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