mirror of
https://github.com/t-affeldt/lighting_monoids.git
synced 2025-04-26 14:30:30 +02:00
Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
7ac833bb19 | ||
|
8108a5d585 | ||
|
a65f43bded |
@ -15,15 +15,17 @@ Each property of the lighting definition will be aggregated with the respective
|
||||
|
||||
Properties will be aggregated in different ways. Here is the full list:
|
||||
|
||||
- `saturation` will be __multiplied__
|
||||
- `shadows`
|
||||
- `intensity` will be __multiplied__
|
||||
- `exposure`
|
||||
- `luminance_min` will be __added__
|
||||
- `luminance_max` will be __added__
|
||||
- `speed_dark_bright` will be __multiplied__
|
||||
- `speed_bright_dark` will be __multiplied__
|
||||
- `center_weight_power` will be __multiplied__
|
||||
- `saturation` will be __multiplied__
|
||||
- `shadows`
|
||||
- `intensity` will be __multiplied__
|
||||
- `tint` values will be __maxed__
|
||||
- `volumetric_light` will be __maxed__
|
||||
|
||||
### Example
|
||||
|
||||
|
@ -7,6 +7,11 @@ if weather == nil or weather.get == nil then
|
||||
return
|
||||
end
|
||||
|
||||
-- leave it to climate_api to disable
|
||||
if minetest.get_modpath("climate_api") then
|
||||
return
|
||||
end
|
||||
|
||||
-- prevent mod from triggering lighting updates itself
|
||||
local old_get = weather.get
|
||||
weather.get = function(player)
|
||||
|
30
init.lua
30
init.lua
@ -5,6 +5,11 @@ local monoid_definition = {
|
||||
shadows = {
|
||||
intensity = "multiply",
|
||||
},
|
||||
tint = {
|
||||
r = "max_255",
|
||||
g = "max_255",
|
||||
b = "max_255"
|
||||
},
|
||||
saturation = "multiply",
|
||||
exposure = {
|
||||
luminance_min = "add",
|
||||
@ -13,16 +18,31 @@ local monoid_definition = {
|
||||
speed_dark_bright = "multiply",
|
||||
speed_bright_dark = "multiply",
|
||||
center_weight_power = "multiply"
|
||||
},
|
||||
volumetric_light = {
|
||||
strength = "max_1"
|
||||
}
|
||||
}
|
||||
|
||||
-- default values that don't reflect neutral operations
|
||||
-- neutral values
|
||||
local lighting_defaults = {
|
||||
shadows = {
|
||||
intensity = 1,
|
||||
},
|
||||
tint = {
|
||||
r = 0,
|
||||
g = 0,
|
||||
b = 0
|
||||
},
|
||||
saturation = 1,
|
||||
exposure = {
|
||||
luminance_min = -3,
|
||||
luminance_max = -3,
|
||||
speed_dark_bright = 1000,
|
||||
speed_bright_dark = 1000,
|
||||
},
|
||||
volumetric_light = {
|
||||
strength = 0
|
||||
}
|
||||
}
|
||||
|
||||
@ -36,6 +56,14 @@ function methods.multiply(a, b)
|
||||
return a * b
|
||||
end
|
||||
|
||||
function methods.max_1(a, b)
|
||||
return math.min(math.max(math.max(a, b), 0), 1)
|
||||
end
|
||||
|
||||
function methods.max_255(a, b)
|
||||
return math.min(math.max(math.max(a, b), 0), 255)
|
||||
end
|
||||
|
||||
-- combine tables using specified methods
|
||||
local function combine(definition, tabA, tabB)
|
||||
-- at least one table has undefined value
|
||||
|
Loading…
x
Reference in New Issue
Block a user