add block 'shadeless' property

This commit is contained in:
MihailRis 2024-06-15 19:55:55 +03:00
parent 4d962e8349
commit ea53009b96
9 changed files with 16 additions and 6 deletions

View File

@ -1,5 +1,6 @@
{
"texture": "blue_lamp",
"emission": [0, 0, 15],
"shadeless": true,
"material": "base:glass"
}

View File

@ -1,5 +1,6 @@
{
"texture": "green_lamp",
"emission": [0, 15, 0],
"shadeless": true,
"material": "base:glass"
}

View File

@ -1,4 +1,5 @@
{
"texture": "lamp",
"emission": [15, 14, 13]
}
"emission": [15, 14, 13],
"shadeless": true
}

View File

@ -7,5 +7,6 @@
"rotation": "pipe",
"light-passing": true,
"sky-light-passing": true,
"shadeless": true,
"material": "base:glass"
}

View File

@ -1,5 +1,6 @@
{
"texture": "red_lamp",
"emission": [15, 0, 0],
"shadeless": true,
"material": "base:glass"
}

View File

@ -11,6 +11,7 @@
"model": "aabb",
"hitbox": [0.4375, 0.0, 0.4375, 0.125, 0.5, 0.125],
"light-passing": true,
"shadeless": true,
"obstacle": false,
"rotation": "pipe"
}

View File

@ -208,11 +208,12 @@ void ContentLoader::loadBlock(Block& def, const std::string& name, const fs::pat
root->flag("obstacle", def.obstacle);
root->flag("replaceable", def.replaceable);
root->flag("light-passing", def.lightPassing);
root->flag("sky-light-passing", def.skyLightPassing);
root->flag("shadeless", def.shadeless);
root->flag("breakable", def.breakable);
root->flag("selectable", def.selectable);
root->flag("grounded", def.grounded);
root->flag("hidden", def.hidden);
root->flag("sky-light-passing", def.skyLightPassing);
root->num("draw-group", def.drawGroup);
root->str("picking-item", def.pickingItem);
root->str("script-name", def.scriptName);

View File

@ -440,7 +440,7 @@ void BlocksRenderer::render(const voxel* voxels) {
int z = (i / CHUNK_D) % CHUNK_W;
switch (def.model) {
case BlockModel::block:
blockCube(x, y, z, texfaces, &def, vox.state, !def.rt.emissive);
blockCube(x, y, z, texfaces, &def, vox.state, !def.shadeless);
break;
case BlockModel::xsprite: {
blockXSprite(x, y, z, vec3(1.0f),
@ -448,11 +448,11 @@ void BlocksRenderer::render(const voxel* voxels) {
break;
}
case BlockModel::aabb: {
blockAABB(ivec3(x,y,z), texfaces, &def, vox.state.rotation, !def.rt.emissive);
blockAABB(ivec3(x,y,z), texfaces, &def, vox.state.rotation, !def.shadeless);
break;
}
case BlockModel::custom: {
blockCustomModel(ivec3(x, y, z), &def, vox.state.rotation, !def.rt.emissive);
blockCustomModel(ivec3(x, y, z), &def, vox.state.rotation, !def.shadeless);
break;
}
default:

View File

@ -126,6 +126,9 @@ public:
/// @brief Does the block passing top-down sky lights into itself
bool skyLightPassing = false;
/// @brief Does block model have shading
bool shadeless = false;
/// @brief Is the block a physical obstacle
bool obstacle = true;