sm64coopdx/include/PR
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
..
abi.h Update to Refresh 13 (#19) 2022-03-13 00:17:10 -08:00
gbi.h Gfx set command: v2 + Gfx/Vtx dynamic alloc (#718) 2025-04-12 18:19:14 -04:00
gbi_extension.h Lighting engine improvements (#870) 2025-06-29 17:46:35 +02:00
gs2dex.h Refresh 1 2019-09-01 15:50:50 -04:00
gu.h Refresh 1 2019-09-01 15:50:50 -04:00
libaudio.h Update to Refresh 13 (#19) 2022-03-13 00:17:10 -08:00
libultra.h init2 2019-08-25 00:46:40 -04:00
mbi.h refresh 4 2019-12-01 21:52:53 -05:00
os_ai.h init2 2019-08-25 00:46:40 -04:00
os_cache.h Refresh 2 2019-10-05 15:08:05 -04:00
os_cont.h Added support for X and Y buttons; Re-mapped B button to the actual B button for controllers; Moved particleFlags code so lua scripts can spawn Mario particles with 'before Mario update' and 'after Mario update' hooks (#5) 2022-02-27 14:31:59 -08:00
os_eeprom.h init2 2019-08-25 00:46:40 -04:00
os_exception.h init2 2019-08-25 00:46:40 -04:00
os_internal.h Update to Refresh 13 (#19) 2022-03-13 00:17:10 -08:00
os_libc.h Refactor PR #156 2020-05-19 10:32:01 -03:00
os_message.h refresh 6 2020-02-03 00:51:26 -05:00
os_misc.h refresh 6 2020-02-03 00:51:26 -05:00
os_pi.h Merge in small changes. (#63) 2022-04-16 19:12:12 -07:00
os_rdp.h init2 2019-08-25 00:46:40 -04:00
os_thread.h refresh 6 2020-02-03 00:51:26 -05:00
os_time.h Update to Refresh 13 (#19) 2022-03-13 00:17:10 -08:00
os_tlb.h init2 2019-08-25 00:46:40 -04:00
os_vi.h Update to Refresh 13 (#19) 2022-03-13 00:17:10 -08:00
sptask.h Update to Refresh 13 (#19) 2022-03-13 00:17:10 -08:00
ucode.h init2 2019-08-25 00:46:40 -04:00
ultratypes.h avoid redefining CLOCK_MONOTONIC and shit 2020-05-20 17:56:35 +03:00