The lighting is done better where I set it up once in the shader and then only change the camera spotlight when the camera moves.
This commit is contained in:
parent
748528a31f
commit
032f10ef44
5 changed files with 22 additions and 3 deletions
|
|
@ -44,9 +44,14 @@ void Scene::render(GLFWwindow* window) {
|
|||
shader.setMat4("projection", projection);
|
||||
shader.setVec3("viewPos", camera.position);
|
||||
|
||||
light.camera.position = camera.position;
|
||||
light.camera.direction = camera.front;
|
||||
shader.apply_lighting(light);
|
||||
// for now just detect the camera moved and do spotlight update
|
||||
if(camera.dirty) {
|
||||
light.camera.position = camera.position;
|
||||
light.camera.direction = camera.front;
|
||||
// just update the camera's light
|
||||
shader.apply_spot_light(light.camera, 0);
|
||||
camera.dirty = false;
|
||||
}
|
||||
|
||||
// BUG: no connection between models and positions
|
||||
for(auto& thing : things) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue