mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2025-10-30 08:01:01 +00:00
Lighting engine full documentation and more improvements
Some checks are pending
Build coop / build-linux (push) Waiting to run
Build coop / build-steamos (push) Waiting to run
Build coop / build-windows-opengl (push) Waiting to run
Build coop / build-windows-directx (push) Waiting to run
Build coop / build-macos-arm (push) Waiting to run
Build coop / build-macos-intel (push) Waiting to run
Some checks are pending
Build coop / build-linux (push) Waiting to run
Build coop / build-steamos (push) Waiting to run
Build coop / build-windows-opengl (push) Waiting to run
Build coop / build-windows-directx (push) Waiting to run
Build coop / build-macos-arm (push) Waiting to run
Build coop / build-macos-intel (push) Waiting to run
This commit is contained in:
parent
4c3ee14f55
commit
6a5af9d23a
23 changed files with 599 additions and 253 deletions
|
|
@ -54,7 +54,7 @@ in_files = [
|
|||
"src/pc/djui/djui_panel_menu.h",
|
||||
"src/engine/lighting_engine.h",
|
||||
"include/PR/gbi.h",
|
||||
"include/PR/gbi_extension.h"
|
||||
"include/PR/gbi_extension.h",
|
||||
]
|
||||
|
||||
exclude_constants = {
|
||||
|
|
@ -67,7 +67,7 @@ exclude_constants = {
|
|||
"src/pc/djui/djui_console.h": [ "CONSOLE_MAX_TMP_BUFFER" ],
|
||||
"src/pc/lua/smlua_hooks.h": [ "MAX_HOOKED_MOD_MENU_ELEMENTS", "^HOOK_RETURN_.*", "^ACTION_HOOK_.*", "^MOD_MENU_ELEMENT_.*" ],
|
||||
"src/pc/djui/djui_panel_menu.h": [ "RAINBOW_TEXT_LEN" ],
|
||||
"src/pc/mods/mod_fs.h": [ "MOD_FS_DIRECTORY", "MOD_FS_EXTENSION", "MOD_FS_VERSION", "INT_TYPE_MAX", "FLOAT_TYPE_MAX", "FILE_SEEK_MAX" ]
|
||||
"src/pc/mods/mod_fs.h": [ "MOD_FS_DIRECTORY", "MOD_FS_EXTENSION", "MOD_FS_VERSION", "INT_TYPE_MAX", "FLOAT_TYPE_MAX", "FILE_SEEK_MAX" ],
|
||||
}
|
||||
|
||||
include_constants = {
|
||||
|
|
@ -110,7 +110,7 @@ include_constants = {
|
|||
"^G_TEXRECTFLIP$",
|
||||
"^G_TEXRECT$",
|
||||
],
|
||||
"include/PR/gbi_extension.h": [ "G_VTX_EXT" ]
|
||||
"include/PR/gbi_extension.h": [ "G_VTX_EXT" ],
|
||||
}
|
||||
|
||||
# Constants that exist in the source code but should not appear
|
||||
|
|
@ -120,7 +120,7 @@ hide_constants = {
|
|||
}
|
||||
|
||||
pretend_find = [
|
||||
"SOUND_ARG_LOAD"
|
||||
"SOUND_ARG_LOAD",
|
||||
]
|
||||
############################################################################
|
||||
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ in_files = [
|
|||
"src/engine/behavior_script.h",
|
||||
"src/audio/seqplayer.h",
|
||||
"src/engine/lighting_engine.h",
|
||||
"src/pc/network/sync_object.h"
|
||||
"src/pc/network/sync_object.h",
|
||||
]
|
||||
|
||||
override_allowed_functions = {
|
||||
|
|
@ -98,7 +98,7 @@ override_allowed_functions = {
|
|||
"src/engine/level_script.h": [ "area_create_warp_node" ],
|
||||
"src/game/ingame_menu.h": [ "set_min_dialog_width", "set_dialog_override_pos", "reset_dialog_override_pos", "set_dialog_override_color", "reset_dialog_override_color", "set_menu_mode", "create_dialog_box", "create_dialog_box_with_var", "create_dialog_inverted_box", "create_dialog_box_with_response", "reset_dialog_render_state", "set_dialog_box_state", ],
|
||||
"src/audio/seqplayer.h": [ "sequence_player_set_tempo", "sequence_player_set_tempo_acc", "sequence_player_set_transposition", "sequence_player_get_tempo", "sequence_player_get_tempo_acc", "sequence_player_get_transposition", "sequence_player_get_volume", "sequence_player_get_fade_volume", "sequence_player_get_mute_volume_scale" ],
|
||||
"src/pc/network/sync_object.h": [ "sync_object_is_initialized", "sync_object_is_owned_locally", "sync_object_get_object" ]
|
||||
"src/pc/network/sync_object.h": [ "sync_object_is_initialized", "sync_object_is_owned_locally", "sync_object_get_object" ],
|
||||
}
|
||||
|
||||
override_disallowed_functions = {
|
||||
|
|
@ -139,22 +139,22 @@ override_disallowed_functions = {
|
|||
"src/pc/lua/utils/smlua_collision_utils.h": [ "collision_find_surface_on_ray" ],
|
||||
"src/engine/behavior_script.h": [ "stub_behavior_script_2", "cur_obj_update" ],
|
||||
"src/pc/utils/misc.h": [ "str_.*", "file_get_line", "delta_interpolate_(normal|rgba|mtx)", "detect_and_skip_mtx_interpolation" ],
|
||||
"src/engine/lighting_engine.h": [ "le_calculate_vertex_lighting", "le_clear", "le_shutdown" ]
|
||||
"src/engine/lighting_engine.h": [ "le_calculate_vertex_lighting", "le_clear", "le_shutdown" ],
|
||||
}
|
||||
|
||||
override_hide_functions = {
|
||||
"smlua_deprecated.h": [ ".*" ],
|
||||
"network_player.h": [ "network_player_get_palette_color_channel", "network_player_get_override_palette_color_channel" ]
|
||||
"network_player.h": [ "network_player_get_palette_color_channel", "network_player_get_override_palette_color_channel" ],
|
||||
}
|
||||
|
||||
override_function_version_excludes = {
|
||||
"bhv_play_music_track_when_touched_loop": "VERSION_JP",
|
||||
"play_knockback_sound": "VERSION_JP",
|
||||
"cur_obj_spawn_star_at_y_offset": "VERSION_JP"
|
||||
"cur_obj_spawn_star_at_y_offset": "VERSION_JP",
|
||||
}
|
||||
|
||||
lua_function_params = {
|
||||
"src/pc/lua/utils/smlua_obj_utils.h::spawn_object_sync::objSetupFunction": [ "struct Object*" ]
|
||||
"src/pc/lua/utils/smlua_obj_utils.h::spawn_object_sync::objSetupFunction": [ "struct Object*" ],
|
||||
}
|
||||
|
||||
parameter_keywords = [
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ in_files = [
|
|||
"src/game/first_person_cam.h",
|
||||
"src/game/player_palette.h",
|
||||
"src/engine/graph_node.h",
|
||||
"include/PR/gbi.h"
|
||||
"include/PR/gbi.h",
|
||||
]
|
||||
|
||||
out_filename_c = 'src/pc/lua/smlua_cobject_autogen.c'
|
||||
|
|
@ -81,7 +81,7 @@ override_field_mutable = {
|
|||
"NetworkPlayer": [
|
||||
"overrideModelIndex",
|
||||
"overridePalette",
|
||||
"overridePaletteIndex"
|
||||
"overridePaletteIndex",
|
||||
],
|
||||
"Animation": [
|
||||
"values",
|
||||
|
|
@ -104,7 +104,7 @@ override_field_invisible = {
|
|||
}
|
||||
|
||||
override_field_deprecated = {
|
||||
"NetworkPlayer": [ "paletteIndex", "overridePaletteIndex", "overridePaletteIndexLp" ]
|
||||
"NetworkPlayer": [ "paletteIndex", "overridePaletteIndex", "overridePaletteIndexLp" ],
|
||||
}
|
||||
|
||||
override_field_immutable = {
|
||||
|
|
@ -147,7 +147,7 @@ override_field_immutable = {
|
|||
|
||||
override_field_version_excludes = {
|
||||
"oCameraLakituUnk104": "VERSION_JP",
|
||||
"oCoinUnk1B0": "VERSION_JP"
|
||||
"oCoinUnk1B0": "VERSION_JP",
|
||||
}
|
||||
|
||||
override_allowed_structs = {
|
||||
|
|
@ -155,7 +155,7 @@ override_allowed_structs = {
|
|||
"src/pc/djui/djui_types.h": [ "DjuiColor" ],
|
||||
"src/game/player_palette.h": [ "PlayerPalette" ],
|
||||
"src/game/ingame_menu.h" : [ "DialogEntry" ],
|
||||
"include/PR/gbi.h": [ "Gfx", "Vtx" ]
|
||||
"include/PR/gbi.h": [ "Gfx", "Vtx" ],
|
||||
}
|
||||
|
||||
sLuaManuallyDefinedStructs = [{
|
||||
|
|
@ -173,7 +173,7 @@ sLuaManuallyDefinedStructs = [{
|
|||
|
||||
override_types = {
|
||||
"Gwords": "Gfx",
|
||||
"Vtx_L": "Vtx"
|
||||
"Vtx_L": "Vtx",
|
||||
}
|
||||
reversed_override_types = {v: k for k, v in override_types.items()}
|
||||
|
||||
|
|
|
|||
|
|
@ -3611,6 +3611,9 @@ HUD_DISPLAY_DEFAULT = HUD_DISPLAY_FLAG_LIVES | HUD_DISPLAY_FLAG_CO
|
|||
--- | `HUD_DISPLAY_NONE`
|
||||
--- | `HUD_DISPLAY_DEFAULT`
|
||||
|
||||
--- @type integer
|
||||
LE_MAX_LIGHTS = 128
|
||||
|
||||
LE_MODE_AFFECT_ALL_SHADED_AND_COLORED = 0 --- @type LEMode
|
||||
LE_MODE_AFFECT_ALL_SHADED = 1 --- @type LEMode
|
||||
LE_MODE_AFFECT_ONLY_GEOMETRY_MODE = 2 --- @type LEMode
|
||||
|
|
|
|||
|
|
@ -2915,33 +2915,8 @@ function uv_update_scroll()
|
|||
-- ...
|
||||
end
|
||||
|
||||
--- @param x number
|
||||
--- @param y number
|
||||
--- @param z number
|
||||
--- @param r integer
|
||||
--- @param g integer
|
||||
--- @param b integer
|
||||
--- @return Object
|
||||
--- Spawns a lighting engine point light
|
||||
function spawn_ambient_light(x, y, z, r, g, b)
|
||||
-- ...
|
||||
end
|
||||
|
||||
--- @param x number
|
||||
--- @param y number
|
||||
--- @param z number
|
||||
--- @param r integer
|
||||
--- @param g integer
|
||||
--- @param b integer
|
||||
--- @param radius number
|
||||
--- @return Object
|
||||
--- Spawns a lighting engine ambient light
|
||||
function spawn_point_light(x, y, z, r, g, b, radius)
|
||||
-- ...
|
||||
end
|
||||
|
||||
--- Behavior loop function for the lighting engine ambient light. Takes the first 3 behavior parameter bytes for RGB color
|
||||
function bhv_ambient_light_update()
|
||||
--- Behavior init function for the lighting engine ambient light. Takes the first 3 behavior parameter bytes for RGB color
|
||||
function bhv_ambient_light_init()
|
||||
-- ...
|
||||
end
|
||||
|
||||
|
|
@ -5041,7 +5016,7 @@ function le_set_tone_mapping(toneMapping)
|
|||
end
|
||||
|
||||
--- @return boolean
|
||||
--- Gets whether the lighting engine has been enabled or not. It becomes enabled once a light is added.
|
||||
--- Gets whether the lighting engine has been enabled or not. It becomes enabled once a light is added or the ambient color is set
|
||||
function le_is_enabled()
|
||||
-- ...
|
||||
end
|
||||
|
|
@ -5096,6 +5071,19 @@ function le_get_light_count()
|
|||
-- ...
|
||||
end
|
||||
|
||||
--- @param id integer
|
||||
--- @return boolean
|
||||
--- Checks if a lighting engine point light exists
|
||||
function le_light_exists(id)
|
||||
-- ...
|
||||
end
|
||||
|
||||
--- @param out Color
|
||||
--- Outputs the lighting engine's ambient color to `out`
|
||||
function le_get_ambient_color(out)
|
||||
-- ...
|
||||
end
|
||||
|
||||
--- @param r integer
|
||||
--- @param g integer
|
||||
--- @param b integer
|
||||
|
|
@ -5104,6 +5092,13 @@ function le_set_ambient_color(r, g, b)
|
|||
-- ...
|
||||
end
|
||||
|
||||
--- @param id integer
|
||||
--- @param out Vec3f
|
||||
--- Outputs a lighting engine point light's position to `out`
|
||||
function le_get_light_pos(id, out)
|
||||
-- ...
|
||||
end
|
||||
|
||||
--- @param id integer
|
||||
--- @param x number
|
||||
--- @param y number
|
||||
|
|
@ -5113,6 +5108,13 @@ function le_set_light_pos(id, x, y, z)
|
|||
-- ...
|
||||
end
|
||||
|
||||
--- @param id integer
|
||||
--- @param out Color
|
||||
--- Outputs a lighting engine point light's color to `out`
|
||||
function le_get_light_color(id, out)
|
||||
-- ...
|
||||
end
|
||||
|
||||
--- @param id integer
|
||||
--- @param r integer
|
||||
--- @param g integer
|
||||
|
|
@ -5122,6 +5124,13 @@ function le_set_light_color(id, r, g, b)
|
|||
-- ...
|
||||
end
|
||||
|
||||
--- @param id integer
|
||||
--- @return number
|
||||
--- Gets a lighting engine point light's `radius`
|
||||
function le_get_light_radius(id)
|
||||
-- ...
|
||||
end
|
||||
|
||||
--- @param id integer
|
||||
--- @param radius number
|
||||
--- Sets a lighting engine point light's `radius`
|
||||
|
|
@ -5129,6 +5138,13 @@ function le_set_light_radius(id, radius)
|
|||
-- ...
|
||||
end
|
||||
|
||||
--- @param id integer
|
||||
--- @return number
|
||||
--- Gets a lighting engine point light's `intensity`
|
||||
function le_get_light_intensity(id)
|
||||
-- ...
|
||||
end
|
||||
|
||||
--- @param id integer
|
||||
--- @param intensity number
|
||||
--- Sets a lighting engine point light's `intensity`
|
||||
|
|
@ -5136,6 +5152,13 @@ function le_set_light_intensity(id, intensity)
|
|||
-- ...
|
||||
end
|
||||
|
||||
--- @param id integer
|
||||
--- @return boolean
|
||||
--- Gets whether a lighting engine point light will use a surface's normals to determine its brightness with `useSurfaceNormals`
|
||||
function le_get_light_use_surface_normals(id)
|
||||
-- ...
|
||||
end
|
||||
|
||||
--- @param id integer
|
||||
--- @param useSurfaceNormals boolean
|
||||
--- Sets whether a lighting engine point light will use a surface's normals to determine its brightness with `useSurfaceNormals`
|
||||
|
|
|
|||
|
|
@ -1746,7 +1746,6 @@
|
|||
--- @field public oKoopaTurningAwayFromWall integer
|
||||
--- @field public oKoopaUnshelledTimeUntilTurn integer
|
||||
--- @field public oLightID integer
|
||||
--- @field public oLightRadius number
|
||||
--- @field public oLllRotatingHexFlameUnkF4 number
|
||||
--- @field public oLllRotatingHexFlameUnkF8 number
|
||||
--- @field public oLllRotatingHexFlameUnkFC number
|
||||
|
|
|
|||
|
|
@ -6440,9 +6440,7 @@ const BehaviorScript editor_Scroll_Texture[] = {
|
|||
const BehaviorScript bhvAmbientLight[] = {
|
||||
BEGIN(OBJ_LIST_DEFAULT),
|
||||
ID(id_bhvAmbientLight),
|
||||
BEGIN_LOOP(),
|
||||
CALL_NATIVE(bhv_ambient_light_update),
|
||||
END_LOOP(),
|
||||
CALL_NATIVE(bhv_ambient_light_init),
|
||||
};
|
||||
|
||||
const BehaviorScript bhvPointLight[] = {
|
||||
|
|
|
|||
|
|
@ -2030,7 +2030,7 @@ static const void* sDynosBuiltinFuncs[] = {
|
|||
define_builtin(spawn_star_number),
|
||||
define_builtin(bhv_ferris_wheel_platform_init),
|
||||
define_builtin(geo_mario_cap_display_list),
|
||||
define_builtin(bhv_ambient_light_update),
|
||||
define_builtin(bhv_ambient_light_init),
|
||||
define_builtin(bhv_point_light_init),
|
||||
define_builtin(bhv_point_light_loop),
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1635,6 +1635,7 @@
|
|||
<br />
|
||||
|
||||
## [lighting_engine.h](#lighting_engine.h)
|
||||
- LE_MAX_LIGHTS
|
||||
|
||||
### [enum LEMode](#LEMode)
|
||||
| Identifier | Value |
|
||||
|
|
|
|||
|
|
@ -11942,70 +11942,13 @@ Behavior loop function for UV texture scrolling
|
|||
|
||||
<br />
|
||||
|
||||
## [spawn_ambient_light](#spawn_ambient_light)
|
||||
## [bhv_ambient_light_init](#bhv_ambient_light_init)
|
||||
|
||||
### Description
|
||||
Spawns a lighting engine point light
|
||||
Behavior init function for the lighting engine ambient light. Takes the first 3 behavior parameter bytes for RGB color
|
||||
|
||||
### Lua Example
|
||||
`local ObjectValue = spawn_ambient_light(x, y, z, r, g, b)`
|
||||
|
||||
### Parameters
|
||||
| Field | Type |
|
||||
| ----- | ---- |
|
||||
| x | `number` |
|
||||
| y | `number` |
|
||||
| z | `number` |
|
||||
| r | `integer` |
|
||||
| g | `integer` |
|
||||
| b | `integer` |
|
||||
|
||||
### Returns
|
||||
[Object](structs.md#Object)
|
||||
|
||||
### C Prototype
|
||||
`struct Object* spawn_ambient_light(f32 x, f32 y, f32 z, u8 r, u8 g, u8 b);`
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [spawn_point_light](#spawn_point_light)
|
||||
|
||||
### Description
|
||||
Spawns a lighting engine ambient light
|
||||
|
||||
### Lua Example
|
||||
`local ObjectValue = spawn_point_light(x, y, z, r, g, b, radius)`
|
||||
|
||||
### Parameters
|
||||
| Field | Type |
|
||||
| ----- | ---- |
|
||||
| x | `number` |
|
||||
| y | `number` |
|
||||
| z | `number` |
|
||||
| r | `integer` |
|
||||
| g | `integer` |
|
||||
| b | `integer` |
|
||||
| radius | `number` |
|
||||
|
||||
### Returns
|
||||
[Object](structs.md#Object)
|
||||
|
||||
### C Prototype
|
||||
`struct Object* spawn_point_light(f32 x, f32 y, f32 z, u8 r, u8 g, u8 b, f32 radius);`
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [bhv_ambient_light_update](#bhv_ambient_light_update)
|
||||
|
||||
### Description
|
||||
Behavior loop function for the lighting engine ambient light. Takes the first 3 behavior parameter bytes for RGB color
|
||||
|
||||
### Lua Example
|
||||
`bhv_ambient_light_update()`
|
||||
`bhv_ambient_light_init()`
|
||||
|
||||
### Parameters
|
||||
- None
|
||||
|
|
@ -12014,7 +11957,7 @@ Behavior loop function for the lighting engine ambient light. Takes the first 3
|
|||
- None
|
||||
|
||||
### C Prototype
|
||||
`void bhv_ambient_light_update(void);`
|
||||
`void bhv_ambient_light_init(void);`
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
|
|
|
|||
|
|
@ -6703,7 +6703,7 @@ Sets the lighting engine's tone mapping mode to `toneMapping`
|
|||
## [le_is_enabled](#le_is_enabled)
|
||||
|
||||
### Description
|
||||
Gets whether the lighting engine has been enabled or not. It becomes enabled once a light is added.
|
||||
Gets whether the lighting engine has been enabled or not. It becomes enabled once a light is added or the ambient color is set
|
||||
|
||||
### Lua Example
|
||||
`local booleanValue = le_is_enabled()`
|
||||
|
|
@ -6870,6 +6870,52 @@ Gets the total number of lights currently loaded in the lighting engine
|
|||
|
||||
<br />
|
||||
|
||||
## [le_light_exists](#le_light_exists)
|
||||
|
||||
### Description
|
||||
Checks if a lighting engine point light exists
|
||||
|
||||
### Lua Example
|
||||
`local booleanValue = le_light_exists(id)`
|
||||
|
||||
### Parameters
|
||||
| Field | Type |
|
||||
| ----- | ---- |
|
||||
| id | `integer` |
|
||||
|
||||
### Returns
|
||||
- `boolean`
|
||||
|
||||
### C Prototype
|
||||
`bool le_light_exists(s32 id);`
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [le_get_ambient_color](#le_get_ambient_color)
|
||||
|
||||
### Description
|
||||
Outputs the lighting engine's ambient color to `out`
|
||||
|
||||
### Lua Example
|
||||
`le_get_ambient_color(out)`
|
||||
|
||||
### Parameters
|
||||
| Field | Type |
|
||||
| ----- | ---- |
|
||||
| out | [Color](structs.md#Color) |
|
||||
|
||||
### Returns
|
||||
- None
|
||||
|
||||
### C Prototype
|
||||
`void le_get_ambient_color(OUT Color out);`
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [le_set_ambient_color](#le_set_ambient_color)
|
||||
|
||||
### Description
|
||||
|
|
@ -6895,6 +6941,30 @@ Sets the lighting engine ambient color
|
|||
|
||||
<br />
|
||||
|
||||
## [le_get_light_pos](#le_get_light_pos)
|
||||
|
||||
### Description
|
||||
Outputs a lighting engine point light's position to `out`
|
||||
|
||||
### Lua Example
|
||||
`le_get_light_pos(id, out)`
|
||||
|
||||
### Parameters
|
||||
| Field | Type |
|
||||
| ----- | ---- |
|
||||
| id | `integer` |
|
||||
| out | [Vec3f](structs.md#Vec3f) |
|
||||
|
||||
### Returns
|
||||
- None
|
||||
|
||||
### C Prototype
|
||||
`void le_get_light_pos(s32 id, OUT Vec3f out);`
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [le_set_light_pos](#le_set_light_pos)
|
||||
|
||||
### Description
|
||||
|
|
@ -6921,6 +6991,30 @@ Sets a lighting engine point light's position to `x`, `y`, `z`
|
|||
|
||||
<br />
|
||||
|
||||
## [le_get_light_color](#le_get_light_color)
|
||||
|
||||
### Description
|
||||
Outputs a lighting engine point light's color to `out`
|
||||
|
||||
### Lua Example
|
||||
`le_get_light_color(id, out)`
|
||||
|
||||
### Parameters
|
||||
| Field | Type |
|
||||
| ----- | ---- |
|
||||
| id | `integer` |
|
||||
| out | [Color](structs.md#Color) |
|
||||
|
||||
### Returns
|
||||
- None
|
||||
|
||||
### C Prototype
|
||||
`void le_get_light_color(s32 id, OUT Color out);`
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [le_set_light_color](#le_set_light_color)
|
||||
|
||||
### Description
|
||||
|
|
@ -6947,6 +7041,29 @@ Sets a lighting engine point light's color to `r`, `g`, `b`
|
|||
|
||||
<br />
|
||||
|
||||
## [le_get_light_radius](#le_get_light_radius)
|
||||
|
||||
### Description
|
||||
Gets a lighting engine point light's `radius`
|
||||
|
||||
### Lua Example
|
||||
`local numberValue = le_get_light_radius(id)`
|
||||
|
||||
### Parameters
|
||||
| Field | Type |
|
||||
| ----- | ---- |
|
||||
| id | `integer` |
|
||||
|
||||
### Returns
|
||||
- `number`
|
||||
|
||||
### C Prototype
|
||||
`f32 le_get_light_radius(s32 id);`
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [le_set_light_radius](#le_set_light_radius)
|
||||
|
||||
### Description
|
||||
|
|
@ -6971,6 +7088,29 @@ Sets a lighting engine point light's `radius`
|
|||
|
||||
<br />
|
||||
|
||||
## [le_get_light_intensity](#le_get_light_intensity)
|
||||
|
||||
### Description
|
||||
Gets a lighting engine point light's `intensity`
|
||||
|
||||
### Lua Example
|
||||
`local numberValue = le_get_light_intensity(id)`
|
||||
|
||||
### Parameters
|
||||
| Field | Type |
|
||||
| ----- | ---- |
|
||||
| id | `integer` |
|
||||
|
||||
### Returns
|
||||
- `number`
|
||||
|
||||
### C Prototype
|
||||
`f32 le_get_light_intensity(s32 id);`
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [le_set_light_intensity](#le_set_light_intensity)
|
||||
|
||||
### Description
|
||||
|
|
@ -6995,6 +7135,29 @@ Sets a lighting engine point light's `intensity`
|
|||
|
||||
<br />
|
||||
|
||||
## [le_get_light_use_surface_normals](#le_get_light_use_surface_normals)
|
||||
|
||||
### Description
|
||||
Gets whether a lighting engine point light will use a surface's normals to determine its brightness with `useSurfaceNormals`
|
||||
|
||||
### Lua Example
|
||||
`local booleanValue = le_get_light_use_surface_normals(id)`
|
||||
|
||||
### Parameters
|
||||
| Field | Type |
|
||||
| ----- | ---- |
|
||||
| id | `integer` |
|
||||
|
||||
### Returns
|
||||
- `boolean`
|
||||
|
||||
### C Prototype
|
||||
`bool le_get_light_use_surface_normals(s32 id);`
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [le_set_light_use_surface_normals](#le_set_light_use_surface_normals)
|
||||
|
||||
### Description
|
||||
|
|
|
|||
|
|
@ -605,9 +605,7 @@
|
|||
- [bhv_yoshi_loop](functions-2.md#bhv_yoshi_loop)
|
||||
- [bhv_volcano_trap_loop](functions-2.md#bhv_volcano_trap_loop)
|
||||
- [uv_update_scroll](functions-2.md#uv_update_scroll)
|
||||
- [spawn_ambient_light](functions-2.md#spawn_ambient_light)
|
||||
- [spawn_point_light](functions-2.md#spawn_point_light)
|
||||
- [bhv_ambient_light_update](functions-2.md#bhv_ambient_light_update)
|
||||
- [bhv_ambient_light_init](functions-2.md#bhv_ambient_light_init)
|
||||
- [bhv_point_light_init](functions-2.md#bhv_point_light_init)
|
||||
- [bhv_point_light_loop](functions-2.md#bhv_point_light_loop)
|
||||
- [spawn_default_star](functions-2.md#spawn_default_star)
|
||||
|
|
@ -974,11 +972,18 @@
|
|||
- [le_add_light](functions-3.md#le_add_light)
|
||||
- [le_remove_light](functions-3.md#le_remove_light)
|
||||
- [le_get_light_count](functions-3.md#le_get_light_count)
|
||||
- [le_light_exists](functions-3.md#le_light_exists)
|
||||
- [le_get_ambient_color](functions-3.md#le_get_ambient_color)
|
||||
- [le_set_ambient_color](functions-3.md#le_set_ambient_color)
|
||||
- [le_get_light_pos](functions-3.md#le_get_light_pos)
|
||||
- [le_set_light_pos](functions-3.md#le_set_light_pos)
|
||||
- [le_get_light_color](functions-3.md#le_get_light_color)
|
||||
- [le_set_light_color](functions-3.md#le_set_light_color)
|
||||
- [le_get_light_radius](functions-3.md#le_get_light_radius)
|
||||
- [le_set_light_radius](functions-3.md#le_set_light_radius)
|
||||
- [le_get_light_intensity](functions-3.md#le_get_light_intensity)
|
||||
- [le_set_light_intensity](functions-3.md#le_set_light_intensity)
|
||||
- [le_get_light_use_surface_normals](functions-3.md#le_get_light_use_surface_normals)
|
||||
- [le_set_light_use_surface_normals](functions-3.md#le_set_light_use_surface_normals)
|
||||
|
||||
<br />
|
||||
|
|
|
|||
95
docs/lua/guides/lighting-engine.md
Normal file
95
docs/lua/guides/lighting-engine.md
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
# How to use the Lighting Engine
|
||||
|
||||
## Section 1: Preparation
|
||||
|
||||
The Lighting Engine is a vertex point lighting system built directly into sm64coopdx and its renderer. It works on all backends and is relatively easy to use.
|
||||
|
||||
To use the Lighting Engine, you need to figure out how you want to approach using it given the different modes it has. There are also 2 methods to enable the lighting engine, either by setting the ambient color, or spawning a point light in.
|
||||
|
||||
## Section 2: Modes
|
||||
|
||||
The lighting engine has 3 modes you can switch between using `le_set_mode(mode)`.
|
||||
|
||||
1. `LE_MODE_AFFECT_ALL_SHADED_AND_COLORED`: (Default) Applies lighting to every shaded and vertex colored surface minus some geometry and menus.
|
||||
|
||||
2. `LE_MODE_AFFECT_ALL_SHADED`: Applies lighting to every shaded surface minus some geometry and menus.
|
||||
|
||||
3. `LE_MODE_AFFECT_ONLY_GEOMETRY_MODE`: Only applies lighting to geometry that has the `G_LIGHTING_ENGINE_EXT` geometry mode.
|
||||
|
||||
`LE_MODE_AFFECT_ONLY_GEOMETRY_MODE` was the only "mode" until djoslin0 improved the lighting engine and came up with a system for affecting shaded surfaces without needing to apply the lighting engine geometry mode to every actor and level manually.
|
||||
|
||||
## Section 3: Tonemapping
|
||||
|
||||
The lighting engine has 4 tonemapping modes you can switch between using `le_set_tone_mapping(toneMapping)`.
|
||||
|
||||
1. `LE_TONE_MAPPING_TOTAL_WEIGHTED`: Weighs the combined ambient color and lights together, can look slightly dim.
|
||||
|
||||
2. `LE_TONE_MAPPING_WEIGHTED`: (Default) Weights the lights on top of the ambient color instead of with it, generally looks the best with good color balance.
|
||||
|
||||
3. `LE_TONE_MAPPING_CLAMP`: The sum of the lights and ambient color clamped between 0 and 255. Colors can look overexposed if lights are too bright.
|
||||
|
||||
4. `LE_TONE_MAPPING_REINHARD`: The sum of the lights and ambient color divided by itself + 255, multiplied by 255, and then clamped between 0 and 255. Looks like clamped but dimmed.
|
||||
|
||||
You can see the visual differences of the different tonemappings in [this video](https://youtu.be/TJ_qnzi8YHA?t=25).
|
||||
|
||||
## Section 4: Ambient Light
|
||||
|
||||
There are two ways you can set the ambient color for the scene.
|
||||
|
||||
### 1. `le_set_ambient_color(r, g, b)`
|
||||
To set the ambient color directly through code.
|
||||
|
||||
### 2. `bhvAmbientLight` object with `0xRRGGBB00` behavior parameters
|
||||
The first 3 bytes are for the red, green, and blue values. This will set the ambient color once on init but not on loop so changing the ambient color is possible.
|
||||
|
||||
**Be mindful of an annoying SM64 engine quirk**: If you set the third byte to 255, which the game uses to store respawn bit information, it will think the light has already been spawned and it won't spawn. There isn't really a way around this except using 254 instead of 255, but `le_set_ambient_color` does not have this quirk and you can use 255 for the third value.
|
||||
|
||||
## Section 5: Point Lights
|
||||
|
||||
There are two ways you can add point lights in the scene.
|
||||
|
||||
### 1. `le_add_light(x, y, z, r, g, b, radius, intensity)`
|
||||
To spawn a point light directly through code.
|
||||
|
||||
| Parameter | Description |
|
||||
| --------- | ----------- |
|
||||
| `x` | X coordinate |
|
||||
| `y` | Y coordinate |
|
||||
| `z` | Z coordinate |
|
||||
| `r` | Red value |
|
||||
| `g` | Green value |
|
||||
| `b` | Blue value |
|
||||
| `radius` | How many units out the light should spread, 500-1000 units recommended. |
|
||||
| `intensity` | How much influence/brightness the light has, 2.0 recommended. |
|
||||
|
||||
### 2. `bhvPointLight` object with `0xRRGGBBWW` behavior parameters
|
||||
The first 3 bytes are for the red, green, and blue values. The Ws are an arbitrary letter I picked for the fourth byte to represent radius. Due to only having one byte to represent radius, I opted to make it so whatever you have for radius in the 4th byte gets multiplied by 10 for a bigger range. If you have `0x64` (100) then your light will have a radius of 1000. The default intensity is 2.
|
||||
|
||||
The point light object has some special exclusive behavior made possible from it being tied to the object system instead of a separate list. If you give it a parent object, the light will copy its position to the parent and delete itself when the parent is deleted. Other than that, changing the position of the light object will change the actual light's position but you are able to modify the other properties without it being forced by the object.
|
||||
|
||||
Initially, I made it so it always copied the color and radius to match behavior parameters but I figured it would be easier if you could just edit the properties directly without having to go through tedious behavior parameter bit shifting and whatnot.
|
||||
|
||||
You can also make your own light behavior and call `bhv_point_light_init()` and or `bhv_point_light_loop()` if you just want to add onto the behavior for your version.
|
||||
|
||||
## Section 6: Light Functions
|
||||
|
||||
| Function | Description |
|
||||
| -------- | ----------- |
|
||||
| `le_is_enabled()` | Gets whether the lighting engine has been enabled or not. It becomes enabled once a light is added or the ambient color is set |
|
||||
| `le_calculate_lighting_color(pos, out, lightIntensityScalar)` | In case you wanted to calculate lighting color in Lua for whatever reason. Calculates the lighting with `lightIntensityScalar` at a position and outputs the color in `out` |
|
||||
| `le_calculate_lighting_color_with_normal(pos, normal, out, lightIntensityScalar)` | Calculates the lighting with `lightIntensityScalar` at a position and with a normal and outputs the color in `out` |
|
||||
| `le_calculate_lighting_dir(pos, out)` | An additional function not used by the lighting engine. Calculates the lighting direction from a position and outputs the result in `out` |
|
||||
| `le_remove_light()` | Removes a lighting engine point light corresponding to `id` |
|
||||
| `le_get_light_count()` | Gets the total number of lights currently loaded in the lighting engine |
|
||||
| `le_light_exists()` | Checks if a lighting engine point light corresponding to `id` exists |
|
||||
| `le_get_ambient_color(out)` | Outputs the lighting engine's ambient color to `out` |
|
||||
| `le_get_light_pos(id, out)` | Outputs a lighting engine point light's position to `out` |
|
||||
| `le_set_light_pos(id, x, y, z)` | Sets a lighting engine point light's position to `x`, `y`, `z` |
|
||||
| `le_get_light_color(id, out)` | Outputs a lighting engine point light's color to `out` |
|
||||
| `le_set_light_color(id, r, g, b)` | Sets a lighting engine point light's color to `r`, `g`, `b` |
|
||||
| `le_get_light_radius(id)` | Gets a lighting engine point light's `radius` |
|
||||
| `le_set_light_radius(id, radius)` | Sets a lighting engine point light's `radius` |
|
||||
| `le_get_light_intensity(id)` | Gets a lighting engine point light's `intensity` |
|
||||
| `le_set_light_intensity(id, intensity)` | Sets a lighting engine point light's `intensity` |
|
||||
| `le_get_light_use_surface_normals(id)` | Gets whether a lighting engine point light will use a surface's normals to determine its brightness with `useSurfaceNormals` |
|
||||
| `le_set_light_use_surface_normals(id, useSurfaceNormals)` | Sets whether a lighting engine point light will use a surface's normals to determine its brightness with `useSurfaceNormals` |
|
||||
|
|
@ -2833,7 +2833,6 @@
|
|||
| oYoshiTargetYaw | `integer` | |
|
||||
| oBreakableWallForce | `integer` | |
|
||||
| oLightID | `integer` | |
|
||||
| oLightRadius | `number` | |
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
|
|
|
|||
|
|
@ -1177,6 +1177,5 @@
|
|||
|
||||
/* Point Light */
|
||||
#define /*0x0F4*/ oLightID OBJECT_FIELD_S32(0x1B)
|
||||
#define /*0x0F8*/ oLightRadius OBJECT_FIELD_F32(0x1C)
|
||||
|
||||
#endif // OBJECT_FIELDS_H
|
||||
|
|
|
|||
|
|
@ -4,8 +4,6 @@
|
|||
#include "pc/debuglog.h"
|
||||
#include "data/dynos_cmap.cpp.h"
|
||||
|
||||
#define LE_MAX_LIGHTS 256
|
||||
|
||||
Color gLEAmbientColor = { 127, 127, 127 };
|
||||
static void* sLights = NULL;
|
||||
static s32 sLightID = 0;
|
||||
|
|
@ -19,6 +17,12 @@ static inline void color_set(Color color, u8 r, u8 g, u8 b) {
|
|||
color[2] = b;
|
||||
}
|
||||
|
||||
static inline void color_copy(Color dest, Color src) {
|
||||
dest[0] = src[0];
|
||||
dest[1] = src[1];
|
||||
dest[2] = src[2];
|
||||
}
|
||||
|
||||
bool le_is_enabled(void) {
|
||||
// this is needed because we don't want to make vanilla darker,
|
||||
// and we don't want to set the ambient color to { 255, 255, 255 }
|
||||
|
|
@ -38,44 +42,44 @@ void le_set_tone_mapping(enum LEToneMapping toneMapping) {
|
|||
sToneMapping = toneMapping;
|
||||
}
|
||||
|
||||
static inline void le_tone_map_total_weighted(OUT Color out, Color in_ambient, Vec3f in_color, float weight) {
|
||||
out[0] = clamp((in_ambient[0] + in_color[0]) / weight, 0, 255);
|
||||
out[1] = clamp((in_ambient[1] + in_color[1]) / weight, 0, 255);
|
||||
out[2] = clamp((in_ambient[2] + in_color[2]) / weight, 0, 255);
|
||||
static inline void le_tone_map_total_weighted(Color out, Color inAmbient, Vec3f inColor, float weight) {
|
||||
out[0] = clamp((inAmbient[0] + inColor[0]) / weight, 0, 255);
|
||||
out[1] = clamp((inAmbient[1] + inColor[1]) / weight, 0, 255);
|
||||
out[2] = clamp((inAmbient[2] + inColor[2]) / weight, 0, 255);
|
||||
}
|
||||
|
||||
static inline void le_tone_map_weighted(OUT Color out, Color in_ambient, Vec3f in_color, float weight) {
|
||||
out[0] = clamp(in_ambient[0] + (in_color[0] / weight), 0, 255);
|
||||
out[1] = clamp(in_ambient[1] + (in_color[1] / weight), 0, 255);
|
||||
out[2] = clamp(in_ambient[2] + (in_color[2] / weight), 0, 255);
|
||||
static inline void le_tone_map_weighted(Color out, Color inAmbient, Vec3f inColor, float weight) {
|
||||
out[0] = clamp(inAmbient[0] + (inColor[0] / weight), 0, 255);
|
||||
out[1] = clamp(inAmbient[1] + (inColor[1] / weight), 0, 255);
|
||||
out[2] = clamp(inAmbient[2] + (inColor[2] / weight), 0, 255);
|
||||
}
|
||||
|
||||
static inline void le_tone_map_clamp(OUT Color out, Color in_ambient, Vec3f in_color) {
|
||||
out[0] = clamp(in_ambient[0] + in_color[0], 0, 255);
|
||||
out[1] = clamp(in_ambient[1] + in_color[1], 0, 255);
|
||||
out[2] = clamp(in_ambient[2] + in_color[2], 0, 255);
|
||||
static inline void le_tone_map_clamp(Color out, Color inAmbient, Vec3f inColor) {
|
||||
out[0] = clamp(inAmbient[0] + inColor[0], 0, 255);
|
||||
out[1] = clamp(inAmbient[1] + inColor[1], 0, 255);
|
||||
out[2] = clamp(inAmbient[2] + inColor[2], 0, 255);
|
||||
}
|
||||
|
||||
static inline void le_tone_map_reinhard(OUT Color out, Color in_ambient, Vec3f in_color) {
|
||||
in_color[0] += in_ambient[0];
|
||||
in_color[1] += in_ambient[1];
|
||||
in_color[2] += in_ambient[2];
|
||||
static inline void le_tone_map_reinhard(Color out, Color inAmbient, Vec3f inColor) {
|
||||
inColor[0] += inAmbient[0];
|
||||
inColor[1] += inAmbient[1];
|
||||
inColor[2] += inAmbient[2];
|
||||
|
||||
out[0] = clamp((in_color[0] / (in_color[0] + 255.0f)) * 255.0f, 0, 255);
|
||||
out[1] = clamp((in_color[1] / (in_color[1] + 255.0f)) * 255.0f, 0, 255);
|
||||
out[2] = clamp((in_color[2] / (in_color[2] + 255.0f)) * 255.0f, 0, 255);
|
||||
out[0] = clamp((inColor[0] / (inColor[0] + 255.0f)) * 255.0f, 0, 255);
|
||||
out[1] = clamp((inColor[1] / (inColor[1] + 255.0f)) * 255.0f, 0, 255);
|
||||
out[2] = clamp((inColor[2] / (inColor[2] + 255.0f)) * 255.0f, 0, 255);
|
||||
}
|
||||
|
||||
static inline void le_tone_map(OUT Color out, Color in_ambient, Vec3f in_color, float weight) {
|
||||
static inline void le_tone_map(Color out, Color inAmbient, Vec3f inColor, float weight) {
|
||||
switch (sToneMapping) {
|
||||
case LE_TONE_MAPPING_TOTAL_WEIGHTED: le_tone_map_total_weighted(out, in_ambient, in_color, weight); break;
|
||||
case LE_TONE_MAPPING_WEIGHTED: le_tone_map_weighted(out, in_ambient, in_color, weight); break;
|
||||
case LE_TONE_MAPPING_CLAMP: le_tone_map_clamp(out, in_ambient, in_color); break;
|
||||
case LE_TONE_MAPPING_REINHARD: le_tone_map_reinhard(out, in_ambient, in_color); break;
|
||||
case LE_TONE_MAPPING_TOTAL_WEIGHTED: le_tone_map_total_weighted(out, inAmbient, inColor, weight); break;
|
||||
case LE_TONE_MAPPING_WEIGHTED: le_tone_map_weighted(out, inAmbient, inColor, weight); break;
|
||||
case LE_TONE_MAPPING_CLAMP: le_tone_map_clamp(out, inAmbient, inColor); break;
|
||||
case LE_TONE_MAPPING_REINHARD: le_tone_map_reinhard(out, inAmbient, inColor); break;
|
||||
}
|
||||
}
|
||||
|
||||
static inline void le_calculate_light_contribution(struct LELight* light, Vec3f pos, Vec3f normal, f32 lightIntensityScalar, OUT Vec3f out_color, OUT f32* weight) {
|
||||
static inline void le_calculate_light_contribution(struct LELight* light, Vec3f pos, Vec3f normal, f32 lightIntensityScalar, Vec3f out_color, f32* weight) {
|
||||
// skip 'inactive' lights
|
||||
if (light->intensity <= 0 || light->radius <= 0) { return; }
|
||||
|
||||
|
|
@ -115,7 +119,7 @@ static inline void le_calculate_light_contribution(struct LELight* light, Vec3f
|
|||
*weight += brightness;
|
||||
}
|
||||
|
||||
void le_calculate_vertex_lighting(Vtx_t* v, Vec3f pos, OUT Color out) {
|
||||
void le_calculate_vertex_lighting(Vtx_t* v, Vec3f pos, Color out) {
|
||||
if (sLights == NULL) { return; }
|
||||
|
||||
// clear color
|
||||
|
|
@ -136,7 +140,7 @@ void le_calculate_vertex_lighting(Vtx_t* v, Vec3f pos, OUT Color out) {
|
|||
le_tone_map(out, vtxAmbient, color, weight);
|
||||
}
|
||||
|
||||
void le_calculate_lighting_color(Vec3f pos, OUT Color out, f32 lightIntensityScalar) {
|
||||
void le_calculate_lighting_color(Vec3f pos, Color out, f32 lightIntensityScalar) {
|
||||
if (sLights == NULL) { return; }
|
||||
|
||||
// clear color
|
||||
|
|
@ -152,7 +156,7 @@ void le_calculate_lighting_color(Vec3f pos, OUT Color out, f32 lightIntensitySca
|
|||
le_tone_map(out, gLEAmbientColor, color, weight);
|
||||
}
|
||||
|
||||
void le_calculate_lighting_color_with_normal(Vec3f pos, Vec3f normal, OUT Color out, f32 lightIntensityScalar) {
|
||||
void le_calculate_lighting_color_with_normal(Vec3f pos, Vec3f normal, Color out, f32 lightIntensityScalar) {
|
||||
if (sLights == NULL) { return; }
|
||||
|
||||
// normalize normal
|
||||
|
|
@ -171,7 +175,7 @@ void le_calculate_lighting_color_with_normal(Vec3f pos, Vec3f normal, OUT Color
|
|||
le_tone_map(out, gLEAmbientColor, color, weight);
|
||||
}
|
||||
|
||||
void le_calculate_lighting_dir(Vec3f pos, OUT Vec3f out) {
|
||||
void le_calculate_lighting_dir(Vec3f pos, Vec3f out) {
|
||||
if (sLights == NULL) { return; }
|
||||
|
||||
Vec3f lightingDir = { 0, 0, 0 };
|
||||
|
|
@ -240,11 +244,28 @@ s32 le_get_light_count(void) {
|
|||
return hmap_len(sLights);
|
||||
}
|
||||
|
||||
bool le_light_exists(s32 id) {
|
||||
if (sLights == NULL || id <= 0) { return false; }
|
||||
return hmap_get(sLights, id) != NULL;
|
||||
}
|
||||
|
||||
void le_get_ambient_color(OUT Color out) {
|
||||
color_copy(out, gLEAmbientColor);
|
||||
}
|
||||
|
||||
void le_set_ambient_color(u8 r, u8 g, u8 b) {
|
||||
color_set(gLEAmbientColor, r, g, b);
|
||||
sEnabled = true;
|
||||
}
|
||||
|
||||
void le_get_light_pos(s32 id, OUT Vec3f out) {
|
||||
if (sLights == NULL || id <= 0) { return; }
|
||||
|
||||
struct LELight* light = hmap_get(sLights, id);
|
||||
if (light == NULL) { return; }
|
||||
vec3f_set(out, light->posX, light->posY, light->posZ);
|
||||
}
|
||||
|
||||
void le_set_light_pos(s32 id, f32 x, f32 y, f32 z) {
|
||||
if (sLights == NULL || id <= 0) { return; }
|
||||
|
||||
|
|
@ -255,6 +276,14 @@ void le_set_light_pos(s32 id, f32 x, f32 y, f32 z) {
|
|||
light->posZ = z;
|
||||
}
|
||||
|
||||
void le_get_light_color(s32 id, OUT Color out) {
|
||||
if (sLights == NULL || id <= 0) { return; }
|
||||
|
||||
struct LELight* light = hmap_get(sLights, id);
|
||||
if (light == NULL) { return; }
|
||||
color_set(out, light->colorR, light->colorG, light->colorB);
|
||||
}
|
||||
|
||||
void le_set_light_color(s32 id, u8 r, u8 g, u8 b) {
|
||||
if (sLights == NULL || id <= 0) { return; }
|
||||
|
||||
|
|
@ -265,6 +294,14 @@ void le_set_light_color(s32 id, u8 r, u8 g, u8 b) {
|
|||
light->colorB = b;
|
||||
}
|
||||
|
||||
f32 le_get_light_radius(s32 id) {
|
||||
if (sLights == NULL || id <= 0) { return 0.0f; }
|
||||
|
||||
struct LELight* light = hmap_get(sLights, id);
|
||||
if (light == NULL) { return 0.0f; }
|
||||
return light->radius;
|
||||
}
|
||||
|
||||
void le_set_light_radius(s32 id, f32 radius) {
|
||||
if (sLights == NULL || id <= 0) { return; }
|
||||
|
||||
|
|
@ -273,6 +310,14 @@ void le_set_light_radius(s32 id, f32 radius) {
|
|||
light->radius = radius;
|
||||
}
|
||||
|
||||
f32 le_get_light_intensity(s32 id) {
|
||||
if (sLights == NULL || id <= 0) { return 0.0f; }
|
||||
|
||||
struct LELight* light = hmap_get(sLights, id);
|
||||
if (light == NULL) { return 0.0f; }
|
||||
return light->intensity;
|
||||
}
|
||||
|
||||
void le_set_light_intensity(s32 id, f32 intensity) {
|
||||
if (sLights == NULL || id <= 0) { return; }
|
||||
|
||||
|
|
@ -281,6 +326,14 @@ void le_set_light_intensity(s32 id, f32 intensity) {
|
|||
light->intensity = intensity;
|
||||
}
|
||||
|
||||
bool le_get_light_use_surface_normals(s32 id) {
|
||||
if (sLights == NULL || id <= 0) { return false; }
|
||||
|
||||
struct LELight* light = hmap_get(sLights, id);
|
||||
if (light == NULL) { return false; }
|
||||
return light->useSurfaceNormals;
|
||||
}
|
||||
|
||||
void le_set_light_use_surface_normals(s32 id, bool useSurfaceNormals) {
|
||||
if (sLights == NULL || id <= 0) { return; }
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@
|
|||
|
||||
#include "types.h"
|
||||
|
||||
#define LE_MAX_LIGHTS 128
|
||||
|
||||
struct LELight
|
||||
{
|
||||
f32 posX;
|
||||
|
|
@ -37,7 +39,7 @@ void le_set_mode(enum LEMode mode);
|
|||
enum LEMode le_get_mode(void);
|
||||
/* |description|Sets the lighting engine's tone mapping mode to `toneMapping`|descriptionEnd|*/
|
||||
void le_set_tone_mapping(enum LEToneMapping toneMapping);
|
||||
/* |description|Gets whether the lighting engine has been enabled or not. It becomes enabled once a light is added.|descriptionEnd|*/
|
||||
/* |description|Gets whether the lighting engine has been enabled or not. It becomes enabled once a light is added or the ambient color is set|descriptionEnd|*/
|
||||
bool le_is_enabled(void);
|
||||
|
||||
void le_calculate_vertex_lighting(Vtx_t* v, Vec3f pos, OUT Color out);
|
||||
|
|
@ -53,16 +55,30 @@ s32 le_add_light(f32 x, f32 y, f32 z, u8 r, u8 g, u8 b, f32 radius, f32 intensit
|
|||
void le_remove_light(s32 id);
|
||||
/* |description|Gets the total number of lights currently loaded in the lighting engine|descriptionEnd| */
|
||||
s32 le_get_light_count(void);
|
||||
/* |description|Checks if a lighting engine point light corresponding to `id` exists|descriptionEnd| */
|
||||
bool le_light_exists(s32 id);
|
||||
/* |description|Outputs the lighting engine's ambient color to `out`|descriptionEnd| */
|
||||
void le_get_ambient_color(OUT Color out);
|
||||
/* |description|Sets the lighting engine ambient color|descriptionEnd| */
|
||||
void le_set_ambient_color(u8 r, u8 g, u8 b);
|
||||
/* |description|Outputs a lighting engine point light's position to `out`|descriptionEnd| */
|
||||
void le_get_light_pos(s32 id, OUT Vec3f out);
|
||||
/* |description|Sets a lighting engine point light's position to `x`, `y`, `z`|descriptionEnd| */
|
||||
void le_set_light_pos(s32 id, f32 x, f32 y, f32 z);
|
||||
/* |description|Outputs a lighting engine point light's color to `out`|descriptionEnd| */
|
||||
void le_get_light_color(s32 id, OUT Color out);
|
||||
/* |description|Sets a lighting engine point light's color to `r`, `g`, `b`|descriptionEnd| */
|
||||
void le_set_light_color(s32 id, u8 r, u8 g, u8 b);
|
||||
/* |description|Gets a lighting engine point light's `radius`|descriptionEnd| */
|
||||
f32 le_get_light_radius(s32 id);
|
||||
/* |description|Sets a lighting engine point light's `radius`|descriptionEnd| */
|
||||
void le_set_light_radius(s32 id, f32 radius);
|
||||
/* |description|Gets a lighting engine point light's `intensity`|descriptionEnd| */
|
||||
f32 le_get_light_intensity(s32 id);
|
||||
/* |description|Sets a lighting engine point light's `intensity`|descriptionEnd| */
|
||||
void le_set_light_intensity(s32 id, f32 intensity);
|
||||
/* |description|Gets whether a lighting engine point light will use a surface's normals to determine its brightness with `useSurfaceNormals`|descriptionEnd| */
|
||||
bool le_get_light_use_surface_normals(s32 id);
|
||||
/* |description|Sets whether a lighting engine point light will use a surface's normals to determine its brightness with `useSurfaceNormals`|descriptionEnd| */
|
||||
void le_set_light_use_surface_normals(s32 id, bool useSurfaceNormals);
|
||||
void le_clear(void);
|
||||
|
|
|
|||
|
|
@ -1145,12 +1145,8 @@ void bhv_yoshi_loop(void);
|
|||
void bhv_volcano_trap_loop(void);
|
||||
/* |description|Behavior loop function for UV texture scrolling|descriptionEnd| */
|
||||
void uv_update_scroll(void);
|
||||
/* |description|Spawns a lighting engine point light|descriptionEnd| */
|
||||
struct Object* spawn_ambient_light(f32 x, f32 y, f32 z, u8 r, u8 g, u8 b);
|
||||
/* |description|Spawns a lighting engine ambient light|descriptionEnd| */
|
||||
struct Object* spawn_point_light(f32 x, f32 y, f32 z, u8 r, u8 g, u8 b, f32 radius);
|
||||
/* |description|Behavior loop function for the lighting engine ambient light. Takes the first 3 behavior parameter bytes for RGB color|descriptionEnd| */
|
||||
void bhv_ambient_light_update(void);
|
||||
/* |description|Behavior init function for the lighting engine ambient light. Takes the first 3 behavior parameter bytes for RGB color|descriptionEnd| */
|
||||
void bhv_ambient_light_init(void);
|
||||
/* |description|Behavior init function for the lighting engine point light. Takes the first 3 behavior parameter bytes for RGB color and the last for radius|descriptionEnd| */
|
||||
void bhv_point_light_init(void);
|
||||
/* |description|Behavior loop function for the lighting engine point light|descriptionEnd| */
|
||||
|
|
|
|||
|
|
@ -1,25 +1,4 @@
|
|||
struct Object* spawn_ambient_light(f32 x, f32 y, f32 z, u8 r, u8 g, u8 b) {
|
||||
struct Object* obj = spawn_object(NULL, MODEL_NONE, bhvAmbientLight);
|
||||
|
||||
obj->oPosX = x;
|
||||
obj->oPosY = y;
|
||||
obj->oPosZ = z;
|
||||
obj->oBehParams = (r << 24) | (g << 16) | (b << 8) | (0x00);
|
||||
return obj;
|
||||
}
|
||||
|
||||
struct Object* spawn_point_light(f32 x, f32 y, f32 z, u8 r, u8 g, u8 b, f32 radius) {
|
||||
struct Object* obj = spawn_object(NULL, MODEL_NONE, bhvPointLight);
|
||||
|
||||
obj->oPosX = x;
|
||||
obj->oPosY = y;
|
||||
obj->oPosZ = z;
|
||||
obj->oBehParams = (r << 24) | (g << 16) | (b << 8) | (0x00);
|
||||
obj->oLightRadius = radius;
|
||||
return obj;
|
||||
}
|
||||
|
||||
void bhv_ambient_light_update(void) {
|
||||
void bhv_ambient_light_init(void) {
|
||||
le_set_ambient_color(
|
||||
(o->oBehParams >> 24) & 0xFF,
|
||||
(o->oBehParams >> 16) & 0xFF,
|
||||
|
|
@ -29,21 +8,13 @@ void bhv_ambient_light_update(void) {
|
|||
|
||||
|
||||
void bhv_point_light_init(void) {
|
||||
// assign oLightRadius
|
||||
f32 radius = (o->oBehParams & 0xFF) * 10.0f;
|
||||
if (o->oLightRadius != 0.0f) {
|
||||
radius = o->oLightRadius;
|
||||
} else if (radius != 0) {
|
||||
o->oLightRadius = radius;
|
||||
}
|
||||
|
||||
o->oLightID = le_add_light(
|
||||
// position
|
||||
o->oPosX, o->oPosY, o->oPosZ,
|
||||
// color
|
||||
(o->oBehParams >> 24) & 0xFF, (o->oBehParams >> 16) & 0xFF, (o->oBehParams >> 8) & 0xFF,
|
||||
// radius
|
||||
radius,
|
||||
(o->oBehParams & 0xFF) * 10.0f,
|
||||
// intensity (2 by default)
|
||||
2.0f
|
||||
);
|
||||
|
|
@ -52,6 +23,7 @@ void bhv_point_light_init(void) {
|
|||
void bhv_point_light_loop(void) {
|
||||
if (o->parentObj != NULL) {
|
||||
if (o->parentObj->activeFlags == ACTIVE_FLAG_DEACTIVATED) {
|
||||
o->parentObj = NULL;
|
||||
le_remove_light(o->oLightID);
|
||||
obj_mark_for_deletion(o);
|
||||
return;
|
||||
|
|
@ -60,8 +32,5 @@ void bhv_point_light_loop(void) {
|
|||
obj_copy_pos(o, o->parentObj);
|
||||
}
|
||||
|
||||
// update these values every frame
|
||||
le_set_light_pos(o->oLightID, o->oPosX, o->oPosY, o->oPosZ);
|
||||
le_set_light_color(o->oLightID, (o->oBehParams >> 24) & 0xFF, (o->oBehParams >> 16) & 0xFF, (o->oBehParams >> 8) & 0xFF);
|
||||
le_set_light_radius(o->oLightID, o->oLightRadius);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,8 +34,8 @@ void djui_panel_options_debug_create(struct DjuiBase* caller) {
|
|||
struct DjuiThreePanel* panel = djui_panel_menu_create(DLANG(MISC, DEBUG_TITLE), false);
|
||||
struct DjuiBase* body = djui_three_panel_get_body(panel);
|
||||
{
|
||||
djui_checkbox_create(body, DLANG(MISC, LUA_PROFILER), &configLuaProfiler, NULL);
|
||||
djui_checkbox_create(body, DLANG(MISC, FIXED_COLLISIONS), (bool*)&gLevelValues.fixCollisionBugs, NULL);
|
||||
djui_checkbox_create(body, DLANG(MISC, LUA_PROFILER), &configLuaProfiler, NULL);
|
||||
djui_checkbox_create(body, DLANG(MISC, CTX_PROFILER), &configCtxProfiler, NULL);
|
||||
djui_checkbox_create(body, DLANG(MISC, DEBUG_PRINT), &configDebugPrint, NULL);
|
||||
djui_checkbox_create(body, DLANG(MISC, DEBUG_INFO), &configDebugInfo, NULL);
|
||||
|
|
|
|||
|
|
@ -1694,7 +1694,7 @@ static struct LuaObjectField sNetworkPlayerFields[LUA_NETWORK_PLAYER_FIELD_COUNT
|
|||
{ "type", LVT_U8, offsetof(struct NetworkPlayer, type), true, LOT_NONE, 1, sizeof(u8) },
|
||||
};
|
||||
|
||||
#define LUA_OBJECT_FIELD_COUNT 763
|
||||
#define LUA_OBJECT_FIELD_COUNT 762
|
||||
static struct LuaObjectField sObjectFields[LUA_OBJECT_FIELD_COUNT] = {
|
||||
{ "activeFlags", LVT_S16, offsetof(struct Object, activeFlags), false, LOT_NONE, 1, sizeof(s16) },
|
||||
{ "allowRemoteInteractions", LVT_U8, offsetof(struct Object, allowRemoteInteractions), false, LOT_NONE, 1, sizeof(u8) },
|
||||
|
|
@ -2100,7 +2100,6 @@ static struct LuaObjectField sObjectFields[LUA_OBJECT_FIELD_COUNT] = {
|
|||
{ "oKoopaTurningAwayFromWall", LVT_S32, offsetof(struct Object, oKoopaTurningAwayFromWall), false, LOT_NONE, 1, sizeof(s32) },
|
||||
{ "oKoopaUnshelledTimeUntilTurn", LVT_S32, offsetof(struct Object, oKoopaUnshelledTimeUntilTurn), false, LOT_NONE, 1, sizeof(s32) },
|
||||
{ "oLightID", LVT_S32, offsetof(struct Object, oLightID), false, LOT_NONE, 1, sizeof(s32) },
|
||||
{ "oLightRadius", LVT_F32, offsetof(struct Object, oLightRadius), false, LOT_NONE, 1, sizeof(f32) },
|
||||
{ "oLllRotatingHexFlameUnkF4", LVT_F32, offsetof(struct Object, oLllRotatingHexFlameUnkF4), false, LOT_NONE, 1, sizeof(f32) },
|
||||
{ "oLllRotatingHexFlameUnkF8", LVT_F32, offsetof(struct Object, oLllRotatingHexFlameUnkF8), false, LOT_NONE, 1, sizeof(f32) },
|
||||
{ "oLllRotatingHexFlameUnkFC", LVT_F32, offsetof(struct Object, oLllRotatingHexFlameUnkFC), false, LOT_NONE, 1, sizeof(f32) },
|
||||
|
|
|
|||
|
|
@ -1778,6 +1778,7 @@ char gSmluaConstants[] = ""
|
|||
"HUD_DISPLAY_FLAG_EMPHASIZE_POWER=0x8000\n"
|
||||
"HUD_DISPLAY_NONE=0x0000\n"
|
||||
"HUD_DISPLAY_DEFAULT=HUD_DISPLAY_FLAG_LIVES | HUD_DISPLAY_FLAG_COIN_COUNT | HUD_DISPLAY_FLAG_STAR_COUNT | HUD_DISPLAY_FLAG_CAMERA_AND_POWER | HUD_DISPLAY_FLAG_CAMERA | HUD_DISPLAY_FLAG_POWER | HUD_DISPLAY_FLAG_KEYS | HUD_DISPLAY_FLAG_UNKNOWN_0020\n"
|
||||
"LE_MAX_LIGHTS=128\n"
|
||||
"LE_MODE_AFFECT_ALL_SHADED_AND_COLORED=0\n"
|
||||
"LE_MODE_AFFECT_ALL_SHADED=1\n"
|
||||
"LE_MODE_AFFECT_ONLY_GEOMETRY_MODE=2\n"
|
||||
|
|
|
|||
|
|
@ -9678,74 +9678,18 @@ int smlua_func_uv_update_scroll(UNUSED lua_State* L) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
int smlua_func_spawn_ambient_light(lua_State* L) {
|
||||
if (L == NULL) { return 0; }
|
||||
|
||||
int top = lua_gettop(L);
|
||||
if (top != 6) {
|
||||
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "spawn_ambient_light", 6, top);
|
||||
return 0;
|
||||
}
|
||||
|
||||
f32 x = smlua_to_number(L, 1);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "spawn_ambient_light"); return 0; }
|
||||
f32 y = smlua_to_number(L, 2);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "spawn_ambient_light"); return 0; }
|
||||
f32 z = smlua_to_number(L, 3);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "spawn_ambient_light"); return 0; }
|
||||
u8 r = smlua_to_integer(L, 4);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "spawn_ambient_light"); return 0; }
|
||||
u8 g = smlua_to_integer(L, 5);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 5, "spawn_ambient_light"); return 0; }
|
||||
u8 b = smlua_to_integer(L, 6);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 6, "spawn_ambient_light"); return 0; }
|
||||
|
||||
smlua_push_object(L, LOT_OBJECT, spawn_ambient_light(x, y, z, r, g, b), NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int smlua_func_spawn_point_light(lua_State* L) {
|
||||
if (L == NULL) { return 0; }
|
||||
|
||||
int top = lua_gettop(L);
|
||||
if (top != 7) {
|
||||
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "spawn_point_light", 7, top);
|
||||
return 0;
|
||||
}
|
||||
|
||||
f32 x = smlua_to_number(L, 1);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "spawn_point_light"); return 0; }
|
||||
f32 y = smlua_to_number(L, 2);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "spawn_point_light"); return 0; }
|
||||
f32 z = smlua_to_number(L, 3);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "spawn_point_light"); return 0; }
|
||||
u8 r = smlua_to_integer(L, 4);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "spawn_point_light"); return 0; }
|
||||
u8 g = smlua_to_integer(L, 5);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 5, "spawn_point_light"); return 0; }
|
||||
u8 b = smlua_to_integer(L, 6);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 6, "spawn_point_light"); return 0; }
|
||||
f32 radius = smlua_to_number(L, 7);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 7, "spawn_point_light"); return 0; }
|
||||
|
||||
smlua_push_object(L, LOT_OBJECT, spawn_point_light(x, y, z, r, g, b, radius), NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int smlua_func_bhv_ambient_light_update(UNUSED lua_State* L) {
|
||||
int smlua_func_bhv_ambient_light_init(UNUSED lua_State* L) {
|
||||
if (!gCurrentObject) { return 0; }
|
||||
if (L == NULL) { return 0; }
|
||||
|
||||
int top = lua_gettop(L);
|
||||
if (top != 0) {
|
||||
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_ambient_light_update", 0, top);
|
||||
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "bhv_ambient_light_init", 0, top);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
bhv_ambient_light_update();
|
||||
bhv_ambient_light_init();
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -15726,6 +15670,44 @@ int smlua_func_le_get_light_count(UNUSED lua_State* L) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
int smlua_func_le_light_exists(lua_State* L) {
|
||||
if (L == NULL) { return 0; }
|
||||
|
||||
int top = lua_gettop(L);
|
||||
if (top != 1) {
|
||||
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "le_light_exists", 1, top);
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 id = smlua_to_integer(L, 1);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "le_light_exists"); return 0; }
|
||||
|
||||
lua_pushboolean(L, le_light_exists(id));
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int smlua_func_le_get_ambient_color(lua_State* L) {
|
||||
if (L == NULL) { return 0; }
|
||||
|
||||
int top = lua_gettop(L);
|
||||
if (top != 1) {
|
||||
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "le_get_ambient_color", 1, top);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Color out;
|
||||
smlua_get_color(out, 1);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "le_get_ambient_color"); return 0; }
|
||||
|
||||
le_get_ambient_color(out);
|
||||
|
||||
smlua_push_color(out, 1);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int smlua_func_le_set_ambient_color(lua_State* L) {
|
||||
if (L == NULL) { return 0; }
|
||||
|
||||
|
|
@ -15747,6 +15729,29 @@ int smlua_func_le_set_ambient_color(lua_State* L) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
int smlua_func_le_get_light_pos(lua_State* L) {
|
||||
if (L == NULL) { return 0; }
|
||||
|
||||
int top = lua_gettop(L);
|
||||
if (top != 2) {
|
||||
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "le_get_light_pos", 2, top);
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 id = smlua_to_integer(L, 1);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "le_get_light_pos"); return 0; }
|
||||
|
||||
Vec3f out;
|
||||
smlua_get_vec3f(out, 2);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "le_get_light_pos"); return 0; }
|
||||
|
||||
le_get_light_pos(id, out);
|
||||
|
||||
smlua_push_vec3f(out, 2);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int smlua_func_le_set_light_pos(lua_State* L) {
|
||||
if (L == NULL) { return 0; }
|
||||
|
||||
|
|
@ -15770,6 +15775,29 @@ int smlua_func_le_set_light_pos(lua_State* L) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
int smlua_func_le_get_light_color(lua_State* L) {
|
||||
if (L == NULL) { return 0; }
|
||||
|
||||
int top = lua_gettop(L);
|
||||
if (top != 2) {
|
||||
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "le_get_light_color", 2, top);
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 id = smlua_to_integer(L, 1);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "le_get_light_color"); return 0; }
|
||||
|
||||
Color out;
|
||||
smlua_get_color(out, 2);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "le_get_light_color"); return 0; }
|
||||
|
||||
le_get_light_color(id, out);
|
||||
|
||||
smlua_push_color(out, 2);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int smlua_func_le_set_light_color(lua_State* L) {
|
||||
if (L == NULL) { return 0; }
|
||||
|
||||
|
|
@ -15793,6 +15821,23 @@ int smlua_func_le_set_light_color(lua_State* L) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
int smlua_func_le_get_light_radius(lua_State* L) {
|
||||
if (L == NULL) { return 0; }
|
||||
|
||||
int top = lua_gettop(L);
|
||||
if (top != 1) {
|
||||
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "le_get_light_radius", 1, top);
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 id = smlua_to_integer(L, 1);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "le_get_light_radius"); return 0; }
|
||||
|
||||
lua_pushnumber(L, le_get_light_radius(id));
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int smlua_func_le_set_light_radius(lua_State* L) {
|
||||
if (L == NULL) { return 0; }
|
||||
|
||||
|
|
@ -15812,6 +15857,23 @@ int smlua_func_le_set_light_radius(lua_State* L) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
int smlua_func_le_get_light_intensity(lua_State* L) {
|
||||
if (L == NULL) { return 0; }
|
||||
|
||||
int top = lua_gettop(L);
|
||||
if (top != 1) {
|
||||
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "le_get_light_intensity", 1, top);
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 id = smlua_to_integer(L, 1);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "le_get_light_intensity"); return 0; }
|
||||
|
||||
lua_pushnumber(L, le_get_light_intensity(id));
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int smlua_func_le_set_light_intensity(lua_State* L) {
|
||||
if (L == NULL) { return 0; }
|
||||
|
||||
|
|
@ -15831,6 +15893,23 @@ int smlua_func_le_set_light_intensity(lua_State* L) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
int smlua_func_le_get_light_use_surface_normals(lua_State* L) {
|
||||
if (L == NULL) { return 0; }
|
||||
|
||||
int top = lua_gettop(L);
|
||||
if (top != 1) {
|
||||
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "le_get_light_use_surface_normals", 1, top);
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 id = smlua_to_integer(L, 1);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "le_get_light_use_surface_normals"); return 0; }
|
||||
|
||||
lua_pushboolean(L, le_get_light_use_surface_normals(id));
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int smlua_func_le_set_light_use_surface_normals(lua_State* L) {
|
||||
if (L == NULL) { return 0; }
|
||||
|
||||
|
|
@ -36809,9 +36888,7 @@ void smlua_bind_functions_autogen(void) {
|
|||
smlua_bind_function(L, "bhv_yoshi_loop", smlua_func_bhv_yoshi_loop);
|
||||
smlua_bind_function(L, "bhv_volcano_trap_loop", smlua_func_bhv_volcano_trap_loop);
|
||||
smlua_bind_function(L, "uv_update_scroll", smlua_func_uv_update_scroll);
|
||||
smlua_bind_function(L, "spawn_ambient_light", smlua_func_spawn_ambient_light);
|
||||
smlua_bind_function(L, "spawn_point_light", smlua_func_spawn_point_light);
|
||||
smlua_bind_function(L, "bhv_ambient_light_update", smlua_func_bhv_ambient_light_update);
|
||||
smlua_bind_function(L, "bhv_ambient_light_init", smlua_func_bhv_ambient_light_init);
|
||||
smlua_bind_function(L, "bhv_point_light_init", smlua_func_bhv_point_light_init);
|
||||
smlua_bind_function(L, "bhv_point_light_loop", smlua_func_bhv_point_light_loop);
|
||||
//smlua_bind_function(L, "geo_move_mario_part_from_parent", smlua_func_geo_move_mario_part_from_parent); <--- UNIMPLEMENTED
|
||||
|
|
@ -37152,11 +37229,18 @@ void smlua_bind_functions_autogen(void) {
|
|||
smlua_bind_function(L, "le_add_light", smlua_func_le_add_light);
|
||||
smlua_bind_function(L, "le_remove_light", smlua_func_le_remove_light);
|
||||
smlua_bind_function(L, "le_get_light_count", smlua_func_le_get_light_count);
|
||||
smlua_bind_function(L, "le_light_exists", smlua_func_le_light_exists);
|
||||
smlua_bind_function(L, "le_get_ambient_color", smlua_func_le_get_ambient_color);
|
||||
smlua_bind_function(L, "le_set_ambient_color", smlua_func_le_set_ambient_color);
|
||||
smlua_bind_function(L, "le_get_light_pos", smlua_func_le_get_light_pos);
|
||||
smlua_bind_function(L, "le_set_light_pos", smlua_func_le_set_light_pos);
|
||||
smlua_bind_function(L, "le_get_light_color", smlua_func_le_get_light_color);
|
||||
smlua_bind_function(L, "le_set_light_color", smlua_func_le_set_light_color);
|
||||
smlua_bind_function(L, "le_get_light_radius", smlua_func_le_get_light_radius);
|
||||
smlua_bind_function(L, "le_set_light_radius", smlua_func_le_set_light_radius);
|
||||
smlua_bind_function(L, "le_get_light_intensity", smlua_func_le_get_light_intensity);
|
||||
smlua_bind_function(L, "le_set_light_intensity", smlua_func_le_set_light_intensity);
|
||||
smlua_bind_function(L, "le_get_light_use_surface_normals", smlua_func_le_get_light_use_surface_normals);
|
||||
smlua_bind_function(L, "le_set_light_use_surface_normals", smlua_func_le_set_light_use_surface_normals);
|
||||
|
||||
// mario.h
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue