public UpdateTriangleLightFacing ( Vector4 lightPos ) : void | ||
lightPos | Vector4 | /// 4D position of the light in object space, note that /// for directional lights (which have no position), the w component /// is 0 and the x/y/z position are the direction. /// |
return | void |
public void UpdateTriangleLightFacing( Vector4 lightPos )
{
for ( int i = 0; i < triangles.Count; i++ )
{
Triangle tri = (Triangle)triangles[ i ];
float dot = tri.normal.Dot( lightPos );
tri.lightFacing = ( dot > 0 );
}
}
/// <summary> /// Tells the caster to perform the tasks necessary to update the /// edge data's light listing. Can be overridden if the subclass needs /// to do additional things. /// </summary> /// <param name="edgeData">The edge information to update.</param> /// <param name="lightPosition">4D vector representing the light, a directional light has w=0.0.</param> protected virtual void UpdateEdgeListLightFacing( EdgeData edgeData, Vector4 lightPosition ) { edgeData.UpdateTriangleLightFacing( lightPosition ); }