From d2c4c385df2594a5d4369f2af2f6a7b5d66bdd8c Mon Sep 17 00:00:00 2001 From: quou Date: Sun, 5 Jan 2025 17:57:08 +1100 Subject: basic pbr --- model.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'model.cpp') diff --git a/model.cpp b/model.cpp index 4c5edcc..778d945 100644 --- a/model.cpp +++ b/model.cpp @@ -20,7 +20,9 @@ struct Mat_Cbuffer { float metalness; float roughness; float ao; - char pad[40]; + char pad2[8]; + float camera_pos[3]; + char pad[20]; }; void Material::use( @@ -316,6 +318,9 @@ void Model_Instance::update_cbuffers( mat.metalness = sm.metalness; mat.roughness = sm.roughness; mat.ao = sm.ao; + mat.camera_pos[0] = cam.position.x; + mat.camera_pos[1] = cam.position.y; + mat.camera_pos[2] = cam.position.z; } dev->unmap_buffer(mvp); dev->unmap_buffer(mat); -- cgit v1.2.3-54-g00ecf