cleaned up geomap code
git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@8808 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
parent
36453a919c
commit
9da184fcd7
@ -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)
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user