Adding UV coordinates to the model if they are defined for the mesh even if no material is applied.

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9383 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
Kae..pl 13 years ago
parent f8771f437e
commit 816b082c73
  1. 11
      engine/src/blender/com/jme3/scene/plugins/blender/meshes/MeshHelper.java

@ -360,8 +360,19 @@ public class MeshHelper extends AbstractBlenderHelper {
materialContext.applyMaterial(geometry, structure.getOldMemoryAddress(), noTextures, uvCoordinates.get(Integer.valueOf(materialNumber)), blenderContext);
}
} else {
//add UV coordinates if they are defined even if the material is not applied to the model
VertexBuffer uvCoordsBuffer = null;
if(uvCoordinates.size() > 0) {
List<Vector2f> uvs = uvCoordinates.get(0);
uvCoordsBuffer = new VertexBuffer(Type.TexCoord);
uvCoordsBuffer.setupData(Usage.Static, 2, Format.Float, BufferUtils.createFloatBuffer(uvs.toArray(new Vector2f[uvs.size()])));
}
for(Geometry geometry : geometries) {
geometry.setMaterial(blenderContext.getDefaultMaterial());
if(uvCoordsBuffer != null) {
geometry.getMesh().setBuffer(uvCoordsBuffer);
}
}
}

Loading…
Cancel
Save