SuperMartijn642 / Tesseract

9 stars 9 forks source link

[Feature] Option to disable rendering ender faces #94

Open lilmayu opened 4 months ago

lilmayu commented 4 months ago

Minecraft: 1.12.2

Is your feature request related to a problem? Please describe. I've been diagnosing issues with my FPS and came upon your TesseractBlockEntityRenderer. I'm quite baffled why there's no option to disable the end portal effect render, since it's just for decoration purposes.

Describe the solution you'd like Add an option in the config to disable this behavior; render instead a black cube, like so (for example):

Tessellator tessellator = Tessellator.getInstance();
BufferBuilder bufferbuilder = tessellator.getBuffer();
GlStateManager.disableTexture2D();
GlStateManager.color(0, 0, 0); // Set the color to black

bufferbuilder.begin(7, DefaultVertexFormats.POSITION);

bufferbuilder.pos(0, 0, 0).endVertex();
bufferbuilder.pos(1, 0, 0).endVertex();
bufferbuilder.pos(1, 0, 1).endVertex();
bufferbuilder.pos(0, 0, 1).endVertex();

bufferbuilder.pos(0, 1, 1).endVertex();
bufferbuilder.pos(1, 1, 1).endVertex();
bufferbuilder.pos(1, 1, 0).endVertex();
bufferbuilder.pos(0, 1, 0).endVertex();

bufferbuilder.pos(0, 1, 0).endVertex();
bufferbuilder.pos(1, 1, 0).endVertex();
bufferbuilder.pos(1, 0, 0).endVertex();
bufferbuilder.pos(0, 0, 0).endVertex();

bufferbuilder.pos(0, 0, 1).endVertex();
bufferbuilder.pos(1, 0, 1).endVertex();
bufferbuilder.pos(1, 1, 1).endVertex();
bufferbuilder.pos(0, 1, 1).endVertex();

bufferbuilder.pos(0, 0, 0).endVertex();
bufferbuilder.pos(0, 0, 1).endVertex();
bufferbuilder.pos(0, 1, 1).endVertex();
bufferbuilder.pos(0, 1, 0).endVertex();

bufferbuilder.pos(1, 1, 0).endVertex();
bufferbuilder.pos(1, 1, 1).endVertex();
bufferbuilder.pos(1, 0, 1).endVertex();
bufferbuilder.pos(1, 0, 0).endVertex();

tessellator.draw();
GlStateManager.enableTexture2D();

Upon applying, I've achieved nearly +30fps in environments, where there are more than few Tesseracts.

lilmayu commented 4 months ago

Another idea is to render whole different model when the render should be on. Or render some block model inside the Tesseract to have still some beauty, for example obsidian or some custom texture which mimics the end portal effect (but without any animations)

SuperMartijn642 commented 4 months ago

I have not tested the performance of the end portal effect (especially on 1.12). As the code for it is simply copied from the end portal itself, I assumed performance would not be significantly impacted.

Newer Minecraft versions simply use shaders for the end portal effect, hence it's unlikely to be an issue there. In 1.12, shaders aren't really an option due to the older OpenGL version used. I am not too sure there's much I can (or am willing to) optimize for the 1.12 code.

Add an option in the config to disable this behavior

I don't mind adding an option to render something simpler instead.