sm64coopdx/include
djoslin0 82ca45eeb6
Lighting engine improvements (#870)
* Lighting engine improvements

Now objects will be affected by the lighting engine. This is
accomplished by passing the renderer the object's model matrix
(uncombined with the view or projection). You can now setup the
lighting engine mode to affect all shaded surfaces, lighting can
be affected by surface normals, and you can control what type of
tone mapping is applied.

added le_set_mode(mode)
    By default we retain the previous behavior.

    When set to LE_MODE_AFFECT_ALL_SHADED the lighting engine will
    affect every shaded material.

    This way we don't have to recompile every object and level that
    we want shaded with special coop-specific commands

added le_get_mode()

added le_set_tone_mapping(toneMapping)
    Tone mapping is what happens when a color value exceeds its 0-255
    range.

    By default we retain the current tone mapping (called
    LE_TONE_MAPPING_TOTAL_WEIGHTED).

    LE_TONE_MAPPING_WEIGHTED is now accessible, it was the tone
    mapping that was previously left out of the compile through ifdefs.

    LE_TONE_MAPPING_CLAMP is just simple additive with a clamp at a
    color value of 255.

    LE_TONE_MAPPING_REINHARD is reinhard tone mapping
    (vout = (vin + 1) / vin).

added le_set_light_use_surface_normals(id, useSurfaceNormals)
    By default lights retain their previous behavior (of ignoring
    surface normals).

    When enabled lights cast on one side of the object will not
    appear on the other side of the object.

    It is kind of like backface culling, but for lights.

added le_calculate_lighting_color_with_normal(pos, normal, outColor, lightIntensityScalar)
    It's just like le_calculate_lighting_color(), but you can pass
    in normals now.

* Removed normal calculation from vertex colored surfaces - they don't have normals

* Use packed normals correctly

* made LE_MODE_AFFECT_ALL_SHADED the default

* made useSurfaceNormals the default for lights

* Set ambient color, performed le_is_enabled() checks

The ambient color was black, which is why everything was dark by default.
If we set ambient to white then people will never see the effects of their
lights unless they set ambient to a lower value. So I added checks for
if a light has ever been added. The alternative would be to have something
like le_set_enabled()

* Rewrite how we obtain the model matrix - invert the camera

* run autogen

* Change default tonemapper to weighted, make setting ambient enable LE, fix null deref

* Address Peachy's comments

---------

Co-authored-by: MysterD <myster@d>
2025-06-29 17:46:35 +02:00
..
GL merge PC port onto the decompile 2020-05-07 20:21:22 +02:00
libc Palette system overhaul and preset rewrite 2024-05-21 17:09:59 -04:00
PR Lighting engine improvements (#870) 2025-06-29 17:46:35 +02:00
stb Implemented dynos model packs into configfile 2022-03-10 19:23:38 -08:00
behavior_commands.h Added a full new custom behavior system (#124) 2022-06-02 12:19:54 -07:00
behavior_data.h Basic Vertex Point Lighting Engine (#716) 2025-03-27 16:36:02 -04:00
behavior_table.h Basic Vertex Point Lighting Engine (#716) 2025-03-27 16:36:02 -04:00
command_macros_base.h merge refresh 10 2020-06-20 02:49:59 +03:00
config.h Fix let's a go & okie dokie character sounds 2024-06-27 11:09:28 -04:00
course_table.h Fix pause menus 2023-11-21 17:14:25 -05:00
dialog_ids.h merge refresh 10 2020-06-20 02:49:59 +03:00
display_lists.inl make extract_display_lists.py consistent across platforms 2025-05-10 13:30:06 +10:00
eu_translation.h Adds support for compiling other regions (#378) 2023-05-03 00:54:25 -07:00
geo_commands.h change misleading switch case field label (#781) 2025-05-02 13:33:36 +02:00
gfx_dimensions.h merge refresh 10 2020-06-20 02:49:59 +03:00
gfx_symbols.h cleanup old gfx symbol management code 2025-06-14 14:58:55 +10:00
helper_macros.h merge refresh 10 2020-06-20 02:49:59 +03:00
level_commands.h Add some level commands to make porting HackerSM64 levels easier 2025-04-14 19:25:05 -04:00
level_misc_macros.h merge refresh 10 2020-06-20 02:49:59 +03:00
level_table.h merge refresh 10 2020-06-20 02:49:59 +03:00
luigi_sounds.h Fix let's a go & okie dokie character sounds 2024-06-27 11:09:28 -04:00
macro_preset_names.h merge refresh 10 2020-06-20 02:49:59 +03:00
macro_presets.h Improvements to late-join synchronization 2021-06-09 22:35:34 -07:00
macros.h More Optimizations (#792) 2025-05-16 20:27:49 -04:00
macros.inc Refresh 3 2019-11-03 14:36:27 -05:00
make_const_nonconst.h Removed majority of TARGET_N64 logic from code 2020-05-13 07:57:25 -04:00
mario_animation_ids.h Remove Waluigi anims 2024-07-01 18:32:27 -04:00
mario_geo_switch_case_ids.h merge refresh 10 2020-06-20 02:49:59 +03:00
model_ids.h add obj_get_model_id_extended, remember regular model ids 2025-03-04 15:09:09 +10:00
moving_texture_macros.h merge refresh 10 2020-06-20 02:49:59 +03:00
object_constants.h Make most used and useful features built-ins (#242) 2023-02-26 03:15:54 +01:00
object_fields.h Improving math functions (#813) 2025-05-21 23:50:49 +02:00
platform_info.h merge refresh 10 2020-06-20 02:49:59 +03:00
prevent_bss_reordering.h merge refresh 10 2020-06-20 02:49:59 +03:00
segment_symbols.h merge refresh 10 2020-06-20 02:49:59 +03:00
segments.h Added extended bounds 2022-04-06 08:40:22 -07:00
seq_ids.h Update to Refresh 13 (#19) 2022-03-13 00:17:10 -08:00
seq_luigi.inc Fix cut off Luigi line 2024-06-27 16:54:20 -04:00
seq_macros.inc sm64coopdx 2023-10-30 01:03:36 -04:00
seq_toad.inc Fix let's a go & okie dokie character sounds 2024-06-27 11:09:28 -04:00
seq_wario.inc Fix let's a go & okie dokie character sounds 2024-06-27 11:09:28 -04:00
sm64.h djui player menu custom camera cutscene (#2) 2024-03-28 18:53:46 -04:00
sounds.h Fix let's a go & okie dokie character sounds 2024-06-27 11:09:28 -04:00
special_preset_names.h merge refresh 10 2020-06-20 02:49:59 +03:00
special_presets.h merge refresh 10 2020-06-20 02:49:59 +03:00
surface_terrains.h Fix HOOK_ALLOW_HAZARD_SURFACE and expose SURFACE_IS_* macros (#865) 2025-06-24 22:15:27 +02:00
textures.h More DynOS custom level progress - BOB can now compile 2022-04-03 03:30:47 -07:00
tinfl.h add virtual filesystem thing w/ ZIP support 2020-06-07 21:06:25 +03:00
toad_sounds.h Fix let's a go & okie dokie character sounds 2024-06-27 11:09:28 -04:00
trig_tables.inc.c refresh 4 2019-12-01 21:52:53 -05:00
types.h Fix vec3f bugs (#837) 2025-06-05 19:44:09 +10:00
ultra64.h Better way to detect mingw-w64; fix bettercamera for mingw.org; close 2020-05-15 00:26:56 +08:00
wario_sounds.h Fix let's a go & okie dokie character sounds 2024-06-27 11:09:28 -04:00