From c6a43557185d068ef0c0f35c60235d275dbe4960 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 28 Feb 2026 08:13:26 -0600 Subject: [PATCH] minor render cleanup --- .../bufferBuilding/LodBufferContainer.java | 4 ---- .../distanthorizons/core/util/LodUtil.java | 1 + .../render/IMcLodRenderer.java | 5 ----- .../shaders/fade/vanillaFade.fsh | 19 +++++++++++-------- .../distanthorizons/shaders/lod/frag.fsh | 16 +++------------- .../distanthorizons/shaders/lod/vert.vsh | 16 ++++++---------- 6 files changed, 21 insertions(+), 40 deletions(-) diff --git a/core/src/main/java/com/seibel/distanthorizons/core/dataObjects/render/bufferBuilding/LodBufferContainer.java b/core/src/main/java/com/seibel/distanthorizons/core/dataObjects/render/bufferBuilding/LodBufferContainer.java index 94e170e8e..0a8ecf4a9 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/dataObjects/render/bufferBuilding/LodBufferContainer.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/dataObjects/render/bufferBuilding/LodBufferContainer.java @@ -220,12 +220,8 @@ public class LodBufferContainer implements AutoCloseable ByteBuffer buffer = byteBuffers.get(i); int size = buffer.limit() - buffer.position(); - //int vertexCount = size / LodUtil.DH_VERTEX_FORMAT.getByteSize(); int vertexCount = size / lodRenderer.getVertexSize(); - // 6,1,0 - // java.nio.DirectByteBuffer[pos=0 lim=219840 cap=10485760] - // 13740 try { vbo.upload(buffer, vertexCount); diff --git a/core/src/main/java/com/seibel/distanthorizons/core/util/LodUtil.java b/core/src/main/java/com/seibel/distanthorizons/core/util/LodUtil.java index 92516bc46..e24634518 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/util/LodUtil.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/util/LodUtil.java @@ -109,6 +109,7 @@ public class LodUtil public static final int MAX_ALLOCATABLE_DIRECT_MEMORY = 64 * 1024 * 1024; /** the format of data stored in the GPU buffers */ + @Deprecated public static final LodVertexFormat DH_VERTEX_FORMAT = VertexFormats.POSITION_COLOR_BLOCK_LIGHT_SKY_LIGHT_MATERIAL_ID_NORMAL_INDEX; diff --git a/core/src/main/java/com/seibel/distanthorizons/core/wrapperInterfaces/render/IMcLodRenderer.java b/core/src/main/java/com/seibel/distanthorizons/core/wrapperInterfaces/render/IMcLodRenderer.java index 857555205..dbcadf849 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/wrapperInterfaces/render/IMcLodRenderer.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/wrapperInterfaces/render/IMcLodRenderer.java @@ -26,11 +26,6 @@ import com.seibel.distanthorizons.coreapi.interfaces.dependencyInjection.IBindab public interface IMcLodRenderer extends IBindable { - //void fillUniformData(DhApiRenderParam renderEventParam); - ///** sets the vec3 that all DH verticies should be offset by when rendering */ - //void setModelOffsetPos(DhApiVec3f modelPos); - - //void render(IVertexBufferWrapper[] bufferList, IProfilerWrapper profiler); void render( DhApiRenderParam renderEventParam, boolean opaquePass, DhApiVec3f modelPos, IVertexBufferWrapper[] bufferList, diff --git a/core/src/main/resources/assets/distanthorizons/shaders/fade/vanillaFade.fsh b/core/src/main/resources/assets/distanthorizons/shaders/fade/vanillaFade.fsh index da2064fa0..186ef51e2 100644 --- a/core/src/main/resources/assets/distanthorizons/shaders/fade/vanillaFade.fsh +++ b/core/src/main/resources/assets/distanthorizons/shaders/fade/vanillaFade.fsh @@ -4,20 +4,23 @@ in vec2 TexCoord; out vec4 fragColor; -// inverted model view matrix and projection matrix -uniform mat4 uDhInvMvmProj; -uniform mat4 uMcInvMvmProj; - uniform sampler2D uMcDepthTexture; uniform sampler2D uDhDepthTexture; uniform sampler2D uCombinedMcDhColorTexture; uniform sampler2D uDhColorTexture; -uniform float uStartFadeBlockDistance; -uniform float uEndFadeBlockDistance; -uniform float uMaxLevelHeight; +layout (std140) uniform fragUniformBlock +{ + // inverted model view matrix and projection matrix + mat4 uDhInvMvmProj; + mat4 uMcInvMvmProj; -uniform bool uOnlyRenderLods; + float uStartFadeBlockDistance; + float uEndFadeBlockDistance; + float uMaxLevelHeight; + + bool uOnlyRenderLods; +}; diff --git a/core/src/main/resources/assets/distanthorizons/shaders/lod/frag.fsh b/core/src/main/resources/assets/distanthorizons/shaders/lod/frag.fsh index 0f57d5f17..5431a2ce0 100644 --- a/core/src/main/resources/assets/distanthorizons/shaders/lod/frag.fsh +++ b/core/src/main/resources/assets/distanthorizons/shaders/lod/frag.fsh @@ -7,27 +7,17 @@ in vec4 gl_FragCoord; out vec4 fragColor; -//// Fade/Clip Uniforms -//layout (std140) uniform uClipDistance { float uClipDistance; }; -// -//// Noise Uniforms -//layout (std140) uniform uNoiseEnabled { bool uNoiseEnabled; }; -//layout (std140) uniform uNoiseSteps { int uNoiseSteps; }; -//layout (std140) uniform uNoiseIntensity { float uNoiseIntensity; }; -//layout (std140) uniform uNoiseDropoff { int uNoiseDropoff; }; -//layout (std140) uniform uDitherDhRendering { bool uDitherDhRendering; }; - layout (std140) uniform fragUniformBlock { // Fade/Clip Uniforms float uClipDistance; - + // Noise Uniforms - bool uNoiseEnabled; - int uNoiseSteps; float uNoiseIntensity; + int uNoiseSteps; int uNoiseDropoff; bool uDitherDhRendering; + bool uNoiseEnabled; }; diff --git a/core/src/main/resources/assets/distanthorizons/shaders/lod/vert.vsh b/core/src/main/resources/assets/distanthorizons/shaders/lod/vert.vsh index c86733ff0..2401f9889 100644 --- a/core/src/main/resources/assets/distanthorizons/shaders/lod/vert.vsh +++ b/core/src/main/resources/assets/distanthorizons/shaders/lod/vert.vsh @@ -1,4 +1,4 @@ -#version 330 core +#version 150 in uvec4 vPosition; in vec4 vColor; @@ -8,21 +8,17 @@ out vec4 vertexColor; out vec3 vertexWorldPos; out float vertexYPos; -//layout (std140) uniform uIsWhiteWorld { bool uIsWhiteWorld; }; -//layout (std140) uniform uCombinedMatrix { mat4 uCombinedMatrix; }; -//layout (std140) uniform uModelOffset { vec3 uModelOffset; }; -//layout (std140) uniform uWorldYOffset { float uWorldYOffset; }; -//layout (std140) uniform uMircoOffset { float uMircoOffset; }; -//layout (std140) uniform uEarthRadius { float uEarthRadius; }; - layout (std140) uniform vertUniformBlock { bool uIsWhiteWorld; - mat4 uCombinedMatrix; - vec3 uModelOffset; + float uWorldYOffset; float uMircoOffset; float uEarthRadius; + + vec3 uModelOffset; + + mat4 uCombinedMatrix; }; uniform sampler2D uLightMap;