Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@
import com.jme3.util.BufferUtils;
import com.jme3.util.TempVars;
import java.io.IOException;
import java.nio.Buffer;
import java.nio.BufferUnderflowException;
import java.nio.ByteBuffer;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;
import java.nio.ShortBuffer;
Expand Down Expand Up @@ -81,12 +81,7 @@ public Mesh createMesh(Vector3f scale, Vector2f tcScale, Vector2f tcOffset, floa
FloatBuffer pb = writeVertexArray(null, scale, center);
FloatBuffer texb = writeTexCoordArray(null, tcOffset, tcScale, offsetAmount, totalSize);
FloatBuffer nb = writeNormalArray(null, scale);
Buffer ib;
IndexBuffer idxB = writeIndexArrayLodDiff(lod, rightLod, topLod, leftLod, bottomLod, totalSize);
if (idxB.getBuffer() instanceof IntBuffer)
ib = (IntBuffer)idxB.getBuffer();
else
ib = (ShortBuffer)idxB.getBuffer();
IndexBuffer ib = writeIndexArrayLodDiff(lod, rightLod, topLod, leftLod, bottomLod, totalSize);
FloatBuffer bb = BufferUtils.createFloatBuffer(getWidth() * getHeight() * 3);
FloatBuffer tanb = BufferUtils.createFloatBuffer(getWidth() * getHeight() * 3);
writeTangentArray(nb, tanb, bb, texb, scale);
Expand All @@ -97,10 +92,17 @@ public Mesh createMesh(Vector3f scale, Vector2f tcScale, Vector2f tcOffset, floa
m.setBuffer(Type.Tangent, 3, tanb);
m.setBuffer(Type.Binormal, 3, bb);
m.setBuffer(Type.TexCoord, 2, texb);
if (ib instanceof IntBuffer)
m.setBuffer(Type.Index, 3, (IntBuffer)ib);
else if (ib instanceof ShortBuffer)
m.setBuffer(Type.Index, 3, (ShortBuffer)ib);
switch (ib.getFormat()) {
case UnsignedInt:
m.setBuffer(Type.Index, 3, (IntBuffer) ib.getBuffer());
break;
case UnsignedShort:
m.setBuffer(Type.Index, 3, (ShortBuffer) ib.getBuffer());
break;
case UnsignedByte:
m.setBuffer(Type.Index, 3, (ByteBuffer) ib.getBuffer());
break;
}
m.setStatic();
m.updateBound();
return m;
Expand Down