From 25c446e10f4b44ff3f765c8f3781e61a0256e9f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Leclercq?= Date: Wed, 2 Feb 2022 13:47:39 +0100 Subject: [PATCH] GraphicsTest: Add light --- examples/GraphicsTest/main.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/examples/GraphicsTest/main.cpp b/examples/GraphicsTest/main.cpp index b65070537..c8412f107 100644 --- a/examples/GraphicsTest/main.cpp +++ b/examples/GraphicsTest/main.cpp @@ -104,6 +104,11 @@ int main() framePipeline.RegisterInstancedDrawable(modelInstance, &model, 0xFFFFFFFF); framePipeline.RegisterInstancedDrawable(modelInstance2, &model, 0xFFFFFFFF); + std::shared_ptr light = std::make_shared(); + light->UpdateColor(Nz::Color::Green); + + framePipeline.RegisterLight(light, 0xFFFFFFFF); + Nz::Vector3f viewerPos = Nz::Vector3f::Zero(); Nz::EulerAnglesf camAngles(0.f, 0.f, 0.f); @@ -202,6 +207,8 @@ int main() // ContrĂ´le (Gauche ou droite) pour descendre dans l'espace global, etc... if (Nz::Keyboard::IsKeyPressed(Nz::Keyboard::VKey::LControl) || Nz::Keyboard::IsKeyPressed(Nz::Keyboard::VKey::RControl)) viewerPos += Nz::Vector3f::Down() * cameraSpeed; + + light->UpdatePosition(viewerPos); } Nz::RenderFrame frame = window.AcquireFrame();