1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Smooth lighting: Fix light leaking through edge-connected corners

For solid nodes, the lighting at a corner becomes face-dependent, which
means that only the four nodes in face-direction contribute to the
lighting (getSmoothLightSolid).
For special nodes, which use the lighting values at the eight corners of
a node, the lighting is not face-dependent, but certain nodes of the
eight surrounding nodes of a corner (here indices 4, 5, 6 and 7) can be
obstructed.

Ambient occlusion now also occurs for solid nodes, if two, three or four
of the four nodes in face-direction are solid.
This commit is contained in:
DTA7 2017-10-03 01:23:49 +02:00 committed by paramat
parent 1ff5c20442
commit 2cf9014160
3 changed files with 109 additions and 41 deletions

View file

@ -232,7 +232,8 @@ video::SColor encode_light(u16 light, u8 emissive_light);
// Compute light at node
u16 getInteriorLight(MapNode n, s32 increment, INodeDefManager *ndef);
u16 getFaceLight(MapNode n, MapNode n2, v3s16 face_dir, INodeDefManager *ndef);
u16 getSmoothLight(v3s16 p, v3s16 corner, MeshMakeData *data);
u16 getSmoothLightSolid(const v3s16 &p, const v3s16 &face_dir, const v3s16 &corner, MeshMakeData *data);
u16 getSmoothLightTransparent(const v3s16 &p, const v3s16 &corner, MeshMakeData *data);
/*!
* Returns the sunlight's color from the current