update debug wireframe renderer
This commit is contained in:
+19
-26
@@ -38,13 +38,12 @@ import com.seibel.distanthorizons.common.render.blaze.util.DhBlazeVertexFormatUt
|
||||
import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
|
||||
import com.seibel.distanthorizons.core.logging.DhLogger;
|
||||
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
||||
import com.seibel.distanthorizons.core.render.renderer.DebugRenderer;
|
||||
import com.seibel.distanthorizons.core.render.renderer.RenderParams;
|
||||
import com.seibel.distanthorizons.core.render.RenderParams;
|
||||
import com.seibel.distanthorizons.core.render.renderer.AbstractDebugWireframeRenderer;
|
||||
import com.seibel.distanthorizons.core.util.math.Mat4f;
|
||||
import com.seibel.distanthorizons.core.util.math.Vec3d;
|
||||
import com.seibel.distanthorizons.core.util.math.Vec3f;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftRenderWrapper;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.render.IMcDebugRenderer;
|
||||
import net.minecraft.resources.Identifier;
|
||||
import org.lwjgl.system.MemoryUtil;
|
||||
|
||||
@@ -55,17 +54,15 @@ import java.util.OptionalDouble;
|
||||
import java.util.OptionalInt;
|
||||
|
||||
/**
|
||||
* TODO
|
||||
* Handles rendering the wireframe particles
|
||||
* that are used for seeing what the system's doing.
|
||||
*/
|
||||
public class BlazeDebugWireframeRenderer implements IMcDebugRenderer
|
||||
public class BlazeDebugWireframeRenderer extends AbstractDebugWireframeRenderer
|
||||
{
|
||||
private static final DhLogger LOGGER = new DhLoggerBuilder().build();
|
||||
|
||||
private static final IMinecraftRenderWrapper MC_RENDER = SingletonInjector.INSTANCE.get(IMinecraftRenderWrapper.class);
|
||||
|
||||
private static final GpuDevice GPU_DEVICE = RenderSystem.getDevice();
|
||||
private static final CommandEncoder COMMAND_ENCODER = GPU_DEVICE.createCommandEncoder();
|
||||
|
||||
public static BlazeDebugWireframeRenderer INSTANCE = new BlazeDebugWireframeRenderer();
|
||||
|
||||
|
||||
@@ -140,6 +137,10 @@ public class BlazeDebugWireframeRenderer implements IMcDebugRenderer
|
||||
}
|
||||
private void createPipelines()
|
||||
{
|
||||
VertexFormat vertexFormat = VertexFormat.builder()
|
||||
.add("vPosition", DhBlazeVertexFormatUtil.FLOAT_XYZ_POS)
|
||||
.build();
|
||||
|
||||
RenderPipeline.Builder pipelineBuilder = RenderPipeline.builder();
|
||||
{
|
||||
pipelineBuilder.withCull(false);
|
||||
@@ -155,13 +156,17 @@ public class BlazeDebugWireframeRenderer implements IMcDebugRenderer
|
||||
|
||||
pipelineBuilder.withUniform("uniformBlock", UniformType.UNIFORM_BUFFER);
|
||||
|
||||
pipelineBuilder.withVertexFormat(BlazePostProcessUtil.createVertexFormat(), VertexFormat.Mode.DEBUG_LINES);
|
||||
pipelineBuilder.withVertexFormat(vertexFormat, VertexFormat.Mode.DEBUG_LINES);
|
||||
}
|
||||
this.pipeline = pipelineBuilder.build();
|
||||
|
||||
}
|
||||
private void createBuffers()
|
||||
{
|
||||
GpuDevice GPU_DEVICE = RenderSystem.getDevice();
|
||||
CommandEncoder COMMAND_ENCODER = GPU_DEVICE.createCommandEncoder();
|
||||
|
||||
|
||||
// box vertices
|
||||
ByteBuffer boxVerticesBuffer = MemoryUtil.memAlloc(BOX_VERTICES.length * Float.BYTES);
|
||||
boxVerticesBuffer.asFloatBuffer().put(BOX_VERTICES);
|
||||
@@ -217,23 +222,8 @@ public class BlazeDebugWireframeRenderer implements IMcDebugRenderer
|
||||
//===========//
|
||||
//region
|
||||
|
||||
private Mat4f combinedMatrixThisFrame = new Mat4f();
|
||||
|
||||
@Override
|
||||
public void render(RenderParams renderParams, Collection<DebugRenderer.BoxParticle> boxCollection)
|
||||
{
|
||||
|
||||
this.combinedMatrixThisFrame = new Mat4f(renderParams.dhProjectionMatrix);
|
||||
this.combinedMatrixThisFrame.multiply(renderParams.dhModelViewMatrix);
|
||||
|
||||
for (DebugRenderer.BoxParticle box : boxCollection)
|
||||
{
|
||||
this.render(box.createNewRenderBox());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(DebugRenderer.Box box)
|
||||
public void render(Box box)
|
||||
{
|
||||
this.init();
|
||||
|
||||
@@ -249,6 +239,9 @@ public class BlazeDebugWireframeRenderer implements IMcDebugRenderer
|
||||
return;
|
||||
}
|
||||
|
||||
GpuDevice GPU_DEVICE = RenderSystem.getDevice();
|
||||
CommandEncoder COMMAND_ENCODER = GPU_DEVICE.createCommandEncoder();
|
||||
|
||||
|
||||
|
||||
// uniforms
|
||||
@@ -273,7 +266,7 @@ public class BlazeDebugWireframeRenderer implements IMcDebugRenderer
|
||||
box.maxPos.y - box.minPos.y,
|
||||
box.maxPos.z - box.minPos.z));
|
||||
|
||||
Mat4f transformMatrix = this.combinedMatrixThisFrame.copy();
|
||||
Mat4f transformMatrix = this.dhMvmProjMatrixThisFrame.copy();
|
||||
transformMatrix.multiply(boxTransform);
|
||||
|
||||
|
||||
|
||||
+4
-4
@@ -51,10 +51,10 @@ import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
|
||||
import com.seibel.distanthorizons.core.logging.DhLogger;
|
||||
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
||||
import com.seibel.distanthorizons.core.logging.f3.F3Screen;
|
||||
import com.seibel.distanthorizons.core.render.renderer.RenderParams;
|
||||
import com.seibel.distanthorizons.core.render.renderer.generic.GenericRenderObjectFactory;
|
||||
import com.seibel.distanthorizons.core.render.renderer.generic.IGenericObjectVertexBufferContainer;
|
||||
import com.seibel.distanthorizons.core.render.renderer.generic.RenderableBoxGroup;
|
||||
import com.seibel.distanthorizons.core.render.RenderParams;
|
||||
import com.seibel.distanthorizons.common.render.nativeGl.generic.GenericRenderObjectFactory;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.render.IGenericObjectVertexBufferContainer;
|
||||
import com.seibel.distanthorizons.common.render.nativeGl.generic.RenderableBoxGroup;
|
||||
import com.seibel.distanthorizons.core.util.LodUtil;
|
||||
import com.seibel.distanthorizons.core.util.math.Mat4f;
|
||||
import com.seibel.distanthorizons.core.util.math.Vec3d;
|
||||
|
||||
+3
-2
@@ -26,6 +26,7 @@ import com.seibel.distanthorizons.common.render.blaze.wrappers.buffer.BlazeVerte
|
||||
import com.seibel.distanthorizons.common.wrappers.misc.LightMapWrapper;
|
||||
import com.seibel.distanthorizons.core.config.Config;
|
||||
import com.seibel.distanthorizons.core.dataObjects.render.bufferBuilding.LodBufferContainer;
|
||||
import com.seibel.distanthorizons.core.dataObjects.render.bufferBuilding.LodQuadBuilder;
|
||||
import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
|
||||
import com.seibel.distanthorizons.core.logging.DhLogger;
|
||||
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
||||
@@ -282,8 +283,8 @@ public class McLodRenderer implements IMcLodRenderer
|
||||
{
|
||||
if (this.indexBuffer == null)
|
||||
{
|
||||
ByteBuffer buffer = MemoryUtil.memAlloc(LodBufferContainer.MAX_QUADS_PER_BUFFER * GLEnums.getTypeSize(GL32.GL_UNSIGNED_INT) * 6);
|
||||
QuadElementBuffer.buildBuffer(LodBufferContainer.MAX_QUADS_PER_BUFFER, buffer, GL32.GL_UNSIGNED_INT);
|
||||
ByteBuffer buffer = MemoryUtil.memAlloc(LodQuadBuilder.getMaxBufferByteSize() * GLEnums.getTypeSize(GL32.GL_UNSIGNED_INT) * 6);
|
||||
QuadElementBuffer.buildBuffer(LodQuadBuilder.getMaxBufferByteSize(), buffer, GL32.GL_UNSIGNED_INT);
|
||||
|
||||
|
||||
// create buffer if needed
|
||||
|
||||
+1
-1
@@ -40,7 +40,7 @@ import com.seibel.distanthorizons.common.render.blaze.wrappers.texture.BlazeText
|
||||
import com.seibel.distanthorizons.common.render.blaze.wrappers.texture.BlazeTextureWrapper;
|
||||
import com.seibel.distanthorizons.core.logging.DhLogger;
|
||||
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
||||
import com.seibel.distanthorizons.core.render.renderer.RenderParams;
|
||||
import com.seibel.distanthorizons.core.render.RenderParams;
|
||||
import com.seibel.distanthorizons.core.util.RenderUtil;
|
||||
import com.seibel.distanthorizons.core.util.math.Mat4f;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.render.IMcFarFadeRenderer;
|
||||
|
||||
+17
-106
@@ -25,46 +25,30 @@ import com.seibel.distanthorizons.common.render.nativeGl.glObject.shader.ShaderP
|
||||
import com.seibel.distanthorizons.common.render.nativeGl.glObject.vertexAttribute.AbstractVertexAttribute;
|
||||
import com.seibel.distanthorizons.common.render.nativeGl.glObject.vertexAttribute.VertexPointer;
|
||||
import com.seibel.distanthorizons.common.wrappers.minecraft.MinecraftGLWrapper;
|
||||
import com.seibel.distanthorizons.core.config.Config;
|
||||
import com.seibel.distanthorizons.core.config.types.ConfigEntry;
|
||||
import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
|
||||
import com.seibel.distanthorizons.core.logging.DhLogger;
|
||||
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
||||
import com.seibel.distanthorizons.core.pos.DhSectionPos;
|
||||
import com.seibel.distanthorizons.core.render.renderer.IDebugRenderable;
|
||||
import com.seibel.distanthorizons.core.render.RenderParams;
|
||||
import com.seibel.distanthorizons.core.render.renderer.AbstractDebugWireframeRenderer;
|
||||
import com.seibel.distanthorizons.core.util.math.Mat4f;
|
||||
import com.seibel.distanthorizons.core.util.math.Vec3d;
|
||||
import com.seibel.distanthorizons.core.util.math.Vec3f;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftRenderWrapper;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.render.IMcDebugRenderer;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.lwjgl.opengl.GL32;
|
||||
|
||||
import java.awt.*;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.concurrent.PriorityBlockingQueue;
|
||||
|
||||
/**
|
||||
* Handles rendering the wireframe particles
|
||||
* that are used for seeing what the system's doing.
|
||||
*/
|
||||
public class DebugRenderer
|
||||
public class DebugRenderer extends AbstractDebugWireframeRenderer
|
||||
{
|
||||
public static DebugRenderer INSTANCE = new DebugRenderer();
|
||||
|
||||
public static final DhLogger LOGGER = new DhLoggerBuilder().build();
|
||||
public static final DhLogger RATE_LIMITED_LOGGER = new DhLoggerBuilder()
|
||||
.maxCountPerSecond(1)
|
||||
.build();
|
||||
|
||||
private static final IMinecraftRenderWrapper MC_RENDER = SingletonInjector.INSTANCE.get(IMinecraftRenderWrapper.class);
|
||||
private static final MinecraftGLWrapper GLMC = MinecraftGLWrapper.INSTANCE;
|
||||
|
||||
|
||||
@@ -75,15 +59,6 @@ public class DebugRenderer
|
||||
private AbstractVertexAttribute va;
|
||||
private boolean init = false;
|
||||
|
||||
// used when rendering
|
||||
private Mat4f dhMvmProjMatrixThisFrame;
|
||||
private Vec3f camPosFloatThisFrame;
|
||||
|
||||
|
||||
private final IMcDebugRenderer.RendererLists rendererLists = new IMcDebugRenderer.RendererLists();
|
||||
private final PriorityBlockingQueue<IMcDebugRenderer.BoxParticle> particles = new PriorityBlockingQueue<>();
|
||||
|
||||
|
||||
|
||||
|
||||
/** A box from 0,0,0 to 1,1,1 */
|
||||
@@ -173,19 +148,14 @@ public class DebugRenderer
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//===========//
|
||||
// rendering //
|
||||
//===========//
|
||||
//region
|
||||
|
||||
public void render(RenderParams renderEventParam)
|
||||
@Override
|
||||
public void renderPass(RenderParams renderParams)
|
||||
{
|
||||
//this.dhMvmProjMatrixThisFrame = dhMvmProjMatrix; // TODO
|
||||
Vec3d camPos = MC_RENDER.getCameraExactPosition();
|
||||
this.camPosFloatThisFrame = new Vec3f((float) camPos.x, (float) camPos.y, (float) camPos.z);
|
||||
|
||||
this.init();
|
||||
|
||||
GL32.glPolygonMode(GL32.GL_FRONT_AND_BACK, GL32.GL_LINE);
|
||||
@@ -194,86 +164,27 @@ public class DebugRenderer
|
||||
this.basicShader.bind();
|
||||
this.va.bind();
|
||||
|
||||
|
||||
this.outlineIndexBuffer.bind();
|
||||
//this.rendererLists.render(this); // TODO
|
||||
|
||||
|
||||
// particle rendering
|
||||
IMcDebugRenderer.BoxParticle head = null;
|
||||
while ((head = this.particles.poll()) != null && head.isDead())
|
||||
{ /* remove dead particles */ }
|
||||
if (head != null)
|
||||
{
|
||||
// re-add the popped off head
|
||||
this.particles.add(head);
|
||||
}
|
||||
|
||||
IMcDebugRenderer renderer = SingletonInjector.INSTANCE.get(IMcDebugRenderer.class);
|
||||
renderer.render(renderEventParam, this.particles);
|
||||
|
||||
super.renderPass(renderParams);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated // TODO this should add all the boxes to a list so we can render them as a batch instead of individual draw calls
|
||||
public void renderBox(IMcDebugRenderer.Box box)
|
||||
public void render(Box box)
|
||||
{
|
||||
IMcDebugRenderer renderer = SingletonInjector.INSTANCE.get(IMcDebugRenderer.class);
|
||||
renderer.render(box);
|
||||
Mat4f boxTransform = Mat4f.createTranslateMatrix(box.minPos.x - this.camPosFloatThisFrame.x, box.minPos.y - this.camPosFloatThisFrame.y, box.minPos.z - this.camPosFloatThisFrame.z);
|
||||
boxTransform.multiply(Mat4f.createScaleMatrix(box.maxPos.x - box.minPos.x, box.maxPos.y - box.minPos.y, box.maxPos.z - box.minPos.z));
|
||||
|
||||
Mat4f transformMatrix = this.dhMvmProjMatrixThisFrame.copy();
|
||||
transformMatrix.multiply(boxTransform);
|
||||
this.basicShader.setUniform(this.basicShader.getUniformLocation("uTransform"), transformMatrix);
|
||||
|
||||
this.basicShader.setUniform(this.basicShader.getUniformLocation("uColor"), box.color);
|
||||
|
||||
GL32.glDrawElements(GL32.GL_LINES, BOX_OUTLINE_INDICES.length, GL32.GL_UNSIGNED_INT, 0);
|
||||
}
|
||||
|
||||
//public void render(Mat4f dhMvmProjMatrix)
|
||||
//{
|
||||
// this.dhMvmProjMatrixThisFrame = dhMvmProjMatrix;
|
||||
// Vec3d camPos = MC_RENDER.getCameraExactPosition();
|
||||
// this.camPosFloatThisFrame = new Vec3f((float) camPos.x, (float) camPos.y, (float) camPos.z);
|
||||
//
|
||||
// this.init();
|
||||
//
|
||||
// GL32.glPolygonMode(GL32.GL_FRONT_AND_BACK, GL32.GL_LINE);
|
||||
// GLMC.enableDepthTest();
|
||||
//
|
||||
// this.basicShader.bind();
|
||||
// this.va.bind();
|
||||
//
|
||||
//
|
||||
// this.outlineIndexBuffer.bind();
|
||||
// this.rendererLists.render(this);
|
||||
//
|
||||
//
|
||||
// // particle rendering
|
||||
// BoxParticle head = null;
|
||||
// while ((head = this.particles.poll()) != null && head.isDead())
|
||||
// { /* remove dead particles */ }
|
||||
// if (head != null)
|
||||
// {
|
||||
// // re-add the popped off head
|
||||
// this.particles.add(head);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// // box rendering
|
||||
// GL32.glPolygonMode(GL32.GL_FRONT_AND_BACK, GL32.GL_FILL);
|
||||
// for (BoxParticle particle : this.particles)
|
||||
// {
|
||||
// // a new box is created each time since the height will be different based on the time it's lived
|
||||
// this.renderBox(particle.createNewRenderBox());
|
||||
// }
|
||||
//}
|
||||
//
|
||||
//public void renderBox(Box box)
|
||||
//{
|
||||
// Mat4f boxTransform = Mat4f.createTranslateMatrix(box.minPos.x - this.camPosFloatThisFrame.x, box.minPos.y - this.camPosFloatThisFrame.y, box.minPos.z - this.camPosFloatThisFrame.z);
|
||||
// boxTransform.multiply(Mat4f.createScaleMatrix(box.maxPos.x - box.minPos.x, box.maxPos.y - box.minPos.y, box.maxPos.z - box.minPos.z));
|
||||
//
|
||||
// Mat4f transformMatrix = this.dhMvmProjMatrixThisFrame.copy();
|
||||
// transformMatrix.multiply(boxTransform);
|
||||
// this.basicShader.setUniform(this.basicShader.getUniformLocation("uTransform"), transformMatrix);
|
||||
//
|
||||
// this.basicShader.setUniform(this.basicShader.getUniformLocation("uColor"), box.color);
|
||||
//
|
||||
// GL32.glDrawElements(GL32.GL_LINES, BOX_OUTLINE_INDICES.length, GL32.GL_UNSIGNED_INT, 0);
|
||||
//}
|
||||
|
||||
//endregion
|
||||
|
||||
|
||||
|
||||
+2
-1
@@ -32,6 +32,7 @@ import com.seibel.distanthorizons.common.render.nativeGl.postProcessing.fade.DhF
|
||||
import com.seibel.distanthorizons.common.wrappers.minecraft.MinecraftGLWrapper;
|
||||
import com.seibel.distanthorizons.core.config.Config;
|
||||
import com.seibel.distanthorizons.core.dataObjects.render.bufferBuilding.LodBufferContainer;
|
||||
import com.seibel.distanthorizons.core.dataObjects.render.bufferBuilding.LodQuadBuilder;
|
||||
import com.seibel.distanthorizons.core.dependencyInjection.ModAccessorInjector;
|
||||
import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
|
||||
import com.seibel.distanthorizons.core.logging.DhLogger;
|
||||
@@ -516,7 +517,7 @@ public class LodRenderer
|
||||
this.lodRenderProgram = new DhTerrainShaderProgram();
|
||||
|
||||
this.quadIBO = new QuadElementBuffer();
|
||||
this.quadIBO.reserve(LodBufferContainer.MAX_QUADS_PER_BUFFER);
|
||||
this.quadIBO.reserve(LodQuadBuilder.getMaxBufferByteSize());
|
||||
|
||||
|
||||
// create or get the frame buffer
|
||||
|
||||
+6
-4
@@ -19,6 +19,7 @@
|
||||
|
||||
package com.seibel.distanthorizons.common.wrappers;
|
||||
|
||||
import com.seibel.distanthorizons.api.interfaces.render.IDhApiCustomRenderObjectFactory;
|
||||
import com.seibel.distanthorizons.common.render.blaze.BlazeDebugWireframeRenderer;
|
||||
import com.seibel.distanthorizons.common.render.blaze.McLodRenderer;
|
||||
import com.seibel.distanthorizons.common.render.blaze.postProcessing.BlazeDhFarFadeRenderer;
|
||||
@@ -26,12 +27,13 @@ import com.seibel.distanthorizons.common.render.blaze.postProcessing.BlazeDhFogR
|
||||
import com.seibel.distanthorizons.common.render.blaze.postProcessing.BlazeDhSsaoRenderer;
|
||||
import com.seibel.distanthorizons.common.render.blaze.postProcessing.BlazeVanillaFadeRenderer;
|
||||
import com.seibel.distanthorizons.common.render.blaze.test.BlazeDhTestRenderer;
|
||||
import com.seibel.distanthorizons.common.render.nativeGl.generic.GenericRenderObjectFactory;
|
||||
import com.seibel.distanthorizons.common.wrappers.gui.ClassicConfigGUI;
|
||||
import com.seibel.distanthorizons.common.wrappers.gui.LangWrapper;
|
||||
import com.seibel.distanthorizons.common.wrappers.level.KeyedClientLevelManager;
|
||||
import com.seibel.distanthorizons.common.wrappers.minecraft.MinecraftGLWrapper;
|
||||
import com.seibel.distanthorizons.common.wrappers.minecraft.MinecraftServerWrapper;
|
||||
import com.seibel.distanthorizons.core.level.IKeyedClientLevelManager;
|
||||
import com.seibel.distanthorizons.core.render.renderer.AbstractDebugWireframeRenderer;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.config.IConfigGui;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.config.ILangWrapper;
|
||||
import com.seibel.distanthorizons.common.wrappers.minecraft.MinecraftClientWrapper;
|
||||
@@ -40,7 +42,6 @@ import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.IVersionConstants;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.IWrapperFactory;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftClientWrapper;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftGLWrapper;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftRenderWrapper;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftSharedWrapper;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.render.*;
|
||||
@@ -64,6 +65,7 @@ public class DependencySetup
|
||||
SingletonInjector.INSTANCE.bind(IVersionConstants.class, VersionConstants.INSTANCE);
|
||||
SingletonInjector.INSTANCE.bind(IWrapperFactory.class, WrapperFactory.INSTANCE);
|
||||
SingletonInjector.INSTANCE.bind(IKeyedClientLevelManager.class, KeyedClientLevelManager.INSTANCE);
|
||||
SingletonInjector.INSTANCE.bind(IDhApiCustomRenderObjectFactory.class, GenericRenderObjectFactory.INSTANCE);
|
||||
}
|
||||
|
||||
public static void createServerBindings()
|
||||
@@ -74,8 +76,9 @@ public class DependencySetup
|
||||
SingletonInjector.INSTANCE.bind(IMinecraftClientWrapper.class, MinecraftClientWrapper.INSTANCE);
|
||||
SingletonInjector.INSTANCE.bind(IMinecraftSharedWrapper.class, MinecraftClientWrapper.INSTANCE);
|
||||
SingletonInjector.INSTANCE.bind(IMinecraftRenderWrapper.class, MinecraftRenderWrapper.INSTANCE);
|
||||
SingletonInjector.INSTANCE.bind(IMinecraftGLWrapper.class, MinecraftGLWrapper.INSTANCE);
|
||||
SingletonInjector.INSTANCE.bind(IConfigGui.class, ClassicConfigGUI.CONFIG_CORE_INTERFACE);
|
||||
|
||||
SingletonInjector.INSTANCE.bind(AbstractDebugWireframeRenderer.class, BlazeDebugWireframeRenderer.INSTANCE);
|
||||
}
|
||||
|
||||
public static void createRenderBindings()
|
||||
@@ -86,7 +89,6 @@ public class DependencySetup
|
||||
SingletonInjector.INSTANCE.bind(IMcSsaoRenderer.class, BlazeDhSsaoRenderer.INSTANCE);
|
||||
SingletonInjector.INSTANCE.bind(IMcFogRenderer.class, BlazeDhFogRenderer.INSTANCE);
|
||||
SingletonInjector.INSTANCE.bind(IMcFarFadeRenderer.class, BlazeDhFarFadeRenderer.INSTANCE);
|
||||
SingletonInjector.INSTANCE.bind(IMcDebugRenderer.class, BlazeDebugWireframeRenderer.INSTANCE);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ import com.seibel.distanthorizons.common.wrappers.world.ServerLevelWrapper;
|
||||
import com.seibel.distanthorizons.common.wrappers.worldGeneration.BatchGenerationEnvironment;
|
||||
import com.seibel.distanthorizons.core.level.IDhLevel;
|
||||
import com.seibel.distanthorizons.core.level.IDhServerLevel;
|
||||
import com.seibel.distanthorizons.core.render.renderer.generic.IGenericObjectVertexBufferContainer;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.render.IGenericObjectVertexBufferContainer;
|
||||
import com.seibel.distanthorizons.core.util.LodUtil;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.IWrapperFactory;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.block.IBlockStateWrapper;
|
||||
|
||||
+2
-26
@@ -27,10 +27,8 @@ import com.mojang.blaze3d.opengl.GlStateManager;
|
||||
|
||||
import com.seibel.distanthorizons.core.jar.EPlatform;
|
||||
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftGLWrapper;
|
||||
|
||||
import com.seibel.distanthorizons.core.logging.DhLogger;
|
||||
import org.lwjgl.opengl.GL15;
|
||||
import org.lwjgl.opengl.GL32;
|
||||
|
||||
|
||||
@@ -52,7 +50,7 @@ import org.lwjgl.opengl.GL32;
|
||||
* This may slow down some low end GPUs that are driver limited,
|
||||
* however James would rather have slow correct rendering vs fast broken rendering.
|
||||
*/
|
||||
public class MinecraftGLWrapper implements IMinecraftGLWrapper
|
||||
public class MinecraftGLWrapper
|
||||
{
|
||||
public static final MinecraftGLWrapper INSTANCE = new MinecraftGLWrapper();
|
||||
|
||||
@@ -68,14 +66,12 @@ public class MinecraftGLWrapper implements IMinecraftGLWrapper
|
||||
// scissor //
|
||||
|
||||
/** @see GL32#GL_SCISSOR_TEST */
|
||||
@Override
|
||||
public void enableScissorTest()
|
||||
{
|
||||
GL32.glEnable(GL32.GL_SCISSOR_TEST);
|
||||
GlStateManager._enableScissorTest();
|
||||
}
|
||||
/** @see GL32#GL_SCISSOR_TEST */
|
||||
@Override
|
||||
public void disableScissorTest()
|
||||
{
|
||||
GL32.glDisable(GL32.GL_SCISSOR_TEST);
|
||||
@@ -94,14 +90,12 @@ public class MinecraftGLWrapper implements IMinecraftGLWrapper
|
||||
// depth //
|
||||
|
||||
/** @see GL32#GL_DEPTH_TEST */
|
||||
@Override
|
||||
public void enableDepthTest()
|
||||
{
|
||||
GL32.glEnable(GL32.GL_DEPTH_TEST);
|
||||
GlStateManager._enableDepthTest();
|
||||
}
|
||||
/** @see GL32#GL_DEPTH_TEST */
|
||||
@Override
|
||||
public void disableDepthTest()
|
||||
{
|
||||
GL32.glDisable(GL32.GL_DEPTH_TEST);
|
||||
@@ -109,7 +103,6 @@ public class MinecraftGLWrapper implements IMinecraftGLWrapper
|
||||
}
|
||||
|
||||
/** @see GL32#glDepthFunc(int) */
|
||||
@Override
|
||||
public void glDepthFunc(int func)
|
||||
{
|
||||
GL32.glDepthFunc(func);
|
||||
@@ -117,14 +110,12 @@ public class MinecraftGLWrapper implements IMinecraftGLWrapper
|
||||
}
|
||||
|
||||
/** @see GL32#glDepthMask(boolean) */
|
||||
@Override
|
||||
public void enableDepthMask()
|
||||
{
|
||||
GL32.glDepthMask(true);
|
||||
GlStateManager._depthMask(true);
|
||||
}
|
||||
/** @see GL32#glDepthMask(boolean) */
|
||||
@Override
|
||||
public void disableDepthMask()
|
||||
{
|
||||
GL32.glDepthMask(false);
|
||||
@@ -135,14 +126,12 @@ public class MinecraftGLWrapper implements IMinecraftGLWrapper
|
||||
// blending //
|
||||
|
||||
/** @see GL32#GL_BLEND */
|
||||
@Override
|
||||
public void enableBlend()
|
||||
{
|
||||
GL32.glEnable(GL32.GL_BLEND);
|
||||
GlStateManager._enableBlend();
|
||||
}
|
||||
/** @see GL32#GL_BLEND */
|
||||
@Override
|
||||
public void disableBlend()
|
||||
{
|
||||
GL32.glDisable(GL32.GL_BLEND);
|
||||
@@ -150,7 +139,6 @@ public class MinecraftGLWrapper implements IMinecraftGLWrapper
|
||||
}
|
||||
|
||||
/** @see GL32#glBlendFunc */
|
||||
@Override
|
||||
public void glBlendFunc(int sfactor, int dfactor)
|
||||
{
|
||||
GL32.glBlendFunc(sfactor, dfactor);
|
||||
@@ -160,7 +148,6 @@ public class MinecraftGLWrapper implements IMinecraftGLWrapper
|
||||
#endif
|
||||
}
|
||||
/** @see GL32#glBlendFuncSeparate */
|
||||
@Override
|
||||
public void glBlendFuncSeparate(int sfactorRGB, int dfactorRGB, int sfactorAlpha, int dfactorAlpha)
|
||||
{
|
||||
GL32.glBlendFuncSeparate(sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha);
|
||||
@@ -171,7 +158,6 @@ public class MinecraftGLWrapper implements IMinecraftGLWrapper
|
||||
// frame buffers //
|
||||
|
||||
/** @see GL32#glBindFramebuffer */
|
||||
@Override
|
||||
public void glBindFramebuffer(int target, int framebuffer)
|
||||
{
|
||||
GL32.glBindFramebuffer(target, framebuffer);
|
||||
@@ -182,12 +168,10 @@ public class MinecraftGLWrapper implements IMinecraftGLWrapper
|
||||
// buffers //
|
||||
|
||||
/** @see GL32#glGenBuffers() */
|
||||
@Override
|
||||
public int glGenBuffers()
|
||||
{ return GL32.glGenBuffers(); }
|
||||
|
||||
/** @see GL32#glDeleteBuffers(int) */
|
||||
@Override
|
||||
/** @see GL32#glDeleteBuffers(int) */
|
||||
public void glDeleteBuffers(int buffer)
|
||||
{
|
||||
GL32.glDeleteBuffers(buffer);
|
||||
@@ -218,14 +202,12 @@ public class MinecraftGLWrapper implements IMinecraftGLWrapper
|
||||
// culling //
|
||||
|
||||
/** @see GL32#GL_CULL_FACE */
|
||||
@Override
|
||||
public void enableFaceCulling()
|
||||
{
|
||||
GL32.glEnable(GL32.GL_CULL_FACE);
|
||||
GlStateManager._enableCull();
|
||||
}
|
||||
/** @see GL32#GL_CULL_FACE */
|
||||
@Override
|
||||
public void disableFaceCulling()
|
||||
{
|
||||
GL32.glDisable(GL32.GL_CULL_FACE);
|
||||
@@ -236,27 +218,22 @@ public class MinecraftGLWrapper implements IMinecraftGLWrapper
|
||||
// textures //
|
||||
|
||||
/** @see GL32#glGenTextures() */
|
||||
@Override
|
||||
public int glGenTextures() { return GlStateManager._genTexture(); }
|
||||
/** @see GL32#glDeleteTextures(int) */
|
||||
@Override
|
||||
public void glDeleteTextures(int texture) { GlStateManager._deleteTexture(texture); }
|
||||
|
||||
/** @see GL32#glActiveTexture(int) */
|
||||
@Override
|
||||
public void glActiveTexture(int textureId)
|
||||
{
|
||||
GL32.glActiveTexture(textureId);
|
||||
GlStateManager._activeTexture(textureId);
|
||||
}
|
||||
@Override
|
||||
public int getActiveTexture() { return GL32.glGetInteger(GL32.GL_TEXTURE_BINDING_2D); }
|
||||
|
||||
/**
|
||||
* Always binds to {@link GL32#GL_TEXTURE_2D}
|
||||
* @see GL32#glBindTexture(int, int)
|
||||
*/
|
||||
@Override
|
||||
public void glBindTexture(int texture)
|
||||
{
|
||||
GL32.glBindTexture(GL32.GL_TEXTURE_2D, texture);
|
||||
@@ -265,5 +242,4 @@ public class MinecraftGLWrapper implements IMinecraftGLWrapper
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
+9
-4
@@ -22,9 +22,8 @@ package com.seibel.distanthorizons.common.wrappers.misc;
|
||||
import com.mojang.blaze3d.platform.NativeImage;
|
||||
import com.mojang.blaze3d.textures.GpuTexture;
|
||||
import com.seibel.distanthorizons.common.render.blaze.wrappers.texture.BlazeTextureViewWrapper;
|
||||
import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
|
||||
import com.seibel.distanthorizons.common.wrappers.minecraft.MinecraftGLWrapper;
|
||||
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftGLWrapper;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.misc.ILightMapWrapper;
|
||||
import com.seibel.distanthorizons.core.logging.DhLogger;
|
||||
import org.lwjgl.opengl.GL32;
|
||||
@@ -36,9 +35,15 @@ import java.nio.ByteBuffer;
|
||||
|
||||
public class LightMapWrapper implements ILightMapWrapper
|
||||
{
|
||||
private static final IMinecraftGLWrapper GLMC = SingletonInjector.INSTANCE.get(IMinecraftGLWrapper.class);
|
||||
private static final MinecraftGLWrapper GLMC = MinecraftGLWrapper.INSTANCE;
|
||||
private static final DhLogger LOGGER = new DhLoggerBuilder().build();
|
||||
|
||||
/**
|
||||
* which texture index IE 0,1,2... the lightmap will be bound to. <Br>
|
||||
* Related to but different from {@link GL32#GL_TEXTURE0}.
|
||||
*/
|
||||
public static final int GL_BOUND_INDEX = 0;
|
||||
|
||||
private int textureId = 0;
|
||||
|
||||
private GpuTexture gpuTexture = null;
|
||||
@@ -124,7 +129,7 @@ public class LightMapWrapper implements ILightMapWrapper
|
||||
@Override
|
||||
public void bind()
|
||||
{
|
||||
GLMC.glActiveTexture(GL32.GL_TEXTURE0 + ILightMapWrapper.BOUND_INDEX);
|
||||
GLMC.glActiveTexture(GL32.GL_TEXTURE0 + LightMapWrapper.GL_BOUND_INDEX);
|
||||
GLMC.glBindTexture(this.textureId);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
Submodule coreSubProjects updated: 67b2467bee...49e34d78a5
Reference in New Issue
Block a user