1
Support / Re: Vertices order when adding triangles.
« on: January 10, 2017, 07:12:30 pm »
This is what we mean by "break".
![](http://i.imgur.com/YIfuD0N.png)
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Mesh aMesh = anObject.getMesh();
System.out.println("Before build");
System.out.println("Mesh Vertices: " + aMesh.getVertexCount());
System.out.println("Mesh Unique Vertices: " + aMesh.getUniqueVertexCount());
System.out.println("Mesh Triangles: " + aMesh.getTriangleCount());
System.out.println("After build");
anObject.build();
System.out.println("Mesh Vertices: " + aMesh.getVertexCount());
System.out.println("Mesh Unique Vertices: " + aMesh.getUniqueVertexCount());
System.out.println("Mesh Triangles: " + aMesh.getTriangleCount());
Before build
Mesh Vertices: 4644
Mesh Unique Vertices: 786
Mesh Triangles: 1548
After build
Mesh Vertices: 4644
Mesh Unique Vertices: 794
Mesh Triangles: 1548
you mean like sum of weights should be 1 per vertex? no there is no such requirement
float[][] weights = new float[vertices.size()][Skeleton.MAX_JOINTS_PER_VERTEX];
short[][] jointIndices = new short[bones.size()][Skeleton.MAX_JOINTS_PER_VERTEX];
int[] weightCounters = new int[vertices.size()];
int[] jointIndicesCounters = new int[bones.size()];
for (BoneReference aBoneRef: boneRefs) {
int weightCounter = weightCounters[aBoneRef.vertexIndexReference];
if (weightCounter < Skeleton.MAX_JOINTS_PER_VERTEX) {
weights[aBoneRef.vertexIndexReference][weightCounter] = aBoneRef.vertexWeight;
weightCounters[aBoneRef.vertexIndexReference]++;
}
int jointIndicesCounter = jointIndicesCounters[aBoneRef.boneIndexReference];
if (jointIndicesCounter < Skeleton.MAX_JOINTS_PER_VERTEX) {
jointIndices[aBoneRef.boneIndexReference][jointIndicesCounter] = aBoneRef.vertexIndexReference;
jointIndicesCounters[aBoneRef.boneIndexReference]++;
}
}
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 249
at raft.jpct.bones.Animated3D.applySkeletonPose(Animated3D.java:523)
at Importer.loop(Importer.java:344)
at Importer.<init>(Importer.java:56)
at Importer.main(Importer.java:422)