Commit graph

271 commits

Author SHA1 Message Date
Agent X
4ed1c878bb Revert "Hacky Goddard fix"
Some checks failed
Build coop / build-linux (push) Has been cancelled
Build coop / build-steamos (push) Has been cancelled
Build coop / build-windows-opengl (push) Has been cancelled
Build coop / build-windows-directx (push) Has been cancelled
Build coop / build-macos-arm (push) Has been cancelled
Build coop / build-macos-intel (push) Has been cancelled
This reverts commit 6be5c6f619.
2025-12-22 15:29:42 -05:00
Agent X
6be5c6f619 Hacky Goddard fix 2025-12-22 15:11:51 -05:00
Cooliokid956
0dcb4f030a
Multi-return from C and other autogen changes (#1044)
* Allow multiple returns in autogen functions

* condense function member names

* This shouldn't be here

* Relocate these functions

LVT_FIELD shouldn't be there yet

* multi-return part 2: most functions are usable now

---------

Co-authored-by: PeachyPeachSM64 <72323920+PeachyPeachSM64@users.noreply.github.com>
2025-12-19 20:27:44 -05:00
Isaac0-dev
63ba422075 Update gfx_opengl.c
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
2025-12-14 21:51:47 +10:00
Isaac0-dev
4026ee5390 typo fix 2025-12-14 21:45:12 +10:00
PeachyPeachSM64
4ce9be4935 Fix 4-bit textures djui 2025-11-26 00:23:20 +01:00
PeachyPeachSM64
983932214a Fix artifacts with texture tiles 2025-11-23 13:49:35 +01:00
Isaac0-dev
14ac356fc2 i forgot to press save :( 2025-11-22 06:36:11 +10:00
Isaac0-dev
c89e52a554 missed these 2025-11-22 06:21:31 +10:00
Isaac0-dev
61b342710a this is gross what was i thinking 2025-11-22 06:15:01 +10:00
PeachyPeach
c3e5843c53
Fix djui hud texture unsupported formats (#995)
- `djui_hud_render_texture(_tile)` now accepts properly any `TextureInfo`
- Removed `bitSize`, added `format` and `size` to `TextureInfo`
- `texture_to_lua_table` can now convert any `Texture` into an RGBA table
2025-11-20 11:44:02 +10:00
djoslin0
a3bfd4a740
Make lightmapped graphics ignore lighting engine (#1025)
The dynamic lighting engine conflicted with lightmapped graphics. Now
lightmapped graphics will ignore the lighting engine. Making them work
together is something for the future.

Co-authored-by: MysterD <myster@d>
2025-11-20 11:40:46 +10:00
Baconator2558
458d683e41
Add gsDPSetEnvRGB() (#997)
This command sets the RGB values of a material's environment color without setting the alpha. This is important, as functions like `geo_update_layer_transparency()` use the environment color alpha to control a model's overall opacity. However, if one of the model's materials sets its own environment color alpha, then that will take priority. This command allows these models to still use environment colors in their materials.
2025-11-13 08:00:31 +10:00
PeachyPeach
4671f09f79
G_CULL_INVERT_EXT; Vec2 functions; bug fixes (#985) 2025-10-21 18:56:35 +02:00
ManIsCat2
f80f8eba62
gsSPLightColor() support (#948)
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
* G_MW_LIGHTCOL

* Update gfx_pc.c

---------

Co-authored-by: PeachyPeach <72323920+PeachyPeachSM64@users.noreply.github.com>
2025-09-15 18:56:40 +02:00
ManIsCat2
6524e709a3
Fresnel Lighting from F3DEX3 (#941)
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
* Fresnel part1

* Fresnel part2

* vmacu
2025-09-13 12:40:38 +02:00
ManIsCat2
5f1a2d0b42
Gfx commands to Copy Lights into Env/Prim color (#927)
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
2025-08-28 06:27:25 +10:00
Isaac0-dev
e74ea05fde
revise better frame pacing (#901)
improved frame pacing, where frame delaying is done just before displaying the frame.
so, the frame is fully rendered, and then the delay is done to wait the extra time before displaying the frame.
This is a far more reliable and consistent way to manage frame pacing, and it will help to keep the framerate from choking too badly when the game lags a little. 

The changes to `gfx_end_frame` is to minimize the steps necessary between delaying and actually displaying the frame. This is an optimization just to increase the accuracy of frame pacing even further.

Also, delta calculation is improved when the number of frames to draw is known. 

Djui cursor movement is also updated every frame for smoother movement.
2025-08-27 08:17:16 +10:00
PeachyPeachSM64
afec9d35b9 Revert "much better frame pacing"
- No one complained about framerate since several updates now; don't fix what isn't broken
- Too much frames are drawn at low framerates when Vsync is enabled
- FPS and delay calculation are wrong with Vsync: 60 FPS looks like 30 with a 120+Hz monitor
- Fixed Auto mode that was broken
- Kept precise_delay_f64 as I have observed no noticeable impact on CPU
2025-07-28 22:31:40 +02:00
Isaac0-dev
0a84ca725e much better frame pacing
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
plus limited frame rates on the loading and crash screens to go easy on the cpu.

during gameplay, this new system is able to stay true to your fps limit without frame drops.
Vsync causes occasional frame drops by just 1 frame. this is an sdl issue and i know of no workaround; luckily it's very minor.

this commit changes frame pacing by moving frame delaying to just before the frame is displayed. a more precise delay function is also used.
2025-07-25 14:00:14 +10:00
Agent X
7009e7da86 Lighting Engine: Awesome Edition
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
Just making a brief commit and thats all to add onto dj's lighting engine improvements because I heard about the PR, in mine I
* allowed all Vtx objects to be manipulated/retrieved
* updated lighting engine demo to be an SM64 night mode with a flashlight
* Fixed longterm bug where lighting bugs out unless you spawn a light
* Added new default LE mode LE_MODE_AFFECT_ALL_SHADED_AND_COLORED which also affects vertex colored surfaces
2025-06-29 12:08:04 -04:00
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
djoslin0
afb1c7f0e8
Adjust alpha color combiners to use the correct values (#876)
Co-authored-by: MysterD <myster@d>
2025-06-29 15:25:56 +02:00
Isaac0-dev
bee2b924bd disable lua vertex colors for G_PACKED_NORMALS_EXT
by maniscat2

Co-Authored-By: ManIsCat2 <137772623+ManIsCat2@users.noreply.github.com>
2025-06-09 19:03:22 +10:00
PeachyPeach
c79d59d8ec
Fix vec3f bugs (#837) 2025-06-05 19:44:09 +10:00
Agent X
ff31ae55fa Bug fixes
Some checks failed
Build coop / build-linux (push) Has been cancelled
Build coop / build-steamos (push) Has been cancelled
Build coop / build-windows-opengl (push) Has been cancelled
Build coop / build-windows-directx (push) Has been cancelled
Build coop / build-macos-arm (push) Has been cancelled
Build coop / build-macos-intel (push) Has been cancelled
If it ain't broke, don't fix it
2025-05-30 16:14:19 -04:00
Isaac0-dev
56a5e0b7d2 fix opengl warning 2025-05-29 12:49:38 +10:00
Agent X
318c8a4995 Fix macOS compile errors and warnings [build] 2025-05-22 08:48:05 -04:00
PeachyPeach
8db6356754
Improving math functions (#813)
* Improving math functions

* Isaac review
2025-05-21 23:50:49 +02:00
Prince Frizzy
258db1f6e7
Fix issue with texture filtering
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
2025-05-17 17:37:29 -04:00
Prince Frizzy
02c9a4146b
More Optimizations (#792)
* Initial work on optimizations.

* Requested Changes Part 1

* Requested Changes Part 2

* Requested Changes Part 3

* Requested Changes Part 4

* Requested Changes Part 5

* Requested Changes Part 6

* Update deprecated.lua

---------

Co-authored-by: PeachyPeach <72323920+PeachyPeachSM64@users.noreply.github.com>
2025-05-16 20:27:49 -04:00
ManIsCat2
10154b75d0
Fix packed normals (#797)
* Fix packed normals

* Clear packed normals on obj_sanitize_gfx

* Isaac review

* Peachy review
2025-05-09 19:17:26 -04:00
ManIsCat2
29f9e7cfcb
Add G_PACKED_NORMALS Geo Mode from F3DEX3 (#768)
Some checks are pending
Build coop / build-ubuntu (push) Waiting to run
Build coop / build-windows (push) Waiting to run
Build coop / build-macos-arm (push) Waiting to run
Build coop / build-macos-intel (push) Waiting to run
* Add new geometry mode

* Fix lua vertex colors not working
2025-04-25 15:07:31 -04:00
PeachyPeach
467b22e939
Gfx set command: v2 + Gfx/Vtx dynamic alloc (#718)
Some checks failed
Build coop / build-ubuntu (push) Has been cancelled
Build coop / build-windows (push) Has been cancelled
Build coop / build-macos-arm (push) Has been cancelled
Build coop / build-macos-intel (push) Has been cancelled
* set_gfx_command part 2

* part 3

* get gfx/vtx from name; copy gfx/vtx

* gfx/vtx dynamic allocation lua

* gfx/vtx_new: don't take level/model/vanilla names

* Clean up gbi constants

* update example

* Isaac review; add gfx_get_next_command and vtx_get_next_vertex

* make all commands length 1; missing NULL checks
2025-04-12 18:19:14 -04:00
Agent X
211ad82937 Further enhance lighting engine 2025-04-05 13:58:28 -04:00
Cooliokid956
3bfa75e32b
Miscellaneous Additions: Addendum (#723)
Some checks are pending
Build coop / build-ubuntu (push) Waiting to run
Build coop / build-windows (push) Waiting to run
Build coop / build-macos-arm (push) Waiting to run
Build coop / build-macos-intel (push) Waiting to run
* More autogen work

- made the `Pointer_` classes into aliases instead so that they're actually associated with their true type
- "Total constants" metric is now accurate

* High Quality Master Volume

* Audio work

it's 12:55am and there are some bright flashes outside (lightning)

- cracked the code (interpreted the "Acc" in `tempoAcc`)
- added several functions that will help greatly in the Streamed Music department (you can now match sequenced music fading (transitions, eepy, etc.))
- introducing `gMasterVolume`! a variable that is only updated when it needs to be, theoretically improving performance (by some amount). this variable is used in many places in place of recalculations of the same number
- made it so that muting the game skips some audio processing (not the main process since that would linger after unmuting (not good))
- fixed an oversight where lua volumes were not taken into account when `audio_stream_set_volume`
- it's its 😁
- removed additional `#include "audio/external.h"`

it is 1:06am
gn

* Add mouse status functions

you can now check if mouse buttons were held, clicked, or released

* Sorting was a bad idea

disabled sorting for constants so that they are represented more closely to their original defines

* Expose playerlist page index

also noticed that sorting still sucks

* Minor (very important) detail

lalette

* Addressing the PeachyPeachSM64 reviews

* Return of the Forced 4:3 Mode

shoutouts to DISPLAY.FORCE_4BY3 for sticking through the toughest of times, waiting for this day to come

* Added scroll support

- Scrolling added to chat box (hold ctrl to scroll fewer lines, shift to scroll faster)
- Scrolling functions added to smlua

* Addressing the Isaac0-dev review + fixes

- mouse scroll is now accumulated
- djui_gfx_get_dimensions
- forced 4:3 won't kick in if the window isn't wide enough
- game now recognizes horizontal resizing when in 4:3 mode

* Run autogen

* gfx_get_dimensions

works just as well
2025-04-05 13:52:14 -04:00
Agent X
0ee8d5f81e Fix/optimize/improve lighting engine 2025-03-28 23:06:48 -04:00
Agent X
3e540790a3
Basic Vertex Point Lighting Engine (#716)
* CONCEPT: Basic vertex lighting engine

Set the geometry mode on your model to G_LIGHTING_ENGINE_EXT, spawn a `bhvAmbientLight`, spawn some `bhvPointLight`s, and then you got yourself a mighty interesting scene.

* Fixes

* How did I miss this

* Make light set home pos
2025-03-27 16:36:02 -04:00
Agent X
64ef23ba6a Make sliders show their number value
Some checks failed
Build coop / build-ubuntu (push) Has been cancelled
Build coop / build-windows (push) Has been cancelled
Build coop / build-macos-arm (push) Has been cancelled
Build coop / build-macos-intel (push) Has been cancelled
2025-03-18 23:07:03 -04:00
Agent X
8775f9c145 Fix lighting
Some checks are pending
Build coop / build-ubuntu (push) Waiting to run
Build coop / build-windows (push) Waiting to run
Build coop / build-macos-arm (push) Waiting to run
Build coop / build-macos-intel (push) Waiting to run
2025-03-13 00:42:04 -04:00
Cooliokid956
42e0051dda
Headless mode as a CLI option (#639) 2025-01-28 10:19:38 +10:00
Agent X
b9d48e0952 Fix 5 year bug where envmaps use the wrong orientation
Fixed gfx intepreter bug that has existed for about 5 years now in the PC Port. I have now cleansed this platform of Super Mario 64 of its sin. No longer shall I hear people complain about this specific bug. PC Port has now been deshittified. It is now pure and excellent. Mario 64 is reborn, PC Port is real, the future is now.

P.S. I really hope this doesn't have incredibly strange unintended side effects that cause me to require to revert this and implement it in a more convoluted way.
2025-01-12 22:06:18 -05:00
Agent X
0a7060ac17 Fix compilation error 2024-12-31 17:10:44 -05:00
Michael
ba037771bd
ime composition support (#589) 2024-12-28 08:45:34 -05:00
Isaac0-dev
15eb8dd8fc Revert "changes to recent pr"
This reverts commit 4ba9970972.
2024-11-14 22:58:53 +10:00
Isaac0-dev
4ba9970972 changes to recent pr 2024-11-13 13:28:36 +10:00
Khangaroo
d2aaeb23e9
Minor vertex processing optimizations (#490)
* Minor vertex processing optimizations

* Only cache global light if lighting is enabled
2024-11-13 13:27:43 +10:00
Khangaroo
1babad1640
Don't use default VAO (#487)
* Don't use default VAO

* Don't use a VAO on OpenGL 2.1
2024-11-12 11:08:21 +10:00
Radek Krzyśków
b4b66c369a
Fixed clipboard (text copy & paste) implementation (#380)
- fixed "SDL_GetClipboardText" memory leak
- forcing unicode clipboard data format on Windows (UTF-16LE system, UTF-8 in-game)
- all "get_clipboard_text" functions return a zero-width string in case of failure, instead of NULL
2024-10-22 22:24:13 +10:00
Agent X
c0c2352617 Hopefully fix issues with EMBLEM lights 2024-07-09 15:39:26 -04:00