You've already forked HackerSM64
mirror of
https://github.com/HackerN64/HackerSM64.git
synced 2026-01-21 10:35:32 -08:00
Added WORLDSPACE_LIGHTING define (#461)
Co-authored-by: Gregory Heskett <gheskett@gmail.com>
This commit is contained in:
@@ -9,6 +9,14 @@
|
||||
*/
|
||||
#define GFX_POOL_SIZE 10000
|
||||
|
||||
/**
|
||||
* Causes the global light direction to be in world space,
|
||||
* this allows you to have a singular light source that doesn't change with the camera's rotation.
|
||||
* By modifying `globalLightDirection`, you can choose the direction that points TOWARDS the light,
|
||||
* but keep in mind that this direction should be normalized to roughly ~127 if changed.
|
||||
*/
|
||||
// #define WORLDSPACE_LIGHTING
|
||||
|
||||
/**
|
||||
* Show a watermark on the title screen that reads "Made with HackerSM64", instead of the copyright message.
|
||||
*/
|
||||
|
||||
@@ -573,13 +573,18 @@ void setup_global_light() {
|
||||
Lights1* curLight = (Lights1*)alloc_display_list(sizeof(Lights1));
|
||||
bcopy(&defaultLight, curLight, sizeof(Lights1));
|
||||
|
||||
#ifdef WORLDSPACE_LIGHTING
|
||||
curLight->l->l.dir[0] = (s8)(globalLightDirection[0]);
|
||||
curLight->l->l.dir[1] = (s8)(globalLightDirection[1]);
|
||||
curLight->l->l.dir[2] = (s8)(globalLightDirection[2]);
|
||||
#else
|
||||
Vec3f transformedLightDirection;
|
||||
|
||||
linear_mtxf_transpose_mul_vec3f(gCameraTransform, transformedLightDirection, globalLightDirection);
|
||||
|
||||
curLight->l->l.dir[0] = (s8)(transformedLightDirection[0]);
|
||||
curLight->l->l.dir[1] = (s8)(transformedLightDirection[1]);
|
||||
curLight->l->l.dir[2] = (s8)(transformedLightDirection[2]);
|
||||
#endif
|
||||
|
||||
gSPSetLights1(gDisplayListHead++, (*curLight));
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ extern struct GraphNodeObject *gCurGraphNodeObject;
|
||||
extern struct GraphNodeHeldObject *gCurGraphNodeHeldObject;
|
||||
#define gCurGraphNodeObjectNode ((struct Object *)gCurGraphNodeObject)
|
||||
extern u16 gAreaUpdateCounter;
|
||||
extern Vec3f globalLightDirection;
|
||||
|
||||
enum AnimType {
|
||||
// after processing an object, the type is reset to this
|
||||
|
||||
Reference in New Issue
Block a user