Преглед изворни кода

Bugfix: Fixing Light and Renderable component use in the editor

BearishSun пре 8 година
родитељ
комит
2cd33e4e53

+ 8 - 8
Source/BansheeCore/Components/BsCLight.h

@@ -21,7 +21,7 @@ namespace bs
 	{
 	public:
 		CLight(const HSceneObject& parent, LightType type = LightType::Radial, Color color = Color::White, 
-			float intensity = 100.0f, float range = 1.0f, bool castsShadows = false, Degree spotAngle = Degree(45), 
+			float intensity = 10000.0f, float range = 1.0f, bool castsShadows = false, Degree spotAngle = Degree(45), 
 			Degree spotFalloffAngle = Degree(40));
 
 		virtual ~CLight();
@@ -123,13 +123,13 @@ namespace bs
 		mutable SPtr<Light> mInternal;
 
 		// Only valid during construction
-		LightType mType;
-		Color mColor;
-		float mIntensity; 
-		float mRange; 
-		bool mCastsShadows; 
-		Degree mSpotAngle; 
-		Degree mSpotFalloffAngle;
+		LightType mType = LightType::Radial;
+		Color mColor = Color::White;
+		float mIntensity = 10000.0f;
+		float mRange = 1.0f;
+		bool mCastsShadows = false; 
+		Degree mSpotAngle = Degree(45); 
+		Degree mSpotFalloffAngle = Degree(40);
 
 		/************************************************************************/
 		/* 						COMPONENT OVERRIDES                      		*/

+ 1 - 1
Source/BansheeCore/Renderer/BsLight.cpp

@@ -11,7 +11,7 @@ namespace bs
 {
 	LightBase::LightBase()
 		: mType(LightType::Radial), mCastsShadows(false), mColor(Color::White), mAttRadius(10.0f), mSourceRadius(0.0f)
-		, mIntensity(5.0f), mSpotAngle(45), mSpotFalloffAngle(35.0f), mAutoAttenuation(true), mShadowBias(0.5f)
+		, mIntensity(10000.0f), mSpotAngle(45), mSpotFalloffAngle(35.0f), mAutoAttenuation(true), mShadowBias(0.5f)
 	{
 		updateAttenuationRange();
 	}

+ 1 - 1
Source/BansheeCore/Renderer/BsLight.h

@@ -194,7 +194,7 @@ namespace bs
 		 * @param[in]	spotFalloffAngle	Spot light angle at which falloff starts. Must be smaller than total angle.
 		 */
 		static SPtr<Light> create(LightType type = LightType::Radial, Color color = Color::White,
-			float intensity = 100.0f, float attRadius = 10.0f, bool castsShadows = false,
+			float intensity = 10000.0f, float attRadius = 10.0f, bool castsShadows = false,
 			Degree spotAngle = Degree(45), Degree spotFalloffAngle = Degree(40));
 
 	protected:

+ 10 - 0
Source/BansheeCore/Renderer/BsRenderable.cpp

@@ -143,6 +143,16 @@ namespace bs
 	template class TRenderable < false >;
 	template class TRenderable < true >;
 
+	void Renderable::initialize()
+	{
+		CoreObject::initialize();		
+
+		// Since we don't pass any information along to the core thread object on its construction, make sure the data
+		// sync executes
+		_markCoreDirty();
+	}
+
+
 	void Renderable::setAnimation(const SPtr<Animation>& animation)
 	{
 		mAnimation = animation;

+ 3 - 0
Source/BansheeCore/Renderer/BsRenderable.h

@@ -170,6 +170,9 @@ namespace bs
 		/** @copydoc SceneActor::_updateState */
 		void _updateState(const SceneObject& so, bool force = false) override;
 
+		/** @copydoc CoreObject::initialize() */
+		void initialize() override;
+
 		/** @} */
 	protected:
 		/** @copydoc CoreObject::createCore */

+ 1 - 1
Source/RenderBeast/BsRendererTextures.cpp

@@ -182,7 +182,7 @@ namespace bs { namespace ct
 		dummySkyDesc.height = 2;
 
 		// Note: Eventually replace this with a time of day model
-		float intensity = 10.0f;
+		float intensity = 1.0f;
 		Color skyColor = Color::White * intensity;
 		SPtr<Texture> skyTexture = Texture::create(dummySkyDesc);