public class NormalGenerator
extends java.lang.Object
If two (or more) triangles in the model share the same coordinate index then the normal generator will attempt to generate one normal for the vertex, resulting in a "smooth" looking surface. If two coordinates don't have the same index then they will have two separate normals, even if they have the same position. This will result in a "crease" in your object. If you suspect that your data isn't properly indexed, call GeometryInfo.recomputeIndexes().
Of course, sometimes your model *has* a crease in it. That's what creaseAngle is. If two triangles' normals differ by more than creaseAngle, then the vertex will get two separate normals, creating a discontinuous crease in the model. This is perfect for the edge of a table or the corner of a cube, for instance.
| Modifier and Type | Field and Description |
|---|---|
private int[] |
colorInds |
private int[] |
coordInds |
private double |
creaseAngle |
private static int |
DEBUG |
private Vector3f[] |
facetNorms |
private GeometryInfo |
gi |
private int[] |
normalInds |
private int |
numTexSets |
private int[] |
stripCounts |
private static long |
t1 |
private static long |
t2 |
private static long |
t3 |
private static long |
t4 |
private static long |
t5 |
private static long |
t6 |
private java.util.ArrayList |
tally |
private int[][] |
texInds |
private Triangulator |
tr |
| Constructor and Description |
|---|
NormalGenerator()
Constructor.
|
NormalGenerator(double radians)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
private void |
calculatefacetNorms() |
private void |
calculateVertexNormals(int maxShare) |
(package private) void |
convertBackToOldPrim(GeometryInfo geom,
int oldPrim,
int[] oldStripCounts)
Used when the user calls the NormalGenerator and not
the Stripifier or Triangulator.
|
private void |
convertTriToFan(GeometryInfo geom,
int[] oldStripCounts) |
private void |
convertTriToQuad(GeometryInfo geom) |
private void |
convertTriToStrip(GeometryInfo geom,
int[] oldStripCounts) |
private int |
createHardEdges() |
void |
generateNormals(GeometryInfo geom)
Generate normals for the GeometryInfo object.
|
double |
getCreaseAngle()
Returns the current value of the crease angle, in radians.
|
void |
setCreaseAngle(double radians)
Set the crease angle.
|
private int[] |
triToFanIndices(int[] sc,
int[] oldList,
int numVerts) |
private int[] |
triToQuadIndices(int[] oldList) |
private int[] |
triToStripIndices(int[] sc,
int[] oldList,
int numVerts) |
private double creaseAngle
private Vector3f[] facetNorms
private java.util.ArrayList tally
private GeometryInfo gi
private int[] coordInds
private int[] normalInds
private int[] colorInds
private int[][] texInds
private int[] stripCounts
private static long t1
private static long t2
private static long t3
private static long t4
private static long t5
private static long t6
private Triangulator tr
private int numTexSets
private static final int DEBUG
public NormalGenerator(double radians)
public NormalGenerator()
private void calculatefacetNorms()
private int createHardEdges()
private void calculateVertexNormals(int maxShare)
private int[] triToQuadIndices(int[] oldList)
private void convertTriToQuad(GeometryInfo geom)
private int[] triToFanIndices(int[] sc,
int[] oldList,
int numVerts)
private void convertTriToFan(GeometryInfo geom, int[] oldStripCounts)
private int[] triToStripIndices(int[] sc,
int[] oldList,
int numVerts)
private void convertTriToStrip(GeometryInfo geom, int[] oldStripCounts)
void convertBackToOldPrim(GeometryInfo geom, int oldPrim, int[] oldStripCounts)
public void generateNormals(GeometryInfo geom)
public void setCreaseAngle(double radians)
public double getCreaseAngle()
Copyright 1996-2008 Sun Microsystems, Inc. All Rights Reserved. Use is subject to license terms.