Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade libGDX to 1.12.0 #204

Merged
merged 2 commits into from
Jul 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
14 changes: 10 additions & 4 deletions commons/src/main/com/mbrlabs/mundus/commons/Scene.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -176,7 +178,7 @@ public void render(float delta) {
modelCacheManager.update(delta);

if (sceneGraph.isContainsWater()) {
if (!Gdx.graphics.isGL30Available()) {
if (!isMRTRefraction) {
captureDepth();
}
captureReflectionFBO();
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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();
Expand Down
5 changes: 3 additions & 2 deletions editor/CHANGES
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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) {
Expand Down
5 changes: 4 additions & 1 deletion gdx-runtime/CHANGES
Original file line number Diff line number Diff line change
@@ -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
Expand Down