performance work
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good

This commit is contained in:
austin 2025-03-30 13:01:46 -04:00
parent c630a184aa
commit 75eb75b2db
8 changed files with 240 additions and 47 deletions

View File

@ -1385,6 +1385,11 @@ Code cleanup
Small ServerAttackTree fix (for when not holding an item)
Work on optimization
(03/30/2025)
Reorganizing terrain data
ServerGroundMovementTree concurrent modify fix
TransvoxelModelGeneration allocation reduction
# TODO

View File

@ -1,4 +1,4 @@
package electrosphere.entity.types.terrain;
package electrosphere.client.terrain.data;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;
@ -12,18 +12,35 @@ import electrosphere.entity.state.collidable.TriGeomData;
*/
public class TerrainChunkData implements TriGeomData {
//the verts
/**
* The vertices
*/
float[] vertices;
//normals
/**
* The normals
*/
float[] normals;
//faces
/**
* The indices of the faces
*/
int[] faceElements;
//UVs
/**
* The UVs
*/
float[] uvs;
//texture samplers
float[] textureSamplers; //what textures in the atlas to sample
//texture ratio vector
float[] textureRatioVectors; //HOW MUCH of each texture in the atlas to sample
/**
* what textures in the atlas to sample
*/
float[] textureSamplers;
/**
* HOW MUCH of each texture in the atlas to sample
*/
float[] textureRatioVectors;
/**
* The various buffers of data to send to the gpu
@ -133,26 +150,50 @@ public class TerrainChunkData implements TriGeomData {
return lod;
}
/**
* Gets the vertex buffer
* @return The buffer
*/
public FloatBuffer getVertexArrayBufferData() {
return vertexArrayBufferData;
}
/**
* Gets the normal buffer
* @return The buffer
*/
public FloatBuffer getNormalArrayBufferData() {
return normalArrayBufferData;
}
/**
* Gets the texture array buffer
* @return The buffer
*/
public FloatBuffer getTextureArrayBufferData() {
return textureArrayBufferData;
}
/**
* Gets the index buffer
* @return The buffer
*/
public IntBuffer getElementArrayBufferData() {
return elementArrayBufferData;
}
/**
* Gets the sampler index buffer
* @return The buffer
*/
public FloatBuffer getSamplerBuffer() {
return samplerBuffer;
}
/**
* Gets the sampler ratio buffer
* @return The buffer
*/
public FloatBuffer getRatioBuffer() {
return ratioBuffer;
}

View File

@ -23,10 +23,10 @@ import electrosphere.client.terrain.cache.ClientTerrainCache;
import electrosphere.client.terrain.cells.ClientDrawCellManager;
import electrosphere.client.terrain.cells.DrawCell;
import electrosphere.client.terrain.cells.VoxelTextureAtlas;
import electrosphere.client.terrain.data.TerrainChunkData;
import electrosphere.engine.Globals;
import electrosphere.entity.ClientEntityUtils;
import electrosphere.entity.Entity;
import electrosphere.entity.types.terrain.TerrainChunkData;
import electrosphere.logger.LoggerInterface;
import electrosphere.net.parser.net.message.TerrainMessage;
import electrosphere.renderer.meshgen.TransvoxelModelGeneration;

View File

@ -2,8 +2,8 @@ package electrosphere.client.terrain.manager;
import electrosphere.client.terrain.cells.DrawCell;
import electrosphere.client.terrain.cells.VoxelTextureAtlas;
import electrosphere.client.terrain.data.TerrainChunkData;
import electrosphere.entity.Entity;
import electrosphere.entity.types.terrain.TerrainChunkData;
/**
* Represents an item in a queue of terrain chunks to have models generated in the main thread

View File

@ -37,6 +37,7 @@ import electrosphere.util.math.SpatialMathUtils;
import java.util.LinkedList;
import java.util.List;
import java.util.concurrent.locks.ReentrantLock;
import org.joml.Quaterniond;
import org.joml.Vector3d;
@ -49,6 +50,11 @@ Behavior tree for movement in an entity
*/
public class ServerGroundMovementTree implements BehaviorTree {
/**
* Lock for handling threading with network messages
*/
static ReentrantLock lock = new ReentrantLock();
String animationStartUp = Animation.ANIMATION_MOVEMENT_STARTUP;
String animationMain = Animation.ANIMATION_MOVEMENT_MOVE;
@ -216,8 +222,8 @@ public class ServerGroundMovementTree implements BehaviorTree {
}
//parse attached network messages
lock.lock();
for(EntityMessage message : networkMessageQueue){
networkMessageQueue.remove(message);
long updateTime = message.gettime();
// System.out.println("MOVE to " + message.getX() + " " + message.getY() + " " + message.getZ());
switch(message.getMessageSubtype()){
@ -247,6 +253,8 @@ public class ServerGroundMovementTree implements BehaviorTree {
break;
}
}
networkMessageQueue.clear();
lock.unlock();
// System.out.println(movementVector + " " + velocity * Main.deltaTime);
@ -471,8 +479,14 @@ public class ServerGroundMovementTree implements BehaviorTree {
return velocity * sprintModifier * walkModifier * attackModifier;
}
/**
* Adds a network message for the tree to parse
* @param networkMessage The message
*/
public void addNetworkMessage(EntityMessage networkMessage) {
lock.lock();
networkMessageQueue.add(networkMessage);
lock.unlock();
}
/**

View File

@ -12,6 +12,7 @@ import electrosphere.client.block.BlockChunkData;
import electrosphere.client.terrain.cells.ClientDrawCellManager;
import electrosphere.client.terrain.cells.DrawCell;
import electrosphere.client.terrain.cells.VoxelTextureAtlas;
import electrosphere.client.terrain.data.TerrainChunkData;
import electrosphere.client.terrain.manager.ClientTerrainManager;
import electrosphere.collision.PhysicsEntityUtils;
import electrosphere.collision.PhysicsUtils;
@ -67,7 +68,7 @@ public class TerrainChunk {
if(Globals.clientScene.containsEntity(rVal)){
String modelPath = ClientTerrainManager.queueTerrainGridGeneration(data, atlas, notifyTarget, toDelete);
EntityCreationUtils.makeEntityDrawablePreexistingModel(rVal, modelPath);
if(levelOfDetail == BlockChunkData.LOD_FULL_RES && data.faceElements.length > 0){
if(levelOfDetail == BlockChunkData.LOD_FULL_RES && data.getFaceElements().length > 0){
PhysicsEntityUtils.clientAttachTriGeomRigidBody(rVal, data);
Vector3d finalPos = new Vector3d(EntityUtils.getPosition(rVal));
CollisionObjUtils.clientPositionCharacter(rVal, finalPos, new Quaterniond());
@ -116,7 +117,7 @@ public class TerrainChunk {
TransvoxelChunkData chunkData = new TransvoxelChunkData(weights, values, ClientDrawCellManager.FULL_RES_LOD);
TerrainChunkData data = TransvoxelModelGeneration.generateTerrainChunkData(chunkData);
if(data.vertices.length > 0){
if(data.getVertices().length > 0){
PhysicsEntityUtils.serverAttachTriGeomRigidBody(entity, data);
Realm realm = Globals.realmManager.getEntityRealm(entity);
DBody terrainBody = PhysicsEntityUtils.getDBody(entity);

View File

@ -13,8 +13,8 @@ import org.joml.Vector3f;
import static org.lwjgl.opengl.GL30.glBindVertexArray;
import electrosphere.client.terrain.cells.VoxelTextureAtlas;
import electrosphere.client.terrain.data.TerrainChunkData;
import electrosphere.engine.Globals;
import electrosphere.entity.types.terrain.TerrainChunkData;
import electrosphere.renderer.model.Material;
import electrosphere.renderer.model.Mesh;
import electrosphere.renderer.model.Model;

View File

@ -11,8 +11,8 @@ import org.joml.Vector3f;
import org.lwjgl.opengl.GL40;
import electrosphere.client.terrain.cells.VoxelTextureAtlas;
import electrosphere.client.terrain.data.TerrainChunkData;
import electrosphere.engine.Globals;
import electrosphere.entity.types.terrain.TerrainChunkData;
import electrosphere.logger.LoggerInterface;
import electrosphere.renderer.model.Material;
import electrosphere.renderer.model.Mesh;
@ -63,7 +63,7 @@ public class TransvoxelModelGeneration {
/**
* Size of the vector pool
*/
static final int VECTOR_POOL_SIZE = 11;
static final int VECTOR_POOL_SIZE = 13;
/**
* Threshold of normal dot product
@ -1277,17 +1277,39 @@ public class TransvoxelModelGeneration {
int x = ServerTerrainChunk.CHUNK_DATA_GENERATOR_SIZE - 2;
for(int y = yStartIndex; y < yEndIndex; y++){
for(int z = zStartIndex; z < zEndIndex; z++){
vecPool[0].set(x+1,y,z);
vecPool[1].set(x+1,y+TRANSITION_CELL_WIDTH,z);
vecPool[2].set(x+1,y+1,z);
vecPool[3].set(x+1,y,z+TRANSITION_CELL_WIDTH);
vecPool[4].set(x+1,y+TRANSITION_CELL_WIDTH,z+TRANSITION_CELL_WIDTH);
vecPool[5].set(x+1,y+1,z+TRANSITION_CELL_WIDTH);
vecPool[6].set(x+1,y,z+1);
vecPool[7].set(x+1,y+TRANSITION_CELL_WIDTH,z+1);
vecPool[8].set(x+1,y+1,z+1);
vecPool[9].set(x+TRANSITION_CELL_WIDTH,y,z);
vecPool[10].set(x+TRANSITION_CELL_WIDTH,y+1,z);
vecPool[11].set(x+TRANSITION_CELL_WIDTH,y,z+1);
vecPool[12].set(x+TRANSITION_CELL_WIDTH,y+1,z+1);
//
//Generate the transition cell
//
currentTransitionCell.setValues(
//complex face vertex coordinates
new Vector3f(x+1,y,z), new Vector3f(x+1,y+TRANSITION_CELL_WIDTH,z), new Vector3f(x+1,y+1,z),
new Vector3f(x+1,y,z+TRANSITION_CELL_WIDTH), new Vector3f(x+1,y+TRANSITION_CELL_WIDTH,z+TRANSITION_CELL_WIDTH), new Vector3f(x+1,y+1,z+TRANSITION_CELL_WIDTH),
new Vector3f(x+1,y,z+1), new Vector3f(x+1,y+TRANSITION_CELL_WIDTH,z+1), new Vector3f(x+1,y+1,z+1),
// new Vector3f(x+1,y,z), new Vector3f(x+1,y+TRANSITION_CELL_WIDTH,z), new Vector3f(x+1,y+1,z),
// new Vector3f(x+1,y,z+TRANSITION_CELL_WIDTH), new Vector3f(x+1,y+TRANSITION_CELL_WIDTH,z+TRANSITION_CELL_WIDTH), new Vector3f(x+1,y+1,z+TRANSITION_CELL_WIDTH),
// new Vector3f(x+1,y,z+1), new Vector3f(x+1,y+TRANSITION_CELL_WIDTH,z+1), new Vector3f(x+1,y+1,z+1),
// //simple face vertex coordinates
// new Vector3f(x+TRANSITION_CELL_WIDTH,y,z), new Vector3f(x+TRANSITION_CELL_WIDTH,y+1,z),
// new Vector3f(x+TRANSITION_CELL_WIDTH,y,z+1), new Vector3f(x+TRANSITION_CELL_WIDTH,y+1,z+1),
//complex face vertex coordinates
vecPool[0], vecPool[1], vecPool[2],
vecPool[3], vecPool[4], vecPool[5],
vecPool[6], vecPool[7], vecPool[8],
//simple face vertex coordinates
new Vector3f(x+TRANSITION_CELL_WIDTH,y,z), new Vector3f(x+TRANSITION_CELL_WIDTH,y+1,z),
new Vector3f(x+TRANSITION_CELL_WIDTH,y,z+1), new Vector3f(x+TRANSITION_CELL_WIDTH,y+1,z+1),
vecPool[9], vecPool[10],
vecPool[11], vecPool[12],
//complex face iso values
chunkData.xPositiveEdgeIso[(y+0)*2+0][(z+0)*2+0], chunkData.xPositiveEdgeIso[(y+0)*2+1][(z+0)*2+0], chunkData.xPositiveEdgeIso[(y+1)*2+0][(z+0)*2+0],
chunkData.xPositiveEdgeIso[(y+0)*2+0][(z+0)*2+1], chunkData.xPositiveEdgeIso[(y+0)*2+1][(z+0)*2+1], chunkData.xPositiveEdgeIso[(y+1)*2+0][(z+0)*2+1],
@ -1367,17 +1389,39 @@ public class TransvoxelModelGeneration {
int x = 0;
for(int y = yStartIndex; y < yEndIndex; y++){
for(int z = zStartIndex; z < zEndIndex; z++){
vecPool[0].set(x,y,z);
vecPool[1].set(x,y+TRANSITION_CELL_WIDTH,z);
vecPool[2].set(x,y+1,z);
vecPool[3].set(x,y,z+TRANSITION_CELL_WIDTH);
vecPool[4].set(x,y+TRANSITION_CELL_WIDTH,z+TRANSITION_CELL_WIDTH);
vecPool[5].set(x,y+1,z+TRANSITION_CELL_WIDTH);
vecPool[6].set(x,y,z+1);
vecPool[7].set(x,y+TRANSITION_CELL_WIDTH,z+1);
vecPool[8].set(x,y+1,z+1);
vecPool[9].set(x+TRANSITION_CELL_WIDTH,y,z);
vecPool[10].set(x+TRANSITION_CELL_WIDTH,y+1,z);
vecPool[11].set(x+TRANSITION_CELL_WIDTH,y,z+1);
vecPool[12].set(x+TRANSITION_CELL_WIDTH,y+1,z+1);
//
//Generate the transition cell
//
currentTransitionCell.setValues(
// //complex face vertex coordinates
// new Vector3f(x,y,z), new Vector3f(x,y+TRANSITION_CELL_WIDTH,z), new Vector3f(x,y+1,z),
// new Vector3f(x,y,z+TRANSITION_CELL_WIDTH), new Vector3f(x,y+TRANSITION_CELL_WIDTH,z+TRANSITION_CELL_WIDTH), new Vector3f(x,y+1,z+TRANSITION_CELL_WIDTH),
// new Vector3f(x,y,z+1), new Vector3f(x,y+TRANSITION_CELL_WIDTH,z+1), new Vector3f(x,y+1,z+1),
// //simple face vertex coordinates
// new Vector3f(x+TRANSITION_CELL_WIDTH,y,z), new Vector3f(x+TRANSITION_CELL_WIDTH,y+1,z),
// new Vector3f(x+TRANSITION_CELL_WIDTH,y,z+1), new Vector3f(x+TRANSITION_CELL_WIDTH,y+1,z+1),
//complex face vertex coordinates
new Vector3f(x,y,z), new Vector3f(x,y+TRANSITION_CELL_WIDTH,z), new Vector3f(x,y+1,z),
new Vector3f(x,y,z+TRANSITION_CELL_WIDTH), new Vector3f(x,y+TRANSITION_CELL_WIDTH,z+TRANSITION_CELL_WIDTH), new Vector3f(x,y+1,z+TRANSITION_CELL_WIDTH),
new Vector3f(x,y,z+1), new Vector3f(x,y+TRANSITION_CELL_WIDTH,z+1), new Vector3f(x,y+1,z+1),
vecPool[0], vecPool[1], vecPool[2],
vecPool[3], vecPool[4], vecPool[5],
vecPool[6], vecPool[7], vecPool[8],
//simple face vertex coordinates
new Vector3f(x+TRANSITION_CELL_WIDTH,y,z), new Vector3f(x+TRANSITION_CELL_WIDTH,y+1,z),
new Vector3f(x+TRANSITION_CELL_WIDTH,y,z+1), new Vector3f(x+TRANSITION_CELL_WIDTH,y+1,z+1),
vecPool[9], vecPool[10],
vecPool[11], vecPool[12],
//complex face iso values
chunkData.xNegativeEdgeIso[(y+0)*2+0][(z+0)*2+0], chunkData.xNegativeEdgeIso[(y+0)*2+1][(z+0)*2+0], chunkData.xNegativeEdgeIso[(y+1)*2+0][(z+0)*2+0],
chunkData.xNegativeEdgeIso[(y+0)*2+0][(z+0)*2+1], chunkData.xNegativeEdgeIso[(y+0)*2+1][(z+0)*2+1], chunkData.xNegativeEdgeIso[(y+1)*2+0][(z+0)*2+1],
@ -1456,17 +1500,39 @@ public class TransvoxelModelGeneration {
int y = ServerTerrainChunk.CHUNK_DATA_GENERATOR_SIZE - 2;
for(int x = xStartIndex; x < xEndIndex; x++){
for(int z = zStartIndex; z < zEndIndex; z++){
vecPool[0].set(x,y+1,z);
vecPool[1].set(x+TRANSITION_CELL_WIDTH,y+1,z);
vecPool[2].set(x+1,y+1,z);
vecPool[3].set(x,y+1,z+TRANSITION_CELL_WIDTH);
vecPool[4].set(x+TRANSITION_CELL_WIDTH,y+1,z+TRANSITION_CELL_WIDTH);
vecPool[5].set(x+1,y+1,z+TRANSITION_CELL_WIDTH);
vecPool[6].set(x,y+1,z+1);
vecPool[7].set(x+TRANSITION_CELL_WIDTH,y+1,z+1);
vecPool[8].set(x+1,y+1,z+1);
vecPool[9].set(x,y+TRANSITION_CELL_WIDTH,z);
vecPool[10].set(x+1,y+TRANSITION_CELL_WIDTH,z);
vecPool[11].set(x,y+TRANSITION_CELL_WIDTH,z+1);
vecPool[12].set(x+1,y+TRANSITION_CELL_WIDTH,z+1);
//
//Generate the transition cell
//
currentTransitionCell.setValues(
// //complex face vertex coordinates
// new Vector3f(x,y+1,z), new Vector3f(x+TRANSITION_CELL_WIDTH,y+1,z), new Vector3f(x+1,y+1,z),
// new Vector3f(x,y+1,z+TRANSITION_CELL_WIDTH), new Vector3f(x+TRANSITION_CELL_WIDTH,y+1,z+TRANSITION_CELL_WIDTH), new Vector3f(x+1,y+1,z+TRANSITION_CELL_WIDTH),
// new Vector3f(x,y+1,z+1), new Vector3f(x+TRANSITION_CELL_WIDTH,y+1,z+1), new Vector3f(x+1,y+1,z+1),
// //simple face vertex coordinates
// new Vector3f(x,y+TRANSITION_CELL_WIDTH,z), new Vector3f(x+1,y+TRANSITION_CELL_WIDTH,z),
// new Vector3f(x,y+TRANSITION_CELL_WIDTH,z+1), new Vector3f(x+1,y+TRANSITION_CELL_WIDTH,z+1),
//complex face vertex coordinates
new Vector3f(x,y+1,z), new Vector3f(x+TRANSITION_CELL_WIDTH,y+1,z), new Vector3f(x+1,y+1,z),
new Vector3f(x,y+1,z+TRANSITION_CELL_WIDTH), new Vector3f(x+TRANSITION_CELL_WIDTH,y+1,z+TRANSITION_CELL_WIDTH), new Vector3f(x+1,y+1,z+TRANSITION_CELL_WIDTH),
new Vector3f(x,y+1,z+1), new Vector3f(x+TRANSITION_CELL_WIDTH,y+1,z+1), new Vector3f(x+1,y+1,z+1),
vecPool[0], vecPool[1], vecPool[2],
vecPool[3], vecPool[4], vecPool[5],
vecPool[6], vecPool[7], vecPool[8],
//simple face vertex coordinates
new Vector3f(x,y+TRANSITION_CELL_WIDTH,z), new Vector3f(x+1,y+TRANSITION_CELL_WIDTH,z),
new Vector3f(x,y+TRANSITION_CELL_WIDTH,z+1), new Vector3f(x+1,y+TRANSITION_CELL_WIDTH,z+1),
vecPool[9], vecPool[10],
vecPool[11], vecPool[12],
//complex face iso values
chunkData.yPositiveEdgeIso[(x+0)*2+0][(z+0)*2+0], chunkData.yPositiveEdgeIso[(x+0)*2+1][(z+0)*2+0], chunkData.yPositiveEdgeIso[(x+1)*2+0][(z+0)*2+0],
chunkData.yPositiveEdgeIso[(x+0)*2+0][(z+0)*2+1], chunkData.yPositiveEdgeIso[(x+0)*2+1][(z+0)*2+1], chunkData.yPositiveEdgeIso[(x+1)*2+0][(z+0)*2+1],
@ -1545,17 +1611,39 @@ public class TransvoxelModelGeneration {
int y = 0;
for(int x = xStartIndex; x < xEndIndex; x++){
for(int z = zStartIndex; z < zEndIndex; z++){
vecPool[0].set(x,y+0,z);
vecPool[1].set(x+TRANSITION_CELL_WIDTH,y+0,z);
vecPool[2].set(x+1,y+0,z);
vecPool[3].set(x,y+0,z+TRANSITION_CELL_WIDTH);
vecPool[4].set(x+TRANSITION_CELL_WIDTH,y+0,z+TRANSITION_CELL_WIDTH);
vecPool[5].set(x+1,y+0,z+TRANSITION_CELL_WIDTH);
vecPool[6].set(x,y+0,z+1);
vecPool[7].set(x+TRANSITION_CELL_WIDTH,y+0,z+1);
vecPool[8].set(x+1,y+0,z+1);
vecPool[9].set(x,y+TRANSITION_CELL_WIDTH,z);
vecPool[10].set(x+1,y+TRANSITION_CELL_WIDTH,z);
vecPool[11].set(x,y+TRANSITION_CELL_WIDTH,z+1);
vecPool[12].set(x+1,y+TRANSITION_CELL_WIDTH,z+1);
//
//Generate the transition cell
//
currentTransitionCell.setValues(
// //complex face vertex coordinates
// new Vector3f(x,y+0,z), new Vector3f(x+TRANSITION_CELL_WIDTH,y+0,z), new Vector3f(x+1,y+0,z),
// new Vector3f(x,y+0,z+TRANSITION_CELL_WIDTH), new Vector3f(x+TRANSITION_CELL_WIDTH,y+0,z+TRANSITION_CELL_WIDTH), new Vector3f(x+1,y+0,z+TRANSITION_CELL_WIDTH),
// new Vector3f(x,y+0,z+1), new Vector3f(x+TRANSITION_CELL_WIDTH,y+0,z+1), new Vector3f(x+1,y+0,z+1),
// //simple face vertex coordinates
// new Vector3f(x,y+TRANSITION_CELL_WIDTH,z), new Vector3f(x+1,y+TRANSITION_CELL_WIDTH,z),
// new Vector3f(x,y+TRANSITION_CELL_WIDTH,z+1), new Vector3f(x+1,y+TRANSITION_CELL_WIDTH,z+1),
//complex face vertex coordinates
new Vector3f(x,y+0,z), new Vector3f(x+TRANSITION_CELL_WIDTH,y+0,z), new Vector3f(x+1,y+0,z),
new Vector3f(x,y+0,z+TRANSITION_CELL_WIDTH), new Vector3f(x+TRANSITION_CELL_WIDTH,y+0,z+TRANSITION_CELL_WIDTH), new Vector3f(x+1,y+0,z+TRANSITION_CELL_WIDTH),
new Vector3f(x,y+0,z+1), new Vector3f(x+TRANSITION_CELL_WIDTH,y+0,z+1), new Vector3f(x+1,y+0,z+1),
vecPool[0], vecPool[1], vecPool[2],
vecPool[3], vecPool[4], vecPool[5],
vecPool[6], vecPool[7], vecPool[8],
//simple face vertex coordinates
new Vector3f(x,y+TRANSITION_CELL_WIDTH,z), new Vector3f(x+1,y+TRANSITION_CELL_WIDTH,z),
new Vector3f(x,y+TRANSITION_CELL_WIDTH,z+1), new Vector3f(x+1,y+TRANSITION_CELL_WIDTH,z+1),
vecPool[9], vecPool[10],
vecPool[11], vecPool[12],
//complex face iso values
chunkData.yNegativeEdgeIso[(x+0)*2+0][(z+0)*2+0], chunkData.yNegativeEdgeIso[(x+0)*2+1][(z+0)*2+0], chunkData.yNegativeEdgeIso[(x+1)*2+0][(z+0)*2+0],
chunkData.yNegativeEdgeIso[(x+0)*2+0][(z+0)*2+1], chunkData.yNegativeEdgeIso[(x+0)*2+1][(z+0)*2+1], chunkData.yNegativeEdgeIso[(x+1)*2+0][(z+0)*2+1],
@ -1635,17 +1723,39 @@ public class TransvoxelModelGeneration {
int z = ServerTerrainChunk.CHUNK_DATA_GENERATOR_SIZE - 2;
for(int x = xStartIndex; x < xEndIndex; x++){
for(int y = yStartIndex; y < yEndIndex; y++){
vecPool[0].set(x+0,y,z+1);
vecPool[1].set(x+0,y+TRANSITION_CELL_WIDTH,z+1);
vecPool[2].set(x+0,y+1,z+1);
vecPool[3].set(x+TRANSITION_CELL_WIDTH,y,z+1);
vecPool[4].set(x+TRANSITION_CELL_WIDTH,y+TRANSITION_CELL_WIDTH,z+1);
vecPool[5].set(x+TRANSITION_CELL_WIDTH,y+1,z+1);
vecPool[6].set(x+1,y,z+1);
vecPool[7].set(x+1,y+TRANSITION_CELL_WIDTH,z+1);
vecPool[8].set(x+1,y+1,z+1);
vecPool[9].set(x+0,y,z+TRANSITION_CELL_WIDTH);
vecPool[10].set(x+0,y+1,z+TRANSITION_CELL_WIDTH);
vecPool[11].set(x+1,y,z+TRANSITION_CELL_WIDTH);
vecPool[12].set(x+1,y+1,z+TRANSITION_CELL_WIDTH);
//
//Generate the transition cell
//
currentTransitionCell.setValues(
// //complex face vertex coordinates
// new Vector3f(x+0,y,z+1), new Vector3f(x+0,y+TRANSITION_CELL_WIDTH,z+1), new Vector3f(x+0,y+1,z+1),
// new Vector3f(x+TRANSITION_CELL_WIDTH,y,z+1), new Vector3f(x+TRANSITION_CELL_WIDTH,y+TRANSITION_CELL_WIDTH,z+1), new Vector3f(x+TRANSITION_CELL_WIDTH,y+1,z+1),
// new Vector3f(x+1,y,z+1), new Vector3f(x+1,y+TRANSITION_CELL_WIDTH,z+1), new Vector3f(x+1,y+1,z+1),
// //simple face vertex coordinates
// new Vector3f(x+0,y,z+TRANSITION_CELL_WIDTH), new Vector3f(x+0,y+1,z+TRANSITION_CELL_WIDTH),
// new Vector3f(x+1,y,z+TRANSITION_CELL_WIDTH), new Vector3f(x+1,y+1,z+TRANSITION_CELL_WIDTH),
//complex face vertex coordinates
new Vector3f(x+0,y,z+1), new Vector3f(x+0,y+TRANSITION_CELL_WIDTH,z+1), new Vector3f(x+0,y+1,z+1),
new Vector3f(x+TRANSITION_CELL_WIDTH,y,z+1), new Vector3f(x+TRANSITION_CELL_WIDTH,y+TRANSITION_CELL_WIDTH,z+1), new Vector3f(x+TRANSITION_CELL_WIDTH,y+1,z+1),
new Vector3f(x+1,y,z+1), new Vector3f(x+1,y+TRANSITION_CELL_WIDTH,z+1), new Vector3f(x+1,y+1,z+1),
vecPool[0], vecPool[1], vecPool[2],
vecPool[3], vecPool[4], vecPool[5],
vecPool[6], vecPool[7], vecPool[8],
//simple face vertex coordinates
new Vector3f(x+0,y,z+TRANSITION_CELL_WIDTH), new Vector3f(x+0,y+1,z+TRANSITION_CELL_WIDTH),
new Vector3f(x+1,y,z+TRANSITION_CELL_WIDTH), new Vector3f(x+1,y+1,z+TRANSITION_CELL_WIDTH),
vecPool[9], vecPool[10],
vecPool[11], vecPool[12],
//complex face iso values
chunkData.zPositiveEdgeIso[(x+0)*2+0][(y+0)*2+0], chunkData.zPositiveEdgeIso[(x+0)*2+0][(y+0)*2+1], chunkData.zPositiveEdgeIso[(x+0)*2+0][(y+1)*2+0],
chunkData.zPositiveEdgeIso[(x+0)*2+1][(y+0)*2+0], chunkData.zPositiveEdgeIso[(x+0)*2+1][(y+0)*2+1], chunkData.zPositiveEdgeIso[(x+0)*2+1][(y+1)*2+0],
@ -1725,17 +1835,39 @@ public class TransvoxelModelGeneration {
int z = 0;
for(int x = xStartIndex; x < xEndIndex; x++){
for(int y = yStartIndex; y < yEndIndex; y++){
vecPool[0].set(x+0, y,z);
vecPool[1].set(x+0, y+TRANSITION_CELL_WIDTH,z);
vecPool[2].set(x+0, y+1,z);
vecPool[3].set(x+TRANSITION_CELL_WIDTH,y,z);
vecPool[4].set(x+TRANSITION_CELL_WIDTH,y+TRANSITION_CELL_WIDTH,z);
vecPool[5].set(x+TRANSITION_CELL_WIDTH,y+1,z);
vecPool[6].set(x+1, y,z);
vecPool[7].set(x+1, y+TRANSITION_CELL_WIDTH,z);
vecPool[8].set(x+1, y+1,z);
vecPool[9].set(x+0,y,z+TRANSITION_CELL_WIDTH);
vecPool[10].set(x+0,y+1,z+TRANSITION_CELL_WIDTH);
vecPool[11].set(x+1,y,z+TRANSITION_CELL_WIDTH);
vecPool[12].set(x+1,y+1,z+TRANSITION_CELL_WIDTH);
//
//Generate the transition cell
//
currentTransitionCell.setValues(
// //complex face vertex coordinates
// new Vector3f(x+0, y,z), new Vector3f(x+0, y+TRANSITION_CELL_WIDTH,z), new Vector3f(x+0, y+1,z),
// new Vector3f(x+TRANSITION_CELL_WIDTH,y,z), new Vector3f(x+TRANSITION_CELL_WIDTH,y+TRANSITION_CELL_WIDTH,z), new Vector3f(x+TRANSITION_CELL_WIDTH,y+1,z),
// new Vector3f(x+1, y,z), new Vector3f(x+1, y+TRANSITION_CELL_WIDTH,z), new Vector3f(x+1, y+1,z),
// //simple face vertex coordinates
// new Vector3f(x+0,y,z+TRANSITION_CELL_WIDTH), new Vector3f(x+0,y+1,z+TRANSITION_CELL_WIDTH),
// new Vector3f(x+1,y,z+TRANSITION_CELL_WIDTH), new Vector3f(x+1,y+1,z+TRANSITION_CELL_WIDTH),
//complex face vertex coordinates
new Vector3f(x+0, y,z), new Vector3f(x+0, y+TRANSITION_CELL_WIDTH,z), new Vector3f(x+0, y+1,z),
new Vector3f(x+TRANSITION_CELL_WIDTH,y,z), new Vector3f(x+TRANSITION_CELL_WIDTH,y+TRANSITION_CELL_WIDTH,z), new Vector3f(x+TRANSITION_CELL_WIDTH,y+1,z),
new Vector3f(x+1, y,z), new Vector3f(x+1, y+TRANSITION_CELL_WIDTH,z), new Vector3f(x+1, y+1,z),
vecPool[0], vecPool[1], vecPool[2],
vecPool[3], vecPool[4], vecPool[5],
vecPool[6], vecPool[7], vecPool[8],
//simple face vertex coordinates
new Vector3f(x+0,y,z+TRANSITION_CELL_WIDTH), new Vector3f(x+0,y+1,z+TRANSITION_CELL_WIDTH),
new Vector3f(x+1,y,z+TRANSITION_CELL_WIDTH), new Vector3f(x+1,y+1,z+TRANSITION_CELL_WIDTH),
vecPool[9], vecPool[10],
vecPool[11], vecPool[12],
//complex face iso values
chunkData.zNegativeEdgeIso[(x+0)*2+0][(y+0)*2+0], chunkData.zNegativeEdgeIso[(x+0)*2+0][(y+0)*2+1], chunkData.zNegativeEdgeIso[(x+0)*2+0][(y+1)*2+0],
chunkData.zNegativeEdgeIso[(x+0)*2+1][(y+0)*2+0], chunkData.zNegativeEdgeIso[(x+0)*2+1][(y+0)*2+1], chunkData.zNegativeEdgeIso[(x+0)*2+1][(y+1)*2+0],