Skip to content

Commit

Permalink
Disable cullface only for skybox
Browse files Browse the repository at this point in the history
  • Loading branch information
minecraft8997 committed Nov 22, 2023
1 parent e4b15b5 commit a681362
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
3 changes: 0 additions & 3 deletions core/src/ru/mclord/classic/McLordClassic.java
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ public Object addTask(Runnable task, boolean subscribe) {
}

@Override
@SuppressWarnings("deprecation")
public void create() {
System.out.println("Loading texture pack");
String configTexturePack = gameProperties.getProperty("texturePack");
Expand All @@ -144,8 +143,6 @@ public void create() {
networkingThread = new NetworkingThread();
networkingThread.start();

DefaultShader.defaultCullFace = 0; // make it possible to render skybox

setScreen(LoadingScreen.getInstance());
}

Expand Down
13 changes: 11 additions & 2 deletions core/src/ru/mclord/classic/Skybox.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
package ru.mclord.classic;

import com.badlogic.gdx.graphics.Camera;
import com.badlogic.gdx.graphics.g3d.Material;
import com.badlogic.gdx.graphics.g3d.Model;
import com.badlogic.gdx.graphics.g3d.ModelBatch;
import com.badlogic.gdx.graphics.g3d.ModelInstance;
import com.badlogic.gdx.graphics.g3d.attributes.IntAttribute;
import com.badlogic.gdx.math.Matrix4;
import com.badlogic.gdx.utils.Disposable;

Expand All @@ -24,14 +27,20 @@ public void initGraphics() {

TextureManager manager = TextureManager.getInstance();

modelInstance = new ModelInstance(Helper.constructBlock(size,
Model model = Helper.constructBlock(size,
manager.getSkyboxTexture(3),
manager.getSkyboxTexture(5),
manager.getSkyboxTexture(1),
manager.getSkyboxTexture(0),
manager.getSkyboxTexture(4),
manager.getSkyboxTexture(2)
));
);
IntAttribute disableCullFace = IntAttribute.createCullFace(0);
for (Material material : model.materials) {
material.set(disableCullFace);
}

modelInstance = new ModelInstance(model);
}

public boolean isReady() {
Expand Down

0 comments on commit a681362

Please sign in to comment.