* Mesh.cloneForAnim() now clones tangent buffer as well

* Fix javadoc in Mesh.cloneForAnim(), the position/normal/tangent buffers are cloned

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@8878 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
Sha..rd 13 years ago
parent a1d73d159d
commit 58d26b5ebe
  1. 10
      engine/src/core/com/jme3/scene/Mesh.java

@ -260,7 +260,7 @@ public class Mesh implements Savable, Cloneable {
* Clone the mesh for animation use.
* This creates a shallow clone of the mesh, sharing most
* of the {@link VertexBuffer vertex buffer} data, however the
* {@link Type#BindPosePosition} and {@link Type#BindPoseNormal} buffers
* {@link Type#Position}, {@link Type#Normal}, and {@link Type#Tangent} buffers
* are deeply cloned.
*
* @return A clone of the mesh for animation use.
@ -269,6 +269,7 @@ public class Mesh implements Savable, Cloneable {
Mesh clone = clone();
if (getBuffer(Type.BindPosePosition) != null){
VertexBuffer oldPos = getBuffer(Type.Position);
// NOTE: creates deep clone
VertexBuffer newPos = oldPos.clone();
clone.clearBuffer(Type.Position);
@ -279,6 +280,13 @@ public class Mesh implements Savable, Cloneable {
VertexBuffer newNorm = oldNorm.clone();
clone.clearBuffer(Type.Normal);
clone.setBuffer(newNorm);
if (getBuffer(Type.BindPoseTangent) != null){
VertexBuffer oldTang = getBuffer(Type.Tangent);
VertexBuffer newTang = oldTang.clone();
clone.clearBuffer(Type.Tangent);
clone.setBuffer(newTang);
}
}
}
return clone;

Loading…
Cancel
Save