diff --git a/res/content/base/blocks/pipe.json b/res/content/base/blocks/pipe.json new file mode 100644 index 00000000..eaaaff3c --- /dev/null +++ b/res/content/base/blocks/pipe.json @@ -0,0 +1,14 @@ +{ + "texture-faces": [ + "pipe_side", + "pipe_side", + "pipe_hole", + "pipe_hole", + "pipe_side", + "pipe_side" + ], + "model": "aabb", + "hitbox": [0.25, 0.0, 0.25, 0.5, 1.0, 0.5], + "light-passing": true, + "rotation": "pipe" +} diff --git a/res/content/base/package.json b/res/content/base/package.json index 943d64b5..5ba70b1f 100644 --- a/res/content/base/package.json +++ b/res/content/base/package.json @@ -22,6 +22,7 @@ "red_lamp", "green_lamp", "blue_lamp", - "pane" + "pane", + "pipe" ] } \ No newline at end of file diff --git a/res/textures/blocks/pipe_hole.png b/res/textures/blocks/pipe_hole.png new file mode 100644 index 00000000..681a5ddf Binary files /dev/null and b/res/textures/blocks/pipe_hole.png differ diff --git a/res/textures/blocks/pipe_side.png b/res/textures/blocks/pipe_side.png new file mode 100644 index 00000000..e5977fbe Binary files /dev/null and b/res/textures/blocks/pipe_side.png differ diff --git a/src/graphics/BlocksRenderer.cpp b/src/graphics/BlocksRenderer.cpp index c0579bc4..bbae1c8e 100644 --- a/src/graphics/BlocksRenderer.cpp +++ b/src/graphics/BlocksRenderer.cpp @@ -251,18 +251,20 @@ void BlocksRenderer::blockCubeShaded(const ivec3& icoord, coord += orient.fix; loff -= orient.fix; } + vec3 fX(X); + vec3 fY(Y); vec3 fZ(Z); vec3 local = offset.x*vec3(X)+offset.y*vec3(Y)+offset.z*-fZ; - face(coord, X, Y, Z, Z+loff, local-size.z*fZ, size.x, size.y, size.z, texfaces[5]); - face(coord+X, -X, Y, -Z, Z-Z-X+loff, local-size.z*fZ, size.x, size.y, 0.0f, texfaces[4]); + face(coord, X, Y, Z, Z+loff, local-size.z*fZ, size.x, size.y, size.z, texfaces[5]); // north ;;; + face(coord, -X, Y, -Z, Z-Z-X+loff, local-size.z*fZ+fX*size.x, size.x, size.y, 0.0f, texfaces[4]); // south ;;; - face(coord+Y, X, -Z, Y, Y-Y+loff, local, size.x, size.z, 0.0f, texfaces[3]); - face(coord+X, -X, -Z, -Y, -X-Y+loff, local, size.x, size.z, 0.0f, texfaces[2]); + face(coord+Y, X, -Z, Y, Y-Y+loff, local, size.x, size.z, 0.0f, texfaces[3]); // top ;;; + face(coord+X, -X, -Z, -Y, -X-Y+loff, local+size.x*fX-fX, size.x, size.z, 0.0f, texfaces[2]); // bottom ;;; - face(coord+X, -Z, Y, X, X-X+loff, local, size.z, size.y, 0.0f, texfaces[1]); - face(coord+Y, -Z, -Y, -X, -X-Y+loff, local, size.z, size.y, 0.0f, texfaces[0]); + face(coord+X, -Z, Y, X, X-X+loff, local+size.x*fX-fX, size.z, size.y, 0.0f, texfaces[1]); // west ;;; + face(coord+Y, -Z, -Y, -X, -X-Y+loff, local, size.z, size.y, 0.0f, texfaces[0]); // east ;;; } /* Fastest solid shaded blocks render method */