Fix time keyframe lines rendering below timeline
This commit is contained in:
@@ -10,6 +10,7 @@ import de.johni0702.minecraft.gui.utils.lwjgl.vector.Vector3f;
|
|||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
import net.minecraft.client.gui.screen.Screen;
|
import net.minecraft.client.gui.screen.Screen;
|
||||||
import net.minecraft.client.render.BufferBuilder;
|
import net.minecraft.client.render.BufferBuilder;
|
||||||
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
import net.minecraft.network.NetworkState;
|
import net.minecraft.network.NetworkState;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.util.Util;
|
import net.minecraft.util.Util;
|
||||||
@@ -437,11 +438,11 @@ public class MCVer {
|
|||||||
//$$ }
|
//$$ }
|
||||||
//#endif
|
//#endif
|
||||||
|
|
||||||
public static void emitLine(BufferBuilder buffer, Vector2f p1, Vector2f p2, int color) {
|
public static void emitLine(MatrixStack matrixStack, BufferBuilder buffer, Vector2f p1, Vector2f p2, int color) {
|
||||||
emitLine(buffer, new Vector3f(p1.x, p1.y, 0), new Vector3f(p2.x, p2.y, 0), color);
|
emitLine(matrixStack, buffer, new Vector3f(p1.x, p1.y, 0), new Vector3f(p2.x, p2.y, 0), color);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void emitLine(BufferBuilder buffer, Vector3f p1, Vector3f p2, int color) {
|
public static void emitLine(MatrixStack matrixStack, BufferBuilder buffer, Vector3f p1, Vector3f p2, int color) {
|
||||||
int r = color >> 24 & 0xff;
|
int r = color >> 24 & 0xff;
|
||||||
int g = color >> 16 & 0xff;
|
int g = color >> 16 & 0xff;
|
||||||
int b = color >> 8 & 0xff;
|
int b = color >> 8 & 0xff;
|
||||||
@@ -449,14 +450,22 @@ public class MCVer {
|
|||||||
//#if MC>=11700
|
//#if MC>=11700
|
||||||
//$$ Vector3f n = Vector3f.sub(p2, p1, null);
|
//$$ Vector3f n = Vector3f.sub(p2, p1, null);
|
||||||
//#endif
|
//#endif
|
||||||
buffer.vertex(p1.x, p1.y, p1.z)
|
//#if MC>=11600
|
||||||
|
buffer.vertex(matrixStack.peek().getModel(), p1.x, p1.y, p1.z)
|
||||||
|
//#else
|
||||||
|
//$$ buffer.vertex(p1.x, p1.y, p1.z)
|
||||||
|
//#endif
|
||||||
.color(r, g, b, a)
|
.color(r, g, b, a)
|
||||||
//#if MC>=11700
|
//#if MC>=11700
|
||||||
//$$ .normal(n.x, n.y, n.z)
|
//$$ .normal(n.x, n.y, n.z)
|
||||||
//#endif
|
//#endif
|
||||||
;
|
;
|
||||||
buffer.next();
|
buffer.next();
|
||||||
buffer.vertex(p2.x, p2.y, p2.z)
|
//#if MC>=11600
|
||||||
|
buffer.vertex(matrixStack.peek().getModel(), p2.x, p2.y, p2.z)
|
||||||
|
//#else
|
||||||
|
//$$ buffer.vertex(p2.x, p2.y, p2.z)
|
||||||
|
//#endif
|
||||||
.color(r, g, b, a)
|
.color(r, g, b, a)
|
||||||
//#if MC>=11700
|
//#if MC>=11700
|
||||||
//$$ .normal(n.x, n.y, n.z)
|
//$$ .normal(n.x, n.y, n.z)
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import de.johni0702.minecraft.gui.utils.lwjgl.vector.Vector2f;
|
|||||||
import net.minecraft.client.render.BufferBuilder;
|
import net.minecraft.client.render.BufferBuilder;
|
||||||
import net.minecraft.client.render.Tessellator;
|
import net.minecraft.client.render.Tessellator;
|
||||||
import net.minecraft.client.render.VertexFormats;
|
import net.minecraft.client.render.VertexFormats;
|
||||||
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
import org.apache.commons.lang3.tuple.Pair;
|
import org.apache.commons.lang3.tuple.Pair;
|
||||||
import de.johni0702.minecraft.gui.utils.lwjgl.Point;
|
import de.johni0702.minecraft.gui.utils.lwjgl.Point;
|
||||||
import de.johni0702.minecraft.gui.utils.lwjgl.ReadableDimension;
|
import de.johni0702.minecraft.gui.utils.lwjgl.ReadableDimension;
|
||||||
@@ -169,9 +170,10 @@ public class GuiKeyframeTimeline extends AbstractGuiTimeline<GuiKeyframeTimeline
|
|||||||
// And finally another vertical bit (the timeline is already crammed enough, so only the border)
|
// And finally another vertical bit (the timeline is already crammed enough, so only the border)
|
||||||
Vector2f p4 = new Vector2f(keyframeTimelineLeft + positionXKeyframeTimeline, keyframeTimelineTop + BORDER_TOP);
|
Vector2f p4 = new Vector2f(keyframeTimelineLeft + positionXKeyframeTimeline, keyframeTimelineTop + BORDER_TOP);
|
||||||
|
|
||||||
emitLine(buffer, p1, p2, color);
|
MatrixStack matrixStack = renderer.getMatrixStack();
|
||||||
emitLine(buffer, p2, p3, color);
|
emitLine(matrixStack, buffer, p1, p2, color);
|
||||||
emitLine(buffer, p3, p4, color);
|
emitLine(matrixStack, buffer, p2, p3, color);
|
||||||
|
emitLine(matrixStack, buffer, p3, p4, color);
|
||||||
|
|
||||||
//#if MC>=11700
|
//#if MC>=11700
|
||||||
//$$ RenderSystem.setShader(GameRenderer::getRenderTypeLinesShader);
|
//$$ RenderSystem.setShader(GameRenderer::getRenderTypeLinesShader);
|
||||||
|
|||||||
@@ -254,7 +254,7 @@ public class PathPreviewRenderer extends EventRegistrations {
|
|||||||
buffer.begin(GL11.GL_LINES, VertexFormats.POSITION_COLOR);
|
buffer.begin(GL11.GL_LINES, VertexFormats.POSITION_COLOR);
|
||||||
//#endif
|
//#endif
|
||||||
|
|
||||||
emitLine(buffer, Vector3f.sub(pos1, view, null), Vector3f.sub(pos2, view, null), color);
|
emitLine(new MatrixStack(), buffer, Vector3f.sub(pos1, view, null), Vector3f.sub(pos2, view, null), color);
|
||||||
|
|
||||||
//#if MC>=11700
|
//#if MC>=11700
|
||||||
//$$ RenderSystem.setShader(GameRenderer::getRenderTypeLinesShader);
|
//$$ RenderSystem.setShader(GameRenderer::getRenderTypeLinesShader);
|
||||||
@@ -350,7 +350,7 @@ public class PathPreviewRenderer extends EventRegistrations {
|
|||||||
buffer.begin(GL11.GL_LINES, VertexFormats.POSITION_COLOR);
|
buffer.begin(GL11.GL_LINES, VertexFormats.POSITION_COLOR);
|
||||||
//#endif
|
//#endif
|
||||||
|
|
||||||
emitLine(buffer, new Vector3f(0, 0, 0), new Vector3f(0, 0, 2), 0x00ff00aa);
|
emitLine(new MatrixStack(), buffer, new Vector3f(0, 0, 0), new Vector3f(0, 0, 2), 0x00ff00aa);
|
||||||
|
|
||||||
//#if MC>=11700
|
//#if MC>=11700
|
||||||
//$$ RenderSystem.applyModelViewMatrix();
|
//$$ RenderSystem.applyModelViewMatrix();
|
||||||
|
|||||||
Reference in New Issue
Block a user