diff options
author | quou <quou@disroot.org> | 2025-02-13 23:32:28 +1100 |
---|---|---|
committer | quou <quou@disroot.org> | 2025-02-13 23:33:54 +1100 |
commit | 2e4ecca19aadc09d5c3d927724f8004b6a0ff0b0 (patch) | |
tree | 156c747452788f5221158f6e2a9151eaeb61b672 /intermediate | |
parent | 42cd6a572a35c354dc7d7fd390e86e7cff191617 (diff) |
refactoring; prep for shadows
Diffstat (limited to 'intermediate')
-rw-r--r-- | intermediate/surface.glsl | 22 | ||||
-rw-r--r-- | intermediate/surface_depthonly.glsl | 18 |
2 files changed, 28 insertions, 12 deletions
diff --git a/intermediate/surface.glsl b/intermediate/surface.glsl index 17ddd06..9fc1c48 100644 --- a/intermediate/surface.glsl +++ b/intermediate/surface.glsl @@ -31,10 +31,13 @@ name: tbn type: mat3 [struct] -name: MVP +name: Model [variable] name: model type: mat4 + +[struct] +name: VP [variable] name: view_projection type: mat4 @@ -73,8 +76,13 @@ name: colour type: vec3 [cbuffer] -name: c_mvp -type: MVP +name: c_vp +type: VP +stage: vertex + +[cbuffer] +name: c_model +type: Model stage: vertex [cbuffer] @@ -121,15 +129,15 @@ type: vec4 #ifdef VERTEX_SHADER void main() { - vec4 pos = c_mvp.model * vec4(position, 1.0); - vec3 t = normalize((c_mvp.model * vec4(tangent, 0.0)).xyz); - vec3 n = normalize((c_mvp.model * vec4(normal, 0.0)).xyz); + vec4 pos = c_model.model * vec4(position, 1.0); + vec3 t = normalize((c_model.model * vec4(tangent, 0.0)).xyz); + vec3 n = normalize((c_model.model * vec4(normal, 0.0)).xyz); vec3 b = cross(t, n); interpolator.tbn = mat3(t, b, n); interpolator.uv = uv; interpolator.position = pos; interpolator.tbn = mat3(t, b, n); - gl_Position = c_mvp.view_projection * pos; + gl_Position = c_vp.view_projection * pos; } #endif diff --git a/intermediate/surface_depthonly.glsl b/intermediate/surface_depthonly.glsl index f53a937..2db5e96 100644 --- a/intermediate/surface_depthonly.glsl +++ b/intermediate/surface_depthonly.glsl @@ -12,17 +12,25 @@ name: position type: vec3 [struct] -name: MVP +name: Model [variable] name: model type: mat4 + +[struct] +name: VP [variable] name: view_projection type: mat4 [cbuffer] -name: c_mvp -type: MVP +name: c_vp +type: VP +stage: vertex + +[cbuffer] +name: c_model +type: Model stage: vertex #endif @@ -30,8 +38,8 @@ stage: vertex #ifdef VERTEX_SHADER void main() { - vec4 pos = c_mvp.model * vec4(position, 1.0); - gl_Position = c_mvp.view_projection * pos; + vec4 pos = c_model.model * vec4(position, 1.0); + gl_Position = c_vp.view_projection * pos; } #endif |