Preset matrices, add modelview uniforms, add extra logging when creating geometry buffer
This commit is contained in:
@@ -28,8 +28,8 @@ public abstract class Viewport <A extends Viewport<A>> {
|
|||||||
public int height;
|
public int height;
|
||||||
public int frameId;
|
public int frameId;
|
||||||
public Matrix4f vanillaProjection = new Matrix4f();
|
public Matrix4f vanillaProjection = new Matrix4f();
|
||||||
public Matrix4f projection;
|
public Matrix4f projection = new Matrix4f();
|
||||||
public Matrix4f modelView;
|
public Matrix4f modelView = new Matrix4f();
|
||||||
public final FrustumIntersection frustum = new FrustumIntersection();
|
public final FrustumIntersection frustum = new FrustumIntersection();
|
||||||
public final Vector4f[] frustumPlanes;
|
public final Vector4f[] frustumPlanes;
|
||||||
public double cameraX;
|
public double cameraX;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package me.cortex.voxy.client.core.rendering.section.geometry;
|
package me.cortex.voxy.client.core.rendering.section.geometry;
|
||||||
|
|
||||||
import me.cortex.voxy.client.core.gl.GlBuffer;
|
import me.cortex.voxy.client.core.gl.GlBuffer;
|
||||||
|
import me.cortex.voxy.common.Logger;
|
||||||
|
|
||||||
public class BasicSectionGeometryData implements IGeometryData {
|
public class BasicSectionGeometryData implements IGeometryData {
|
||||||
public static final int SECTION_METADATA_SIZE = 32;
|
public static final int SECTION_METADATA_SIZE = 32;
|
||||||
@@ -17,7 +18,12 @@ public class BasicSectionGeometryData implements IGeometryData {
|
|||||||
if ((geometryCapacity%8)!=0) {
|
if ((geometryCapacity%8)!=0) {
|
||||||
throw new IllegalStateException();
|
throw new IllegalStateException();
|
||||||
}
|
}
|
||||||
|
long start = System.currentTimeMillis();
|
||||||
|
Logger.info("Creating and zeroing " + (geometryCapacity/(1024*1024)) + "MB geometry buffer");
|
||||||
|
Logger.info("if your game crashes/exits here without any other log message, try manually decreasing the geometry capacity");
|
||||||
this.geometryBuffer = new GlBuffer(geometryCapacity);
|
this.geometryBuffer = new GlBuffer(geometryCapacity);
|
||||||
|
long delta = System.currentTimeMillis() - start;
|
||||||
|
Logger.info("Successfully allocated and zeroed the geometry buffer in " + delta + "ms");
|
||||||
}
|
}
|
||||||
|
|
||||||
public GlBuffer getGeometryBuffer() {
|
public GlBuffer getGeometryBuffer() {
|
||||||
|
|||||||
@@ -22,6 +22,15 @@ public class VoxyUniforms {
|
|||||||
return new Matrix4f(vrs.getViewport().MVP);
|
return new Matrix4f(vrs.getViewport().MVP);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Matrix4f getModelView() {//This is 1 frame late ;-; cries, since the update occurs _before_ the voxy render pipeline
|
||||||
|
var getVrs = (IGetVoxyRenderSystem) MinecraftClient.getInstance().worldRenderer;
|
||||||
|
if (getVrs == null || getVrs.getVoxyRenderSystem() == null) {
|
||||||
|
return new Matrix4f();
|
||||||
|
}
|
||||||
|
var vrs = getVrs.getVoxyRenderSystem();
|
||||||
|
return new Matrix4f(vrs.getViewport().modelView);
|
||||||
|
}
|
||||||
|
|
||||||
public static Matrix4f getProjection() {//This is 1 frame late ;-; cries, since the update occurs _before_ the voxy render pipeline
|
public static Matrix4f getProjection() {//This is 1 frame late ;-; cries, since the update occurs _before_ the voxy render pipeline
|
||||||
var getVrs = (IGetVoxyRenderSystem) MinecraftClient.getInstance().worldRenderer;
|
var getVrs = (IGetVoxyRenderSystem) MinecraftClient.getInstance().worldRenderer;
|
||||||
if (getVrs == null || getVrs.getVoxyRenderSystem() == null) {
|
if (getVrs == null || getVrs.getVoxyRenderSystem() == null) {
|
||||||
@@ -41,6 +50,9 @@ public class VoxyUniforms {
|
|||||||
.uniformMatrix(PER_FRAME, "vxViewProj", VoxyUniforms::getViewProjection)
|
.uniformMatrix(PER_FRAME, "vxViewProj", VoxyUniforms::getViewProjection)
|
||||||
.uniformMatrix(PER_FRAME, "vxViewProjInv", new Inverted(VoxyUniforms::getViewProjection))
|
.uniformMatrix(PER_FRAME, "vxViewProjInv", new Inverted(VoxyUniforms::getViewProjection))
|
||||||
.uniformMatrix(PER_FRAME, "vxViewProjPrev", new PreviousMat(VoxyUniforms::getViewProjection))
|
.uniformMatrix(PER_FRAME, "vxViewProjPrev", new PreviousMat(VoxyUniforms::getViewProjection))
|
||||||
|
.uniformMatrix(PER_FRAME, "vxModelView", VoxyUniforms::getModelView)
|
||||||
|
.uniformMatrix(PER_FRAME, "vxModelViewInv", new Inverted(VoxyUniforms::getModelView))
|
||||||
|
.uniformMatrix(PER_FRAME, "vxModelViewPrev", new PreviousMat(VoxyUniforms::getModelView))
|
||||||
.uniformMatrix(PER_FRAME, "vxProj", VoxyUniforms::getProjection)
|
.uniformMatrix(PER_FRAME, "vxProj", VoxyUniforms::getProjection)
|
||||||
.uniformMatrix(PER_FRAME, "vxProjInv", new Inverted(VoxyUniforms::getProjection))
|
.uniformMatrix(PER_FRAME, "vxProjInv", new Inverted(VoxyUniforms::getProjection))
|
||||||
.uniformMatrix(PER_FRAME, "vxProjPrev", new PreviousMat(VoxyUniforms::getProjection));
|
.uniformMatrix(PER_FRAME, "vxProjPrev", new PreviousMat(VoxyUniforms::getProjection));
|
||||||
|
|||||||
Reference in New Issue
Block a user