mirror of
https://github.com/Llennpie/Saturn.git
synced 2025-01-22 07:32:02 -05:00
Overhaul chroma key stage
This commit is contained in:
parent
090674b234
commit
56ebc2eb25
10 changed files with 56 additions and 93 deletions
|
@ -1,27 +1,13 @@
|
|||
const Collision sa_area_1_collision[] = {
|
||||
COL_INIT(),
|
||||
COL_VERTEX_INIT(8),
|
||||
COL_VERTEX(6400, 100, -6400),
|
||||
COL_VERTEX(-6400, 100, -6400),
|
||||
COL_VERTEX_INIT(4),
|
||||
COL_VERTEX(-6400, 100, 6400),
|
||||
COL_VERTEX(6400, 100, 6400),
|
||||
COL_VERTEX(6400, -100, 6400),
|
||||
COL_VERTEX(-6400, -100, 6400),
|
||||
COL_VERTEX(-6400, -100, -6400),
|
||||
COL_VERTEX(6400, -100, -6400),
|
||||
COL_TRI_INIT(SURFACE_DEFAULT, 12),
|
||||
COL_VERTEX(6400, 100, -6400),
|
||||
COL_VERTEX(-6400, 100, -6400),
|
||||
COL_TRI_INIT(SURFACE_DEFAULT, 2),
|
||||
COL_TRI(0, 1, 2),
|
||||
COL_TRI(0, 2, 3),
|
||||
COL_TRI(4, 3, 2),
|
||||
COL_TRI(4, 2, 5),
|
||||
COL_TRI(5, 2, 1),
|
||||
COL_TRI(5, 1, 6),
|
||||
COL_TRI(6, 7, 4),
|
||||
COL_TRI(6, 4, 5),
|
||||
COL_TRI(7, 0, 3),
|
||||
COL_TRI(7, 3, 4),
|
||||
COL_TRI(6, 1, 0),
|
||||
COL_TRI(6, 0, 7),
|
||||
COL_TRI_STOP(),
|
||||
COL_END()
|
||||
};
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
const GeoLayout sa_area_1_geo[] = {
|
||||
GEO_NODE_START(),
|
||||
GEO_OPEN_NODE(),
|
||||
GEO_DISPLAY_LIST(LAYER_OPAQUE, sa_dl_Cube_001_mesh),
|
||||
GEO_TRANSLATE_NODE_WITH_DL(LAYER_OPAQUE, 0, 100, 0, sa_dl_Plane_001_mesh),
|
||||
GEO_CLOSE_NODE(),
|
||||
GEO_RETURN(),
|
||||
};
|
||||
|
|
|
@ -1,27 +1,13 @@
|
|||
const Collision sa_area_2_collision[] = {
|
||||
COL_INIT(),
|
||||
COL_VERTEX_INIT(8),
|
||||
COL_VERTEX(6400, 100, -6400),
|
||||
COL_VERTEX(-6400, 100, -6400),
|
||||
COL_VERTEX_INIT(4),
|
||||
COL_VERTEX(-6400, 100, 6400),
|
||||
COL_VERTEX(6400, 100, 6400),
|
||||
COL_VERTEX(6400, -100, 6400),
|
||||
COL_VERTEX(-6400, -100, 6400),
|
||||
COL_VERTEX(-6400, -100, -6400),
|
||||
COL_VERTEX(6400, -100, -6400),
|
||||
COL_TRI_INIT(SURFACE_DEFAULT, 12),
|
||||
COL_VERTEX(6400, 100, -6400),
|
||||
COL_VERTEX(-6400, 100, -6400),
|
||||
COL_TRI_INIT(SURFACE_DEFAULT, 2),
|
||||
COL_TRI(0, 1, 2),
|
||||
COL_TRI(0, 2, 3),
|
||||
COL_TRI(4, 3, 2),
|
||||
COL_TRI(4, 2, 5),
|
||||
COL_TRI(5, 2, 1),
|
||||
COL_TRI(5, 1, 6),
|
||||
COL_TRI(6, 7, 4),
|
||||
COL_TRI(6, 4, 5),
|
||||
COL_TRI(7, 0, 3),
|
||||
COL_TRI(7, 3, 4),
|
||||
COL_TRI(6, 1, 0),
|
||||
COL_TRI(6, 0, 7),
|
||||
COL_TRI_STOP(),
|
||||
COL_END()
|
||||
};
|
||||
|
|
|
@ -7,8 +7,8 @@ extern const GeoLayout sa_area_1[];
|
|||
extern const Collision sa_area_1_collision[];
|
||||
extern const MacroObject sa_area_1_macro_objs[];
|
||||
extern Lights1 sa_dl_sm64_material_lights;
|
||||
extern Vtx sa_dl_Cube_001_mesh_vtx_0[24];
|
||||
extern Gfx sa_dl_Cube_001_mesh_tri_0[];
|
||||
extern Vtx sa_dl_Plane_001_mesh_vtx_0[4];
|
||||
extern Gfx sa_dl_Plane_001_mesh_tri_0[];
|
||||
extern Gfx mat_sa_dl_sm64_material[];
|
||||
extern Gfx sa_dl_Cube_001_mesh[];
|
||||
extern Gfx sa_dl_Plane_001_mesh[];
|
||||
extern Gfx sa_dl_material_revert_render_settings[];
|
||||
|
|
|
@ -1,49 +1,18 @@
|
|||
Lights1 sa_dl_sm64_material_lights = gdSPDefLights1(
|
||||
0x3F, 0x31, 0x19,
|
||||
0x7E, 0x63, 0x32, 0x28, 0x28, 0x28);
|
||||
0x3F, 0x32, 0x19,
|
||||
0x0, 0x0, 0x0, 0x0, 0x7F, 0x0);
|
||||
|
||||
Vtx sa_dl_Cube_001_mesh_vtx_0[24] = {
|
||||
{{{6400, 100, -6400},0, {624, 496},{0x0, 0x7F, 0x0, 0xFF}}},
|
||||
{{{-6400, 100, -6400},0, {880, 496},{0x0, 0x7F, 0x0, 0xFF}}},
|
||||
{{{-6400, 100, 6400},0, {880, 240},{0x0, 0x7F, 0x0, 0xFF}}},
|
||||
{{{6400, 100, 6400},0, {624, 240},{0x0, 0x7F, 0x0, 0xFF}}},
|
||||
{{{6400, -100, 6400},0, {368, 240},{0x0, 0x0, 0x7F, 0xFF}}},
|
||||
{{{6400, 100, 6400},0, {624, 240},{0x0, 0x0, 0x7F, 0xFF}}},
|
||||
{{{-6400, 100, 6400},0, {624, -16},{0x0, 0x0, 0x7F, 0xFF}}},
|
||||
{{{-6400, -100, 6400},0, {368, -16},{0x0, 0x0, 0x7F, 0xFF}}},
|
||||
{{{-6400, -100, 6400},0, {368, 1008},{0x81, 0x0, 0x0, 0xFF}}},
|
||||
{{{-6400, 100, 6400},0, {624, 1008},{0x81, 0x0, 0x0, 0xFF}}},
|
||||
{{{-6400, 100, -6400},0, {624, 752},{0x81, 0x0, 0x0, 0xFF}}},
|
||||
{{{-6400, -100, -6400},0, {368, 752},{0x81, 0x0, 0x0, 0xFF}}},
|
||||
{{{-6400, -100, -6400},0, {112, 496},{0x0, 0x81, 0x0, 0xFF}}},
|
||||
{{{6400, -100, -6400},0, {368, 496},{0x0, 0x81, 0x0, 0xFF}}},
|
||||
{{{6400, -100, 6400},0, {368, 240},{0x0, 0x81, 0x0, 0xFF}}},
|
||||
{{{-6400, -100, 6400},0, {112, 240},{0x0, 0x81, 0x0, 0xFF}}},
|
||||
{{{6400, -100, -6400},0, {368, 496},{0x7F, 0x0, 0x0, 0xFF}}},
|
||||
{{{6400, 100, -6400},0, {624, 496},{0x7F, 0x0, 0x0, 0xFF}}},
|
||||
{{{6400, 100, 6400},0, {624, 240},{0x7F, 0x0, 0x0, 0xFF}}},
|
||||
{{{6400, -100, 6400},0, {368, 240},{0x7F, 0x0, 0x0, 0xFF}}},
|
||||
{{{-6400, -100, -6400},0, {368, 752},{0x0, 0x0, 0x81, 0xFF}}},
|
||||
{{{-6400, 100, -6400},0, {624, 752},{0x0, 0x0, 0x81, 0xFF}}},
|
||||
{{{6400, 100, -6400},0, {624, 496},{0x0, 0x0, 0x81, 0xFF}}},
|
||||
{{{6400, -100, -6400},0, {368, 496},{0x0, 0x0, 0x81, 0xFF}}},
|
||||
Vtx sa_dl_Plane_001_mesh_vtx_0[4] = {
|
||||
{{{-6400, 0, 6400},0, {8688, -7696},{0x0, 0x7F, 0x0, 0xFF}}},
|
||||
{{{6400, 0, 6400},0, {-7696, -7696},{0x0, 0x7F, 0x0, 0xFF}}},
|
||||
{{{6400, 0, -6400},0, {-7696, 8688},{0x0, 0x7F, 0x0, 0xFF}}},
|
||||
{{{-6400, 0, -6400},0, {8688, 8688},{0x0, 0x7F, 0x0, 0xFF}}},
|
||||
};
|
||||
|
||||
Gfx sa_dl_Cube_001_mesh_tri_0[] = {
|
||||
gsSPVertex(sa_dl_Cube_001_mesh_vtx_0 + 0, 16, 0),
|
||||
Gfx sa_dl_Plane_001_mesh_tri_0[] = {
|
||||
gsSPVertex(sa_dl_Plane_001_mesh_vtx_0 + 0, 4, 0),
|
||||
gsSP1Triangle(0, 1, 2, 0),
|
||||
gsSP1Triangle(0, 2, 3, 0),
|
||||
gsSP1Triangle(4, 5, 6, 0),
|
||||
gsSP1Triangle(4, 6, 7, 0),
|
||||
gsSP1Triangle(8, 9, 10, 0),
|
||||
gsSP1Triangle(8, 10, 11, 0),
|
||||
gsSP1Triangle(12, 13, 14, 0),
|
||||
gsSP1Triangle(12, 14, 15, 0),
|
||||
gsSPVertex(sa_dl_Cube_001_mesh_vtx_0 + 16, 8, 0),
|
||||
gsSP1Triangle(0, 1, 2, 0),
|
||||
gsSP1Triangle(0, 2, 3, 0),
|
||||
gsSP1Triangle(4, 5, 6, 0),
|
||||
gsSP1Triangle(4, 6, 7, 0),
|
||||
gsSPEndDisplayList(),
|
||||
};
|
||||
|
||||
|
@ -55,9 +24,9 @@ Gfx mat_sa_dl_sm64_material[] = {
|
|||
gsSPEndDisplayList(),
|
||||
};
|
||||
|
||||
Gfx sa_dl_Cube_001_mesh[] = {
|
||||
Gfx sa_dl_Plane_001_mesh[] = {
|
||||
gsSPDisplayList(mat_sa_dl_sm64_material),
|
||||
gsSPDisplayList(sa_dl_Cube_001_mesh_tri_0),
|
||||
gsSPDisplayList(sa_dl_Plane_001_mesh_tri_0),
|
||||
gsSPEndDisplayList(),
|
||||
};
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ const LevelScript level_sa_entry[] = {
|
|||
INIT_LEVEL(),
|
||||
LOAD_MIO0(0x07, _sa_segment_7SegmentRomStart, _sa_segment_7SegmentRomEnd),
|
||||
LOAD_MIO0_TEXTURE(0x09, _inside_mio0SegmentRomStart, _inside_mio0SegmentRomEnd),
|
||||
LOAD_MIO0(0x0A, _wdw_skybox_mio0SegmentRomStart, _wdw_skybox_mio0SegmentRomEnd),
|
||||
LOAD_MIO0(0x0A, _water_skybox_mio0SegmentRomStart, _water_skybox_mio0SegmentRomEnd),
|
||||
LOAD_MIO0(0x0B, _effect_mio0SegmentRomStart, _effect_mio0SegmentRomEnd),
|
||||
LOAD_MIO0(0x05, _group4_mio0SegmentRomStart, _group4_mio0SegmentRomEnd),
|
||||
LOAD_RAW(0x0C, _group4_geoSegmentRomStart, _group4_geoSegmentRomEnd),
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include "save_file.h"
|
||||
#include "segment2.h"
|
||||
#include "sm64.h"
|
||||
#include "src/saturn/saturn_colors.h"
|
||||
|
||||
|
||||
/**
|
||||
|
@ -300,6 +301,14 @@ Gfx *create_skybox_facing_camera(s8 player, s8 background, f32 fov,
|
|||
// If the first star is collected in JRB, make the sky darker and slightly green
|
||||
if (background == 8 && !(save_file_get_star_flags(gCurrSaveFileNum - 1, COURSE_JRB - 1) & 1)) {
|
||||
colorIndex = 0;
|
||||
} else if (gCurrLevelNum == LEVEL_SA && use_color_background && colorIndex == 1) {
|
||||
sSkyboxColors[colorIndex][0] = chromaColor.red[0];
|
||||
sSkyboxColors[colorIndex][1] = chromaColor.green[0];
|
||||
sSkyboxColors[colorIndex][2] = chromaColor.blue[0];
|
||||
} else {
|
||||
sSkyboxColors[colorIndex][0] = 255;
|
||||
sSkyboxColors[colorIndex][1] = 255;
|
||||
sSkyboxColors[colorIndex][2] = 255;
|
||||
}
|
||||
|
||||
//! fov is always set to 90.0f. If this line is removed, then the game crashes because fov is 0 on
|
||||
|
|
|
@ -31,6 +31,8 @@
|
|||
|
||||
#include "saturn/imgui/saturn_imgui.h"
|
||||
|
||||
#include "src/engine/geo_layout.h"
|
||||
|
||||
#define SUPPORT_CHECK(x) assert(x)
|
||||
|
||||
// SCALE_M_N: upscale/downscale M-bit integer to N-bit
|
||||
|
@ -818,7 +820,7 @@ static void gfx_sp_vertex(size_t n_vertices, size_t dest_index, const Vtx *verti
|
|||
bool mario_legtop = (r == 0x7f && g == 0x00 && b == 0x40) | (r == 0x7F && g == 0x00 && b == 0x3F);
|
||||
bool mario_legbottom = (r == 0x40 && g == 0x00 && b == 0x7f) | (r == 0x3F && g == 0x00 && b == 0x7F);
|
||||
|
||||
bool chroma_floor = (r == 0x3f && g == 0x31 && b == 0x19);
|
||||
bool chroma_floor = (r == 0x3f && g == 0x31 && b == 0x19 && use_color_background || r == 0x3f && g == 0x32 && b == 0x19 && use_color_background);
|
||||
|
||||
// Override them lazily
|
||||
if (cc_model_support || chroma_floor) {
|
||||
|
@ -966,9 +968,10 @@ static void gfx_sp_vertex(size_t n_vertices, size_t dest_index, const Vtx *verti
|
|||
b += intensity * sparkColorLegBottom.blue[0];
|
||||
}
|
||||
else if (chroma_floor) {
|
||||
r += intensity * chromaColor.red[0];
|
||||
g += intensity * chromaColor.green[0];
|
||||
b += intensity * chromaColor.blue[0];
|
||||
// No shading
|
||||
r += 0;
|
||||
g += 0;
|
||||
b += 0;
|
||||
}
|
||||
else {
|
||||
r += intensity * lightr;
|
||||
|
|
|
@ -56,12 +56,23 @@ void schroma_imgui_init() {
|
|||
}
|
||||
|
||||
void schroma_imgui_update() {
|
||||
if (ImGui::Checkbox("Color Skybox", &use_color_background))
|
||||
chromaRequireReload = true;
|
||||
|
||||
ImGui::Checkbox("Color Skybox", &use_color_background);
|
||||
if (use_color_background) {
|
||||
if (ImGui::ColorEdit4("Chroma Key Color", (float*)&uiChromaColor, ImGuiColorEditFlags_NoAlpha | ImGuiColorEditFlags_InputRGB | ImGuiColorEditFlags_Uint8 | ImGuiColorEditFlags_NoLabel))
|
||||
chromaRequireReload = true;
|
||||
ImGui::ColorEdit4("Chroma Key Color", (float*)&uiChromaColor, ImGuiColorEditFlags_NoAlpha | ImGuiColorEditFlags_InputRGB | ImGuiColorEditFlags_Uint8 | ImGuiColorEditFlags_NoLabel | ImGuiColorEditFlags_NoOptions);
|
||||
if (ImGui::IsItemActivated()) accept_text_input = false;
|
||||
if (ImGui::IsItemDeactivated()) accept_text_input = true;
|
||||
|
||||
if (ImGui::IsItemHovered() && ImGui::IsMouseReleased(ImGuiMouseButton_Right))
|
||||
ImGui::OpenPopup("###chromaColorPresets");
|
||||
if (ImGui::BeginPopup("###chromaColorPresets")) {
|
||||
if (ImGui::Selectable("Green")) uiChromaColor = ImVec4(0.0f / 255.0f, 255.0f / 255.0f, 0.0f / 255.0f, 255.0f / 255.0f);
|
||||
if (ImGui::Selectable("Blue")) uiChromaColor = ImVec4(0.0f / 255.0f, 0.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f);
|
||||
if (ImGui::Selectable("Pink")) uiChromaColor = ImVec4(255.0f / 255.0f, 0.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f);
|
||||
if (ImGui::Selectable("Black")) uiChromaColor = ImVec4(0.0f / 255.0f, 0.0f / 255.0f, 0.0f / 255.0f, 255.0f / 255.0f);
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
|
||||
set_chroma_color();
|
||||
|
||||
ImGui::SameLine(); ImGui::Text("Color");
|
||||
if (gCurrLevelNum == LEVEL_SA) {
|
||||
|
@ -82,7 +93,6 @@ void schroma_imgui_update() {
|
|||
if (ImGui::IsItemDeactivated()) accept_text_input = true;
|
||||
|
||||
if (ImGui::Button("Reload###apply_chroma_color")) {
|
||||
set_chroma_color();
|
||||
mario_loaded = false;
|
||||
chromaRequireReload = false;
|
||||
bool result = DynOS_Warp_ToLevel(gCurrLevelNum, (s32)currentChromaArea, gCurrActNum);
|
||||
|
|
BIN
textures/saturn/white.rgba16.png
Normal file
BIN
textures/saturn/white.rgba16.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.7 KiB |
Loading…
Reference in a new issue