Przeglądaj źródła

Refactor/Cleanup: Scene manager and renderer are no longer split across two libraries, for no real reason. Moved everything related to them to Core layer.

BearishSun 8 lat temu
rodzic
commit
53ffc80827
56 zmienionych plików z 1631 dodań i 1811 usunięć
  1. 22 4
      Source/BansheeCore/CMakeSources.cmake
  2. 2 2
      Source/BansheeCore/Include/BsCAnimation.h
  3. 2 2
      Source/BansheeCore/Include/BsCAnimationRTTI.h
  4. 2 2
      Source/BansheeCore/Include/BsCBone.h
  5. 2 2
      Source/BansheeCore/Include/BsCBoneRTTI.h
  6. 128 128
      Source/BansheeCore/Include/BsCLight.h
  7. 47 47
      Source/BansheeCore/Include/BsCLightRTTI.h
  8. 101 101
      Source/BansheeCore/Include/BsCRenderable.h
  9. 47 47
      Source/BansheeCore/Include/BsCRenderableRTTI.h
  10. 15 1
      Source/BansheeCore/Include/BsCorePrerequisites.h
  11. 299 302
      Source/BansheeCore/Include/BsLight.h
  12. 62 62
      Source/BansheeCore/Include/BsLightRTTI.h
  13. 316 316
      Source/BansheeCore/Include/BsRenderable.h
  14. 65 65
      Source/BansheeCore/Include/BsRenderableRTTI.h
  15. 208 161
      Source/BansheeCore/Include/BsRenderer.h
  16. 1 1
      Source/BansheeCore/Include/BsRendererExtension.h
  17. 1 1
      Source/BansheeCore/Include/BsRendererFactory.h
  18. 2 2
      Source/BansheeCore/Include/BsRendererManager.h
  19. 1 1
      Source/BansheeCore/Include/BsRendererMeshData.h
  20. 154 137
      Source/BansheeCore/Include/BsSceneManager.h
  21. 6 6
      Source/BansheeCore/Include/BsSceneObject.h
  22. 2 2
      Source/BansheeCore/Source/BsAnimationManager.cpp
  23. 0 0
      Source/BansheeCore/Source/BsCAnimation.cpp
  24. 0 0
      Source/BansheeCore/Source/BsCBone.cpp
  25. 4 4
      Source/BansheeCore/Source/BsCCamera.cpp
  26. 0 0
      Source/BansheeCore/Source/BsCLight.cpp
  27. 0 0
      Source/BansheeCore/Source/BsCRenderable.cpp
  28. 1 1
      Source/BansheeCore/Source/BsCamera.cpp
  29. 6 6
      Source/BansheeCore/Source/BsCoreApplication.cpp
  30. 1 17
      Source/BansheeCore/Source/BsLight.cpp
  31. 0 2
      Source/BansheeCore/Source/BsRenderable.cpp
  32. 12 6
      Source/BansheeCore/Source/BsRenderer.cpp
  33. 1 1
      Source/BansheeCore/Source/BsRendererExtension.cpp
  34. 2 2
      Source/BansheeCore/Source/BsRendererManager.cpp
  35. 1 1
      Source/BansheeCore/Source/BsRendererMeshData.cpp
  36. 92 26
      Source/BansheeCore/Source/BsSceneManager.cpp
  37. 3 3
      Source/BansheeCore/Source/BsSceneObject.cpp
  38. 1 1
      Source/BansheeCore/Source/BsTechnique.cpp
  39. 1 1
      Source/BansheeEditor/Source/BsDockManager.cpp
  40. 2 2
      Source/BansheeEditor/Source/BsEditorApplication.cpp
  41. 1 1
      Source/BansheeEditor/Source/BsGUISceneTreeView.cpp
  42. 1 1
      Source/BansheeEditor/Source/BsGizmoManager.cpp
  43. 2 2
      Source/BansheeEditor/Source/BsHandleDrawManager.cpp
  44. 1 1
      Source/BansheeEditor/Source/BsScenePicking.cpp
  45. 1 1
      Source/BansheeEditor/Source/BsSelectionRenderer.cpp
  46. 0 32
      Source/BansheeEngine/CMakeSources.cmake
  47. 4 23
      Source/BansheeEngine/Include/BsPrerequisites.h
  48. 0 67
      Source/BansheeEngine/Include/BsRenderer.h
  49. 0 96
      Source/BansheeEngine/Include/BsSceneManager.h
  50. 0 12
      Source/BansheeEngine/Source/BsRenderer.cpp
  51. 0 101
      Source/BansheeEngine/Source/BsSceneManager.cpp
  52. 2 2
      Source/RenderBeast/Include/BsRenderBeast.h
  53. 1 1
      Source/RenderBeast/Include/BsRenderBeastFactory.h
  54. 1 1
      Source/RenderBeast/Include/BsRenderBeastOptions.h
  55. 4 4
      Source/RenderBeast/Source/BsRenderBeast.cpp
  56. 1 1
      Source/RenderBeast/Source/BsRenderBeastFactory.cpp

+ 22 - 4
Source/BansheeCore/CMakeSources.cmake

