From 56feddb1001caabaa9dbd9601bd51ce3ee90eb5d Mon Sep 17 00:00:00 2001 From: Lynix Date: Mon, 25 Mar 2013 13:27:18 +0100 Subject: [PATCH] Added Scene::GetActiveCamera() Also fixed a warning when instancing is used without lighting Former-commit-id: 5326e95f99a58ffcc91d7942ec2991482d7e58bd --- include/Nazara/3D/Scene.hpp | 1 + src/Nazara/3D/Scene.cpp | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/include/Nazara/3D/Scene.hpp b/include/Nazara/3D/Scene.hpp index 99a988714..c7dff02b0 100644 --- a/include/Nazara/3D/Scene.hpp +++ b/include/Nazara/3D/Scene.hpp @@ -34,6 +34,7 @@ class NAZARA_API NzScene void Cull(); void Draw(); + const NzCamera* GetActiveCamera() const; NzBackground* GetBackground() const; NzSceneNode& GetRoot() const; float GetUpdateTime() const; diff --git a/src/Nazara/3D/Scene.cpp b/src/Nazara/3D/Scene.cpp index 84deb6b0b..3accfb0af 100644 --- a/src/Nazara/3D/Scene.cpp +++ b/src/Nazara/3D/Scene.cpp @@ -269,7 +269,8 @@ void NzScene::Draw() if (instancing) { - shader->SendInteger(lightCountLocation, lightIndex); + if (lightCountLocation != -1) + shader->SendInteger(lightCountLocation, lightIndex); unsigned int count = 0; for (const NzMatrix4f& matrix : subMeshIt.second) @@ -322,6 +323,11 @@ void NzScene::Draw() drawable->Draw(); } +const NzCamera* NzScene::GetActiveCamera() const +{ + return m_impl->camera; +} + NzBackground* NzScene::GetBackground() const { return m_impl->background.get();