simplify part of transvoxel algo
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit

This commit is contained in:
austin 2025-06-04 22:16:23 -04:00
parent 661300297c
commit 6cbddbb42f
2 changed files with 45 additions and 37 deletions

View File

@ -2113,6 +2113,7 @@ Client uses non-rigid-body collidables for farther away entities (via client LOD
Reorder main content draw calls to support non-OIT transparencies better Reorder main content draw calls to support non-OIT transparencies better
Content debug supports rendering paths Content debug supports rendering paths
Rendering ai pathfinding paths Rendering ai pathfinding paths
Simplify part of transvoxel algo

View File

@ -28,60 +28,60 @@ public class TransvoxelModelGeneration {
/** /**
* Number of ints required to store an element * Number of ints required to store an element
*/ */
static final int INTS_PER_ELEMENT = 1; public static final int INTS_PER_ELEMENT = 1;
/** /**
* Number of elements per triangle * Number of elements per triangle
*/ */
static final int ELEMENTS_PER_TRIANGLE = 3; public static final int ELEMENTS_PER_TRIANGLE = 3;
/** /**
* Number of floats per vert * Number of floats per vert
*/ */
static final int FLOATS_PER_VERT = 3; public static final int FLOATS_PER_VERT = 3;
/** /**
* Number of vertices per triangle * Number of vertices per triangle
*/ */
static final int VERTS_PER_TRIANGLE = ELEMENTS_PER_TRIANGLE; public static final int VERTS_PER_TRIANGLE = ELEMENTS_PER_TRIANGLE;
/** /**
* Number of floats per UV * Number of floats per UV
*/ */
static final int FLOATS_PER_UV = 2; public static final int FLOATS_PER_UV = 2;
/** /**
* The number of sampler indices per triangle * The number of sampler indices per triangle
*/ */
static final int SAMPLER_INDICES_PER_TRIANGLE = 3; public static final int SAMPLER_INDICES_PER_TRIANGLE = 3;
/** /**
* The number of sampler values to store for each vertex * The number of sampler values to store for each vertex
*/ */
static final int SAMPLER_VALUES_PER_VERT = 3; public static final int SAMPLER_VALUES_PER_VERT = 3;
/** /**
* Size of the vector pool * Size of the vector pool
*/ */
static final int VECTOR_POOL_SIZE = 13; public static final int VECTOR_POOL_SIZE = 13;
/** /**
* Threshold of normal dot product * Threshold of normal dot product
*/ */
static final float NORMAL_DOT_THRESHOLD = 0.99f; public static final float NORMAL_DOT_THRESHOLD = 0.99f;
/** /**
* The min dist to check * The min dist to check
*/ */
static final double MIN_DIST = 0.00001; public static final double MIN_DIST = 0.00001;
//this is the width of the transition cell //this is the width of the transition cell
//it should be between 0 and 1, exclusive //it should be between 0 and 1, exclusive
//the higher the value, the more of the high resolution chunk we will see //the higher the value, the more of the high resolution chunk we will see
//the lower the value, the more of the low resolution chunk we will see //the lower the value, the more of the low resolution chunk we will see
static final float TRANSITION_CELL_WIDTH = 0.5f; public static final float TRANSITION_CELL_WIDTH = 0.5f;
/** /**
* The dimension of the array for the face generator. It must be 2 * <size of chunk> + 1. The extra 1 is for the neighbor value * The dimension of the array for the face generator. It must be 2 * <size of chunk> + 1. The extra 1 is for the neighbor value
@ -98,7 +98,7 @@ public class TransvoxelModelGeneration {
/** /**
* A single generated triangle * A single generated triangle
*/ */
static class Triangle { private static class Triangle {
//the indices //the indices
int[] indices = new int[3]; //array of size 3 int[] indices = new int[3]; //array of size 3
@ -118,7 +118,7 @@ public class TransvoxelModelGeneration {
/** /**
* The grid cell currently being looked at * The grid cell currently being looked at
*/ */
static class GridCell { private static class GridCell {
Vector3f[] points = new Vector3f[8]; //array of size 8 Vector3f[] points = new Vector3f[8]; //array of size 8
double[] val = new double[8]; //array of size 8 double[] val = new double[8]; //array of size 8
int[] atlasValues = new int[8]; //array of size 8 int[] atlasValues = new int[8]; //array of size 8
@ -148,7 +148,7 @@ public class TransvoxelModelGeneration {
/** /**
* The transition grid cell currently being looked at * The transition grid cell currently being looked at
*/ */
static class TransitionGridCell { private static class TransitionGridCell {
Vector3f[][] complexFacePoints = new Vector3f[3][3]; Vector3f[][] complexFacePoints = new Vector3f[3][3];
Vector3f[][] simpleFacePoints = new Vector3f[2][2]; Vector3f[][] simpleFacePoints = new Vector3f[2][2];
float[][] complexFaceValues = new float[3][3]; float[][] complexFaceValues = new float[3][3];
@ -205,9 +205,14 @@ public class TransvoxelModelGeneration {
//location of the sampler index data in the shader /**
* location of the sampler index data in the shader
*/
public static final int SAMPLER_INDEX_ATTRIB_LOC = 5; public static final int SAMPLER_INDEX_ATTRIB_LOC = 5;
//the ratio vectors of how much to pull from each texture
/**
* the ratio vectors of how much to pull from each texture
*/
public static final int SAMPLER_RATIO_ATTRIB_LOC = 6; public static final int SAMPLER_RATIO_ATTRIB_LOC = 6;
@ -234,7 +239,6 @@ public class TransvoxelModelGeneration {
*/ */
protected static int polygonize( protected static int polygonize(
GridCell grid, GridCell grid,
double isolevel,
List<Triangle> triangles, List<Triangle> triangles,
List<Vector3f> samplerIndices, List<Vector3f> samplerIndices,
Map<String,Integer> vertMap, Map<String,Integer> vertMap,
@ -251,6 +255,8 @@ public class TransvoxelModelGeneration {
int ntriang; int ntriang;
int cubeIndex = 0; int cubeIndex = 0;
float isolevel = TerrainChunkModelGeneration.MIN_ISO_VALUE;
//essentially, because the iso level is 0, we can end up generating weird midpoints between 0 and negative values //essentially, because the iso level is 0, we can end up generating weird midpoints between 0 and negative values
//in order to not actually generate triangles for these edge cases, the skip table is populated if the current edge is between 0 and a negative value //in order to not actually generate triangles for these edge cases, the skip table is populated if the current edge is between 0 and a negative value
//when storing triangles, all skip edges trigger the loop to skip to the next triangle set //when storing triangles, all skip edges trigger the loop to skip to the next triangle set
@ -524,7 +530,6 @@ public class TransvoxelModelGeneration {
*/ */
protected static int polygonizeTransition( protected static int polygonizeTransition(
TransitionGridCell transitionCell, TransitionGridCell transitionCell,
double isolevel,
List<Triangle> triangles, List<Triangle> triangles,
List<Vector3f> samplerIndices, List<Vector3f> samplerIndices,
Map<String,Integer> vertMap, Map<String,Integer> vertMap,
@ -537,6 +542,8 @@ public class TransvoxelModelGeneration {
StringBuilder builder StringBuilder builder
){ ){
float isolevel = TerrainChunkModelGeneration.MIN_ISO_VALUE;
/** /**
@ -1277,7 +1284,7 @@ public class TransvoxelModelGeneration {
chunkData.textureGrid[x+0][y+1][z+0], chunkData.textureGrid[x+0][y+1][z+1], chunkData.textureGrid[x+1][y+1][z+1], chunkData.textureGrid[x+1][y+1][z+0] chunkData.textureGrid[x+0][y+1][z+0], chunkData.textureGrid[x+0][y+1][z+1], chunkData.textureGrid[x+1][y+1][z+1], chunkData.textureGrid[x+1][y+1][z+0]
); );
//polygonize the current gridcell //polygonize the current gridcell
TransvoxelModelGeneration.polygonize(currentCell, TerrainChunkModelGeneration.MIN_ISO_VALUE, triangles, samplerTriangles, vertMap, verts, normals, trianglesSharingVert, false, vertList, samplerIndex, skip, builder); TransvoxelModelGeneration.polygonize(currentCell, triangles, samplerTriangles, vertMap, verts, normals, trianglesSharingVert, false, vertList, samplerIndex, skip, builder);
} }
} }
} }
@ -1349,7 +1356,7 @@ public class TransvoxelModelGeneration {
chunkData.xPositiveEdgeAtlas[(y+0)*2+0][(z+0)*2+0], chunkData.xPositiveEdgeAtlas[(y+1)*2+0][(z+0)*2+0], chunkData.xPositiveEdgeAtlas[(y+0)*2+0][(z+0)*2+0], chunkData.xPositiveEdgeAtlas[(y+1)*2+0][(z+0)*2+0],
chunkData.xPositiveEdgeAtlas[(y+0)*2+0][(z+1)*2+0], chunkData.xPositiveEdgeAtlas[(y+1)*2+0][(z+1)*2+0] chunkData.xPositiveEdgeAtlas[(y+0)*2+0][(z+1)*2+0], chunkData.xPositiveEdgeAtlas[(y+1)*2+0][(z+1)*2+0]
); );
TransvoxelModelGeneration.polygonizeTransition(currentTransitionCell, TerrainChunkModelGeneration.MIN_ISO_VALUE, triangles, samplerTriangles, vertMap, verts, normals, trianglesSharingVert, true, vertList, samplerIndex, builder); TransvoxelModelGeneration.polygonizeTransition(currentTransitionCell, triangles, samplerTriangles, vertMap, verts, normals, trianglesSharingVert, true, vertList, samplerIndex, builder);
// //
//Generate the normal cell with half width //Generate the normal cell with half width
@ -1371,7 +1378,7 @@ public class TransvoxelModelGeneration {
chunkData.textureGrid[x+0][y+1][z+0], chunkData.textureGrid[x+0][y+1][z+1], chunkData.xPositiveEdgeAtlas[(y+1)*2+0][(z+1)*2+0], chunkData.xPositiveEdgeAtlas[(y+1)*2+0][(z+0)*2+0] chunkData.textureGrid[x+0][y+1][z+0], chunkData.textureGrid[x+0][y+1][z+1], chunkData.xPositiveEdgeAtlas[(y+1)*2+0][(z+1)*2+0], chunkData.xPositiveEdgeAtlas[(y+1)*2+0][(z+0)*2+0]
); );
//polygonize the current gridcell //polygonize the current gridcell
TransvoxelModelGeneration.polygonize(currentCell, TerrainChunkModelGeneration.MIN_ISO_VALUE, triangles, samplerTriangles, vertMap, verts, normals, trianglesSharingVert, false, vertList, samplerIndex, skip, builder); TransvoxelModelGeneration.polygonize(currentCell, triangles, samplerTriangles, vertMap, verts, normals, trianglesSharingVert, false, vertList, samplerIndex, skip, builder);
} }
} }
} else { } else {
@ -1396,7 +1403,7 @@ public class TransvoxelModelGeneration {
chunkData.textureGrid[x+0][y+1][z+0], chunkData.textureGrid[x+0][y+1][z+1], chunkData.textureGrid[x+1][y+1][z+1], chunkData.textureGrid[x+1][y+1][z+0] chunkData.textureGrid[x+0][y+1][z+0], chunkData.textureGrid[x+0][y+1][z+1], chunkData.textureGrid[x+1][y+1][z+1], chunkData.textureGrid[x+1][y+1][z+0]
); );
//polygonize the current gridcell //polygonize the current gridcell
TransvoxelModelGeneration.polygonize(currentCell, TerrainChunkModelGeneration.MIN_ISO_VALUE, triangles, samplerTriangles, vertMap, verts, normals, trianglesSharingVert, false, vertList, samplerIndex, skip, builder); TransvoxelModelGeneration.polygonize(currentCell, triangles, samplerTriangles, vertMap, verts, normals, trianglesSharingVert, false, vertList, samplerIndex, skip, builder);
} }
} }
} }
@ -1461,7 +1468,7 @@ public class TransvoxelModelGeneration {
chunkData.xNegativeEdgeAtlas[(y+0)*2+0][(z+0)*2+0], chunkData.xNegativeEdgeAtlas[(y+1)*2+0][(z+0)*2+0], chunkData.xNegativeEdgeAtlas[(y+0)*2+0][(z+0)*2+0], chunkData.xNegativeEdgeAtlas[(y+1)*2+0][(z+0)*2+0],
chunkData.xNegativeEdgeAtlas[(y+0)*2+0][(z+1)*2+0], chunkData.xNegativeEdgeAtlas[(y+1)*2+0][(z+1)*2+0] chunkData.xNegativeEdgeAtlas[(y+0)*2+0][(z+1)*2+0], chunkData.xNegativeEdgeAtlas[(y+1)*2+0][(z+1)*2+0]
); );
TransvoxelModelGeneration.polygonizeTransition(currentTransitionCell, TerrainChunkModelGeneration.MIN_ISO_VALUE, triangles, samplerTriangles, vertMap, verts, normals, trianglesSharingVert, false, vertList, samplerIndex, builder); TransvoxelModelGeneration.polygonizeTransition(currentTransitionCell, triangles, samplerTriangles, vertMap, verts, normals, trianglesSharingVert, false, vertList, samplerIndex, builder);
// //
//Generate the normal cell with half width //Generate the normal cell with half width
@ -1483,7 +1490,7 @@ public class TransvoxelModelGeneration {
chunkData.xNegativeEdgeAtlas[(y+1)*2+0][(z+0)*2+0], chunkData.xNegativeEdgeAtlas[(y+1)*2+0][(z+1)*2+0], chunkData.textureGrid[x+1][y+1][z+1], chunkData.textureGrid[x+1][y+1][z+0] chunkData.xNegativeEdgeAtlas[(y+1)*2+0][(z+0)*2+0], chunkData.xNegativeEdgeAtlas[(y+1)*2+0][(z+1)*2+0], chunkData.textureGrid[x+1][y+1][z+1], chunkData.textureGrid[x+1][y+1][z+0]
); );
//polygonize the current gridcell //polygonize the current gridcell
TransvoxelModelGeneration.polygonize(currentCell, TerrainChunkModelGeneration.MIN_ISO_VALUE, triangles, samplerTriangles, vertMap, verts, normals, trianglesSharingVert, false, vertList, samplerIndex, skip, builder); TransvoxelModelGeneration.polygonize(currentCell, triangles, samplerTriangles, vertMap, verts, normals, trianglesSharingVert, false, vertList, samplerIndex, skip, builder);
} }
} }
} else { } else {
@ -1508,7 +1515,7 @@ public class TransvoxelModelGeneration {
chunkData.textureGrid[x+0][y+1][z+0], chunkData.textureGrid[x+0][y+1][z+1], chunkData.textureGrid[x+1][y+1][z+1], chunkData.textureGrid[x+1][y+1][z+0] chunkData.textureGrid[x+0][y+1][z+0], chunkData.textureGrid[x+0][y+1][z+1], chunkData.textureGrid[x+1][y+1][z+1], chunkData.textureGrid[x+1][y+1][z+0]
); );
//polygonize the current gridcell //polygonize the current gridcell
TransvoxelModelGeneration.polygonize(currentCell, TerrainChunkModelGeneration.MIN_ISO_VALUE, triangles, samplerTriangles, vertMap, verts, normals, trianglesSharingVert, false, vertList, samplerIndex, skip, builder); TransvoxelModelGeneration.polygonize(currentCell, triangles, samplerTriangles, vertMap, verts, normals, trianglesSharingVert, false, vertList, samplerIndex, skip, builder);
} }
} }
} }
@ -1572,7 +1579,7 @@ public class TransvoxelModelGeneration {
chunkData.yPositiveEdgeAtlas[(x+0)*2+0][(z+0)*2+0], chunkData.yPositiveEdgeAtlas[(x+1)*2+0][(z+0)*2+0], chunkData.yPositiveEdgeAtlas[(x+0)*2+0][(z+0)*2+0], chunkData.yPositiveEdgeAtlas[(x+1)*2+0][(z+0)*2+0],
chunkData.yPositiveEdgeAtlas[(x+0)*2+0][(z+1)*2+0], chunkData.yPositiveEdgeAtlas[(x+1)*2+0][(z+1)*2+0] chunkData.yPositiveEdgeAtlas[(x+0)*2+0][(z+1)*2+0], chunkData.yPositiveEdgeAtlas[(x+1)*2+0][(z+1)*2+0]
); );
TransvoxelModelGeneration.polygonizeTransition(currentTransitionCell, TerrainChunkModelGeneration.MIN_ISO_VALUE, triangles, samplerTriangles, vertMap, verts, normals, trianglesSharingVert, false, vertList, samplerIndex, builder); TransvoxelModelGeneration.polygonizeTransition(currentTransitionCell, triangles, samplerTriangles, vertMap, verts, normals, trianglesSharingVert, false, vertList, samplerIndex, builder);
// //
//Generate the normal cell with half width //Generate the normal cell with half width
@ -1594,7 +1601,7 @@ public class TransvoxelModelGeneration {
chunkData.yPositiveEdgeAtlas[(x+0)*2+0][(z+0)*2+0], chunkData.yPositiveEdgeAtlas[(x+0)*2+0][(z+1)*2+0], chunkData.yPositiveEdgeAtlas[(x+1)*2+0][(z+1)*2+0], chunkData.yPositiveEdgeAtlas[(x+1)*2+0][(z+0)*2+0] chunkData.yPositiveEdgeAtlas[(x+0)*2+0][(z+0)*2+0], chunkData.yPositiveEdgeAtlas[(x+0)*2+0][(z+1)*2+0], chunkData.yPositiveEdgeAtlas[(x+1)*2+0][(z+1)*2+0], chunkData.yPositiveEdgeAtlas[(x+1)*2+0][(z+0)*2+0]
); );
//polygonize the current gridcell //polygonize the current gridcell
TransvoxelModelGeneration.polygonize(currentCell, TerrainChunkModelGeneration.MIN_ISO_VALUE, triangles, samplerTriangles, vertMap, verts, normals, trianglesSharingVert, false, vertList, samplerIndex, skip, builder); TransvoxelModelGeneration.polygonize(currentCell, triangles, samplerTriangles, vertMap, verts, normals, trianglesSharingVert, false, vertList, samplerIndex, skip, builder);
} }
} }
} else { } else {
@ -1619,7 +1626,7 @@ public class TransvoxelModelGeneration {
chunkData.textureGrid[x+0][y+1][z+0], chunkData.textureGrid[x+0][y+1][z+1], chunkData.textureGrid[x+1][y+1][z+1], chunkData.textureGrid[x+1][y+1][z+0] chunkData.textureGrid[x+0][y+1][z+0], chunkData.textureGrid[x+0][y+1][z+1], chunkData.textureGrid[x+1][y+1][z+1], chunkData.textureGrid[x+1][y+1][z+0]
); );
//polygonize the current gridcell //polygonize the current gridcell
TransvoxelModelGeneration.polygonize(currentCell, TerrainChunkModelGeneration.MIN_ISO_VALUE, triangles, samplerTriangles, vertMap, verts, normals, trianglesSharingVert, false, vertList, samplerIndex, skip, builder); TransvoxelModelGeneration.polygonize(currentCell, triangles, samplerTriangles, vertMap, verts, normals, trianglesSharingVert, false, vertList, samplerIndex, skip, builder);
} }
} }
} }
@ -1683,7 +1690,7 @@ public class TransvoxelModelGeneration {
chunkData.yNegativeEdgeAtlas[(x+0)*2+0][(z+0)*2+0], chunkData.yNegativeEdgeAtlas[(x+1)*2+0][(z+0)*2+0], chunkData.yNegativeEdgeAtlas[(x+0)*2+0][(z+0)*2+0], chunkData.yNegativeEdgeAtlas[(x+1)*2+0][(z+0)*2+0],
chunkData.yNegativeEdgeAtlas[(x+0)*2+0][(z+1)*2+0], chunkData.yNegativeEdgeAtlas[(x+1)*2+0][(z+1)*2+0] chunkData.yNegativeEdgeAtlas[(x+0)*2+0][(z+1)*2+0], chunkData.yNegativeEdgeAtlas[(x+1)*2+0][(z+1)*2+0]
); );
TransvoxelModelGeneration.polygonizeTransition(currentTransitionCell, TerrainChunkModelGeneration.MIN_ISO_VALUE, triangles, samplerTriangles, vertMap, verts, normals, trianglesSharingVert, true, vertList, samplerIndex, builder); TransvoxelModelGeneration.polygonizeTransition(currentTransitionCell, triangles, samplerTriangles, vertMap, verts, normals, trianglesSharingVert, true, vertList, samplerIndex, builder);
// //
//Generate the normal cell with half width //Generate the normal cell with half width
@ -1705,7 +1712,7 @@ public class TransvoxelModelGeneration {
chunkData.yNegativeEdgeAtlas[(x+0)*2+0][(z+0)*2+0], chunkData.yNegativeEdgeAtlas[(x+0)*2+0][(z+1)*2+0], chunkData.yNegativeEdgeAtlas[(x+1)*2+0][(z+1)*2+0], chunkData.yNegativeEdgeAtlas[(x+1)*2+0][(z+0)*2+0] chunkData.yNegativeEdgeAtlas[(x+0)*2+0][(z+0)*2+0], chunkData.yNegativeEdgeAtlas[(x+0)*2+0][(z+1)*2+0], chunkData.yNegativeEdgeAtlas[(x+1)*2+0][(z+1)*2+0], chunkData.yNegativeEdgeAtlas[(x+1)*2+0][(z+0)*2+0]
); );
//polygonize the current gridcell //polygonize the current gridcell
TransvoxelModelGeneration.polygonize(currentCell, TerrainChunkModelGeneration.MIN_ISO_VALUE, triangles, samplerTriangles, vertMap, verts, normals, trianglesSharingVert, true, vertList, samplerIndex, skip, builder); TransvoxelModelGeneration.polygonize(currentCell, triangles, samplerTriangles, vertMap, verts, normals, trianglesSharingVert, true, vertList, samplerIndex, skip, builder);
} }
} }
} else { } else {
@ -1730,7 +1737,7 @@ public class TransvoxelModelGeneration {
chunkData.textureGrid[x+0][y+1][z+0], chunkData.textureGrid[x+0][y+1][z+1], chunkData.textureGrid[x+1][y+1][z+1], chunkData.textureGrid[x+1][y+1][z+0] chunkData.textureGrid[x+0][y+1][z+0], chunkData.textureGrid[x+0][y+1][z+1], chunkData.textureGrid[x+1][y+1][z+1], chunkData.textureGrid[x+1][y+1][z+0]
); );
//polygonize the current gridcell //polygonize the current gridcell
TransvoxelModelGeneration.polygonize(currentCell, TerrainChunkModelGeneration.MIN_ISO_VALUE, triangles, samplerTriangles, vertMap, verts, normals, trianglesSharingVert, false, vertList, samplerIndex, skip, builder); TransvoxelModelGeneration.polygonize(currentCell, triangles, samplerTriangles, vertMap, verts, normals, trianglesSharingVert, false, vertList, samplerIndex, skip, builder);
} }
} }
} }
@ -1795,7 +1802,7 @@ public class TransvoxelModelGeneration {
chunkData.zPositiveEdgeAtlas[(x+0)*2+0][(y+0)*2+0], chunkData.zPositiveEdgeAtlas[(x+0)*2+0][(y+1)*2+0], chunkData.zPositiveEdgeAtlas[(x+0)*2+0][(y+0)*2+0], chunkData.zPositiveEdgeAtlas[(x+0)*2+0][(y+1)*2+0],
chunkData.zPositiveEdgeAtlas[(x+1)*2+0][(y+0)*2+0], chunkData.zPositiveEdgeAtlas[(x+1)*2+0][(y+1)*2+0] chunkData.zPositiveEdgeAtlas[(x+1)*2+0][(y+0)*2+0], chunkData.zPositiveEdgeAtlas[(x+1)*2+0][(y+1)*2+0]
); );
TransvoxelModelGeneration.polygonizeTransition(currentTransitionCell, TerrainChunkModelGeneration.MIN_ISO_VALUE, triangles, samplerTriangles, vertMap, verts, normals, trianglesSharingVert, false, vertList, samplerIndex, builder); TransvoxelModelGeneration.polygonizeTransition(currentTransitionCell, triangles, samplerTriangles, vertMap, verts, normals, trianglesSharingVert, false, vertList, samplerIndex, builder);
// //
//Generate the normal cell with half width //Generate the normal cell with half width
@ -1817,7 +1824,7 @@ public class TransvoxelModelGeneration {
chunkData.textureGrid[x+0][y+1][z+0], chunkData.zPositiveEdgeAtlas[(x+0)*2+0][(y+1)*2+0], chunkData.zPositiveEdgeAtlas[(x+1)*2+0][(y+1)*2+0], chunkData.textureGrid[x+1][y+1][z+0] chunkData.textureGrid[x+0][y+1][z+0], chunkData.zPositiveEdgeAtlas[(x+0)*2+0][(y+1)*2+0], chunkData.zPositiveEdgeAtlas[(x+1)*2+0][(y+1)*2+0], chunkData.textureGrid[x+1][y+1][z+0]
); );
//polygonize the current gridcell //polygonize the current gridcell
TransvoxelModelGeneration.polygonize(currentCell, TerrainChunkModelGeneration.MIN_ISO_VALUE, triangles, samplerTriangles, vertMap, verts, normals, trianglesSharingVert, false, vertList, samplerIndex, skip, builder); TransvoxelModelGeneration.polygonize(currentCell, triangles, samplerTriangles, vertMap, verts, normals, trianglesSharingVert, false, vertList, samplerIndex, skip, builder);
} }
} }
} else { } else {
@ -1842,7 +1849,7 @@ public class TransvoxelModelGeneration {
chunkData.textureGrid[x+0][y+1][z+0], chunkData.textureGrid[x+0][y+1][z+1], chunkData.textureGrid[x+1][y+1][z+1], chunkData.textureGrid[x+1][y+1][z+0] chunkData.textureGrid[x+0][y+1][z+0], chunkData.textureGrid[x+0][y+1][z+1], chunkData.textureGrid[x+1][y+1][z+1], chunkData.textureGrid[x+1][y+1][z+0]
); );
//polygonize the current gridcell //polygonize the current gridcell
TransvoxelModelGeneration.polygonize(currentCell, TerrainChunkModelGeneration.MIN_ISO_VALUE, triangles, samplerTriangles, vertMap, verts, normals, trianglesSharingVert, false, vertList, samplerIndex, skip, builder); TransvoxelModelGeneration.polygonize(currentCell, triangles, samplerTriangles, vertMap, verts, normals, trianglesSharingVert, false, vertList, samplerIndex, skip, builder);
} }
} }
} }
@ -1907,7 +1914,7 @@ public class TransvoxelModelGeneration {
chunkData.zNegativeEdgeAtlas[(x+0)*2+0][(y+0)*2+0], chunkData.zNegativeEdgeAtlas[(x+0)*2+0][(y+1)*2+0], chunkData.zNegativeEdgeAtlas[(x+0)*2+0][(y+0)*2+0], chunkData.zNegativeEdgeAtlas[(x+0)*2+0][(y+1)*2+0],
chunkData.zNegativeEdgeAtlas[(x+1)*2+0][(y+0)*2+0], chunkData.zNegativeEdgeAtlas[(x+1)*2+0][(y+1)*2+0] chunkData.zNegativeEdgeAtlas[(x+1)*2+0][(y+0)*2+0], chunkData.zNegativeEdgeAtlas[(x+1)*2+0][(y+1)*2+0]
); );
TransvoxelModelGeneration.polygonizeTransition(currentTransitionCell, TerrainChunkModelGeneration.MIN_ISO_VALUE, triangles, samplerTriangles, vertMap, verts, normals, trianglesSharingVert, true, vertList, samplerIndex, builder); TransvoxelModelGeneration.polygonizeTransition(currentTransitionCell, triangles, samplerTriangles, vertMap, verts, normals, trianglesSharingVert, true, vertList, samplerIndex, builder);
// //
//Generate the normal cell with half width //Generate the normal cell with half width
@ -1929,7 +1936,7 @@ public class TransvoxelModelGeneration {
chunkData.textureGrid[x+0][y+1][z+1], chunkData.zNegativeEdgeAtlas[(x+0)*2+0][(y+1)*2+0], chunkData.zNegativeEdgeAtlas[(x+1)*2+0][(y+1)*2+0], chunkData.textureGrid[x+1][y+1][z+1] chunkData.textureGrid[x+0][y+1][z+1], chunkData.zNegativeEdgeAtlas[(x+0)*2+0][(y+1)*2+0], chunkData.zNegativeEdgeAtlas[(x+1)*2+0][(y+1)*2+0], chunkData.textureGrid[x+1][y+1][z+1]
); );
//polygonize the current gridcell //polygonize the current gridcell
TransvoxelModelGeneration.polygonize(currentCell, TerrainChunkModelGeneration.MIN_ISO_VALUE, triangles, samplerTriangles, vertMap, verts, normals, trianglesSharingVert, true, vertList, samplerIndex, skip, builder); TransvoxelModelGeneration.polygonize(currentCell, triangles, samplerTriangles, vertMap, verts, normals, trianglesSharingVert, true, vertList, samplerIndex, skip, builder);
} }
} }
} else { } else {
@ -1954,7 +1961,7 @@ public class TransvoxelModelGeneration {
chunkData.textureGrid[x+0][y+1][z+0], chunkData.textureGrid[x+0][y+1][z+1], chunkData.textureGrid[x+1][y+1][z+1], chunkData.textureGrid[x+1][y+1][z+0] chunkData.textureGrid[x+0][y+1][z+0], chunkData.textureGrid[x+0][y+1][z+1], chunkData.textureGrid[x+1][y+1][z+1], chunkData.textureGrid[x+1][y+1][z+0]
); );
//polygonize the current gridcell //polygonize the current gridcell
TransvoxelModelGeneration.polygonize(currentCell, TerrainChunkModelGeneration.MIN_ISO_VALUE, triangles, samplerTriangles, vertMap, verts, normals, trianglesSharingVert, false, vertList, samplerIndex, skip, builder); TransvoxelModelGeneration.polygonize(currentCell, triangles, samplerTriangles, vertMap, verts, normals, trianglesSharingVert, false, vertList, samplerIndex, skip, builder);
} }
} }
} }