use of io.xol.chunkstories.renderer.chunks.ChunkRenderDataHolder.RenderLodLevel in project chunkstories by Hugobros3.
the class ChunkMeshesRenderer method renderChunks.
@Override
public void renderChunks(RenderingInterface renderingInterface) {
RenderPass currentPass = renderingInterface.getCurrentPass();
List<ChunkRenderCommand> culledChunks = currentPass.name.startsWith("shadow") ? culledChunksShadow : culledChunksNormal;
ShadingType shadingType = currentPass.name.startsWith("water") ? ShadingType.LIQUIDS : ShadingType.OPAQUE;
if (currentPass.name.startsWith("shadow"))
renderingInterface.currentShader().setUniform1f("useVoxelCoordinates", 1f);
Matrix4f matrix = new Matrix4f();
for (ChunkRenderCommand command : culledChunks) {
matrix.identity();
matrix.translate(new Vector3f(command.displayWorldX, command.displayWorldY, command.displayWorldZ));
renderingInterface.setObjectMatrix(matrix);
Vector3d chunkPos = new Vector3d(command.displayWorldX + 16, command.displayWorldY + 16, command.displayWorldZ + 16);
double distance = renderingInterface.getCamera().getCameraPosition().distance(chunkPos);
RenderLodLevel lodToUse;
lodToUse = distance < Math.max(64, world.getClient().getConfiguration().getIntOption("client.rendering.viewDistance") / 4.0) ? RenderLodLevel.HIGH : RenderLodLevel.LOW;
((ClientChunk) command.chunk).getChunkRenderData().renderPass(renderingInterface, lodToUse, shadingType);
}
if (currentPass.name.startsWith("shadow"))
renderingInterface.currentShader().setUniform1f("useVoxelCoordinates", 0f);
}
Aggregations