@@ -50,9 +50,34 @@ uniform float preBlurAmount;
5050uniform float clipXY;
5151uniform float focalAdjustment;
5252
53- #define HOOK_GLOBAL
53+ // Shader hooks
54+ #ifdef HOOK_GLOBAL
55+ {{HOOK_GLOBAL}}
56+ #endif
57+
58+ #ifdef HOOK_UNIFORMS
59+ {{HOOK_UNIFORMS}}
60+ #endif
61+
62+ #ifdef HOOK_OBJECT_MODIFIER
63+ void _shader_hook_object_modifier(inout vec3 center, inout vec3 scales, inout vec4 quaternion, inout vec4 rgba) {
64+ {{HOOK_OBJECT_MODIFIER}}
65+ }
66+ #endif
67+
68+ #ifdef HOOK_WORLD_MODIFIER
69+ void _shader_hook_world_modifier(inout vec3 center, inout vec3 scales, inout vec4 quaternion, inout vec4 rgba) {
70+ {{HOOK_WORLD_MODIFIER}}
71+ }
72+ #endif
73+
74+ #ifdef HOOK_SPLAT_COLOR
75+ vec4 _shader_hook_splat_color(in vec3 center, in vec3 scales, in vec4 quaternion, inout vec4 rgba, in vec3 viewCenter) {
76+ {{HOOK_SPLAT_COLOR}}
77+ return rgba;
78+ }
79+ #endif
5480
55- #define HOOK_UNIFORMS
5681
5782void main() {
5883 // Default to outside the frustum so it's discarded if we return early
@@ -68,7 +93,9 @@ void main() {
6893 uint sIndex = splatIndex & 0x3FFFFFu;
6994 uint objectIndex = splatIndex >> 26u;
7095 decodeSplat(sIndex, center, scales, quaternion, rgba);
71- #define HOOK_OBJECT_MODIFIER
96+ #ifdef HOOK_OBJECT_MODIFIER
97+ _shader_hook_object_modifier(center, scales, quaternion, rgba);
98+ #endif
7299
73100#ifdef USE_BATCHING
74101 mat4 splatModelMatrix = getBatchingMatrix(objectIndex);
@@ -86,7 +113,10 @@ void main() {
86113 center = (splatModelMatrix * vec4 (center, 1.0 )).xyz;
87114 scales *= modelScale;
88115 rgba.a *= opacity;
89- #define HOOK_WORLD_MODIFIER
116+
117+ #ifdef HOOK_WORLD_MODIFIER
118+ _shader_hook_world_modifier(center, scales, quaternion, rgba);
119+ #endif
90120
91121 if (rgba.a < minAlpha) {
92122 return ;
@@ -224,7 +254,9 @@ void main() {
224254 rgba.rgb += evaluateSH(viewDir, sh1, sh2, sh3);
225255 #endif
226256
227- #define HOOK_SPLAT_COLOR
257+ #ifdef HOOK_SPLAT_COLOR
258+ rgba = _shader_hook_splat_color(center, scales, quaternion, rgba, viewCenter);
259+ #endif
228260
229261 vRgba = rgba;
230262 vSplatUv = position.xy * maxStdDev;
0 commit comments