Fix for applying normals for smooth models that use generated textures (they were solid instead of smooth).

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9530 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
Kae..pl 13 years ago
parent 801b87d6ce
commit 37f74cdb07
  1. 4
      engine/src/blender/com/jme3/scene/plugins/blender/meshes/MeshBuilder.java

@ -150,7 +150,7 @@ import com.jme3.util.BufferUtils;
indexList.add(index[i]); indexList.add(index[i]);
} }
} else { } else {
Vector3f n = FastMath.computeNormal(verticesAndNormals[v1][0], verticesAndNormals[v2][0], verticesAndNormals[v3][0]); Vector3f n = smooth ? null : FastMath.computeNormal(verticesAndNormals[v1][0], verticesAndNormals[v2][0], verticesAndNormals[v3][0]);
for (int i = 0; i < 3; ++i) { for (int i = 0; i < 3; ++i) {
indexList.add(vertexList.size()); indexList.add(vertexList.size());
this.appendVertexReference(index[i], vertexList.size(), vertexReferenceMap); this.appendVertexReference(index[i], vertexList.size(), vertexReferenceMap);
@ -162,7 +162,7 @@ import com.jme3.util.BufferUtils;
if(verticesColors != null) { if(verticesColors != null) {
vertexColorsList.add(verticesColors.get(faceIndex + vertexColorIndex[i])); vertexColorsList.add(verticesColors.get(faceIndex + vertexColorIndex[i]));
} }
normalList.add(n); normalList.add(smooth ? verticesAndNormals[index[i]][1] : n);
} }
} }
} }

Loading…
Cancel
Save