voxelImprovements #5
@ -20,6 +20,11 @@ public class TerrainChunkData {
 | 
				
			|||||||
    //texture ratio vector
 | 
					    //texture ratio vector
 | 
				
			||||||
    List<Float> textureRatioVectors; //HOW MUCH of each texture in the atlas to sample
 | 
					    List<Float> textureRatioVectors; //HOW MUCH of each texture in the atlas to sample
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * The LOD of the model
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    int lod;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Creates an object to hold data required to generate a chunk
 | 
					     * Creates an object to hold data required to generate a chunk
 | 
				
			||||||
     * @param vertices
 | 
					     * @param vertices
 | 
				
			||||||
@ -27,14 +32,16 @@ public class TerrainChunkData {
 | 
				
			|||||||
     * @param faceElements
 | 
					     * @param faceElements
 | 
				
			||||||
     * @param uvs
 | 
					     * @param uvs
 | 
				
			||||||
     * @param textureSamplers
 | 
					     * @param textureSamplers
 | 
				
			||||||
 | 
					     * @param lod The LOD of the model
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    public TerrainChunkData(List<Float> vertices, List<Float> normals, List<Integer> faceElements, List<Float> uvs, List<Float> textureSamplers, List<Float> textureRatioVectors){
 | 
					    public TerrainChunkData(List<Float> vertices, List<Float> normals, List<Integer> faceElements, List<Float> uvs, List<Float> textureSamplers, List<Float> textureRatioVectors, int lod){
 | 
				
			||||||
        this.vertices = vertices;
 | 
					        this.vertices = vertices;
 | 
				
			||||||
        this.normals = normals;
 | 
					        this.normals = normals;
 | 
				
			||||||
        this.faceElements = faceElements;
 | 
					        this.faceElements = faceElements;
 | 
				
			||||||
        this.uvs = uvs;
 | 
					        this.uvs = uvs;
 | 
				
			||||||
        this.textureSamplers = textureSamplers;
 | 
					        this.textureSamplers = textureSamplers;
 | 
				
			||||||
        this.textureRatioVectors = textureRatioVectors;
 | 
					        this.textureRatioVectors = textureRatioVectors;
 | 
				
			||||||
 | 
					        this.lod = lod;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
@ -85,4 +92,12 @@ public class TerrainChunkData {
 | 
				
			|||||||
        return textureRatioVectors;
 | 
					        return textureRatioVectors;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Gets the LOD of the model
 | 
				
			||||||
 | 
					     * @return The LOD
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public int getLOD(){
 | 
				
			||||||
 | 
					        return lod;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -763,7 +763,7 @@ public class TerrainChunkModelGeneration {
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        //List<Float> vertices, List<Float> normals, List<Integer> faceElements, List<Float> uvs
 | 
					        //List<Float> vertices, List<Float> normals, List<Integer> faceElements, List<Float> uvs
 | 
				
			||||||
        TerrainChunkData rVal = new TerrainChunkData(vertsFlat, normalsFlat, elementsFlat, UVs, textureSamplers, textureRatioData);
 | 
					        TerrainChunkData rVal = new TerrainChunkData(vertsFlat, normalsFlat, elementsFlat, UVs, textureSamplers, textureRatioData, 0);
 | 
				
			||||||
        return rVal;
 | 
					        return rVal;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
@ -892,14 +892,15 @@ public class TerrainChunkModelGeneration {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        //bounding sphere logic
 | 
					        //bounding sphere logic
 | 
				
			||||||
 | 
					        int distance = ServerTerrainChunk.CHUNK_DIMENSION / 2 * (int)Math.pow(2,data.getLOD());
 | 
				
			||||||
        mesh.updateBoundingSphere(
 | 
					        mesh.updateBoundingSphere(
 | 
				
			||||||
            ServerTerrainChunk.CHUNK_DIMENSION,
 | 
					            distance,
 | 
				
			||||||
            ServerTerrainChunk.CHUNK_DIMENSION,
 | 
					            distance,
 | 
				
			||||||
            ServerTerrainChunk.CHUNK_DIMENSION,
 | 
					            distance,
 | 
				
			||||||
            (float)Math.sqrt(
 | 
					            (float)Math.sqrt(
 | 
				
			||||||
                ServerTerrainChunk.CHUNK_DIMENSION * ServerTerrainChunk.CHUNK_DIMENSION +
 | 
					                distance * distance +
 | 
				
			||||||
                ServerTerrainChunk.CHUNK_DIMENSION * ServerTerrainChunk.CHUNK_DIMENSION +
 | 
					                distance * distance +
 | 
				
			||||||
                ServerTerrainChunk.CHUNK_DIMENSION * ServerTerrainChunk.CHUNK_DIMENSION
 | 
					                distance * distance
 | 
				
			||||||
            ));
 | 
					            ));
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
 | 
				
			|||||||
@ -1694,7 +1694,7 @@ public class TransvoxelModelGeneration {
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        //List<Float> vertices, List<Float> normals, List<Integer> faceElements, List<Float> uvs
 | 
					        //List<Float> vertices, List<Float> normals, List<Integer> faceElements, List<Float> uvs
 | 
				
			||||||
        TerrainChunkData rVal = new TerrainChunkData(vertsFlat, normalsFlat, elementsFlat, UVs, textureSamplers, textureRatioData);
 | 
					        TerrainChunkData rVal = new TerrainChunkData(vertsFlat, normalsFlat, elementsFlat, UVs, textureSamplers, textureRatioData, chunkData.levelOfDetail);
 | 
				
			||||||
        return rVal;
 | 
					        return rVal;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user