Lights for Shifting Sand Land.

This commit is contained in:
Dario 2021-04-23 19:37:49 -03:00
parent 3ba21248f7
commit 122d6f2b7f
3 changed files with 58 additions and 16 deletions

View File

@ -2424,6 +2424,25 @@
],
"shadowOffset": 50.0,
"specularIntensity": 0.6499999761581421
},
{
"attenuationExponent": 1.0,
"attenuationRadius": 1500.0,
"diffuseColor": [
0.4000000059604645,
0.4000000059604645,
0.05000000074505806
],
"flickerIntensity": 0.0,
"groupBits": 4,
"pointRadius": 50.0,
"position": [
-2934.3310546875,
-625.76708984375,
-1655.316650390625
],
"shadowOffset": 50.0,
"specularIntensity": 0.6499999761581421
}
]
},
@ -2738,9 +2757,9 @@
"attenuationExponent": 2.0,
"attenuationRadius": 12000.0,
"diffuseColor": [
0.4000000059604645,
0.699999988079071,
0.4000000059604645
1.0,
0.699999988079071
],
"flickerIntensity": 0.0,
"groupBits": 2,
@ -3720,22 +3739,22 @@
"specularIntensity": 0.0
},
{
"attenuationExponent": 0.0,
"attenuationRadius": 99999997952.0,
"attenuationExponent": 0.25,
"attenuationRadius": 5000.0,
"diffuseColor": [
0.800000011920929,
0.75,
0.6499999761581421
0.699999988079071,
0.6499999761581421,
0.4000000059604645
],
"flickerIntensity": 0.0,
"groupBits": 1,
"pointRadius": 5000.0,
"pointRadius": 50.0,
"position": [
100000.0,
200000.0,
100000.0
0.0,
-1157.465576171875,
-831.975830078125
],
"shadowOffset": 0.0,
"shadowOffset": 50.0,
"specularIntensity": 0.6499999761581421
}
]

View File

@ -1100,11 +1100,8 @@ static void gfx_sp_tri1(uint8_t vtx1_idx, uint8_t vtx2_idx, uint8_t vtx3_idx) {
// Continue as normal.
case G_CULL_BACK:
break;
// Flip order in which the vertices are processed and continue.
// Continue as normal.
case G_CULL_FRONT:
swap = vtx3_idx;
vtx3_idx = vtx1_idx;
vtx1_idx = swap;
break;
// Set the double sided flag, flush if any contents were already processed while the flag was false.
default:

View File

@ -11,6 +11,7 @@ extern "C" {
# include "../../game/level_update.h"
# include "../fs/fs.h"
# include "../pc_main.h"
# include "../../goddard/gd_math.h"
# include "gfx_cc.h"
}
@ -158,6 +159,7 @@ struct {
// Camera.
RT64_MATRIX4 viewMatrix;
RT64_MATRIX4 invViewMatrix;
float fovRadians;
float nearDist;
float farDist;
@ -1520,6 +1522,30 @@ static void gfx_rt64_rapi_end_frame(void) {
// Set the camera.
RT64.lib.SetViewPerspective(RT64.view, RT64.viewMatrix, RT64.fovRadians, RT64.nearDist, RT64.farDist);
// Lakitu camera light for Shifting Sand Land Pyramid.
int levelIndex = gCurrLevelNum;
int areaIndex = gCurrAreaIndex;
if ((levelIndex == 8) && (areaIndex == 2)) {
// Extract view position from the inverse matrix.
gd_inverse_mat4f(&RT64.viewMatrix.m, &RT64.invViewMatrix.m);
auto &light = RT64.lights[RT64.lightCount++];
RT64_VECTOR3 viewPos = { RT64.invViewMatrix.m[3][0], RT64.invViewMatrix.m[3][1], RT64.invViewMatrix.m[3][2] };
RT64_VECTOR3 marioPos = { gMarioState->pos[0], gMarioState->pos[1], gMarioState->pos[2] };
light.diffuseColor.x = 1.0f;
light.diffuseColor.y = 0.9f;
light.diffuseColor.z = 0.5f;
light.position.x = viewPos.x + (viewPos.x - marioPos.x);
light.position.y = viewPos.y + 150.0f;
light.position.z = viewPos.z + (viewPos.z - marioPos.z);
light.attenuationRadius = 4000.0f;
light.attenuationExponent = 1.0f;
light.pointRadius = 25.0f;
light.specularIntensity = 0.65f;
light.shadowOffset = 1000.0f;
light.groupBits = RT64_LIGHT_GROUP_DEFAULT;
}
// Set lights on the scene.
RT64.lib.SetSceneLights(RT64.scene, RT64.lights, RT64.lightCount);