com.jme.util.geom
Class NormalGenerator

java.lang.Object
  extended by com.jme.util.geom.NormalGenerator

public class NormalGenerator
extends java.lang.Object

A utility class to generate normals for TriMeshes.

The generator generates the normals using a given crease angle up to which the transitions between two triangles are to be smoothed. Normals will be generated for the mesh, as long as it uses the default triangle mode (TRIANGLE) - the modes TRIANGLE_FAN and TRIANGLE_STRIP are not supported.

The generator currently only supports a single set of texture coordinates in a mesh. If more than one set of texture coordinates is specified in a mesh, all sets after the first one will be deleted.

Please note: The mesh must be manifold, i.e. only 2 triangles may be connected by one edge, and the mesh has to be connected by means of edges, not vertices. Otherwise, the normal generation might fail, with undefined results.

Version:
2008-03-11
Author:
Michael Sattler

Constructor Summary
NormalGenerator()
           
 
Method Summary
 void generateNormals(TriMesh mesh, float creaseAngle)
          Generates the normals for one TriMesh, using the specified crease angle.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NormalGenerator

public NormalGenerator()
Method Detail

generateNormals

public void generateNormals(TriMesh mesh,
                            float creaseAngle)
Generates the normals for one TriMesh, using the specified crease angle.

Parameters:
mesh - The TriMesh to generate the normals for
creaseAngle - The angle between two triangles up to which the normal between the two triangles will be interpolated, creating a smooth transition