voxelImprovements #5
@ -491,31 +491,18 @@ public class ClientDrawCellManager {
 | 
				
			|||||||
        throw new Error("Unimplemented");
 | 
					        throw new Error("Unimplemented");
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					 | 
				
			||||||
     * Checks if the terrain cache has a chunk at a given world point
 | 
					 | 
				
			||||||
     * @param worldX the x coordinate
 | 
					 | 
				
			||||||
     * @param worldY the y coordinate
 | 
					 | 
				
			||||||
     * @param worldZ the z coordinate
 | 
					 | 
				
			||||||
     * @return true if the chunk data exists, false otherwise
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    boolean containsChunkDataAtWorldPoint(int worldX, int worldY, int worldZ){
 | 
					 | 
				
			||||||
        if(Globals.clientTerrainManager != null){
 | 
					 | 
				
			||||||
            return Globals.clientTerrainManager.containsChunkDataAtWorldPoint(worldX,worldY,worldZ,ChunkData.NO_STRIDE);
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        return true;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Requests all chunks for a given draw cell
 | 
					     * Requests all chunks for a given draw cell
 | 
				
			||||||
     * @param cell The cell
 | 
					     * @param cell The cell
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    private void requestChunks(WorldOctTree.FloatingChunkTreeNode<DrawCell> node){
 | 
					    private void requestChunks(WorldOctTree.FloatingChunkTreeNode<DrawCell> node){
 | 
				
			||||||
        DrawCell cell = node.getData();
 | 
					        DrawCell cell = node.getData();
 | 
				
			||||||
        int lodMultiplitier = this.chunkTree.getMaxLevel() - node.getLevel() + 1;
 | 
					        int lod = this.chunkTree.getMaxLevel() - node.getLevel();
 | 
				
			||||||
        for(int i = 0; i < 2 * lodMultiplitier; i++){
 | 
					        int spacingFactor = (int)Math.pow(2,lod);
 | 
				
			||||||
            for(int j = 0; j < 2 * lodMultiplitier; j++){
 | 
					        for(int i = 0; i < 2; i++){
 | 
				
			||||||
                for(int k = 0; k < 2 * lodMultiplitier; k++){
 | 
					            for(int j = 0; j < 2; j++){
 | 
				
			||||||
                    Vector3i posToCheck = new Vector3i(cell.getWorldPos()).add(i,j,k);
 | 
					                for(int k = 0; k < 2; k++){
 | 
				
			||||||
 | 
					                    Vector3i posToCheck = new Vector3i(cell.getWorldPos()).add(i*spacingFactor,j*spacingFactor,k*spacingFactor);
 | 
				
			||||||
                    if(
 | 
					                    if(
 | 
				
			||||||
                        posToCheck.x >= 0 &&
 | 
					                        posToCheck.x >= 0 &&
 | 
				
			||||||
                        posToCheck.x < Globals.clientWorldData.getWorldDiscreteSize() &&
 | 
					                        posToCheck.x < Globals.clientWorldData.getWorldDiscreteSize() &&
 | 
				
			||||||
@ -542,11 +529,12 @@ public class ClientDrawCellManager {
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    private boolean containsDataToGenerate(WorldOctTree.FloatingChunkTreeNode<DrawCell> node, List<DrawCellFace> highResFaces){
 | 
					    private boolean containsDataToGenerate(WorldOctTree.FloatingChunkTreeNode<DrawCell> node, List<DrawCellFace> highResFaces){
 | 
				
			||||||
        DrawCell cell = node.getData();
 | 
					        DrawCell cell = node.getData();
 | 
				
			||||||
        int lodMultiplitier = this.chunkTree.getMaxLevel() - node.getLevel() + 1;
 | 
					        int lod = this.chunkTree.getMaxLevel() - node.getLevel();
 | 
				
			||||||
        for(int i = 0; i < 2 * lodMultiplitier; i++){
 | 
					        int spacingFactor = (int)Math.pow(2,lod);
 | 
				
			||||||
            for(int j = 0; j < 2 * lodMultiplitier; j++){
 | 
					        for(int i = 0; i < 2; i++){
 | 
				
			||||||
                for(int k = 0; k < 2 * lodMultiplitier; k++){
 | 
					            for(int j = 0; j < 2; j++){
 | 
				
			||||||
                    Vector3i posToCheck = new Vector3i(cell.getWorldPos()).add(i,j,k);
 | 
					                for(int k = 0; k < 2; k++){
 | 
				
			||||||
 | 
					                    Vector3i posToCheck = new Vector3i(cell.getWorldPos()).add(i*spacingFactor,j*spacingFactor,k*spacingFactor);
 | 
				
			||||||
                    if(
 | 
					                    if(
 | 
				
			||||||
                        posToCheck.x >= 0 &&
 | 
					                        posToCheck.x >= 0 &&
 | 
				
			||||||
                        posToCheck.x < Globals.clientWorldData.getWorldDiscreteSize() &&
 | 
					                        posToCheck.x < Globals.clientWorldData.getWorldDiscreteSize() &&
 | 
				
			||||||
@ -561,48 +549,48 @@ public class ClientDrawCellManager {
 | 
				
			|||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        if(highResFaces != null){
 | 
					        // if(highResFaces != null){
 | 
				
			||||||
            for(DrawCellFace highResFace : highResFaces){
 | 
					        //     for(DrawCellFace highResFace : highResFaces){
 | 
				
			||||||
                //x & y are in face-space
 | 
					        //         //x & y are in face-space
 | 
				
			||||||
                for(int x = 0; x < 2 * lodMultiplitier; x++){
 | 
					        //         for(int x = 0; x < 4; x++){
 | 
				
			||||||
                    for(int y = 0; y < 2 * lodMultiplitier; y++){
 | 
					        //             for(int y = 0; y < 4; y++){
 | 
				
			||||||
                        Vector3i posToCheck = null;
 | 
					        //                 Vector3i posToCheck = null;
 | 
				
			||||||
                        //implicitly performing transforms to adapt from face-space to world space
 | 
					        //                 //implicitly performing transforms to adapt from face-space to world space
 | 
				
			||||||
                        switch(highResFace){
 | 
					        //                 switch(highResFace){
 | 
				
			||||||
                            case X_POSITIVE: {
 | 
					        //                     case X_POSITIVE: {
 | 
				
			||||||
                                posToCheck = new Vector3i(cell.getWorldPos()).add(lodMultiplitier,x,y);
 | 
					        //                         posToCheck = new Vector3i(cell.getWorldPos()).add(lodMultiplitier,x,y);
 | 
				
			||||||
                            } break;
 | 
					        //                     } break;
 | 
				
			||||||
                            case X_NEGATIVE: {
 | 
					        //                     case X_NEGATIVE: {
 | 
				
			||||||
                                posToCheck = new Vector3i(cell.getWorldPos()).add(-1,x,y);
 | 
					        //                         posToCheck = new Vector3i(cell.getWorldPos()).add(-1,x,y);
 | 
				
			||||||
                            } break;
 | 
					        //                     } break;
 | 
				
			||||||
                            case Y_POSITIVE: {
 | 
					        //                     case Y_POSITIVE: {
 | 
				
			||||||
                                posToCheck = new Vector3i(cell.getWorldPos()).add(x,lodMultiplitier,y);
 | 
					        //                         posToCheck = new Vector3i(cell.getWorldPos()).add(x,lodMultiplitier,y);
 | 
				
			||||||
                            } break;
 | 
					        //                     } break;
 | 
				
			||||||
                            case Y_NEGATIVE: {
 | 
					        //                     case Y_NEGATIVE: {
 | 
				
			||||||
                                posToCheck = new Vector3i(cell.getWorldPos()).add(x,-1,y);
 | 
					        //                         posToCheck = new Vector3i(cell.getWorldPos()).add(x,-1,y);
 | 
				
			||||||
                            } break;
 | 
					        //                     } break;
 | 
				
			||||||
                            case Z_POSITIVE: {
 | 
					        //                     case Z_POSITIVE: {
 | 
				
			||||||
                                posToCheck = new Vector3i(cell.getWorldPos()).add(x,y,lodMultiplitier);
 | 
					        //                         posToCheck = new Vector3i(cell.getWorldPos()).add(x,y,lodMultiplitier);
 | 
				
			||||||
                            } break;
 | 
					        //                     } break;
 | 
				
			||||||
                            case Z_NEGATIVE: {
 | 
					        //                     case Z_NEGATIVE: {
 | 
				
			||||||
                                posToCheck = new Vector3i(cell.getWorldPos()).add(x,y,-1);
 | 
					        //                         posToCheck = new Vector3i(cell.getWorldPos()).add(x,y,-1);
 | 
				
			||||||
                            } break;
 | 
					        //                     } break;
 | 
				
			||||||
                        }
 | 
					        //                 }
 | 
				
			||||||
                        if(
 | 
					        //                 if(
 | 
				
			||||||
                            posToCheck.x >= 0 &&
 | 
					        //                     posToCheck.x >= 0 &&
 | 
				
			||||||
                            posToCheck.x < Globals.clientWorldData.getWorldDiscreteSize() &&
 | 
					        //                     posToCheck.x < Globals.clientWorldData.getWorldDiscreteSize() &&
 | 
				
			||||||
                            posToCheck.y >= 0 &&
 | 
					        //                     posToCheck.y >= 0 &&
 | 
				
			||||||
                            posToCheck.y < Globals.clientWorldData.getWorldDiscreteSize() &&
 | 
					        //                     posToCheck.y < Globals.clientWorldData.getWorldDiscreteSize() &&
 | 
				
			||||||
                            posToCheck.z >= 0 &&
 | 
					        //                     posToCheck.z >= 0 &&
 | 
				
			||||||
                            posToCheck.z < Globals.clientWorldData.getWorldDiscreteSize() &&
 | 
					        //                     posToCheck.z < Globals.clientWorldData.getWorldDiscreteSize() &&
 | 
				
			||||||
                            !Globals.clientTerrainManager.containsChunkDataAtWorldPoint(posToCheck.x, posToCheck.y, posToCheck.z, ChunkData.NO_STRIDE)
 | 
					        //                     !Globals.clientTerrainManager.containsChunkDataAtWorldPoint(posToCheck.x, posToCheck.y, posToCheck.z, ChunkData.NO_STRIDE)
 | 
				
			||||||
                            ){
 | 
					        //                     ){
 | 
				
			||||||
                            return false;
 | 
					        //                     return false;
 | 
				
			||||||
                        }
 | 
					        //                 }
 | 
				
			||||||
                    }
 | 
					        //             }
 | 
				
			||||||
                }
 | 
					        //         }
 | 
				
			||||||
            }
 | 
					        //     }
 | 
				
			||||||
        }
 | 
					        // }
 | 
				
			||||||
        return true;
 | 
					        return true;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -192,23 +192,23 @@ public class DrawCell {
 | 
				
			|||||||
            for(int y = 0; y < ChunkData.CHUNK_DATA_GENERATOR_SIZE; y++){
 | 
					            for(int y = 0; y < ChunkData.CHUNK_DATA_GENERATOR_SIZE; y++){
 | 
				
			||||||
                for(int z = 0; z < ChunkData.CHUNK_DATA_GENERATOR_SIZE; z++){
 | 
					                for(int z = 0; z < ChunkData.CHUNK_DATA_GENERATOR_SIZE; z++){
 | 
				
			||||||
                    ChunkData currentChunk = Globals.clientTerrainManager.getChunkDataAtWorldPoint(
 | 
					                    ChunkData currentChunk = Globals.clientTerrainManager.getChunkDataAtWorldPoint(
 | 
				
			||||||
                        worldPos.x + (x * spacingFactor) / ChunkData.CHUNK_SIZE,
 | 
					                        worldPos.x + x / ChunkData.CHUNK_SIZE * spacingFactor,
 | 
				
			||||||
                        worldPos.y + (y * spacingFactor) / ChunkData.CHUNK_SIZE,
 | 
					                        worldPos.y + y / ChunkData.CHUNK_SIZE * spacingFactor,
 | 
				
			||||||
                        worldPos.z + (z * spacingFactor) / ChunkData.CHUNK_SIZE,
 | 
					                        worldPos.z + z / ChunkData.CHUNK_SIZE * spacingFactor,
 | 
				
			||||||
                        ChunkData.NO_STRIDE
 | 
					                        ChunkData.NO_STRIDE
 | 
				
			||||||
                    );
 | 
					                    );
 | 
				
			||||||
                    if(currentChunk == null){
 | 
					                    if(currentChunk == null){
 | 
				
			||||||
                        return false;
 | 
					                        return false;
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                    weights[x][y][z] = currentChunk.getWeight(
 | 
					                    weights[x][y][z] = currentChunk.getWeight(
 | 
				
			||||||
                        (x * spacingFactor) % ChunkData.CHUNK_SIZE,
 | 
					                        x % ChunkData.CHUNK_SIZE,
 | 
				
			||||||
                        (y * spacingFactor) % ChunkData.CHUNK_SIZE,
 | 
					                        y % ChunkData.CHUNK_SIZE,
 | 
				
			||||||
                        (z * spacingFactor) % ChunkData.CHUNK_SIZE
 | 
					                        z % ChunkData.CHUNK_SIZE
 | 
				
			||||||
                    );
 | 
					                    );
 | 
				
			||||||
                    types[x][y][z] = currentChunk.getType(
 | 
					                    types[x][y][z] = currentChunk.getType(
 | 
				
			||||||
                        (x * spacingFactor) % ChunkData.CHUNK_SIZE,
 | 
					                        x % ChunkData.CHUNK_SIZE,
 | 
				
			||||||
                        (y * spacingFactor) % ChunkData.CHUNK_SIZE,
 | 
					                        y % ChunkData.CHUNK_SIZE,
 | 
				
			||||||
                        (z * spacingFactor) % ChunkData.CHUNK_SIZE
 | 
					                        z % ChunkData.CHUNK_SIZE
 | 
				
			||||||
                    );
 | 
					                    );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    //checks to see if there is only one type of voxel in this chunk
 | 
					                    //checks to see if there is only one type of voxel in this chunk
 | 
				
			||||||
@ -233,201 +233,201 @@ 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 higherResSpacing = (int)Math.pow(2,lod - 1);
 | 
				
			||||||
        float[][] faceWeights = new float[TransvoxelModelGeneration.FACE_DATA_DIMENSIONS][TransvoxelModelGeneration.FACE_DATA_DIMENSIONS];
 | 
					        // float[][] faceWeights = new float[TransvoxelModelGeneration.FACE_DATA_DIMENSIONS][TransvoxelModelGeneration.FACE_DATA_DIMENSIONS];
 | 
				
			||||||
        int[][] faceTypes = new int[TransvoxelModelGeneration.FACE_DATA_DIMENSIONS][TransvoxelModelGeneration.FACE_DATA_DIMENSIONS];
 | 
					        // int[][] faceTypes = new int[TransvoxelModelGeneration.FACE_DATA_DIMENSIONS][TransvoxelModelGeneration.FACE_DATA_DIMENSIONS];
 | 
				
			||||||
        //allocate face array
 | 
					        // //allocate face array
 | 
				
			||||||
        for(int x = 0; x < TransvoxelModelGeneration.FACE_DATA_DIMENSIONS; x++){
 | 
					        // for(int x = 0; x < TransvoxelModelGeneration.FACE_DATA_DIMENSIONS; x++){
 | 
				
			||||||
            for(int y = 0; y < TransvoxelModelGeneration.FACE_DATA_DIMENSIONS; y++){
 | 
					        //     for(int y = 0; y < TransvoxelModelGeneration.FACE_DATA_DIMENSIONS; y++){
 | 
				
			||||||
                int worldCoordOffset1 = (x * higherResSpacing) / ChunkData.CHUNK_SIZE;
 | 
					        //         int worldCoordOffset1 = (x * higherResSpacing) / ChunkData.CHUNK_SIZE;
 | 
				
			||||||
                int worldCoordOffset2 = (y * higherResSpacing) / ChunkData.CHUNK_SIZE;
 | 
					        //         int worldCoordOffset2 = (y * higherResSpacing) / ChunkData.CHUNK_SIZE;
 | 
				
			||||||
                //solve coordinates relative to the face
 | 
					        //         //solve coordinates relative to the face
 | 
				
			||||||
                int localCoord1 = (x * higherResSpacing) % ChunkData.CHUNK_SIZE;
 | 
					        //         int localCoord1 = (x * higherResSpacing) % ChunkData.CHUNK_SIZE;
 | 
				
			||||||
                int localCoord2 = (y * higherResSpacing) % ChunkData.CHUNK_SIZE;
 | 
					        //         int localCoord2 = (y * higherResSpacing) % 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 + (17 * mainSpacing) / ChunkData.CHUNK_SIZE,
 | 
				
			||||||
                                worldPos.y + worldCoordOffset1,
 | 
					        //                         worldPos.y + worldCoordOffset1,
 | 
				
			||||||
                                worldPos.z + worldCoordOffset2
 | 
					        //                         worldPos.z + worldCoordOffset2
 | 
				
			||||||
                            ),
 | 
					        //                     ),
 | 
				
			||||||
                            ChunkData.NO_STRIDE
 | 
					        //                     ChunkData.NO_STRIDE
 | 
				
			||||||
                        );
 | 
					 | 
				
			||||||
                        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
 | 
					 | 
				
			||||||
                            ),
 | 
					 | 
				
			||||||
                            ChunkData.NO_STRIDE
 | 
					 | 
				
			||||||
                        );
 | 
					 | 
				
			||||||
                        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 + (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){
 | 
					        //                 if(currentChunk == null){
 | 
				
			||||||
                //     throw new Error("Chunk is null! " + worldPos);
 | 
					        //                     return false;
 | 
				
			||||||
        //                 }
 | 
					        //                 }
 | 
				
			||||||
                // weights[x][y][z] = currentChunk.getWeight(
 | 
					        //                 faceWeights[x][y] = currentChunk.getWeight(
 | 
				
			||||||
                //     (x * higherResSpacing) % ChunkData.CHUNK_SIZE,
 | 
					        //                     0,
 | 
				
			||||||
                //     (y * higherResSpacing) % ChunkData.CHUNK_SIZE,
 | 
					        //                     localCoord1,
 | 
				
			||||||
                //     (z * spacingFactor) % ChunkData.CHUNK_SIZE
 | 
					        //                     localCoord2
 | 
				
			||||||
        //                 );
 | 
					        //                 );
 | 
				
			||||||
                // types[x][y][z] = currentChunk.getType(
 | 
					        //                 faceTypes[x][y] = currentChunk.getType(
 | 
				
			||||||
                //     (x * higherResSpacing) % ChunkData.CHUNK_SIZE,
 | 
					        //                     0,
 | 
				
			||||||
                //     (y * higherResSpacing) % ChunkData.CHUNK_SIZE,
 | 
					        //                     localCoord1,
 | 
				
			||||||
                //     (z * spacingFactor) % ChunkData.CHUNK_SIZE
 | 
					        //                     localCoord2
 | 
				
			||||||
        //                 );
 | 
					        //                 );
 | 
				
			||||||
            }
 | 
					        //             } break;
 | 
				
			||||||
        }
 | 
					        //             case X_NEGATIVE: {
 | 
				
			||||||
        switch(higherLODFace){
 | 
					        //                 ChunkData currentChunk = Globals.clientTerrainManager.getChunkDataAtWorldPoint(
 | 
				
			||||||
            case X_POSITIVE: {
 | 
					        //                     new Vector3i(
 | 
				
			||||||
                chunkData.addXPositiveEdge(faceWeights, faceTypes);
 | 
					        //                         worldPos.x,
 | 
				
			||||||
            } break;
 | 
					        //                         worldPos.y + worldCoordOffset1,
 | 
				
			||||||
            case X_NEGATIVE: {
 | 
					        //                         worldPos.z + worldCoordOffset2
 | 
				
			||||||
                chunkData.addXNegativeEdge(faceWeights, faceTypes);
 | 
					        //                     ),
 | 
				
			||||||
            } break;
 | 
					        //                     ChunkData.NO_STRIDE
 | 
				
			||||||
            case Y_POSITIVE: {
 | 
					        //                 );
 | 
				
			||||||
                chunkData.addYPositiveEdge(faceWeights, faceTypes);
 | 
					        //                 if(currentChunk == null){
 | 
				
			||||||
            } break;
 | 
					        //                     return false;
 | 
				
			||||||
            case Y_NEGATIVE: {
 | 
					        //                 }
 | 
				
			||||||
                chunkData.addYNegativeEdge(faceWeights, faceTypes);
 | 
					        //                 faceWeights[x][y] = currentChunk.getWeight(
 | 
				
			||||||
            } break;
 | 
					        //                     0,
 | 
				
			||||||
            case Z_POSITIVE: {
 | 
					        //                     localCoord1,
 | 
				
			||||||
                chunkData.addZPositiveEdge(faceWeights, faceTypes);
 | 
					        //                     localCoord2
 | 
				
			||||||
            } break;
 | 
					        //                 );
 | 
				
			||||||
            case Z_NEGATIVE: {
 | 
					        //                 faceTypes[x][y] = currentChunk.getType(
 | 
				
			||||||
                chunkData.addZNegativeEdge(faceWeights, faceTypes);
 | 
					        //                     0,
 | 
				
			||||||
            } break;
 | 
					        //                     localCoord1,
 | 
				
			||||||
        }
 | 
					        //                     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;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user