Rendering is slow
Kenkron opened this issue ยท 1 comments
When on screen, the minimap drops the framerate down to ~12 FPS.
- This stops happening if AtlasRenderHelper.drawAutotileCorner is commented out in the AAORenderEventReciever.drawTiles method.
- No such framerate drop occurs in the Antique Atlas mod itself.
- Keeps happening even if I replace drawAutotileCorner with raw opengl calls.
Relavent Code from AtlasRenderHelper.drawAutotileCorner:
TileRenderIterator iter = new TileRenderIterator(biomeData);
Rect iteratorScope = new Rect((int)position.xCoord/CHUNKSIZE-6,(int)position.zCoord/CHUNKSIZE-3,(int)position.xCoord/CHUNKSIZE+4,(int)position.zCoord/CHUNKSIZE+3);
iter.setScope(iteratorScope);
iter.setStep(1);
Vec3 chunkPosition = Vec3.createVectorHelper(position.xCoord/CHUNKSIZE,position.yCoord/CHUNKSIZE,position.zCoord/CHUNKSIZE);
int shapeMiddleX = (shape.minX+shape.maxX)/2;
int shapeMiddleY = (shape.minY+shape.maxY)/2;
while (iter.hasNext()) {
SubTileQuartet subtiles = iter.next();
for (SubTile subtile : subtiles) {
if (subtile == null || subtile.tile == null)
continue;
//Position of this subtile (measured in chunks) relative to the player
float relativeChunkPositionX = (float) (subtile.x/2.0+iteratorScope.minX-chunkPosition.xCoord);
float relativeChunkPositionY = (float) (subtile.y/2.0+iteratorScope.minY-chunkPosition.zCoord);
AtlasRenderHelper.drawAutotileCorner(BiomeTextureMap.instance()
.getTexture(subtile.tile),
shapeMiddleX+(int)Math.round(relativeChunkPositionX*TILE_SIZE),
shapeMiddleY+(int)Math.round(relativeChunkPositionY*TILE_SIZE),
subtile.getTextureU(), subtile
.getTextureV(), TILE_SIZE/2);
}
}
Example Raw OpenGL:
/**This does not improve framerate...*/
public static void drawAutotileCornerRAW(ResourceLocation texture, int x, int y, int u, int v, int tileHalfSize) {
//Effectively a string-based call to GL11.glBindTexture(GL11.GL_TEXTURE_2D, p_94277_0_);
Minecraft.getMinecraft().renderEngine.bindTexture(texture);
float minU = u / 4f;
float maxU =(u + 1) / 4f;
float minV = v / 6f;
float maxV =(v + 1) / 6f;
GL11.glBegin(GL11.GL_QUADS);
GL11.glTexCoord2f(maxU, maxV);
GL11.glVertex2f(x+tileHalfSize, y+ tileHalfSize);
GL11.glTexCoord2f(maxU, minV);
GL11.glVertex2f(x+tileHalfSize,y);
GL11.glTexCoord2f(minU, minV);
GL11.glVertex2f(x,y);
GL11.glTexCoord2f(minU, maxV);
GL11.glVertex2f(x,y+ tileHalfSize);
GL11.glEnd();
}