diff --git a/docs/src/progress/currenttarget.md b/docs/src/progress/currenttarget.md index 515d3cd3..cecbb267 100644 --- a/docs/src/progress/currenttarget.md +++ b/docs/src/progress/currenttarget.md @@ -39,6 +39,7 @@ + bug fixes Fix light cluster mapping for foliage shader Fix ui elements not storing default discrete world size on level editor menu + Fix static friction coeff causing player to slide on shallow slopes Fix skeleton right strafe Fix block tree preventing initiating an attack Fix return to title menu synchronization bug diff --git a/docs/src/progress/renderertodo.md b/docs/src/progress/renderertodo.md index 86fe8f73..d12de903 100644 --- a/docs/src/progress/renderertodo.md +++ b/docs/src/progress/renderertodo.md @@ -805,6 +805,8 @@ Work on clustered lighting (09/19/2024) Cluster lighting completed +ClientPointLightComponent +Small rendering info display # TODO diff --git a/src/main/java/electrosphere/client/ui/menu/debug/ImGuiRenderer.java b/src/main/java/electrosphere/client/ui/menu/debug/ImGuiRenderer.java index fb42380a..393a01a8 100644 --- a/src/main/java/electrosphere/client/ui/menu/debug/ImGuiRenderer.java +++ b/src/main/java/electrosphere/client/ui/menu/debug/ImGuiRenderer.java @@ -31,17 +31,25 @@ public class ImGuiRenderer { rendererWindow.setCallback(new ImGuiWindowCallback() { @Override public void exec() { - if(ImGui.collapsingHeader("Shadow Map Pipeline")){ - ShadowMapPipeline shadowMapPipeline = Globals.renderingEngine.getShadowMapPipeline(); - if(ImGui.sliderFloat("Far Plane Distance", farPlaneArr, 1, 100)){ - shadowMapPipeline.setFarPlane(farPlaneArr[0]); + if(ImGui.collapsingHeader("Pipelines")){ + ImGui.indent(); + if(ImGui.collapsingHeader("Shadow Map Pipeline")){ + ShadowMapPipeline shadowMapPipeline = Globals.renderingEngine.getShadowMapPipeline(); + if(ImGui.sliderFloat("Far Plane Distance", farPlaneArr, 1, 100)){ + shadowMapPipeline.setFarPlane(farPlaneArr[0]); + } } + if(ImGui.collapsingHeader("Post Processing Pipeline")){ + PostProcessingPipeline postProcessingPipeline = Globals.renderingEngine.getPostProcessingPipeline(); + if(ImGui.button("Toggle Blur")){ + postProcessingPipeline.setApplyBlur(!postProcessingPipeline.isApplyingBlur()); + } + } + ImGui.unindent(); } - if(ImGui.collapsingHeader("Post Processing Pipeline")){ - PostProcessingPipeline postProcessingPipeline = Globals.renderingEngine.getPostProcessingPipeline(); - if(ImGui.button("Toggle Blur")){ - postProcessingPipeline.setApplyBlur(!postProcessingPipeline.isApplyingBlur()); - } + if(ImGui.collapsingHeader("OpenGL Details")){ + ImGui.text("GL_MAX_TEXTURE_IMAGE_UNITS: " + Globals.renderingEngine.getOpenGLContext().getMaxTextureImageUnits()); + ImGui.text("GL_MAX_TEXTURE_SIZE: " + Globals.renderingEngine.getOpenGLContext().getMaxTextureSize()); } } }); diff --git a/src/main/java/electrosphere/renderer/OpenGLContext.java b/src/main/java/electrosphere/renderer/OpenGLContext.java new file mode 100644 index 00000000..d79694ce --- /dev/null +++ b/src/main/java/electrosphere/renderer/OpenGLContext.java @@ -0,0 +1,52 @@ +package electrosphere.renderer; + +import java.nio.IntBuffer; + +import org.lwjgl.opengl.GL45; +import org.lwjgl.system.MemoryStack; + +/** + * Data about the opengl context (ie, card-defined limits and so on) + */ +public class OpenGLContext { + + /** + * The maximum number of textures supported + */ + int maxTextureImageUnits = 0; + + /** + * The maximum texture size + */ + int maxTextureSize = 0; + + /** + * Constructor + */ + protected OpenGLContext(){ + try(MemoryStack stack = MemoryStack.stackPush()){ + IntBuffer lookupBuf = stack.ints(1); + GL45.glGetIntegerv(GL45.GL_MAX_TEXTURE_IMAGE_UNITS, lookupBuf); + maxTextureImageUnits = lookupBuf.get(0); + GL45.glGetIntegerv(GL45.GL_MAX_TEXTURE_SIZE,lookupBuf); + maxTextureSize = lookupBuf.get(0); + } + } + + /** + * Gets GL_MAX_TEXTURE_IMAGE_UNITS + * @return GL_MAX_TEXTURE_IMAGE_UNITS + */ + public int getMaxTextureImageUnits(){ + return maxTextureImageUnits; + } + + /** + * Gets the max texture size + * @return The max texture size + */ + public int getMaxTextureSize(){ + return maxTextureSize; + } + +} diff --git a/src/main/java/electrosphere/renderer/RenderingEngine.java b/src/main/java/electrosphere/renderer/RenderingEngine.java index 5e39aab2..5e23ecdc 100644 --- a/src/main/java/electrosphere/renderer/RenderingEngine.java +++ b/src/main/java/electrosphere/renderer/RenderingEngine.java @@ -152,6 +152,11 @@ public class RenderingEngine { //the opengl state static OpenGLState openGLState = new OpenGLState(); + /** + * The opengl context the rendering engine is running within + */ + OpenGLContext openGLContext; + //render pipelines MainContentPipeline mainContentPipeline = new MainContentPipeline(); MainContentNoOITPipeline mainContentNoOITPipeline = new MainContentNoOITPipeline(); @@ -273,6 +278,7 @@ public class RenderingEngine { //get environment constraints openGLState.init(); + openGLContext = new OpenGLContext(); //init imgui pipeline imGuiPipeline = new ImGuiPipeline(Globals.window, glslVersion); @@ -657,6 +663,14 @@ public class RenderingEngine { return openGLState; } + /** + * Gets the opengl context that the rendering engine is running within + * @return The opengl context + */ + public OpenGLContext getOpenGLContext(){ + return openGLContext; + } + /** * Tries to recapture the screen */