2021-09-15 23:24:19 +00:00
|
|
|
#ifndef Z64LIGHT_H
|
|
|
|
#define Z64LIGHT_H
|
2020-03-17 04:31:30 +00:00
|
|
|
|
2020-10-03 15:22:44 +00:00
|
|
|
#include "ultra64.h"
|
|
|
|
#include "ultra64/gbi.h"
|
|
|
|
#include "z64math.h"
|
|
|
|
#include "color.h"
|
2020-03-17 04:31:30 +00:00
|
|
|
|
2020-03-22 21:50:11 +00:00
|
|
|
typedef struct {
|
2020-09-05 13:45:10 +00:00
|
|
|
/* 0x0 */ s16 x;
|
|
|
|
/* 0x2 */ s16 y;
|
|
|
|
/* 0x4 */ s16 z;
|
|
|
|
/* 0x6 */ u8 color[3];
|
|
|
|
/* 0x9 */ u8 drawGlow;
|
|
|
|
/* 0xA */ s16 radius;
|
|
|
|
} LightPoint; // size = 0xC
|
2020-03-17 04:31:30 +00:00
|
|
|
|
2020-03-22 21:50:11 +00:00
|
|
|
typedef struct {
|
2020-09-05 13:45:10 +00:00
|
|
|
/* 0x0 */ s8 x;
|
|
|
|
/* 0x1 */ s8 y;
|
|
|
|
/* 0x2 */ s8 z;
|
|
|
|
/* 0x3 */ u8 color[3];
|
|
|
|
} LightDirectional; // size = 0x6
|
|
|
|
|
|
|
|
typedef union {
|
|
|
|
LightPoint point;
|
|
|
|
LightDirectional dir;
|
|
|
|
} LightParams; // size = 0xC
|
2020-03-17 04:31:30 +00:00
|
|
|
|
2020-03-22 21:50:11 +00:00
|
|
|
typedef struct {
|
2020-03-17 04:31:30 +00:00
|
|
|
/* 0x0 */ u8 type;
|
2020-09-05 13:45:10 +00:00
|
|
|
/* 0x2 */ LightParams params;
|
|
|
|
} LightInfo; // size = 0xE
|
2020-03-17 04:31:30 +00:00
|
|
|
|
2020-12-02 03:19:56 +00:00
|
|
|
typedef struct Lights {
|
2020-09-05 13:45:10 +00:00
|
|
|
/* 0x00 */ u8 numLights;
|
|
|
|
/* 0x08 */ Lightsn l;
|
|
|
|
} Lights; // size = 0x80
|
2020-03-17 04:31:30 +00:00
|
|
|
|
2020-09-05 13:45:10 +00:00
|
|
|
typedef struct LightNode {
|
|
|
|
/* 0x0 */ LightInfo* info;
|
|
|
|
/* 0x4 */ struct LightNode* prev;
|
|
|
|
/* 0x8 */ struct LightNode* next;
|
|
|
|
} LightNode; // size = 0xC
|
2020-03-17 04:31:30 +00:00
|
|
|
|
2022-11-01 23:00:38 +00:00
|
|
|
#define ENV_FOGNEAR_MAX 996
|
|
|
|
#define ENV_ZFAR_MAX 12800
|
|
|
|
|
2020-03-22 21:50:11 +00:00
|
|
|
typedef struct {
|
2020-09-05 13:45:10 +00:00
|
|
|
/* 0x0 */ LightNode* listHead;
|
2021-09-20 16:51:35 +00:00
|
|
|
/* 0x4 */ u8 ambientColor[3];
|
|
|
|
/* 0x7 */ u8 fogColor[3];
|
2022-11-01 23:00:38 +00:00
|
|
|
/* 0xA */ s16 fogNear; // how close until fog starts taking effect. range 0 - ENV_FOGNEAR_MAX
|
|
|
|
/* 0xC */ s16 zFar; // draw distance. range 0 - ENV_ZFAR_MAX
|
2020-09-05 13:45:10 +00:00
|
|
|
} LightContext; // size = 0x10
|
2020-03-17 04:31:30 +00:00
|
|
|
|
2020-09-05 13:45:10 +00:00
|
|
|
typedef enum {
|
|
|
|
/* 0x00 */ LIGHT_POINT_NOGLOW,
|
|
|
|
/* 0x01 */ LIGHT_DIRECTIONAL,
|
|
|
|
/* 0x02 */ LIGHT_POINT_GLOW
|
|
|
|
} LightType;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
2020-09-05 13:45:10 +00:00
|
|
|
typedef void (*LightsBindFunc)(Lights* lights, LightParams* params, Vec3f* vec);
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
|
|
#endif
|