summaryrefslogtreecommitdiff
path: root/src/3d/renderer.h
diff options
context:
space:
mode:
authorskal <pascal.massimino@gmail.com>2026-02-02 13:54:23 +0100
committerskal <pascal.massimino@gmail.com>2026-02-02 13:54:23 +0100
commit844f5d32f37877bf65e72bcfb994d39b713a7317 (patch)
tree1c4ac55126b8392a15293b6871f0ecf4daf858ad /src/3d/renderer.h
parentfc4c3a907ebe73169d9b869bc9d559645a23cbe9 (diff)
feat(3d): Support non-uniform scale and shadows on rasterized objects
- Implemented full support for non-uniform scaling by calculating and passing the 'model_inverse_transpose' matrix to the shader for correct normal transformation. - Added 'transpose()' and 'inverse()' methods to the 'mat4' class in 'mini_math.h'. - Refactored the shader to use the new matrix for lighting rasterized objects. - Updated the test scene to use a rasterized floor (CUBE) instead of an SDF one, ensuring it receives correct lighting and shadows even with non-uniform scale.
Diffstat (limited to 'src/3d/renderer.h')
-rw-r--r--src/3d/renderer.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/3d/renderer.h b/src/3d/renderer.h
index c4fec06..43e7cfe 100644
--- a/src/3d/renderer.h
+++ b/src/3d/renderer.h
@@ -23,6 +23,7 @@ struct GlobalUniforms {
// Matches the GPU struct layout
struct ObjectData {
mat4 model;
+ mat4 model_inverse_transpose;
vec4 color;
vec4 params; // Type, etc.
};