From 7a954c0650d696005ace0af892bf758ca4ff4c0d Mon Sep 17 00:00:00 2001 From: "bre..ns" Date: Tue, 23 Aug 2011 00:59:44 +0000 Subject: [PATCH] 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 --- .../com/jme3/terrain/geomipmap/TerrainPatch.java | 10 ++++++---- .../com/jme3/terrain/geomipmap/TerrainQuad.java | 12 ++++++------ 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/engine/src/terrain/com/jme3/terrain/geomipmap/TerrainPatch.java b/engine/src/terrain/com/jme3/terrain/geomipmap/TerrainPatch.java index 5aaf466d6..dccb99b06 100644 --- a/engine/src/terrain/com/jme3/terrain/geomipmap/TerrainPatch.java +++ b/engine/src/terrain/com/jme3/terrain/geomipmap/TerrainPatch.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) { diff --git a/engine/src/terrain/com/jme3/terrain/geomipmap/TerrainQuad.java b/engine/src/terrain/com/jme3/terrain/geomipmap/TerrainQuad.java index 699d580c4..b00e2976d 100644 --- a/engine/src/terrain/com/jme3/terrain/geomipmap/TerrainQuad.java +++ b/engine/src/terrain/com/jme3/terrain/geomipmap/TerrainQuad.java @@ -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; }