Work on minimizing terrain cell poly usage
This commit is contained in:
parent
dda5cb59e5
commit
fac9c5f41b
@ -420,6 +420,10 @@ public class ModelUtils {
|
|||||||
for(int x = 0; x < width - 1; x = x + stride){
|
for(int x = 0; x < width - 1; x = x + stride){
|
||||||
quadCurrent = null;
|
quadCurrent = null;
|
||||||
for(int y = 0; y < height - 1; y = y + stride){
|
for(int y = 0; y < height - 1; y = y + stride){
|
||||||
|
if((x == 5 && y == 2)){
|
||||||
|
System.out.println(quadCurrent);
|
||||||
|
// continue;
|
||||||
|
}
|
||||||
if(quadCurrent == null){
|
if(quadCurrent == null){
|
||||||
minVal = 100000000;
|
minVal = 100000000;
|
||||||
maxVal = 0;
|
maxVal = 0;
|
||||||
@ -452,7 +456,8 @@ public class ModelUtils {
|
|||||||
}
|
}
|
||||||
boolean textureMatch = false;
|
boolean textureMatch = false;
|
||||||
float texture = -1;
|
float texture = -1;
|
||||||
if(x+stride < width - 1 && y+stride < height -1 && texturemap[x][y] == texturemap[x+stride][y] &&
|
if(x+stride < width - 1 && y+stride < height -1 &&
|
||||||
|
texturemap[x][y] == texturemap[x+stride][y] &&
|
||||||
texturemap[x][y] == texturemap[x][y+stride] &&
|
texturemap[x][y] == texturemap[x][y+stride] &&
|
||||||
texturemap[x][y] == texturemap[x+stride][y+stride]){
|
texturemap[x][y] == texturemap[x+stride][y+stride]){
|
||||||
|
|
||||||
@ -496,7 +501,8 @@ public class ModelUtils {
|
|||||||
if(newMax - newMin < MINIMIZATION_DIFF_MAX &&
|
if(newMax - newMin < MINIMIZATION_DIFF_MAX &&
|
||||||
texturemap[quadCurrent.startX][quadCurrent.startY] == texturemap[x+stride][y] &&
|
texturemap[quadCurrent.startX][quadCurrent.startY] == texturemap[x+stride][y] &&
|
||||||
texturemap[quadCurrent.startX][quadCurrent.startY] == texturemap[x][y+stride] &&
|
texturemap[quadCurrent.startX][quadCurrent.startY] == texturemap[x][y+stride] &&
|
||||||
texturemap[quadCurrent.startX][quadCurrent.startY] == texturemap[x+stride][y+stride]
|
texturemap[quadCurrent.startX][quadCurrent.startY] == texturemap[x+stride][y+stride] &&
|
||||||
|
texturemap[x+stride][y+stride] == quadCurrent.texture
|
||||||
){
|
){
|
||||||
//add to quad
|
//add to quad
|
||||||
quadCurrent.endY = y + stride;
|
quadCurrent.endY = y + stride;
|
||||||
@ -578,7 +584,9 @@ public class ModelUtils {
|
|||||||
// finalQuads.add(currentQuad);
|
// finalQuads.add(currentQuad);
|
||||||
|
|
||||||
for(QuadToGenerate current : finalQuads){
|
for(QuadToGenerate current : finalQuads){
|
||||||
// System.out.println(current.startX + " " + current.startY + " " + current.endX + " " + current.endY);
|
if(current.startX > 0 && current.startY > 0 && current.endX < 99 && current.endY < 99){
|
||||||
|
System.out.println(current.startX + " " + current.startY + " " + current.endX + " " + current.endY);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// System.out.println(finalQuads.size());
|
// System.out.println(finalQuads.size());
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user