diff --git a/build.gradle b/build.gradle index a2c34d291..cdcfb500e 100644 --- a/build.gradle +++ b/build.gradle @@ -26,7 +26,7 @@ allprojects { ext { appName = "Mundus" - gdxVersion = '1.11.0' + gdxVersion = '1.12.0' visuiVersion = '1.5.0' kryoVersion = '5.2.0' junitVersion = '4.13.2' diff --git a/commons/src/main/com/mbrlabs/mundus/commons/Scene.java b/commons/src/main/com/mbrlabs/mundus/commons/Scene.java index f708eedbf..73edbddd8 100644 --- a/commons/src/main/com/mbrlabs/mundus/commons/Scene.java +++ b/commons/src/main/com/mbrlabs/mundus/commons/Scene.java @@ -16,6 +16,7 @@ package com.mbrlabs.mundus.commons; +import com.badlogic.gdx.Application; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.graphics.Camera; import com.badlogic.gdx.graphics.Color; @@ -83,6 +84,7 @@ public class Scene implements Disposable { protected FrameBuffer fboWaterReflection; protected FrameBuffer fboWaterRefraction; protected FrameBuffer fboDepthRefraction; + private boolean isMRTRefraction = false; private DepthShader depthShader; @@ -176,7 +178,7 @@ public void render(float delta) { modelCacheManager.update(delta); if (sceneGraph.isContainsWater()) { - if (!Gdx.graphics.isGL30Available()) { + if (!isMRTRefraction) { captureDepth(); } captureReflectionFBO(); @@ -320,10 +322,14 @@ protected void renderShadowMap() { protected void initFrameBuffers(int width, int height) { fboWaterReflection = new NestableFrameBuffer(Pixmap.Format.RGB888, width, height, true); - if (Gdx.graphics.isGL30Available()) { + + // Despite supporting MRT on WebGL2, the depth precision is far worse then doing a separate depth pass frustratingly. + isMRTRefraction = Gdx.graphics.isGL30Available() && Gdx.app.getType() != Application.ApplicationType.WebGL; + + if (isMRTRefraction) { NestableFrameBuffer.NestableFrameBufferBuilder frameBufferBuilder = new NestableFrameBuffer.NestableFrameBufferBuilder(width, height); frameBufferBuilder.addBasicColorTextureAttachment(Pixmap.Format.RGB888); - frameBufferBuilder.addDepthTextureAttachment(GL30.GL_DEPTH_COMPONENT24, GL30.GL_UNSIGNED_SHORT); + frameBufferBuilder.addDepthTextureAttachment(GL30.GL_DEPTH_COMPONENT24, GL30.GL_UNSIGNED_INT); fboWaterRefraction = frameBufferBuilder.build(); } else { fboWaterRefraction = new NestableFrameBuffer(Pixmap.Format.RGB888, width, height, true); @@ -440,7 +446,7 @@ private Texture getRefractionTexture() { private Texture getRefractionDepthTexture() { Texture refractionDepth; - if (Gdx.graphics.isGL30Available()) { + if (isMRTRefraction) { refractionDepth = fboWaterRefraction.getTextureAttachments().get(DEPTH_ATTACHMENT); } else { refractionDepth = fboDepthRefraction.getColorBufferTexture(); diff --git a/editor/CHANGES b/editor/CHANGES index ad48f47d9..cb95f0699 100644 --- a/editor/CHANGES +++ b/editor/CHANGES @@ -1,11 +1,12 @@ -[0.5.1] +[0.5.1] ~ - Added FPS launcher argument, always call setForegroundFPS - Fix mouse picking by not rendering inactive game objects to picker - Fix removed terrain in helper lines - Fix undo removed light component on selected game object - Fix Material culling value being reset to GL_NONE by editor +- Updated libGDX to 1.12.0 -[0.5.0] +[0.5.0] ~ 06/28/2023 - [Breaking Change] Lighting systems updated, visibly different. See PR#184 - Convert Water Shader to an Uber Shader - Water Shader Enhancements (visible depth, toggle reflection/refraction) diff --git a/editor/src/main/com/mbrlabs/mundus/editor/profiling/MundusGL30Interceptor.java b/editor/src/main/com/mbrlabs/mundus/editor/profiling/MundusGL30Interceptor.java index 7520c1b4b..2d3af8100 100644 --- a/editor/src/main/com/mbrlabs/mundus/editor/profiling/MundusGL30Interceptor.java +++ b/editor/src/main/com/mbrlabs/mundus/editor/profiling/MundusGL30Interceptor.java @@ -1224,6 +1224,13 @@ public void glDrawRangeElements (int mode, int start, int end, int count, int ty check(); } + @Override + public void glTexImage2D(int target, int level, int internalformat, int width, int height, int border, int format, int type, int offset) { + incrementCalls(); + gl30.glTexImage2D(target, level, internalformat, width, height, border, format, type, offset); + check(); + } + @Override public void glTexImage3D (int target, int level, int internalformat, int width, int height, int depth, int border, int format, int type, Buffer pixels) { @@ -1240,6 +1247,13 @@ public void glTexImage3D (int target, int level, int internalformat, int width, check(); } + @Override + public void glTexSubImage2D(int target, int level, int xoffset, int yoffset, int width, int height, int format, int type, int offset) { + incrementCalls(); + gl30.glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, offset); + check(); + } + @Override public void glTexSubImage3D (int target, int level, int xoffset, int yoffset, int zoffset, int width, int height, int depth, int format, int type, Buffer pixels) { diff --git a/gdx-runtime/CHANGES b/gdx-runtime/CHANGES index 5533e88d2..707531227 100644 --- a/gdx-runtime/CHANGES +++ b/gdx-runtime/CHANGES @@ -1,4 +1,7 @@ -[0.5.0] ~ +[0.5.1] ~ +- Updated libGDX to 1.12.0 + +[0.5.0] ~ 06/28/2023 - [Breaking Change] Terrain API modified to closer reflect Models - [Breaking Change] ShadowMapper class removed. Replaced with MundusDirectionalShadowLight - Lighting systems updated, visibly different. See PR#184