diff --git a/common/src/main/java/com/seibel/distanthorizons/common/render/nativeGl/OpenGlDhMetaRenderer.java b/common/src/main/java/com/seibel/distanthorizons/common/render/nativeGl/OpenGlDhMetaRenderer.java index cf6c25a55..8e7c26b33 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/render/nativeGl/OpenGlDhMetaRenderer.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/render/nativeGl/OpenGlDhMetaRenderer.java @@ -11,6 +11,7 @@ import com.seibel.distanthorizons.common.render.nativeGl.glObject.buffer.QuadEle import com.seibel.distanthorizons.common.render.nativeGl.glObject.texture.*; import com.seibel.distanthorizons.common.render.nativeGl.postProcessing.apply.DhApplyShader; import com.seibel.distanthorizons.common.wrappers.minecraft.MinecraftGLWrapper; +import com.seibel.distanthorizons.common.wrappers.misc.LightMapWrapper; import com.seibel.distanthorizons.core.config.Config; import com.seibel.distanthorizons.core.dataObjects.render.bufferBuilding.LodQuadBuilder; import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector; @@ -19,6 +20,7 @@ import com.seibel.distanthorizons.core.logging.DhLoggerBuilder; import com.seibel.distanthorizons.core.render.DhApiRenderProxy; import com.seibel.distanthorizons.core.render.RenderParams; import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftRenderWrapper; +import com.seibel.distanthorizons.core.wrapperInterfaces.misc.ILightMapWrapper; import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.AbstractOptifineAccessor; import com.seibel.distanthorizons.core.wrapperInterfaces.render.renderPass.IDhMetaRenderer; import com.seibel.distanthorizons.coreapi.DependencyInjection.ApiEventInjector; @@ -104,7 +106,7 @@ public class OpenGlDhMetaRenderer implements IDhMetaRenderer this.setGLState(renderParams, firstPass); DhTerrainShaderProgram.INSTANCE.quadIBO.bind(); - renderParams.lightmap.bind(); + this.bindLightmap(renderParams.lightmap); } private void setGLState( DhApiRenderParam renderEventParam, @@ -358,7 +360,7 @@ public class OpenGlDhMetaRenderer implements IDhMetaRenderer } - renderParams.lightmap.unbind(); + this.unbindLightmap(); DhTerrainShaderProgram.INSTANCE.quadIBO.unbind(); this.shaderProgramForThisFrame.unbind(); } @@ -447,5 +449,25 @@ public class OpenGlDhMetaRenderer implements IDhMetaRenderer //endregion + //================// + // helper methods // + //================// + //region + + public void bindLightmap(ILightMapWrapper lightMapWrapper) + { + LightMapWrapper lightMap = (LightMapWrapper)lightMapWrapper; + GLMC.glActiveTexture(GL32.GL_TEXTURE0 + LightMapWrapper.GL_BOUND_INDEX); + GLMC.glBindTexture(lightMap.getOpenGlId()); + } + + public void unbindLightmap() + { + // strange that we don't call "glActiveTexture" here but since it's working James isn't going to change it right now (2026-03-10) + GLMC.glBindTexture(0); + } + + //endregion + } diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/misc/LightMapWrapper.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/misc/LightMapWrapper.java index 286fbe03b..5bee728d6 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/misc/LightMapWrapper.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/misc/LightMapWrapper.java @@ -126,15 +126,7 @@ public class LightMapWrapper implements ILightMapWrapper public BlazeTextureViewWrapper getTextureViewWrapper() { return this.lightmapTextureWrapper; } - @Override - public void bind() - { - GLMC.glActiveTexture(GL32.GL_TEXTURE0 + LightMapWrapper.GL_BOUND_INDEX); - GLMC.glBindTexture(this.textureId); - } - - @Override - public void unbind() { GLMC.glBindTexture(0); } + public int getOpenGlId() { return this.textureId; } //endregion diff --git a/coreSubProjects b/coreSubProjects index 4e908b5b1..e426fc238 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 4e908b5b156e338f18589d20574ddc654d1bea97 +Subproject commit e426fc238022d8f4c584e6ff6d505a62564ebcab