Changeset 1883 for OpenSceneGraph/trunk/examples/osgpick/osgpick.cpp
- Timestamp:
- 04/16/03 11:22:33 (10 years ago)
- Files:
-
- 1 modified
-
OpenSceneGraph/trunk/examples/osgpick/osgpick.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/examples/osgpick/osgpick.cpp
r1882 r1883 126 126 Producer::RenderSurface* rs = cmm->getRenderSurface(); 127 127 128 std::cout << "checking camara "<<i<<std::endl;128 //std::cout << "checking camara "<<i<<std::endl; 129 129 130 130 float pixel_x,pixel_y; 131 131 if (km->computePixelCoords(x,y,rs,pixel_x,pixel_y)) 132 132 { 133 std::cout << " compute pixel coords "<<pixel_x<<" "<<pixel_y<<std::endl;133 //std::cout << " compute pixel coords "<<pixel_x<<" "<<pixel_y<<std::endl; 134 134 135 135 int pr_wx, pr_wy; … … 144 144 pr_wy += rs_wy; 145 145 146 std::cout << " wx = "<<pr_wx<<" wy = "<<pr_wy<<" width="<<pr_width<<" height="<<pr_height<<std::endl;146 //std::cout << " wx = "<<pr_wx<<" wy = "<<pr_wy<<" width="<<pr_width<<" height="<<pr_height<<std::endl; 147 147 148 148 … … 158 158 float ry = 2.0f*(pixel_y - (float)pr_wy)/(float)pr_height-1.0f; 159 159 160 std::cout << " rx "<<rx<<" "<<ry<<std::endl; 161 162 osg::Matrix vum(osg::Matrix(cmm->getViewMatrix()) * 163 osg::Matrix(cmm->getProjectionMatrix())/* * 164 osg::Matrix::translate(1.0f,1.0f,1.0f) * 165 osg::Matrix::scale(0.5f,0.5f,0.5f)*/); 166 160 //std::cout << " rx "<<rx<<" "<<ry<<std::endl; 161 162 osgProducer::OsgSceneHandler* sh = dynamic_cast<osgProducer::OsgSceneHandler*>(cmm->getSceneHandler()); 163 osg::Matrix vum; 164 if (sh!=0 && sh->getModelViewMatrix()!=0 && sh->getProjectionMatrix()!=0) 165 { 166 vum.set((*(sh->getModelViewMatrix())) * 167 (*(sh->getProjectionMatrix()))); 168 } 169 else 170 { 171 vum.set(osg::Matrix(cmm->getViewMatrix()) * 172 osg::Matrix(cmm->getProjectionMatrix())/* * 173 osg::Matrix::translate(1.0f,1.0f,1.0f) * 174 osg::Matrix::scale(0.5f,0.5f,0.5f)*/); 175 } 176 167 177 osgUtil::PickVisitor iv; 168 178 osgUtil::IntersectVisitor::HitList& hlist=iv.getHits(scene, vum, rx,ry);