@@ -17,6 +17,10 @@ set(BS_BANSHEECORE_INC_COMPONENTS
 	"Include/BsCAudioSource.h"
 	"Include/BsCAudioListener.h"
 	"Include/BsCCamera.h"
+	"Include/BsCRenderable.h"
+	"Include/BsCLight.h"
+	"Include/BsCAnimation.h"
+	"Include/BsCBone.h"	
 )
 
 set(BS_BANSHEECORE_INC_PHYSICS
@@ -69,7 +73,7 @@ set(BS_BANSHEECORE_INC_SCENE
 	"Include/BsGameObjectHandle.h"
 	"Include/BsGameObjectManager.h"
 	"Include/BsSceneObject.h"
-	"Include/BsCoreSceneManager.h"
+	"Include/BsSceneManager.h"
 	"Include/BsPrefab.h"
 	"Include/BsPrefabDiff.h"
 	"Include/BsPrefabUtility.h"
@@ -83,9 +87,11 @@ set(BS_BANSHEECORE_INC_INPUT
 )
 
 set(BS_BANSHEECORE_INC_RENDERER
+	"Include/BsLight.h"
+	"Include/BsRenderable.h"
 	"Include/BsRendererManager.h"
 	"Include/BsRendererFactory.h"
-	"Include/BsCoreRenderer.h"
+	"Include/BsRenderer.h"
 	"Include/BsRendererMeshData.h"
 	"Include/BsParamBlocks.h"
 	"Include/BsCamera.h"
@@ -246,6 +252,10 @@ set(BS_BANSHEECORE_SRC_COMPONENTS
 	"Source/BsCAudioSource.cpp"
 	"Source/BsCAudioListener.cpp"
 	"Source/BsCCamera.cpp"
+	"Source/BsCRenderable.cpp"
+	"Source/BsCLight.cpp"
+	"Source/BsCAnimation.cpp"
+	"Source/BsCBone.cpp"	
 )
 
 set(BS_BANSHEECORE_SRC_IMPORTER
@@ -336,11 +346,19 @@ set(BS_BANSHEECORE_INC_RTTI
 	"Include/BsPostProcessSettingsRTTI.h"
 	"Include/BsMorphShapesRTTI.h"
 	"Include/BsAudioClipImportOptionsRTTI.h"
+	"Include/BsCRenderableRTTI.h"
+	"Include/BsCLightRTTI.h"
+	"Include/BsCAnimationRTTI.h"
+	"Include/BsCBoneRTTI.h"
+	"Include/BsRenderableRTTI.h"
+	"Include/BsLightRTTI.h"	
 )
 
 set(BS_BANSHEECORE_SRC_RENDERER
+	"Source/BsLight.cpp"
+	"Source/BsRenderable.cpp"
 	"Source/BsRendererManager.cpp"
-	"Source/BsCoreRenderer.cpp"
+	"Source/BsRenderer.cpp"
 	"Source/BsRendererMeshData.cpp"
 	"Source/BsParamBlocks.cpp"
 	"Source/BsCamera.cpp"
@@ -476,7 +494,7 @@ set(BS_BANSHEECORE_SRC_SCENE
 	"Source/BsGameObjectHandle.cpp"
 	"Source/BsGameObjectManager.cpp"
 	"Source/BsSceneObject.cpp"
-	"Source/BsCoreSceneManager.cpp"
+	"Source/BsSceneManager.cpp"
 	"Source/BsPrefab.cpp"
 	"Source/BsPrefabDiff.cpp"
 	"Source/BsPrefabUtility.cpp"

+ 2 - 2
Source/BansheeEngine/Include/BsCAnimation.h → Source/BansheeCore/Include/BsCAnimation.h

@@ -2,7 +2,7 @@
 //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
 #pragma once
 
-#include "BsPrerequisites.h"
+#include "BsCorePrerequisites.h"
 #include "BsAnimation.h"
 #include "BsComponent.h"
 
@@ -17,7 +17,7 @@ namespace bs
 	 *
 	 * Wraps Animation as a Component.
 	 */
-    class BS_EXPORT CAnimation : public Component
+    class BS_CORE_EXPORT CAnimation : public Component
     {
 		/** Information about scene objects bound to a specific animation curve. */
 		struct SceneObjectMappingInfo

+ 2 - 2
Source/BansheeEngine/Include/BsCAnimationRTTI.h → Source/BansheeCore/Include/BsCAnimationRTTI.h

@@ -2,7 +2,7 @@
 //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
 #pragma once
 
-#include "BsPrerequisites.h"
+#include "BsCorePrerequisites.h"
 #include "BsRTTIType.h"
 #include "BsCAnimation.h"
 #include "BsGameObjectRTTI.h"
@@ -14,7 +14,7 @@ namespace bs
 	 *  @{
 	 */
 
-	class BS_EXPORT CAnimationRTTI : public RTTIType<CAnimation, Component, CAnimationRTTI>
+	class BS_CORE_EXPORT CAnimationRTTI : public RTTIType<CAnimation, Component, CAnimationRTTI>
 	{
 		BS_BEGIN_RTTI_MEMBERS
 			BS_RTTI_MEMBER_REFL(mDefaultClip, 0)

+ 2 - 2
Source/BansheeEngine/Include/BsCBone.h → Source/BansheeCore/Include/BsCBone.h

@@ -2,7 +2,7 @@
 //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
 #pragma once
 
-#include "BsPrerequisites.h"
+#include "BsCorePrerequisites.h"
 #include "BsComponent.h"
 
 namespace bs 
@@ -15,7 +15,7 @@ namespace bs
 	 * Component that maps animation for specific bone also be applied to the SceneObject this component is attached to. 
 	 * The component will attach to the first found parent Animation component.
 	 */
-    class BS_EXPORT CBone : public Component
+    class BS_CORE_EXPORT CBone : public Component
     {
     public:
 		CBone(const HSceneObject& parent);

+ 2 - 2
Source/BansheeEngine/Include/BsCBoneRTTI.h → Source/BansheeCore/Include/BsCBoneRTTI.h

@@ -2,7 +2,7 @@
 //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
 #pragma once
 
-#include "BsPrerequisites.h"
+#include "BsCorePrerequisites.h"
 #include "BsRTTIType.h"
 #include "BsCBone.h"
 #include "BsGameObjectRTTI.h"
@@ -14,7 +14,7 @@ namespace bs
 	 *  @{
 	 */
 
-	class BS_EXPORT CBoneRTTI : public RTTIType<CBone, Component, CBoneRTTI>
+	class BS_CORE_EXPORT CBoneRTTI : public RTTIType<CBone, Component, CBoneRTTI>
 	{
 		BS_BEGIN_RTTI_MEMBERS
 			BS_RTTI_MEMBER_PLAIN(mBoneName, 0)

+ 128 - 128
Source/BansheeEngine/Include/BsCLight.h → Source/BansheeCore/Include/BsCLight.h

@@ -1,129 +1,129 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsPrerequisites.h"
-#include "BsLight.h"
-#include "BsComponent.h"
-
-namespace bs 
-{
-	/** @addtogroup Components
-	 *  @{
-	 */
-
-	/**
-	 * @copydoc	Light
-	 *
-	 * Wraps Light as a Component.
-	 */
-    class BS_EXPORT CLight : public Component
-    {
-    public:
-		CLight(const HSceneObject& parent, LightType type = LightType::Point, Color color = Color::White, 
-			float intensity = 100.0f, float range = 1.0f, bool castsShadows = false, Degree spotAngle = Degree(45), 
-			Degree spotFalloffAngle = Degree(40));
-
-		virtual ~CLight();
-
-	    /** @copydoc Light::getType */
-		LightType getType() const { return mInternal->getType(); }
-
-	    /** @copydoc Light::setType */
-		void setType(LightType type) { mInternal->setType(type); }
-
-	    /** @copydoc Light::getCastsShadow */
-		bool getCastsShadow() const { return mInternal->getCastsShadow(); }
-
-	    /** @copydoc Light::setCastsShadow  */
-		void setCastsShadow(bool castsShadow) { mInternal->setCastsShadow(castsShadow); }
-
-	    /** @copydoc Light::getColor */
-		Color getColor() const { return mInternal->getColor(); }
-
-	    /** @copydoc Light::setColor */
-		void setColor(const Color& color) { mInternal->setColor(color); }
-
-	    /** @copydoc Light::getRange */
-		float getRange() const { return mInternal->getRange(); }
-
-	    /** @copydoc Light::setRange */
-		void setRange(float range) { mInternal->setRange(range);; }
-
-	    /** @copydoc Light::getIntensity */
-		float getIntensity() const { return mInternal->getIntensity(); }
-
-	    /** @copydoc Light::setIntensity */
-		void setIntensity(float intensity) { mInternal->setIntensity(intensity); }
-
-	    /** @copydoc Light::getSpotAngle */
-		Degree getSpotAngle() const { return mInternal->getSpotAngle(); }
-
-	    /** @copydoc Light::setSpotAngle */
-		void setSpotAngle(const Degree& spotAngle) { mInternal->setSpotAngle(spotAngle); }
-
-		/** @copydoc Light::getSpotFalloffAngle */
-		Degree getSpotFalloffAngle() const { return mInternal->getSpotFalloffAngle(); }
-
-		/** @copydoc Light::setSpotFalloffAngle */
-		void setSpotFalloffAngle(const Degree& spotAngle) { mInternal->setSpotFalloffAngle(spotAngle); }
-
-		/** @copydoc Light::getPhysicallyBasedAttenuation  */
-		bool getPhysicallyBasedAttenuation() const { return mInternal->getPhysicallyBasedAttenuation(); }
-
-		/**  @copydoc Light::setPhysicallyBasedAttenuation  */
-		void setPhysicallyBasedAttenuation(bool enabled) { mInternal->setPhysicallyBasedAttenuation(enabled); }
-
-	    /** @copydoc Light::getBounds  */
-		Sphere getBounds() const;
-
-		/** @name Internal 
-		 *  @{
-		 */
-
-	    /**	Returns the light that this component wraps. */
-		SPtr<Light> _getLight() const { return mInternal; }
-
-		/** @} */
-
-    protected:
-		mutable SPtr<Light> mInternal;
-
-		// Only valid during construction
-		LightType mType;
-		Color mColor;
-		float mIntensity; 
-		float mRange; 
-		bool mCastsShadows; 
-		Degree mSpotAngle; 
-		Degree mSpotFalloffAngle;
-
-		/************************************************************************/
-		/* 						COMPONENT OVERRIDES                      		*/
-		/************************************************************************/
-	protected:
-		friend class SceneObject;
-
-	    /** @copydoc Component::onInitialized */
-		void onInitialized() override;
-
-	    /** @copydoc Component::onDestroyed */
-		void onDestroyed() override;
-
-		/** @copydoc Component::update */
-		void update() override { }
-
-		/************************************************************************/
-		/* 								RTTI		                     		*/
-		/************************************************************************/
-	public:
-		friend class CLightRTTI;
-		static RTTITypeBase* getRTTIStatic();
-		RTTITypeBase* getRTTI() const override;
-
-	protected:
-		CLight() {} // Serialization only
-     };
-
-	 /** @} */
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsCorePrerequisites.h"
+#include "BsLight.h"
+#include "BsComponent.h"
+
+namespace bs 
+{
+	/** @addtogroup Components
+	 *  @{
+	 */
+
+	/**
+	 * @copydoc	Light
+	 *
+	 * Wraps Light as a Component.
+	 */
+    class BS_CORE_EXPORT CLight : public Component
+    {
+    public:
+		CLight(const HSceneObject& parent, LightType type = LightType::Point, Color color = Color::White, 
+			float intensity = 100.0f, float range = 1.0f, bool castsShadows = false, Degree spotAngle = Degree(45), 
+			Degree spotFalloffAngle = Degree(40));
+
+		virtual ~CLight();
+
+	    /** @copydoc Light::getType */
+		LightType getType() const { return mInternal->getType(); }
+
+	    /** @copydoc Light::setType */
+		void setType(LightType type) { mInternal->setType(type); }
+
+	    /** @copydoc Light::getCastsShadow */
+		bool getCastsShadow() const { return mInternal->getCastsShadow(); }
+
+	    /** @copydoc Light::setCastsShadow  */
+		void setCastsShadow(bool castsShadow) { mInternal->setCastsShadow(castsShadow); }
+
+	    /** @copydoc Light::getColor */
+		Color getColor() const { return mInternal->getColor(); }
+
+	    /** @copydoc Light::setColor */
+		void setColor(const Color& color) { mInternal->setColor(color); }
+
+	    /** @copydoc Light::getRange */
+		float getRange() const { return mInternal->getRange(); }
+
+	    /** @copydoc Light::setRange */
+		void setRange(float range) { mInternal->setRange(range);; }
+
+	    /** @copydoc Light::getIntensity */
+		float getIntensity() const { return mInternal->getIntensity(); }
+
+	    /** @copydoc Light::setIntensity */
+		void setIntensity(float intensity) { mInternal->setIntensity(intensity); }
+
+	    /** @copydoc Light::getSpotAngle */
+		Degree getSpotAngle() const { return mInternal->getSpotAngle(); }
+
+	    /** @copydoc Light::setSpotAngle */
+		void setSpotAngle(const Degree& spotAngle) { mInternal->setSpotAngle(spotAngle); }
+
+		/** @copydoc Light::getSpotFalloffAngle */
+		Degree getSpotFalloffAngle() const { return mInternal->getSpotFalloffAngle(); }
+
+		/** @copydoc Light::setSpotFalloffAngle */
+		void setSpotFalloffAngle(const Degree& spotAngle) { mInternal->setSpotFalloffAngle(spotAngle); }
+
+		/** @copydoc Light::getPhysicallyBasedAttenuation  */
+		bool getPhysicallyBasedAttenuation() const { return mInternal->getPhysicallyBasedAttenuation(); }
+
+		/**  @copydoc Light::setPhysicallyBasedAttenuation  */
+		void setPhysicallyBasedAttenuation(bool enabled) { mInternal->setPhysicallyBasedAttenuation(enabled); }
+
+	    /** @copydoc Light::getBounds  */
+		Sphere getBounds() const;
+
+		/** @name Internal 
+		 *  @{
+		 */
+
+	    /**	Returns the light that this component wraps. */
+		SPtr<Light> _getLight() const { return mInternal; }
+
+		/** @} */
+
+    protected:
+		mutable SPtr<Light> mInternal;
+
+		// Only valid during construction
+		LightType mType;
+		Color mColor;
+		float mIntensity; 
+		float mRange; 
+		bool mCastsShadows; 
+		Degree mSpotAngle; 
+		Degree mSpotFalloffAngle;
+
+		/************************************************************************/
+		/* 						COMPONENT OVERRIDES                      		*/
+		/************************************************************************/
+	protected:
+		friend class SceneObject;
+
+	    /** @copydoc Component::onInitialized */
+		void onInitialized() override;
+
+	    /** @copydoc Component::onDestroyed */
+		void onDestroyed() override;
+
+		/** @copydoc Component::update */
+		void update() override { }
+
+		/************************************************************************/
+		/* 								RTTI		                     		*/
+		/************************************************************************/
+	public:
+		friend class CLightRTTI;
+		static RTTITypeBase* getRTTIStatic();
+		RTTITypeBase* getRTTI() const override;
+
+	protected:
+		CLight() {} // Serialization only
+     };
+
+	 /** @} */
 }

+ 47 - 47
Source/BansheeEngine/Include/BsCLightRTTI.h → Source/BansheeCore/Include/BsCLightRTTI.h

@@ -1,48 +1,48 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsPrerequisites.h"
-#include "BsRTTIType.h"
-#include "BsCLight.h"
-#include "BsGameObjectRTTI.h"
-
-namespace bs
-{
-	/** @cond RTTI */
-	/** @addtogroup RTTI-Impl-Engine
-	 *  @{
-	 */
-
-	class BS_EXPORT CLightRTTI : public RTTIType <CLight, Component, CLightRTTI>
-	{
-	private:
-		SPtr<Light> getInternal(CLight* obj) { return obj->mInternal; }
-		void setInternal(CLight* obj, SPtr<Light> val) { obj->mInternal = val; }
-
-	public:
-		CLightRTTI()
-		{
-			addReflectablePtrField("mInternal", 0, &CLightRTTI::getInternal, &CLightRTTI::setInternal);
-		}
-
-		const String& getRTTIName() override
-		{
-			static String name = "CLight";
-			return name;
-		}
-
-		UINT32 getRTTIId() override
-		{
-			return TID_CLight;
-		}
-
-		SPtr<IReflectable> newRTTIObject() override
-		{
-			return GameObjectRTTI::createGameObject<CLight>();
-		}
-	};
-
-	/** @} */
-	/** @endcond */
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsCorePrerequisites.h"
+#include "BsRTTIType.h"
+#include "BsCLight.h"
+#include "BsGameObjectRTTI.h"
+
+namespace bs
+{
+	/** @cond RTTI */
+	/** @addtogroup RTTI-Impl-Engine
+	 *  @{
+	 */
+
+	class BS_CORE_EXPORT CLightRTTI : public RTTIType <CLight, Component, CLightRTTI>
+	{
+	private:
+		SPtr<Light> getInternal(CLight* obj) { return obj->mInternal; }
+		void setInternal(CLight* obj, SPtr<Light> val) { obj->mInternal = val; }
+
+	public:
+		CLightRTTI()
+		{
+			addReflectablePtrField("mInternal", 0, &CLightRTTI::getInternal, &CLightRTTI::setInternal);
+		}
+
+		const String& getRTTIName() override
+		{
+			static String name = "CLight";
+			return name;
+		}
+
+		UINT32 getRTTIId() override
+		{
+			return TID_CLight;
+		}
+
+		SPtr<IReflectable> newRTTIObject() override
+		{
+			return GameObjectRTTI::createGameObject<CLight>();
+		}
+	};
+
+	/** @} */
+	/** @endcond */
 }

+ 101 - 101
Source/BansheeEngine/Include/BsCRenderable.h → Source/BansheeCore/Include/BsCRenderable.h

@@ -1,102 +1,102 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsPrerequisites.h"
-#include "BsRenderable.h"
-#include "BsBounds.h"
-#include "BsComponent.h"
-
-namespace bs
-{
-	/** @addtogroup Components
-	 *  @{
-	 */
-
-	/**
-	 * @copydoc	Renderable
-	 * 			
-	 * Wraps a TRenderable as a Component.
-	 */
-	class BS_EXPORT CRenderable : public Component
-	{
-	public:
-		/** @copydoc Renderable::setMesh */
-		void setMesh(HMesh mesh);
-
-		/** @copydoc Renderable::setMaterial */
-		void setMaterial(UINT32 idx, HMaterial material) { mInternal->setMaterial(idx, material); }
-
-		/** @copydoc Renderable::setMaterial */
-		void setMaterial(HMaterial material) { mInternal->setMaterial(material); }
-
-		/** @copydoc Renderable::setLayer */
-		void setLayer(UINT64 layer) { mInternal->setLayer(layer); }
-
-		/** @copydoc Renderable::getLayer */
-		UINT64 getLayer() const { return mInternal->getLayer(); }
-
-		/** @copydoc Renderable::getMesh */
-		HMesh getMesh() const { return mInternal->getMesh(); }
-
-		/** @copydoc Renderable::getMaterial */
-		HMaterial getMaterial(UINT32 idx) const { return mInternal->getMaterial(idx); }
-
-		/**	Gets world bounds of the mesh rendered by this object. */
-		Bounds getBounds() const;
-
-		/** @copydoc Component::calculateBounds */
-		bool calculateBounds(Bounds& bounds) override;
-
-		/** @name Internal 
-		 *  @{
-		 */
-
-		/** Returns the internal renderable that is used for majority of operations by this component. */
-		SPtr<Renderable> _getRenderable() const { return mInternal; }
-
-		/** Registers an Animation component that will be used for animating the renderable's mesh. */
-		void _registerAnimation(const HAnimation& animation);
-
-		/** Removes the Animation component, making the renderable rendered as a static object. */
-		void _unregisterAnimation();
-
-		/** @} */
-
-	private:
-		mutable SPtr<Renderable> mInternal;
-		HAnimation mAnimation;
-
-		/************************************************************************/
-		/* 							COMPONENT OVERRIDES                    		*/
-		/************************************************************************/
-
-	protected:
-		friend class SceneObject;
-
-		CRenderable(const HSceneObject& parent);
-
-		/** @copydoc Component::onInitialized */
-		void onInitialized() override;
-
-		/** @copydoc Component::onDestroyed */
-		void onDestroyed() override;
-
-	public:
-		/** @copydoc Component::update */
-		void update() override;
-
-		/************************************************************************/
-		/* 								RTTI		                     		*/
-		/************************************************************************/
-	public:
-		friend class CRenderableRTTI;
-		static RTTITypeBase* getRTTIStatic();
-		RTTITypeBase* getRTTI() const override;
-
-	protected:
-		CRenderable() {} // Serialization only
-	};
-
-	/** @} */
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsCorePrerequisites.h"
+#include "BsRenderable.h"
+#include "BsBounds.h"
+#include "BsComponent.h"
+
+namespace bs
+{
+	/** @addtogroup Components
+	 *  @{
+	 */
+
+	/**
+	 * @copydoc	Renderable
+	 * 			
+	 * Wraps a TRenderable as a Component.
+	 */
+	class BS_CORE_EXPORT CRenderable : public Component
+	{
+	public:
+		/** @copydoc Renderable::setMesh */
+		void setMesh(HMesh mesh);
+
+		/** @copydoc Renderable::setMaterial */
+		void setMaterial(UINT32 idx, HMaterial material) { mInternal->setMaterial(idx, material); }
+
+		/** @copydoc Renderable::setMaterial */
+		void setMaterial(HMaterial material) { mInternal->setMaterial(material); }
+
+		/** @copydoc Renderable::setLayer */
+		void setLayer(UINT64 layer) { mInternal->setLayer(layer); }
+
+		/** @copydoc Renderable::getLayer */
+		UINT64 getLayer() const { return mInternal->getLayer(); }
+
+		/** @copydoc Renderable::getMesh */
+		HMesh getMesh() const { return mInternal->getMesh(); }
+
+		/** @copydoc Renderable::getMaterial */
+		HMaterial getMaterial(UINT32 idx) const { return mInternal->getMaterial(idx); }
+
+		/**	Gets world bounds of the mesh rendered by this object. */
+		Bounds getBounds() const;
+
+		/** @copydoc Component::calculateBounds */
+		bool calculateBounds(Bounds& bounds) override;
+
+		/** @name Internal 
+		 *  @{
+		 */
+
+		/** Returns the internal renderable that is used for majority of operations by this component. */
+		SPtr<Renderable> _getRenderable() const { return mInternal; }
+
+		/** Registers an Animation component that will be used for animating the renderable's mesh. */
+		void _registerAnimation(const HAnimation& animation);
+
+		/** Removes the Animation component, making the renderable rendered as a static object. */
+		void _unregisterAnimation();
+
+		/** @} */
+
+	private:
+		mutable SPtr<Renderable> mInternal;
+		HAnimation mAnimation;
+
+		/************************************************************************/
+		/* 							COMPONENT OVERRIDES                    		*/
+		/************************************************************************/
+
+	protected:
+		friend class SceneObject;
+
+		CRenderable(const HSceneObject& parent);
+
+		/** @copydoc Component::onInitialized */
+		void onInitialized() override;
+
+		/** @copydoc Component::onDestroyed */
+		void onDestroyed() override;
+
+	public:
+		/** @copydoc Component::update */
+		void update() override;
+
+		/************************************************************************/
+		/* 								RTTI		                     		*/
+		/************************************************************************/
+	public:
+		friend class CRenderableRTTI;
+		static RTTITypeBase* getRTTIStatic();
+		RTTITypeBase* getRTTI() const override;
+
+	protected:
+		CRenderable() {} // Serialization only
+	};
+
+	/** @} */
 }

+ 47 - 47
Source/BansheeEngine/Include/BsCRenderableRTTI.h → Source/BansheeCore/Include/BsCRenderableRTTI.h

@@ -1,48 +1,48 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsPrerequisites.h"
-#include "BsRTTIType.h"
-#include "BsCRenderable.h"
-#include "BsGameObjectRTTI.h"
-
-namespace bs
-{
-	/** @cond RTTI */
-	/** @addtogroup RTTI-Impl-Engine
-	 *  @{
-	 */
-
-	class BS_EXPORT CRenderableRTTI : public RTTIType<CRenderable, Component, CRenderableRTTI>
-	{
-	private:
-		SPtr<Renderable> getInternal(CRenderable* obj) { return obj->mInternal; }
-		void setInternal(CRenderable* obj, SPtr<Renderable> val) { obj->mInternal = val; }
-
-	public:
-		CRenderableRTTI()
-		{
-			addReflectablePtrField("mInternal", 0, &CRenderableRTTI::getInternal, &CRenderableRTTI::setInternal);
-		}
-
-		const String& getRTTIName() override
-		{
-			static String name = "CRenderable";
-			return name;
-		}
-
-		UINT32 getRTTIId() override
-		{
-			return TID_CRenderable;
-		}
-
-		SPtr<IReflectable> newRTTIObject() override
-		{
-			return GameObjectRTTI::createGameObject<CRenderable>();
-		}
-	};
-
-	/** @} */
-	/** @endcond */
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsCorePrerequisites.h"
+#include "BsRTTIType.h"
+#include "BsCRenderable.h"
+#include "BsGameObjectRTTI.h"
+
+namespace bs
+{
+	/** @cond RTTI */
+	/** @addtogroup RTTI-Impl-Engine
+	 *  @{
+	 */
+
+	class BS_CORE_EXPORT CRenderableRTTI : public RTTIType<CRenderable, Component, CRenderableRTTI>
+	{
+	private:
+		SPtr<Renderable> getInternal(CRenderable* obj) { return obj->mInternal; }
+		void setInternal(CRenderable* obj, SPtr<Renderable> val) { obj->mInternal = val; }
+
+	public:
+		CRenderableRTTI()
+		{
+			addReflectablePtrField("mInternal", 0, &CRenderableRTTI::getInternal, &CRenderableRTTI::setInternal);
+		}
+
+		const String& getRTTIName() override
+		{
+			static String name = "CRenderable";
+			return name;
+		}
+
+		UINT32 getRTTIId() override
+		{
+			return TID_CRenderable;
+		}
+
+		SPtr<IReflectable> newRTTIObject() override
+		{
+			return GameObjectRTTI::createGameObject<CRenderable>();
+		}
+	};
+
+	/** @} */
+	/** @endcond */
 }

+ 15 - 1
Source/BansheeCore/Include/BsCorePrerequisites.h

@@ -332,6 +332,10 @@ namespace bs
 	class AudioClipImportOptions;
 	class AnimationClip;
 	class CCamera;
+	class CRenderable;
+	class CLight;
+	class CAnimation;
+	class CBone;
 	class GpuPipelineParamInfo;
 	class MaterialParams;
 	template <class T> class TAnimationCurve;
@@ -340,6 +344,7 @@ namespace bs
 	class Animation;
 	class GpuParamsSet;
 	class Camera;
+	class Renderable;
 	class MorphShapes;
 	class MorphShape;
 	class MorphChannel;
@@ -398,7 +403,7 @@ namespace bs
 
 	namespace ct
 	{
-		class CoreRenderer;
+		class Renderer;
 		class VertexData;
 		class SamplerState;
 		class IndexBuffer;
@@ -412,6 +417,7 @@ namespace bs
 		class BlendState;
 		class CoreObject;
 		class Camera;
+		class Renderable;
 		class MeshBase;
 		class Mesh;
 		class TransientMesh;
@@ -566,6 +572,10 @@ namespace bs
 		// Moved from Engine layer
 		TID_CCamera = 30000,
 		TID_Camera = 30003,
+		TID_CRenderable = 30001,
+		TID_Renderable = 30004,
+		TID_Light = 30011,
+		TID_CLight = 30012,
 	};
 }
 
@@ -611,6 +621,10 @@ namespace bs
 	typedef GameObjectHandle<SceneObject> HSceneObject;
 	typedef GameObjectHandle<Component> HComponent;
 	typedef GameObjectHandle<CCamera> HCamera;
+	typedef GameObjectHandle<CRenderable> HRenderable;
+	typedef GameObjectHandle<CLight> HLight;
+	typedef GameObjectHandle<CAnimation> HAnimation;
+	typedef GameObjectHandle<CBone> HBone;
 	typedef GameObjectHandle<CRigidbody> HRigidbody;
 	typedef GameObjectHandle<CCollider> HCollider;
 	typedef GameObjectHandle<CBoxCollider> HBoxCollider;

+ 299 - 302
Source/BansheeEngine/Include/BsLight.h → Source/BansheeCore/Include/BsLight.h

@@ -1,303 +1,300 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsPrerequisites.h"
-#include "BsIReflectable.h"
-#include "BsVector3.h"
-#include "BsQuaternion.h"
-#include "BsColor.h"
-#include "BsSphere.h"
-#include "BsCoreObject.h"
-
-namespace bs
-{
-	/** @addtogroup Renderer-Engine-Internal
-	 *  @{
-	 */
-
-	/** Light type that determines how is light information parsed by the renderer and other systems. */
-	enum class LightType
-	{
-		Directional, 
-		Point, 
-		Spot
-	};
-
-	/**	Signals which portion of a LightInternal is dirty. */
-	enum class LightDirtyFlag
-	{
-		Transform = 0x01,
-		Everything = 0x02
-	};
-
-	/** @} */
-
-	/** @addtogroup Implementation
-	 *  @{
-	 */
-
-	/**
-	 * Illuminates a portion of the scene covered by a light. Base class for both sim and core thread Light implementations.
-	 */
-	class BS_EXPORT LightBase
-	{
-	public:
-		LightBase();
-		LightBase(LightType type, Color color, float intensity, float range, 
-			bool castsShadows, Degree spotAngle, Degree spotFalloffAngle);
-
-		virtual ~LightBase() { }
-
-		/**	Returns the position of the light, in world space. */
-		Vector3 getPosition() const { return mPosition; }
-
-		/**	Sets the position of the light, in world space. */
-		void setPosition(const Vector3& position) { mPosition = position; _markCoreDirty(); updateBounds(); }
-
-		/**	Returns the rotation of the light, in world space. */
-		Quaternion getRotation() const { return mRotation; }
-
-		/**	Sets the rotation of the light, in world space. */
-		void setRotation(const Quaternion& rotation) { mRotation = rotation; _markCoreDirty(); updateBounds(); }
-
-		/**	Returns the type of the light. */
-		LightType getType() const { return mType; }
-
-		/**	Changes the type of the light. */
-		void setType(LightType type) { mType = type; _markCoreDirty(); updateBounds(); }
-
-		/**	Checks does this light cast shadows when rendered. */
-		bool getCastsShadow() const { return mCastsShadows; }
-
-		/**	Sets whether this light will cast shadows when rendered. */
-		void setCastsShadow(bool castsShadow) { mCastsShadows = castsShadow; _markCoreDirty(); }
-
-		/**	Returns the color emitted from the light. */
-		Color getColor() const { return mColor; }
-
-		/**	Sets the color emitted from the light. */
-		void setColor(const Color& color) { mColor = color; _markCoreDirty(); }
-
-		/**	Returns the maximum range of the light. Light will not affect any geometry past that point. */
-		float getRange() const { return mRange; }
-
-		/**
-		 * Sets the maximum range of the light. Light will not affect any geometry past that point. Value is ignored if
-		 * physically based attenuation is active.
-		 *
-		 * @note	Normally you want to set this at a point where light intensity is too low due to attenuation.
-		 */
-		void setRange(float range);
-
-		/** 
-		 * Checks is physically based attenuation active. If true the range and attenuation of the light are controlled
-		 * by inverse square of distance. If false then the user is allowed to set the range and attenuation is adjusted
-		 * accordingly. 
-		 */
-		bool getPhysicallyBasedAttenuation() const { return mPhysCorrectAtten; }
-
-		/** 
-		 * Activates or deactivates physically based attenuation. If true the range and attenuation of the light are 
-		 * controlled by inverse square of distance. If false then the user is allowed to set the range and attenuation is 
-		 * adjusted accordingly. 
-		 */
-		void setPhysicallyBasedAttenuation(bool enabled);
-
-		/**
-		 * Gets the power of the light source. This is luminous flux for point & spot lights, and radiance for directional 
-		 * lights.
-		 */
-		float getIntensity() const { return mIntensity; }
-
-		/**
-		 * Sets the power of the light source. This will be luminous flux for point & spot lights, and radiance for 
-		 * directional lights.
-		 */
-		void setIntensity(float intensity);
-
-		/**	Gets the total angle covered by a spot light. */
-		Degree getSpotAngle() const { return mSpotAngle; }
-
-		/**	Sets the total angle covered by a spot light. */
-		void setSpotAngle(const Degree& spotAngle) { mSpotAngle = spotAngle; _markCoreDirty(); updateBounds(); }
-
-		/**
-		 * Gets the falloff angle covered by a spot light. Falloff angle determines at what point does light intensity 
-		 * starts quadratically falling off as the angle approaches the total spot angle.
-		 */
-		Degree getSpotFalloffAngle() const { return mSpotFalloffAngle; }
-
-		/**
-		 * Sets the falloff angle covered by a spot light. Falloff angle determines at what point does light intensity 
-		 * starts quadratically falling off as the angle approaches the total spot angle.
-		 */
-		void setSpotFalloffAngle(const Degree& spotFallofAngle) 
-		{ mSpotFalloffAngle = spotFallofAngle; _markCoreDirty(); updateBounds(); }
-
-		/**	Returns world space bounds that completely encompass the light's area of influence. */
-		Sphere getBounds() const { return mBounds; }
-
-		/**
-		 * Returns the radiance of the light source. This is the value that should be used in lighting equations.
-		 *
-		 * @note	
-		 * Ignores the light direction, therefore caller must ensure to properly handle non-uniform emitters like spot 
-		 * lights.
-		 */
-		float getRadiance() const;
-
-		/**	Checks whether the light should be rendered or not. */
-		bool getIsActive() const { return mIsActive; }
-
-		/**	Sets whether the light should be rendered or not. */
-		void setIsActive(bool active) { mIsActive = active; _markCoreDirty(); }
-
-		/** 
-		 * Marks the simulation thread object as dirty and notifies the system its data should be synced with its core 
-		 * thread counterpart. 
-		 */
-		virtual void _markCoreDirty(LightDirtyFlag flag = LightDirtyFlag::Everything) { }
-
-	protected:
-		/** Updates the internal bounds for the light. Call this whenever a property affecting the bounds changes. */
-		void updateBounds();
-
-		/** Calculates maximum light range based on light intensity. */
-		void updatePhysicallyCorrectRange();
-
-		Vector3 mPosition; /**< World space position. */
-		Quaternion mRotation; /**< World space rotation. */
-
-		LightType mType; /**< Type of light that determines how are the rest of the parameters interpreted. */
-		bool mCastsShadows; /**< Determines whether the light casts shadows. */
-		Color mColor; /**< Color of the light. */
-		float mRange; /**< Cut off range for the light when rendering. */
-		float mIntensity; /**< Power of the light source. This will be luminous flux for point & spot lights, and radiance for directional lights. */
-		Degree mSpotAngle; /**< Total angle covered by a spot light. */
-		Degree mSpotFalloffAngle; /**< Spot light angle at which falloff starts. Must be smaller than total angle. */
-		bool mIsActive; /**< Whether the light should be rendered or not. */
-		Sphere mBounds; /**< Sphere that bounds the light area of influence. */
-		bool mPhysCorrectAtten; /**< Determines is physically based attentuation active. */
-	};
-
-	/** @} */
-	/** @addtogroup Renderer-Engine-Internal
-	 *  @{
-	 */
-
-	namespace ct { class Light; }
-
-	/**
-	 * Sim thread usable version of a light.
-	 *
-	 * @see		LightBase
-	 */
-	class BS_EXPORT Light : public IReflectable, public CoreObject, public LightBase
-	{
-	public:
-		/**	Retrieves an implementation of a light usable only from the core thread. */
-		SPtr<ct::Light> getCore() const;
-
-		/** Returns the hash value that can be used to identify if the internal data needs an update. */
-		UINT32 _getLastModifiedHash() const { return mLastUpdateHash; }
-
-		/**	Sets the hash value that can be used to identify if the internal data needs an update. */
-		void _setLastModifiedHash(UINT32 hash) { mLastUpdateHash = hash; }
-
-		/**
-		 * Updates internal transform values from the specified scene object, in case that scene object's transform changed
-		 * since the last call.
-		 *
-		 * @note	Assumes the same scene object will be provided every time.
-		 */
-		void _updateTransform(const HSceneObject& parent);
-
-		/**
-		 * Creates a new light with provided settings.
-		 *
-		 * @param[in]	type				Type of light that determines how are the rest of the parameters interpreted.
-		 * @param[in]	color				Color of the light.
-		 * @param[in]	intensity			Power of the light source. This will be luminous flux for point & spot lights, 
-		 *									and radiance for directional lights.
-		 * @param[in]	range				Cut off range for the light when rendering.
-		 * @param[in]	castsShadows		Determines whether the light casts shadows.
-		 * @param[in]	spotAngle			Total angle covered by a spot light.
-		 * @param[in]	spotFalloffAngle	Spot light angle at which falloff starts. Must be smaller than total angle.
-		 */
-		static SPtr<Light> create(LightType type = LightType::Point, Color color = Color::White,
-			float intensity = 100.0f, float range = 10.0f, bool castsShadows = false,
-			Degree spotAngle = Degree(45), Degree spotFalloffAngle = Degree(40));
-
-	protected:
-		Light(LightType type, Color color, float intensity, float range, 
-			bool castsShadows, Degree spotAngle, Degree spotFalloffAngle);
-
-		/** @copydoc CoreObject::createCore */
-		SPtr<ct::CoreObject> createCore() const override;
-
-		/** @copydoc LightBase::_markCoreDirty */
-		void _markCoreDirty(LightDirtyFlag flag = LightDirtyFlag::Everything) override;
-
-		/** @copydoc CoreObject::syncToCore */
-		CoreSyncData syncToCore(FrameAlloc* allocator) override;
-
-		/**	Creates a light with without initializing it. Used for serialization. */
-		static SPtr<Light> createEmpty();
-
-		UINT32 mLastUpdateHash;
-
-		/************************************************************************/
-		/* 								RTTI		                     		*/
-		/************************************************************************/
-	public:
-		friend class LightRTTI;
-		static RTTITypeBase* getRTTIStatic();
-		RTTITypeBase* getRTTI() const override;
-
-	protected:
-		Light(); // Serialization only
-	};
-
-	namespace ct
-	{
-	/**
-	 * Core thread usable version of a light.
-	 *
-	 * @see		LightBase
-	 */
-	class BS_EXPORT Light : public CoreObject, public LightBase
-	{
-	public:
-		~Light();
-
-		/**	Sets an ID that can be used for uniquely identifying this object by the renderer. */
-		void setRendererId(UINT32 id) { mRendererId = id; }
-
-		/**	Retrieves an ID that can be used for uniquely identifying this object by the renderer. */
-		UINT32 getRendererId() const { return mRendererId; }
-
-		/**	Returns a mesh that represents the light's bounds. */
-		SPtr<Mesh> getMesh() const;
-
-		static const UINT32 LIGHT_CONE_NUM_SIDES;
-		static const UINT32 LIGHT_CONE_NUM_SLICES;
-	protected:
-		friend class bs::Light;
-
-		Light(LightType type, Color color, float intensity, 
-			float range, bool castsShadows, Degree spotAngle, Degree spotFalloffAngle);
-
-		/** @copydoc CoreObject::initialize */
-		void initialize() override;
-
-		/** @copydoc CoreObject::syncToCore */
-		void syncToCore(const CoreSyncData& data) override;
-
-		UINT32 mRendererId;
-		SPtr<Mesh> mMesh;
-	};
-	}
-
-	/** @} */
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsCorePrerequisites.h"
+#include "BsIReflectable.h"
+#include "BsVector3.h"
+#include "BsQuaternion.h"
+#include "BsColor.h"
+#include "BsSphere.h"
+#include "BsCoreObject.h"
+
+namespace bs
+{
+	/** @addtogroup Renderer-Engine-Internal
+	 *  @{
+	 */
+
+	/** Light type that determines how is light information parsed by the renderer and other systems. */
+	enum class LightType
+	{
+		Directional, 
+		Point, 
+		Spot
+	};
+
+	/**	Signals which portion of a LightInternal is dirty. */
+	enum class LightDirtyFlag
+	{
+		Transform = 0x01,
+		Everything = 0x02
+	};
+
+	/** @} */
+
+	/** @addtogroup Implementation
+	 *  @{
+	 */
+
+	/**
+	 * Illuminates a portion of the scene covered by a light. Base class for both sim and core thread Light implementations.
+	 */
+	class BS_CORE_EXPORT LightBase
+	{
+	public:
+		LightBase();
+		LightBase(LightType type, Color color, float intensity, float range, 
+			bool castsShadows, Degree spotAngle, Degree spotFalloffAngle);
+
+		virtual ~LightBase() { }
+
+		/**	Returns the position of the light, in world space. */
+		Vector3 getPosition() const { return mPosition; }
+
+		/**	Sets the position of the light, in world space. */
+		void setPosition(const Vector3& position) { mPosition = position; _markCoreDirty(); updateBounds(); }
+
+		/**	Returns the rotation of the light, in world space. */
+		Quaternion getRotation() const { return mRotation; }
+
+		/**	Sets the rotation of the light, in world space. */
+		void setRotation(const Quaternion& rotation) { mRotation = rotation; _markCoreDirty(); updateBounds(); }
+
+		/**	Returns the type of the light. */
+		LightType getType() const { return mType; }
+
+		/**	Changes the type of the light. */
+		void setType(LightType type) { mType = type; _markCoreDirty(); updateBounds(); }
+
+		/**	Checks does this light cast shadows when rendered. */
+		bool getCastsShadow() const { return mCastsShadows; }
+
+		/**	Sets whether this light will cast shadows when rendered. */
+		void setCastsShadow(bool castsShadow) { mCastsShadows = castsShadow; _markCoreDirty(); }
+
+		/**	Returns the color emitted from the light. */
+		Color getColor() const { return mColor; }
+
+		/**	Sets the color emitted from the light. */
+		void setColor(const Color& color) { mColor = color; _markCoreDirty(); }
+
+		/**	Returns the maximum range of the light. Light will not affect any geometry past that point. */
+		float getRange() const { return mRange; }
+
+		/**
+		 * Sets the maximum range of the light. Light will not affect any geometry past that point. Value is ignored if
+		 * physically based attenuation is active.
+		 *
+		 * @note	Normally you want to set this at a point where light intensity is too low due to attenuation.
+		 */
+		void setRange(float range);
+
+		/** 
+		 * Checks is physically based attenuation active. If true the range and attenuation of the light are controlled
+		 * by inverse square of distance. If false then the user is allowed to set the range and attenuation is adjusted
+		 * accordingly. 
+		 */
+		bool getPhysicallyBasedAttenuation() const { return mPhysCorrectAtten; }
+
+		/** 
+		 * Activates or deactivates physically based attenuation. If true the range and attenuation of the light are 
+		 * controlled by inverse square of distance. If false then the user is allowed to set the range and attenuation is 
+		 * adjusted accordingly. 
+		 */
+		void setPhysicallyBasedAttenuation(bool enabled);
+
+		/**
+		 * Gets the power of the light source. This is luminous flux for point & spot lights, and radiance for directional 
+		 * lights.
+		 */
+		float getIntensity() const { return mIntensity; }
+
+		/**
+		 * Sets the power of the light source. This will be luminous flux for point & spot lights, and radiance for 
+		 * directional lights.
+		 */
+		void setIntensity(float intensity);
+
+		/**	Gets the total angle covered by a spot light. */
+		Degree getSpotAngle() const { return mSpotAngle; }
+
+		/**	Sets the total angle covered by a spot light. */
+		void setSpotAngle(const Degree& spotAngle) { mSpotAngle = spotAngle; _markCoreDirty(); updateBounds(); }
+
+		/**
+		 * Gets the falloff angle covered by a spot light. Falloff angle determines at what point does light intensity 
+		 * starts quadratically falling off as the angle approaches the total spot angle.
+		 */
+		Degree getSpotFalloffAngle() const { return mSpotFalloffAngle; }
+
+		/**
+		 * Sets the falloff angle covered by a spot light. Falloff angle determines at what point does light intensity 
+		 * starts quadratically falling off as the angle approaches the total spot angle.
+		 */
+		void setSpotFalloffAngle(const Degree& spotFallofAngle) 
+		{ mSpotFalloffAngle = spotFallofAngle; _markCoreDirty(); updateBounds(); }
+
+		/**	Returns world space bounds that completely encompass the light's area of influence. */
+		Sphere getBounds() const { return mBounds; }
+
+		/**
+		 * Returns the radiance of the light source. This is the value that should be used in lighting equations.
+		 *
+		 * @note	
+		 * Ignores the light direction, therefore caller must ensure to properly handle non-uniform emitters like spot 
+		 * lights.
+		 */
+		float getRadiance() const;
+
+		/**	Checks whether the light should be rendered or not. */
+		bool getIsActive() const { return mIsActive; }
+
+		/**	Sets whether the light should be rendered or not. */
+		void setIsActive(bool active) { mIsActive = active; _markCoreDirty(); }
+
+		/** 
+		 * Marks the simulation thread object as dirty and notifies the system its data should be synced with its core 
+		 * thread counterpart. 
+		 */
+		virtual void _markCoreDirty(LightDirtyFlag flag = LightDirtyFlag::Everything) { }
+
+	protected:
+		/** Updates the internal bounds for the light. Call this whenever a property affecting the bounds changes. */
+		void updateBounds();
+
+		/** Calculates maximum light range based on light intensity. */
+		void updatePhysicallyCorrectRange();
+
+		Vector3 mPosition; /**< World space position. */
+		Quaternion mRotation; /**< World space rotation. */
+
+		LightType mType; /**< Type of light that determines how are the rest of the parameters interpreted. */
+		bool mCastsShadows; /**< Determines whether the light casts shadows. */
+		Color mColor; /**< Color of the light. */
+		float mRange; /**< Cut off range for the light when rendering. */
+		float mIntensity; /**< Power of the light source. This will be luminous flux for point & spot lights, and radiance for directional lights. */
+		Degree mSpotAngle; /**< Total angle covered by a spot light. */
+		Degree mSpotFalloffAngle; /**< Spot light angle at which falloff starts. Must be smaller than total angle. */
+		bool mIsActive; /**< Whether the light should be rendered or not. */
+		Sphere mBounds; /**< Sphere that bounds the light area of influence. */
+		bool mPhysCorrectAtten; /**< Determines is physically based attentuation active. */
+	};
+
+	/** @} */
+	/** @addtogroup Renderer-Engine-Internal
+	 *  @{
+	 */
+
+	namespace ct { class Light; }
+
+	/**
+	 * Sim thread usable version of a light.
+	 *
+	 * @see		LightBase
+	 */
+	class BS_CORE_EXPORT Light : public IReflectable, public CoreObject, public LightBase
+	{
+	public:
+		/**	Retrieves an implementation of a light usable only from the core thread. */
+		SPtr<ct::Light> getCore() const;
+
+		/** Returns the hash value that can be used to identify if the internal data needs an update. */
+		UINT32 _getLastModifiedHash() const { return mLastUpdateHash; }
+
+		/**	Sets the hash value that can be used to identify if the internal data needs an update. */
+		void _setLastModifiedHash(UINT32 hash) { mLastUpdateHash = hash; }
+
+		/**
+		 * Updates internal transform values from the specified scene object, in case that scene object's transform changed
+		 * since the last call.
+		 *
+		 * @note	Assumes the same scene object will be provided every time.
+		 */
+		void _updateTransform(const HSceneObject& parent);
+
+		/**
+		 * Creates a new light with provided settings.
+		 *
+		 * @param[in]	type				Type of light that determines how are the rest of the parameters interpreted.
+		 * @param[in]	color				Color of the light.
+		 * @param[in]	intensity			Power of the light source. This will be luminous flux for point & spot lights, 
+		 *									and radiance for directional lights.
+		 * @param[in]	range				Cut off range for the light when rendering.
+		 * @param[in]	castsShadows		Determines whether the light casts shadows.
+		 * @param[in]	spotAngle			Total angle covered by a spot light.
+		 * @param[in]	spotFalloffAngle	Spot light angle at which falloff starts. Must be smaller than total angle.
+		 */
+		static SPtr<Light> create(LightType type = LightType::Point, Color color = Color::White,
+			float intensity = 100.0f, float range = 10.0f, bool castsShadows = false,
+			Degree spotAngle = Degree(45), Degree spotFalloffAngle = Degree(40));
+
+	protected:
+		Light(LightType type, Color color, float intensity, float range, 
+			bool castsShadows, Degree spotAngle, Degree spotFalloffAngle);
+
+		/** @copydoc CoreObject::createCore */
+		SPtr<ct::CoreObject> createCore() const override;
+
+		/** @copydoc LightBase::_markCoreDirty */
+		void _markCoreDirty(LightDirtyFlag flag = LightDirtyFlag::Everything) override;
+
+		/** @copydoc CoreObject::syncToCore */
+		CoreSyncData syncToCore(FrameAlloc* allocator) override;
+
+		/**	Creates a light with without initializing it. Used for serialization. */
+		static SPtr<Light> createEmpty();
+
+		UINT32 mLastUpdateHash;
+
+		/************************************************************************/
+		/* 								RTTI		                     		*/
+		/************************************************************************/
+	public:
+		friend class LightRTTI;
+		static RTTITypeBase* getRTTIStatic();
+		RTTITypeBase* getRTTI() const override;
+
+	protected:
+		Light(); // Serialization only
+	};
+
+	namespace ct
+	{
+	/**
+	 * Core thread usable version of a light.
+	 *
+	 * @see		LightBase
+	 */
+	class BS_CORE_EXPORT Light : public CoreObject, public LightBase
+	{
+	public:
+		~Light();
+
+		/**	Sets an ID that can be used for uniquely identifying this object by the renderer. */
+		void setRendererId(UINT32 id) { mRendererId = id; }
+
+		/**	Retrieves an ID that can be used for uniquely identifying this object by the renderer. */
+		UINT32 getRendererId() const { return mRendererId; }
+
+		static const UINT32 LIGHT_CONE_NUM_SIDES;
+		static const UINT32 LIGHT_CONE_NUM_SLICES;
+	protected:
+		friend class bs::Light;
+
+		Light(LightType type, Color color, float intensity, 
+			float range, bool castsShadows, Degree spotAngle, Degree spotFalloffAngle);
+
+		/** @copydoc CoreObject::initialize */
+		void initialize() override;
+
+		/** @copydoc CoreObject::syncToCore */
+		void syncToCore(const CoreSyncData& data) override;
+
+		UINT32 mRendererId;
+		SPtr<Mesh> mMesh;
+	};
+	}
+
+	/** @} */
 }

+ 62 - 62
Source/BansheeEngine/Include/BsLightRTTI.h → Source/BansheeCore/Include/BsLightRTTI.h

@@ -1,63 +1,63 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsPrerequisites.h"
-#include "BsRTTIType.h"
-#include "BsLight.h"
-
-namespace bs
-{
-	/** @cond RTTI */
-	/** @addtogroup RTTI-Impl-Engine
-	 *  @{
-	 */
-
-	class BS_EXPORT LightRTTI : public RTTIType <Light, IReflectable, LightRTTI>
-	{
-	private:
-		BS_BEGIN_RTTI_MEMBERS
-			BS_RTTI_MEMBER_PLAIN(mPosition, 0)
-			BS_RTTI_MEMBER_PLAIN(mRotation, 1)
-			BS_RTTI_MEMBER_PLAIN(mType, 2)
-			BS_RTTI_MEMBER_PLAIN(mCastsShadows, 3)
-			BS_RTTI_MEMBER_PLAIN(mColor, 4)
-			BS_RTTI_MEMBER_PLAIN(mRange, 5)
-			BS_RTTI_MEMBER_PLAIN(mIntensity, 6)
-			BS_RTTI_MEMBER_PLAIN(mSpotAngle, 7)
-			BS_RTTI_MEMBER_PLAIN(mSpotFalloffAngle, 8)
-			BS_RTTI_MEMBER_PLAIN(mPhysCorrectAtten, 9)
-		BS_END_RTTI_MEMBERS
-	public:
-		LightRTTI()
-			:mInitMembers(this)
-		{ }
-
-		void onDeserializationEnded(IReflectable* obj, const UnorderedMap<String, UINT64>& params) override
-		{
-			// Note: Since this is a CoreObject I should call initialize() right after deserialization,
-			// but since this specific type is used in Components we delay initialization until Component
-			// itself does it. Keep this is mind in case this ever needs to be deserialized for non-Component 
-			// purposes (you'll need to call initialize manually).
-		}
-
-		const String& getRTTIName() override
-		{
-			static String name = "Light";
-			return name;
-		}
-
-		UINT32 getRTTIId() override
-		{
-			return TID_Light;
-		}
-
-		SPtr<IReflectable> newRTTIObject() override
-		{
-			return Light::createEmpty();
-		}
-	};
-
-	/** @} */
-	/** @endcond */
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsCorePrerequisites.h"
+#include "BsRTTIType.h"
+#include "BsLight.h"
+
+namespace bs
+{
+	/** @cond RTTI */
+	/** @addtogroup RTTI-Impl-Engine
+	 *  @{
+	 */
+
+	class BS_CORE_EXPORT LightRTTI : public RTTIType <Light, IReflectable, LightRTTI>
+	{
+	private:
+		BS_BEGIN_RTTI_MEMBERS
+			BS_RTTI_MEMBER_PLAIN(mPosition, 0)
+			BS_RTTI_MEMBER_PLAIN(mRotation, 1)
+			BS_RTTI_MEMBER_PLAIN(mType, 2)
+			BS_RTTI_MEMBER_PLAIN(mCastsShadows, 3)
+			BS_RTTI_MEMBER_PLAIN(mColor, 4)
+			BS_RTTI_MEMBER_PLAIN(mRange, 5)
+			BS_RTTI_MEMBER_PLAIN(mIntensity, 6)
+			BS_RTTI_MEMBER_PLAIN(mSpotAngle, 7)
+			BS_RTTI_MEMBER_PLAIN(mSpotFalloffAngle, 8)
+			BS_RTTI_MEMBER_PLAIN(mPhysCorrectAtten, 9)
+		BS_END_RTTI_MEMBERS
+	public:
+		LightRTTI()
+			:mInitMembers(this)
+		{ }
+
+		void onDeserializationEnded(IReflectable* obj, const UnorderedMap<String, UINT64>& params) override
+		{
+			// Note: Since this is a CoreObject I should call initialize() right after deserialization,
+			// but since this specific type is used in Components we delay initialization until Component
+			// itself does it. Keep this is mind in case this ever needs to be deserialized for non-Component 
+			// purposes (you'll need to call initialize manually).
+		}
+
+		const String& getRTTIName() override
+		{
+			static String name = "Light";
+			return name;
+		}
+
+		UINT32 getRTTIId() override
+		{
+			return TID_Light;
+		}
+
+		SPtr<IReflectable> newRTTIObject() override
+		{
+			return Light::createEmpty();
+		}
+	};
+
+	/** @} */
+	/** @endcond */
 }

+ 316 - 316
Source/BansheeEngine/Include/BsRenderable.h → Source/BansheeCore/Include/BsRenderable.h

@@ -1,317 +1,317 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsPrerequisites.h"
-#include "BsIReflectable.h"
-#include "BsCoreObject.h"
-#include "BsIResourceListener.h"
-#include "BsBounds.h"
-#include "BsAABox.h"
-
-namespace bs
-{
-	struct RendererAnimationData;
-
-	/** @addtogroup Implementation
-	 *  @{
-	 */
-
-	/**	Signals which portion of a Renderable is dirty. */
-	enum class RenderableDirtyFlag
-	{
-		Transform = 0x01,
-		Everything = 0x02
-	};
-
-	/** Type of animation that can be applied to a renderable object. */
-	enum class RenderableAnimType
-	{
-		None,
-		Skinned,
-		Morph,
-		SkinnedMorph,
-		Count // Keep at end
-	};
-
-	/**
-	 * Renderable represents any visible object in the scene. It has a mesh, bounds and a set of materials. Renderer will
-	 * render any Renderable objects visible by a camera.
-	 */
-	template<bool Core>
-	class BS_EXPORT TRenderable
-	{
-		typedef typename TMeshType<Core>::Type MeshType;
-		typedef typename TMaterialPtrType<Core>::Type MaterialType;
-
-	public:
-		TRenderable();
-		virtual ~TRenderable();
-
-		/**
-		 * Sets the mesh to render. All sub-meshes of the mesh will be rendered, and you may set individual materials for
-		 * each sub-mesh.
-		 */
-		void setMesh(const MeshType& mesh);
-
-		/**
-		 * Sets a material that will be used for rendering a sub-mesh with the specified index. If a sub-mesh doesn't have
-		 * a specific material set then the primary material will be used.
-		 */
-		void setMaterial(UINT32 idx, const MaterialType& material);
-
-		/**
-		 * Sets the primary material to use for rendering. Any sub-mesh that doesn't have an explicit material set will use
-		 * this material.
-		 *
-		 * @note	This is equivalent to calling setMaterial(0, material).
-		 */
-		void setMaterial(const MaterialType& material);
-
-		/**
-		 * Returns all materials used for rendering this renderable. Each of the materials is used for rendering a single
-		 * sub-mesh.
-		 */
-		const Vector<MaterialType>& getMaterials() { return mMaterials; }
-
-		/**
-		 * Sets all materials used for rendering this renderable. Each of the materials is used for rendering a single
-		 * sub-mesh. If number of materials is larger than number of sub-meshes, they will be ignored. If lower, the
-		 * remaining materials will be removed.
-		 */
-		void setMaterials(const Vector<MaterialType>& materials);
-
-		/**
-		 * Sets the layer bitfield that controls whether a renderable is considered visible in a specific camera. Renderable
-		 * layer must match camera layer in order for the camera to render the component.
-		 */
-		void setLayer(UINT64 layer);
-
-		/** Sets the transform matrix that is applied to the object when its being rendered. */
-		void setTransform(const Matrix4& transform, const Matrix4& transformNoScale);
-
-		/**	Sets whether the object should be rendered or not. */
-		void setIsActive(bool active);
-
-		/** 
-		 * Sets bounds that will be used when determining if object is visible. Only relevant if setUseOverrideBounds() is
-		 * set to true.
-		 *
-		 * @param[in]	bounds	Bounds in local space.
-		 */
-		void setOverrideBounds(const AABox& bounds);
-
-		/**
-		 * Enables or disables override bounds. When enabled the bounds provided to setOverrideBounds() will be used for
-		 * determining object visibility, otherwise the bounds from the object's mesh will be used. Disabled by default.
-		 */
-		void setUseOverrideBounds(bool enable);
-
-		/**
-		 * Gets the layer bitfield that controls whether a renderable is considered visible in a specific camera. 
-		 * Renderable layer must match camera layer in order for the camera to render the component.
-		 */
-		UINT64 getLayer() const { return mLayer; }
-
-		/**	Returns the mesh used for rendering. */
-		MeshType getMesh() const { return mMesh; }
-
-		/**	Returns the material used for rendering a sub-mesh with the specified index. */
-		MaterialType getMaterial(UINT32 idx) const { return mMaterials[idx]; }
-
-		/**	Returns the transform matrix that is applied to the object when its being rendered. */
-		Matrix4 getTransform() const { return mTransform; }
-
-		/**
-		 * Returns the transform matrix that is applied to the object when its being rendered. This transform matrix does 
-		 * not include scale values.
-		 */
-		Matrix4 getTransformNoScale() const { return mTransformNoScale; }
-
-		/**	Gets whether the object should be rendered or not. */
-		bool getIsActive() const { return mIsActive; }
-
-		/**	Retrieves the world position of the renderable. */
-		Vector3 getPosition() const { return mPosition; }
-
-	protected:
-		/** 
-		 * Marks the simulation thread object as dirty and notifies the system its data should be synced with its core 
-		 * thread counterpart. 
-		 */
-		virtual void _markCoreDirty(RenderableDirtyFlag flag = RenderableDirtyFlag::Everything) { }
-
-		/**
-		 * Notifies the core object manager that this object is dependant on some other CoreObject(s), and the dependencies
-		 * changed since the last call to this method. This will trigger a call to getCoreDependencies() to collect the 
-		 * new dependencies.
-		 */
-		virtual void _markDependenciesDirty() { }
-
-		/**	Marks the resource dependencies list as dirty and schedules it for rebuild. */
-		virtual void _markResourcesDirty() { }
-
-		/** Triggered whenever the renderable's mesh changes. */
-		virtual void onMeshChanged() { }
-
-		MeshType mMesh;
-		Vector<MaterialType> mMaterials;
-		UINT64 mLayer;
-		AABox mOverrideBounds;
-		bool mUseOverrideBounds;
-		Vector3 mPosition;
-		Matrix4 mTransform;
-		Matrix4 mTransformNoScale;
-		bool mIsActive;
-		RenderableAnimType mAnimType;
-	};
-
-	/** @} */
-
-	/** @addtogroup Renderer-Engine-Internal
-	 *  @{
-	 */
-
-	/** @copydoc TRenderable */
-	class BS_EXPORT Renderable : public IReflectable, public CoreObject, public TRenderable<false>, public IResourceListener
-	{
-	public:
-		/**	Gets world bounds of the mesh rendered by this object. */
-		Bounds getBounds() const;
-
-		/** Sets the animation that will be used for animating the attached mesh. */
-		void setAnimation(const SPtr<Animation>& animation);
-
-		/** Checks is the renderable animated or static. */
-		bool isAnimated() const { return mAnimation != nullptr; }
-
-		/**	Retrieves an implementation of a renderable handler usable only from the core thread. */
-		SPtr<ct::Renderable> getCore() const;
-
-		/**	Returns the hash value that can be used to identify if the internal data needs an update. */
-		UINT32 _getLastModifiedHash() const { return mLastUpdateHash; }
-
-		/**	Sets the hash value that can be used to identify if the internal data needs an update. */
-		void _setLastModifiedHash(UINT32 hash) { mLastUpdateHash = hash; }
-
-		/** Updates the transfrom from the provided scene object, if the scene object's data is detected to be dirty. */
-		void _updateTransform(const HSceneObject& so, bool force = false);
-
-		/**	Creates a new renderable handler instance. */
-		static SPtr<Renderable> create();
-
-	protected:
-		Renderable();
-
-		/** @copydoc CoreObject::createCore */
-		SPtr<ct::CoreObject> createCore() const override;
-
-		/** @copydoc TRenderable::onMeshChanged */
-		void onMeshChanged() override;
-
-		/** Updates animation properties depending on the current mesh. */
-		void refreshAnimation();
-
-		/** @copydoc TRenderable::_markCoreDirty */
-		void _markCoreDirty(RenderableDirtyFlag flag = RenderableDirtyFlag::Everything) override;
-
-		/** @copydoc TRenderable::_markResourcesDirty */
-		void _markResourcesDirty() override;
-
-		/** @copydoc CoreObject::markDependenciesDirty */
-		void _markDependenciesDirty() override;
-
-		/** @copydoc CoreObject::syncToCore */
-		CoreSyncData syncToCore(FrameAlloc* allocator) override;
-
-		/** @copydoc CoreObject::getCoreDependencies */
-		void getCoreDependencies(Vector<CoreObject*>& dependencies) override;
-
-		/** @copydoc IResourceListener::getListenerResources */
-		void getListenerResources(Vector<HResource>& resources) override;
-
-		/** @copydoc IResourceListener::notifyResourceLoaded */
-		void notifyResourceLoaded(const HResource& resource) override;
-
-		/** @copydoc IResourceListener::notifyResourceChanged */
-		void notifyResourceChanged(const HResource& resource) override;
-
-		/**	Creates a new renderable handler instance without initializing it. */
-		static SPtr<Renderable> createEmpty();
-
-		UINT32 mLastUpdateHash;
-		SPtr<Animation> mAnimation;
-
-		/************************************************************************/
-		/* 								RTTI		                     		*/
-		/************************************************************************/
-	public:
-		friend class RenderableRTTI;
-		static RTTITypeBase* getRTTIStatic();
-		RTTITypeBase* getRTTI() const override;
-	};
-
-	namespace ct
-	{
-	/** @copydoc TRenderable */
-	class BS_EXPORT Renderable : public CoreObject, public TRenderable<true>
-	{
-	public:
-		~Renderable();
-
-		/**	Gets world bounds of the mesh rendered by this object. */
-		Bounds getBounds() const;
-
-		/**	Sets an ID that can be used for uniquely identifying this handler by the renderer. */
-		void setRendererId(UINT32 id) { mRendererId = id; }
-
-		/**	Retrieves an ID that can be used for uniquely identifying this handler by the renderer. */
-		UINT32 getRendererId() const { return mRendererId; }
-
-		/** Returns the type of animation influencing this renderable, if any. */
-		RenderableAnimType getAnimType() const { return mAnimType; }
-
-		/** Returns the identifier of the animation, if this object is animated using skeleton or blend shape animation. */
-		UINT64 getAnimationId() const { return mAnimationId; }
-
-		/** 
-		 * Updates internal animation buffers from the contents of the provided animation data object. Does nothing if
-		 * renderable is not affected by animation.
-		 */
-		void updateAnimationBuffers(const RendererAnimationData& animData);
-
-		/** Returns the GPU buffer containing element's bone matrices, if it has any. */
-		const SPtr<GpuBuffer>& getBoneMatrixBuffer() const { return mBoneMatrixBuffer; }
-
-		/** Returns the vertex buffer containing element's morph shape vertices, if it has any. */
-		const SPtr<VertexBuffer>& getMorphShapeBuffer() const { return mMorphShapeBuffer; }
-
-		/** Returns vertex declaration used for rendering meshes containing morph shape information. */
-		const SPtr<VertexDeclaration>& getMorphVertexDeclaration() const { return mMorphVertexDeclaration; }
-
-	protected:
-		friend class bs::Renderable;
-
-		Renderable();
-
-		/** @copydoc CoreObject::initialize */
-		void initialize() override;
-
-		/** @copydoc CoreObject::syncToCore */
-		void syncToCore(const CoreSyncData& data) override;
-
-		/** Creates any buffers required for renderable animation. Should be called whenever animation properties change. */
-		void createAnimationBuffers();
-
-		UINT32 mRendererId;
-		UINT64 mAnimationId;
-		UINT32 mMorphShapeVersion;
-
-		SPtr<GpuBuffer> mBoneMatrixBuffer;
-		SPtr<VertexBuffer> mMorphShapeBuffer;
-		SPtr<VertexDeclaration> mMorphVertexDeclaration;
-	};
-	}
-
-	/** @} */
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsCorePrerequisites.h"
+#include "BsIReflectable.h"
+#include "BsCoreObject.h"
+#include "BsIResourceListener.h"
+#include "BsBounds.h"
+#include "BsAABox.h"
+
+namespace bs
+{
+	struct RendererAnimationData;
+
+	/** @addtogroup Implementation
+	 *  @{
+	 */
+
+	/**	Signals which portion of a Renderable is dirty. */
+	enum class RenderableDirtyFlag
+	{
+		Transform = 0x01,
+		Everything = 0x02
+	};
+
+	/** Type of animation that can be applied to a renderable object. */
+	enum class RenderableAnimType
+	{
+		None,
+		Skinned,
+		Morph,
+		SkinnedMorph,
+		Count // Keep at end
+	};
+
+	/**
+	 * Renderable represents any visible object in the scene. It has a mesh, bounds and a set of materials. Renderer will
+	 * render any Renderable objects visible by a camera.
+	 */
+	template<bool Core>
+	class BS_CORE_EXPORT TRenderable
+	{
+		typedef typename TMeshType<Core>::Type MeshType;
+		typedef typename TMaterialPtrType<Core>::Type MaterialType;
+
+	public:
+		TRenderable();
+		virtual ~TRenderable();
+
+		/**
+		 * Sets the mesh to render. All sub-meshes of the mesh will be rendered, and you may set individual materials for
+		 * each sub-mesh.
+		 */
+		void setMesh(const MeshType& mesh);
+
+		/**
+		 * Sets a material that will be used for rendering a sub-mesh with the specified index. If a sub-mesh doesn't have
+		 * a specific material set then the primary material will be used.
+		 */
+		void setMaterial(UINT32 idx, const MaterialType& material);
+
+		/**
+		 * Sets the primary material to use for rendering. Any sub-mesh that doesn't have an explicit material set will use
+		 * this material.
+		 *
+		 * @note	This is equivalent to calling setMaterial(0, material).
+		 */
+		void setMaterial(const MaterialType& material);
+
+		/**
+		 * Returns all materials used for rendering this renderable. Each of the materials is used for rendering a single
+		 * sub-mesh.
+		 */
+		const Vector<MaterialType>& getMaterials() { return mMaterials; }
+
+		/**
+		 * Sets all materials used for rendering this renderable. Each of the materials is used for rendering a single
+		 * sub-mesh. If number of materials is larger than number of sub-meshes, they will be ignored. If lower, the
+		 * remaining materials will be removed.
+		 */
+		void setMaterials(const Vector<MaterialType>& materials);
+
+		/**
+		 * Sets the layer bitfield that controls whether a renderable is considered visible in a specific camera. Renderable
+		 * layer must match camera layer in order for the camera to render the component.
+		 */
+		void setLayer(UINT64 layer);
+
+		/** Sets the transform matrix that is applied to the object when its being rendered. */
+		void setTransform(const Matrix4& transform, const Matrix4& transformNoScale);
+
+		/**	Sets whether the object should be rendered or not. */
+		void setIsActive(bool active);
+
+		/** 
+		 * Sets bounds that will be used when determining if object is visible. Only relevant if setUseOverrideBounds() is
+		 * set to true.
+		 *
+		 * @param[in]	bounds	Bounds in local space.
+		 */
+		void setOverrideBounds(const AABox& bounds);
+
+		/**
+		 * Enables or disables override bounds. When enabled the bounds provided to setOverrideBounds() will be used for
+		 * determining object visibility, otherwise the bounds from the object's mesh will be used. Disabled by default.
+		 */
+		void setUseOverrideBounds(bool enable);
+
+		/**
+		 * Gets the layer bitfield that controls whether a renderable is considered visible in a specific camera. 
+		 * Renderable layer must match camera layer in order for the camera to render the component.
+		 */
+		UINT64 getLayer() const { return mLayer; }
+
+		/**	Returns the mesh used for rendering. */
+		MeshType getMesh() const { return mMesh; }
+
+		/**	Returns the material used for rendering a sub-mesh with the specified index. */
+		MaterialType getMaterial(UINT32 idx) const { return mMaterials[idx]; }
+
+		/**	Returns the transform matrix that is applied to the object when its being rendered. */
+		Matrix4 getTransform() const { return mTransform; }
+
+		/**
+		 * Returns the transform matrix that is applied to the object when its being rendered. This transform matrix does 
+		 * not include scale values.
+		 */
+		Matrix4 getTransformNoScale() const { return mTransformNoScale; }
+
+		/**	Gets whether the object should be rendered or not. */
+		bool getIsActive() const { return mIsActive; }
+
+		/**	Retrieves the world position of the renderable. */
+		Vector3 getPosition() const { return mPosition; }
+
+	protected:
+		/** 
+		 * Marks the simulation thread object as dirty and notifies the system its data should be synced with its core 
+		 * thread counterpart. 
+		 */
+		virtual void _markCoreDirty(RenderableDirtyFlag flag = RenderableDirtyFlag::Everything) { }
+
+		/**
+		 * Notifies the core object manager that this object is dependant on some other CoreObject(s), and the dependencies
+		 * changed since the last call to this method. This will trigger a call to getCoreDependencies() to collect the 
+		 * new dependencies.
+		 */
+		virtual void _markDependenciesDirty() { }
+
+		/**	Marks the resource dependencies list as dirty and schedules it for rebuild. */
+		virtual void _markResourcesDirty() { }
+
+		/** Triggered whenever the renderable's mesh changes. */
+		virtual void onMeshChanged() { }
+
+		MeshType mMesh;
+		Vector<MaterialType> mMaterials;
+		UINT64 mLayer;
+		AABox mOverrideBounds;
+		bool mUseOverrideBounds;
+		Vector3 mPosition;
+		Matrix4 mTransform;
+		Matrix4 mTransformNoScale;
+		bool mIsActive;
+		RenderableAnimType mAnimType;
+	};
+
+	/** @} */
+
+	/** @addtogroup Renderer-Engine-Internal
+	 *  @{
+	 */
+
+	/** @copydoc TRenderable */
+	class BS_CORE_EXPORT Renderable : public IReflectable, public CoreObject, public TRenderable<false>, public IResourceListener
+	{
+	public:
+		/**	Gets world bounds of the mesh rendered by this object. */
+		Bounds getBounds() const;
+
+		/** Sets the animation that will be used for animating the attached mesh. */
+		void setAnimation(const SPtr<Animation>& animation);
+
+		/** Checks is the renderable animated or static. */
+		bool isAnimated() const { return mAnimation != nullptr; }
+
+		/**	Retrieves an implementation of a renderable handler usable only from the core thread. */
+		SPtr<ct::Renderable> getCore() const;
+
+		/**	Returns the hash value that can be used to identify if the internal data needs an update. */
+		UINT32 _getLastModifiedHash() const { return mLastUpdateHash; }
+
+		/**	Sets the hash value that can be used to identify if the internal data needs an update. */
+		void _setLastModifiedHash(UINT32 hash) { mLastUpdateHash = hash; }
+
+		/** Updates the transfrom from the provided scene object, if the scene object's data is detected to be dirty. */
+		void _updateTransform(const HSceneObject& so, bool force = false);
+
+		/**	Creates a new renderable handler instance. */
+		static SPtr<Renderable> create();
+
+	protected:
+		Renderable();
+
+		/** @copydoc CoreObject::createCore */
+		SPtr<ct::CoreObject> createCore() const override;
+
+		/** @copydoc TRenderable::onMeshChanged */
+		void onMeshChanged() override;
+
+		/** Updates animation properties depending on the current mesh. */
+		void refreshAnimation();
+
+		/** @copydoc TRenderable::_markCoreDirty */
+		void _markCoreDirty(RenderableDirtyFlag flag = RenderableDirtyFlag::Everything) override;
+
+		/** @copydoc TRenderable::_markResourcesDirty */
+		void _markResourcesDirty() override;
+
+		/** @copydoc CoreObject::markDependenciesDirty */
+		void _markDependenciesDirty() override;
+
+		/** @copydoc CoreObject::syncToCore */
+		CoreSyncData syncToCore(FrameAlloc* allocator) override;
+
+		/** @copydoc CoreObject::getCoreDependencies */
+		void getCoreDependencies(Vector<CoreObject*>& dependencies) override;
+
+		/** @copydoc IResourceListener::getListenerResources */
+		void getListenerResources(Vector<HResource>& resources) override;
+
+		/** @copydoc IResourceListener::notifyResourceLoaded */
+		void notifyResourceLoaded(const HResource& resource) override;
+
+		/** @copydoc IResourceListener::notifyResourceChanged */
+		void notifyResourceChanged(const HResource& resource) override;
+
+		/**	Creates a new renderable handler instance without initializing it. */
+		static SPtr<Renderable> createEmpty();
+
+		UINT32 mLastUpdateHash;
+		SPtr<Animation> mAnimation;
+
+		/************************************************************************/
+		/* 								RTTI		                     		*/
+		/************************************************************************/
+	public:
+		friend class RenderableRTTI;
+		static RTTITypeBase* getRTTIStatic();
+		RTTITypeBase* getRTTI() const override;
+	};
+
+	namespace ct
+	{
+	/** @copydoc TRenderable */
+	class BS_CORE_EXPORT Renderable : public CoreObject, public TRenderable<true>
+	{
+	public:
+		~Renderable();
+
+		/**	Gets world bounds of the mesh rendered by this object. */
+		Bounds getBounds() const;
+
+		/**	Sets an ID that can be used for uniquely identifying this handler by the renderer. */
+		void setRendererId(UINT32 id) { mRendererId = id; }
+
+		/**	Retrieves an ID that can be used for uniquely identifying this handler by the renderer. */
+		UINT32 getRendererId() const { return mRendererId; }
+
+		/** Returns the type of animation influencing this renderable, if any. */
+		RenderableAnimType getAnimType() const { return mAnimType; }
+
+		/** Returns the identifier of the animation, if this object is animated using skeleton or blend shape animation. */
+		UINT64 getAnimationId() const { return mAnimationId; }
+
+		/** 
+		 * Updates internal animation buffers from the contents of the provided animation data object. Does nothing if
+		 * renderable is not affected by animation.
+		 */
+		void updateAnimationBuffers(const RendererAnimationData& animData);
+
+		/** Returns the GPU buffer containing element's bone matrices, if it has any. */
+		const SPtr<GpuBuffer>& getBoneMatrixBuffer() const { return mBoneMatrixBuffer; }
+
+		/** Returns the vertex buffer containing element's morph shape vertices, if it has any. */
+		const SPtr<VertexBuffer>& getMorphShapeBuffer() const { return mMorphShapeBuffer; }
+
+		/** Returns vertex declaration used for rendering meshes containing morph shape information. */
+		const SPtr<VertexDeclaration>& getMorphVertexDeclaration() const { return mMorphVertexDeclaration; }
+
+	protected:
+		friend class bs::Renderable;
+
+		Renderable();
+
+		/** @copydoc CoreObject::initialize */
+		void initialize() override;
+
+		/** @copydoc CoreObject::syncToCore */
+		void syncToCore(const CoreSyncData& data) override;
+
+		/** Creates any buffers required for renderable animation. Should be called whenever animation properties change. */
+		void createAnimationBuffers();
+
+		UINT32 mRendererId;
+		UINT64 mAnimationId;
+		UINT32 mMorphShapeVersion;
+
+		SPtr<GpuBuffer> mBoneMatrixBuffer;
+		SPtr<VertexBuffer> mMorphShapeBuffer;
+		SPtr<VertexDeclaration> mMorphVertexDeclaration;
+	};
+	}
+
+	/** @} */
 }

+ 65 - 65
Source/BansheeEngine/Include/BsRenderableRTTI.h → Source/BansheeCore/Include/BsRenderableRTTI.h

@@ -1,66 +1,66 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsPrerequisites.h"
-#include "BsRTTIType.h"
-#include "BsRenderable.h"
-
-namespace bs
-{
-	/** @cond RTTI */
-	/** @addtogroup RTTI-Impl-Engine
-	 *  @{
-	 */
-
-	class BS_EXPORT RenderableRTTI : public RTTIType<Renderable, IReflectable, RenderableRTTI>
-	{
-	private:
-		HMesh& getMesh(Renderable* obj) { return obj->mMesh; }
-		void setMesh(Renderable* obj, HMesh& val) { obj->mMesh = val; }
-
-		UINT64& getLayer(Renderable* obj) { return obj->mLayer; }
-		void setLayer(Renderable* obj, UINT64& val) { obj->mLayer = val; }
-
-		HMaterial& getMaterial(Renderable* obj, UINT32 idx) { return obj->mMaterials[idx]; }
-		void setMaterial(Renderable* obj, UINT32 idx, HMaterial& val) { obj->setMaterial(idx, val); }
-		UINT32 getNumMaterials(Renderable* obj) { return (UINT32)obj->mMaterials.size(); }
-		void setNumMaterials(Renderable* obj, UINT32 num) { obj->mMaterials.resize(num); }
-
-	public:
-		RenderableRTTI()
-		{
-			addReflectableField("mMesh", 0, &RenderableRTTI::getMesh, &RenderableRTTI::setMesh);
-			addPlainField("mLayer", 1, &RenderableRTTI::getLayer, &RenderableRTTI::setLayer);
-			addReflectableArrayField("mMaterials", 2, &RenderableRTTI::getMaterial, 
-				&RenderableRTTI::getNumMaterials, &RenderableRTTI::setMaterial, &RenderableRTTI::setNumMaterials);
-		}
-
-		void onDeserializationEnded(IReflectable* obj, const UnorderedMap<String, UINT64>& params) override
-		{
-			// Note: Since this is a CoreObject I should call initialize() right after deserialization,
-			// but since this specific type is used in Components we delay initialization until Component
-			// itself does it. Keep this is mind in case this ever needs to be deserialized for non-Component 
-			// purposes (you'll need to call initialize manually).
-		}
-
-		const String& getRTTIName() override
-		{
-			static String name = "Renderable";
-			return name;
-		}
-
-		UINT32 getRTTIId() override
-		{
-			return TID_Renderable;
-		}
-
-		SPtr<IReflectable> newRTTIObject() override
-		{
-			return Renderable::createEmpty();
-		}
-	};
-
-	/** @} */
-	/** @endcond */
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsCorePrerequisites.h"
+#include "BsRTTIType.h"
+#include "BsRenderable.h"
+
+namespace bs
+{
+	/** @cond RTTI */
+	/** @addtogroup RTTI-Impl-Engine
+	 *  @{
+	 */
+
+	class BS_CORE_EXPORT RenderableRTTI : public RTTIType<Renderable, IReflectable, RenderableRTTI>
+	{
+	private:
+		HMesh& getMesh(Renderable* obj) { return obj->mMesh; }
+		void setMesh(Renderable* obj, HMesh& val) { obj->mMesh = val; }
+
+		UINT64& getLayer(Renderable* obj) { return obj->mLayer; }
+		void setLayer(Renderable* obj, UINT64& val) { obj->mLayer = val; }
+
+		HMaterial& getMaterial(Renderable* obj, UINT32 idx) { return obj->mMaterials[idx]; }
+		void setMaterial(Renderable* obj, UINT32 idx, HMaterial& val) { obj->setMaterial(idx, val); }
+		UINT32 getNumMaterials(Renderable* obj) { return (UINT32)obj->mMaterials.size(); }
+		void setNumMaterials(Renderable* obj, UINT32 num) { obj->mMaterials.resize(num); }
+
+	public:
+		RenderableRTTI()
+		{
+			addReflectableField("mMesh", 0, &RenderableRTTI::getMesh, &RenderableRTTI::setMesh);
+			addPlainField("mLayer", 1, &RenderableRTTI::getLayer, &RenderableRTTI::setLayer);
+			addReflectableArrayField("mMaterials", 2, &RenderableRTTI::getMaterial, 
+				&RenderableRTTI::getNumMaterials, &RenderableRTTI::setMaterial, &RenderableRTTI::setNumMaterials);
+		}
+
+		void onDeserializationEnded(IReflectable* obj, const UnorderedMap<String, UINT64>& params) override
+		{
+			// Note: Since this is a CoreObject I should call initialize() right after deserialization,
+			// but since this specific type is used in Components we delay initialization until Component
+			// itself does it. Keep this is mind in case this ever needs to be deserialized for non-Component 
+			// purposes (you'll need to call initialize manually).
+		}
+
+		const String& getRTTIName() override
+		{
+			static String name = "Renderable";
+			return name;
+		}
+
+		UINT32 getRTTIId() override
+		{
+			return TID_Renderable;
+		}
+
+		SPtr<IReflectable> newRTTIObject() override
+		{
+			return Renderable::createEmpty();
+		}
+	};
+
+	/** @} */
+	/** @endcond */
 }

+ 208 - 161
Source/BansheeCore/Include/BsCoreRenderer.h → Source/BansheeCore/Include/BsRenderer.h

@@ -1,162 +1,209 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsCorePrerequisites.h"
-#include "BsStringID.h"
-#include "BsRendererMeshData.h"
-
-namespace bs 
-{ 
-	class RendererExtension;
-	struct PostProcessSettings;
-
-	namespace ct
-	{
-	/** @addtogroup Renderer-Internal
-	 *  @{
-	 */
-
-	/**
-	 * Available parameter block semantics that allow the renderer to identify the use of a GPU program parameter block 
-	 * specified in a shader.
-	 */
-	static StringID RBS_Static = "Static";
-	static StringID RBS_PerCamera = "PerCamera";
-	static StringID RBS_PerFrame = "PerFrame";
-	static StringID RBS_PerObject = "PerObject";
-	static StringID RBS_PerCall = "PerCall";
-
-	/**
-	 * Available parameter semantics that allow the renderer to identify the use of a GPU parameter specified in a shader.
-	 */
-	static StringID RPS_WorldViewProjTfrm = "WVP";
-	static StringID RPS_ViewProjTfrm = "VP";
-	static StringID RPS_ProjTfrm = "P";
-	static StringID RPS_ViewTfrm = "V";
-	static StringID RPS_WorldTfrm = "W";
-	static StringID RPS_InvWorldTfrm = "IW";
-	static StringID RPS_WorldNoScaleTfrm = "WNoScale";
-	static StringID RPS_InvWorldNoScaleTfrm = "IWNoScale";
-	static StringID RPS_WorldDeterminantSign = "WorldDeterminantSign";
-	static StringID RPS_Diffuse = "Diffuse";
-	static StringID RPS_ViewDir = "ViewDir";
-
-	/** Technique tags. */
-	static StringID RTag_Skinned = "Skinned";
-	static StringID RTag_Morph = "Morph";
-	static StringID RTag_SkinnedMorph = "SkinnedMorph";
-
-	/**	Set of options that can be used for controlling the renderer. */	
-	struct BS_CORE_EXPORT CoreRendererOptions
-	{
-		virtual ~CoreRendererOptions() { }
-	};
-
-	/**
-	 * Primarily rendering class that allows you to specify how to render objects that exist in the scene graph. You need
-	 * to provide your own implementation of your class.
-	 *
-	 * @note	
-	 * Normally you would iterate over all cameras, find visible objects for each camera and render those objects in some way.
-	 */
-	class BS_CORE_EXPORT CoreRenderer
-	{
-	public:
-		CoreRenderer();
-		virtual ~CoreRenderer() { }
-
-		/** Initializes the renderer. Must be called before using the renderer. */
-		virtual void initialize() { }
-
-		/**	Cleans up the renderer. Must be called before the renderer is deleted. */
-		virtual void destroy() { }
-
-		/** Name of the renderer. Used by materials to find an appropriate technique for this renderer. */
-		virtual const StringID& getName() const = 0;
-
-		/** Called in order to render all currently active cameras. */
-		virtual void renderAll() = 0;
-
-		/**
-		 * Called whenever a new camera is created.
-		 *
-		 * @note	Core thread.
-		 */
-		virtual void notifyCameraAdded(const ct::Camera* camera) { }
-
-		/**
-		 * Called whenever a camera's position or rotation is updated.
-		 *
-		 * @param[in]	camera		Camera that was updated.
-		 * @param[in]	updateFlag	Optional flag that allows the camera to signal to the renderer exactly what was updated.
-		 *
-		 * @note	Core thread.
-		 */
-		virtual void notifyCameraUpdated(const ct::Camera* camera, UINT32 updateFlag) { }
-
-		/**
-		 * Called whenever a camera is destroyed.
-		 *
-		 * @note	Core thread.
-		 */
-		virtual void notifyCameraRemoved(const ct::Camera* camera) { }
-
-		/**
-		 * Creates a new empty renderer mesh data.
-		 *
-		 * @note	Sim thread.
-		 *			
-		 * @see		RendererMeshData
-		 */
-		virtual SPtr<RendererMeshData> _createMeshData(UINT32 numVertices, UINT32 numIndices, VertexLayout layout, IndexType indexType = IT_32BIT);
-
-		/**
-		 * Creates a new renderer mesh data using an existing generic mesh data buffer.
-		 *
-		 * @note	Sim thread.
-		 *			
-		 * @see		RendererMeshData
-		 */
-		virtual SPtr<RendererMeshData> _createMeshData(const SPtr<MeshData>& meshData);
-
-		/** 
-		 * Registers an extension object that will be called every frame by the renderer. Allows external code to perform
-		 * custom rendering interleaved with the renderer's output.
-		 * 
-		 * @note	Core thread.
-		 */
-		void addPlugin(RendererExtension* plugin) { mCallbacks.insert(plugin); }
-
-		/** 
-		 * Unregisters an extension registered with addPlugin(). 
-		 * 
-		 * @note	Core thread.
-		 */
-		void removePlugin(RendererExtension* plugin) { mCallbacks.erase(plugin); }
-
-		/**	Sets options used for controlling the rendering. */
-		virtual void setOptions(const SPtr<CoreRendererOptions>& options) { }
-
-		/**	Returns current set of options used for controlling the rendering. */
-		virtual SPtr<CoreRendererOptions> getOptions() const { return SPtr<CoreRendererOptions>(); }
-
-		/** Creates post process settings that can be attached to a camera and processed by the active renderer. */
-		virtual SPtr<PostProcessSettings> createPostProcessSettings() const = 0;
-
-	protected:
-		/**	Contains information about a render callback. */
-		struct RenderCallbackData
-		{
-			bool overlay;
-			std::function<void()> callback;
-		};
-
-		/** Callback to trigger when comparing the order in which renderer extensions are called. */
-		static bool compareCallback(const RendererExtension* a, const RendererExtension* b);
-
-		Set<RendererExtension*, std::function<bool(const RendererExtension*, const RendererExtension*)>> mCallbacks;
-	};
-
-	/** @} */
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsCorePrerequisites.h"
+#include "BsStringID.h"
+#include "BsRendererMeshData.h"
+
+namespace bs 
+{ 
+	class RendererExtension;
+	struct PostProcessSettings;
+
+	namespace ct
+	{
+	/** @addtogroup Renderer-Internal
+	 *  @{
+	 */
+
+	/**
+	 * Available parameter block semantics that allow the renderer to identify the use of a GPU program parameter block 
+	 * specified in a shader.
+	 */
+	static StringID RBS_Static = "Static";
+	static StringID RBS_PerCamera = "PerCamera";
+	static StringID RBS_PerFrame = "PerFrame";
+	static StringID RBS_PerObject = "PerObject";
+	static StringID RBS_PerCall = "PerCall";
+
+	/**
+	 * Available parameter semantics that allow the renderer to identify the use of a GPU parameter specified in a shader.
+	 */
+	static StringID RPS_WorldViewProjTfrm = "WVP";
+	static StringID RPS_ViewProjTfrm = "VP";
+	static StringID RPS_ProjTfrm = "P";
+	static StringID RPS_ViewTfrm = "V";
+	static StringID RPS_WorldTfrm = "W";
+	static StringID RPS_InvWorldTfrm = "IW";
+	static StringID RPS_WorldNoScaleTfrm = "WNoScale";
+	static StringID RPS_InvWorldNoScaleTfrm = "IWNoScale";
+	static StringID RPS_WorldDeterminantSign = "WorldDeterminantSign";
+	static StringID RPS_Diffuse = "Diffuse";
+	static StringID RPS_ViewDir = "ViewDir";
+
+	/** Technique tags. */
+	static StringID RTag_Skinned = "Skinned";
+	static StringID RTag_Morph = "Morph";
+	static StringID RTag_SkinnedMorph = "SkinnedMorph";
+
+	/**	Set of options that can be used for controlling the renderer. */	
+	struct BS_CORE_EXPORT RendererOptions
+	{
+		virtual ~RendererOptions() { }
+	};
+
+	/**
+	 * Primarily rendering class that allows you to specify how to render objects that exist in the scene graph. You need
+	 * to provide your own implementation of your class.
+	 *
+	 * @note	
+	 * Normally you would iterate over all cameras, find visible objects for each camera and render those objects in some 
+	 * way.
+	 */
+	class BS_CORE_EXPORT Renderer
+	{
+	public:
+		Renderer();
+		virtual ~Renderer() { }
+
+		/** Initializes the renderer. Must be called before using the renderer. */
+		virtual void initialize() { }
+
+		/**	Cleans up the renderer. Must be called before the renderer is deleted. */
+		virtual void destroy() { }
+
+		/** Name of the renderer. Used by materials to find an appropriate technique for this renderer. */
+		virtual const StringID& getName() const = 0;
+
+		/** Called in order to render all currently active cameras. */
+		virtual void renderAll() = 0;
+
+		/**
+		 * Called whenever a new camera is created.
+		 *
+		 * @note	Core thread.
+		 */
+		virtual void notifyCameraAdded(const Camera* camera) { }
+
+		/**
+		 * Called whenever a camera's position or rotation is updated.
+		 *
+		 * @param[in]	camera		Camera that was updated.
+		 * @param[in]	updateFlag	Optional flag that allows the camera to signal to the renderer exactly what was updated.
+		 *
+		 * @note	Core thread.
+		 */
+		virtual void notifyCameraUpdated(const Camera* camera, UINT32 updateFlag) { }
+
+		/**
+		 * Called whenever a camera is destroyed.
+		 *
+		 * @note	Core thread.
+		 */
+		virtual void notifyCameraRemoved(const Camera* camera) { }
+
+		/**
+		 * Called whenever a new renderable is created.
+		 *
+		 * @note	Core thread.
+		 */
+		virtual void notifyRenderableAdded(Renderable* renderable) { }
+
+		/**
+		 * Called whenever a renderable is updated.
+		 *
+		 * @note	Core thread.
+		 */
+		virtual void notifyRenderableUpdated(Renderable* renderable) { }
+
+		/**
+		 * Called whenever a renderable is destroyed.
+		 *
+		 * @note	Core thread.
+		 */
+		virtual void notifyRenderableRemoved(Renderable* renderable) { }
+
+		/**
+		 * Called whenever a new light is created.
+		 *
+		 * @note	Core thread.
+		 */
+		virtual void notifyLightAdded(Light* light) { }
+
+		/**
+		 * Called whenever a light is updated.
+		 *
+		 * @note	Core thread.
+		 */
+		virtual void notifyLightUpdated(Light* light) { }
+
+		/**
+		 * Called whenever a light is destroyed.
+		 *
+		 * @note	Core thread.
+		 */
+		virtual void notifyLightRemoved(Light* light) { }
+
+		/**
+		 * Creates a new empty renderer mesh data.
+		 *
+		 * @note	Sim thread.
+		 *			
+		 * @see		RendererMeshData
+		 */
+		virtual SPtr<RendererMeshData> _createMeshData(UINT32 numVertices, UINT32 numIndices, VertexLayout layout, 
+													   IndexType indexType = IT_32BIT);
+
+		/**
+		 * Creates a new renderer mesh data using an existing generic mesh data buffer.
+		 *
+		 * @note	Sim thread.
+		 *			
+		 * @see		RendererMeshData
+		 */
+		virtual SPtr<RendererMeshData> _createMeshData(const SPtr<MeshData>& meshData);
+
+		/** 
+		 * Registers an extension object that will be called every frame by the renderer. Allows external code to perform
+		 * custom rendering interleaved with the renderer's output.
+		 * 
+		 * @note	Core thread.
+		 */
+		void addPlugin(RendererExtension* plugin) { mCallbacks.insert(plugin); }
+
+		/** 
+		 * Unregisters an extension registered with addPlugin(). 
+		 * 
+		 * @note	Core thread.
+		 */
+		void removePlugin(RendererExtension* plugin) { mCallbacks.erase(plugin); }
+
+		/**	Sets options used for controlling the rendering. */
+		virtual void setOptions(const SPtr<RendererOptions>& options) { }
+
+		/**	Returns current set of options used for controlling the rendering. */
+		virtual SPtr<RendererOptions> getOptions() const { return SPtr<RendererOptions>(); }
+
+		/** Creates post process settings that can be attached to a camera and processed by the active renderer. */
+		virtual SPtr<PostProcessSettings> createPostProcessSettings() const = 0;
+
+	protected:
+		/**	Contains information about a render callback. */
+		struct RenderCallbackData
+		{
+			bool overlay;
+			std::function<void()> callback;
+		};
+
+		/** Callback to trigger when comparing the order in which renderer extensions are called. */
+		static bool compareCallback(const RendererExtension* a, const RendererExtension* b);
+
+		Set<RendererExtension*, std::function<bool(const RendererExtension*, const RendererExtension*)>> mCallbacks;
+	};
+
+	/**	Provides easy access to Renderer. */
+	SPtr<Renderer> BS_CORE_EXPORT gRenderer();
+
+	/** @} */
 }}

+ 1 - 1
Source/BansheeCore/Include/BsRendererExtension.h

@@ -42,7 +42,7 @@ namespace bs
 
 	/** 
 	 * Interface that can be implemented in order to provide custom rendering code to the renderer. 
-	 * See CoreRenderer::addPlugin().
+	 * See Renderer::addPlugin().
 	 * 
 	 * @note	Core thread.
 	 */

+ 1 - 1
Source/BansheeCore/Include/BsRendererFactory.h

@@ -22,7 +22,7 @@ namespace bs
 		virtual ~RendererFactory() { }
 
 		/**	Creates a new instance of the renderer. */
-		virtual SPtr<ct::CoreRenderer> create() = 0;
+		virtual SPtr<ct::Renderer> create() = 0;
 
 		/**	Returns the name of the renderer this factory creates. */
 		virtual const String& name() const = 0;

+ 2 - 2
Source/BansheeCore/Include/BsRendererManager.h

@@ -33,7 +33,7 @@ namespace bs
 		void initialize();
 
 		/**	Returns the currently active renderer. Null if no renderer is active. */
-		SPtr<ct::CoreRenderer> getActive() { return mActiveRenderer; }
+		SPtr<ct::Renderer> getActive() { return mActiveRenderer; }
 
 		/**
 		 * Registers a new renderer factory. Any renderer you try to make active with setActive() you will need to have 
@@ -43,7 +43,7 @@ namespace bs
 	private:
 		Vector<SPtr<RendererFactory>> mAvailableFactories;
 
-		SPtr<ct::CoreRenderer> mActiveRenderer;
+		SPtr<ct::Renderer> mActiveRenderer;
 	};
 
 	/** @} */

+ 1 - 1
Source/BansheeCore/Include/BsRendererMeshData.h

@@ -219,7 +219,7 @@ namespace bs
 		static SPtr<VertexDataDesc> vertexLayoutVertexDesc(VertexLayout type);
 
 	private:
-		friend class ct::CoreRenderer;
+		friend class ct::Renderer;
 
 		RendererMeshData(UINT32 numVertices, UINT32 numIndices, VertexLayout layout, IndexType indexType = IT_32BIT);
 		RendererMeshData(const SPtr<MeshData>& meshData);

+ 154 - 137
Source/BansheeCore/Include/BsCoreSceneManager.h → Source/BansheeCore/Include/BsSceneManager.h

@@ -1,138 +1,155 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsCorePrerequisites.h"
-#include "BsModule.h"
-#include "BsGameObject.h"
-
-namespace bs
-{
-	/** @addtogroup Scene-Internal
-	 *  @{
-	 */
-
-	/**	Contains information about a camera managed by the scene manager. */
-	struct SceneCameraData
-	{
-		SceneCameraData() { }
-
-		SceneCameraData(const SPtr<Camera>& camera, const HSceneObject& sceneObject)
-			:camera(camera), sceneObject(sceneObject)
-		{ }
-
-		SPtr<Camera> camera;
-		HSceneObject sceneObject;
-	};
-
-	/**
-	 * Manages all objects in the scene and provides various query methods for finding objects. This is just the base class
-	 * with basic query functionality. You should override it with your own version.
-	 */
-	class BS_CORE_EXPORT CoreSceneManager : public Module<CoreSceneManager>
-	{
-	public:
-		CoreSceneManager();
-		virtual ~CoreSceneManager();
-
-		/**	Returns the root scene object. */
-		HSceneObject getRootNode() const { return mRootNode; }
-
-		/**
-		 * Destroys all scene objects in the scene.
-		 *
-		 * @param[in]	forceAll	If true, then even the persistent objects will be unloaded.
-		 */
-		void clearScene(bool forceAll = false);
-
-		/** Returns all cameras in the scene. */
-		const Map<Camera*, SceneCameraData>& getAllCameras() const { return mCameras; }
-
-		/**
-		 * Returns the camera in the scene marked as main. Main camera controls the final render surface that is displayed
-		 * to the user. If there are multiple main cameras, the first one found returned.
-		 */
-		SceneCameraData getMainCamera() const;
-
-		/**
-		 * Sets the render target that the main camera in the scene (if any) will render its view to. This generally means
-		 * the main game window when running standalone, or the Game viewport when running in editor.
-		 */
-		void setMainRenderTarget(const SPtr<RenderTarget>& rt);
-
-		/**	Notifies the scene manager that a new camera was created. */
-		void _registerCamera(const SPtr<Camera>& camera, const HSceneObject& so);
-
-		/**	Notifies the scene manager that a camera was removed. */
-		void _unregisterCamera(const SPtr<Camera>& camera);
-
-		/**	Notifies the scene manager that a camera either became the main camera, or has stopped being main camera. */
-		void _notifyMainCameraStateChanged(const SPtr<Camera>& camera);
-
-		/** Changes the root scene object. Any persistent objects will remain in the scene, now parented to the new root. */
-		void _setRootNode(const HSceneObject& root);
-
-		/** Called every frame. Calls update methods on all scene objects and their components. */
-		virtual void _update();
-
-		/** Updates dirty transforms on any core objects that may be tied with scene objects. */
-		virtual void _updateCoreObjectTransforms() { }
-
-	protected:
-		friend class SceneObject;
-
-		/**
-		 * Register a new node in the scene manager, on the top-most level of the hierarchy.
-		 * 			
-		 * @param[in]	node	Node you wish to add. It's your responsibility not to add duplicate or null nodes. This 
-		 *						method won't check.
-		 *
-		 * @note	
-		 * After you add a node in the scene manager, it takes ownership of its memory and is responsible for releasing it.
-		 * Do NOT add nodes that have already been added (if you just want to change their parent). Normally this 
-		 * method will only be called by SceneObject.
-		 */
-		void registerNewSO(const HSceneObject& node);
-
-		/**	Callback that is triggered when the main render target size is changed. */
-		void onMainRenderTargetResized();
-
-	protected:
-		HSceneObject mRootNode;
-
-		Map<Camera*, SceneCameraData> mCameras;
-		Vector<SceneCameraData> mMainCameras;
-
-		SPtr<RenderTarget> mMainRT;
-		HEvent mMainRTResizedConn;
-	};
-
-	/**
-	 * Handles creation of a scene manager.
-	 *
-	 * @note	
-	 * Since scene manager implementations may vary it is expected that a concrete implementation of a scene manager will 
-	 * register its creation method using setFactoryMethod() which will then later be used for creating the scene manager
-	 * during application start up.
-	 */
-	class BS_CORE_EXPORT SceneManagerFactory
-	{
-	public:
-		/**	Creates a concrete scene manager, depending on the currently set factory method. */
-		static void create();
-
-		/**	Sets method that will be used for creating the scene manager when create() gets called. */
-		static void setFactoryMethod(const std::function<void()>& method)
-		{
-			mFactoryMethod = method;
-		}
-
-	private:
-		static std::function<void()> mFactoryMethod;
-	};
-
-	/**	Provides easy access to the CoreSceneManager. */
-	BS_CORE_EXPORT CoreSceneManager& gCoreSceneManager();
-
-	/** @} */
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsCorePrerequisites.h"
+#include "BsModule.h"
+#include "BsGameObject.h"
+
+namespace bs
+{
+	/** @addtogroup Scene-Internal
+	 *  @{
+	 */
+
+	/**	Contains information about a camera managed by the scene manager. */
+	struct SceneCameraData
+	{
+		SceneCameraData() { }
+
+		SceneCameraData(const SPtr<Camera>& camera, const HSceneObject& sceneObject)
+			:camera(camera), sceneObject(sceneObject)
+		{ }
+
+		SPtr<Camera> camera;
+		HSceneObject sceneObject;
+	};
+
+	/**	Contains information about a renderable managed by the scene manager. */
+	struct SceneRenderableData
+	{
+		SceneRenderableData() { }
+
+		SceneRenderableData(const SPtr<Renderable>& renderable, const HSceneObject& sceneObject)
+			:renderable(renderable), sceneObject(sceneObject)
+		{ }
+
+		SPtr<Renderable> renderable;
+		HSceneObject sceneObject;
+	};
+
+	/**	Contains information about a light managed by the scene manager. */
+	struct SceneLightData
+	{
+		SceneLightData() { }
+
+		SceneLightData(const SPtr<Light>& light, const HSceneObject& sceneObject)
+			:light(light), sceneObject(sceneObject)
+		{ }
+
+		SPtr<Light> light;
+		HSceneObject sceneObject;
+	};
+
+	/** Manages active SceneObjects and provides ways for querying and updating them or their components. */
+	class BS_CORE_EXPORT SceneManager : public Module<SceneManager>
+	{
+	public:
+		SceneManager();
+		~SceneManager();
+
+		/**	Returns the root scene object. */
+		HSceneObject getRootNode() const { return mRootNode; }
+
+		/**
+		 * Destroys all scene objects in the scene.
+		 *
+		 * @param[in]	forceAll	If true, then even the persistent objects will be unloaded.
+		 */
+		void clearScene(bool forceAll = false);
+
+		/** Returns all cameras in the scene. */
+		const Map<Camera*, SceneCameraData>& getAllCameras() const { return mCameras; }
+
+		/**
+		 * Returns the camera in the scene marked as main. Main camera controls the final render surface that is displayed
+		 * to the user. If there are multiple main cameras, the first one found returned.
+		 */
+		SceneCameraData getMainCamera() const;
+
+		/**
+		 * Sets the render target that the main camera in the scene (if any) will render its view to. This generally means
+		 * the main game window when running standalone, or the Game viewport when running in editor.
+		 */
+		void setMainRenderTarget(const SPtr<RenderTarget>& rt);
+
+		/**	Returns all renderables in the scene. */
+		const Map<Renderable*, SceneRenderableData>& getAllRenderables() const { return mRenderables; }
+
+		/** Notifies the scene manager that a new renderable was created. */
+		void _registerRenderable(const SPtr<Renderable>& renderable, const HSceneObject& so);
+
+		/**	Notifies the scene manager that a renderable was removed. */
+		void _unregisterRenderable(const SPtr<Renderable>& renderable);
+
+		/**	Notifies the scene manager that a new light was created. */
+		void _registerLight(const SPtr<Light>& light, const HSceneObject& so);
+
+		/**	Notifies the scene manager that a light was removed. */
+		void _unregisterLight(const SPtr<Light>& light);
+
+		/**	Notifies the scene manager that a new camera was created. */
+		void _registerCamera(const SPtr<Camera>& camera, const HSceneObject& so);
+
+		/**	Notifies the scene manager that a camera was removed. */
+		void _unregisterCamera(const SPtr<Camera>& camera);
+
+		/**	Notifies the scene manager that a camera either became the main camera, or has stopped being main camera. */
+		void _notifyMainCameraStateChanged(const SPtr<Camera>& camera);
+
+		/** Changes the root scene object. Any persistent objects will remain in the scene, now parented to the new root. */
+		void _setRootNode(const HSceneObject& root);
+
+		/** Called every frame. Calls update methods on all scene objects and their components. */
+		void _update();
+
+		/** Updates dirty transforms on any core objects that may be tied with scene objects. */
+		void _updateCoreObjectTransforms();
+
+	protected:
+		friend class SceneObject;
+
+		/**
+		 * Register a new node in the scene manager, on the top-most level of the hierarchy.
+		 * 			
+		 * @param[in]	node	Node you wish to add. It's your responsibility not to add duplicate or null nodes. This 
+		 *						method won't check.
+		 *
+		 * @note	
+		 * After you add a node in the scene manager, it takes ownership of its memory and is responsible for releasing it.
+		 * Do NOT add nodes that have already been added (if you just want to change their parent). Normally this 
+		 * method will only be called by SceneObject.
+		 */
+		void registerNewSO(const HSceneObject& node);
+
+		/**	Callback that is triggered when the main render target size is changed. */
+		void onMainRenderTargetResized();
+
+	protected:
+		HSceneObject mRootNode;
+
+		Map<Camera*, SceneCameraData> mCameras;
+		Vector<SceneCameraData> mMainCameras;
+
+		Map<Renderable*, SceneRenderableData> mRenderables;
+		Map<Light*, SceneLightData> mLights;
+
+		SPtr<RenderTarget> mMainRT;
+		HEvent mMainRTResizedConn;
+	};
+
+	/**	Provides easy access to the SceneManager. */
+	BS_CORE_EXPORT SceneManager& gSceneManager();
+
+	/** @} */
 }

+ 6 - 6
Source/BansheeCore/Include/BsSceneObject.h

@@ -42,7 +42,7 @@ namespace bs
 			WorldTfrmDirty = 0x02
 		};
 
-		friend class CoreSceneManager;
+		friend class SceneManager;
 		friend class Prefab;
 		friend class PrefabDiff;
 		friend class PrefabUtility;
@@ -472,9 +472,9 @@ namespace bs
 		/**
 		 * Internal version of setParent() that allows you to set a null parent.
 		 *
-		 * @param[in]	parent			New parent.
-		 * @param[in]	keepWorldPos	Determines should the current transform be maintained even after the parent is 
-		 *								changed (this means the local transform will be modified accordingly).
+		 * @param[in]	parent				New parent.
+		 * @param[in]	keepWorldTransform	Determines should the current transform be maintained even after the parent is 
+		 *									changed (this means the local transform will be modified accordingly).
 		 */
 		void _setParent(const HSceneObject& parent, bool keepWorldTransform = true);
 
@@ -538,8 +538,8 @@ namespace bs
 		 * Searches for a component with the specific type and returns the first one it finds. Will also return components
 		 * derived from the type.
 		 * 			
-		 * @tparam	typename T	Type of the component.
-		 * @return				Component if found, nullptr otherwise.
+		 * @tparam	T	Type of the component.
+		 * @return		Component if found, nullptr otherwise.
 		 *
 		 * @note	
 		 * Don't call this too often as it is relatively slow. It is more efficient to call it once and store the result 

+ 2 - 2
Source/BansheeCore/Source/BsAnimationManager.cpp

@@ -5,7 +5,7 @@
 #include "BsAnimationClip.h"
 #include "BsTaskScheduler.h"
 #include "BsTime.h"
-#include "BsCoreSceneManager.h"
+#include "BsSceneManager.h"
 #include "BsCamera.h"
 #include "BsMorphShapes.h"
 #include "BsMeshData.h"
@@ -85,7 +85,7 @@ namespace bs
 
 		mCullFrustums.clear();
 
-		auto& allCameras = gCoreSceneManager().getAllCameras();
+		auto& allCameras = gSceneManager().getAllCameras();
 		for(auto& entry : allCameras)
 		{
 			bool isOverlayCamera = entry.second.camera->getFlags().isSet(CameraFlag::Overlay);

+ 0 - 0
Source/BansheeEngine/Source/BsCAnimation.cpp → Source/BansheeCore/Source/BsCAnimation.cpp


+ 0 - 0
Source/BansheeEngine/Source/BsCBone.cpp → Source/BansheeCore/Source/BsCBone.cpp


+ 4 - 4
Source/BansheeCore/Source/BsCCamera.cpp

@@ -3,7 +3,7 @@
 #include "BsCCamera.h"
 #include "BsCCameraRTTI.h"
 #include "BsSceneObject.h"
-#include "BsCoreSceneManager.h"
+#include "BsSceneManager.h"
 
 namespace bs 
 {
@@ -50,7 +50,7 @@ namespace bs
 	{
 		mInternal->setMain(main);
 
-		gCoreSceneManager()._notifyMainCameraStateChanged(mInternal);
+		gSceneManager()._notifyMainCameraStateChanged(mInternal);
 	}
 
 	void CCamera::update() 
@@ -70,12 +70,12 @@ namespace bs
 			mTarget = nullptr;
 		}
 
-		gCoreSceneManager()._registerCamera(mInternal, SO());
+		gSceneManager()._registerCamera(mInternal, SO());
 	}
 
 	void CCamera::onDestroyed()
 	{
-		gCoreSceneManager()._unregisterCamera(mInternal);
+		gSceneManager()._unregisterCamera(mInternal);
 	}
 
 	RTTITypeBase* CCamera::getRTTIStatic()

+ 0 - 0
Source/BansheeEngine/Source/BsCLight.cpp → Source/BansheeCore/Source/BsCLight.cpp


+ 0 - 0
Source/BansheeEngine/Source/BsCRenderable.cpp → Source/BansheeCore/Source/BsCRenderable.cpp


+ 1 - 1
Source/BansheeCore/Source/BsCamera.cpp

@@ -11,7 +11,7 @@
 #include "BsRenderAPI.h"
 #include "BsSceneObject.h"
 #include "BsRendererManager.h"
-#include "BsCoreRenderer.h"
+#include "BsRenderer.h"
 #include "BsFrameAlloc.h"
 
 namespace bs

+ 6 - 6
Source/BansheeCore/Source/BsCoreApplication.cpp

@@ -15,7 +15,7 @@
 #include "BsGameObjectManager.h"
 #include "BsDynLib.h"
 #include "BsDynLibManager.h"
-#include "BsCoreSceneManager.h"
+#include "BsSceneManager.h"
 #include "BsImporter.h"
 #include "BsResources.h"
 #include "BsMesh.h"
@@ -28,7 +28,7 @@
 #include "BsMaterialManager.h"
 #include "BsFontManager.h"
 #include "BsRenderWindowManager.h"
-#include "BsCoreRenderer.h"
+#include "BsRenderer.h"
 #include "BsDeferredCallManager.h"
 #include "BsCoreThread.h"
 #include "BsStringTableManager.h"
@@ -68,7 +68,7 @@ namespace bs
 		MeshManager::shutDown();
 		ProfilerGPU::shutDown();
 
-		CoreSceneManager::shutDown();
+		SceneManager::shutDown();
 		
 		Input::shutDown();
 
@@ -154,7 +154,7 @@ namespace bs
 
 		loadPlugin(mStartUpDesc.renderer, &mRendererPlugin);
 
-		SceneManagerFactory::create();
+		SceneManager::startUp();
 		RendererManager::instance().setActive(mStartUpDesc.renderer);
 		startUpRenderer();
 
@@ -224,7 +224,7 @@ namespace bs
 
 			preUpdate();
 
-			PROFILE_CALL(gCoreSceneManager()._update(), "SceneManager");
+			PROFILE_CALL(gSceneManager()._update(), "SceneManager");
 			gAudio()._update();
 			gPhysics().update();
 			AnimationManager::instance().postUpdate();
@@ -238,7 +238,7 @@ namespace bs
 			// Send out resource events in case any were loaded/destroyed/modified
 			ResourceListenerManager::instance().update();
 
-			gCoreSceneManager()._updateCoreObjectTransforms();
+			gSceneManager()._updateCoreObjectTransforms();
 			PROFILE_CALL(RendererManager::instance().getActive()->renderAll(), "Render");
 
 			// Core and sim thread run in lockstep. This will result in a larger input latency than if I was 

+ 1 - 17
Source/BansheeEngine/Source/BsLight.cpp → Source/BansheeCore/Source/BsLight.cpp

@@ -6,7 +6,6 @@
 #include "BsFrameAlloc.h"
 #include "BsSceneObject.h"
 #include "BsMesh.h"
-#include "BsRendererUtility.h"
 
 namespace bs
 {
@@ -311,19 +310,4 @@ namespace bs
 		}
 	}
 
-	SPtr<Mesh> Light::getMesh() const
-	{
-		switch (mType)
-		{
-		case LightType::Directional:
-			return nullptr;
-		case LightType::Point:
-			return RendererUtility::instance().getPointLightStencil();
-		case LightType::Spot:
-			return RendererUtility::instance().getSpotLightStencil();
-		}
-
-		return nullptr;
-	}
-	}
-}
+}}

+ 0 - 2
Source/BansheeEngine/Source/BsRenderable.cpp → Source/BansheeCore/Source/BsRenderable.cpp

@@ -3,10 +3,8 @@
 #include "BsRenderable.h"
 #include "BsRenderableRTTI.h"
 #include "BsSceneObject.h"
-#include "BsBuiltinResources.h"
 #include "BsMesh.h"
 #include "BsMaterial.h"
-#include "BsRenderQueue.h"
 #include "BsBounds.h"
 #include "BsRenderer.h"
 #include "BsAnimation.h"

+ 12 - 6
Source/BansheeCore/Source/BsCoreRenderer.cpp → Source/BansheeCore/Source/BsRenderer.cpp

@@ -1,31 +1,32 @@
 //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
 //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#include "BsCoreRenderer.h"
+#include "BsRenderer.h"
 #include "BsCoreThread.h"
 #include "BsRenderAPI.h"
 #include "BsMesh.h"
 #include "BsMaterial.h"
 #include "BsRendererExtension.h"
+#include "BsRendererManager.h"
 
 namespace bs { namespace ct
 {
-	CoreRenderer::CoreRenderer()
+	Renderer::Renderer()
 		:mCallbacks(&compareCallback)
 	{ }
 
-	SPtr<RendererMeshData> CoreRenderer::_createMeshData(UINT32 numVertices, UINT32 numIndices, VertexLayout layout, IndexType indexType)
+	SPtr<RendererMeshData> Renderer::_createMeshData(UINT32 numVertices, UINT32 numIndices, VertexLayout layout, IndexType indexType)
 	{
 		return bs_shared_ptr<RendererMeshData>(new (bs_alloc<RendererMeshData>()) 
 			RendererMeshData(numVertices, numIndices, layout, indexType));
 	}
 
-	SPtr<RendererMeshData> CoreRenderer::_createMeshData(const SPtr<MeshData>& meshData)
+	SPtr<RendererMeshData> Renderer::_createMeshData(const SPtr<MeshData>& meshData)
 	{
 		return bs_shared_ptr<RendererMeshData>(new (bs_alloc<RendererMeshData>())
 			RendererMeshData(meshData));
 	}
 
-	bool CoreRenderer::compareCallback(const RendererExtension* a, const RendererExtension* b)
+	bool Renderer::compareCallback(const RendererExtension* a, const RendererExtension* b)
 	{
 		// Sort by alpha setting first, then by cull mode, then by index
 		if (a->getLocation() == b->getLocation())
@@ -38,4 +39,9 @@ namespace bs { namespace ct
 		else
 			return (UINT32)a->getLocation() < (UINT32)b->getLocation();
 	}
-}}
+
+	SPtr<Renderer> gRenderer()
+	{
+		return std::static_pointer_cast<Renderer>(RendererManager::instance().getActive());
+	}
+}}

+ 1 - 1
Source/BansheeCore/Source/BsRendererExtension.cpp

@@ -3,7 +3,7 @@
 #include "BsRendererExtension.h"
 #include "BsCoreThread.h"
 #include "BsRendererManager.h"
-#include "BsCoreRenderer.h"
+#include "BsRenderer.h"
 
 namespace bs
 {

+ 2 - 2
Source/BansheeCore/Source/BsRendererManager.cpp

@@ -1,7 +1,7 @@
 //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
 //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
 #include "BsRendererManager.h"
-#include "BsCoreRenderer.h"
+#include "BsRenderer.h"
 #include "BsException.h"
 #include "BsRendererFactory.h"
 
@@ -19,7 +19,7 @@ namespace bs
 		{
 			if((*iter)->name() == name)
 			{
-				SPtr<ct::CoreRenderer> newRenderer = (*iter)->create();
+				SPtr<ct::Renderer> newRenderer = (*iter)->create();
 				if(newRenderer != nullptr)
 				{
 					if (mActiveRenderer != nullptr)

+ 1 - 1
Source/BansheeCore/Source/BsRendererMeshData.cpp

@@ -8,7 +8,7 @@
 #include "BsColor.h"
 #include "BsPixelUtil.h"
 #include "BsRendererManager.h"
-#include "BsCoreRenderer.h"
+#include "BsRenderer.h"
 #include "BsMeshUtility.h"
 
 namespace bs

+ 92 - 26
Source/BansheeCore/Source/BsCoreSceneManager.cpp → Source/BansheeCore/Source/BsSceneManager.cpp

@@ -1,29 +1,29 @@
 //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
 //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#include "BsCoreSceneManager.h"
+#include "BsSceneManager.h"
 #include "BsSceneObject.h"
 #include "BsComponent.h"
+#include "BsRenderable.h"
 #include "BsCamera.h"
+#include "BsLight.h"
 #include "BsViewport.h"
 #include "BsGameObjectManager.h"
 #include "BsRenderTarget.h"
 
 namespace bs
 {
-	std::function<void()> SceneManagerFactory::mFactoryMethod;
-
-	CoreSceneManager::CoreSceneManager()
+	SceneManager::SceneManager()
 	{
 		mRootNode = SceneObject::createInternal("SceneRoot");
 	}
 
-	CoreSceneManager::~CoreSceneManager()
+	SceneManager::~SceneManager()
 	{
 		if (mRootNode != nullptr && !mRootNode.isDestroyed())
 			mRootNode->destroy(true);
 	}
 
-	void CoreSceneManager::clearScene(bool forceAll)
+	void SceneManager::clearScene(bool forceAll)
 	{
 		UINT32 numChildren = mRootNode->getNumChildren();
 
@@ -44,7 +44,7 @@ namespace bs
 		_setRootNode(newRoot);
 	}
 
-	void CoreSceneManager::_setRootNode(const HSceneObject& root)
+	void SceneManager::_setRootNode(const HSceneObject& root)
 	{
 		if (root == nullptr)
 			return;
@@ -76,12 +76,32 @@ namespace bs
 		oldRoot->destroy();
 	}
 
-	void CoreSceneManager::_registerCamera(const SPtr<Camera>& camera, const HSceneObject& so)
+	void SceneManager::_registerRenderable(const SPtr<Renderable>& renderable, const HSceneObject& so)
+	{
+		mRenderables[renderable.get()] = SceneRenderableData(renderable, so);
+	}
+
+	void SceneManager::_unregisterRenderable(const SPtr<Renderable>& renderable)
+	{
+		mRenderables.erase(renderable.get());
+	}
+
+	void SceneManager::_registerLight(const SPtr<Light>& light, const HSceneObject& so)
+	{
+		mLights[light.get()] = SceneLightData(light, so);
+	}
+
+	void SceneManager::_unregisterLight(const SPtr<Light>& light)
+	{
+		mLights.erase(light.get());
+	}
+
+	void SceneManager::_registerCamera(const SPtr<Camera>& camera, const HSceneObject& so)
 	{
 		mCameras[camera.get()] = SceneCameraData(camera, so);
 	}
 
-	void CoreSceneManager::_unregisterCamera(const SPtr<Camera>& camera)
+	void SceneManager::_unregisterCamera(const SPtr<Camera>& camera)
 	{
 		mCameras.erase(camera.get());
 
@@ -95,7 +115,7 @@ namespace bs
 			mMainCameras.erase(iterFind);
 	}
 
-	void CoreSceneManager::_notifyMainCameraStateChanged(const SPtr<Camera>& camera)
+	void SceneManager::_notifyMainCameraStateChanged(const SPtr<Camera>& camera)
 	{
 		auto iterFind = std::find_if(mMainCameras.begin(), mMainCameras.end(),
 			[&](const SceneCameraData& entry)
@@ -121,7 +141,61 @@ namespace bs
 		}
 	}
 
-	SceneCameraData CoreSceneManager::getMainCamera() const
+	void SceneManager::_updateCoreObjectTransforms()
+	{
+		for (auto& renderablePair : mRenderables)
+		{
+			SPtr<Renderable> renderable = renderablePair.second.renderable;
+			HSceneObject so = renderablePair.second.sceneObject;
+
+			renderable->_updateTransform(so);
+
+			if (so->getActive() != renderable->getIsActive())
+				renderable->setIsActive(so->getActive());
+		}
+
+		for (auto& cameraPair : mCameras)
+		{
+			SPtr<Camera> handler = cameraPair.second.camera;
+			HSceneObject so = cameraPair.second.sceneObject;
+
+			UINT32 curHash = so->getTransformHash();
+			if (curHash != handler->_getLastModifiedHash())
+			{
+				handler->setPosition(so->getWorldPosition());
+				handler->setRotation(so->getWorldRotation());
+
+				handler->_setLastModifiedHash(curHash);
+			}
+
+			if (so->getActive() != handler->getIsActive())
+			{
+				handler->setIsActive(so->getActive());
+			}
+		}
+
+		for (auto& lightPair : mLights)
+		{
+			SPtr<Light> handler = lightPair.second.light;
+			HSceneObject so = lightPair.second.sceneObject;
+
+			UINT32 curHash = so->getTransformHash();
+			if (curHash != handler->_getLastModifiedHash())
+			{
+				handler->setPosition(so->getWorldPosition());
+				handler->setRotation(so->getWorldRotation());
+
+				handler->_setLastModifiedHash(curHash);
+			}
+
+			if (so->getActive() != handler->getIsActive())
+			{
+				handler->setIsActive(so->getActive());
+			}
+		}
+	}
+
+	SceneCameraData SceneManager::getMainCamera() const
 	{
 		if (mMainCameras.size() > 0)
 			return mMainCameras[0];
@@ -129,7 +203,7 @@ namespace bs
 		return SceneCameraData();
 	}
 
-	void CoreSceneManager::setMainRenderTarget(const SPtr<RenderTarget>& rt)
+	void SceneManager::setMainRenderTarget(const SPtr<RenderTarget>& rt)
 	{
 		if (mMainRT == rt)
 			return;
@@ -137,7 +211,7 @@ namespace bs
 		mMainRTResizedConn.disconnect();
 
 		if (rt != nullptr)
-			mMainRTResizedConn = rt->onResized.connect(std::bind(&CoreSceneManager::onMainRenderTargetResized, this));
+			mMainRTResizedConn = rt->onResized.connect(std::bind(&SceneManager::onMainRenderTargetResized, this));
 
 		mMainRT = rt;
 
@@ -155,7 +229,7 @@ namespace bs
 		}
 	}
 
-	void CoreSceneManager::_update()
+	void SceneManager::_update()
 	{
 		Stack<HSceneObject> todo;
 		todo.push(mRootNode);
@@ -182,13 +256,13 @@ namespace bs
 		GameObjectManager::instance().destroyQueuedObjects();
 	}
 
-	void CoreSceneManager::registerNewSO(const HSceneObject& node) 
+	void SceneManager::registerNewSO(const HSceneObject& node)
 	{ 
 		if(mRootNode)
 			node->setParent(mRootNode);
 	}
 
-	void CoreSceneManager::onMainRenderTargetResized()
+	void SceneManager::onMainRenderTargetResized()
 	{
 		auto& rtProps = mMainRT->getProperties();
 		float aspect = rtProps.getWidth() / (float)rtProps.getHeight();
@@ -197,16 +271,8 @@ namespace bs
 			entry.camera->setAspectRatio(aspect);
 	}
 
-	CoreSceneManager& gCoreSceneManager()
+	SceneManager& gSceneManager()
 	{
-		return CoreSceneManager::instance();
-	}
-
-	void SceneManagerFactory::create()
-	{
-		if (mFactoryMethod != nullptr)
-			mFactoryMethod();
-		else
-			BS_EXCEPT(InvalidStateException, "Failed to initialize scene manager because no valid factory method is set.");
+		return SceneManager::instance();
 	}
 }

+ 3 - 3
Source/BansheeCore/Source/BsSceneObject.cpp

@@ -2,7 +2,7 @@
 //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
 #include "BsSceneObject.h"
 #include "BsComponent.h"
-#include "BsCoreSceneManager.h"
+#include "BsSceneManager.h"
 #include "BsException.h"
 #include "BsDebug.h"
 #include "BsSceneObjectRTTI.h"
@@ -37,7 +37,7 @@ namespace bs
 		HSceneObject newObject = createInternal(name, flags);
 
 		if (newObject->isInstantiated())
-			gCoreSceneManager().registerNewSO(newObject);
+			gSceneManager().registerNewSO(newObject);
 
 		return newObject;
 	}
@@ -206,7 +206,7 @@ namespace bs
 			obj->mFlags &= ~SOF_DontInstantiate;
 
 			if (obj->mParent == nullptr)
-				gCoreSceneManager().registerNewSO(obj->mThisHandle);
+				gSceneManager().registerNewSO(obj->mThisHandle);
 
 			for (auto& component : obj->mComponents)
 				component->_instantiate();

+ 1 - 1
Source/BansheeCore/Source/BsTechnique.cpp

@@ -5,7 +5,7 @@
 #include "BsRenderAPI.h"
 #include "BsRendererManager.h"
 #include "BsPass.h"
-#include "BsCoreRenderer.h"
+#include "BsRenderer.h"
 #include "BsFrameAlloc.h"
 #include "BsTechniqueRTTI.h"
 

+ 1 - 1
Source/BansheeEditor/Source/BsDockManager.cpp

@@ -11,7 +11,7 @@
 #include "BsVector2.h"
 #include "BsCoreApplication.h"
 #include "BsRendererManager.h"
-#include "BsCoreRenderer.h"
+#include "BsRenderer.h"
 #include "BsSceneObject.h"
 #include "BsGUIManager.h"
 #include "BsBuiltinEditorResources.h"

+ 2 - 2
Source/BansheeEditor/Source/BsEditorApplication.cpp

@@ -25,7 +25,7 @@
 #include "BsImporter.h"
 #include "BsVirtualInput.h"
 #include "BsResources.h"
-#include "BsCoreSceneManager.h"
+#include "BsSceneManager.h"
 #include "BsSplashScreen.h"
 #include "BsDynLib.h"
 #include "BsSceneManager.h"
@@ -239,7 +239,7 @@ namespace bs
 		EditorWidgetManager::instance().closeAll();
 		gProjectLibrary().unloadLibrary();
 		Resources::instance().unloadAllUnused();
-		gCoreSceneManager().clearScene();
+		gSceneManager().clearScene();
 
 		mProjectPath = Path::BLANK;
 		mProjectName = StringUtil::WBLANK;

+ 1 - 1
Source/BansheeEditor/Source/BsGUISceneTreeView.cpp

@@ -252,7 +252,7 @@ namespace bs
 
 	void GUISceneTreeView::updateTreeElementHierarchy()
 	{
-		HSceneObject root = gCoreSceneManager().getRootNode();
+		HSceneObject root = gSceneManager().getRootNode();
 		mRootElement.mSceneObject = root;
 		mRootElement.mId = root->getInstanceId();
 		mRootElement.mSortedIdx = 0;

+ 1 - 1
Source/BansheeEditor/Source/BsGizmoManager.cpp

@@ -15,7 +15,7 @@
 #include "BsGpuParams.h"
 #include "BsGpuParamsSet.h"
 #include "BsRenderAPI.h"
-#include "BsCoreRenderer.h"
+#include "BsRenderer.h"
 #include "BsRendererUtility.h"
 #include "BsTransientMesh.h"
 #include "BsRendererManager.h"

+ 2 - 2
Source/BansheeEditor/Source/BsHandleDrawManager.cpp

@@ -7,7 +7,7 @@
 #include "BsBuiltinEditorResources.h"
 #include "BsCoreThread.h"
 #include "BsRendererManager.h"
-#include "BsCoreRenderer.h"
+#include "BsRenderer.h"
 #include "BsTransientMesh.h"
 #include "BsCamera.h"
 #include "BsRendererUtility.h"
@@ -251,7 +251,7 @@ namespace bs
 
 	void HandleRenderer::queueForDraw(const SPtr<Camera>& camera, Vector<MeshData>& meshes)
 	{
-		SPtr<CoreRenderer> activeRenderer = RendererManager::instance().getActive();
+		SPtr<Renderer> activeRenderer = RendererManager::instance().getActive();
 		if (camera != nullptr)
 		{
 			for(auto& entry : meshes)

+ 1 - 1
Source/BansheeEditor/Source/BsScenePicking.cpp

@@ -22,7 +22,7 @@
 #include "BsGpuParamsSet.h"
 #include "BsBuiltinEditorResources.h"
 #include "BsShader.h"
-#include "BsCoreRenderer.h"
+#include "BsRenderer.h"
 #include "BsGizmoManager.h"
 #include "BsRendererUtility.h"
 

+ 1 - 1
Source/BansheeEditor/Source/BsSelectionRenderer.cpp

@@ -10,7 +10,7 @@
 #include "BsGpuParams.h"
 #include "BsGpuParamsSet.h"
 #include "BsRenderAPI.h"
-#include "BsCoreRenderer.h"
+#include "BsRenderer.h"
 #include "BsRendererManager.h"
 #include "BsSelection.h"
 #include "BsSceneObject.h"

+ 0 - 32
Source/BansheeEngine/CMakeSources.cmake

@@ -1,10 +1,3 @@
-set(BS_BANSHEEENGINE_INC_COMPONENTS
-	"Include/BsCRenderable.h"
-	"Include/BsCLight.h"
-	"Include/BsCAnimation.h"
-	"Include/BsCBone.h"
-)
-
 set(BS_BANSHEEENGINE_SRC_RESOURCES
 	"Source/BsScriptCodeImportOptions.cpp"
 	"Source/BsScriptCodeImporter.cpp"
@@ -89,14 +82,10 @@ set(BS_BANSHEEENGINE_INC_PLATFORM
 )
 
 set(BS_BANSHEEENGINE_INC_RENDERER
-	"Include/BsLight.h"
-	"Include/BsRenderable.h"
 	"Include/BsRenderableElement.h"
-	"Include/BsRenderer.h"
 	"Include/BsRendererMaterial.h"
 	"Include/BsRendererMaterialManager.h"
 	"Include/BsRenderQueue.h"
-	"Include/BsSceneManager.h"
 	"Include/BsRendererUtility.h"
 	"Include/BsStandardPostProcessSettings.h"	
 )
@@ -142,15 +131,9 @@ set(BS_BANSHEEENGINE_INC_RTTI
 	"Include/BsGUIElementStyleRTTI.h"
 	"Include/BsGUISkinRTTI.h"
 	"Include/BsProfilerOverlayRTTI.h"
-	"Include/BsCRenderableRTTI.h"
-	"Include/BsCLightRTTI.h"
-	"Include/BsRenderableRTTI.h"
-	"Include/BsLightRTTI.h"
 	"Include/BsCGUIWidgetRTTI.h"
 	"Include/BsGameSettingsRTTI.h"
 	"Include/BsResourceMappingRTTI.h"
-	"Include/BsCAnimationRTTI.h"
-	"Include/BsCBoneRTTI.h"
 	"Include/BsStandardPostProcessSettingsRTTI.h"
 )
 
@@ -171,13 +154,6 @@ set(BS_BANSHEEENGINE_INC_RESOURCES
 	"Include/BsBuiltinResourcesHelper.h"
 )
 
-set(BS_BANSHEEENGINE_SRC_COMPONENTS
-	"Source/BsCRenderable.cpp"
-	"Source/BsCLight.cpp"
-	"Source/BsCAnimation.cpp"
-	"Source/BsCBone.cpp"
-)
-
 set(BS_BANSHEEENGINE_INC_SCRIPT
 	"Include/BsScriptManager.h"
 )
@@ -194,13 +170,9 @@ set(BS_BANSHEEENGINE_INC_UTILITY
 )
 
 set(BS_BANSHEEENGINE_SRC_RENDERER
-	"Source/BsLight.cpp"
-	"Source/BsRenderable.cpp"
-	"Source/BsRenderer.cpp"
 	"Source/BsRendererMaterial.cpp"
 	"Source/BsRendererMaterialManager.cpp"
 	"Source/BsRenderQueue.cpp"
-	"Source/BsSceneManager.cpp"
 	"Source/BsRendererUtility.cpp"
 	"Source/BsStandardPostProcessSettings.cpp"	
 )
@@ -279,7 +251,6 @@ set(BS_BANSHEEENGINE_SRC_PLATFORM
 	"Source/BsSplashScreen.cpp"
 )
 
-source_group("Header Files\\Components" FILES ${BS_BANSHEEENGINE_INC_COMPONENTS})
 source_group("Source Files\\Resources" FILES ${BS_BANSHEEENGINE_SRC_RESOURCES})
 source_group("Source Files\\Script" FILES ${BS_BANSHEEENGINE_SRC_SCRIPT})
 source_group("Header Files\\Input" FILES ${BS_BANSHEEENGINE_INC_INPUT})
@@ -293,7 +264,6 @@ source_group("Header Files\\2D" FILES ${BS_BANSHEEENGINE_INC_2D})
 source_group("Header Files\\RTTI" FILES ${BS_BANSHEEENGINE_INC_RTTI})
 source_group("Header Files" FILES ${BS_BANSHEEENGINE_INC_NOFILTER})
 source_group("Header Files\\Resources" FILES ${BS_BANSHEEENGINE_INC_RESOURCES})
-source_group("Source Files\\Components" FILES ${BS_BANSHEEENGINE_SRC_COMPONENTS})
 source_group("Header Files\\Script" FILES ${BS_BANSHEEENGINE_INC_SCRIPT})
 source_group("Header Files\\Utility" FILES ${BS_BANSHEEENGINE_INC_UTILITY})
 source_group("Source Files\\Renderer" FILES ${BS_BANSHEEENGINE_SRC_RENDERER})
@@ -303,7 +273,6 @@ source_group("Source Files" FILES ${BS_BANSHEEENGINE_SRC_NOFILTER})
 source_group("Source Files\\Platform" FILES ${BS_BANSHEEENGINE_SRC_PLATFORM})
 
 set(BS_BANSHEEENGINE_SRC
-	${BS_BANSHEEENGINE_INC_COMPONENTS}
 	${BS_BANSHEEENGINE_SRC_RESOURCES}
 	${BS_BANSHEEENGINE_SRC_SCRIPT}
 	${BS_BANSHEEENGINE_INC_INPUT}
@@ -317,7 +286,6 @@ set(BS_BANSHEEENGINE_SRC
 	${BS_BANSHEEENGINE_INC_RTTI}
 	${BS_BANSHEEENGINE_INC_NOFILTER}
 	${BS_BANSHEEENGINE_INC_RESOURCES}
-	${BS_BANSHEEENGINE_SRC_COMPONENTS}
 	${BS_BANSHEEENGINE_INC_SCRIPT}
 	${BS_BANSHEEENGINE_INC_UTILITY}
 	${BS_BANSHEEENGINE_SRC_RENDERER}

+ 4 - 23
Source/BansheeEngine/Include/BsPrerequisites.h

@@ -113,9 +113,6 @@
 
 namespace bs
 {
-	static const StringID RenderAPIDX9 = "D3D9RenderAPI";
-	static const StringID RenderAPIDX11 = "D3D11RenderAPI";
-	static const StringID RenderAPIOpenGL = "GLRenderAPI";
 	static const StringID RendererDefault = "RenderBeast";
 
 	class VirtualButton;
@@ -179,7 +176,6 @@ namespace bs
 	class ProfilerOverlay;
 	class ProfilerOverlayInternal;
 	class DrawHelper;
-	class Renderable;
 	class PlainText;
 	class ScriptCode;
 	class ScriptCodeImportOptions;
@@ -192,22 +188,7 @@ namespace bs
 	class SpriteMaterial;
 	struct SpriteMaterialInfo;
 
-	// Components
-	class CRenderable;
-	class CLight;
-	class CAnimation;
-	class CBone;
-
-	namespace ct
-	{
-		class Renderable;
-	}
-
 	typedef GameObjectHandle<CGUIWidget> HGUIWidget;
-	typedef GameObjectHandle<CRenderable> HRenderable;
-	typedef GameObjectHandle<CLight> HLight;
-	typedef GameObjectHandle<CAnimation> HAnimation;
-	typedef GameObjectHandle<CBone> HBone;
 	typedef GameObjectHandle<ProfilerOverlay> HProfilerOverlay;
 
 	typedef ResourceHandle<SpriteTexture> HSpriteTexture;
@@ -219,18 +200,18 @@ namespace bs
 	enum TypeID_Banshee
 	{
 		/* TID_CCamera = 30000, */
-		TID_CRenderable = 30001,
+		/* TID_CRenderable = 30001, */
 		TID_SpriteTexture = 30002,
 		/* TID_Camera = 30003, */
-		TID_Renderable = 30004,
+		/* TID_Renderable = 30004, */
 		TID_PlainText = 30005,
 		TID_ScriptCode = 30006,
 		TID_ScriptCodeImportOptions = 30007,
 		TID_GUIElementStyle = 30008,
 		TID_GUISkin = 30009,
 		TID_GUISkinEntry = 30010,
-		TID_Light = 30011,
-		TID_CLight = 30012,
+		/* TID_Light = 30011, */
+		/* TID_CLight = 30012, */
 		TID_GameSettings = 30013,
 		TID_ResourceMapping = 30014,
 		TID_StandardPostProcessSettings = 30015,

+ 0 - 67
Source/BansheeEngine/Include/BsRenderer.h

@@ -1,67 +0,0 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsPrerequisites.h"
-#include "BsCoreRenderer.h"
-
-namespace bs { namespace ct
-{
-	/** @addtogroup Renderer-Engine-Internal
-	 *  @{
-	 */
-
-	/** @copydoc CoreRenderer */
-	class BS_EXPORT Renderer : public CoreRenderer
-	{
-	public:
-		virtual ~Renderer() { }
-
-		/**
-		 * Called whenever a new renderable is created.
-		 *
-		 * @note	Core thread.
-		 */
-		virtual void notifyRenderableAdded(Renderable* renderable) { }
-
-		/**
-		 * Called whenever a renderable is updated.
-		 *
-		 * @note	Core thread.
-		 */
-		virtual void notifyRenderableUpdated(Renderable* renderable) { }
-
-		/**
-		 * Called whenever a renderable is destroyed.
-		 *
-		 * @note	Core thread.
-		 */
-		virtual void notifyRenderableRemoved(Renderable* renderable) { }
-
-		/**
-		 * Called whenever a new light is created.
-		 *
-		 * @note	Core thread.
-		 */
-		virtual void notifyLightAdded(Light* light) { }
-
-		/**
-		 * Called whenever a light is updated.
-		 *
-		 * @note	Core thread.
-		 */
-		virtual void notifyLightUpdated(Light* light) { }
-
-		/**
-		 * Called whenever a light is destroyed.
-		 *
-		 * @note	Core thread.
-		 */
-		virtual void notifyLightRemoved(Light* light) { }
-	};
-
-	/**	Provides easy access to Renderer. */
-	SPtr<Renderer> BS_EXPORT gRenderer();
-
-	/** @} */
-}}

+ 0 - 96
Source/BansheeEngine/Include/BsSceneManager.h

@@ -1,96 +0,0 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsPrerequisites.h"
-#include "BsCoreSceneManager.h"
-
-namespace bs
-{
-	/** @addtogroup Renderer-Engine-Internal
-	 *  @{
-	 */
-
-	/**	Contains information about a renderable managed by the scene manager. */
-	struct SceneRenderableData
-	{
-		SceneRenderableData() { }
-
-		SceneRenderableData(const SPtr<Renderable>& renderable, const HSceneObject& sceneObject)
-			:renderable(renderable), sceneObject(sceneObject)
-		{ }
-
-		SPtr<Renderable> renderable;
-		HSceneObject sceneObject;
-	};
-
-	/**	Contains information about a light managed by the scene manager. */
-	struct SceneLightData
-	{
-		SceneLightData() { }
-
-		SceneLightData(const SPtr<Light>& light, const HSceneObject& sceneObject)
-			:light(light), sceneObject(sceneObject)
-		{ }
-
-		SPtr<Light> light;
-		HSceneObject sceneObject;
-	};
-
-	/** Manages active SceneObjects and provides ways for querying and updating them or their components. */
-	class BS_EXPORT SceneManager : public CoreSceneManager
-	{
-	public:
-		struct InitOnStart
-		{
-		public:
-			InitOnStart()
-			{
-				SceneManagerFactory::setFactoryMethod(&startUp);
-			}
-
-			static void startUp()
-			{
-				CoreSceneManager::startUp<SceneManager>();
-			}
-		};
-
-		SceneManager() { }
-		virtual ~SceneManager() {}
-
-		/**	Returns all renderables in the scene. */
-		const Map<Renderable*, SceneRenderableData>& getAllRenderables() const { return mRenderables; }
-
-		/** Notifies the scene manager that a new renderable was created. */
-		void _registerRenderable(const SPtr<Renderable>& renderable, const HSceneObject& so);
-
-		/**	Notifies the scene manager that a renderable was removed. */
-		void _unregisterRenderable(const SPtr<Renderable>& renderable);
-
-		/**	Notifies the scene manager that a new light was created. */
-		void _registerLight(const SPtr<Light>& light, const HSceneObject& so);
-
-		/**	Notifies the scene manager that a light was removed. */
-		void _unregisterLight(const SPtr<Light>& light);
-
-		/** @copydoc CoreSceneManager::_updateCoreObjectTransforms */
-		void _updateCoreObjectTransforms() override;
-
-		/** @copydoc CoreSceneManager::instance */
-		static SceneManager& instance();
-
-		/** @copydoc CoreSceneManager::instancePtr */
-		static SceneManager* instancePtr();
-
-	private:
-		Map<Renderable*, SceneRenderableData> mRenderables;
-		Map<Light*, SceneLightData> mLights;
-
-		volatile static InitOnStart DoInitOnStart;
-	};
-
-	/** Provides easier access to SceneManager. */
-	BS_EXPORT SceneManager& gSceneManager();
-
-	/** @} */
-}

+ 0 - 12
Source/BansheeEngine/Source/BsRenderer.cpp

@@ -1,12 +0,0 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#include "BsRenderer.h"
-#include "BsRendererManager.h"
-
-namespace bs { namespace ct
-{
-	SPtr<Renderer> gRenderer()
-	{
-		return std::static_pointer_cast<Renderer>(RendererManager::instance().getActive());
-	}
-}}

+ 0 - 101
Source/BansheeEngine/Source/BsSceneManager.cpp

@@ -1,101 +0,0 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#include "BsSceneManager.h"
-#include "BsSceneObject.h"
-#include "BsRenderable.h"
-#include "BsCamera.h"
-#include "BsLight.h"
-
-namespace bs
-{
-	volatile SceneManager::InitOnStart SceneManager::DoInitOnStart;
-
-	void SceneManager::_registerRenderable(const SPtr<Renderable>& renderable, const HSceneObject& so)
-	{
-		mRenderables[renderable.get()] = SceneRenderableData(renderable, so);
-	}
-
-	void SceneManager::_unregisterRenderable(const SPtr<Renderable>& renderable)
-	{
-		mRenderables.erase(renderable.get());
-	}
-
-	void SceneManager::_registerLight(const SPtr<Light>& light, const HSceneObject& so)
-	{
-		mLights[light.get()] = SceneLightData(light, so);
-	}
-
-	void SceneManager::_unregisterLight(const SPtr<Light>& light)
-	{
-		mLights.erase(light.get());
-	}
-
-	void SceneManager::_updateCoreObjectTransforms()
-	{
-		for (auto& renderablePair : mRenderables)
-		{
-			SPtr<Renderable> renderable = renderablePair.second.renderable;
-			HSceneObject so = renderablePair.second.sceneObject;
-
-			renderable->_updateTransform(so);
-
-			if (so->getActive() != renderable->getIsActive())
-				renderable->setIsActive(so->getActive());
-		}
-
-		for (auto& cameraPair : mCameras)
-		{
-			SPtr<Camera> handler = cameraPair.second.camera;
-			HSceneObject so = cameraPair.second.sceneObject;
-
-			UINT32 curHash = so->getTransformHash();
-			if (curHash != handler->_getLastModifiedHash())
-			{
-				handler->setPosition(so->getWorldPosition());
-				handler->setRotation(so->getWorldRotation());
-
-				handler->_setLastModifiedHash(curHash);
-			}
-
-			if (so->getActive() != handler->getIsActive())
-			{
-				handler->setIsActive(so->getActive());
-			}
-		}
-
-		for (auto& lightPair : mLights)
-		{
-			SPtr<Light> handler = lightPair.second.light;
-			HSceneObject so = lightPair.second.sceneObject;
-
-			UINT32 curHash = so->getTransformHash();
-			if (curHash != handler->_getLastModifiedHash())
-			{
-				handler->setPosition(so->getWorldPosition());
-				handler->setRotation(so->getWorldRotation());
-
-				handler->_setLastModifiedHash(curHash);
-			}
-
-			if (so->getActive() != handler->getIsActive())
-			{
-				handler->setIsActive(so->getActive());
-			}
-		}
-	}
-
-	SceneManager& SceneManager::instance()
-	{
-		return static_cast<SceneManager&>(CoreSceneManager::instance());
-	}
-
-	SceneManager* SceneManager::instancePtr()
-	{
-		return static_cast<SceneManager*>(CoreSceneManager::instancePtr());
-	}
-
-	SceneManager& gSceneManager()
-	{
-		return static_cast<SceneManager&>(gCoreSceneManager());
-	}
-}

+ 2 - 2
Source/RenderBeast/Include/BsRenderBeast.h

@@ -75,10 +75,10 @@ namespace bs
 		void renderAll() override;
 
 		/**	Sets options used for controlling the rendering. */
-		void setOptions(const SPtr<CoreRendererOptions>& options) override;
+		void setOptions(const SPtr<RendererOptions>& options) override;
 
 		/**	Returns current set of options used for controlling the rendering. */
-		SPtr<CoreRendererOptions> getOptions() const override;
+		SPtr<RendererOptions> getOptions() const override;
 
 		/** @copydoc Renderer::initialize */
 		void initialize() override;

+ 1 - 1
Source/RenderBeast/Include/BsRenderBeastFactory.h

@@ -21,7 +21,7 @@ namespace bs
 	{
 	public:
 		/** @copydoc RendererFactory::create */
-		SPtr<ct::CoreRenderer> create() override;
+		SPtr<ct::Renderer> create() override;
 
 		/** @copydoc RendererFactory::name */
 		const String& name() const override;

+ 1 - 1
Source/RenderBeast/Include/BsRenderBeastOptions.h

@@ -21,7 +21,7 @@ namespace bs { namespace ct
 	};
 
 	/** A set of options used for controlling the rendering of the RenderBeast renderer. */
-	struct BS_BSRND_EXPORT RenderBeastOptions : public CoreRendererOptions
+	struct BS_BSRND_EXPORT RenderBeastOptions : public RendererOptions
 	{
 		RenderBeastOptions() { }
 

+ 4 - 4
Source/RenderBeast/Source/BsRenderBeast.cpp

@@ -53,14 +53,14 @@ namespace bs { namespace ct
 
 	void RenderBeast::initialize()
 	{
-		CoreRenderer::initialize();
+		Renderer::initialize();
 
 		gCoreThread().queueCommand(std::bind(&RenderBeast::initializeCore, this), CTQF_InternalQueue);
 	}
 
 	void RenderBeast::destroy()
 	{
-		CoreRenderer::destroy();
+		Renderer::destroy();
 
 		gCoreThread().queueCommand(std::bind(&RenderBeast::destroyCore, this));
 		gCoreThread().submit(true);
@@ -606,13 +606,13 @@ namespace bs { namespace ct
 		return output;
 	}
 
-	void RenderBeast::setOptions(const SPtr<CoreRendererOptions>& options)
+	void RenderBeast::setOptions(const SPtr<RendererOptions>& options)
 	{
 		mOptions = std::static_pointer_cast<RenderBeastOptions>(options);
 		mOptionsDirty = true;
 	}
 
-	SPtr<CoreRendererOptions> RenderBeast::getOptions() const
+	SPtr<RendererOptions> RenderBeast::getOptions() const
 	{
 		return mOptions;
 	}

+ 1 - 1
Source/RenderBeast/Source/BsRenderBeastFactory.cpp

@@ -8,7 +8,7 @@ namespace bs
 {
 	const char* SystemName = "RenderBeast";
 
-	SPtr<ct::CoreRenderer> RenderBeastFactory::create()
+	SPtr<ct::Renderer> RenderBeastFactory::create()
 	{
 		return bs_shared_ptr_new<ct::RenderBeast>();
 	}