Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Lighting #51

Open
wants to merge 22 commits into
base: main
Choose a base branch
from
Open

Conversation

0x00002a
Copy link
Contributor

This adds support for the lighting API.

It's a bit rough, I don't currently have a 3ds to test it on but the pre-rebase version is used as part of our bevy 3ds port so I'm pretty confident it works alright.

It does have an example which should render a rotating purple cube with specular lighting, again I can only test this in emulation right now.

The implementation is... complex. The citro3d internals here are a minefield of backpointers, the wrapper makes liberal use of Pin to try and avoid allocating where possible (the user is of course free to put LightEnv on the heap if they don't want to deal with the mess) as well as faithfully portraying the semantics of the C API.

The way to actually use it is a bit convoluted, basically you should use light_env_mut on Instance, technically you should be able to mem::swap on that and it'll bind a different LightEnv, I'm not sure how or if this should be a part of the documented API.

Note this currently does NOT include spotlight support, it only supports point lights.

@jacksonsamuelmoore
Copy link

Just ran some tests on my 3ds vs emulation, I'm seeing some colour banding, though I'm not sure if that's an issue or a side effect of something else?

Emulation (Lime3ds):
_21 06 24_13 58 17 45

My 3ds:
Top
2024-06-21_14-44-12 741_top
Bottom
2024-06-21_14-44-12 741_bot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants