* Ensure bind pose format and num components matches base buffer. Fixes crash when batching model with 3D tangents

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@10219 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
sha..RD 2013-01-28 02:29:49 +00:00
parent 3de0e580b8
commit d6448dd112

View File

@ -312,8 +312,8 @@ public class Mesh implements Savable, Cloneable {
VertexBuffer bindPos = new VertexBuffer(Type.BindPosePosition); VertexBuffer bindPos = new VertexBuffer(Type.BindPosePosition);
bindPos.setupData(Usage.CpuOnly, bindPos.setupData(Usage.CpuOnly,
3, pos.getNumComponents(),
Format.Float, pos.getFormat(),
BufferUtils.clone(pos.getData())); BufferUtils.clone(pos.getData()));
setBuffer(bindPos); setBuffer(bindPos);
@ -325,8 +325,8 @@ public class Mesh implements Savable, Cloneable {
if (norm != null) { if (norm != null) {
VertexBuffer bindNorm = new VertexBuffer(Type.BindPoseNormal); VertexBuffer bindNorm = new VertexBuffer(Type.BindPoseNormal);
bindNorm.setupData(Usage.CpuOnly, bindNorm.setupData(Usage.CpuOnly,
3, norm.getNumComponents(),
Format.Float, norm.getFormat(),
BufferUtils.clone(norm.getData())); BufferUtils.clone(norm.getData()));
setBuffer(bindNorm); setBuffer(bindNorm);
norm.setUsage(Usage.Stream); norm.setUsage(Usage.Stream);
@ -336,8 +336,8 @@ public class Mesh implements Savable, Cloneable {
if (tangents != null) { if (tangents != null) {
VertexBuffer bindTangents = new VertexBuffer(Type.BindPoseTangent); VertexBuffer bindTangents = new VertexBuffer(Type.BindPoseTangent);
bindTangents.setupData(Usage.CpuOnly, bindTangents.setupData(Usage.CpuOnly,
4, tangents.getNumComponents(),
Format.Float, tangents.getFormat(),
BufferUtils.clone(tangents.getData())); BufferUtils.clone(tangents.getData()));
setBuffer(bindTangents); setBuffer(bindTangents);
tangents.setUsage(Usage.Stream); tangents.setUsage(Usage.Stream);