removed a premature commit to terrain tangents that isn't fully working yet

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@8063 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
bre..ns 13 years ago
parent 82a405f067
commit 7a954c0650
  1. 10
      engine/src/terrain/com/jme3/terrain/geomipmap/TerrainPatch.java
  2. 12
      engine/src/terrain/com/jme3/terrain/geomipmap/TerrainQuad.java

@ -331,11 +331,10 @@ public class TerrainPatch extends Geometry {
* recalculate all of this normal vectors in this terrain patch
*/
protected void updateNormals() {
TangentBinormalGenerator.generate(this);
FloatBuffer newNormalBuffer = geomap.writeNormalArray(null, getWorldScale());
getMesh().getBuffer(Type.Normal).updateData(newNormalBuffer);
FloatBuffer newTangentBuffer = geomap.writeTangentArray(null, getWorldScale());
getMesh().getBuffer(Type.Tangent).updateData(newTangentBuffer);
//FloatBuffer newTangentBuffer = geomap.writeTangentArray(null, getWorldScale());
//getMesh().getBuffer(Type.Tangent).updateData(newTangentBuffer);
}
/**
@ -686,7 +685,7 @@ public class TerrainPatch extends Geometry {
Vector3f normal,
Vector3f tangent)
{
Vector3f scale = getWorldScale();
Vector3f scale = Vector3f.UNIT_XYZ;//getWorldScale();
v[0] = topPoint;
v[1] = rootPoint;
v[2] = leftPoint;
@ -742,6 +741,9 @@ public class TerrainPatch extends Geometry {
normal.set(n1.add(n2).add(n3).add(n4).normalizeLocal());
tangent.set(t1.add(t2).add(t3).add(t4)).normalizeLocal();
/*if (rightPoint != null) {
tangent.set(rootPoint.mult(scale).subtract(rightPoint.mult(scale)));
}*/
}
private Vector3f getNormal(Vector3f firstPoint, Vector3f rootPoint, Vector3f secondPoint) {

@ -734,7 +734,7 @@ public class TerrainQuad extends Node implements Terrain {
patch1.setModelBound(new BoundingBox());
patch1.updateModelBound();
patch1.setLodCalculator(lodCalculatorFactory);
//TangentBinormalGenerator.generate(patch1);
TangentBinormalGenerator.generate(patch1);
// 2 lower left
float[] heightBlock2 = createHeightSubBlock(heightMap, 0, split - 1,
@ -756,7 +756,7 @@ public class TerrainQuad extends Node implements Terrain {
patch2.setModelBound(new BoundingBox());
patch2.updateModelBound();
patch2.setLodCalculator(lodCalculatorFactory);
//TangentBinormalGenerator.generate(patch2);
TangentBinormalGenerator.generate(patch2);
// 3 upper right
float[] heightBlock3 = createHeightSubBlock(heightMap, split - 1, 0,
@ -778,7 +778,7 @@ public class TerrainQuad extends Node implements Terrain {
patch3.setModelBound(new BoundingBox());
patch3.updateModelBound();
patch3.setLodCalculator(lodCalculatorFactory);
//TangentBinormalGenerator.generate(patch3);
TangentBinormalGenerator.generate(patch3);
// 4 lower right
float[] heightBlock4 = createHeightSubBlock(heightMap, split - 1,
@ -800,7 +800,7 @@ public class TerrainQuad extends Node implements Terrain {
patch4.setModelBound(new BoundingBox());
patch4.updateModelBound();
patch4.setLodCalculator(lodCalculatorFactory);
//TangentBinormalGenerator.generate(patch4);
TangentBinormalGenerator.generate(patch4);
}
public float[] createHeightSubBlock(float[] heightMap, int x,
@ -878,10 +878,10 @@ public class TerrainQuad extends Node implements Terrain {
protected boolean needToRecalculateNormals() {
if (affectedAreaBBox != null)
return true;
if (!lastScale.equals(getWorldScale())) {
/*if (!lastScale.equals(getWorldScale())) {
lastScale = getWorldScale();
return true;
}
}*/
return false;
}

Loading…
Cancel
Save