Added the beginnings of a new osgforest example.

Added support into osg::TriangleFunctor for specifying whether the vertices
being generates are temporary or not.
This commit is contained in:
Robert Osfield
2003-09-25 21:54:33 +00:00
parent 16216b991f
commit 7fb9f6be4b
16 changed files with 750 additions and 69 deletions

View File

@@ -369,7 +369,7 @@ struct TriangleIntersect
}
// bool intersect(const Vec3& v1,const Vec3& v2,const Vec3& v3,float& r)
inline void operator () (const Vec3& v1,const Vec3& v2,const Vec3& v3)
inline void operator () (const Vec3& v1,const Vec3& v2,const Vec3& v3, bool treatVertexDataAsTemporary)
{
++_index;
@@ -465,8 +465,15 @@ struct TriangleIntersect
osg::notify(WARN)<<" ("<<r1<<",\t"<<r2<<",\t"<<r3<<")"<<std::endl;
return;
}
_thl.insert(std::pair<const float,TriangleHit>(r,TriangleHit(_index-1,normal,r1,&v1,r2,&v2,r3,&v3)));
if (treatVertexDataAsTemporary)
{
_thl.insert(std::pair<const float,TriangleHit>(r,TriangleHit(_index-1,normal,r1,0,r2,0,r3,0)));
}
else
{
_thl.insert(std::pair<const float,TriangleHit>(r,TriangleHit(_index-1,normal,r1,&v1,r2,&v2,r3,&v3)));
}
_hit = true;
}