diff --git a/examples/osgkeyboardmouse/osgkeyboardmouse.cpp b/examples/osgkeyboardmouse/osgkeyboardmouse.cpp index 90651ad9a..98970ad74 100644 --- a/examples/osgkeyboardmouse/osgkeyboardmouse.cpp +++ b/examples/osgkeyboardmouse/osgkeyboardmouse.cpp @@ -468,7 +468,7 @@ int main( int argc, char **argv ) if (useKdTree) { - OSG_NOTICE<<"Buildering KdTrees"< builder = new osg::KdTreeBuilder; loadedModel->accept(*builder); } diff --git a/include/osg/KdTree b/include/osg/KdTree index 25eca0954..12279334e 100644 --- a/include/osg/KdTree +++ b/include/osg/KdTree @@ -158,9 +158,9 @@ class OSG_EXPORT KdTree : public osg::Shape switch(numVertices) { case(1): functor.intersect(_vertices.get(), i, _vertexIndices[primitiveIndex]); break; - case(2): functor.intersect(_vertices.get(), i, _vertexIndices[primitiveIndex], _vertexIndices[primitiveIndex]+1); break; - case(3): functor.intersect(_vertices.get(), i, _vertexIndices[primitiveIndex], _vertexIndices[primitiveIndex]+1, _vertexIndices[primitiveIndex]+2); break; - case(4): functor.intersect(_vertices.get(), i, _vertexIndices[primitiveIndex], _vertexIndices[primitiveIndex]+1, _vertexIndices[primitiveIndex]+2, _vertexIndices[primitiveIndex]+3); break; + case(2): functor.intersect(_vertices.get(), i, _vertexIndices[primitiveIndex], _vertexIndices[primitiveIndex+1]); break; + case(3): functor.intersect(_vertices.get(), i, _vertexIndices[primitiveIndex], _vertexIndices[primitiveIndex+1], _vertexIndices[primitiveIndex+2]); break; + case(4): functor.intersect(_vertices.get(), i, _vertexIndices[primitiveIndex], _vertexIndices[primitiveIndex+1], _vertexIndices[primitiveIndex+2], _vertexIndices[primitiveIndex+3]); break; default : OSG_NOTICE<<"Warning: KdTree::intersect() encounted unsupported primitive size of "<_kdTree.getVertices()))[p0]; _buildKdTree->_kdTree.addPoint(p0); @@ -78,7 +78,7 @@ struct PrimitiveIndicesCollector inline void operator () (unsigned int p0, unsigned int p1) { - OSG_NOTICE<<" line ("<_kdTree.getVertices()))[p0]; const osg::Vec3& v1 = (*(_buildKdTree->_kdTree.getVertices()))[p1]; @@ -127,7 +127,7 @@ struct PrimitiveIndicesCollector inline void operator () (unsigned int p0, unsigned int p1, unsigned int p2, unsigned int p3) { - OSG_NOTICE<<" quad ("<_kdTree.getVertices()))[p0]; const osg::Vec3& v1 = (*(_buildKdTree->_kdTree.getVertices()))[p1]; @@ -207,7 +207,6 @@ bool BuildKdTree::build(KdTree::BuildOptions& options, osg::Geometry* geometry) osg::BoundingBox bb = _bb; nodeNum = divide(options, bb, nodeNum, 0); - OSG_NOTICE<<"After KdTree setup"<_vertices.valid()) @@ -375,35 +368,31 @@ struct IntersectFunctor intersect(v1,v2,v3); } - bool intersect(const osg::Vec3Array*, int , unsigned int) + void intersect(const osg::Vec3Array*, int , unsigned int) { - return false; } - bool intersect(const osg::Vec3Array*, int, unsigned int, unsigned int) + void intersect(const osg::Vec3Array*, int, unsigned int, unsigned int) { - return false; } - bool intersect(const osg::Vec3Array* vertices, int primitiveIndex, unsigned int p0, unsigned int p1, unsigned int p2) + void intersect(const osg::Vec3Array* vertices, int primitiveIndex, unsigned int p0, unsigned int p1, unsigned int p2) { - if (_settings->_limitOneIntersection && _hit) return false; + if (_settings->_limitOneIntersection && _hit) return; _primitiveIndex = primitiveIndex; intersect((*vertices)[p0], (*vertices)[p1], (*vertices)[p2]); - return false; } - bool intersect(const osg::Vec3Array* vertices, int primitiveIndex, unsigned int p0, unsigned int p1, unsigned int p2, unsigned int p3) + void intersect(const osg::Vec3Array* vertices, int primitiveIndex, unsigned int p0, unsigned int p1, unsigned int p2, unsigned int p3) { - if (_settings->_limitOneIntersection && _hit) return false; + if (_settings->_limitOneIntersection && _hit) return; _primitiveIndex = primitiveIndex; intersect((*vertices)[p0], (*vertices)[p1], (*vertices)[p3]); intersect((*vertices)[p1], (*vertices)[p2], (*vertices)[p3]); - return false; } }; diff --git a/src/osgUtil/PolytopeIntersector.cpp b/src/osgUtil/PolytopeIntersector.cpp index a8d07fae0..14ed5e3a9 100644 --- a/src/osgUtil/PolytopeIntersector.cpp +++ b/src/osgUtil/PolytopeIntersector.cpp @@ -339,75 +339,51 @@ struct IntersectFunctor } } - bool intersect(const osg::Vec3Array* vertices, int primitiveIndex, unsigned int p0) + void intersect(const osg::Vec3Array* vertices, int primitiveIndex, unsigned int p0) { - if (_settings->_limitOneIntersection && _hit) return false; + if (_settings->_limitOneIntersection && _hit) return; if (contains((*vertices)[p0])) { _primitiveIndex = primitiveIndex; addIntersection(); - - return true; - } - else - { - return false; } } - bool intersect(const osg::Vec3Array* vertices, int primitiveIndex, unsigned int p0, unsigned int p1) + void intersect(const osg::Vec3Array* vertices, int primitiveIndex, unsigned int p0, unsigned int p1) { - if (_settings->_limitOneIntersection && _hit) return false; + if (_settings->_limitOneIntersection && _hit) return; if (contains((*vertices)[p0], (*vertices)[p1])) { _primitiveIndex = primitiveIndex; addIntersection(); - - return true; - } - else - { - return false; } } - bool intersect(const osg::Vec3Array* vertices, int primitiveIndex, unsigned int p0, unsigned int p1, unsigned int p2) + void intersect(const osg::Vec3Array* vertices, int primitiveIndex, unsigned int p0, unsigned int p1, unsigned int p2) { - if (_settings->_limitOneIntersection && _hit) return false; + if (_settings->_limitOneIntersection && _hit) return; if (contains((*vertices)[p0], (*vertices)[p1], (*vertices)[p2])) { _primitiveIndex = primitiveIndex; addIntersection(); - - return true; - } - else - { - return false; } } - bool intersect(const osg::Vec3Array* vertices, int primitiveIndex, unsigned int p0, unsigned int p1, unsigned int p2, unsigned int p3) + void intersect(const osg::Vec3Array* vertices, int primitiveIndex, unsigned int p0, unsigned int p1, unsigned int p2, unsigned int p3) { - if (_settings->_limitOneIntersection && _hit) return false; + if (_settings->_limitOneIntersection && _hit) return; if (contains((*vertices)[p0], (*vertices)[p1], (*vertices)[p2], (*vertices)[p3])) { _primitiveIndex = primitiveIndex; addIntersection(); - - return true; - } - else - { - return false; } }