Bugfix: fixed an issue when UV coordinates were not applied even though the mesh had them defined (the bug occured when the mesh had materials, UV's and no textures).
git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@10818 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
parent
04ed5d1467
commit
535a6dd8ce
@ -159,7 +159,7 @@ public final class MaterialContext {
|
|||||||
// applying textures
|
// applying textures
|
||||||
if (loadedTextures != null && loadedTextures.size() > 0) {
|
if (loadedTextures != null && loadedTextures.size() > 0) {
|
||||||
int textureIndex = 0;
|
int textureIndex = 0;
|
||||||
if(loadedTextures.size() > 8) {
|
if(loadedTextures.size() > TextureHelper.TEXCOORD_TYPES.length) {
|
||||||
LOGGER.log(Level.WARNING, "The blender file has defined more than {0} different textures. JME supports only {0} UV mappings.", TextureHelper.TEXCOORD_TYPES.length);
|
LOGGER.log(Level.WARNING, "The blender file has defined more than {0} different textures. JME supports only {0} UV mappings.", TextureHelper.TEXCOORD_TYPES.length);
|
||||||
}
|
}
|
||||||
for (Entry<Number, CombinedTexture> entry : loadedTextures.entrySet()) {
|
for (Entry<Number, CombinedTexture> entry : loadedTextures.entrySet()) {
|
||||||
@ -176,6 +176,22 @@ public final class MaterialContext {
|
|||||||
LOGGER.log(Level.WARNING, "The texture could not be applied because JME only supports up to {0} different UV's.", TextureHelper.TEXCOORD_TYPES.length);
|
LOGGER.log(Level.WARNING, "The texture could not be applied because JME only supports up to {0} different UV's.", TextureHelper.TEXCOORD_TYPES.length);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if(userDefinedUVCoordinates != null && userDefinedUVCoordinates.size() > 0) {
|
||||||
|
LOGGER.fine("No textures found for the mesh, but UV coordinates are applied.");
|
||||||
|
int textureIndex = 0;
|
||||||
|
if(userDefinedUVCoordinates.size() > TextureHelper.TEXCOORD_TYPES.length) {
|
||||||
|
LOGGER.log(Level.WARNING, "The blender file has defined more than {0} different UV coordinates for the mesh. JME supports only {0} UV coordinates buffers.", TextureHelper.TEXCOORD_TYPES.length);
|
||||||
|
}
|
||||||
|
for(Entry<String, List<Vector2f>> entry : userDefinedUVCoordinates.entrySet()) {
|
||||||
|
if(textureIndex < TextureHelper.TEXCOORD_TYPES.length) {
|
||||||
|
List<Vector2f> uvs = entry.getValue();
|
||||||
|
VertexBuffer uvCoordsBuffer = new VertexBuffer(TextureHelper.TEXCOORD_TYPES[textureIndex++]);
|
||||||
|
uvCoordsBuffer.setupData(Usage.Static, 2, Format.Float, BufferUtils.createFloatBuffer(uvs.toArray(new Vector2f[uvs.size()])));
|
||||||
|
geometry.getMesh().setBuffer(uvCoordsBuffer);
|
||||||
|
} else {
|
||||||
|
LOGGER.log(Level.WARNING, "The texture could not be applied because JME only supports up to {0} different UV's.", TextureHelper.TEXCOORD_TYPES.length);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// applying additional data
|
// applying additional data
|
||||||
|
Loading…
x
Reference in New Issue
Block a user