voxelImprovements #5
@ -548,48 +548,50 @@ public class ClientDrawCellManager {
 | 
				
			|||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        // if(highResFaces != null){
 | 
					        int highResLod = this.chunkTree.getMaxLevel() - (node.getLevel() + 1);
 | 
				
			||||||
        //     for(DrawCellFace highResFace : highResFaces){
 | 
					        int highResSpacingFactor = (int)Math.pow(2,highResLod);
 | 
				
			||||||
        //         //x & y are in face-space
 | 
					        if(highResFaces != null){
 | 
				
			||||||
        //         for(int x = 0; x < 4; x++){
 | 
					            for(DrawCellFace highResFace : highResFaces){
 | 
				
			||||||
        //             for(int y = 0; y < 4; y++){
 | 
					                //x & y are in face-space
 | 
				
			||||||
        //                 Vector3i posToCheck = null;
 | 
					                for(int x = 0; x < 3; x++){
 | 
				
			||||||
        //                 //implicitly performing transforms to adapt from face-space to world space
 | 
					                    for(int y = 0; y < 3; y++){
 | 
				
			||||||
        //                 switch(highResFace){
 | 
					                        Vector3i posToCheck = null;
 | 
				
			||||||
        //                     case X_POSITIVE: {
 | 
					                        //implicitly performing transforms to adapt from face-space to world space
 | 
				
			||||||
        //                         posToCheck = new Vector3i(cell.getWorldPos()).add(lodMultiplitier,x,y);
 | 
					                        switch(highResFace){
 | 
				
			||||||
        //                     } break;
 | 
					                            case X_POSITIVE: {
 | 
				
			||||||
        //                     case X_NEGATIVE: {
 | 
					                                posToCheck = new Vector3i(cell.getWorldPos()).add(spacingFactor,x*highResSpacingFactor,y*highResSpacingFactor);
 | 
				
			||||||
        //                         posToCheck = new Vector3i(cell.getWorldPos()).add(-1,x,y);
 | 
					                            } break;
 | 
				
			||||||
        //                     } break;
 | 
					                            case X_NEGATIVE: {
 | 
				
			||||||
        //                     case Y_POSITIVE: {
 | 
					                                posToCheck = new Vector3i(cell.getWorldPos()).add(0,x*highResSpacingFactor,y*highResSpacingFactor);
 | 
				
			||||||
        //                         posToCheck = new Vector3i(cell.getWorldPos()).add(x,lodMultiplitier,y);
 | 
					                            } break;
 | 
				
			||||||
        //                     } break;
 | 
					                            case Y_POSITIVE: {
 | 
				
			||||||
        //                     case Y_NEGATIVE: {
 | 
					                                posToCheck = new Vector3i(cell.getWorldPos()).add(x*highResSpacingFactor,spacingFactor,y*highResSpacingFactor);
 | 
				
			||||||
        //                         posToCheck = new Vector3i(cell.getWorldPos()).add(x,-1,y);
 | 
					                            } break;
 | 
				
			||||||
        //                     } break;
 | 
					                            case Y_NEGATIVE: {
 | 
				
			||||||
        //                     case Z_POSITIVE: {
 | 
					                                posToCheck = new Vector3i(cell.getWorldPos()).add(x*highResSpacingFactor,0,y*highResSpacingFactor);
 | 
				
			||||||
        //                         posToCheck = new Vector3i(cell.getWorldPos()).add(x,y,lodMultiplitier);
 | 
					                            } break;
 | 
				
			||||||
        //                     } break;
 | 
					                            case Z_POSITIVE: {
 | 
				
			||||||
        //                     case Z_NEGATIVE: {
 | 
					                                posToCheck = new Vector3i(cell.getWorldPos()).add(x*highResSpacingFactor,y*highResSpacingFactor,spacingFactor);
 | 
				
			||||||
        //                         posToCheck = new Vector3i(cell.getWorldPos()).add(x,y,-1);
 | 
					                            } break;
 | 
				
			||||||
        //                     } break;
 | 
					                            case Z_NEGATIVE: {
 | 
				
			||||||
        //                 }
 | 
					                                posToCheck = new Vector3i(cell.getWorldPos()).add(x*highResSpacingFactor,y*highResSpacingFactor,0);
 | 
				
			||||||
        //                 if(
 | 
					                            } break;
 | 
				
			||||||
        //                     posToCheck.x >= 0 &&
 | 
					                        }
 | 
				
			||||||
        //                     posToCheck.x < Globals.clientWorldData.getWorldDiscreteSize() &&
 | 
					                        if(
 | 
				
			||||||
        //                     posToCheck.y >= 0 &&
 | 
					                            posToCheck.x >= 0 &&
 | 
				
			||||||
        //                     posToCheck.y < Globals.clientWorldData.getWorldDiscreteSize() &&
 | 
					                            posToCheck.x < Globals.clientWorldData.getWorldDiscreteSize() &&
 | 
				
			||||||
        //                     posToCheck.z >= 0 &&
 | 
					                            posToCheck.y >= 0 &&
 | 
				
			||||||
        //                     posToCheck.z < Globals.clientWorldData.getWorldDiscreteSize() &&
 | 
					                            posToCheck.y < Globals.clientWorldData.getWorldDiscreteSize() &&
 | 
				
			||||||
        //                     !Globals.clientTerrainManager.containsChunkDataAtWorldPoint(posToCheck.x, posToCheck.y, posToCheck.z, ChunkData.NO_STRIDE)
 | 
					                            posToCheck.z >= 0 &&
 | 
				
			||||||
        //                     ){
 | 
					                            posToCheck.z < Globals.clientWorldData.getWorldDiscreteSize() &&
 | 
				
			||||||
        //                     return false;
 | 
					                            !Globals.clientTerrainManager.containsChunkDataAtWorldPoint(posToCheck.x, posToCheck.y, posToCheck.z, highResLod)
 | 
				
			||||||
        //                 }
 | 
					                            ){
 | 
				
			||||||
        //             }
 | 
					                            return false;
 | 
				
			||||||
        //         }
 | 
					                        }
 | 
				
			||||||
        //     }
 | 
					                    }
 | 
				
			||||||
        // }
 | 
					                }
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
        return true;
 | 
					        return true;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -12,7 +12,9 @@ import electrosphere.engine.Globals;
 | 
				
			|||||||
import electrosphere.entity.ClientEntityUtils;
 | 
					import electrosphere.entity.ClientEntityUtils;
 | 
				
			||||||
import electrosphere.entity.Entity;
 | 
					import electrosphere.entity.Entity;
 | 
				
			||||||
import electrosphere.entity.types.terrain.TerrainChunk;
 | 
					import electrosphere.entity.types.terrain.TerrainChunk;
 | 
				
			||||||
 | 
					import electrosphere.renderer.meshgen.TransvoxelModelGeneration;
 | 
				
			||||||
import electrosphere.renderer.meshgen.TransvoxelModelGeneration.TransvoxelChunkData;
 | 
					import electrosphere.renderer.meshgen.TransvoxelModelGeneration.TransvoxelChunkData;
 | 
				
			||||||
 | 
					import electrosphere.server.terrain.manager.ServerTerrainChunk;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * A single drawcell - contains an entity that has a physics mesh and potentially graphics
 | 
					 * A single drawcell - contains an entity that has a physics mesh and potentially graphics
 | 
				
			||||||
@ -232,201 +234,202 @@ public class DrawCell {
 | 
				
			|||||||
     * @return true if successfully filled in data, false otherwise
 | 
					     * @return true if successfully filled in data, false otherwise
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    private boolean fillInFaceData(TransvoxelChunkData chunkData, DrawCellFace higherLODFace, int lod){
 | 
					    private boolean fillInFaceData(TransvoxelChunkData chunkData, DrawCellFace higherLODFace, int lod){
 | 
				
			||||||
        // int mainSpacing = (int)Math.pow(2,lod);
 | 
					        int mainSpacing = (int)Math.pow(2,lod);
 | 
				
			||||||
        // int higherResSpacing = (int)Math.pow(2,lod - 1);
 | 
					        int higherLOD = lod - 1;
 | 
				
			||||||
        // float[][] faceWeights = new float[TransvoxelModelGeneration.FACE_DATA_DIMENSIONS][TransvoxelModelGeneration.FACE_DATA_DIMENSIONS];
 | 
					        int higherResSpacing = (int)Math.pow(2,higherLOD);
 | 
				
			||||||
        // int[][] faceTypes = new int[TransvoxelModelGeneration.FACE_DATA_DIMENSIONS][TransvoxelModelGeneration.FACE_DATA_DIMENSIONS];
 | 
					        float[][] faceWeights = new float[TransvoxelModelGeneration.FACE_DATA_DIMENSIONS][TransvoxelModelGeneration.FACE_DATA_DIMENSIONS];
 | 
				
			||||||
        // //allocate face array
 | 
					        int[][] faceTypes = new int[TransvoxelModelGeneration.FACE_DATA_DIMENSIONS][TransvoxelModelGeneration.FACE_DATA_DIMENSIONS];
 | 
				
			||||||
        // for(int x = 0; x < TransvoxelModelGeneration.FACE_DATA_DIMENSIONS; x++){
 | 
					        //allocate face array
 | 
				
			||||||
        //     for(int y = 0; y < TransvoxelModelGeneration.FACE_DATA_DIMENSIONS; y++){
 | 
					        for(int x = 0; x < TransvoxelModelGeneration.FACE_DATA_DIMENSIONS; x++){
 | 
				
			||||||
        //         int worldCoordOffset1 = (x * higherResSpacing) / ChunkData.CHUNK_SIZE;
 | 
					            for(int y = 0; y < TransvoxelModelGeneration.FACE_DATA_DIMENSIONS; y++){
 | 
				
			||||||
        //         int worldCoordOffset2 = (y * higherResSpacing) / ChunkData.CHUNK_SIZE;
 | 
					                int worldCoordOffset1 = x / ChunkData.CHUNK_SIZE * higherResSpacing;
 | 
				
			||||||
        //         //solve coordinates relative to the face
 | 
					                int worldCoordOffset2 = y / ChunkData.CHUNK_SIZE * higherResSpacing;
 | 
				
			||||||
        //         int localCoord1 = (x * higherResSpacing) % ChunkData.CHUNK_SIZE;
 | 
					                //solve coordinates relative to the face
 | 
				
			||||||
        //         int localCoord2 = (y * higherResSpacing) % ChunkData.CHUNK_SIZE;
 | 
					                int localCoord1 = x % ChunkData.CHUNK_SIZE;
 | 
				
			||||||
 | 
					                int localCoord2 = y % ChunkData.CHUNK_SIZE;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        //         //implicitly performing transforms to adapt from face-space to world & local space
 | 
					                //implicitly performing transforms to adapt from face-space to world & local space
 | 
				
			||||||
        //         switch(higherLODFace){
 | 
					                switch(higherLODFace){
 | 
				
			||||||
        //             case X_POSITIVE: {
 | 
					                    case X_POSITIVE: {
 | 
				
			||||||
        //                 ChunkData currentChunk = Globals.clientTerrainManager.getChunkDataAtWorldPoint(
 | 
					                        ChunkData currentChunk = Globals.clientTerrainManager.getChunkDataAtWorldPoint(
 | 
				
			||||||
        //                     new Vector3i(
 | 
					                            new Vector3i(
 | 
				
			||||||
        //                         worldPos.x + (17 * mainSpacing) / ChunkData.CHUNK_SIZE,
 | 
					                                worldPos.x + mainSpacing,
 | 
				
			||||||
        //                         worldPos.y + worldCoordOffset1,
 | 
					                                worldPos.y + worldCoordOffset1,
 | 
				
			||||||
        //                         worldPos.z + worldCoordOffset2
 | 
					                                worldPos.z + worldCoordOffset2
 | 
				
			||||||
        //                     ),
 | 
					                            ),
 | 
				
			||||||
        //                     ChunkData.NO_STRIDE
 | 
					                            higherLOD
 | 
				
			||||||
 | 
					                        );
 | 
				
			||||||
 | 
					                        if(currentChunk == null){
 | 
				
			||||||
 | 
					                            return false;
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
 | 
					                        faceWeights[x][y] = currentChunk.getWeight(
 | 
				
			||||||
 | 
					                            0,
 | 
				
			||||||
 | 
					                            localCoord1,
 | 
				
			||||||
 | 
					                            localCoord2
 | 
				
			||||||
 | 
					                        );
 | 
				
			||||||
 | 
					                        faceTypes[x][y] = currentChunk.getType(
 | 
				
			||||||
 | 
					                            0,
 | 
				
			||||||
 | 
					                            localCoord1,
 | 
				
			||||||
 | 
					                            localCoord2
 | 
				
			||||||
 | 
					                        );
 | 
				
			||||||
 | 
					                    } break;
 | 
				
			||||||
 | 
					                    case X_NEGATIVE: {
 | 
				
			||||||
 | 
					                        ChunkData currentChunk = Globals.clientTerrainManager.getChunkDataAtWorldPoint(
 | 
				
			||||||
 | 
					                            new Vector3i(
 | 
				
			||||||
 | 
					                                worldPos.x,
 | 
				
			||||||
 | 
					                                worldPos.y + worldCoordOffset1,
 | 
				
			||||||
 | 
					                                worldPos.z + worldCoordOffset2
 | 
				
			||||||
 | 
					                            ),
 | 
				
			||||||
 | 
					                            higherLOD
 | 
				
			||||||
 | 
					                        );
 | 
				
			||||||
 | 
					                        if(currentChunk == null){
 | 
				
			||||||
 | 
					                            return false;
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
 | 
					                        faceWeights[x][y] = currentChunk.getWeight(
 | 
				
			||||||
 | 
					                            0,
 | 
				
			||||||
 | 
					                            localCoord1,
 | 
				
			||||||
 | 
					                            localCoord2
 | 
				
			||||||
 | 
					                        );
 | 
				
			||||||
 | 
					                        faceTypes[x][y] = currentChunk.getType(
 | 
				
			||||||
 | 
					                            0,
 | 
				
			||||||
 | 
					                            localCoord1,
 | 
				
			||||||
 | 
					                            localCoord2
 | 
				
			||||||
 | 
					                        );
 | 
				
			||||||
 | 
					                    } break;
 | 
				
			||||||
 | 
					                    case Y_POSITIVE: {
 | 
				
			||||||
 | 
					                        ChunkData currentChunk = Globals.clientTerrainManager.getChunkDataAtWorldPoint(
 | 
				
			||||||
 | 
					                            new Vector3i(
 | 
				
			||||||
 | 
					                                worldPos.x + worldCoordOffset1,
 | 
				
			||||||
 | 
					                                worldPos.y + mainSpacing,
 | 
				
			||||||
 | 
					                                worldPos.z + worldCoordOffset2
 | 
				
			||||||
 | 
					                            ),
 | 
				
			||||||
 | 
					                            higherLOD
 | 
				
			||||||
 | 
					                        );
 | 
				
			||||||
 | 
					                        if(currentChunk == null){
 | 
				
			||||||
 | 
					                            return false;
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
 | 
					                        faceWeights[x][y] = currentChunk.getWeight(
 | 
				
			||||||
 | 
					                            localCoord1,
 | 
				
			||||||
 | 
					                            0,
 | 
				
			||||||
 | 
					                            localCoord2
 | 
				
			||||||
 | 
					                        );
 | 
				
			||||||
 | 
					                        faceTypes[x][y] = currentChunk.getType(
 | 
				
			||||||
 | 
					                            localCoord1,
 | 
				
			||||||
 | 
					                            0,
 | 
				
			||||||
 | 
					                            localCoord2
 | 
				
			||||||
 | 
					                        );
 | 
				
			||||||
 | 
					                    } break;
 | 
				
			||||||
 | 
					                    case Y_NEGATIVE: {
 | 
				
			||||||
 | 
					                        ChunkData currentChunk = Globals.clientTerrainManager.getChunkDataAtWorldPoint(
 | 
				
			||||||
 | 
					                            new Vector3i(
 | 
				
			||||||
 | 
					                                worldPos.x + worldCoordOffset1,
 | 
				
			||||||
 | 
					                                worldPos.y,
 | 
				
			||||||
 | 
					                                worldPos.z + worldCoordOffset2
 | 
				
			||||||
 | 
					                            ),
 | 
				
			||||||
 | 
					                            higherLOD
 | 
				
			||||||
 | 
					                        );
 | 
				
			||||||
 | 
					                        if(currentChunk == null){
 | 
				
			||||||
 | 
					                            return false;
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
 | 
					                        faceWeights[x][y] = currentChunk.getWeight(
 | 
				
			||||||
 | 
					                            localCoord1,
 | 
				
			||||||
 | 
					                            0,
 | 
				
			||||||
 | 
					                            localCoord2
 | 
				
			||||||
 | 
					                        );
 | 
				
			||||||
 | 
					                        faceTypes[x][y] = currentChunk.getType(
 | 
				
			||||||
 | 
					                            localCoord1,
 | 
				
			||||||
 | 
					                            0,
 | 
				
			||||||
 | 
					                            localCoord2
 | 
				
			||||||
 | 
					                        );
 | 
				
			||||||
 | 
					                    } break;
 | 
				
			||||||
 | 
					                    case Z_POSITIVE: {
 | 
				
			||||||
 | 
					                        ChunkData currentChunk = Globals.clientTerrainManager.getChunkDataAtWorldPoint(
 | 
				
			||||||
 | 
					                            new Vector3i(
 | 
				
			||||||
 | 
					                                worldPos.x + worldCoordOffset1,
 | 
				
			||||||
 | 
					                                worldPos.y + worldCoordOffset2,
 | 
				
			||||||
 | 
					                                worldPos.z + mainSpacing
 | 
				
			||||||
 | 
					                            ),
 | 
				
			||||||
 | 
					                            higherLOD
 | 
				
			||||||
 | 
					                        );
 | 
				
			||||||
 | 
					                        if(currentChunk == null){
 | 
				
			||||||
 | 
					                            return false;
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
 | 
					                        faceWeights[x][y] = currentChunk.getWeight(
 | 
				
			||||||
 | 
					                            localCoord1,
 | 
				
			||||||
 | 
					                            localCoord2,
 | 
				
			||||||
 | 
					                            0
 | 
				
			||||||
 | 
					                        );
 | 
				
			||||||
 | 
					                        faceTypes[x][y] = currentChunk.getType(
 | 
				
			||||||
 | 
					                            localCoord1,
 | 
				
			||||||
 | 
					                            localCoord2,
 | 
				
			||||||
 | 
					                            0
 | 
				
			||||||
 | 
					                        );
 | 
				
			||||||
 | 
					                    } break;
 | 
				
			||||||
 | 
					                    case Z_NEGATIVE: {
 | 
				
			||||||
 | 
					                        ChunkData currentChunk = Globals.clientTerrainManager.getChunkDataAtWorldPoint(
 | 
				
			||||||
 | 
					                            new Vector3i(
 | 
				
			||||||
 | 
					                                worldPos.x + worldCoordOffset1,
 | 
				
			||||||
 | 
					                                worldPos.y + worldCoordOffset2,
 | 
				
			||||||
 | 
					                                worldPos.z
 | 
				
			||||||
 | 
					                            ),
 | 
				
			||||||
 | 
					                            higherLOD
 | 
				
			||||||
 | 
					                        );
 | 
				
			||||||
 | 
					                        if(currentChunk == null){
 | 
				
			||||||
 | 
					                            return false;
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
 | 
					                        faceWeights[x][y] = currentChunk.getWeight(
 | 
				
			||||||
 | 
					                            localCoord1,
 | 
				
			||||||
 | 
					                            localCoord2,
 | 
				
			||||||
 | 
					                            0
 | 
				
			||||||
 | 
					                        );
 | 
				
			||||||
 | 
					                        faceTypes[x][y] = currentChunk.getType(
 | 
				
			||||||
 | 
					                            localCoord1,
 | 
				
			||||||
 | 
					                            localCoord2,
 | 
				
			||||||
 | 
					                            0
 | 
				
			||||||
 | 
					                        );
 | 
				
			||||||
 | 
					                    } break;
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                // Vector3i sampleChunkWorldPos = new Vector3i(
 | 
				
			||||||
 | 
					                //     worldPos.x + (x * higherResSpacing) / ChunkData.CHUNK_SIZE,
 | 
				
			||||||
 | 
					                //     worldPos.y + (y * higherResSpacing) / ChunkData.CHUNK_SIZE,
 | 
				
			||||||
 | 
					                //     worldPos.z + (z * spacingFactor) / ChunkData.CHUNK_SIZE
 | 
				
			||||||
                // );
 | 
					                // );
 | 
				
			||||||
 | 
					                // ChunkData currentChunk = Globals.clientTerrainManager.getChunkDataAtWorldPoint(sampleChunkWorldPos);
 | 
				
			||||||
                // if(currentChunk == null){
 | 
					                // if(currentChunk == null){
 | 
				
			||||||
        //                     return false;
 | 
					                //     throw new Error("Chunk is null! " + worldPos);
 | 
				
			||||||
                // }
 | 
					                // }
 | 
				
			||||||
        //                 faceWeights[x][y] = currentChunk.getWeight(
 | 
					                // weights[x][y][z] = currentChunk.getWeight(
 | 
				
			||||||
        //                     0,
 | 
					                //     (x * higherResSpacing) % ChunkData.CHUNK_SIZE,
 | 
				
			||||||
        //                     localCoord1,
 | 
					                //     (y * higherResSpacing) % ChunkData.CHUNK_SIZE,
 | 
				
			||||||
        //                     localCoord2
 | 
					                //     (z * spacingFactor) % ChunkData.CHUNK_SIZE
 | 
				
			||||||
                // );
 | 
					                // );
 | 
				
			||||||
        //                 faceTypes[x][y] = currentChunk.getType(
 | 
					                // types[x][y][z] = currentChunk.getType(
 | 
				
			||||||
        //                     0,
 | 
					                //     (x * higherResSpacing) % ChunkData.CHUNK_SIZE,
 | 
				
			||||||
        //                     localCoord1,
 | 
					                //     (y * higherResSpacing) % ChunkData.CHUNK_SIZE,
 | 
				
			||||||
        //                     localCoord2
 | 
					                //     (z * spacingFactor) % ChunkData.CHUNK_SIZE
 | 
				
			||||||
                // );
 | 
					                // );
 | 
				
			||||||
        //             } break;
 | 
					            }
 | 
				
			||||||
        //             case X_NEGATIVE: {
 | 
					        }
 | 
				
			||||||
        //                 ChunkData currentChunk = Globals.clientTerrainManager.getChunkDataAtWorldPoint(
 | 
					        switch(higherLODFace){
 | 
				
			||||||
        //                     new Vector3i(
 | 
					            case X_POSITIVE: {
 | 
				
			||||||
        //                         worldPos.x,
 | 
					                chunkData.addXPositiveEdge(faceWeights, faceTypes);
 | 
				
			||||||
        //                         worldPos.y + worldCoordOffset1,
 | 
					            } break;
 | 
				
			||||||
        //                         worldPos.z + worldCoordOffset2
 | 
					            case X_NEGATIVE: {
 | 
				
			||||||
        //                     ),
 | 
					                chunkData.addXNegativeEdge(faceWeights, faceTypes);
 | 
				
			||||||
        //                     ChunkData.NO_STRIDE
 | 
					            } break;
 | 
				
			||||||
        //                 );
 | 
					            case Y_POSITIVE: {
 | 
				
			||||||
        //                 if(currentChunk == null){
 | 
					                chunkData.addYPositiveEdge(faceWeights, faceTypes);
 | 
				
			||||||
        //                     return false;
 | 
					            } break;
 | 
				
			||||||
        //                 }
 | 
					            case Y_NEGATIVE: {
 | 
				
			||||||
        //                 faceWeights[x][y] = currentChunk.getWeight(
 | 
					                chunkData.addYNegativeEdge(faceWeights, faceTypes);
 | 
				
			||||||
        //                     0,
 | 
					            } break;
 | 
				
			||||||
        //                     localCoord1,
 | 
					            case Z_POSITIVE: {
 | 
				
			||||||
        //                     localCoord2
 | 
					                chunkData.addZPositiveEdge(faceWeights, faceTypes);
 | 
				
			||||||
        //                 );
 | 
					            } break;
 | 
				
			||||||
        //                 faceTypes[x][y] = currentChunk.getType(
 | 
					            case Z_NEGATIVE: {
 | 
				
			||||||
        //                     0,
 | 
					                chunkData.addZNegativeEdge(faceWeights, faceTypes);
 | 
				
			||||||
        //                     localCoord1,
 | 
					            } break;
 | 
				
			||||||
        //                     localCoord2
 | 
					        }
 | 
				
			||||||
        //                 );
 | 
					 | 
				
			||||||
        //             } break;
 | 
					 | 
				
			||||||
        //             case Y_POSITIVE: {
 | 
					 | 
				
			||||||
        //                 ChunkData currentChunk = Globals.clientTerrainManager.getChunkDataAtWorldPoint(
 | 
					 | 
				
			||||||
        //                     new Vector3i(
 | 
					 | 
				
			||||||
        //                         worldPos.x + worldCoordOffset1,
 | 
					 | 
				
			||||||
        //                         worldPos.y + (17 * mainSpacing) / ChunkData.CHUNK_SIZE,
 | 
					 | 
				
			||||||
        //                         worldPos.z + worldCoordOffset2
 | 
					 | 
				
			||||||
        //                     ),
 | 
					 | 
				
			||||||
        //                     ChunkData.NO_STRIDE
 | 
					 | 
				
			||||||
        //                 );
 | 
					 | 
				
			||||||
        //                 if(currentChunk == null){
 | 
					 | 
				
			||||||
        //                     return false;
 | 
					 | 
				
			||||||
        //                 }
 | 
					 | 
				
			||||||
        //                 faceWeights[x][y] = currentChunk.getWeight(
 | 
					 | 
				
			||||||
        //                     localCoord1,
 | 
					 | 
				
			||||||
        //                     0,
 | 
					 | 
				
			||||||
        //                     localCoord2
 | 
					 | 
				
			||||||
        //                 );
 | 
					 | 
				
			||||||
        //                 faceTypes[x][y] = currentChunk.getType(
 | 
					 | 
				
			||||||
        //                     localCoord1,
 | 
					 | 
				
			||||||
        //                     0,
 | 
					 | 
				
			||||||
        //                     localCoord2
 | 
					 | 
				
			||||||
        //                 );
 | 
					 | 
				
			||||||
        //             } break;
 | 
					 | 
				
			||||||
        //             case Y_NEGATIVE: {
 | 
					 | 
				
			||||||
        //                 ChunkData currentChunk = Globals.clientTerrainManager.getChunkDataAtWorldPoint(
 | 
					 | 
				
			||||||
        //                     new Vector3i(
 | 
					 | 
				
			||||||
        //                         worldPos.x + worldCoordOffset1,
 | 
					 | 
				
			||||||
        //                         worldPos.y,
 | 
					 | 
				
			||||||
        //                         worldPos.z + worldCoordOffset2
 | 
					 | 
				
			||||||
        //                     ),
 | 
					 | 
				
			||||||
        //                     ChunkData.NO_STRIDE
 | 
					 | 
				
			||||||
        //                 );
 | 
					 | 
				
			||||||
        //                 if(currentChunk == null){
 | 
					 | 
				
			||||||
        //                     return false;
 | 
					 | 
				
			||||||
        //                 }
 | 
					 | 
				
			||||||
        //                 faceWeights[x][y] = currentChunk.getWeight(
 | 
					 | 
				
			||||||
        //                     localCoord1,
 | 
					 | 
				
			||||||
        //                     0,
 | 
					 | 
				
			||||||
        //                     localCoord2
 | 
					 | 
				
			||||||
        //                 );
 | 
					 | 
				
			||||||
        //                 faceTypes[x][y] = currentChunk.getType(
 | 
					 | 
				
			||||||
        //                     localCoord1,
 | 
					 | 
				
			||||||
        //                     0,
 | 
					 | 
				
			||||||
        //                     localCoord2
 | 
					 | 
				
			||||||
        //                 );
 | 
					 | 
				
			||||||
        //             } break;
 | 
					 | 
				
			||||||
        //             case Z_POSITIVE: {
 | 
					 | 
				
			||||||
        //                 ChunkData currentChunk = Globals.clientTerrainManager.getChunkDataAtWorldPoint(
 | 
					 | 
				
			||||||
        //                     new Vector3i(
 | 
					 | 
				
			||||||
        //                         worldPos.x + worldCoordOffset1,
 | 
					 | 
				
			||||||
        //                         worldPos.y + worldCoordOffset2,
 | 
					 | 
				
			||||||
        //                         worldPos.z + (17 * mainSpacing) / ChunkData.CHUNK_SIZE
 | 
					 | 
				
			||||||
        //                     ),
 | 
					 | 
				
			||||||
        //                     ChunkData.NO_STRIDE
 | 
					 | 
				
			||||||
        //                 );
 | 
					 | 
				
			||||||
        //                 if(currentChunk == null){
 | 
					 | 
				
			||||||
        //                     return false;
 | 
					 | 
				
			||||||
        //                 }
 | 
					 | 
				
			||||||
        //                 faceWeights[x][y] = currentChunk.getWeight(
 | 
					 | 
				
			||||||
        //                     localCoord1,
 | 
					 | 
				
			||||||
        //                     localCoord2,
 | 
					 | 
				
			||||||
        //                     0
 | 
					 | 
				
			||||||
        //                 );
 | 
					 | 
				
			||||||
        //                 faceTypes[x][y] = currentChunk.getType(
 | 
					 | 
				
			||||||
        //                     localCoord1,
 | 
					 | 
				
			||||||
        //                     localCoord2,
 | 
					 | 
				
			||||||
        //                     0
 | 
					 | 
				
			||||||
        //                 );
 | 
					 | 
				
			||||||
        //             } break;
 | 
					 | 
				
			||||||
        //             case Z_NEGATIVE: {
 | 
					 | 
				
			||||||
        //                 ChunkData currentChunk = Globals.clientTerrainManager.getChunkDataAtWorldPoint(
 | 
					 | 
				
			||||||
        //                     new Vector3i(
 | 
					 | 
				
			||||||
        //                         worldPos.x + worldCoordOffset1,
 | 
					 | 
				
			||||||
        //                         worldPos.y + worldCoordOffset2,
 | 
					 | 
				
			||||||
        //                         worldPos.z
 | 
					 | 
				
			||||||
        //                     ),
 | 
					 | 
				
			||||||
        //                     ChunkData.NO_STRIDE
 | 
					 | 
				
			||||||
        //                 );
 | 
					 | 
				
			||||||
        //                 if(currentChunk == null){
 | 
					 | 
				
			||||||
        //                     return false;
 | 
					 | 
				
			||||||
        //                 }
 | 
					 | 
				
			||||||
        //                 faceWeights[x][y] = currentChunk.getWeight(
 | 
					 | 
				
			||||||
        //                     localCoord1,
 | 
					 | 
				
			||||||
        //                     localCoord2,
 | 
					 | 
				
			||||||
        //                     0
 | 
					 | 
				
			||||||
        //                 );
 | 
					 | 
				
			||||||
        //                 faceTypes[x][y] = currentChunk.getType(
 | 
					 | 
				
			||||||
        //                     localCoord1,
 | 
					 | 
				
			||||||
        //                     localCoord2,
 | 
					 | 
				
			||||||
        //                     0
 | 
					 | 
				
			||||||
        //                 );
 | 
					 | 
				
			||||||
        //             } break;
 | 
					 | 
				
			||||||
        //         }
 | 
					 | 
				
			||||||
        //         // Vector3i sampleChunkWorldPos = new Vector3i(
 | 
					 | 
				
			||||||
        //         //     worldPos.x + (x * higherResSpacing) / ChunkData.CHUNK_SIZE,
 | 
					 | 
				
			||||||
        //         //     worldPos.y + (y * higherResSpacing) / ChunkData.CHUNK_SIZE,
 | 
					 | 
				
			||||||
        //         //     worldPos.z + (z * spacingFactor) / ChunkData.CHUNK_SIZE
 | 
					 | 
				
			||||||
        //         // );
 | 
					 | 
				
			||||||
        //         // ChunkData currentChunk = Globals.clientTerrainManager.getChunkDataAtWorldPoint(sampleChunkWorldPos);
 | 
					 | 
				
			||||||
        //         // if(currentChunk == null){
 | 
					 | 
				
			||||||
        //         //     throw new Error("Chunk is null! " + worldPos);
 | 
					 | 
				
			||||||
        //         // }
 | 
					 | 
				
			||||||
        //         // weights[x][y][z] = currentChunk.getWeight(
 | 
					 | 
				
			||||||
        //         //     (x * higherResSpacing) % ChunkData.CHUNK_SIZE,
 | 
					 | 
				
			||||||
        //         //     (y * higherResSpacing) % ChunkData.CHUNK_SIZE,
 | 
					 | 
				
			||||||
        //         //     (z * spacingFactor) % ChunkData.CHUNK_SIZE
 | 
					 | 
				
			||||||
        //         // );
 | 
					 | 
				
			||||||
        //         // types[x][y][z] = currentChunk.getType(
 | 
					 | 
				
			||||||
        //         //     (x * higherResSpacing) % ChunkData.CHUNK_SIZE,
 | 
					 | 
				
			||||||
        //         //     (y * higherResSpacing) % ChunkData.CHUNK_SIZE,
 | 
					 | 
				
			||||||
        //         //     (z * spacingFactor) % ChunkData.CHUNK_SIZE
 | 
					 | 
				
			||||||
        //         // );
 | 
					 | 
				
			||||||
        //     }
 | 
					 | 
				
			||||||
        // }
 | 
					 | 
				
			||||||
        // switch(higherLODFace){
 | 
					 | 
				
			||||||
        //     case X_POSITIVE: {
 | 
					 | 
				
			||||||
        //         chunkData.addXPositiveEdge(faceWeights, faceTypes);
 | 
					 | 
				
			||||||
        //     } break;
 | 
					 | 
				
			||||||
        //     case X_NEGATIVE: {
 | 
					 | 
				
			||||||
        //         chunkData.addXNegativeEdge(faceWeights, faceTypes);
 | 
					 | 
				
			||||||
        //     } break;
 | 
					 | 
				
			||||||
        //     case Y_POSITIVE: {
 | 
					 | 
				
			||||||
        //         chunkData.addYPositiveEdge(faceWeights, faceTypes);
 | 
					 | 
				
			||||||
        //     } break;
 | 
					 | 
				
			||||||
        //     case Y_NEGATIVE: {
 | 
					 | 
				
			||||||
        //         chunkData.addYNegativeEdge(faceWeights, faceTypes);
 | 
					 | 
				
			||||||
        //     } break;
 | 
					 | 
				
			||||||
        //     case Z_POSITIVE: {
 | 
					 | 
				
			||||||
        //         chunkData.addZPositiveEdge(faceWeights, faceTypes);
 | 
					 | 
				
			||||||
        //     } break;
 | 
					 | 
				
			||||||
        //     case Z_NEGATIVE: {
 | 
					 | 
				
			||||||
        //         chunkData.addZNegativeEdge(faceWeights, faceTypes);
 | 
					 | 
				
			||||||
        //     } break;
 | 
					 | 
				
			||||||
        // }
 | 
					 | 
				
			||||||
        return true;
 | 
					        return true;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -1335,7 +1335,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]
 | 
				
			||||||
                    );
 | 
					                    );
 | 
				
			||||||
                    polygonizeTransition(currentTransitionCell, TerrainChunkModelGeneration.MIN_ISO_VALUE, triangles, samplerTriangles, vertMap, verts, normals, trianglesSharingVert, false);
 | 
					                    polygonizeTransition(currentTransitionCell, TerrainChunkModelGeneration.MIN_ISO_VALUE, triangles, samplerTriangles, vertMap, verts, normals, trianglesSharingVert, true);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    //
 | 
					                    //
 | 
				
			||||||
                    //Generate the normal cell with half width
 | 
					                    //Generate the normal cell with half width
 | 
				
			||||||
@ -1349,7 +1349,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
 | 
				
			||||||
                    polygonize(currentCell, TerrainChunkModelGeneration.MIN_ISO_VALUE, triangles, samplerTriangles, vertMap, verts, normals, trianglesSharingVert, false);
 | 
					                    polygonize(currentCell, TerrainChunkModelGeneration.MIN_ISO_VALUE, triangles, samplerTriangles, vertMap, verts, normals, trianglesSharingVert, true);
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user