1
0
mirror of https://github.com/luanti-org/luanti.git synced 2025-10-30 06:55:33 +01:00

Fix dark liquids (#6621)

* Update light storage format
This commit is contained in:
Vitaliy
2017-11-18 12:57:22 +03:00
committed by Loïc Blot
parent 24c1c2fd0f
commit 0780ee51c5
2 changed files with 33 additions and 23 deletions

View File

@@ -25,8 +25,20 @@ with this program; if not, write to the Free Software Foundation, Inc.,
struct MeshMakeData;
struct MeshCollector;
struct LightFrame
{
struct LightPair {
u8 lightA;
u8 lightB;
LightPair() = default;
explicit LightPair(u16 value) : lightA(value & 0xff), lightB(value >> 8) {}
LightPair(u8 valueA, u8 valueB) : lightA(valueA), lightB(valueB) {}
LightPair(float valueA, float valueB) :
lightA(core::clamp(core::round32(valueA), 0, 255)),
lightB(core::clamp(core::round32(valueB), 0, 255)) {}
operator u16() const { return lightA | lightB << 8; }
};
struct LightFrame {
f32 lightsA[8];
f32 lightsB[8];
};
@@ -49,7 +61,7 @@ public:
v3f origin;
MapNode n;
const ContentFeatures *f;
u16 light;
LightPair light;
LightFrame frame;
video::SColor color;
TileSpec tile;
@@ -57,7 +69,7 @@ public:
// lighting
void getSmoothLightFrame();
u16 blendLight(const v3f &vertex_pos);
LightPair blendLight(const v3f &vertex_pos);
video::SColor blendLightColor(const v3f &vertex_pos);
video::SColor blendLightColor(const v3f &vertex_pos, const v3f &vertex_normal);
@@ -73,7 +85,7 @@ public:
// cuboid drawing!
void drawCuboid(const aabb3f &box, TileSpec *tiles, int tilecount,
const u16 *lights , const f32 *txc);
const LightPair *lights , const f32 *txc);
void generateCuboidTextureCoords(aabb3f const &box, f32 *coords);
void drawAutoLightedCuboid(aabb3f box, const f32 *txc = NULL,
TileSpec *tiles = NULL, int tile_count = 0);