Class NonIndexedNormalGenerator

java.lang.Object
com.ardor3d.util.geom.NonIndexedNormalGenerator

public class NonIndexedNormalGenerator extends Object
A utility class to generate normals for a set of vertices. The triangles must be defined by just the vertices, so that every 3 consecutive vertices define one triangle. However, an index array must be specified to identify identical vertices properly (see method generateNormals(double[], int[], double). If the index aray is not specified, the vertex normals are currently simply taken from the faces they belong to (this might be changed in the future, so that vertices are compared by their values).
  • Constructor Details

    • NonIndexedNormalGenerator

      public NonIndexedNormalGenerator()
  • Method Details

    • generateNormals

      public double[] generateNormals(double[] vertices, int[] indices, double creaseAngle)
      Calculates the normals for a set of faces determined by the specified vertices. Every 3 consecutive vertices define one triangle.
      Please note: This method uses class fields and is not synchronized! Therefore it should only be called from a single thread, unless synchronization is taken care of externally.
      Parameters:
      vertices - The vertex coordinates. Every three values define one vertex
      indices - An array containing int values. Each value belongs to one vertex in the vertices array, the values are stored in the same order as the vertices. For equal vertices in the vertices array, the indices are also equal.
      creaseAngle - The maximum angle in radians between faces to which normals between the faces are interpolated to create a smooth transition
      Returns:
      An array containing the generated normals for the geometry
    • generateNormals

      public void generateNormals(Mesh mesh)