GraphicsTest: Add light

This commit is contained in:
Jérôme Leclercq 2022-02-02 13:47:39 +01:00
parent 109127459b
commit 25c446e10f
1 changed files with 7 additions and 0 deletions

View File

@ -104,6 +104,11 @@ int main()
framePipeline.RegisterInstancedDrawable(modelInstance, &model, 0xFFFFFFFF);
framePipeline.RegisterInstancedDrawable(modelInstance2, &model, 0xFFFFFFFF);
std::shared_ptr<Nz::PointLight> light = std::make_shared<Nz::PointLight>();
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();