mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-28 16:06:48 +01:00
Fixed outliners' culling issue
This commit is contained in:
parent
68b656c6be
commit
8d8f96c778
8 changed files with 33 additions and 23 deletions
|
@ -35,6 +35,7 @@ public class TerrainZapperRenderHandler {
|
|||
CreateClient.outliner.showCluster("terrainZapper", shape.stream()
|
||||
.map(pos -> pos.add(renderedPosition))
|
||||
.collect(Collectors.toList()))
|
||||
.colored(0x999999)
|
||||
.disableNormals()
|
||||
.lineWidth(1 / 32f)
|
||||
.withFaceTexture(AllSpecialTextures.CHECKERED);
|
||||
|
|
|
@ -124,6 +124,13 @@ public class SchematicHandler {
|
|||
if (!active && !present)
|
||||
return;
|
||||
|
||||
if (active) {
|
||||
ms.push();
|
||||
currentTool.getTool()
|
||||
.renderTool(ms, buffer, light, overlay);
|
||||
ms.pop();
|
||||
}
|
||||
|
||||
ms.push();
|
||||
transformation.applyGLTransformations(ms);
|
||||
renderer.render(ms, buffer);
|
||||
|
@ -132,12 +139,6 @@ public class SchematicHandler {
|
|||
.renderOnSchematic(ms, buffer, light, overlay);
|
||||
ms.pop();
|
||||
|
||||
if (active) {
|
||||
ms.push();
|
||||
currentTool.getTool()
|
||||
.renderTool(ms, buffer, light, overlay);
|
||||
ms.pop();
|
||||
}
|
||||
}
|
||||
|
||||
public void renderOverlay(MatrixStack ms, IRenderTypeBuffer buffer, int light, int overlay) {
|
||||
|
|
|
@ -69,8 +69,6 @@ public class DeployTool extends PlacementToolBase {
|
|||
.translateBack(origin);
|
||||
|
||||
AABBOutline outline = schematicHandler.getOutline();
|
||||
outline.getParams()
|
||||
.withFaceTexture(AllSpecialTextures.CHECKERED);
|
||||
outline.render(ms, buffer);
|
||||
outline.getParams()
|
||||
.clearTextures();
|
||||
|
|
|
@ -49,11 +49,11 @@ public class FlipTool extends PlacementToolBase {
|
|||
|
||||
@Override
|
||||
public void renderOnSchematic(MatrixStack ms, IRenderTypeBuffer buffer, int light, int overlay) {
|
||||
super.renderOnSchematic(ms, buffer, light, overlay);
|
||||
|
||||
if (!schematicSelected || !selectedFace.getAxis()
|
||||
.isHorizontal())
|
||||
.isHorizontal()) {
|
||||
super.renderOnSchematic(ms, buffer, light, overlay);
|
||||
return;
|
||||
}
|
||||
|
||||
Direction facing = selectedFace.rotateY();
|
||||
AxisAlignedBB bounds = schematicHandler.getBounds();
|
||||
|
@ -66,15 +66,18 @@ public class FlipTool extends PlacementToolBase {
|
|||
.grow(1 - directionVec.x, 1 - directionVec.y, 1 - directionVec.z);
|
||||
bounds = bounds.offset(directionVec.scale(.5f)
|
||||
.mul(boundsSize));
|
||||
|
||||
|
||||
outline.setBounds(bounds);
|
||||
AllSpecialTextures tex = AllSpecialTextures.HIGHLIGHT_CHECKERED;
|
||||
AllSpecialTextures tex = AllSpecialTextures.CHECKERED;
|
||||
outline.getParams()
|
||||
.lineWidth(1 / 16f)
|
||||
.disableCull()
|
||||
.disableNormals()
|
||||
.colored(0x4d80e4)
|
||||
.colored(0xdddddd)
|
||||
.withFaceTextures(tex, tex);
|
||||
outline.render(ms, buffer);
|
||||
|
||||
super.renderOnSchematic(ms, buffer, light, overlay);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -21,8 +21,6 @@ public class RotateTool extends PlacementToolBase {
|
|||
|
||||
@Override
|
||||
public void renderOnSchematic(MatrixStack ms, IRenderTypeBuffer buffer, int light, int overlay) {
|
||||
super.renderOnSchematic(ms, buffer, light, overlay);
|
||||
|
||||
AxisAlignedBB bounds = schematicHandler.getBounds();
|
||||
double height = bounds.getYSize() + Math.max(20, bounds.getYSize());
|
||||
Vec3d center = bounds.getCenter()
|
||||
|
@ -32,12 +30,14 @@ public class RotateTool extends PlacementToolBase {
|
|||
Vec3d end = center.add(0, height / 2, 0);
|
||||
|
||||
line.getParams()
|
||||
.colored(0x4d80e4)
|
||||
.disableCull()
|
||||
.disableNormals()
|
||||
.colored(0xdddddd)
|
||||
.lineWidth(1 / 16f);
|
||||
line.set(start, end)
|
||||
.render(ms, buffer);
|
||||
|
||||
super.renderOnSchematic(ms, buffer, light, overlay);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -139,10 +139,13 @@ public abstract class SchematicToolBase implements ISchematicTool {
|
|||
AllKeys.ctrlDown() ? AllSpecialTextures.HIGHLIGHT_CHECKERED : AllSpecialTextures.CHECKERED);
|
||||
}
|
||||
outline.getParams()
|
||||
.colored(0x6886c5)
|
||||
.withFaceTexture(AllSpecialTextures.CHECKERED)
|
||||
.lineWidth(1 / 32f)
|
||||
.disableCull();
|
||||
outline.render(ms, buffer);
|
||||
outline.getParams()
|
||||
.withFaceTextures(null, null);
|
||||
.clearTextures();
|
||||
ms.pop();
|
||||
}
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.simibubi.create.foundation.utility.outliner;
|
|||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
||||
import com.simibubi.create.AllSpecialTextures;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
|
@ -40,6 +41,9 @@ public class AABBOutline extends Outline {
|
|||
Vec3d XyZ = new Vec3d(bb.maxX, bb.minY, bb.maxZ);
|
||||
Vec3d xYZ = new Vec3d(bb.minX, bb.maxY, bb.maxZ);
|
||||
Vec3d XYZ = new Vec3d(bb.maxX, bb.maxY, bb.maxZ);
|
||||
|
||||
// Buffers with no Culling only seem to work right with when this line is present
|
||||
buffer.getBuffer(RenderType.getEntityCutout(AllSpecialTextures.BLANK.getLocation()));
|
||||
|
||||
Vec3d start = xyz;
|
||||
renderAACuboidLine(ms, buffer, start, Xyz, noCull);
|
||||
|
@ -70,15 +74,16 @@ public class AABBOutline extends Outline {
|
|||
|
||||
}
|
||||
|
||||
//TODO noCull has no effect
|
||||
protected void renderFace(MatrixStack ms, IRenderTypeBuffer buffer, Direction direction, Vec3d p1, Vec3d p2,
|
||||
Vec3d p3, Vec3d p4, boolean noCull) {
|
||||
if (!params.faceTexture.isPresent())
|
||||
return;
|
||||
|
||||
ResourceLocation faceTexture = params.faceTexture.get().getLocation();
|
||||
|
||||
ResourceLocation faceTexture = params.faceTexture.get()
|
||||
.getLocation();
|
||||
if (direction == params.getHighlightedFace() && params.hightlightedFaceTexture.isPresent())
|
||||
faceTexture = params.hightlightedFaceTexture.get().getLocation();
|
||||
faceTexture = params.hightlightedFaceTexture.get()
|
||||
.getLocation();
|
||||
|
||||
RenderType translucentType =
|
||||
noCull ? RenderType.getEntityTranslucent(faceTexture) : RenderType.getEntityTranslucentCull(faceTexture);
|
||||
|
|
|
@ -31,7 +31,6 @@ public abstract class Outline {
|
|||
|
||||
public abstract void render(MatrixStack ms, IRenderTypeBuffer buffer);
|
||||
|
||||
//TODO noCull has no effect
|
||||
public void renderAACuboidLine(MatrixStack ms, IRenderTypeBuffer buffer, Vec3d start, Vec3d end, boolean noCull) {
|
||||
ResourceLocation tex = AllSpecialTextures.BLANK.getLocation();
|
||||
IVertexBuilder builder =
|
||||
|
|
Loading…
Reference in a new issue