Fix to texture UV-mapping (textures did not exactly fit the ones in blender).

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7635 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
Kae..pl 14 years ago
parent bd114ed3ac
commit 15e099e160
  1. 12
      engine/src/blender/com/jme3/scene/plugins/blender/helpers/v249/MeshHelper.java
  2. 2
      engine/src/blender/com/jme3/scene/plugins/blender/helpers/v249/TextureHelper.java

@ -155,9 +155,9 @@ public class MeshHelper extends AbstractBlenderHelper {
materialWithoutTextures = pImage.isNull();
// uvs always must be added wheater we have texture or not
uvs = (DynamicArray<Number>) mtFace.getFieldValue("uv");
uvCoordinates.add(new Vector2f(uvs.get(0, 0).floatValue(), uvs.get(0, 1).floatValue()));
uvCoordinates.add(new Vector2f(uvs.get(1, 0).floatValue(), uvs.get(1, 1).floatValue()));
uvCoordinates.add(new Vector2f(uvs.get(2, 0).floatValue(), uvs.get(2, 1).floatValue()));
uvCoordinates.add(new Vector2f(uvs.get(0, 0).floatValue(), 1.0f - uvs.get(0, 1).floatValue()));
uvCoordinates.add(new Vector2f(uvs.get(1, 0).floatValue(), 1.0f - uvs.get(1, 1).floatValue()));
uvCoordinates.add(new Vector2f(uvs.get(2, 0).floatValue(), 1.0f - uvs.get(2, 1).floatValue()));
}
int matNr = ((Number) mFace.getFieldValue("mat_nr")).intValue();
Integer materialNumber = Integer.valueOf(materialWithoutTextures ? -1 * matNr - 1 : matNr);
@ -201,9 +201,9 @@ public class MeshHelper extends AbstractBlenderHelper {
if (v4 > 0) {
if (uvs != null) {
uvCoordinates.add(new Vector2f(uvs.get(0, 0).floatValue(), uvs.get(0, 1).floatValue()));
uvCoordinates.add(new Vector2f(uvs.get(2, 0).floatValue(), uvs.get(2, 1).floatValue()));
uvCoordinates.add(new Vector2f(uvs.get(3, 0).floatValue(), uvs.get(3, 1).floatValue()));
uvCoordinates.add(new Vector2f(uvs.get(0, 0).floatValue(), 1.0f - uvs.get(0, 1).floatValue()));
uvCoordinates.add(new Vector2f(uvs.get(2, 0).floatValue(), 1.0f - uvs.get(2, 1).floatValue()));
uvCoordinates.add(new Vector2f(uvs.get(3, 0).floatValue(), 1.0f - uvs.get(3, 1).floatValue()));
}
this.appendVertexReference(v1, vertexList.size(), vertexReferenceMap);
indexList.add(vertexList.size());

@ -1613,7 +1613,7 @@ public class TextureHelper extends AbstractBlenderHelper {
name = name.substring(1);
}
TextureKey texKey = new TextureKey(name, true);
TextureKey texKey = new TextureKey(name, false);
Texture tex = dataRepository.getAssetManager().loadTexture(texKey);
image = tex.getImage();
}

Loading…
Cancel
Save