From 58d26b5ebe6947d0f26b1fccb509d5493ac69182 Mon Sep 17 00:00:00 2001 From: "Sha..rd" Date: Wed, 7 Dec 2011 01:13:24 +0000 Subject: [PATCH] * 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 --- engine/src/core/com/jme3/scene/Mesh.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/engine/src/core/com/jme3/scene/Mesh.java b/engine/src/core/com/jme3/scene/Mesh.java index d2e29493a..a76730ff4 100644 --- a/engine/src/core/com/jme3/scene/Mesh.java +++ b/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;