Added pane rotation profile

This commit is contained in:
MihailRis 2023-12-05 11:13:09 +03:00
parent 788234ab94
commit 81704140a7
5 changed files with 18 additions and 5 deletions

View File

@ -11,5 +11,5 @@
"hitbox": [0.0, 0.0, 0.0, 1.0, 1.0, 0.2],
"light-passing": true,
"sky-light-passing": true,
"rotation": "pipe"
"rotation": "pane"
}

View File

@ -59,6 +59,8 @@ Block* ContentLoader::loadBlock(string name, path file) {
def->rotatable = profile != "none";
if (profile == "pipe") {
def->rotations = BlockRotProfile::PIPE;
} else if (profile == "pane") {
def->rotations = BlockRotProfile::PANE;
} else if (profile != "none") {
cerr << "unknown rotation profile " << profile << endl;
def->rotatable = false;

View File

@ -262,7 +262,7 @@ void BlocksRenderer::blockCubeShaded(const ivec3& icoord,
face(coord+X, -X, -Z, -Y, -X-Y+loff, local, size.x, size.z, 0.0f, texfaces[2]);
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-Z+loff, local, size.z, size.y, 0.0f, texfaces[0]);
face(coord+Y, -Z, -Y, -X, -X-Y+loff, local, size.z, size.y, 0.0f, texfaces[0]);
}
/* Fastest solid shaded blocks render method */

View File

@ -21,6 +21,17 @@ const BlockRotProfile BlockRotProfile::PIPE {{
{{1, 0, 0}, {0, 0, 1}, {0, -1, 0}, {0, 0, -1}, {0, 1, 0}},
}};
const BlockRotProfile BlockRotProfile::PANE {{
// North
{{1, 0, 0}, {0, 1, 0}, {0, 0, 1}, {0, 0, 0}, {0, 0, 0}},
// East
{{0, 0, -1}, {0, 1, 0}, {1, 0, 0}, {1, 0, 0}, {0, 0, 1}},
// South
{{-1, 0, 0}, {0, 1, 0}, {0, 0, -1}, {1, 0, -1}, {1, 0, 1}},
// West
{{0, 0, 1}, {0, 1, 0}, {-1, 0, 0}, {0, 0, -1}, {1, 0, 0}},
}};
Block::Block(std::string name)
: name(name),
textureFaces {"notfound","notfound","notfound",

View File

@ -31,10 +31,10 @@ struct BlockRotProfile {
static const int MAX_COUNT = 16;
CoordSystem variants[MAX_COUNT];
/* Wood logs, pillars, pipes
3 orientations supported
*/
/* Wood logs, pillars, pipes */
static const BlockRotProfile PIPE;
/* Doors, signs and other panes */
static const BlockRotProfile PANE;
};
enum class BlockModel {