首页 文章

CullVisitor :: apply(Geode&)检测到NaN,

提问于
浏览
0

运行我的OSG应用程序时,我有以下消息:

CullVisitor::apply(Geode&) detected NaN, 
    depth=nan, center=(1.79588 1.50488 1.42179), 
    matrix={ 
        nan nan -nan -nan 
        nan nan -nan -nan 
        nan nan -nan -nan 
        nan nan -nan -nan 
}

这种警告/错误意味着什么?

提前致谢,

罗慕洛

2 回答

  • 0

    我发现并解决了这个问题!

    当我第一次 grab osg场景时,我的视图矩阵是NaN;从第二次开始,这个矩阵被正确填充 .

    然后我执行检查:如果视图矩阵无效,我将用身份矩阵替换它,如下所示:

    // if the view matrix is invalid (NaN), use the identity
        osg::ref_ptr<osg::Camera> camera = _viewer->getCamera();
        if (camera->getViewMatrix().isNaN())
            camera->setViewMatrix(osg::Matrix::identity());
    
  • 1

    来自http://trac.openscenegraph.org/projects/osg//browser/OpenSceneGraph/trunk/src/osgUtil/CullVisitor.cpp?rev=12829

    我认为这是一个问题,因为 depth .

    RefMatrix& matrix = *getModelViewMatrix();
    ...
        float depth = bb.valid() ? distance(bb.center(),matrix) : 0.0f;
    

    enter image description here

相关问题