Fix the stars for goddard and add lights to them.

This commit is contained in:
Dario 2021-04-28 16:35:30 -03:00
parent f74eac13ad
commit f2426a4684
2 changed files with 491 additions and 8 deletions

View File

@ -2,8 +2,8 @@
"textures": [
{
"lightMod": {
"attenuationExponent": 2.0,
"attenuationRadius": 2000.0,
"attenuationExponent": 1.0,
"attenuationRadius": 1500.0,
"diffuseColor": [
1.2999999523162842,
1.2999999523162842,
@ -351,8 +351,8 @@
},
{
"lightMod": {
"attenuationExponent": 2.0,
"attenuationRadius": 6000.0,
"attenuationExponent": 1.0,
"attenuationRadius": 4500.0,
"diffuseColor": [
1.2999999523162842,
1.2999999523162842,
@ -1347,6 +1347,486 @@
{
"materialMod": null,
"name": "textures/water/jrb_textures.0B800.rgba16"
},
{
"lightMod": {
"attenuationExponent": 1.0,
"attenuationRadius": 900.0,
"diffuseColor": [
1.25,
1.25,
1.25
],
"flickerIntensity": 0.0,
"groupBits": 16,
"pointRadius": 50.0,
"position": [
0.0,
0.0,
0.0
],
"shadowOffset": 50.0,
"specularIntensity": 0.6499999761581421
},
"materialMod": {
"lightGroupMaskBits": 0,
"selfLight": [
0.699999988079071,
0.699999988079071,
0.699999988079071
]
},
"name": "textures/intro_raw/white_star_0.rgba16"
},
{
"lightMod": {
"attenuationExponent": 1.0,
"attenuationRadius": 900.0,
"diffuseColor": [
1.25,
1.25,
1.25
],
"flickerIntensity": 0.0,
"groupBits": 16,
"pointRadius": 50.0,
"position": [
0.0,
0.0,
0.0
],
"shadowOffset": 50.0,
"specularIntensity": 0.6499999761581421
},
"materialMod": {
"lightGroupMaskBits": 0,
"selfLight": [
0.699999988079071,
0.699999988079071,
0.699999988079071
]
},
"name": "textures/intro_raw/white_star_1.rgba16"
},
{
"lightMod": {
"attenuationExponent": 1.0,
"attenuationRadius": 900.0,
"diffuseColor": [
1.25,
1.25,
1.25
],
"flickerIntensity": 0.0,
"groupBits": 16,
"pointRadius": 50.0,
"position": [
0.0,
0.0,
0.0
],
"shadowOffset": 50.0,
"specularIntensity": 0.6499999761581421
},
"materialMod": {
"lightGroupMaskBits": 0,
"selfLight": [
0.699999988079071,
0.699999988079071,
0.699999988079071
]
},
"name": "textures/intro_raw/white_star_2.rgba16"
},
{
"lightMod": {
"attenuationExponent": 1.0,
"attenuationRadius": 900.0,
"diffuseColor": [
1.25,
1.25,
1.25
],
"flickerIntensity": 0.0,
"groupBits": 16,
"pointRadius": 50.0,
"position": [
0.0,
0.0,
0.0
],
"shadowOffset": 50.0,
"specularIntensity": 0.6499999761581421
},
"materialMod": {
"lightGroupMaskBits": 0,
"selfLight": [
0.699999988079071,
0.699999988079071,
0.699999988079071
]
},
"name": "textures/intro_raw/white_star_3.rgba16"
},
{
"lightMod": {
"attenuationExponent": 1.0,
"attenuationRadius": 900.0,
"diffuseColor": [
1.25,
1.25,
1.25
],
"flickerIntensity": 0.0,
"groupBits": 16,
"pointRadius": 50.0,
"position": [
0.0,
0.0,
0.0
],
"shadowOffset": 50.0,
"specularIntensity": 0.6499999761581421
},
"materialMod": {
"lightGroupMaskBits": 0,
"selfLight": [
0.699999988079071,
0.699999988079071,
0.699999988079071
]
},
"name": "textures/intro_raw/white_star_4.rgba16"
},
{
"lightMod": {
"attenuationExponent": 1.0,
"attenuationRadius": 900.0,
"diffuseColor": [
1.25,
1.25,
1.25
],
"flickerIntensity": 0.0,
"groupBits": 16,
"pointRadius": 50.0,
"position": [
0.0,
0.0,
0.0
],
"shadowOffset": 50.0,
"specularIntensity": 0.6499999761581421
},
"materialMod": {
"lightGroupMaskBits": 0,
"selfLight": [
0.699999988079071,
0.699999988079071,
0.699999988079071
]
},
"name": "textures/intro_raw/white_star_5.rgba16"
},
{
"lightMod": {
"attenuationExponent": 1.0,
"attenuationRadius": 900.0,
"diffuseColor": [
1.25,
1.25,
1.25
],
"flickerIntensity": 0.0,
"groupBits": 16,
"pointRadius": 50.0,
"position": [
0.0,
0.0,
0.0
],
"shadowOffset": 50.0,
"specularIntensity": 0.6499999761581421
},
"materialMod": {
"lightGroupMaskBits": 0,
"selfLight": [
0.699999988079071,
0.699999988079071,
0.699999988079071
]
},
"name": "textures/intro_raw/white_star_6.rgba16"
},
{
"lightMod": {
"attenuationExponent": 1.0,
"attenuationRadius": 900.0,
"diffuseColor": [
1.25,
1.25,
1.25
],
"flickerIntensity": 0.0,
"groupBits": 16,
"pointRadius": 50.0,
"position": [
0.0,
0.0,
0.0
],
"shadowOffset": 50.0,
"specularIntensity": 0.6499999761581421
},
"materialMod": {
"lightGroupMaskBits": 0,
"selfLight": [
0.699999988079071,
0.699999988079071,
0.699999988079071
]
},
"name": "textures/intro_raw/white_star_7.rgba16"
},
{
"lightMod": {
"attenuationExponent": 1.0,
"attenuationRadius": 900.0,
"diffuseColor": [
1.25,
0.25,
0.25
],
"flickerIntensity": 0.0,
"groupBits": 16,
"pointRadius": 50.0,
"position": [
0.0,
0.0,
0.0
],
"shadowOffset": 50.0,
"specularIntensity": 0.6499999761581421
},
"materialMod": {
"lightGroupMaskBits": 0,
"selfLight": [
0.699999988079071,
0.699999988079071,
0.699999988079071
]
},
"name": "textures/intro_raw/red_star_0.rgba16"
},
{
"lightMod": {
"attenuationExponent": 1.0,
"attenuationRadius": 900.0,
"diffuseColor": [
1.25,
0.25,
0.25
],
"flickerIntensity": 0.0,
"groupBits": 16,
"pointRadius": 50.0,
"position": [
0.0,
0.0,
0.0
],
"shadowOffset": 50.0,
"specularIntensity": 0.6499999761581421
},
"materialMod": {
"lightGroupMaskBits": 0,
"selfLight": [
0.699999988079071,
0.699999988079071,
0.699999988079071
]
},
"name": "textures/intro_raw/red_star_1.rgba16"
},
{
"lightMod": {
"attenuationExponent": 1.0,
"attenuationRadius": 900.0,
"diffuseColor": [
1.25,
0.25,
0.25
],
"flickerIntensity": 0.0,
"groupBits": 16,
"pointRadius": 50.0,
"position": [
0.0,
0.0,
0.0
],
"shadowOffset": 50.0,
"specularIntensity": 0.6499999761581421
},
"materialMod": {
"lightGroupMaskBits": 0,
"selfLight": [
0.699999988079071,
0.699999988079071,
0.699999988079071
]
},
"name": "textures/intro_raw/red_star_2.rgba16"
},
{
"lightMod": {
"attenuationExponent": 1.0,
"attenuationRadius": 900.0,
"diffuseColor": [
1.25,
0.25,
0.25
],
"flickerIntensity": 0.0,
"groupBits": 16,
"pointRadius": 50.0,
"position": [
0.0,
0.0,
0.0
],
"shadowOffset": 50.0,
"specularIntensity": 0.6499999761581421
},
"materialMod": {
"lightGroupMaskBits": 0,
"selfLight": [
0.699999988079071,
0.699999988079071,
0.699999988079071
]
},
"name": "textures/intro_raw/red_star_3.rgba16"
},
{
"lightMod": {
"attenuationExponent": 1.0,
"attenuationRadius": 900.0,
"diffuseColor": [
1.25,
0.25,
0.25
],
"flickerIntensity": 0.0,
"groupBits": 16,
"pointRadius": 50.0,
"position": [
0.0,
0.0,
0.0
],
"shadowOffset": 50.0,
"specularIntensity": 0.6499999761581421
},
"materialMod": {
"lightGroupMaskBits": 0,
"selfLight": [
0.699999988079071,
0.699999988079071,
0.699999988079071
]
},
"name": "textures/intro_raw/red_star_4.rgba16"
},
{
"lightMod": {
"attenuationExponent": 1.0,
"attenuationRadius": 900.0,
"diffuseColor": [
1.25,
0.25,
0.25
],
"flickerIntensity": 0.0,
"groupBits": 16,
"pointRadius": 50.0,
"position": [
0.0,
0.0,
0.0
],
"shadowOffset": 50.0,
"specularIntensity": 0.6499999761581421
},
"materialMod": {
"lightGroupMaskBits": 0,
"selfLight": [
0.699999988079071,
0.699999988079071,
0.699999988079071
]
},
"name": "textures/intro_raw/red_star_5.rgba16"
},
{
"lightMod": {
"attenuationExponent": 1.0,
"attenuationRadius": 900.0,
"diffuseColor": [
1.25,
0.25,
0.25
],
"flickerIntensity": 0.0,
"groupBits": 16,
"pointRadius": 50.0,
"position": [
0.0,
0.0,
0.0
],
"shadowOffset": 50.0,
"specularIntensity": 0.6499999761581421
},
"materialMod": {
"lightGroupMaskBits": 0,
"selfLight": [
0.699999988079071,
0.699999988079071,
0.699999988079071
]
},
"name": "textures/intro_raw/red_star_6.rgba16"
},
{
"lightMod": {
"attenuationExponent": 1.0,
"attenuationRadius": 900.0,
"diffuseColor": [
1.25,
0.25,
0.25
],
"flickerIntensity": 0.0,
"groupBits": 16,
"pointRadius": 50.0,
"position": [
0.0,
0.0,
0.0
],
"shadowOffset": 50.0,
"specularIntensity": 0.6499999761581421
},
"materialMod": {
"lightGroupMaskBits": 0,
"selfLight": [
0.699999988079071,
0.699999988079071,
0.699999988079071
]
},
"name": "textures/intro_raw/red_star_7.rgba16"
}
]
}

View File

@ -216,8 +216,8 @@ static unsigned long get_time(void) {
static struct Matrices {
float model_matrix[4][4];
float inv_model_matrix[4][4];
float extra_model_matrix[4][4];
float camera_matrix[4][4];
float modified_camera_matrix[4][4];
float graph_view_matrix[4][4];
float graph_inv_view_matrix[4][4];
float prev_model_matrix[4][4];
@ -870,21 +870,21 @@ static void gfx_sp_matrix(uint8_t parameters, const int32_t *addr) {
if (parameters & G_MTX_LOAD) {
memcpy(rsp.P_matrix, matrix, sizeof(matrix));
#ifdef GFX_SEPARATE_PROJECTIONS
gd_set_identity_mat4(&separate_projections.extra_model_matrix);
separate_projections.is_ortho = (matrix[3][3] != 0.0f);
#endif
} else {
gfx_matrix_mul(rsp.P_matrix, matrix, rsp.P_matrix);
#ifdef GFX_SEPARATE_PROJECTIONS
// If a view matrix gets pushed into the projection matrix, we multiply and add its effect to
// the current camera matrix.
// the model matrices that get used afterwards.
//
// This is used in two separate instances in the game:
// - Goddard uses it to store the entire view matrix in the projection matrix.
// - When Mario gets hurt, a camera shake effect is applied by applying an offset that acts as
// an additional view matrix in the projection matrix.
if (!separate_projections.is_ortho && !is_identity(matrix)) {
gfx_matrix_mul(separate_projections.modified_camera_matrix, separate_projections.camera_matrix, matrix);
gfx_rapi->set_camera_matrix(separate_projections.modified_camera_matrix);
gfx_matrix_mul(separate_projections.extra_model_matrix, separate_projections.extra_model_matrix, matrix);
}
#endif
}
@ -904,6 +904,7 @@ static void gfx_sp_matrix(uint8_t parameters, const int32_t *addr) {
#ifdef GFX_SEPARATE_PROJECTIONS
gfx_matrix_mul(separate_projections.model_matrix, rsp.modelview_matrix_stack[rsp.modelview_matrix_stack_size - 1], separate_projections.graph_inv_view_matrix);
gfx_matrix_mul(separate_projections.model_matrix, separate_projections.model_matrix, separate_projections.extra_model_matrix);
#endif
}
@ -916,6 +917,7 @@ static void gfx_sp_pop_matrix(uint32_t count) {
#ifdef GFX_SEPARATE_PROJECTIONS
gfx_matrix_mul(separate_projections.model_matrix, rsp.modelview_matrix_stack[rsp.modelview_matrix_stack_size - 1], separate_projections.graph_inv_view_matrix);
gfx_matrix_mul(separate_projections.model_matrix, separate_projections.model_matrix, separate_projections.extra_model_matrix);
#endif
}
}
@ -2067,6 +2069,7 @@ void gfx_start_frame(void) {
gfx_current_dimensions.aspect_ratio = (float)gfx_current_dimensions.width / (float)gfx_current_dimensions.height;
#ifdef GFX_SEPARATE_PROJECTIONS
gd_set_identity_mat4(&separate_projections.extra_model_matrix);
gd_set_identity_mat4(&separate_projections.camera_matrix);
gfx_rapi->set_camera_matrix(separate_projections.camera_matrix);