|
@@ -388,10 +388,10 @@ public class Mesh implements Savable, Cloneable {
|
|
tangents.setUsage(Usage.Stream);
|
|
tangents.setUsage(Usage.Stream);
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
- //if HWBoneIndex and HWBoneWieght are empty, we setup them as direct
|
|
|
|
|
|
+ //if HWBoneIndex and HWBoneWeight are empty, we setup them as direct
|
|
//buffers with software anim buffers data
|
|
//buffers with software anim buffers data
|
|
VertexBuffer indicesHW = getBuffer(Type.HWBoneIndex);
|
|
VertexBuffer indicesHW = getBuffer(Type.HWBoneIndex);
|
|
- if(indicesHW.getData() == null){
|
|
|
|
|
|
+ if (indicesHW.getData() == null) {
|
|
VertexBuffer indices = getBuffer(Type.BoneIndex);
|
|
VertexBuffer indices = getBuffer(Type.BoneIndex);
|
|
ByteBuffer originalIndex = (ByteBuffer) indices.getData();
|
|
ByteBuffer originalIndex = (ByteBuffer) indices.getData();
|
|
ByteBuffer directIndex = BufferUtils.createByteBuffer(originalIndex.capacity());
|
|
ByteBuffer directIndex = BufferUtils.createByteBuffer(originalIndex.capacity());
|
|
@@ -401,25 +401,38 @@ public class Mesh implements Savable, Cloneable {
|
|
}
|
|
}
|
|
|
|
|
|
VertexBuffer weightsHW = getBuffer(Type.HWBoneWeight);
|
|
VertexBuffer weightsHW = getBuffer(Type.HWBoneWeight);
|
|
- if(weightsHW.getData() == null){
|
|
|
|
|
|
+ if (weightsHW.getData() == null) {
|
|
VertexBuffer weights = getBuffer(Type.BoneWeight);
|
|
VertexBuffer weights = getBuffer(Type.BoneWeight);
|
|
FloatBuffer originalWeight = (FloatBuffer) weights.getData();
|
|
FloatBuffer originalWeight = (FloatBuffer) weights.getData();
|
|
FloatBuffer directWeight = BufferUtils.createFloatBuffer(originalWeight.capacity());
|
|
FloatBuffer directWeight = BufferUtils.createFloatBuffer(originalWeight.capacity());
|
|
originalWeight.clear();
|
|
originalWeight.clear();
|
|
directWeight.put(originalWeight);
|
|
directWeight.put(originalWeight);
|
|
- weightsHW.setupData(Usage.Static, weights.getNumComponents(), weights.getFormat(), directWeight);
|
|
|
|
- }
|
|
|
|
|
|
+ weightsHW.setupData(Usage.Static, weights.getNumComponents(), weights.getFormat(), directWeight);
|
|
|
|
+ }
|
|
|
|
|
|
// position, normal, and tanget buffers to be in "Static" mode
|
|
// position, normal, and tanget buffers to be in "Static" mode
|
|
VertexBuffer positions = getBuffer(Type.Position);
|
|
VertexBuffer positions = getBuffer(Type.Position);
|
|
VertexBuffer normals = getBuffer(Type.Normal);
|
|
VertexBuffer normals = getBuffer(Type.Normal);
|
|
VertexBuffer tangents = getBuffer(Type.Tangent);
|
|
VertexBuffer tangents = getBuffer(Type.Tangent);
|
|
|
|
+
|
|
|
|
+ VertexBuffer positionsBP = getBuffer(Type.BindPosePosition);
|
|
|
|
+ VertexBuffer normalsBP = getBuffer(Type.BindPoseNormal);
|
|
|
|
+ VertexBuffer tangentsBP = getBuffer(Type.BindPoseTangent);
|
|
|
|
+
|
|
positions.setUsage(Usage.Static);
|
|
positions.setUsage(Usage.Static);
|
|
|
|
+ positionsBP.copyElements(0, positions, 0, positionsBP.getNumElements());
|
|
|
|
+ positions.setUpdateNeeded();
|
|
|
|
+
|
|
if (normals != null) {
|
|
if (normals != null) {
|
|
normals.setUsage(Usage.Static);
|
|
normals.setUsage(Usage.Static);
|
|
|
|
+ normalsBP.copyElements(0, normals, 0, normalsBP.getNumElements());
|
|
|
|
+ normals.setUpdateNeeded();
|
|
}
|
|
}
|
|
|
|
+
|
|
if (tangents != null) {
|
|
if (tangents != null) {
|
|
tangents.setUsage(Usage.Static);
|
|
tangents.setUsage(Usage.Static);
|
|
|
|
+ tangentsBP.copyElements(0, tangents, 0, tangentsBP.getNumElements());
|
|
|
|
+ tangents.setUpdateNeeded();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|