From 9da184fcd7b87c998069d300b57c32f873b6c272 Mon Sep 17 00:00:00 2001 From: "bre..ns" Date: Sat, 26 Nov 2011 21:47:04 +0000 Subject: [PATCH] cleaned up geomap code git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@8808 75d07b2b-3a1a-0410-a2c5-0572b91ccdca --- .../src/terrain/com/jme3/terrain/GeoMap.java | 3 - .../com/jme3/terrain/geomipmap/LODGeomap.java | 77 ------------------- 2 files changed, 80 deletions(-) diff --git a/engine/src/terrain/com/jme3/terrain/GeoMap.java b/engine/src/terrain/com/jme3/terrain/GeoMap.java index 3e29e52ef..1b3cfc5c8 100644 --- a/engine/src/terrain/com/jme3/terrain/GeoMap.java +++ b/engine/src/terrain/com/jme3/terrain/GeoMap.java @@ -162,8 +162,6 @@ public class GeoMap implements Savable { * @throws NullPointerException If isLoaded() or hasNormalmap() is false */ public FloatBuffer writeNormalArray(FloatBuffer store, Vector3f scale) { - if (!isLoaded()) - throw new NullPointerException(); if (store!=null){ if (store.remaining() < getWidth()*getHeight()*3) @@ -241,7 +239,6 @@ public class GeoMap implements Savable { * @throws NullPointerException If isLoaded() is false */ public FloatBuffer writeVertexArray(FloatBuffer store, Vector3f scale, boolean center) { - if (!isLoaded()) throw new NullPointerException(); if (store!=null){ if (store.remaining() < width*height*3) diff --git a/engine/src/terrain/com/jme3/terrain/geomipmap/LODGeomap.java b/engine/src/terrain/com/jme3/terrain/geomipmap/LODGeomap.java index ec64831e1..b434f4795 100644 --- a/engine/src/terrain/com/jme3/terrain/geomipmap/LODGeomap.java +++ b/engine/src/terrain/com/jme3/terrain/geomipmap/LODGeomap.java @@ -762,83 +762,6 @@ public class LODGeomap extends GeoMap { } store.rewind(); - /*Vector3f rootPoint = new Vector3f(); - Vector3f rightPoint = new Vector3f(); - Vector3f leftPoint = new Vector3f(); - Vector3f topPoint = new Vector3f(); - Vector3f bottomPoint = new Vector3f(); - - // calculate normals for each polygon - for (int r = 0; r < getHeight(); r++) { - for (int c = 0; c < getWidth(); c++) { - - rootPoint.set(c, getValue(c, r), r); - Vector3f normal = new Vector3f(); - Vector3f normal2 = new Vector3f(); - Vector3f normal3 = new Vector3f(); - Vector3f normal4 = new Vector3f(); - - if (r == 0) { // first row - if (c == 0) { // first column - rightPoint.set(c + 1, getValue(c + 1, r), r); - bottomPoint.set(c, getValue(c, r + 1), r + 1); - getNormal(bottomPoint, rootPoint, rightPoint, scale, normal); - } else if (c == getWidth() - 1) { // last column - leftPoint.set(c - 1, getValue(c - 1, r), r); - bottomPoint.set(c, getValue(c, r + 1), r + 1); - getNormal(leftPoint, rootPoint, bottomPoint, scale, normal); - } else { // all middle columns - leftPoint.set(c - 1, getValue(c - 1, r), r); - rightPoint.set(c + 1, getValue(c + 1, r), r); - bottomPoint.set(c, getValue(c, r + 1), r + 1); - getNormal(leftPoint, rootPoint, bottomPoint, scale, normal); - getNormal(bottomPoint, rootPoint, rightPoint, scale, normal2); - normal.set(normal.add(normal2).normalize()); - } - } else if (r == getHeight() - 1) { // last row - if (c == 0) { // first column - topPoint.set(c, getValue(c, r - 1), r - 1); - rightPoint.set(c + 1, getValue(c + 1, r), r); - getNormal(rightPoint, rootPoint, topPoint, scale, normal); - } else if (c == getWidth() - 1) { // last column - topPoint.set(c, getValue(c, r - 1), r - 1); - leftPoint.set(c - 1, getValue(c - 1, r), r); - getNormal(topPoint, rootPoint, leftPoint, scale, normal); - } else { // all middle columns - topPoint.set(c, getValue(c, r - 1), r - 1); - leftPoint.set(c - 1, getValue(c - 1, r), r); - rightPoint.set(c + 1, getValue(c + 1, r), r); - getNormal(topPoint, rootPoint, leftPoint, scale, normal); - getNormal(rightPoint, rootPoint, topPoint, scale, normal2); - normal.set(normal.add(normal2).normalize()); - } - } else { // all middle rows - if (c == 0) { // first column - topPoint.set(c, getValue(c, r - 1), r - 1); - rightPoint.set(c + 1, getValue(c + 1, r), r); - bottomPoint.set(c, getValue(c, r + 1), r + 1); - getNormal(rightPoint, rootPoint, topPoint, scale, normal); - getNormal(bottomPoint, rootPoint, rightPoint, scale, normal2); - normal.set(normal.add(normal2).normalize()); - } else if (c == getWidth() - 1) { // last column - topPoint.set(c, getValue(c, r - 1), r - 1); - leftPoint.set(c - 1, getValue(c - 1, r), r); - bottomPoint.set(c, getValue(c, r + 1), r + 1); - getNormal(topPoint, rootPoint, leftPoint, scale, normal); - getNormal(leftPoint, rootPoint, bottomPoint, scale, normal2); - normal.set(normal.add(normal2).normalize()); - } else { // all middle columns - topPoint.set(c, getValue(c, r - 1), r - 1); - leftPoint.set(c - 1, getValue(c - 1, r), r); - rightPoint.set(c + 1, getValue(c + 1, r), r); - bottomPoint.set(c, getValue(c, r + 1), r + 1); - getNormal(topPoint, rootPoint, leftPoint, scale, normal); - getNormal(leftPoint, rootPoint, bottomPoint, scale, normal2); - getNormal(bottomPoint, rootPoint, rightPoint, scale, normal3); - getNormal(rightPoint, rootPoint, topPoint, scale, normal4); - normal.set(normal.add(normal2).add(normal3).add(normal4).normalize()); - } - }*/ TempVars vars = TempVars.get(); Vector3f rootPoint = vars.vect1;