[jak3] Collision Renderer - support new pat-events and pat-materials (#4049)

before
<img width="3840" height="2160" alt="image"
src="https://github.com/user-attachments/assets/23740c18-f9f4-4049-adb4-fdcc3f6a0123"
/>

after
<img width="3840" height="2160" alt="image"
src="https://github.com/user-attachments/assets/19d0538c-5a17-4694-a368-e2b077333305"
/>

event mode with some new colors:
<img width="3840" height="2110" alt="image"
src="https://github.com/user-attachments/assets/a76f157c-b702-4e2f-943a-841964a0ebb6"
/>

material mode with some new colors:
<img width="3840" height="2110" alt="image"
src="https://github.com/user-attachments/assets/b698065d-4225-4e57-b9f5-cb176c20c94f"
/>
This commit is contained in:
Matt Dallmeyer
2025-10-17 12:41:09 -07:00
committed by GitHub
parent 73dd982fdc
commit e594b23469
4 changed files with 80 additions and 15 deletions
+3 -3
View File
@@ -50,8 +50,8 @@ struct GfxRendererModule {
// runtime settings
static constexpr int PAT_MOD_COUNT = 4;
static constexpr int PAT_EVT_COUNT = 15;
static constexpr int PAT_MAT_COUNT = 29;
static constexpr int PAT_EVT_COUNT = 20;
static constexpr int PAT_MAT_COUNT = 34;
struct GfxGlobalSettings {
bool debug = true; // graphics debugging
@@ -101,7 +101,7 @@ struct GfxGlobalSettings {
enum CollisionRendererMode { None, Mode, Event, Material, Skip, SkipHide } collision_mode = Mode;
std::array<u32, (PAT_MOD_COUNT + 31) / 32> collision_mode_mask = {UINT32_MAX};
std::array<u32, (PAT_EVT_COUNT + 31) / 32> collision_event_mask = {UINT32_MAX};
std::array<u32, (PAT_MAT_COUNT + 31) / 32> collision_material_mask = {UINT32_MAX};
std::array<u32, (PAT_MAT_COUNT + 31) / 32> collision_material_mask = {UINT32_MAX, UINT32_MAX};
u32 collision_skip_mask = 0;
u32 collision_skip_hide_mask = 0;
bool collision_skip_nomask_allowed = true;
@@ -104,6 +104,66 @@ const static std::vector<float> mode_colors_jak2 = {
1.0f, 1.0f, 0.1f, // 3, halfpipe
};
const static std::vector<float> material_colors_jak3 = {
1.0f, 0.1f, 1.0f, // 0, unknown
0.1f, 2.0f, 2.0f, // 1, ice
0.75f, 0.25f, 0.1f, // 2, quicksand
0.1f, 0.25f, 0.75f, // 3, waterbottom
0.5f, 0.15f, 0.1f, // 4, tar
2.0f, 1.5f, 0.5f, // 5, sand
1.5f, 0.75f, 0.1f, // 6, wood
0.1f, 1.35f, 0.1f, // 7, grass
1.7f, 1.3f, 0.1f, // 8, pcmetal
1.8f, 1.8f, 1.8f, // 9, snow
1.5f, 0.2f, 1.0f, // 10, deepsnow
1.2f, 0.5f, 0.3f, // 11, hotcoals
1.4f, 0.1f, 0.1f, // 12, lava
0.8f, 0.3f, 0.1f, // 13, crwood
1.0f, 0.4f, 1.0f, // 14, gravel
1.5f, 0.5f, 0.15f, // 15, dirt
0.7f, 0.7f, 1.0f, // 16, metal
0.1f, 0.1f, 1.2f, // 17, straw
0.75f, 1.75f, 0.75f, // 18, tube
0.4f, 0.1f, 0.8f, // 19, swamp
0.1f, 0.4f, 0.8f, // 20, stopproj
1.9f, 0.1f, 1.9f, // 21, rotate
1.0f, 1.0f, 1.0f, // 22, neutral
1.0f, 0.7f, 1.0f, // 23, stone
0.8f, 1.2f, 1.2f, // 24, crmetal
0.7f, 0.0f, 0.0f, // 25, carpet
0.1f, 0.9f, 0.1f, // 26, grmetal
1.4f, 0.7f, 0.1f, // 27, shmetal
0.5f, 0.5f, 0.0f, // 28, hdwood
2.0f, 1.2f, 1.2f, // 29, squish
2.0f, 1.25f, 0.1f, // 30, mhshroom
0.5f, 1.0f, 0.5f, // 31, forest
1.25f, 2.0f, 0.75f, // 32, mhswamp
0.85f, 0.5f, 2.0f, // 33, dmaker
};
const static std::vector<float> event_colors_jak3 = {
1.0f, 1.0f, 1.0f, // 0, none
0.5f, 1.0f, 1.0f, // 1, deadly
0.1f, 1.0f, 0.1f, // 2, endlessfall
1.0f, 1.0f, 0.1f, // 3, burn
0.1f, 0.1f, 1.0f, // 4, deadlyup
1.0f, 0.1f, 0.5f, // 5, burnup
1.0f, 0.1f, 0.1f, // 6, melt
0.1f, 0.7f, 0.7f, // 7, slide
1.0f, 0.2f, 1.0f, // 8, lip
0.5f, 0.2f, 1.0f, // 9, lipramp
0.1f, 0.5f, 1.0f, // 10, shock
0.5f, 0.6f, 1.0f, // 11, shockup
0.5f, 0.6f, 0.5f, // 12, hide
0.5f, 1.0f, 0.5f, // 13, rail
0.7f, 0.7f, 0.7f, // 14, slippery
1.2f, 1.2f, 0.1f, // 15, drag
1.2f, 2.0f, 2.0f, // 16, waterfloor
2.0f, 1.0f, 0.1f, // 17, hang
1.2f, 0.1f, 0.1f, // 18, fry
0.1f, 2.0f, 0.1f // 19, slime
};
CollideMeshRenderer::CollideMeshRenderer(GameVersion version) {
glGenVertexArrays(1, &m_vao);
glGenBuffers(1, &m_ubo);
@@ -121,17 +181,17 @@ CollideMeshRenderer::~CollideMeshRenderer() {
}
void CollideMeshRenderer::init_pat_colors(GameVersion version) {
for (int i = 0; i < 4; ++i) {
for (int i = 0; i < PAT_MOD_COUNT; ++i) {
m_colors.pat_mode_colors[i].x() = -1.f;
m_colors.pat_mode_colors[i].y() = -1.f;
m_colors.pat_mode_colors[i].z() = -1.f;
}
for (int i = 0; i < 32; ++i) {
for (int i = 0; i < PAT_MAT_COUNT; ++i) {
m_colors.pat_material_colors[i].x() = -1.f;
m_colors.pat_material_colors[i].y() = -1.f;
m_colors.pat_material_colors[i].z() = -1.f;
}
for (int i = 0; i < 32; ++i) {
for (int i = 0; i < PAT_EVT_COUNT; ++i) {
m_colors.pat_event_colors[i].x() = -1.f;
m_colors.pat_event_colors[i].y() = -1.f;
m_colors.pat_event_colors[i].z() = -1.f;
@@ -148,11 +208,15 @@ void CollideMeshRenderer::init_pat_colors(GameVersion version) {
mode_colors = &mode_colors_jak1;
break;
case GameVersion::Jak2:
case GameVersion::Jak3:
material_colors = &material_colors_jak2;
event_colors = &event_colors_jak2;
mode_colors = &mode_colors_jak2;
break;
case GameVersion::Jak3:
material_colors = &material_colors_jak3;
event_colors = &event_colors_jak3;
mode_colors = &mode_colors_jak2; // unchanged from jak2
break;
}
if (material_colors) {
@@ -2,11 +2,12 @@
#include "common/versions/versions.h"
#include "game/graphics/opengl_renderer/BucketRenderer.h"
#include <game/graphics/gfx.h>
struct PatColors {
math::Vector4f pat_mode_colors[4];
math::Vector4f pat_material_colors[32];
math::Vector4f pat_event_colors[32];
math::Vector4f pat_mode_colors[PAT_MOD_COUNT];
math::Vector4f pat_material_colors[PAT_MAT_COUNT];
math::Vector4f pat_event_colors[PAT_EVT_COUNT];
};
class CollideMeshRenderer {
@@ -19,8 +19,8 @@ uniform int version;
out vec4 fragment_color;
const int PAT_MOD_COUNT = 4;
const int PAT_EVT_COUNT = 15;
const int PAT_MAT_COUNT = 29;
const int PAT_EVT_COUNT = 20;
const int PAT_MAT_COUNT = 34;
uniform uint collision_mode_mask[(PAT_MOD_COUNT + 31) / 32];
uniform uint collision_event_mask[(PAT_EVT_COUNT + 31) / 32];
uniform uint collision_material_mask[(PAT_MAT_COUNT + 31) / 32];
@@ -42,9 +42,9 @@ bool logtest(uint a, uint b) { return (a & b) != 0; }
bool logtesta(uint a, uint b) { return (a & b) == b; }
layout(std140) uniform PatColors {
vec4 pat_mode_colors[4];
vec4 pat_material_colors[32];
vec4 pat_event_colors[32];
vec4 pat_mode_colors[PAT_MOD_COUNT];
vec4 pat_material_colors[PAT_MAT_COUNT];
vec4 pat_event_colors[PAT_EVT_COUNT];
};
void main() {