Mesh: preliminary work to use ubyte weights for hardware skinning

experimental
Kirill Vainer 10 years ago
parent 7b64e91681
commit 81a76fdf69
  1. 17
      jme3-core/src/main/java/com/jme3/scene/Mesh.java

@ -353,12 +353,17 @@ public class Mesh extends NativeObject implements Savable {
// convert weights on the heap
VertexBuffer weights = getBuffer(Type.BoneWeight);
if (!weights.getData().hasArray()) {
FloatBuffer originalWeight = (FloatBuffer) weights.getData();
FloatBuffer arrayWeight = FloatBuffer.allocate(originalWeight.capacity());
originalWeight.clear();
arrayWeight.put(originalWeight);
weights.updateData(arrayWeight);
if (!weights.getData().hasArray()) {
if (weights.getFormat() == Format.Float) {
FloatBuffer originalWeight = (FloatBuffer) weights.getData();
FloatBuffer arrayWeight = FloatBuffer.allocate(originalWeight.capacity());
originalWeight.clear();
arrayWeight.put(originalWeight);
weights.updateData(arrayWeight);
} else {
// UByte to Float conversion
throw new UnsupportedOperationException("Not yet supported");
}
}
weights.setUsage(Usage.CpuOnly);
// position, normal, and tanget buffers to be in "Stream" mode

Loading…
Cancel
Save