Pārlūkot izejas kodu

Added a couple of lights to the ExampleProject, because of ambient light changes

BearishSun 8 gadi atpakaļ
vecāks
revīzija
707aa21fad
1 mainītis faili ar 26 papildinājumiem un 0 dzēšanām
  1. 26 0
      Source/ExampleProject/Source/Main.cpp

+ 26 - 0
Source/ExampleProject/Source/Main.cpp

@@ -13,6 +13,7 @@
 #include "BsVirtualInput.h"
 #include "BsVirtualInput.h"
 #include "BsCCamera.h"
 #include "BsCCamera.h"
 #include "BsCRenderable.h"
 #include "BsCRenderable.h"
+#include "BsCLight.h"
 #include "BsCGUIWidget.h"
 #include "BsCGUIWidget.h"
 #include "BsGUILayoutX.h"
 #include "BsGUILayoutX.h"
 #include "BsGUILayoutY.h"
 #include "BsGUILayoutY.h"
@@ -266,6 +267,31 @@ namespace bs
 		renderable->setMesh(mesh);
 		renderable->setMesh(mesh);
 		renderable->setMaterial(material);
 		renderable->setMaterial(material);
 
 
+		/************************************************************************/
+		/* 									LIGHTS                      		*/
+		/************************************************************************/
+
+		// Add a couple of lights so that our object isn't completely in the dark.
+
+		HSceneObject lightASO = SceneObject::create("Light A");
+		HSceneObject lightBSO = SceneObject::create("Light B");
+
+		lightASO->setPosition(Vector3(0, 50, 0));
+		lightBSO->setPosition(Vector3(-130, 140, 450));
+
+		HLight lightA = lightASO->addComponent<CLight>();
+		HLight lightB = lightBSO->addComponent<CLight>();
+
+		// Disable physically based attentuation because we want to set our own range
+		lightA->setPhysicallyBasedAttenuation(false);
+		lightB->setPhysicallyBasedAttenuation(false);
+
+		lightA->setRange(500.0f);
+		lightB->setRange(300.0f);
+
+		lightA->setIntensity(10000.0f);
+		lightB->setIntensity(10000.0f);
+
 		/************************************************************************/
 		/************************************************************************/
 		/* 									CAMERA	                     		*/
 		/* 									CAMERA	                     		*/
 		/************************************************************************/
 		/************************************************************************/