AABB blocks render fix + new test block: pipe

This commit is contained in:
MihailRis 2023-12-07 01:34:54 +03:00
parent f9a5758213
commit e3f7f7218f
5 changed files with 24 additions and 7 deletions

View File

@ -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"
}

View File

@ -22,6 +22,7 @@
"red_lamp",
"green_lamp",
"blue_lamp",
"pane"
"pane",
"pipe"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

View File

@ -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 */