|
|
@ -762,83 +762,6 @@ public class LODGeomap extends GeoMap { |
|
|
|
} |
|
|
|
} |
|
|
|
store.rewind(); |
|
|
|
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(); |
|
|
|
TempVars vars = TempVars.get(); |
|
|
|
|
|
|
|
|
|
|
|
Vector3f rootPoint = vars.vect1; |
|
|
|
Vector3f rootPoint = vars.vect1; |
|
|
|