Просмотр исходного кода

Bugfix: solved problem when one 2D texture was about to be cast on other 2D texture while they had exactly the same UV coordinates.

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9729 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
Kae..pl 13 лет назад
Родитель
Сommit
d2e6648eb3

+ 10 - 10
engine/src/blender/com/jme3/scene/plugins/blender/textures/CombinedTexture.java

@@ -93,7 +93,7 @@ public class CombinedTexture {
 				textureData.projectionType = UVProjectionType.valueOf(projectionType);
 				textureData.textureStructure = textureStructure;
 	
-				if (this.isWithoutAlpha(textureData, blenderContext)) {
+				if (textureDatas.size() > 0 && this.isWithoutAlpha(textureData, blenderContext)) {
 					textureDatas.clear();// clear previous textures, they will be covered anyway
 				}
 				textureDatas.add(textureData);
@@ -238,18 +238,18 @@ public class CombinedTexture {
 	 *            the blender context
 	 */
 	public void castToUVS(CombinedTexture basicUVSOwner, BlenderContext blenderContext) {
-		if (!basicUVSOwner.wasTriangulated) {
-			throw new IllegalStateException("The given texture must be triangulated!");
-		}
-		if (!this.wasTriangulated) {
-			resultTexture = new TriangulatedTexture((Texture2D) resultTexture, resultUVS, blenderContext);
-			resultUVS = ((TriangulatedTexture) resultTexture).getResultUVS();
-			resultTexture = ((TriangulatedTexture) resultTexture).getResultTexture();
-		}
 		if (resultUVS.size() != basicUVSOwner.resultUVS.size()) {
-			throw new IllegalStateException("The amount of UV coordinates must be equal in order to cas one UV's onto another!");
+			throw new IllegalStateException("The amount of UV coordinates must be equal in order to cast one UV's onto another!");
 		}
 		if (!resultUVS.equals(basicUVSOwner.resultUVS)) {
+			if (!basicUVSOwner.wasTriangulated) {
+				throw new IllegalStateException("The given texture must be triangulated!");
+			}
+			if (!this.wasTriangulated) {
+				resultTexture = new TriangulatedTexture((Texture2D) resultTexture, resultUVS, blenderContext);
+				resultUVS = ((TriangulatedTexture) resultTexture).getResultUVS();
+				resultTexture = ((TriangulatedTexture) resultTexture).getResultTexture();
+			}
 			// casting algorithm
 			TextureHelper textureHelper = blenderContext.getHelper(TextureHelper.class);
 			ImageLoader imageLoader = new ImageLoader();