diff --git a/src/main/java/com/simibubi/create/foundation/render/ContraptionRenderDispatcher.java b/src/main/java/com/simibubi/create/foundation/render/ContraptionRenderDispatcher.java index b34886d03..0689583a7 100644 --- a/src/main/java/com/simibubi/create/foundation/render/ContraptionRenderDispatcher.java +++ b/src/main/java/com/simibubi/create/foundation/render/ContraptionRenderDispatcher.java @@ -1,6 +1,7 @@ package com.simibubi.create.foundation.render; import com.mojang.blaze3d.matrix.MatrixStack; +import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.systems.RenderSystem; import com.simibubi.create.content.contraptions.components.structureMovement.Contraption; import com.simibubi.create.foundation.render.light.LightVolume; @@ -51,12 +52,7 @@ public class ContraptionRenderDispatcher { if (renderers.isEmpty()) return; - FastKineticRenderer.setup(Minecraft.getInstance().gameRenderer); -// if (renderType == RenderType.getTranslucent()) { -// GL30.glEnable(GL11.GL_DEPTH_TEST); -// GL20.glDepthFunc(GL20.GL_LESS); -// RenderSystem.defaultBlendFunc(); -// } + renderType.startDrawing(); GL11.glEnable(GL13.GL_TEXTURE_3D); GL13.glActiveTexture(GL40.GL_TEXTURE4); // the shaders expect light volumes to be in texture 4 @@ -85,12 +81,9 @@ public class ContraptionRenderDispatcher { ShaderHelper.releaseShader(); -// if (renderType == RenderType.getTranslucent()) { -// GL30.glEnable(GL11.GL_DEPTH_TEST); -// GL20.glDepthFunc(GL20.GL_LEQUAL); -// } + + renderType.endDrawing(); GL11.glDisable(GL13.GL_TEXTURE_3D); - FastKineticRenderer.teardown(); GL13.glActiveTexture(GL40.GL_TEXTURE0); } diff --git a/src/main/java/com/simibubi/create/foundation/render/FastKineticRenderer.java b/src/main/java/com/simibubi/create/foundation/render/FastKineticRenderer.java index 437bf1387..3d0764187 100644 --- a/src/main/java/com/simibubi/create/foundation/render/FastKineticRenderer.java +++ b/src/main/java/com/simibubi/create/foundation/render/FastKineticRenderer.java @@ -147,53 +147,6 @@ public class FastKineticRenderer { layer.endDrawing(); } - public static void setup(GameRenderer gameRenderer) { - RenderSystem.enableBlend(); - RenderSystem.defaultBlendFunc(); - - RenderSystem.enableLighting(); - RenderSystem.enableDepthTest(); - RenderSystem.enableCull(); - GL11.glCullFace(GL11.GL_BACK); - - LightTexture lightManager = gameRenderer.getLightmapTextureManager(); - - Texture blockAtlasTexture = Minecraft.getInstance().textureManager.getTexture(PlayerContainer.BLOCK_ATLAS_TEXTURE); - Texture lightTexture = Minecraft.getInstance().textureManager.getTexture(lightManager.resourceLocation); - - // bind the block atlas texture to 0 - GL13.glActiveTexture(GL40.GL_TEXTURE0); - GL11.glBindTexture(GL11.GL_TEXTURE_2D, blockAtlasTexture.getGlTextureId()); - GL40.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST_MIPMAP_LINEAR); - GL40.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST); - - // bind the light texture to 1 and setup the mysterious filtering options - GL13.glActiveTexture(GL40.GL_TEXTURE1); - GL11.glBindTexture(GL11.GL_TEXTURE_2D, lightTexture.getGlTextureId()); - RenderSystem.texParameter(GL11.GL_TEXTURE_2D, 10241, 9729); - RenderSystem.texParameter(GL11.GL_TEXTURE_2D, 10240, 9729); - RenderSystem.texParameter(GL11.GL_TEXTURE_2D, 10242, 10496); - RenderSystem.texParameter(GL11.GL_TEXTURE_2D, 10243, 10496); - RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); - RenderSystem.enableTexture(); - } - - public static void teardown() { - - GL13.glActiveTexture(GL40.GL_TEXTURE1); - GL11.glBindTexture(GL11.GL_TEXTURE_2D, 0); - - GL13.glActiveTexture(GL40.GL_TEXTURE0); - GL40.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST_MIPMAP_LINEAR); - GL40.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST); - - RenderSystem.disableCull(); - RenderSystem.disableBlend(); - RenderSystem.defaultBlendFunc(); - RenderSystem.disableDepthTest(); - RenderSystem.disableLighting(); - } - public void registerCompartment(SuperByteBufferCache.Compartment instance) { rotating.put(instance, CacheBuilder.newBuilder().build()); belts.put(instance, CacheBuilder.newBuilder().build()); diff --git a/src/main/resources/assets/create/shader/contraption.frag b/src/main/resources/assets/create/shader/contraption.frag index c493e4c4e..d2ebc1d33 100644 --- a/src/main/resources/assets/create/shader/contraption.frag +++ b/src/main/resources/assets/create/shader/contraption.frag @@ -19,5 +19,5 @@ vec4 light() { void main() { vec4 tex = texture2D(BlockAtlas, TexCoords); - fragColor = vec4(tex.rgb * light().rgb * Diffuse, tex.a) * Color; + fragColor = vec4(tex.rgb * light().rgb * Diffuse * Color.rgb, tex.a); } \ No newline at end of file