Temporary fix to UVS loading. If no texture is applied and UV coordinates are - then they are applied to the model. At this moment user defined UVS are only applied but future implementation will take the UVS type into account.

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9526 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
Kae..pl 13 years ago
parent 7beebfc4c0
commit 4a596c8082
  1. 30
      engine/src/blender/com/jme3/scene/plugins/blender/materials/MaterialContext.java

@ -1,5 +1,21 @@
package com.jme3.scene.plugins.blender.materials;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.logging.Logger;
import javax.imageio.ImageIO;
import jme3tools.converters.ImageToAwt;
import com.jme3.material.Material;
import com.jme3.material.RenderState.BlendMode;
import com.jme3.material.RenderState.FaceCullMode;
@ -21,14 +37,9 @@ import com.jme3.scene.plugins.blender.textures.CombinedTexture;
import com.jme3.scene.plugins.blender.textures.TextureHelper;
import com.jme3.scene.plugins.blender.textures.blending.TextureBlender;
import com.jme3.scene.plugins.blender.textures.blending.TextureBlenderFactory;
import com.jme3.texture.Image;
import com.jme3.texture.Texture;
import com.jme3.util.BufferUtils;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.logging.Logger;
/**
* This class holds the data about the material.
@ -195,6 +206,7 @@ public final class MaterialContext {
}
//applying textures
if(loadedTextures != null && loadedTextures.size() > 0) {
for(Entry<Number, CombinedTexture> entry : loadedTextures.entrySet()) {
CombinedTexture combinedTexture = entry.getValue();
combinedTexture.flatten(geometry, geometriesOMA, userDefinedUVCoordinates, blenderContext);
@ -234,6 +246,12 @@ public final class MaterialContext {
geometry.getMesh().setBuffer(uvCoordsBuffer);
}
}
} else if(userDefinedUVCoordinates != null && userDefinedUVCoordinates.size() > 0) {
VertexBuffer uvCoordsBuffer = new VertexBuffer(VertexBuffer.Type.TexCoord);
uvCoordsBuffer.setupData(Usage.Static, 2, Format.Float,
BufferUtils.createFloatBuffer(userDefinedUVCoordinates.toArray(new Vector2f[userDefinedUVCoordinates.size()])));
geometry.getMesh().setBuffer(uvCoordsBuffer);
}
//applying additional data
material.setName(name);

Loading…
Cancel
Save