summaryrefslogtreecommitdiff
path: root/model.cpp
diff options
context:
space:
mode:
authorquou <quou@disroot.org>2025-01-05 17:57:08 +1100
committerquou <quou@disroot.org>2025-01-05 17:57:08 +1100
commitd2c4c385df2594a5d4369f2af2f6a7b5d66bdd8c (patch)
treeed0ee1316cfdf783c05dbd245990807332ed0a46 /model.cpp
parent12173bbc77b233997afcc96dede9b292babc7911 (diff)
basic pbr
Diffstat (limited to 'model.cpp')
-rw-r--r--model.cpp7
1 files changed, 6 insertions, 1 deletions
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);