diff --git a/engine/src/blender/com/jme3/scene/plugins/blender/helpers/v249/ModifierHelper.java b/engine/src/blender/com/jme3/scene/plugins/blender/helpers/v249/ModifierHelper.java index 6fc6994c8..c63d6c2d9 100644 --- a/engine/src/blender/com/jme3/scene/plugins/blender/helpers/v249/ModifierHelper.java +++ b/engine/src/blender/com/jme3/scene/plugins/blender/helpers/v249/ModifierHelper.java @@ -32,6 +32,7 @@ package com.jme3.scene.plugins.blender.helpers.v249; import java.nio.FloatBuffer; +import java.nio.ShortBuffer; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -551,13 +552,14 @@ public class ModifierHelper extends AbstractBlenderHelper { Mesh clone = mesh.deepClone(); // getting buffers - FloatBuffer position = (FloatBuffer) mesh.getBuffer(Type.Position).getData(); - FloatBuffer bindPosePosition = (FloatBuffer) mesh.getBuffer(Type.BindPosePosition).getData(); - - FloatBuffer clonePosition = (FloatBuffer) clone.getBuffer(Type.Position).getData(); - FloatBuffer cloneBindPosePosition = (FloatBuffer) clone.getBuffer(Type.BindPosePosition).getData(); - FloatBuffer cloneNormals = (FloatBuffer) clone.getBuffer(Type.Normal).getData(); - FloatBuffer cloneBindPoseNormals = (FloatBuffer) clone.getBuffer(Type.BindPoseNormal).getData(); + FloatBuffer position = mesh.getFloatBuffer(Type.Position); + FloatBuffer bindPosePosition = mesh.getFloatBuffer(Type.BindPosePosition); + + FloatBuffer clonePosition = clone.getFloatBuffer(Type.Position); + FloatBuffer cloneBindPosePosition = clone.getFloatBuffer(Type.BindPosePosition); + FloatBuffer cloneNormals = clone.getFloatBuffer(Type.Normal); + FloatBuffer cloneBindPoseNormals = clone.getFloatBuffer(Type.BindPoseNormal); + ShortBuffer cloneIndexes = (ShortBuffer) clone.getBuffer(Type.Index).getData(); // modyfying data for (int i = mirrorIndex; i < clonePosition.limit(); i += 3) { @@ -575,6 +577,14 @@ public class ModifierHelper extends AbstractBlenderHelper { } cloneNormals.put(i, -cloneNormals.get(i)); cloneBindPoseNormals.put(i, -cloneNormals.get(i)); + + //modifying clone indexes + int vertexIndex = (i - mirrorIndex) / 3; + if(vertexIndex % 3 == 0) { + short index = cloneIndexes.get(vertexIndex + 2); + cloneIndexes.put(vertexIndex + 2, cloneIndexes.get(vertexIndex + 1)); + cloneIndexes.put(vertexIndex + 1, index); + } } if(mirrorU) { diff --git a/engine/src/test-data/Blender/2.4x/modifiers.blend b/engine/src/test-data/Blender/2.4x/modifiers.blend index 52403dbaf..0f1269cec 100644 Binary files a/engine/src/test-data/Blender/2.4x/modifiers.blend and b/engine/src/test-data/Blender/2.4x/modifiers.blend differ