diff --git a/examples/osggeometry/osggeometry.cpp b/examples/osggeometry/osggeometry.cpp index 853c5ffcc..adeb61c60 100644 --- a/examples/osggeometry/osggeometry.cpp +++ b/examples/osggeometry/osggeometry.cpp @@ -60,7 +60,7 @@ struct NormalPrint { - void operator() (const osg::Vec3& v1,const osg::Vec3& v2,const osg::Vec3& v3, bool) const + void operator() (const osg::Vec3& v1,const osg::Vec3& v2,const osg::Vec3& v3) const { osg::Vec3 normal = (v2-v1)^(v3-v2); normal.normalize(); diff --git a/include/osg/TriangleFunctor b/include/osg/TriangleFunctor index d342083c8..e8da88110 100644 --- a/include/osg/TriangleFunctor +++ b/include/osg/TriangleFunctor @@ -88,7 +88,7 @@ public: { const Vec3* vlast = &_vertexArrayPtr[first+count]; for(const Vec3* vptr=&_vertexArrayPtr[first];vptroperator()(*(vptr),*(vptr+1),*(vptr+2),false); + this->operator()(*(vptr),*(vptr+1),*(vptr+2)); break; } case(GL_TRIANGLE_STRIP): @@ -96,8 +96,8 @@ public: const Vec3* vptr = &_vertexArrayPtr[first]; for(GLsizei i=2;ioperator()(*(vptr),*(vptr+2),*(vptr+1),false); - else this->operator()(*(vptr),*(vptr+1),*(vptr+2),false); + if ((i%2)) this->operator()(*(vptr),*(vptr+2),*(vptr+1)); + else this->operator()(*(vptr),*(vptr+1),*(vptr+2)); } break; } @@ -106,8 +106,8 @@ public: const Vec3* vptr = &_vertexArrayPtr[first]; for(GLsizei i=3;ioperator()(*(vptr),*(vptr+1),*(vptr+2),false); - this->operator()(*(vptr),*(vptr+2),*(vptr+3),false); + this->operator()(*(vptr),*(vptr+1),*(vptr+2)); + this->operator()(*(vptr),*(vptr+2),*(vptr+3)); } break; } @@ -116,8 +116,8 @@ public: const Vec3* vptr = &_vertexArrayPtr[first]; for(GLsizei i=3;ioperator()(*(vptr),*(vptr+1),*(vptr+2),false); - this->operator()(*(vptr+1),*(vptr+3),*(vptr+2),false); + this->operator()(*(vptr),*(vptr+1),*(vptr+2)); + this->operator()(*(vptr+1),*(vptr+3),*(vptr+2)); } break; } @@ -128,7 +128,7 @@ public: const Vec3* vptr = vfirst+1; for(GLsizei i=2;ioperator()(*(vfirst),*(vptr),*(vptr+1),false); + this->operator()(*(vfirst),*(vptr),*(vptr+1)); } break; } @@ -154,7 +154,7 @@ public: { IndexPointer ilast = &indices[count]; for(IndexPointer iptr=indices;iptroperator()(_vertexArrayPtr[*iptr],_vertexArrayPtr[*(iptr+1)],_vertexArrayPtr[*(iptr+2)],false); + this->operator()(_vertexArrayPtr[*iptr],_vertexArrayPtr[*(iptr+1)],_vertexArrayPtr[*(iptr+2)]); break; } case(GL_TRIANGLE_STRIP): @@ -162,8 +162,8 @@ public: IndexPointer iptr = indices; for(GLsizei i=2;ioperator()(_vertexArrayPtr[*(iptr)],_vertexArrayPtr[*(iptr+2)],_vertexArrayPtr[*(iptr+1)],false); - else this->operator()(_vertexArrayPtr[*(iptr)],_vertexArrayPtr[*(iptr+1)],_vertexArrayPtr[*(iptr+2)],false); + if ((i%2)) this->operator()(_vertexArrayPtr[*(iptr)],_vertexArrayPtr[*(iptr+2)],_vertexArrayPtr[*(iptr+1)]); + else this->operator()(_vertexArrayPtr[*(iptr)],_vertexArrayPtr[*(iptr+1)],_vertexArrayPtr[*(iptr+2)]); } break; } @@ -172,8 +172,8 @@ public: IndexPointer iptr = indices; for(GLsizei i=3;ioperator()(_vertexArrayPtr[*(iptr)],_vertexArrayPtr[*(iptr+1)],_vertexArrayPtr[*(iptr+2)],false); - this->operator()(_vertexArrayPtr[*(iptr)],_vertexArrayPtr[*(iptr+2)],_vertexArrayPtr[*(iptr+3)],false); + this->operator()(_vertexArrayPtr[*(iptr)],_vertexArrayPtr[*(iptr+1)],_vertexArrayPtr[*(iptr+2)]); + this->operator()(_vertexArrayPtr[*(iptr)],_vertexArrayPtr[*(iptr+2)],_vertexArrayPtr[*(iptr+3)]); } break; } @@ -182,8 +182,8 @@ public: IndexPointer iptr = indices; for(GLsizei i=3;ioperator()(_vertexArrayPtr[*(iptr)],_vertexArrayPtr[*(iptr+1)],_vertexArrayPtr[*(iptr+2)],false); - this->operator()(_vertexArrayPtr[*(iptr+1)],_vertexArrayPtr[*(iptr+3)],_vertexArrayPtr[*(iptr+2)],false); + this->operator()(_vertexArrayPtr[*(iptr)],_vertexArrayPtr[*(iptr+1)],_vertexArrayPtr[*(iptr+2)]); + this->operator()(_vertexArrayPtr[*(iptr+1)],_vertexArrayPtr[*(iptr+3)],_vertexArrayPtr[*(iptr+2)]); } break; } @@ -195,7 +195,7 @@ public: ++iptr; for(GLsizei i=2;ioperator()(vfirst,_vertexArrayPtr[*(iptr)],_vertexArrayPtr[*(iptr+1)],false); + this->operator()(vfirst,_vertexArrayPtr[*(iptr)],_vertexArrayPtr[*(iptr+1)]); } break; } @@ -222,7 +222,7 @@ public: IndexPointer ilast = &indices[count]; for(IndexPointer iptr=indices;iptroperator()(_vertexArrayPtr[*iptr],_vertexArrayPtr[*(iptr+1)],_vertexArrayPtr[*(iptr+2)],false); + this->operator()(_vertexArrayPtr[*iptr],_vertexArrayPtr[*(iptr+1)],_vertexArrayPtr[*(iptr+2)]); } break; } @@ -231,8 +231,8 @@ public: IndexPointer iptr = indices; for(GLsizei i=2;ioperator()(_vertexArrayPtr[*(iptr)],_vertexArrayPtr[*(iptr+2)],_vertexArrayPtr[*(iptr+1)],false); - else this->operator()(_vertexArrayPtr[*(iptr)],_vertexArrayPtr[*(iptr+1)],_vertexArrayPtr[*(iptr+2)],false); + if ((i%2)) this->operator()(_vertexArrayPtr[*(iptr)],_vertexArrayPtr[*(iptr+2)],_vertexArrayPtr[*(iptr+1)]); + else this->operator()(_vertexArrayPtr[*(iptr)],_vertexArrayPtr[*(iptr+1)],_vertexArrayPtr[*(iptr+2)]); } break; } @@ -241,8 +241,8 @@ public: IndexPointer iptr = indices; for(GLsizei i=3;ioperator()(_vertexArrayPtr[*(iptr)],_vertexArrayPtr[*(iptr+1)],_vertexArrayPtr[*(iptr+2)],false); - this->operator()(_vertexArrayPtr[*(iptr)],_vertexArrayPtr[*(iptr+2)],_vertexArrayPtr[*(iptr+3)],false); + this->operator()(_vertexArrayPtr[*(iptr)],_vertexArrayPtr[*(iptr+1)],_vertexArrayPtr[*(iptr+2)]); + this->operator()(_vertexArrayPtr[*(iptr)],_vertexArrayPtr[*(iptr+2)],_vertexArrayPtr[*(iptr+3)]); } break; } @@ -251,8 +251,8 @@ public: IndexPointer iptr = indices; for(GLsizei i=3;ioperator()(_vertexArrayPtr[*(iptr)],_vertexArrayPtr[*(iptr+1)],_vertexArrayPtr[*(iptr+2)],false); - this->operator()(_vertexArrayPtr[*(iptr+1)],_vertexArrayPtr[*(iptr+3)],_vertexArrayPtr[*(iptr+2)],false); + this->operator()(_vertexArrayPtr[*(iptr)],_vertexArrayPtr[*(iptr+1)],_vertexArrayPtr[*(iptr+2)]); + this->operator()(_vertexArrayPtr[*(iptr+1)],_vertexArrayPtr[*(iptr+3)],_vertexArrayPtr[*(iptr+2)]); } break; } @@ -264,7 +264,7 @@ public: ++iptr; for(GLsizei i=2;ioperator()(vfirst,_vertexArrayPtr[*(iptr)],_vertexArrayPtr[*(iptr+1)],false); + this->operator()(vfirst,_vertexArrayPtr[*(iptr)],_vertexArrayPtr[*(iptr+1)]); } break; } @@ -290,7 +290,7 @@ public: { IndexPointer ilast = &indices[count]; for(IndexPointer iptr=indices;iptroperator()(_vertexArrayPtr[*iptr],_vertexArrayPtr[*(iptr+1)],_vertexArrayPtr[*(iptr+2)],false); + this->operator()(_vertexArrayPtr[*iptr],_vertexArrayPtr[*(iptr+1)],_vertexArrayPtr[*(iptr+2)]); break; } case(GL_TRIANGLE_STRIP): @@ -298,8 +298,8 @@ public: IndexPointer iptr = indices; for(GLsizei i=2;ioperator()(_vertexArrayPtr[*(iptr)],_vertexArrayPtr[*(iptr+2)],_vertexArrayPtr[*(iptr+1)],false); - else this->operator()(_vertexArrayPtr[*(iptr)],_vertexArrayPtr[*(iptr+1)],_vertexArrayPtr[*(iptr+2)],false); + if ((i%2)) this->operator()(_vertexArrayPtr[*(iptr)],_vertexArrayPtr[*(iptr+2)],_vertexArrayPtr[*(iptr+1)]); + else this->operator()(_vertexArrayPtr[*(iptr)],_vertexArrayPtr[*(iptr+1)],_vertexArrayPtr[*(iptr+2)]); } break; } @@ -308,8 +308,8 @@ public: IndexPointer iptr = indices; for(GLsizei i=3;ioperator()(_vertexArrayPtr[*(iptr)],_vertexArrayPtr[*(iptr+1)],_vertexArrayPtr[*(iptr+2)],false); - this->operator()(_vertexArrayPtr[*(iptr)],_vertexArrayPtr[*(iptr+2)],_vertexArrayPtr[*(iptr+3)],false); + this->operator()(_vertexArrayPtr[*(iptr)],_vertexArrayPtr[*(iptr+1)],_vertexArrayPtr[*(iptr+2)]); + this->operator()(_vertexArrayPtr[*(iptr)],_vertexArrayPtr[*(iptr+2)],_vertexArrayPtr[*(iptr+3)]); } break; } @@ -318,8 +318,8 @@ public: IndexPointer iptr = indices; for(GLsizei i=3;ioperator()(_vertexArrayPtr[*(iptr)],_vertexArrayPtr[*(iptr+1)],_vertexArrayPtr[*(iptr+2)],false); - this->operator()(_vertexArrayPtr[*(iptr+1)],_vertexArrayPtr[*(iptr+3)],_vertexArrayPtr[*(iptr+2)],false); + this->operator()(_vertexArrayPtr[*(iptr)],_vertexArrayPtr[*(iptr+1)],_vertexArrayPtr[*(iptr+2)]); + this->operator()(_vertexArrayPtr[*(iptr+1)],_vertexArrayPtr[*(iptr+3)],_vertexArrayPtr[*(iptr+2)]); } break; } @@ -331,7 +331,7 @@ public: ++iptr; for(GLsizei i=2;ioperator()(vfirst,_vertexArrayPtr[*(iptr)],_vertexArrayPtr[*(iptr+1)],false); + this->operator()(vfirst,_vertexArrayPtr[*(iptr)],_vertexArrayPtr[*(iptr+1)]); } break; } @@ -352,7 +352,6 @@ protected: const Vec3* _vertexArrayPtr; }; - } #endif diff --git a/src/osg/ClusterCullingCallback.cpp b/src/osg/ClusterCullingCallback.cpp index b0b620bea..1a5494766 100644 --- a/src/osg/ClusterCullingCallback.cpp +++ b/src/osg/ClusterCullingCallback.cpp @@ -59,7 +59,7 @@ struct ComputeAveragesFunctor ComputeAveragesFunctor(): _num(0) {} - inline void operator() ( const osg::Vec3 &v1, const osg::Vec3 &v2, const osg::Vec3 &v3, bool) + inline void operator() ( const osg::Vec3 &v1, const osg::Vec3 &v2, const osg::Vec3 &v3) { // calc orientation of triangle. osg::Vec3d normal = (v2-v1)^(v3-v1); @@ -96,7 +96,7 @@ struct ComputeDeviationFunctor _normal = normal; } - inline void operator() ( const osg::Vec3 &v1, const osg::Vec3 &v2, const osg::Vec3 &v3, bool) + inline void operator() ( const osg::Vec3 &v1, const osg::Vec3 &v2, const osg::Vec3 &v3) { // calc orientation of triangle. osg::Vec3 normal = (v2-v1)^(v3-v1); diff --git a/src/osgPlugins/ogr/ReaderWriterOGR.cpp b/src/osgPlugins/ogr/ReaderWriterOGR.cpp index b3e81ec7f..5fed4aaea 100644 --- a/src/osgPlugins/ogr/ReaderWriterOGR.cpp +++ b/src/osgPlugins/ogr/ReaderWriterOGR.cpp @@ -71,7 +71,7 @@ struct TriangulizeFunctor osg::Vec3Array* _vertexes; // do nothing - void operator ()(const osg::Vec3& v1, const osg::Vec3& v2, const osg::Vec3& v3, bool /*treatVertexDataAsTemporary*/) + void operator ()(const osg::Vec3& v1, const osg::Vec3& v2, const osg::Vec3& v3) { _vertexes->push_back(v1); _vertexes->push_back(v2); diff --git a/src/osgPlugins/stl/ReaderWriterSTL.cpp b/src/osgPlugins/stl/ReaderWriterSTL.cpp index 92aed56fd..b9697f1de 100644 --- a/src/osgPlugins/stl/ReaderWriterSTL.cpp +++ b/src/osgPlugins/stl/ReaderWriterSTL.cpp @@ -347,7 +347,7 @@ private: osg::Matrix m_mat; bool m_dontSaveNormals; - inline void operator () (const osg::Vec3& _v1, const osg::Vec3& _v2, const osg::Vec3& _v3, bool /*treatVertexDataAsTemporary*/) + inline void operator () (const osg::Vec3& _v1, const osg::Vec3& _v2, const osg::Vec3& _v3) { osg::Vec3 v1 = _v1 * m_mat; osg::Vec3 v2 = _v2 * m_mat; diff --git a/src/osgShadow/OccluderGeometry.cpp b/src/osgShadow/OccluderGeometry.cpp index 4189f0f12..4266ec517 100644 --- a/src/osgShadow/OccluderGeometry.cpp +++ b/src/osgShadow/OccluderGeometry.cpp @@ -189,24 +189,12 @@ struct TriangleCollector // bool intersect(const Vec3& v1,const Vec3& v2,const Vec3& v3,float& r) - inline void operator () (const osg::Vec3& v1,const osg::Vec3& v2,const osg::Vec3& v3, bool treatVertexDataAsTemporary) + inline void operator () (const osg::Vec3& v1,const osg::Vec3& v2,const osg::Vec3& v3) { - if (treatVertexDataAsTemporary) - { - // OSG_NOTICE<<"Triangle temp ("<(r,TriangleHit(_index-1,normal,r1,0,r2,0,r3,0))); - } - else - { - _thl.insert(std::pair(r,TriangleHit(_index-1,normal,r1,&v1,r2,&v2,r3,&v3))); - } + _thl.insert(std::pair(r,TriangleHit(_index-1,normal,r1,&v1,r2,&v2,r3,&v3))); _hit = true; } diff --git a/src/osgUtil/LineSegmentIntersector.cpp b/src/osgUtil/LineSegmentIntersector.cpp index 2ae8ba0f7..2d0d651ca 100644 --- a/src/osgUtil/LineSegmentIntersector.cpp +++ b/src/osgUtil/LineSegmentIntersector.cpp @@ -95,7 +95,7 @@ namespace LineSegmentIntersectorUtils _d /= _length; } - inline void operator () (const osg::Vec3& v1,const osg::Vec3& v2,const osg::Vec3& v3, bool treatVertexDataAsTemporary) + inline void operator () (const osg::Vec3& v1,const osg::Vec3& v2,const osg::Vec3& v3) { ++_index; @@ -194,14 +194,7 @@ namespace LineSegmentIntersectorUtils value_type r = d/_length; - if (treatVertexDataAsTemporary) - { - _intersections->insert(std::pair(r,TriangleIntersection(_index-1,normal,r1,0,r2,0,r3,0))); - } - else - { - _intersections->insert(std::pair(r,TriangleIntersection(_index-1,normal,r1,&v1,r2,&v2,r3,&v3))); - } + _intersections->insert(std::pair(r,TriangleIntersection(_index-1,normal,r1,&v1,r2,&v2,r3,&v3))); _hit = true; } diff --git a/src/osgUtil/PlaneIntersector.cpp b/src/osgUtil/PlaneIntersector.cpp index 4469b403c..152896660 100644 --- a/src/osgUtil/PlaneIntersector.cpp +++ b/src/osgUtil/PlaneIntersector.cpp @@ -437,7 +437,7 @@ namespace PlaneIntersectorUtils } } - inline void operator () (const osg::Vec3& v1,const osg::Vec3& v2,const osg::Vec3& v3, bool) + inline void operator () (const osg::Vec3& v1,const osg::Vec3& v2,const osg::Vec3& v3) { if (_limitOneIntersection && _hit) return; diff --git a/src/osgUtil/SmoothingVisitor.cpp b/src/osgUtil/SmoothingVisitor.cpp index 89eeb45b5..9c72c874a 100644 --- a/src/osgUtil/SmoothingVisitor.cpp +++ b/src/osgUtil/SmoothingVisitor.cpp @@ -76,19 +76,15 @@ struct SmoothTriangleFunctor } } - inline void operator() ( const osg::Vec3 &v1, const osg::Vec3 &v2, const osg::Vec3 &v3, bool treatVertexDataAsTemporary ) + inline void operator() ( const osg::Vec3 &v1, const osg::Vec3 &v2, const osg::Vec3 &v3) { - if (!treatVertexDataAsTemporary) - { - // calc orientation of triangle. - osg::Vec3 normal = (v2-v1)^(v3-v1); - // normal.normalize(); - - updateNormal(normal,&v1); - updateNormal(normal,&v2); - updateNormal(normal,&v3); - } + // calc orientation of triangle. + osg::Vec3 normal = (v2-v1)^(v3-v1); + // normal.normalize(); + updateNormal(normal,&v1); + updateNormal(normal,&v2); + updateNormal(normal,&v3); } };