mirror of https://github.com/zeldaret/mm.git
PointLight_t
This commit is contained in:
parent
339b4dc981
commit
2e51f26d1e
|
|
@ -1277,12 +1277,12 @@ typedef struct {
|
|||
|
||||
// Added in MM
|
||||
typedef struct {
|
||||
unsigned char col[3];
|
||||
unsigned char unk3;
|
||||
unsigned char colc[3];
|
||||
unsigned char unk7;
|
||||
short pos[3];
|
||||
unsigned char unkE;
|
||||
unsigned char col[3];
|
||||
unsigned char kc;
|
||||
unsigned char colc[3];
|
||||
unsigned char kl;
|
||||
short pos[3];
|
||||
unsigned char kq;
|
||||
} PointLight_t;
|
||||
|
||||
typedef struct {
|
||||
|
|
|
|||
|
|
@ -132,39 +132,43 @@ void Lights_BindPointWithReference(Lights* lights, LightParams* params, Vec3f* p
|
|||
|
||||
void Lights_BindPoint(Lights* lights, LightParams* params, PlayState* play) {
|
||||
Light* light;
|
||||
f32 radiusF = params->point.radius;
|
||||
Vec3f posF;
|
||||
f32 kq = params->point.radius;
|
||||
Vec3f pos;
|
||||
Vec3f adjustedPos;
|
||||
s32 pad;
|
||||
|
||||
if (radiusF > 0) {
|
||||
posF.x = params->point.x;
|
||||
posF.y = params->point.y;
|
||||
posF.z = params->point.z;
|
||||
SkinMatrix_Vec3fMtxFMultXYZ(&play->viewProjectionMtxF, &posF, &adjustedPos);
|
||||
if ((adjustedPos.z > -radiusF) && (600 + radiusF > adjustedPos.z) && (400 > fabsf(adjustedPos.x) - radiusF) &&
|
||||
(400 > fabsf(adjustedPos.y) - radiusF)) {
|
||||
if (kq > 0.0f) {
|
||||
pos.x = params->point.x;
|
||||
pos.y = params->point.y;
|
||||
pos.z = params->point.z;
|
||||
SkinMatrix_Vec3fMtxFMultXYZ(&play->viewProjectionMtxF, &pos, &adjustedPos);
|
||||
if ((-kq < adjustedPos.z) && ((600.0f + kq) > adjustedPos.z) && ((fabsf(adjustedPos.x) - kq) < 400.0f) &&
|
||||
((fabsf(adjustedPos.y) - kq) < 400.0f)) {
|
||||
light = Lights_FindSlot(lights);
|
||||
if (light != NULL) {
|
||||
radiusF = 4500000.0f / (radiusF * radiusF);
|
||||
if (radiusF > 255) {
|
||||
radiusF = 255;
|
||||
} else if (20 > radiusF) {
|
||||
radiusF = 20;
|
||||
kq = 4500000.0f / SQ(kq);
|
||||
if (kq > 255.0f) {
|
||||
kq = 255.0f;
|
||||
} else if (20.0f > kq) {
|
||||
kq = 20.0f;
|
||||
}
|
||||
|
||||
light->p.col[0] = params->point.color[0];
|
||||
light->p.colc[0] = light->p.col[0];
|
||||
|
||||
light->p.col[1] = params->point.color[1];
|
||||
light->p.colc[1] = light->p.col[1];
|
||||
|
||||
light->p.col[2] = params->point.color[2];
|
||||
light->p.colc[2] = light->p.col[2];
|
||||
|
||||
light->p.pos[0] = params->point.x;
|
||||
light->p.pos[1] = params->point.y;
|
||||
light->p.pos[2] = params->point.z;
|
||||
light->p.unk3 = 0x8;
|
||||
light->p.unk7 = 0xFF;
|
||||
light->p.unkE = (s32)radiusF;
|
||||
|
||||
light->p.kc = 8;
|
||||
light->p.kl = -1;
|
||||
light->p.kq = (s32)kq;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue