public void recalculateNormals(final GeometryArray ga) { if (ga == null) return; if ((ga.getVertexFormat() & GeometryArray.NORMALS) == 0) return; changed = true; final GeometryInfo gi = new GeometryInfo(ga); final NormalGenerator ng = new NormalGenerator(); ng.generateNormals(gi); final GeometryArray tmp = gi.getGeometryArray(); final int v = ga.getValidVertexCount(); final float[] normals = new float[3 * v]; tmp.getNormals(0, normals); ga.setNormals(0, normals); }
ByCopyGeometry(GeometryArray ga, int firstVertex, int validVertexCount) { int i ; positions = new Point3f[validVertexCount] ; for (i = 0 ; i < validVertexCount ; i++) positions[i] = new Point3f() ; ga.getCoordinates(firstVertex, positions) ; if (vertexNormals) { normals = new Vector3f[validVertexCount] ; for (i = 0 ; i < validVertexCount ; i++) normals[i] = new Vector3f() ; ga.getNormals(firstVertex, normals) ; } if (vertexColor3) { colors3 = new Color3f[validVertexCount] ; for (i = 0 ; i < validVertexCount ; i++) colors3[i] = new Color3f() ; ga.getColors(firstVertex, colors3) ; } else if (vertexColor4) { colors4 = new Color4f[validVertexCount] ; for (i = 0 ; i < validVertexCount ; i++) colors4[i] = new Color4f() ; ga.getColors(firstVertex, colors4) ; } }
ByCopyGeometry(GeometryArray ga, int firstVertex, int validVertexCount) { int i ; positions = new Point3f[validVertexCount] ; for (i = 0 ; i < validVertexCount ; i++) positions[i] = new Point3f() ; ga.getCoordinates(firstVertex, positions) ; if (vertexNormals) { normals = new Vector3f[validVertexCount] ; for (i = 0 ; i < validVertexCount ; i++) normals[i] = new Vector3f() ; ga.getNormals(firstVertex, normals) ; } if (vertexColor3) { colors3 = new Color3f[validVertexCount] ; for (i = 0 ; i < validVertexCount ; i++) colors3[i] = new Color3f() ; ga.getColors(firstVertex, colors3) ; } else if (vertexColor4) { colors4 = new Color4f[validVertexCount] ; for (i = 0 ; i < validVertexCount ; i++) colors4[i] = new Color4f() ; ga.getColors(firstVertex, colors4) ; } }
} else { float[] normals = new float[ vertexCount*3 ]; ((GeometryArray)node).getNormals( 0, normals ); writeFloatArray( out, normals );
normals = new Vector3f[valid]; for (i = 0 ; i < valid ; i++) normals[i] = new Vector3f(); geomArray.getNormals(initial, normals);