From 0252adf8c3f402478c8210bc2d890a27f99fa463 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Halvor=20Smed=C3=A5s?= <stektpotet@gmail.com>
Date: Sun, 29 Apr 2018 18:10:31 +0200
Subject: [PATCH] Added way of moving lights around

---
 assets/scenes/_default.yml | 46 +++++++++++++++++++++++++++++++++-----
 src/EntityPointLight.cpp   |  2 +-
 2 files changed, 41 insertions(+), 7 deletions(-)

diff --git a/assets/scenes/_default.yml b/assets/scenes/_default.yml
index 795b132..026868a 100644
--- a/assets/scenes/_default.yml
+++ b/assets/scenes/_default.yml
@@ -11,7 +11,7 @@ camera: maincam
   nearClip: 0.1
   farClip: 4000
 
-entities: 3
+entities: 5
 
 
 entity: skybox
@@ -32,28 +32,62 @@ entity: Suzanne
 
   
 entity: cube
-  model: cube
+  model: Icosphere
   position: 10 0 0
   rotation: 0 0 0
   scale: 1 1 1
   velocity: 0 0 0
   angleVelocity: 0 0 0
 
-pointlights: 1
+entity: light0
+  model: null
+  position: 10 0 0
+  rotation: 0 0 0
+  scale: 1 1 1
+  velocity: 0 0 0
+  angleVelocity: 0 0 0
+  
+entity: light1
+  model: null
+  position: -10 0 0
+  rotation: 0 0 0
+  scale: 1 1 1
+  velocity: 0 0 0
+  angleVelocity: 0 0 0
+
+pointlights: 3
 
 pointlight: red
-  position: 0 0 0
+  position: 0 0 0 #use parent position instead
+  velocity: 0 0 0
+  intensities: 2 0 0
+  falloff: 1.0 0.03125 0.0625
+  
+pointlight: green
+  position: 10 0 0 #use parent position instead
+  velocity: 0 0 0
+  intensities: 0 2 0
+  falloff: 1.0 0.03125 0.0625
+  
+pointlight: blue
+  position: -10 0 0 #use parent position instead
   velocity: 0 0 0
-  intensities: 10 0 0
+  intensities: 0 0 2
   falloff: 1.0 0.03125 0.0625
 
 
 hasSun: 0
 
 
-relations: 3
+relations: 7
   red: 0
+  green: 0
+  blue: 0
   cube: 1
     red
   Suzanne: 1
 	cube
+  light0: 1
+    green
+  light1: 1
+    blue
diff --git a/src/EntityPointLight.cpp b/src/EntityPointLight.cpp
index 04f09d4..7cd47ae 100644
--- a/src/EntityPointLight.cpp
+++ b/src/EntityPointLight.cpp
@@ -36,7 +36,7 @@ void EntityPointLight::update(float dt, glm::mat4 parentMatrix)
     m_transformMatrix = getModelMatrix(parentMatrix);
     m_position += m_velocity * dt;
     m_rotation += m_angularVelocity * dt;
-    
+
     m_position = glm::vec3(parentMatrix[3]);
 
     
-- 
GitLab