Luanti
5.11.0-dev
▼
Luanti
The Minetest engine internal documentation
Deprecated List
►
Namespaces
►
Classes
▼
Files
▼
File List
►
benchmark
►
client
►
content
►
database
doc
►
gui
►
irrlicht_changes
►
mapgen
►
network
►
script
►
server
►
threading
►
unittest
►
util
►
activeobject.h
►
activeobjectmgr.h
►
catch.cpp
►
catch.h
chat.cpp
►
chat.h
►
chat_interface.h
►
chatmessage.h
►
particles.cpp
►
sound.h
clientdynamicinfo.cpp
►
clientdynamicinfo.h
►
collision.cpp
►
collision.h
►
config.h
►
constants.h
►
content_mapnode.cpp
►
content_mapnode.h
►
content_nodemeta.cpp
►
content_nodemeta.h
►
convert_json.cpp
►
convert_json.h
►
craftdef.cpp
►
craftdef.h
►
daynightratio.h
►
debug.cpp
►
debug.h
►
defaultsettings.cpp
►
defaultsettings.h
►
dummygamedef.h
►
dummymap.h
emerge.cpp
►
emerge.h
►
emerge_internal.h
►
environment.cpp
►
environment.h
►
exceptions.h
face_position_cache.cpp
►
face_position_cache.h
►
filesys.cpp
►
filesys.h
►
gamedef.h
►
gameparams.h
►
gettext.cpp
►
gettext.h
►
gettext_plural_form.cpp
►
gettext_plural_form.h
►
gettime.h
►
httpfetch.cpp
►
httpfetch.h
►
hud.cpp
►
hud.h
►
inventory.cpp
►
inventory.h
►
inventorymanager.cpp
►
inventorymanager.h
►
irr_aabb3d.h
►
irr_gui_ptr.h
►
irr_v2d.h
►
irr_v3d.h
►
irrlichttypes.h
irrlichttypes_bloated.h
irrlichttypes_extrabloated.h
►
itemdef.cpp
►
itemdef.h
►
itemgroup.h
►
itemstackmetadata.cpp
►
itemstackmetadata.h
json-forwards.h
light.cpp
►
light.h
►
lighting.h
►
log.cpp
►
log.h
►
log_internal.h
►
main.cpp
►
map.cpp
►
map.h
map_settings_manager.cpp
►
map_settings_manager.h
►
mapblock.cpp
►
mapblock.h
►
mapnode.cpp
►
mapnode.h
mapsector.cpp
►
mapsector.h
metadata.cpp
►
metadata.h
►
migratesettings.h
►
modchannels.cpp
►
modchannels.h
►
modifiedstate.h
nameidmapping.cpp
►
nameidmapping.h
►
nodedef.cpp
►
nodedef.h
nodemetadata.cpp
►
nodemetadata.h
nodetimer.cpp
►
nodetimer.h
►
noise.cpp
►
noise.h
objdef.cpp
►
objdef.h
►
object_properties.cpp
►
object_properties.h
►
particles.h
►
pathfinder.cpp
►
pathfinder.h
►
player.cpp
►
player.h
►
porting.cpp
►
porting.h
►
porting_android.cpp
►
porting_android.h
►
profiler.cpp
►
profiler.h
►
raycast.cpp
►
raycast.h
reflowscan.cpp
►
reflowscan.h
remoteplayer.cpp
►
remoteplayer.h
rollback_interface.cpp
►
rollback_interface.h
►
serialization.cpp
►
serialization.h
►
server.cpp
►
server.h
►
serverenvironment.cpp
►
serverenvironment.h
►
servermap.cpp
►
servermap.h
►
settings.cpp
►
settings.h
►
settings_translation_file.cpp
►
skyparams.h
staticobject.cpp
►
staticobject.h
terminal_chat_console.cpp
►
terminal_chat_console.h
►
texture_override.cpp
►
texture_override.h
tileanimation.cpp
►
tileanimation.h
►
tool.cpp
►
tool.h
►
translation.cpp
►
translation.h
►
version.cpp
►
version.h
►
voxel.cpp
►
voxel.h
►
voxelalgorithms.cpp
►
voxelalgorithms.h
►
File Members
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
Loading...
Searching...
No Matches
light.h
Go to the documentation of this file.
1
// Luanti
2
// SPDX-License-Identifier: LGPL-2.1-or-later
3
// Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
4
5
#pragma once
6
#include <cassert>
7
#include "
config.h
"
8
#include "
irrlichttypes.h
"
9
10
/*
11
Lower level lighting stuff
12
*/
13
14
// This directly sets the range of light.
15
// Actually this is not the real maximum, and this is not the brightest, the
16
// brightest is LIGHT_SUN.
17
// If changed, this constant as defined in builtin/game/constants.lua must
18
// also be changed.
19
#define LIGHT_MAX 14
20
// Light is stored as 4 bits, thus 15 is the maximum.
21
// This brightness is reserved for sunlight
22
#define LIGHT_SUN 15
23
24
#if IS_CLIENT_BUILD
25
38
extern
const
u8 *light_decode_table;
39
40
// 0 <= light <= LIGHT_SUN
41
// 0 <= return value <= 255
42
inline
u8 decode_light(u8 light)
43
{
44
// assert(light <= LIGHT_SUN);
45
if
(light >
LIGHT_SUN
)
46
light =
LIGHT_SUN
;
47
return
light_decode_table[light];
48
}
49
50
// 0.0 <= light <= 1.0
51
// 0.0 <= return value <= 1.0
52
float
decode_light_f(
float
light_f);
53
54
void
set_light_table(
float
gamma);
55
56
#endif
57
58
// 0 <= daylight_factor <= 1000
59
// 0 <= lightday, lightnight <= LIGHT_SUN
60
// 0 <= return value <= LIGHT_SUN
61
inline
u8
blend_light
(u32 daylight_factor, u8 lightday, u8 lightnight)
62
{
63
u32 c = 1000;
64
u32 l = ((daylight_factor * lightday + (c - daylight_factor) * lightnight)) / c;
65
if
(l >
LIGHT_SUN
)
66
l =
LIGHT_SUN
;
67
return
l;
68
}
61
inline
u8
blend_light
(u32 daylight_factor, u8 lightday, u8 lightnight) {
…
}
config.h
irrlichttypes.h
LIGHT_SUN
#define LIGHT_SUN
Definition
light.h:22
blend_light
u8 blend_light(u32 daylight_factor, u8 lightday, u8 lightnight)
Definition
light.h:61
light.h
Generated on Sat Feb 1 2025 10:20:55 for Luanti by
1.11.0