for (Mesh mesh : meshes) { float[] vertexTable = BufferUtils.getFloatArray(mesh.getFloatBuffer(Type.Position)); float[] normalTable = BufferUtils.getFloatArray(mesh.getFloatBuffer(Type.Normal));
inputData = BufferUtils.getFloatArray(mesh.getFloatBuffer(VertexBuffer.Type.Position)); break; case TEXCO_UV: inputData = BufferUtils.getFloatArray(mesh.getFloatBuffer(VertexBuffer.Type.Normal)); break; case TEXCO_REFL:
inputData = BufferUtils.getFloatArray(mesh.getFloatBuffer(VertexBuffer.Type.Position)); break; case TEXCO_UV:// this should be used if not defined by user explicitly inputData = BufferUtils.getFloatArray(mesh.getFloatBuffer(VertexBuffer.Type.Normal)); break; case TEXCO_REFL:
VertexBuffer vb = sphere.getBuffer(Type.Position); FloatBuffer fb = (FloatBuffer) vb.getData(); float[] uvCoordinates = BufferUtils.getFloatArray(fb);
public static FloatBuffer merge(FloatBuffer f1, FloatBuffer f2) { if (f1 == null) return f2; if (f2 == null) return f1; return BufferUtils.createFloatBuffer(merge(BufferUtils.getFloatArray(f1), BufferUtils.getFloatArray(f2))); }
public static FloatBuffer merge(FloatBuffer f1, FloatBuffer f2) { if (f1 == null) return f2; if (f2 == null) return f1; return BufferUtils.createFloatBuffer(merge(BufferUtils.getFloatArray(f1), BufferUtils.getFloatArray(f2))); }
for (Mesh mesh : meshes) { float[] vertexTable = BufferUtils.getFloatArray(mesh.getFloatBuffer(Type.Position)); float[] normalTable = BufferUtils.getFloatArray(mesh.getFloatBuffer(Type.Normal));
for (Mesh mesh : meshes) { float[] vertexTable = BufferUtils.getFloatArray(mesh.getFloatBuffer(Type.Position)); float[] normalTable = BufferUtils.getFloatArray(mesh.getFloatBuffer(Type.Normal));
/** creates MeshData from mesh */ public MeshData(Mesh mesh) { this.maxNumOfWeights = mesh.getMaxNumWeights(); vertexArray = BufferUtils.getFloatArray(mesh.getFloatBuffer(Type.Position)); normalArray = BufferUtils.getFloatArray(mesh.getFloatBuffer(Type.Normal)); int numOfTexcoordinates = 0; for (int i = 0; i < MAX_TEX_COORDS; i++) { if (mesh.getBuffer(Utilities.getTexCoordType(i)) != null) numOfTexcoordinates++; } this.uvArrays = new float[numOfTexcoordinates][]; for (int i = 0; i < numOfTexcoordinates; i++) { uvArrays[i] = BufferUtils.getFloatArray(mesh.getFloatBuffer(Utilities.getTexCoordType(i))); } indexArray = Utilities.getShortArray(mesh.getShortBuffer(Type.Index)); boneWeightArray = BufferUtils.getFloatArray(mesh.getFloatBuffer(Type.BoneWeight)); VertexBuffer boneIndexBuffer = mesh.getBuffer(Type.BoneIndex); if (boneIndexBuffer != null) boneIndexArray = (Utilities.getByteArray((ByteBuffer) boneIndexBuffer.getData())); }
/** creates MeshData from mesh */ public MeshData(Mesh mesh) { this.maxNumOfWeights = mesh.getMaxNumWeights(); vertexArray = BufferUtils.getFloatArray(mesh.getFloatBuffer(Type.Position)); normalArray = BufferUtils.getFloatArray(mesh.getFloatBuffer(Type.Normal)); int numOfTexcoordinates = 0; for (int i = 0; i < MAX_TEX_COORDS; i++) { if (mesh.getBuffer(Utilities.getTexCoordType(i)) != null) numOfTexcoordinates++; } this.uvArrays = new float[numOfTexcoordinates][]; for (int i = 0; i < numOfTexcoordinates; i++) { uvArrays[i] = BufferUtils.getFloatArray(mesh.getFloatBuffer(Utilities.getTexCoordType(i))); } indexArray = Utilities.getShortArray(mesh.getShortBuffer(Type.Index)); boneWeightArray = BufferUtils.getFloatArray(mesh.getFloatBuffer(Type.BoneWeight)); VertexBuffer boneIndexBuffer = mesh.getBuffer(Type.BoneIndex); if (boneIndexBuffer != null) boneIndexArray = (Utilities.getByteArray((ByteBuffer) boneIndexBuffer.getData())); }
public static Node createDebugNormals(Mesh mesh, Material mat, float scale) { Node debugNormals = new Node(); VertexBuffer vertex = mesh.getBuffer(Type.Position); float[] vertexArray = BufferUtils.getFloatArray((FloatBuffer) vertex.getData()); VertexBuffer normals = mesh.getBuffer(Type.Normal); if (normals == null) return debugNormals; float[] normalArray = BufferUtils.getFloatArray((FloatBuffer) normals.getData()); for (int i = 0; i < vertexArray.length; i += 3) { Vector3f p1 = new Vector3f(vertexArray[i], vertexArray[i + 1], vertexArray[i + 2]); Vector3f n1 = new Vector3f(normalArray[i], normalArray[i + 1], normalArray[i + 2]); debugNormals.attachChild(createLine("DebugShowNormalsLine", mat, p1, p1.add(n1.mult(scale)))); } GeometryBatchFactory.optimize(debugNormals); return debugNormals; }
public static Node createDebugNormals(Mesh mesh, Material mat, float scale) { Node debugNormals = new Node(); VertexBuffer vertex = mesh.getBuffer(Type.Position); float[] vertexArray = BufferUtils.getFloatArray((FloatBuffer) vertex.getData()); VertexBuffer normals = mesh.getBuffer(Type.Normal); if (normals == null) return debugNormals; float[] normalArray = BufferUtils.getFloatArray((FloatBuffer) normals.getData()); for (int i = 0; i < vertexArray.length; i += 3) { Vector3f p1 = new Vector3f(vertexArray[i], vertexArray[i + 1], vertexArray[i + 2]); Vector3f n1 = new Vector3f(normalArray[i], normalArray[i + 1], normalArray[i + 2]); debugNormals.attachChild(createLine("DebugShowNormalsLine", mat, p1, p1.add(n1.mult(scale)))); } GeometryBatchFactory.optimize(debugNormals); return debugNormals; }
float[] vertexArray = BufferUtils.getFloatArray((FloatBuffer) buffer.getData());