No.
Your Chunk Rendermethod should look like this:
public void render(???){
// Create a new ChunkRenderer
ChunkRenderer renderer = new ChunkRenderer();
// FOR every_block_in_chunk DO render_block
for(int x = 0; x < var1; x++){
int gx = chunk.chunkTotalPosX + x;
for(int z = 0; z < var2; z++){
int gz = chunk.chunkTotalPosZ + z;
for(int y = 0; y < var3; y++){
int gy = chunk.chunkTotalPosY + Y;
// Translate to the Blocks global Position
renderer.setBlockTranslation(gx,gy,gz);
// Then Render the Block using the renderer
//When you render a vertex using the renderer, it will be translated by the global block position
}
}
}
}
You must NOT translate anything!
All translations are done by the ChunkRenderer
This would just terminate the sense behind using a ChunkRenderer.
For Example:
public void render(Chunk chunk){
// Create a new ChunkRenderer
ChunkRenderer renderer = new ChunkRenderer();
// FOR every_block_in_chunk DO render_block
for(int x = 0; x < var1; x++){
int gx = chunk.chunkTotalPosX + x;
for(int z = 0; z < var2; z++){
int gz = chunk.chunkTotalPosZ + z;
for(int y = 0; y < var3; y++){
int gy = chunk.chunkTotalPosY + Y;
// Translate to the Blocks global Position
renderer.setBlockTranslation(gx,gy,gz);
// Then Render the Block using the renderer
//When you render a vertex using the renderer, it will be translated by the global block position
int blockID = chunk.getBlock(x,y,z);
renderer.renderBlock();
}
}
}
}
The Block render Method would look like this (only for top surfaces):
public void renderBlock(){
// This would just draw the topside of the block
// Notice how the vertex coordinates are local for the block
drawVertex3d(0,1,0);
drawVertex3d(1,1,0);
drawVertex3d(1,1,1);
drawVertex3d(0,1,1);
}
Important:
This can be optimized even more.
But that’s for you to find out!
- Longor1996