- account for flipped textures in material->j3m creation
git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7192 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
		
							parent
							
								
									93308146ea
								
							
						
					
					
						commit
						5c21723435
					
				| @ -4,6 +4,8 @@ | ||||
|  */ | ||||
| package com.jme3.gde.materials; | ||||
| 
 | ||||
| import com.jme3.asset.AssetKey; | ||||
| import com.jme3.asset.TextureKey; | ||||
| import com.jme3.material.MatParam; | ||||
| import com.jme3.math.ColorRGBA; | ||||
| import com.jme3.texture.Texture2D; | ||||
| @ -33,13 +35,18 @@ public class MaterialProperty { | ||||
|         Object obj = param.getValue(); | ||||
|         this.value = obj.toString(); | ||||
|         //TODO: change to correct string | ||||
|         if(obj instanceof ColorRGBA){ | ||||
|         if (obj instanceof ColorRGBA) { | ||||
|             value = value.replaceAll("Color\\[([^\\]]*)\\]", "$1"); | ||||
|             value = value.replaceAll(",", ""); | ||||
|         } | ||||
|         else if(obj instanceof Texture2D) | ||||
|         { | ||||
|             value = value.replaceAll("Texture2D\\[name=([^,]*)\\,([^\\]]*)]", "$1"); | ||||
|         } else if (obj instanceof Texture2D) { | ||||
|             AssetKey key = ((Texture2D) obj).getKey(); | ||||
|             String flip = ""; | ||||
|             if (key instanceof TextureKey) { | ||||
|                 if (((TextureKey) key).isFlipY()) { | ||||
|                     flip = "Flip "; | ||||
|                 } | ||||
|             } | ||||
|             value = value.replaceAll("Texture2D\\[name=([^,]*)\\,([^\\]]*)]", flip + "$1"); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user