Procházet zdrojové kódy

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
Kae..pl před 14 roky
rodič
revize
15e099e160

+ 6 - 6
engine/src/blender/com/jme3/scene/plugins/blender/helpers/v249/MeshHelper.java

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

+ 1 - 1
engine/src/blender/com/jme3/scene/plugins/blender/helpers/v249/TextureHelper.java

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