Browse Source

- Fixing it to compile
- Fixing a bug in ResourcePointer

Panagiotis Christopoulos Charitos 14 years ago
parent
commit
ac72a4a8e3

+ 1 - 1
anki/resource/MaterialUserVariable.h

@@ -19,7 +19,7 @@ class MaterialUserVariable: public MaterialVariable
 {
 	public:
 		/// The data union
-		typedef boost::variant<float, Vec2, Vec3, Vec4, TextureResourcePointer >
+		typedef boost::variant<float, Vec2, Vec3, Vec4, TextureResourcePointer>
 			DataVariant;
 
 		/// @name Constructors & destructor

+ 1 - 1
anki/resource/ResourceManager.inl.h

@@ -1,5 +1,6 @@
 #include "anki/resource/ResourceManager.h"
 #include "anki/util/Exception.h"
+#include "anki/util/Assert.h"
 #include <iostream>
 
 
@@ -134,5 +135,4 @@ typename ResourceManager<Type>::Iterator ResourceManager<Type>::find(
 }
 
 
-
 } // end namespace

+ 33 - 7
anki/resource/ResourcePointer.h

@@ -15,6 +15,7 @@ class ResourcePointer
 {
 	public:
 		typedef ResourcePointer<Type, ResourceManagerSingleton> Self;
+		typedef typename ResourceManagerSingleton::ValueType::Hook Hook;
 
 		/// Default constructor
 		ResourcePointer()
@@ -22,12 +23,10 @@ class ResourcePointer
 		{}
 
 		/// Copy constructor
-		ResourcePointer(const Self& a)
+		ResourcePointer(const Self& b)
+		:	hook(NULL)
 		{
-			if(hook)
-			{
-				++hook->referenceCounter;
-			}
+			copy(b);
 		}
 
 		~ResourcePointer()
@@ -54,9 +53,19 @@ class ResourcePointer
 			return hook->resource;
 		}
 
-		const std::string& getResourceName() const;
+		const std::string& getResourceName() const
+		{
+			return hook->uuid;
+		}
 		/// @}
 
+		/// Copy
+		Self& operator=(const Self& b)
+		{
+			copy(b);
+			return *this;
+		}
+
 		/// Load the resource using the resource manager
 		void load(const char* filename)
 		{
@@ -66,7 +75,7 @@ class ResourcePointer
 
 	private:
 		/// Points to a container in the resource manager
-		typename ResourceManagerSingleton::ValueType::Hook* hook;
+		Hook* hook;
 
 		/// Unloads the resource @see loadRsrc
 		void unload()
@@ -77,6 +86,23 @@ class ResourcePointer
 				hook = NULL;
 			}
 		}
+
+		/// XXX
+		void copy(const Self& b)
+		{
+			if(b.hook == NULL)
+			{
+				if(hook != NULL)
+				{
+					unload();
+				}
+			}
+			else
+			{
+				unload();
+				load(b.hook->uuid.c_str());
+			}
+		}
 };
 
 

+ 3 - 2
anki/resource/Skin.cpp

@@ -76,8 +76,9 @@ void Skin::load(const char* filename)
 				skeleton->getBones().size())
 			{
 				throw ANKI_EXCEPTION("Skeleton animation \"" +
-					skelAnim.getRsrcName() + "\" and skeleton \"" +
-					skeleton.getRsrcName() + "\" dont have equal bone count");
+					skelAnim.getResourceName() + "\" and skeleton \"" +
+					skeleton.getResourceName() +
+					"\" dont have equal bone count");
 			}
 		}
 

+ 11 - 0
docs/drafts/notes.txt

@@ -0,0 +1,11 @@
+- Have to depth buffers in the MS. The MS writes in the k frame to the first and in the k+1 in the other. With this way we can read from the one and write to the other. Test in 33Hz
+
+- The light material should contain the bool: castsShadow
+
+- All scene objects are debugable because the render at least in DBGS
+
+- Rename DBG stage to DS
+
+- Octree has SceneNodes
+
+- All scene nodes have AABB

+ 2 - 2
testapp/Main.cpp

@@ -428,7 +428,7 @@ void mainLoop()
 		//
 		// Async resource loading
 		//
-		if(ResourceManagerSingleton::get().getAsyncLoadingRequestsNum() > 0)
+		/*if(ResourceManagerSingleton::get().getAsyncLoadingRequestsNum() > 0)
 		{
 			HighRezTimer::Scalar a = timer.getElapsedTime();
 			HighRezTimer::Scalar b = AppSingleton::get().getTimerTick();
@@ -442,7 +442,7 @@ void mainLoop()
 				timeToSpendForRsrcPostProcess = 0.001;
 			}
 			ResourceManagerSingleton::get().postProcessFinishedLoadingRequests(timeToSpendForRsrcPostProcess);
-		}
+		}*/
 
 		//
 		// Sleep