|
楼主 |
发表于 2010-7-12 11:44:46
|
显示全部楼层
以下是发生错误是的调用堆栈
> osg55-osgUtild.dll!osg::Vec3f:perator==(const osg::Vec3f & v={...}) 行50 + 0x1a 字节 C++
osg55-osgUtild.dll!LineSegmentIntersectorUtils::TriangleIntersector::operator()(const osg::Vec3f & v1={...}, const osg::Vec3f &
v2={...}, const osg::Vec3f & v3={...}, bool treatVertexDataAsTemporary=false) 行93 + 0xc 字节 C++
osg55-osgUtild.dll!osg::TriangleFunctor<LineSegmentIntersectorUtils::TriangleIntersector>::drawElements(unsigned int
mode=0x00000008, int count=0x00000200, const unsigned int * indices=0x06f2bb28) 行327 C++
osg55-osgd.dll!osg:rawElementsUInt::accept(osg:rimitiveFunctor & functor={...}) 行251 + 0x40 字节 C++
osg55-osgd.dll!osg::Geometry::accept(osg::PrimitiveFunctor & functor={...}) 行2241 + 0x2e 字节 C++
osg55-osgUtild.dll!osgUtil:ineSegmentIntersector::intersect(osgUtil::IntersectionVisitor & iv={...}, osg::Drawable *
drawable=0x06f35d80) 行357 + 0x16 字节 C++
osg55-osgUtild.dll!osgUtil::IntersectionVisitor::intersect(osg::Drawable * drawable=0x06f35d80) 行245 + 0x44 字节 C++
osg55-osgUtild.dll!osgUtil::IntersectionVisitor::apply(osg::Geode & geode={...}) 行237 C++
osg55-osgd.dll!osg::Geode::accept(osg::NodeVisitor & nv={...}) 行39 + 0x41 字节 C++
osg55-osgd.dll!osg::Group::traverse(osg::NodeVisitor & nv={...}) 行62 + 0x25 字节 C++
osg55-osgd.dll!osg::NodeVisitor::traverse(osg::Node & node={...}) 行191 + 0x1c 字节 C++
osg55-osgUtild.dll!osgUtil::IntersectionVisitor::apply(osg::Transform & transform={...}) 行400 + 0xf 字节 C++
osg55-osgd.dll!osg::NodeVisitor::apply(osg::MatrixTransform & node={...}) 行136 + 0x13 字节 C++
osg55-osgd.dll!osg::MatrixTransform::accept(osg::NodeVisitor & nv={...}) 行37 + 0x41 字节 C++
osg55-osgd.dll!osg::Group::traverse(osg::NodeVisitor & nv={...}) 行62 + 0x25 字节 C++
osg55-osgd.dll!osg::NodeVisitor::traverse(osg::Node & node={...}) 行191 + 0x1c 字节 C++
osg55-osgUtild.dll!osgUtil::IntersectionVisitor::apply(osg::Transform & transform={...}) 行400 + 0xf 字节 C++
osg55-osgd.dll!osg::NodeVisitor::apply(osg::MatrixTransform & node={...}) 行136 + 0x13 字节 C++
osg55-osgd.dll!osg::MatrixTransform::accept(osg::NodeVisitor & nv={...}) 行37 + 0x41 字节 C++
osg55-osgd.dll!osg::Group::traverse(osg::NodeVisitor & nv={...}) 行62 + 0x25 字节 C++
osg55-osgd.dll!osg::NodeVisitor::traverse(osg::Node & node={...}) 行191 + 0x1c 字节 C++
osg55-osgUtild.dll!osgUtil::IntersectionVisitor::apply(osg::Transform & transform={...}) 行400 + 0xf 字节 C++
osg55-osgd.dll!osg::NodeVisitor::apply(osg::MatrixTransform & node={...}) 行136 + 0x13 字节 C++
osg55-osgd.dll!osg::MatrixTransform::accept(osg::NodeVisitor & nv={...}) 行37 + 0x41 字节 C++
osg55-osgd.dll!osg::Group::traverse(osg::NodeVisitor & nv={...}) 行62 + 0x25 字节 C++
osg55-osgd.dll!osg::NodeVisitor::traverse(osg::Node & node={...}) 行191 + 0x1c 字节 C++
osg55-osgUtild.dll!osgUtil::IntersectionVisitor::apply(osg::Camera & camera={...}) 行476 + 0xf 字节 C++
osg55-osgd.dll!osg::Camera::accept(osg::NodeVisitor & nv={...}) 行46 + 0x41 字节 C++
TzScene.dll!CScene::PickModel(long lParam=0x011401cd, NodeAttributeMask mask=NodeAttAll, SceneObjectType *
objtype=0x0012e4b8) 行1193 + 0x3a 字节 C++
TzScene.dll!CScene::OnLButtonDown(unsigned int wParam=0x00000001, long lParam=0x011401cd) 行1239 + 0x15 字节
C++
TE_ActiveX.dll!CSceneControl::OnLButtonDown(unsigned int __formal=0x00000201, unsigned int wParam=0x00000001, long
lParam=0x011401cd, unsigned int __formal=0x00000201) 行108 + 0x35 字节 C++
TE_ActiveX.dll!CSceneControl::ProcessWindowMessage(HWND__ * hWnd=0x0004114c, unsigned int uMsg=0x00000201,
unsigned int wParam=0x00000001, long lParam=0x011401cd, long & lResult=0xcccccccc, unsigned long dwMsgMapID=0x00000000) 行
159 + 0x2e 字节 C++
TE_ActiveX.dll!ATL::CWindowImplBaseT<ATL::CWindow,ATL::CWinTraits<1442840576,0> >::WindowProc(HWND__ *
hWnd=0x05615b54, unsigned int uMsg=0x00000201, unsigned int wParam=0x00000001, long lParam=0x011401cd) 行3073 + 0x27 字
节 C++
出错时的语句为:
inline bool operator == (const Vec3f& v) const { return _v[0]==v._v[0] && _v[1]==v._v[1] && _v[2]==v._v[2]; }
此时:this 与 v._v 都为空指针
从上面可以看出osg相交检测的执行过程,首先IntersectionVisitor对Camera下的所有(mask 匹配的)节点遍历, 当发现
是Geode节点时,则对Geode中包含的Geometry的所有图元进行相交检测, 我的图元类型是矩形带(GL_QUAD_STRIP), 所以osg对
组成矩形的两个三角形进行相交检测,正如osg::TriangleFunctor::drawElements中的代码(292行)
case(GL_QUADS):
{
IndexPointer iptr = indices;
for(GLsizei i=3;i<count;i+=4,iptr+=4)
{
this->operator()(_vertexArrayPtr[*(iptr)],_vertexArrayPtr[*(iptr+1)],_vertexArrayPtr[*(iptr+2)],_treatVertexDataAsTemporary);
this->operator()(_vertexArrayPtr[*(iptr)],_vertexArrayPtr[*(iptr+2)],_vertexArrayPtr[*(iptr+3)],_treatVertexDataAsTemporary);
}
break;
}
可是当引用组成图元的顶点时为什么是无效的数据呢?如果真的无效,那为什么又能正常显示呢?多谢指点。 |
|