terrain : fixed an issue on texture coordinates calculation

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@8240 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
rem..om 14 years ago
parent 7d315f04d9
commit 9df9ad8564
  1. 12
      engine/src/terrain/com/jme3/terrain/geomipmap/LODGeomap.java

@ -135,8 +135,8 @@ public class LODGeomap extends GeoMap {
float offsetX = offset.x + (offsetAmount * 1.0f); float offsetX = offset.x + (offsetAmount * 1.0f);
float offsetY = -offset.y + (offsetAmount * 1.0f);//note the -, we flip the tex coords float offsetY = -offset.y + (offsetAmount * 1.0f);//note the -, we flip the tex coords
store.set((((float) x) + offsetX) / (float) totalSize, // calculates percentage of texture here store.set((((float) x) + offsetX) / (float) (totalSize ), // calculates percentage of texture here
(((float) y) + offsetY) / (float) totalSize); (((float) y) + offsetY) / (float) (totalSize ));
return store; return store;
} }
@ -733,12 +733,16 @@ public class LODGeomap extends GeoMap {
tangent.x = (edge2uv.y * edge1.x) * factor; tangent.x = (edge2uv.y * edge1.x) * factor;
tangent.y = 0; tangent.y = 0;
tangent.z = (edge2uv.y * edge1.z) * factor; tangent.z = (edge2uv.y * edge1.z) * factor;
if (normalize) tangent.normalizeLocal(); if (normalize) {
tangent.normalizeLocal();
}
binormal.x = 0; binormal.x = 0;
binormal.y = (edge1uv.x * edge2.y) * factor; binormal.y = (edge1uv.x * edge2.y) * factor;
binormal.z = (edge1uv.x * edge2.z) * factor; binormal.z = (edge1uv.x * edge2.z) * factor;
if (normalize) binormal.normalizeLocal(); if (normalize) {
binormal.normalizeLocal();
}
return tangent; return tangent;
} }

Loading…
Cancel
Save