Fix to 3D texture triangulation procedure that might have caused an image of width or height == 0 to be produced (which caused later errors during textures merging).

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9496 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
Kae..pl 13 years ago
parent 8cf238a262
commit e8762bcf9d
  1. 6
      engine/src/blender/com/jme3/scene/plugins/blender/textures/TriangulatedTexture.java

@ -524,7 +524,13 @@ import jme3tools.converters.ImageToAwt;
// create the result image
Format imageFormat = texture.getImage().getFormat();
int imageWidth = (int) (envelope.width * blenderContext.getBlenderKey().getGeneratedTexturePPU());
if(imageWidth == 0) {
imageWidth = 1;
}
int imageHeight = (int) (envelope.height * blenderContext.getBlenderKey().getGeneratedTexturePPU());
if(imageHeight == 0) {
imageHeight = 1;
}
ByteBuffer data = BufferUtils.createByteBuffer(imageWidth * imageHeight * (imageFormat.getBitsPerPixel() >> 3));
image = new Image(texture.getImage().getFormat(), imageWidth, imageHeight, data);

Loading…
Cancel
Save