mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-28 16:06:48 +01:00
Debug text
This commit is contained in:
parent
59dd21b85a
commit
d7ed765dde
3 changed files with 47 additions and 11 deletions
|
@ -74,7 +74,7 @@ public class Backend {
|
|||
});
|
||||
|
||||
private static Matrix4f projectionMatrix = new Matrix4f();
|
||||
private static boolean instancingAvailable;
|
||||
private static boolean instancedArrays;
|
||||
private static boolean enabled;
|
||||
|
||||
static final Map<ResourceLocation, MaterialSpec<?>> materialRegistry = new HashMap<>();
|
||||
|
@ -108,6 +108,18 @@ public class Backend {
|
|||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
public static String getBackendDescriptor() {
|
||||
if (canUseInstancing()) {
|
||||
return "GL33 Instanced Arrays";
|
||||
}
|
||||
|
||||
if (canUseVBOs()) {
|
||||
return "VBOs";
|
||||
}
|
||||
|
||||
return "Disabled";
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a shader program.
|
||||
*/
|
||||
|
@ -156,7 +168,7 @@ public class Backend {
|
|||
}
|
||||
|
||||
public static boolean canUseInstancing() {
|
||||
return enabled && instancingAvailable;
|
||||
return enabled && instancedArrays;
|
||||
}
|
||||
|
||||
public static boolean canUseVBOs() {
|
||||
|
@ -189,7 +201,7 @@ public class Backend {
|
|||
|
||||
compat = new GlCompat(capabilities);
|
||||
|
||||
instancingAvailable = compat.vertexArrayObjectsSupported() &&
|
||||
instancedArrays = compat.vertexArrayObjectsSupported() &&
|
||||
compat.drawInstancedSupported() &&
|
||||
compat.instancedArraysSupported();
|
||||
|
||||
|
|
|
@ -47,14 +47,6 @@ public class BufferedModel {
|
|||
return vertexCount;
|
||||
}
|
||||
|
||||
public void bindBuffer() {
|
||||
vbo.bind();
|
||||
}
|
||||
|
||||
public void unbindBuffer() {
|
||||
vbo.unbind();
|
||||
}
|
||||
|
||||
public boolean valid() {
|
||||
return vertexCount > 0 && !deleted;
|
||||
}
|
||||
|
|
32
src/main/java/com/jozufozu/flywheel/event/ForgeEvents.java
Normal file
32
src/main/java/com/jozufozu/flywheel/event/ForgeEvents.java
Normal file
|
@ -0,0 +1,32 @@
|
|||
package com.jozufozu.flywheel.event;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.jozufozu.flywheel.backend.Backend;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
|
||||
@Mod.EventBusSubscriber
|
||||
public class ForgeEvents {
|
||||
|
||||
@SubscribeEvent
|
||||
public static void addToDebugScreen(RenderGameOverlayEvent.Text event) {
|
||||
|
||||
if (Minecraft.getInstance().gameSettings.showDebugInfo) {
|
||||
|
||||
ArrayList<String> right = event.getRight();
|
||||
|
||||
String text = "Flywheel: " + Backend.getBackendDescriptor();
|
||||
if (right.size() < 10) {
|
||||
right.add("");
|
||||
right.add(text);
|
||||
} else {
|
||||
right.add(9, "");
|
||||
right.add(10, text);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue