Browse Source

Making 'LightComponent into a SystemObject;
Code refactoring

Paul A 4 years ago
parent
commit
7a25e70c07

+ 3 - 0
.gitignore

@@ -25,3 +25,6 @@ VC/
 *.db-shm
 *.db-wal
 *.opendb
+*.obj
+*.log
+*.pdb

BIN
.vs/Praxis3D/v16/.suo


+ 1 - 0
Praxis3D/Praxis3D.vcxproj

@@ -382,6 +382,7 @@
     <ClInclude Include="Source\Filesystem.h" />
     <ClInclude Include="Source\FinalPass.h" />
     <ClInclude Include="Source\Framebuffer.h" />
+    <ClInclude Include="Source\GameLogicObject.h" />
     <ClInclude Include="Source\GameObject.h" />
     <ClInclude Include="Source\GeometryBuffer.h" />
     <ClInclude Include="Source\GeometryPass.h" />

+ 3 - 0
Praxis3D/Praxis3D.vcxproj.filters

@@ -605,6 +605,9 @@
     <ClInclude Include="Source\LightComponent.h">
       <Filter>Renderer\Objects\Header Files</Filter>
     </ClInclude>
+    <ClInclude Include="Source\GameLogicObject.h">
+      <Filter>Scripting\Objects\Header Files</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <None Include="Data\config.ini" />

+ 1 - 1
Praxis3D/Source/BaseGraphicsComponent.h

@@ -14,7 +14,7 @@ public:
 	~BaseGraphicsComponent() { }
 
 	virtual void load(PropertySet &p_properties) { }
-	virtual PropertySet export() { return PropertySet(); }
+	virtual PropertySet exportObject() { return PropertySet(); }
 
 	virtual void update(GraphicsObject &p_parentObject);
 	

+ 2 - 2
Praxis3D/Source/BaseGraphicsObjects.h

@@ -47,9 +47,9 @@ public:
 			m_needsUpdate = true;
 		}
 
-		if(p_changeType & Systems::Changes::Spatial::WorldModelMatrix)
+		if(p_changeType & Systems::Changes::Spatial::WorldTransform)
 		{
-			m_baseObjectData.m_modelMat = p_subject->getMat4(this, Systems::Changes::Spatial::WorldModelMatrix);
+			m_baseObjectData.m_modelMat = p_subject->getMat4(this, Systems::Changes::Spatial::WorldTransform);
 			m_needsUpdate = true;
 		}
 

+ 1 - 1
Praxis3D/Source/CameraComponent.h

@@ -14,7 +14,7 @@ public:
 
 	}
 
-	PropertySet export() final override
+	PropertySet exportObject() final override
 	{ 
 		return PropertySet(); 
 	}

+ 3 - 3
Praxis3D/Source/EnvironmentMapObjects.h

@@ -43,7 +43,7 @@ public:
 	{
 		// Create the root property set
 		PropertySet propertySet(Properties::ArrayEntry);
-
+		/*
 		// Add variables
 		propertySet.addProperty(Properties::Type, Properties::EnvironmentMapObject);
 		propertySet.addProperty(Properties::Position, m_baseObjectData.m_position);
@@ -54,7 +54,7 @@ public:
 			auto &materialEntry = propertySet.addPropertySet(Properties::ArrayEntry);
 			materialEntry.addProperty(Properties::Filename, m_cubemap.getFaceFilename(face));
 		}
-
+		*/
 		return propertySet;
 	}
 
@@ -72,7 +72,7 @@ public:
 
 	BitMask getSystemType() { return Systems::Graphics; }
 
-	virtual BitMask getDesiredSystemChanges() { return Systems::Changes::Spacial::All; }
+	virtual BitMask getDesiredSystemChanges() { return Systems::Changes::Spatial::All; }
 	virtual BitMask getPotentialSystemChanges() { return Systems::Changes::None; }
 	
 protected:

+ 63 - 0
Praxis3D/Source/GameLogicObject.h

@@ -0,0 +1,63 @@
+#pragma once
+
+#include "Containers.h"
+#include "Math.h"
+#include "NullSystemObjects.h"
+#include "System.h"
+
+class GameLogicObject : public SystemObject
+{
+public:
+	GameLogicObject(SystemScene *p_systemScene, const std::string &p_name)
+		: SystemObject(p_systemScene, p_name, Properties::Scripting)
+	{
+
+
+	}
+
+	~GameLogicObject()
+	{
+
+	}
+
+	// System type is Graphics
+	BitMask getSystemType() { return Systems::Scripting; }
+
+	void update(const float p_deltaTime)
+	{
+		if(isUpdateNeeded())
+		{
+			// Mark as updated
+			updatePerformed();
+		}
+	}
+
+	virtual BitMask getDesiredSystemChanges() { return Systems::Changes::Spatial::AllWorld | Systems::Changes::Graphics::All; }
+	virtual BitMask getPotentialSystemChanges() { return Systems::Changes::Spatial::WorldTransform; }
+
+	virtual void changeOccurred(ObservedSubject *p_subject, BitMask p_changeType)
+	{
+		// Track what data has been modified
+		BitMask newChanges = Systems::Changes::None;
+
+		// Get all of the world spatial data, include the transform matrix; add up the bit-mask of changed data;
+		if(p_changeType & Systems::Changes::Spatial::AllWorld)
+		{
+			newChanges = newChanges | Systems::Changes::Spatial::AllWorld;
+		}
+		else
+		{
+			setUpdateNeeded(true);
+		}
+
+		// If any new data has been left, pass it to the components
+		if(newChanges != Systems::Changes::None)
+		{
+
+		}
+		//postChanges(newChanges);
+	}
+
+private:
+
+};

+ 6 - 6
Praxis3D/Source/GameObject.h

@@ -44,16 +44,16 @@ public:
 	{
 		BitMask newChanges = Systems::Changes::None;
 
-		if(p_changeType & Systems::Changes::Spatial::Local)
+		if(p_changeType & Systems::Changes::Spatial::AllLocal)
 		{
-			m_localSpace = p_subject->getSpatialData(this, Systems::Changes::Spatial::Local);
-			newChanges = newChanges | Systems::Changes::Spatial::Local;
+			m_localSpace = p_subject->getSpatialData(this, Systems::Changes::Spatial::AllLocalNoTransform);
+			newChanges = newChanges | Systems::Changes::Spatial::AllLocalNoTransform;
 		}
 
-		if(p_changeType & Systems::Changes::Spatial::World)
+		if(p_changeType & Systems::Changes::Spatial::AllWorld)
 		{
-			m_worldSpace = p_subject->getSpatialData(this, Systems::Changes::Spatial::World);
-			newChanges = newChanges | Systems::Changes::Spatial::World;
+			m_worldSpace = p_subject->getSpatialData(this, Systems::Changes::Spatial::AllWorldNoTransform);
+			newChanges = newChanges | Systems::Changes::Spatial::AllWorldNoTransform;
 		}
 		
 		if(newChanges != Systems::Changes::None)

+ 99 - 9
Praxis3D/Source/LightComponent.h

@@ -5,7 +5,7 @@
 #include "ObserverBase.h"
 #include "System.h"
 
-class LightComponent
+class LightComponent : public SystemObject
 {
 public:
 	enum LightComponentType
@@ -15,22 +15,44 @@ public:
 		LightComponentType_spot
 	};
 
-	LightComponent(DirectionalLightDataSet &p_lightDataSet)
+	LightComponent(SystemScene *p_systemScene, std::string p_name, SceneLoader &p_sceneLoader, DirectionalLightDataSet &p_lightDataSet, std::size_t p_id = 0)
 	{
 		m_lightComponentType = LightComponentType::LightComponentType_directional;
 		m_lightComponent.m_directional = p_lightDataSet;
 	}
-	LightComponent(PointLightDataSet &p_lightDataSet)
+	LightComponent(SystemScene *p_systemScene, std::string p_name, SceneLoader &p_sceneLoader, PointLightDataSet &p_lightDataSet, std::size_t p_id = 0)
 	{
 		m_lightComponentType = LightComponentType::LightComponentType_point;
 		m_lightComponent.m_point = p_lightDataSet;
 	}
-	LightComponent(SpotLightDataSet &p_lightDataSet)
+	LightComponent(SystemScene *p_systemScene, std::string p_name, SceneLoader &p_sceneLoader, SpotLightDataSet &p_lightDataSet, std::size_t p_id = 0)
 	{
 		m_lightComponentType = LightComponentType::LightComponentType_spot;
 		m_lightComponent.m_spot = p_lightDataSet;
 	}
 
+	ErrorCode init()
+	{
+		return ErrorCode::Success;
+	}
+
+	void loadToMemory() { }
+
+	// System type is Graphics
+	BitMask getSystemType() { return Systems::Graphics; }
+
+	void update(const float p_deltaTime)
+	{
+		if(isUpdateNeeded())
+		{
+			// Mark as updated
+			updatePerformed();
+		}
+	}
+
+	BitMask getDesiredSystemChanges() { return Systems::Changes::Spatial::AllWorld | Systems::Changes::Graphics::All; }
+	BitMask getPotentialSystemChanges() { return Systems::Changes::Spatial::WorldTransform; }
+
 	~LightComponent() 
 	{
 		// Nothing to delete so far
@@ -45,23 +67,91 @@ public:
 		}
 	}
 
-	void updateSpatialData(SpatialTransformData &p_data)
+	void updateSpatialData(const SpatialData &p_data)
 	{
 		// Update each type of light individually, as their spatial data is made up of different attributes
 		switch(m_lightComponentType)
 		{
 		case LightComponent::LightComponentType_directional:
-			m_lightComponent.m_directional.m_direction = p_data.m_spatialData.m_rotationEuler;
+			m_lightComponent.m_directional.m_direction = p_data.m_rotationEuler;
 			break;
 		case LightComponent::LightComponentType_point:
-			m_lightComponent.m_point.m_position = p_data.m_spatialData.m_position;
+			m_lightComponent.m_point.m_position = p_data.m_position;
+			break;
+		case LightComponent::LightComponentType_spot:
+			m_lightComponent.m_spot.m_position = p_data.m_position;
+			m_lightComponent.m_spot.m_direction = p_data.m_rotationEuler;
+			break;
+		}
+	}
+	void updatePosition(const Math::Vec3f &p_position)
+	{
+		// Update each type of light individually, as their spatial data is made up of different attributes
+		switch(m_lightComponentType)
+		{
+		case LightComponent::LightComponentType_point:
+			m_lightComponent.m_point.m_position = p_position;
 			break;
 		case LightComponent::LightComponentType_spot:
-			m_lightComponent.m_spot.m_position = p_data.m_spatialData.m_position;
-			m_lightComponent.m_spot.m_direction = p_data.m_spatialData.m_rotationEuler;
+			m_lightComponent.m_spot.m_position = p_position;
 			break;
 		}
 	}
+	void updateRotation(const Math::Vec3f &p_rotation)
+	{
+		// Update each type of light individually, as their spatial data is made up of different attributes
+		switch(m_lightComponentType)
+		{
+		case LightComponent::LightComponentType_directional:
+			m_lightComponent.m_directional.m_direction = p_rotation;
+			break;
+		case LightComponent::LightComponentType_spot:
+			m_lightComponent.m_spot.m_direction = p_rotation;
+			break;
+		}
+	}
+
+	virtual void changeOccurred(ObservedSubject *p_subject, BitMask p_changeType)
+	{
+		// Track what data has been modified
+		BitMask newChanges = Systems::Changes::None;
+
+		// Get all of the world spatial data, include the transform matrix; add up the bit-mask of changed data;
+		if(p_changeType & Systems::Changes::Spatial::AllWorld)
+		{
+			updateSpatialData(p_subject->getSpatialData(this, Systems::Changes::Spatial::AllWorldNoTransform));
+			newChanges = newChanges | Systems::Changes::Spatial::AllWorld;
+		}
+		else
+		{
+			// Get world spatial data without transform matrix; add up the bit-mask of changed data; flag object to need updating
+			if(p_changeType & Systems::Changes::Spatial::AllWorldNoTransform)
+			{
+				setUpdateNeeded(true);
+				newChanges = newChanges | Systems::Changes::Spatial::AllWorldNoTransform;
+			}
+			else
+			{
+				// Get world position vector; add up the bit-mask of changed data; flag object to need updating
+				if(p_changeType & Systems::Changes::Spatial::WorldPosition)
+				{
+					updatePosition(p_subject->getVec3(this, Systems::Changes::Spatial::WorldPosition));
+					newChanges = newChanges | Systems::Changes::Spatial::WorldPosition;
+
+					setUpdateNeeded(true);
+				}
+
+				// Get world rotation vector; add up the bit-mask of changed data; flag object to need updating; flag rotation quaternion to need updating
+				if(p_changeType & Systems::Changes::Spatial::WorldRotation)
+				{
+					updateRotation(p_subject->getVec3(this, Systems::Changes::Spatial::WorldRotation));
+					newChanges = newChanges | Systems::Changes::Spatial::WorldRotation;
+
+					setUpdateNeeded(true);
+				}
+			}
+		}
+	}
 
 	LightComponentType getLightType() { return m_lightComponentType; }
 

+ 24 - 23
Praxis3D/Source/LightingGraphicsObjects.h

@@ -1,5 +1,6 @@
 #pragma once
 
+#include <assert.h>
 #include "GraphicsDataSets.h"
 #include "System.h"
 
@@ -45,16 +46,16 @@ public:
 
 	BitMask getSystemType() { return Systems::Graphics; }
 
-	BitMask getDesiredSystemChanges()	{ return Systems::Changes::Spacial::Rotation; }
-	BitMask getPotentialSystemChanges() { return Systems::Changes::Spacial::Rotation; }
+	BitMask getDesiredSystemChanges()	{ return Systems::Changes::Spatial::LocalRotation; }
+	BitMask getPotentialSystemChanges() { return Systems::Changes::Spatial::LocalRotation; }
 
 	// Processes any spacial changes
 	virtual void changeOccurred(ObservedSubject *p_subject, BitMask p_changeType)
 	{
-		if(p_changeType & Systems::Changes::Spacial::Rotation)
+		if(p_changeType & Systems::Changes::Spatial::LocalRotation)
 		{
 			m_lightDataSet.m_direction =
-				p_subject->getVec3(this, Systems::Changes::Spacial::Rotation);
+				p_subject->getVec3(this, Systems::Changes::Spatial::LocalRotation);
 
 			postChanges(p_changeType);
 		}
@@ -64,7 +65,7 @@ public:
 	{
 		switch(p_changedBits)
 		{
-		case Systems::Changes::Spacial::Rotation:
+		case Systems::Changes::Spatial::LocalRotation:
 			return m_lightDataSet.m_direction;
 			break;
 		}
@@ -122,23 +123,23 @@ public:
 		propertySet.addProperty(Properties::Color, m_lightDataSet.m_color);
 		propertySet.addProperty(Properties::Intensity, m_lightDataSet.m_intensity);
 		propertySet.addProperty(Properties::OffsetPosition, m_offsetPosition);
-		propertySet.addProperty(Properties::Position, m_lightDataSet.m_position);
+		propertySet.addProperty(Properties::LocalPosition, m_lightDataSet.m_position);
 
 		return propertySet;
 	}
 
 	BitMask getSystemType() { return Systems::Graphics; }
 
-	BitMask getDesiredSystemChanges() { return Systems::Changes::Spacial::Position; }
-	BitMask getPotentialSystemChanges() { return Systems::Changes::Spacial::Position; }
+	BitMask getDesiredSystemChanges() { return Systems::Changes::Spatial::Position; }
+	BitMask getPotentialSystemChanges() { return Systems::Changes::Spatial::Position; }
 
 	// Processes any spacial changes
 	virtual void changeOccurred(ObservedSubject *p_subject, BitMask p_changeType)
 	{
-		if(p_changeType & Systems::Changes::Spacial::Position)
+		if(p_changeType & Systems::Changes::Spatial::LocalPosition)
 		{
 			m_lightDataSet.m_position =
-				p_subject->getVec3(this, Systems::Changes::Spacial::Position) + m_offsetPosition;
+				p_subject->getVec3(this, Systems::Changes::Spatial::LocalPosition) + m_offsetPosition;
 
 			postChanges(p_changeType);
 		}
@@ -148,7 +149,7 @@ public:
 	{
 		switch(p_changedBits)
 		{
-		case Systems::Changes::Spacial::Position:
+		case Systems::Changes::Spatial::LocalPosition:
 			return m_lightDataSet.m_position;
 			break;
 		}
@@ -215,34 +216,34 @@ public:
 		propertySet.addProperty(Properties::Intensity, m_lightDataSet.m_intensity);
 		propertySet.addProperty(Properties::OffsetPosition, m_offsetPosition);
 		propertySet.addProperty(Properties::OffsetRotation, m_offsetRotation);
-		propertySet.addProperty(Properties::Position, m_lightDataSet.m_position);
+		propertySet.addProperty(Properties::LocalPosition, m_lightDataSet.m_position);
 
 		return propertySet;
 	}
 
 	BitMask getSystemType() { return Systems::Graphics; }
 
-	BitMask getDesiredSystemChanges() { return Systems::Changes::Spacial::All; }
-	BitMask getPotentialSystemChanges() { return Systems::Changes::Spacial::All; }
+	BitMask getDesiredSystemChanges() { return Systems::Changes::Spatial::All; }
+	BitMask getPotentialSystemChanges() { return Systems::Changes::Spatial::All; }
 
 	// Processes any spacial changes
 	virtual void changeOccurred(ObservedSubject *p_subject, BitMask p_changeType)
 	{
 		BitMask relevantChanges = 0;
-		if(p_changeType & Systems::Changes::Spacial::Position)
+		if(p_changeType & Systems::Changes::Spatial::LocalPosition)
 		{
 			m_lightDataSet.m_position =
-				p_subject->getVec3(this, Systems::Changes::Spacial::Position) + m_offsetPosition;
+				p_subject->getVec3(this, Systems::Changes::Spatial::LocalPosition) + m_offsetPosition;
 
-			relevantChanges |= Systems::Changes::Spacial::Position;
+			relevantChanges |= Systems::Changes::Spatial::LocalPosition;
 		}
 
-		if(p_changeType & Systems::Changes::Spacial::Rotation)
+		if(p_changeType & Systems::Changes::Spatial::LocalRotation)
 		{
 			m_lightDataSet.m_direction =
-				p_subject->getVec3(this, Systems::Changes::Spacial::Rotation) + m_offsetRotation;
+				p_subject->getVec3(this, Systems::Changes::Spatial::LocalRotation) + m_offsetRotation;
 
-			relevantChanges |= Systems::Changes::Spacial::Rotation;
+			relevantChanges |= Systems::Changes::Spatial::LocalRotation;
 		}
 
 		if(relevantChanges)
@@ -251,7 +252,7 @@ public:
 
 	const virtual Math::Vec3f &getVec3(const Observer *p_observer, BitMask p_changedBits) const
 	{
-		switch(p_changedBits)
+		/*switch(p_changedBits)
 		{
 		case Systems::Changes::Spacial::Position:
 			return m_lightDataSet.m_position;
@@ -259,8 +260,8 @@ public:
 		case Systems::Changes::Spacial::Rotation:
 			return m_lightDataSet.m_direction;
 			break;
-		}
-
+		}*/
+		assert(true);
 		return ObservedSubject::getVec3(p_observer, p_changedBits);
 	}
 

+ 8 - 4
Praxis3D/Source/LoaderBase.h

@@ -23,13 +23,13 @@ public:
 		{
 			m_loadingToMemoryError = ErrorCode::Failure;
 			m_loadedToMemory = false;
+			m_loadedToVideoMemory = false;
 			m_beingLoaded = false;
 			m_refCounter = 0;
 		}
 		virtual ~UniqueObject()
 		{
-			unloadVideoMemory();
-			unloadMemory();
+			unload();
 		}
 
 		// Increments reference counter
@@ -48,10 +48,12 @@ public:
 
 		// Setters
 		inline void setLoaded(bool p_loaded)				{ m_loadedToMemory = p_loaded;		}
+		inline void setLoadedToVideoMemory(bool p_loaded)	{ m_loadedToVideoMemory = p_loaded; }
 		inline void setUniqueID(unsigned int p_uniqueID)	{ m_uniqueID = p_uniqueID;			}
 
 		// Getters
 		inline const bool isLoaded()				{ return m_loadedToMemory;		}
+		inline const bool isLoadedToVideoMemory()	{ return m_loadedToVideoMemory; }
 		inline const unsigned int getUniqueID()		{ return m_uniqueID;			}
 		inline std::string getFilename()			{ return m_filename;			}
 
@@ -61,9 +63,11 @@ public:
 		inline ErrorCode unload()		 { return static_cast<TObject*>(this)->unloadMemory();		}
 
 	protected:
-		inline const bool isBeingLoaded() { return m_isBeingLoaded; }
+		inline const bool isBeingLoaded() { return m_beingLoaded; }
 
-		std::atomic_bool m_loadedToMemory;
+		std::atomic_bool	m_beingLoaded,
+							m_loadedToMemory,
+							m_loadedToVideoMemory;
 
 		ErrorCode m_loadingToMemoryError;
 		std::string m_filename;

+ 1 - 1
Praxis3D/Source/ModelComponent.h

@@ -132,7 +132,7 @@ public:
 		setLoaded(true);
 	}
 
-	PropertySet export() final override
+	PropertySet exportObject() final override
 	{ 
 		return PropertySet(); 
 	}

+ 5 - 4
Praxis3D/Source/ModelGraphicsObjects.h

@@ -2,6 +2,7 @@
 
 #include <functional>
 
+#include <assert.h>
 #include "BaseGraphicsObjects.h"
 #include "Loaders.h"
 #include "Renderer.h"
@@ -133,15 +134,15 @@ public:
 	{
 		// Create the root property set
 		PropertySet propertySet(Properties::ArrayEntry);
-
+		assert(true);
 		// Add variables
 		propertySet.addProperty(Properties::Type, Properties::ModelObject);
 		propertySet.addProperty(Properties::Name, m_name);
-		propertySet.addProperty(Properties::Position, m_baseObjectData.m_position);
-		propertySet.addProperty(Properties::Rotation, m_baseObjectData.m_rotation);
+		//propertySet.addProperty(Properties::Position, m_baseObjectData.m_position);
+		//propertySet.addProperty(Properties::Rotation, m_baseObjectData.m_rotation);
 		propertySet.addProperty(Properties::OffsetPosition, m_baseObjectData.m_offsetPosition);
 		propertySet.addProperty(Properties::OffsetRotation, m_baseObjectData.m_offsetRotation);
-		propertySet.addProperty(Properties::Scale, m_baseObjectData.m_scale);
+		//propertySet.addProperty(Properties::Scale, m_baseObjectData.m_scale);
 		propertySet.addProperty(Properties::AlphaThreshold, m_baseObjectData.m_alphaThreshold);
 		propertySet.addProperty(Properties::HeightScale, m_baseObjectData.m_heightScale);
 		propertySet.addProperty(Properties::Lighting, m_affectedByLighting);

+ 1 - 1
Praxis3D/Source/ShaderComponent.h

@@ -44,7 +44,7 @@ public:
 		setLoaded(true);
 	}
 
-	PropertySet export() final override
+	PropertySet exportObject() final override
 	{ 
 		return PropertySet(); 
 	}

+ 2 - 2
Praxis3D/Source/ShaderGraphicsObjects.h

@@ -54,8 +54,8 @@ public:
 		//}
 
 		// Load all other data by calling parent class; log an error on failure
-		if(!ErrHandlerLoc::get().ifSuccessful(ModelObject::loadToVideoMemory(), error))
-			ErrHandlerLoc::get().log(error);
+		//if(!ErrHandlerLoc::get().ifSuccessful(ModelObject::loadToVideoMemory(), error))
+		//	ErrHandlerLoc::get().log(error);
 
 		return ErrorCode::Success;
 	}

+ 9 - 11
Praxis3D/Source/TextureLoader.h

@@ -117,8 +117,7 @@ protected:
 					m_pixelData[i * numChan + 2] = blue;						 // Set blue
 				}
 
-				setLoadedToMemory(true);
-				setLoadedToVideoMemory(false);
+				setLoaded(true);
 			}
 			else
 			{
@@ -254,7 +253,7 @@ public:
 		}
 		
 		// Has the texture been already loaded to video memory (GPU VRAM)
-		//const inline bool isLoadedToVideoMemory() const { return m_textureData->isLoadedToVideoMemory(); }
+		const inline bool isLoadedToVideoMemory() const { return m_textureData->isLoadedToVideoMemory(); }
 
 		// Getters
 		inline unsigned int getTextureHeight() const { return m_textureData->m_textureHeight; }
@@ -266,7 +265,7 @@ public:
 
 		// Setters
 		inline void setLoadedToMemory(bool p_loaded)		{ m_textureData->setLoaded(p_loaded);		}
-		//inline void setLoadedToVideoMemory(bool p_loaded)	{ m_textureData->setLoadedToVideoMemory(p_loaded);	}
+		inline void setLoadedToVideoMemory(bool p_loaded)	{ m_textureData->setLoadedToVideoMemory(p_loaded);	}
 
 	private:
 		// Increment the reference counter when creating a handle
@@ -403,7 +402,7 @@ protected:
 		SpinWait::Lock lock(m_mutex);
 
 		// Texture might have already been loaded when called from a different thread. Check if it was
-		if(!isLoadedToMemory())
+		if(!isLoaded())
 		{
 			for(unsigned int face = CubemapFace_PositiveX; face < CubemapFace_NumOfFaces; face++)
 			{
@@ -461,8 +460,7 @@ protected:
 
 			if(returnError == ErrorCode::Success)
 			{
-				setLoadedToMemory(true);
-				setLoadedToVideoMemory(false);
+				setLoaded(true);
 			}
 		}
 
@@ -648,19 +646,19 @@ public:
 			ErrorCode returnError = ErrorCode::Success;
 
 			// If it's not loaded to memory already, call load
-			if(!m_textureData->isLoadedToMemory())
+			if(!m_textureData->isLoaded())
 			{
 				// Load texture to memory (RAM)
 				returnError = m_textureData->loadToMemory();
 
 				// Only set the loaded to video memory flag to false if the texture has been loaded successfully,
 				// otherwise, flag it as loaded to GPU VRAM already, so to not attempt to load to VRAM
-				if(returnError == ErrorCode::Success)
+				/*if(returnError == ErrorCode::Success)
 					m_textureData->setLoadedToVideoMemory(false);
 				else
-					m_textureData->setLoadedToVideoMemory(true);
+					m_textureData->setLoadedToVideoMemory(true);*/
 			}
-
+			
 			return returnError;
 		}