Added basic silhoette detection

This commit is contained in:
Robert Osfield
2006-11-23 11:22:49 +00:00
parent 675e4a2cde
commit 156cf1e97f
2 changed files with 95 additions and 13 deletions

View File

@@ -128,12 +128,18 @@ class OSGSHADOW_EXPORT OccluderGeometry : public osg::Drawable
virtual ~OccluderGeometry() {}
inline bool isSilhouetteEdge(const osg::Vec3& lightpos, const Edge& edge) const
inline float testLightPointSilhouetteEdge(const osg::Vec3& lightpos, const Edge& edge) const
{
osg::Vec3 delta(lightpos-_vertices[edge._p1]);
return ( delta * _triangleNormals[edge._t1] ) *
( delta * _triangleNormals[edge._t2] );
}
inline float testLightDirectionSilhouetteEdge(const osg::Vec3& lightdirection, const Edge& edge) const
{
return ( lightdirection * _triangleNormals[edge._t1] ) *
( lightdirection * _triangleNormals[edge._t2] );
}
void setUpInternalStructures();
@@ -141,6 +147,9 @@ class OSGSHADOW_EXPORT OccluderGeometry : public osg::Drawable
void removeNullTriangles();
void computeNormals();
void buildEdgeMaps();
void computeLightPointSlihouetteEdges(const osg::Vec3& lightpos);
void computeLightDirectionSlihouetteEdges(const osg::Vec3& lightdirection);
Vec3List _vertices;
Vec3List _normals;
@@ -149,7 +158,7 @@ class OSGSHADOW_EXPORT OccluderGeometry : public osg::Drawable
PointList _points;
EdgeList _edges;
UIntList _silhouetteIndices;
};
}