Z counseling

- Bezier track segments now render with a slight angle
This commit is contained in:
simibubi 2023-04-29 18:43:15 +02:00
parent 1b54827feb
commit 08bd9360b0
9 changed files with 279 additions and 163 deletions

View File

@ -533,7 +533,7 @@ public class BezierConnection implements Iterable<BezierConnection.Segment> {
.rotateYRadians(anglesI.y) .rotateYRadians(anglesI.y)
.rotateXRadians(anglesI.x) .rotateXRadians(anglesI.x)
.rotateZRadians(anglesI.z) .rotateZRadians(anglesI.z)
.translate(0, -2 / 16f + (i % 2 == 0 ? 1 : -1) / 2048f - 1 / 256f, -1 / 32f) .translate(0, -2 / 16f - 1 / 256f, -1 / 32f)
.scale(1, 1, (float) diff.length() * scale); .scale(1, 1, (float) diff.length() * scale);
angles.railTransforms.set(first, poseStack.last()); angles.railTransforms.set(first, poseStack.last());
} }

View File

@ -97,9 +97,7 @@ public class TrackInstance extends BlockEntityInstance<TrackBlockEntity> {
PoseStack pose = new PoseStack(); PoseStack pose = new PoseStack();
TransformStack.cast(pose) TransformStack.cast(pose)
.translate(getInstancePosition()) .translate(getInstancePosition());
.nudge((int) bc.tePositions.getFirst()
.asLong());
var mat = materialManager.cutout(RenderType.cutoutMipped()) var mat = materialManager.cutout(RenderType.cutoutMipped())
.material(Materials.TRANSFORMED); .material(Materials.TRANSFORMED);

View File

@ -8,7 +8,6 @@ import static com.simibubi.create.AllPartialModels.TRACK_SEGMENT_RIGHT;
import static com.simibubi.create.AllPartialModels.TRACK_TIE; import static com.simibubi.create.AllPartialModels.TRACK_TIE;
import com.jozufozu.flywheel.backend.Backend; import com.jozufozu.flywheel.backend.Backend;
import com.jozufozu.flywheel.util.transform.TransformStack;
import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.PoseStack.Pose; import com.mojang.blaze3d.vertex.PoseStack.Pose;
import com.mojang.blaze3d.vertex.VertexConsumer; import com.mojang.blaze3d.vertex.VertexConsumer;
@ -57,9 +56,6 @@ public class TrackRenderer extends SafeBlockEntityRenderer<TrackBlockEntity> {
BlockState air = Blocks.AIR.defaultBlockState(); BlockState air = Blocks.AIR.defaultBlockState();
SegmentAngles[] segments = bc.getBakedSegments(); SegmentAngles[] segments = bc.getBakedSegments();
TransformStack.cast(ms)
.nudge((int) tePosition.asLong());
renderGirder(level, bc, ms, vb, tePosition); renderGirder(level, bc, ms, vb, tePosition);
for (int i = 1; i < segments.length; i++) { for (int i = 1; i < segments.length; i++) {

View File

@ -1,50 +1,6 @@
{ {
"credit": "Made with Blockbench", "parent": "create:block/track/obj_track",
"texture_size": [32, 32], "loader": "forge:obj",
"textures": { "flip-v": true,
"1": "create:block/standard_track", "model": "create:models/block/track/segment_left.obj"
"particle": "create:block/palettes/stone_types/polished/andesite_cut_polished"
},
"elements": [
{
"name": "tie1",
"from": [-2.1, 0, 0],
"to": [2.1, 0.05, 8],
"rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]},
"faces": {
"up": {"uv": [0, 8.5, 4, 10.5], "rotation": 90, "texture": "#1"},
"down": {"uv": [0, 8.5, 4, 10.5], "rotation": 90, "texture": "#1"}
}
},
{
"name": "tie2",
"from": [-2, 4.4, 0],
"to": [2, 4.45, 8],
"rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]},
"faces": {
"up": {"uv": [7.5, 13.5, 3.5, 11.5], "rotation": 90, "texture": "#1"},
"down": {"uv": [0, 8.5, 4, 10.5], "rotation": 90, "texture": "#1"}
}
},
{
"name": "tie3",
"from": [-1.55, 0.05, 0],
"to": [1.55, 4.45, 8],
"rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]},
"faces": {
"north": {"uv": [11, 2, 12.5, 4], "texture": "#1"},
"east": {"uv": [0, 6, 4, 8], "texture": "#1"},
"south": {"uv": [11, 2, 12.5, 4], "texture": "#1"},
"west": {"uv": [0, 6, 4, 8], "texture": "#1"}
}
}
],
"groups": [
{
"name": "group",
"origin": [0, 0, 0],
"color": 0,
"children": [0, 1, 2]
}
]
} }

View File

@ -0,0 +1,81 @@
# Made in Blockbench 4.7.1
mtllib track.mtl
o tie1
v 0.13124999999999998 0.0031250000000000444 0.5
v 0.13124999999999998 0.0031250000000000444 0
v 0.13124999999999998 0 0.5
v 0.13124999999999998 0 0
v -0.13124999999999998 0.0031250000000000444 0
v -0.13124999999999998 0.0031250000000000444 0.5
v -0.13124999999999998 0 0
v -0.13124999999999998 0 0.5
vt 0 0.34375
vt 0 0.46875
vt 0.25 0.46875
vt 0.25 0.34375
vt 0 0.34375
vt 0 0.46875
vt 0.25 0.46875
vt 0.25 0.34375
vn 0 1 0
vn 0 -1 0
usemtl m_0
f 6/4/1 1/3/1 2/2/1 5/1/1
f 7/8/2 4/7/2 3/6/2 8/5/2
o tie3
v 0.09687500000000004 0.27374999999999994 0.5
v 0.09687500000000004 0.27374999999999994 0
v 0.09687500000000004 0.0031250000000000444 0.5
v 0.09687500000000004 0.0031250000000000444 0
v -0.09687500000000004 0.27374999999999994 0
v -0.09687500000000004 0.27374999999999994 0.5
v -0.09687500000000004 0.0031250000000000444 0
v -0.09687500000000004 0.0031250000000000444 0.5
vt 0.6875 0.875
vt 0.78125 0.875
vt 0.78125 0.75
vt 0.6875 0.75
vt 0 0.625
vt 0.25 0.625
vt 0.25 0.5
vt 0 0.5
vt 0.6875 0.875
vt 0.78125 0.875
vt 0.78125 0.75
vt 0.6875 0.75
vt 0 0.625
vt 0.25 0.625
vt 0.25 0.5
vt 0 0.5
vn 0 0 -1
vn 1 0 0
vn 0 0 1
vn -1 0 0
usemtl m_0
f 12/12/3 15/11/3 13/10/3 10/9/3
f 11/16/4 12/15/4 10/14/4 9/13/4
f 16/20/5 11/19/5 9/18/5 14/17/5
f 15/24/6 16/23/6 14/22/6 13/21/6
o tie2
v 0.12494918299049051 0.2726710894255546 0.5
v 0.12494918299049051 0.2726710894255546 0
v 0.12481287240497385 0.2695490637331114 0.5
v 0.12481287240497385 0.2695490637331114 0
v -0.1248128724049739 0.2835759362668886 0
v -0.1248128724049739 0.2835759362668886 0.5
v -0.12494918299049057 0.28045391057444535 0
v -0.12494918299049057 0.28045391057444535 0.5
vt 0.46875 0.28125
vt 0.46875 0.15625
vt 0.21875 0.15625
vt 0.21875 0.28125
vt 0 0.34375
vt 0 0.46875
vt 0.25 0.46875
vt 0.25 0.34375
vn 0.043619387365336 0.9990482215818578 0
vn -0.043619387365336 -0.9990482215818578 0
usemtl m_0
f 22/28/7 17/27/7 18/26/7 21/25/7
f 23/32/8 20/31/8 19/30/8 24/29/8

View File

@ -1,50 +1,6 @@
{ {
"credit": "Made with Blockbench", "parent": "create:block/track/obj_track",
"texture_size": [32, 32], "loader": "forge:obj",
"textures": { "flip-v": true,
"1": "create:block/standard_track", "model": "create:models/block/track/segment_right.obj"
"particle": "create:block/palettes/stone_types/polished/andesite_cut_polished"
},
"elements": [
{
"name": "tie1",
"from": [-2.1, 0, 0],
"to": [2.1, 0.05, 8],
"rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]},
"faces": {
"up": {"uv": [0, 8.5, 4, 10.5], "rotation": 90, "texture": "#1"},
"down": {"uv": [0, 8.5, 4, 10.5], "rotation": 90, "texture": "#1"}
}
},
{
"name": "tie2",
"from": [-2, 4.4, 0],
"to": [2, 4.45, 8],
"rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]},
"faces": {
"up": {"uv": [7.5, 11.5, 3.5, 13.5], "rotation": 90, "texture": "#1"},
"down": {"uv": [0, 8.5, 4, 10.5], "rotation": 90, "texture": "#1"}
}
},
{
"name": "tie3",
"from": [-1.55, 0.05, 0],
"to": [1.55, 4.45, 8],
"rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]},
"faces": {
"north": {"uv": [11, 2, 12.5, 4], "texture": "#1"},
"east": {"uv": [0, 6, 4, 8], "texture": "#1"},
"south": {"uv": [11, 2, 12.5, 4], "texture": "#1"},
"west": {"uv": [0, 6, 4, 8], "texture": "#1"}
}
}
],
"groups": [
{
"name": "group",
"origin": [0, 0, 0],
"color": 0,
"children": [0, 1, 2]
}
]
} }

View File

@ -0,0 +1,81 @@
# Made in Blockbench 4.7.1
mtllib track.mtl
o tie1
v 0.13124999999999998 0.0031250000000000444 0.5
v 0.13124999999999998 0.0031250000000000444 0
v 0.13124999999999998 0 0.5
v 0.13124999999999998 0 0
v -0.13124999999999998 0.0031250000000000444 0
v -0.13124999999999998 0.0031250000000000444 0.5
v -0.13124999999999998 0 0
v -0.13124999999999998 0 0.5
vt 0 0.34375
vt 0 0.46875
vt 0.25 0.46875
vt 0.25 0.34375
vt 0 0.34375
vt 0 0.46875
vt 0.25 0.46875
vt 0.25 0.34375
vn 0 1 0
vn 0 -1 0
usemtl m_0
f 6/4/1 1/3/1 2/2/1 5/1/1
f 7/8/2 4/7/2 3/6/2 8/5/2
o tie3
v 0.09687500000000004 0.27374999999999994 0.5
v 0.09687500000000004 0.27374999999999994 0
v 0.09687500000000004 0.0031250000000000444 0.5
v 0.09687500000000004 0.0031250000000000444 0
v -0.09687500000000004 0.27374999999999994 0
v -0.09687500000000004 0.27374999999999994 0.5
v -0.09687500000000004 0.0031250000000000444 0
v -0.09687500000000004 0.0031250000000000444 0.5
vt 0.6875 0.875
vt 0.78125 0.875
vt 0.78125 0.75
vt 0.6875 0.75
vt 0 0.625
vt 0.25 0.625
vt 0.25 0.5
vt 0 0.5
vt 0.6875 0.875
vt 0.78125 0.875
vt 0.78125 0.75
vt 0.6875 0.75
vt 0 0.625
vt 0.25 0.625
vt 0.25 0.5
vt 0 0.5
vn 0 0 -1
vn 1 0 0
vn 0 0 1
vn -1 0 0
usemtl m_0
f 12/12/3 15/11/3 13/10/3 10/9/3
f 11/16/4 12/15/4 10/14/4 9/13/4
f 16/20/5 11/19/5 9/18/5 14/17/5
f 15/24/6 16/23/6 14/22/6 13/21/6
o tie2
v 0.12481287240497385 0.2835759362668886 0.5
v 0.12481287240497385 0.2835759362668886 0
v 0.12494918299049051 0.28045391057444535 0.5
v 0.12494918299049051 0.28045391057444535 0
v -0.12494918299049057 0.2726710894255546 0
v -0.12494918299049057 0.2726710894255546 0.5
v -0.1248128724049739 0.2695490637331114 0
v -0.1248128724049739 0.2695490637331114 0.5
vt 0.46875 0.15625
vt 0.46875 0.28125
vt 0.21875 0.28125
vt 0.21875 0.15625
vt 0 0.34375
vt 0 0.46875
vt 0.25 0.46875
vt 0.25 0.34375
vn -0.043619387365336 0.9990482215818578 0
vn 0.043619387365336 -0.9990482215818578 0
usemtl m_0
f 22/28/7 17/27/7 18/26/7 21/25/7
f 23/32/8 20/31/8 19/30/8 24/29/8

View File

@ -1,61 +1,6 @@
{ {
"credit": "Made with Blockbench", "parent": "create:block/track/obj_track",
"texture_size": [32, 32], "loader": "forge:obj",
"textures": { "flip-v": true,
"1": "create:block/standard_track", "model": "create:models/block/track/tie.obj"
"2": "create:block/standard_track_mip",
"particle": "create:block/palettes/stone_types/polished/andesite_cut_polished"
},
"elements": [
{
"name": "cube1",
"from": [-13.95, -3.05, 2],
"to": [8, 1.05, 6],
"rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]},
"faces": {
"north": {"uv": [0, 2, 11, 4], "texture": "#1"},
"south": {"uv": [11, 2, 0, 4], "texture": "#1"},
"down": {"uv": [0, 4, 11, 6], "rotation": 180, "texture": "#1"}
}
},
{
"name": "cube2",
"from": [-13.95, -3.05, -1.75],
"to": [8, 1.05, 9.75],
"rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]},
"faces": {
"west": {"uv": [11, 3.75, 13, 9.25], "rotation": 90, "texture": "#2"},
"up": {"uv": [0, 3.75, 11, 9.25], "rotation": 180, "texture": "#2"}
}
},
{
"name": "cube3",
"from": [8, -3.05, -1.75],
"to": [29.95, 1.05, 9.75],
"rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]},
"faces": {
"east": {"uv": [11, 3.75, 13, 9.25], "rotation": 90, "texture": "#2"},
"up": {"uv": [0, 3.75, 11, 9.25], "texture": "#2"}
}
},
{
"name": "cube2",
"from": [8, -3.05, 2],
"to": [29.95, 1.05, 6],
"rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]},
"faces": {
"north": {"uv": [11, 2, 0, 4], "texture": "#1"},
"south": {"uv": [0, 2, 11, 4], "texture": "#1"},
"down": {"uv": [0, 4, 11, 6], "texture": "#1"}
}
}
],
"groups": [
{
"name": "group",
"origin": [0, 0, 0],
"color": 0,
"children": [0, 1, 2, 3]
}
]
} }

View File

@ -0,0 +1,103 @@
# Made in Blockbench 4.7.1
mtllib track.mtl
o mip1
v 0.5022361747214583 0.06561524278519393 0.609375
v 0.5022361747214583 0.06561524278519393 -0.109375
v 0.5 -0.190625 0.609375
v 0.5 -0.190625 -0.109375
v -0.8695865884822016 0.0775869586720257 -0.109375
v -0.8695865884822016 0.0775869586720257 0.609375
v -0.8718227632036599 -0.17865328411316828 -0.109375
v -0.8718227632036599 -0.17865328411316828 0.609375
vt 0.6875 0.421875
vt 0.6875 0.765625
vt 0.8125 0.765625
vt 0.8125 0.421875
vt 0.6875 0.421875
vt 0 0.421875
vt 0 0.765625
vt 0.6875 0.765625
vn -0.9999619230641713 0.008726535498373935 0
vn 0.008726535498373935 0.9999619230641713 0
usemtl m_1
f 7/4/1 8/3/1 6/2/1 5/1/1
f 6/8/2 1/7/2 2/6/2 5/5/2
o base1
v 0.5022361747214583 0.06561524278519393 0.375
v 0.5022361747214583 0.06561524278519393 0.125
v 0.5 -0.190625 0.375
v 0.5 -0.190625 0.125
v -0.8695865884822016 0.0775869586720257 0.125
v -0.8695865884822016 0.0775869586720257 0.375
v -0.8718227632036599 -0.17865328411316828 0.125
v -0.8718227632036599 -0.17865328411316828 0.375
vt 0 0.875
vt 0.6875 0.875
vt 0.6875 0.75
vt 0 0.75
vt 0.6875 0.875
vt 0 0.875
vt 0 0.75
vt 0.6875 0.75
vt 0.6875 0.625
vt 0 0.625
vt 0 0.75
vt 0.6875 0.75
vn 0 0 -1
vn 0 0 1
vn -0.008726535498373935 -0.9999619230641713 0
usemtl m_0
f 12/12/3 15/11/3 13/10/3 10/9/3
f 16/16/4 11/15/4 9/14/4 14/13/4
f 15/20/5 12/19/5 11/18/5 16/17/5
o base2
v 1.8695865884822016 0.0775869586720257 0.375
v 1.8695865884822016 0.0775869586720257 0.125
v 1.8718227632036601 -0.17865328411316828 0.375
v 1.8718227632036601 -0.17865328411316828 0.125
v 0.4977638252785417 0.06561524278519393 0.125
v 0.4977638252785417 0.06561524278519393 0.375
v 0.5 -0.190625 0.125
v 0.5 -0.190625 0.375
vt 0.6875 0.875
vt 0 0.875
vt 0 0.75
vt 0.6875 0.75
vt 0 0.875
vt 0.6875 0.875
vt 0.6875 0.75
vt 0 0.75
vt 0 0.75
vt 0.6875 0.75
vt 0.6875 0.625
vt 0 0.625
vn 0 0 -1
vn 0 0 1
vn 0.008726535498373935 -0.9999619230641713 0
usemtl m_0
f 20/24/6 23/23/6 21/22/6 18/21/6
f 24/28/7 19/27/7 17/26/7 22/25/7
f 23/32/8 20/31/8 19/30/8 24/29/8
o mip2
v 1.8695865884822016 0.0775869586720257 0.609375
v 1.8695865884822016 0.0775869586720257 -0.109375
v 1.8718227632036601 -0.17865328411316828 0.609375
v 1.8718227632036601 -0.17865328411316828 -0.109375
v 0.4977638252785417 0.06561524278519393 -0.109375
v 0.4977638252785417 0.06561524278519393 0.609375
v 0.5 -0.190625 -0.109375
v 0.5 -0.190625 0.609375
vt 0.6875 0.421875
vt 0.6875 0.765625
vt 0.8125 0.765625
vt 0.8125 0.421875
vt 0 0.765625
vt 0.6875 0.765625
vt 0.6875 0.421875
vt 0 0.421875
vn 0.9999619230641713 0.008726535498373935 0
vn -0.008726535498373935 0.9999619230641713 0
usemtl m_1
f 27/36/9 28/35/9 26/34/9 25/33/9
f 30/40/10 25/39/10 26/38/10 29/37/10