Fix to specifying texture UV coordinates for generated textures.

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9627 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
Kae..pl 12 years ago
parent 78bbe9b251
commit bb644be5e0
  1. 5
      engine/src/blender/com/jme3/scene/plugins/blender/textures/TriangulatedTexture.java

@ -577,6 +577,11 @@ import com.jme3.util.BufferUtils;
uvs[0] = (point.x - boundingBox.getCenter().x)/(boundingBox.getXExtent() == 0 ? 1 : boundingBox.getXExtent());
uvs[1] = (point.y - boundingBox.getCenter().y)/(boundingBox.getYExtent() == 0 ? 1 : boundingBox.getYExtent());
uvs[2] = (point.z - boundingBox.getCenter().z)/(boundingBox.getZExtent() == 0 ? 1 : boundingBox.getZExtent());
//UVS cannot go outside <0, 1> range, but since we are generating texture for triangle envelope it might happen that
//some points of the envelope will exceet the bounding box of the mesh thus generating uvs outside the range
for (int i = 0; i < 3; ++i) {
uvs[i] = FastMath.clamp(uvs[i], 0, 1);
}
}
/**

Loading…
Cancel
Save