Browse Source

- Removing the complexity from the resource manager. Now its much more clean
- Renaming ASSERTION to ANKI_ASSERTION
- Removing the async loader for now

Panagiotis Christopoulos Charitos 14 years ago
parent
commit
4af8343dcf
100 changed files with 544 additions and 1044 deletions
  1. 2 2
      anki/collision/Aabb.h
  2. 12 12
      anki/collision/CollisionAlgorithmsMatrix.cpp
  3. 1 1
      anki/collision/Obb.inl.h
  4. 3 3
      anki/collision/Plane.cpp
  5. 1 1
      anki/collision/Sphere.inl.h
  6. 0 1
      anki/core/Globals.h
  7. 3 3
      anki/core/Object.cpp
  8. 1 1
      anki/event/Event.cpp
  9. 8 8
      anki/gl/BufferObject.cpp
  10. 7 7
      anki/gl/BufferObject.h
  11. 5 5
      anki/gl/Fbo.cpp
  12. 5 5
      anki/gl/Fbo.h
  13. 1 1
      anki/gl/GlException.cpp
  14. 5 5
      anki/gl/GlStateMachine.cpp
  15. 2 2
      anki/gl/TimeQuery.cpp
  16. 2 2
      anki/gl/Vao.cpp
  17. 3 3
      anki/gl/Vao.h
  18. 1 1
      anki/gl/Vbo.h
  19. 3 3
      anki/math/Mat3.inl.h
  20. 2 2
      anki/math/Mat4.inl.h
  21. 1 1
      anki/math/Quat.inl.h
  22. 1 1
      anki/math/Vec3.inl.h
  23. 1 1
      anki/misc/TestHeader.cpp
  24. 1 1
      anki/physics/Character.cpp
  25. 1 1
      anki/physics/RigidBody.cpp
  26. 4 4
      anki/renderer/Bl.cpp
  27. 5 5
      anki/renderer/Bl.h
  28. 1 1
      anki/renderer/Bs.cpp
  29. 2 2
      anki/renderer/Bs.h
  30. 3 3
      anki/renderer/CollisionDbgDrawer.h
  31. 4 4
      anki/renderer/Dbg.cpp
  32. 2 2
      anki/renderer/Dbg.h
  33. 5 5
      anki/renderer/Deformer.cpp
  34. 3 3
      anki/renderer/Deformer.h
  35. 3 3
      anki/renderer/Hdr.cpp
  36. 4 4
      anki/renderer/Hdr.h
  37. 4 4
      anki/renderer/Is.cpp
  38. 5 5
      anki/renderer/Is.h
  39. 1 1
      anki/renderer/MainRenderer.cpp
  40. 1 1
      anki/renderer/MainRenderer.h
  41. 2 2
      anki/renderer/Pps.cpp
  42. 3 3
      anki/renderer/Pps.h
  43. 1 1
      anki/renderer/Renderer.cpp
  44. 1 1
      anki/renderer/Renderer.h
  45. 1 1
      anki/renderer/SceneDbgDrawer.cpp
  46. 2 2
      anki/renderer/SceneDrawer.cpp
  47. 2 2
      anki/renderer/SceneDrawer.h
  48. 2 2
      anki/renderer/Sm.cpp
  49. 5 5
      anki/renderer/Smo.cpp
  50. 3 3
      anki/renderer/Smo.h
  51. 4 4
      anki/renderer/Ssao.cpp
  52. 5 5
      anki/renderer/Ssao.h
  53. 1 1
      anki/resource/LightRsrc.cpp
  54. 3 3
      anki/resource/LightRsrc.h
  55. 3 3
      anki/resource/Material.cpp
  56. 2 2
      anki/resource/Material.h
  57. 1 1
      anki/resource/MaterialBuildinVariable.cpp
  58. 1 1
      anki/resource/MaterialBuildinVariable.h
  59. 12 12
      anki/resource/MaterialUserVariable.cpp
  60. 2 2
      anki/resource/MaterialUserVariable.h
  61. 1 1
      anki/resource/MaterialVariable.h
  62. 1 1
      anki/resource/Mesh.h
  63. 1 1
      anki/resource/Model.h
  64. 2 2
      anki/resource/ModelPatch.cpp
  65. 3 3
      anki/resource/ModelPatch.h
  66. 37 0
      anki/resource/Resource.h
  67. 0 270
      anki/resource/ResourceManager.cpp
  68. 38 108
      anki/resource/ResourceManager.h
  69. 138 0
      anki/resource/ResourceManager.inl.h
  70. 86 0
      anki/resource/ResourcePointer.h
  71. 0 81
      anki/resource/RsrcAsyncLoadingReqsHandler.cpp
  72. 0 61
      anki/resource/RsrcAsyncLoadingReqsHandler.h
  73. 0 23
      anki/resource/RsrcHook.h
  74. 0 43
      anki/resource/RsrcLoadingRequests.cpp
  75. 0 65
      anki/resource/RsrcLoadingRequests.h
  76. 0 58
      anki/resource/RsrcPtr.h
  77. 0 92
      anki/resource/RsrcPtr.inl.h
  78. 2 2
      anki/resource/ShaderProgram.cpp
  79. 2 2
      anki/resource/ShaderProgram.h
  80. 11 11
      anki/resource/ShaderProgramUniformVariable.cpp
  81. 5 5
      anki/resource/Skin.cpp
  82. 6 6
      anki/resource/Skin.h
  83. 4 4
      anki/resource/Texture.h
  84. 1 1
      anki/scene/Light.cpp
  85. 2 2
      anki/scene/Light.h
  86. 2 2
      anki/scene/MaterialRuntimeVariable.cpp
  87. 2 2
      anki/scene/MaterialRuntimeVariable.h
  88. 1 1
      anki/scene/ModelNode.cpp
  89. 2 2
      anki/scene/ModelNode.h
  90. 1 1
      anki/scene/ParticleEmitterNode.cpp
  91. 3 2
      anki/scene/ParticleEmitterNode.h
  92. 3 3
      anki/scene/PatchNode.cpp
  93. 1 1
      anki/scene/PatchNode.h
  94. 4 4
      anki/scene/Scene.cpp
  95. 2 2
      anki/scene/Scene.inl.h
  96. 1 1
      anki/scene/SceneNode.cpp
  97. 3 3
      anki/scene/SkinNode.cpp
  98. 1 1
      anki/scene/SkinNode.h
  99. 2 1
      anki/scene/SkinPatchNode.cpp
  100. 1 0
      anki/scene/VisibilityTester.cpp

+ 2 - 2
anki/collision/Aabb.h

@@ -26,7 +26,7 @@ class Aabb: public CollisionShape
 			min(min_),
 			min(min_),
 			max(max_)
 			max(max_)
 		{
 		{
-			ASSERT(min < max);
+			ANKI_ASSERT(min < max);
 		}
 		}
 
 
 		Aabb(const Aabb& b)
 		Aabb(const Aabb& b)
@@ -109,7 +109,7 @@ class Aabb: public CollisionShape
 template<typename Container>
 template<typename Container>
 void Aabb::set(const Container& container)
 void Aabb::set(const Container& container)
 {
 {
-	ASSERT(container.size() >= 1);
+	ANKI_ASSERT(container.size() >= 1);
 
 
 	min = container.front();
 	min = container.front();
 	max = container.front();
 	max = container.front();

+ 12 - 12
anki/collision/CollisionAlgorithmsMatrix.cpp

@@ -32,7 +32,7 @@ bool CollisionAlgorithmsMatrix::tcollide(const CollisionShape& a,
 		case CollisionShape::CST_PERSPECTIVE_CAMERA_FRUSTRUM:
 		case CollisionShape::CST_PERSPECTIVE_CAMERA_FRUSTRUM:
 			return collide(t, static_cast<const PerspectiveCameraShape&>(b));
 			return collide(t, static_cast<const PerspectiveCameraShape&>(b));
 		default:
 		default:
-			ASSERT(0 && "Forgot something");
+			ANKI_ASSERT(0 && "Forgot something");
 	}
 	}
 }
 }
 
 
@@ -58,7 +58,7 @@ bool CollisionAlgorithmsMatrix::collide(const CollisionShape& a,
 		case CollisionShape::CST_PERSPECTIVE_CAMERA_FRUSTRUM:
 		case CollisionShape::CST_PERSPECTIVE_CAMERA_FRUSTRUM:
 			return tcollide<PerspectiveCameraShape>(a, b);
 			return tcollide<PerspectiveCameraShape>(a, b);
 		default:
 		default:
-			ASSERT(0 && "Forgot something");
+			ANKI_ASSERT(0 && "Forgot something");
 	}
 	}
 }
 }
 
 
@@ -71,7 +71,7 @@ bool CollisionAlgorithmsMatrix::collide(const CollisionShape& a,
 bool CollisionAlgorithmsMatrix::collide(const Ls& /*a*/,
 bool CollisionAlgorithmsMatrix::collide(const Ls& /*a*/,
 	const Ls& /*b*/)
 	const Ls& /*b*/)
 {
 {
-	ASSERT(0 && "N/A");
+	ANKI_ASSERT(0 && "N/A");
 	return false;
 	return false;
 }
 }
 
 
@@ -144,7 +144,7 @@ bool CollisionAlgorithmsMatrix::collide(const Ls& ls,
 bool CollisionAlgorithmsMatrix::collide(const Ls& /*a*/,
 bool CollisionAlgorithmsMatrix::collide(const Ls& /*a*/,
 	const Pcs& /*b*/)
 	const Pcs& /*b*/)
 {
 {
-	ASSERT(0 && "Not implemented yet");
+	ANKI_ASSERT(0 && "Not implemented yet");
 	return false;
 	return false;
 }
 }
 
 
@@ -160,7 +160,7 @@ bool CollisionAlgorithmsMatrix::collide(const Ls& ls, const Plane& p)
 bool CollisionAlgorithmsMatrix::collide(const Ls& /*a*/,
 bool CollisionAlgorithmsMatrix::collide(const Ls& /*a*/,
 	const Ray& /*b*/)
 	const Ray& /*b*/)
 {
 {
-	ASSERT(0 && "N/A");
+	ANKI_ASSERT(0 && "N/A");
 	return false;
 	return false;
 }
 }
 
 
@@ -438,7 +438,7 @@ bool CollisionAlgorithmsMatrix::collide(const Obb& o0,
 //==============================================================================
 //==============================================================================
 bool CollisionAlgorithmsMatrix::collide(const Obb& a, const Pcs& b)
 bool CollisionAlgorithmsMatrix::collide(const Obb& a, const Pcs& b)
 {
 {
-	ASSERT(0 && "Not impelented yet");
+	ANKI_ASSERT(0 && "Not impelented yet");
 	return false;
 	return false;
 }
 }
 
 
@@ -499,7 +499,7 @@ bool CollisionAlgorithmsMatrix::collide(const Obb& obb,
 bool CollisionAlgorithmsMatrix::collide(const Pcs& a,
 bool CollisionAlgorithmsMatrix::collide(const Pcs& a,
 	const Pcs& b)
 	const Pcs& b)
 {
 {
-	ASSERT(0 && "Not implemented yet");
+	ANKI_ASSERT(0 && "Not implemented yet");
 	return false;
 	return false;
 }
 }
 
 
@@ -508,7 +508,7 @@ bool CollisionAlgorithmsMatrix::collide(const Pcs& a,
 bool CollisionAlgorithmsMatrix::collide(const Pcs& a,
 bool CollisionAlgorithmsMatrix::collide(const Pcs& a,
 	const Plane& b)
 	const Plane& b)
 {
 {
-	ASSERT(0 && "Not implemented yet");
+	ANKI_ASSERT(0 && "Not implemented yet");
 	return false;
 	return false;
 }
 }
 
 
@@ -517,7 +517,7 @@ bool CollisionAlgorithmsMatrix::collide(const Pcs& a,
 bool CollisionAlgorithmsMatrix::collide(const Pcs& a,
 bool CollisionAlgorithmsMatrix::collide(const Pcs& a,
 	const Ray& b)
 	const Ray& b)
 {
 {
-	ASSERT(0 && "Not implemented yet");
+	ANKI_ASSERT(0 && "Not implemented yet");
 	return false;
 	return false;
 }
 }
 
 
@@ -526,7 +526,7 @@ bool CollisionAlgorithmsMatrix::collide(const Pcs& a,
 bool CollisionAlgorithmsMatrix::collide(const Pcs& a,
 bool CollisionAlgorithmsMatrix::collide(const Pcs& a,
 	const Sphere& b)
 	const Sphere& b)
 {
 {
-	ASSERT(0 && "Not implemented yet");
+	ANKI_ASSERT(0 && "Not implemented yet");
 	return false;
 	return false;
 }
 }
 
 
@@ -535,7 +535,7 @@ bool CollisionAlgorithmsMatrix::collide(const Pcs& a,
 bool CollisionAlgorithmsMatrix::collide(const Pcs& a,
 bool CollisionAlgorithmsMatrix::collide(const Pcs& a,
 	const Aabb& b)
 	const Aabb& b)
 {
 {
-	ASSERT(0 && "Not implemented yet");
+	ANKI_ASSERT(0 && "Not implemented yet");
 	return false;
 	return false;
 }
 }
 
 
@@ -584,7 +584,7 @@ bool CollisionAlgorithmsMatrix::collide(const Plane& p,
 bool CollisionAlgorithmsMatrix::collide(const Ray& a,
 bool CollisionAlgorithmsMatrix::collide(const Ray& a,
 	const Ray& b)
 	const Ray& b)
 {
 {
-	ASSERT(0 && "N/A");
+	ANKI_ASSERT(0 && "N/A");
 	return false;
 	return false;
 }
 }
 
 

+ 1 - 1
anki/collision/Obb.inl.h

@@ -9,7 +9,7 @@ namespace anki {
 template<typename Container>
 template<typename Container>
 void Obb::set(const Container& container)
 void Obb::set(const Container& container)
 {
 {
-	ASSERT(container.size() >= 1);
+	ANKI_ASSERT(container.size() >= 1);
 
 
 	Vec3 min(container.front());
 	Vec3 min(container.front());
 	Vec3 max(container.front());
 	Vec3 max(container.front());

+ 3 - 3
anki/collision/Plane.cpp

@@ -24,7 +24,7 @@ Plane::Plane(const Vec3& normal_, float offset_)
 //==============================================================================
 //==============================================================================
 float Plane::testPlane(const Plane& /*p*/) const
 float Plane::testPlane(const Plane& /*p*/) const
 {
 {
-	ASSERT(0 && "Ambiguous call");
+	ANKI_ASSERT(0 && "Ambiguous call");
 	return 0.0;
 	return 0.0;
 }
 }
 
 
@@ -39,7 +39,7 @@ void Plane::setFrom3Points(const Vec3& p0, const Vec3& p1, const Vec3& p2)
 	normal = u.cross(v);
 	normal = u.cross(v);
 
 
 	// length of normal had better not be zero
 	// length of normal had better not be zero
-	ASSERT(!Math::isZero(normal.getLengthSquared()));
+	ANKI_ASSERT(!Math::isZero(normal.getLengthSquared()));
 
 
 	normal.normalize();
 	normal.normalize();
 	offset = normal.dot(p0); // ToDo: correct??
 	offset = normal.dot(p0); // ToDo: correct??
@@ -52,7 +52,7 @@ void Plane::setFromPlaneEquation(float a, float b, float c, float d)
 	// normalize for cheap distance checks
 	// normalize for cheap distance checks
 	float lensq = a * a + b * b + c * c;
 	float lensq = a * a + b * b + c * c;
 	// length of normal had better not be zero
 	// length of normal had better not be zero
-	ASSERT(!Math::isZero(lensq));
+	ANKI_ASSERT(!Math::isZero(lensq));
 
 
 	// recover gracefully
 	// recover gracefully
 	if(Math::isZero(lensq))
 	if(Math::isZero(lensq))

+ 1 - 1
anki/collision/Sphere.inl.h

@@ -12,7 +12,7 @@ namespace anki {
 template<typename Container>
 template<typename Container>
 void Sphere::set(const Container& container)
 void Sphere::set(const Container& container)
 {
 {
-	ASSERT(container.size() >= 1);
+	ANKI_ASSERT(container.size() >= 1);
 
 
 	Vec3 min(container.front());
 	Vec3 min(container.front());
 	Vec3 max(container.front());
 	Vec3 max(container.front());

+ 0 - 1
anki/core/Globals.h

@@ -10,7 +10,6 @@ namespace anki {
 typedef Singleton<class Logger> LoggerSingleton;
 typedef Singleton<class Logger> LoggerSingleton;
 typedef Singleton<class MainRenderer> MainRendererSingleton;
 typedef Singleton<class MainRenderer> MainRendererSingleton;
 typedef Singleton<class Input> InputSingleton;
 typedef Singleton<class Input> InputSingleton;
-typedef Singleton<class ResourceManager> ResourceManagerSingleton;
 typedef Singleton<class Scene> SceneSingleton;
 typedef Singleton<class Scene> SceneSingleton;
 typedef Singleton<class App> AppSingleton;
 typedef Singleton<class App> AppSingleton;
 typedef Singleton<class StdinListener> StdinListenerSingleton;
 typedef Singleton<class StdinListener> StdinListenerSingleton;

+ 3 - 3
anki/core/Object.cpp

@@ -45,8 +45,8 @@ Object::~Object()
 //==============================================================================
 //==============================================================================
 void Object::addChild(Object* child)
 void Object::addChild(Object* child)
 {
 {
-	ASSERT(child != NULL);
-	ASSERT(child->objParent == NULL); // Child already has parent
+	ANKI_ASSERT(child != NULL);
+	ANKI_ASSERT(child->objParent == NULL); // Child already has parent
 
 
 	child->objParent = this;
 	child->objParent = this;
 	objChilds.push_back(child);
 	objChilds.push_back(child);
@@ -58,7 +58,7 @@ void Object::addChild(Object* child)
 //==============================================================================
 //==============================================================================
 void Object::removeChild(Object* child)
 void Object::removeChild(Object* child)
 {
 {
-	ASSERT(child != NULL);
+	ANKI_ASSERT(child != NULL);
 
 
 	Container::iterator it = std::find(objChilds.begin(), objChilds.end(),
 	Container::iterator it = std::find(objChilds.begin(), objChilds.end(),
 		child);
 		child);

+ 1 - 1
anki/event/Event.cpp

@@ -32,7 +32,7 @@ Event& Event::operator=(const Event& b)
 //==============================================================================
 //==============================================================================
 void Event::update(float prevUpdateTime, float crntTime)
 void Event::update(float prevUpdateTime, float crntTime)
 {
 {
-	ASSERT(!isDead(crntTime));
+	ANKI_ASSERT(!isDead(crntTime));
 
 
 	// Dont update if its not the right time yet
 	// Dont update if its not the right time yet
 	if(startTime <= crntTime)
 	if(startTime <= crntTime)

+ 8 - 8
anki/gl/BufferObject.cpp

@@ -25,14 +25,14 @@ BufferObject::~BufferObject()
 void BufferObject::create(GLenum target_, uint sizeInBytes_,
 void BufferObject::create(GLenum target_, uint sizeInBytes_,
 	const void* dataPtr, GLenum usage_)
 	const void* dataPtr, GLenum usage_)
 {
 {
-	ASSERT(!isCreated());
+	ANKI_ASSERT(!isCreated());
 	// unacceptable usage_
 	// unacceptable usage_
 
 
-	ASSERT(usage_ == GL_STREAM_DRAW ||
+	ANKI_ASSERT(usage_ == GL_STREAM_DRAW ||
 		usage_ == GL_STATIC_DRAW ||
 		usage_ == GL_STATIC_DRAW ||
 		usage_ == GL_DYNAMIC_DRAW);
 		usage_ == GL_DYNAMIC_DRAW);
 
 
-	ASSERT(sizeInBytes_ > 0); // unacceptable sizeInBytes
+	ANKI_ASSERT(sizeInBytes_ > 0); // unacceptable sizeInBytes
 
 
 	usage = usage_;
 	usage = usage_;
 	target = target_;
 	target = target_;
@@ -61,8 +61,8 @@ void BufferObject::create(GLenum target_, uint sizeInBytes_,
 //==============================================================================
 //==============================================================================
 void BufferObject::write(void* buff)
 void BufferObject::write(void* buff)
 {
 {
-	ASSERT(isCreated());
-	ASSERT(usage != GL_STATIC_DRAW);
+	ANKI_ASSERT(isCreated());
+	ANKI_ASSERT(usage != GL_STATIC_DRAW);
 	bind();
 	bind();
 	void* mapped = glMapBuffer(target, GL_WRITE_ONLY);
 	void* mapped = glMapBuffer(target, GL_WRITE_ONLY);
 	memcpy(mapped, buff, sizeInBytes);
 	memcpy(mapped, buff, sizeInBytes);
@@ -76,9 +76,9 @@ void BufferObject::write(void* buff)
 //==============================================================================
 //==============================================================================
 void BufferObject::write(void* buff, size_t offset, size_t size)
 void BufferObject::write(void* buff, size_t offset, size_t size)
 {
 {
-	ASSERT(isCreated());
-	ASSERT(usage != GL_STATIC_DRAW);
-	ASSERT(offset + size <= sizeInBytes);
+	ANKI_ASSERT(isCreated());
+	ANKI_ASSERT(usage != GL_STATIC_DRAW);
+	ANKI_ASSERT(offset + size <= sizeInBytes);
 	bind();
 	bind();
 	void* mapped = glMapBufferRange(target, offset, size, GL_MAP_WRITE_BIT);
 	void* mapped = glMapBufferRange(target, offset, size, GL_MAP_WRITE_BIT);
 	memcpy(mapped, buff, size);
 	memcpy(mapped, buff, size);

+ 7 - 7
anki/gl/BufferObject.h

@@ -96,49 +96,49 @@ inline BufferObject::BufferObject(GLenum target, uint sizeInBytes,
 
 
 inline uint BufferObject::getGlId() const
 inline uint BufferObject::getGlId() const
 {
 {
-	ASSERT(isCreated());
+	ANKI_ASSERT(isCreated());
 	return glId;
 	return glId;
 }
 }
 
 
 
 
 inline GLenum BufferObject::getBufferTarget() const
 inline GLenum BufferObject::getBufferTarget() const
 {
 {
-	ASSERT(isCreated());
+	ANKI_ASSERT(isCreated());
 	return target;
 	return target;
 }
 }
 
 
 
 
 inline GLenum BufferObject::getBufferUsage() const
 inline GLenum BufferObject::getBufferUsage() const
 {
 {
-	ASSERT(isCreated());
+	ANKI_ASSERT(isCreated());
 	return usage;
 	return usage;
 }
 }
 
 
 
 
 inline size_t BufferObject::getSizeInBytes() const
 inline size_t BufferObject::getSizeInBytes() const
 {
 {
-	ASSERT(isCreated());
+	ANKI_ASSERT(isCreated());
 	return sizeInBytes;
 	return sizeInBytes;
 }
 }
 
 
 
 
 inline void BufferObject::bind() const
 inline void BufferObject::bind() const
 {
 {
-	ASSERT(isCreated());
+	ANKI_ASSERT(isCreated());
 	glBindBuffer(target, glId);
 	glBindBuffer(target, glId);
 }
 }
 
 
 
 
 inline void BufferObject::unbind() const
 inline void BufferObject::unbind() const
 {
 {
-	ASSERT(isCreated());
+	ANKI_ASSERT(isCreated());
 	glBindBuffer(target, 0);
 	glBindBuffer(target, 0);
 }
 }
 
 
 
 
 inline void BufferObject::deleteBuff()
 inline void BufferObject::deleteBuff()
 {
 {
-	ASSERT(isCreated());
+	ANKI_ASSERT(isCreated());
 	glDeleteBuffers(1, &glId);
 	glDeleteBuffers(1, &glId);
 	glId = 0;
 	glId = 0;
 }
 }

+ 5 - 5
anki/gl/Fbo.cpp

@@ -22,8 +22,8 @@ Fbo::~Fbo()
 //==============================================================================
 //==============================================================================
 void Fbo::checkIfGood() const
 void Fbo::checkIfGood() const
 {
 {
-	ASSERT(isCreated());
-	ASSERT(getCurrentFbo() == glId); // another FBO is binded
+	ANKI_ASSERT(isCreated());
+	ANKI_ASSERT(getCurrentFbo() == glId); // another FBO is binded
 
 
 	GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
 	GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
 
 
@@ -40,8 +40,8 @@ void Fbo::checkIfGood() const
 //==============================================================================
 //==============================================================================
 void Fbo::setNumOfColorAttachements(uint num) const
 void Fbo::setNumOfColorAttachements(uint num) const
 {
 {
-	ASSERT(isCreated());
-	ASSERT(getCurrentFbo() == glId); // another FBO is binded
+	ANKI_ASSERT(isCreated());
+	ANKI_ASSERT(getCurrentFbo() == glId); // another FBO is binded
 
 
 	if(num == 0)
 	if(num == 0)
 	{
 	{
@@ -55,7 +55,7 @@ void Fbo::setNumOfColorAttachements(uint num) const
 			GL_COLOR_ATTACHMENT3, GL_COLOR_ATTACHMENT4, GL_COLOR_ATTACHMENT5,
 			GL_COLOR_ATTACHMENT3, GL_COLOR_ATTACHMENT4, GL_COLOR_ATTACHMENT5,
 			GL_COLOR_ATTACHMENT6, GL_COLOR_ATTACHMENT7};
 			GL_COLOR_ATTACHMENT6, GL_COLOR_ATTACHMENT7};
 
 
-		ASSERT(num <= sizeof(colorAttachments) / sizeof(GLenum));
+		ANKI_ASSERT(num <= sizeof(colorAttachments) / sizeof(GLenum));
 		glDrawBuffers(num, colorAttachments);
 		glDrawBuffers(num, colorAttachments);
 	}
 	}
 }
 }

+ 5 - 5
anki/gl/Fbo.h

@@ -59,23 +59,23 @@ class Fbo
 
 
 inline void Fbo::create()
 inline void Fbo::create()
 {
 {
-	ASSERT(!isCreated());
+	ANKI_ASSERT(!isCreated());
 	glGenFramebuffers(1, &glId);
 	glGenFramebuffers(1, &glId);
 }
 }
 
 
 
 
 inline uint Fbo::getGlId() const
 inline uint Fbo::getGlId() const
 {
 {
-	ASSERT(!isCreated());
+	ANKI_ASSERT(!isCreated());
 	return glId;
 	return glId;
 }
 }
 
 
 
 
 inline void Fbo::bind(GLenum target_)
 inline void Fbo::bind(GLenum target_)
 {
 {
-	ASSERT(isCreated());
+	ANKI_ASSERT(isCreated());
 	target = target_;
 	target = target_;
-	ASSERT(target == GL_DRAW_FRAMEBUFFER ||
+	ANKI_ASSERT(target == GL_DRAW_FRAMEBUFFER ||
 		target == GL_READ_FRAMEBUFFER ||
 		target == GL_READ_FRAMEBUFFER ||
 		target == GL_FRAMEBUFFER);
 		target == GL_FRAMEBUFFER);
 	glBindFramebuffer(target, glId);
 	glBindFramebuffer(target, glId);
@@ -90,7 +90,7 @@ inline void Fbo::unbind()
 
 
 inline void Fbo::destroy()
 inline void Fbo::destroy()
 {
 {
-	ASSERT(isCreated());
+	ANKI_ASSERT(isCreated());
 	glDeleteFramebuffers(1, &glId);
 	glDeleteFramebuffers(1, &glId);
 }
 }
 
 

+ 1 - 1
anki/gl/GlException.cpp

@@ -25,7 +25,7 @@ void glConditionalThrowException(const char* file, int line, const char* func)
 #else
 #else
 	ANKI_ERROR("(" << file << ":" << line <<
 	ANKI_ERROR("(" << file << ":" << line <<
 		" " << func << ") GL Error: " << glerr);
 		" " << func << ") GL Error: " << glerr);
-	ASSERT(0);
+	ANKI_ASSERT(0);
 #endif
 #endif
 }
 }
 
 

+ 5 - 5
anki/gl/GlStateMachine.cpp

@@ -25,9 +25,9 @@ GLenum GlStateMachine::flagEnums[] =
 //==============================================================================
 //==============================================================================
 void GlStateMachine::enable(GLenum glFlag, bool enable)
 void GlStateMachine::enable(GLenum glFlag, bool enable)
 {
 {
-	ASSERT(flags.find(glFlag) != flags.end());
+	ANKI_ASSERT(flags.find(glFlag) != flags.end());
 	bool state = flags[glFlag];
 	bool state = flags[glFlag];
-	ASSERT(glIsEnabled(glFlag) == state);
+	ANKI_ASSERT(glIsEnabled(glFlag) == state);
 
 
 	if(enable != state)
 	if(enable != state)
 	{
 	{
@@ -49,9 +49,9 @@ void GlStateMachine::enable(GLenum glFlag, bool enable)
 //==============================================================================
 //==============================================================================
 bool GlStateMachine::isEnabled(GLenum glFlag)
 bool GlStateMachine::isEnabled(GLenum glFlag)
 {
 {
-	ASSERT(flags.find(glFlag) != flags.end());
+	ANKI_ASSERT(flags.find(glFlag) != flags.end());
 	bool state = flags[glFlag];
 	bool state = flags[glFlag];
-	ASSERT(glIsEnabled(glFlag) == state);
+	ANKI_ASSERT(glIsEnabled(glFlag) == state);
 	return state;
 	return state;
 }
 }
 
 
@@ -103,7 +103,7 @@ void GlStateMachine::setViewport(uint x, uint y, uint w, uint h)
 //==============================================================================
 //==============================================================================
 void GlStateMachine::useShaderProg(GLuint id)
 void GlStateMachine::useShaderProg(GLuint id)
 {
 {
-	ASSERT(getCurrentProgramGlId() == sProgGlId);
+	ANKI_ASSERT(getCurrentProgramGlId() == sProgGlId);
 
 
 	if(sProgGlId != id)
 	if(sProgGlId != id)
 	{
 	{

+ 2 - 2
anki/gl/TimeQuery.cpp

@@ -30,7 +30,7 @@ TimeQuery::~TimeQuery()
 //==============================================================================
 //==============================================================================
 void TimeQuery::begin()
 void TimeQuery::begin()
 {
 {
-	ASSERT(state == S_CREATED || state == S_ENDED);
+	ANKI_ASSERT(state == S_CREATED || state == S_ENDED);
 
 
 	glQueryCounter(glIds[0], GL_TIMESTAMP);
 	glQueryCounter(glIds[0], GL_TIMESTAMP);
 
 
@@ -43,7 +43,7 @@ void TimeQuery::begin()
 //==============================================================================
 //==============================================================================
 double TimeQuery::end()
 double TimeQuery::end()
 {
 {
-	ASSERT(state == S_STARTED);
+	ANKI_ASSERT(state == S_STARTED);
 
 
 	glQueryCounter(glIds[1], GL_TIMESTAMP);
 	glQueryCounter(glIds[1], GL_TIMESTAMP);
 
 

+ 2 - 2
anki/gl/Vao.cpp

@@ -26,7 +26,7 @@ void Vao::attachArrayBufferVbo(const Vbo& vbo, uint attribVarLocation,
 	GLint size, GLenum type, GLboolean normalized, GLsizei stride,
 	GLint size, GLenum type, GLboolean normalized, GLsizei stride,
 	const GLvoid* pointer)
 	const GLvoid* pointer)
 {
 {
-	ASSERT(isCreated());
+	ANKI_ASSERT(isCreated());
 	if(vbo.getBufferTarget() != GL_ARRAY_BUFFER)
 	if(vbo.getBufferTarget() != GL_ARRAY_BUFFER)
 	{
 	{
 		throw ANKI_EXCEPTION("Only GL_ARRAY_BUFFER is accepted");
 		throw ANKI_EXCEPTION("Only GL_ARRAY_BUFFER is accepted");
@@ -64,7 +64,7 @@ void Vao::attachArrayBufferVbo(const Vbo& vbo,
 //==============================================================================
 //==============================================================================
 void Vao::attachElementArrayBufferVbo(const Vbo& vbo)
 void Vao::attachElementArrayBufferVbo(const Vbo& vbo)
 {
 {
-	ASSERT(isCreated());
+	ANKI_ASSERT(isCreated());
 	if(vbo.getBufferTarget() != GL_ELEMENT_ARRAY_BUFFER)
 	if(vbo.getBufferTarget() != GL_ELEMENT_ARRAY_BUFFER)
 	{
 	{
 		throw ANKI_EXCEPTION("Only GL_ELEMENT_ARRAY_BUFFER is accepted");
 		throw ANKI_EXCEPTION("Only GL_ELEMENT_ARRAY_BUFFER is accepted");

+ 3 - 3
anki/gl/Vao.h

@@ -104,7 +104,7 @@ class Vao
 
 
 inline void Vao::create()
 inline void Vao::create()
 {
 {
-	ASSERT(!isCreated());
+	ANKI_ASSERT(!isCreated());
 	glGenVertexArrays(1, &glId);
 	glGenVertexArrays(1, &glId);
 	ANKI_CHECK_GL_ERROR();
 	ANKI_CHECK_GL_ERROR();
 }
 }
@@ -112,14 +112,14 @@ inline void Vao::create()
 
 
 inline void Vao::destroy()
 inline void Vao::destroy()
 {
 {
-	ASSERT(isCreated());
+	ANKI_ASSERT(isCreated());
 	glDeleteVertexArrays(1, &glId);
 	glDeleteVertexArrays(1, &glId);
 }
 }
 
 
 
 
 inline uint Vao::getGlId() const
 inline uint Vao::getGlId() const
 {
 {
-	ASSERT(isCreated());
+	ANKI_ASSERT(isCreated());
 	return glId;
 	return glId;
 }
 }
 
 

+ 1 - 1
anki/gl/Vbo.h

@@ -41,7 +41,7 @@ inline void Vbo::create(GLenum target_, uint sizeInBytes_,
 	const void* dataPtr_, GLenum usage_)
 	const void* dataPtr_, GLenum usage_)
 {
 {
 	// unacceptable target_
 	// unacceptable target_
-	ASSERT(target_ == GL_ARRAY_BUFFER || target_ == GL_ELEMENT_ARRAY_BUFFER);
+	ANKI_ASSERT(target_ == GL_ARRAY_BUFFER || target_ == GL_ELEMENT_ARRAY_BUFFER);
 	BufferObject::create(target_, sizeInBytes_, dataPtr_, usage_);
 	BufferObject::create(target_, sizeInBytes_, dataPtr_, usage_);
 }
 }
 
 

+ 3 - 3
anki/math/Mat3.inl.h

@@ -59,7 +59,7 @@ inline Mat3::Mat3(const Mat3& b)
 inline Mat3::Mat3(const Quat& q)
 inline Mat3::Mat3(const Quat& q)
 {
 {
 	// If length is > 1 + 0.002 or < 1 - 0.002 then not normalized quat
 	// If length is > 1 + 0.002 or < 1 - 0.002 then not normalized quat
-	ASSERT(fabs(1.0 - q.getLength()) <= 0.002);
+	ANKI_ASSERT(fabs(1.0 - q.getLength()) <= 0.002);
 
 
 	float xs, ys, zs, wx, wy, wz, xx, xy, xz, yy, yz, zz;
 	float xs, ys, zs, wx, wy, wz, xx, xy, xz, yy, yz, zz;
 
 
@@ -114,7 +114,7 @@ inline Mat3::Mat3(const Euler& e)
 inline Mat3::Mat3(const Axisang& axisang)
 inline Mat3::Mat3(const Axisang& axisang)
 {
 {
 	// Not normalized axis
 	// Not normalized axis
-	ASSERT(Math::isZero(1.0 - axisang.getAxis().getLength()));
+	ANKI_ASSERT(Math::isZero(1.0 - axisang.getAxis().getLength()));
 
 
 	float c, s;
 	float c, s;
 	Math::sinCos(axisang.getAngle(), s, c);
 	Math::sinCos(axisang.getAngle(), s, c);
@@ -812,7 +812,7 @@ inline Mat3 Mat3::getInverse() const
 		(*this)(2, 0) *
 		(*this)(2, 0) *
 		cofactor6;
 		cofactor6;
 
 
-	ASSERT(!Math::isZero(det)); // Cannot invert det == 0
+	ANKI_ASSERT(!Math::isZero(det)); // Cannot invert det == 0
 
 
 	// create adjoint matrix and multiply by 1/det to get inverse
 	// create adjoint matrix and multiply by 1/det to get inverse
 	float invDet = 1.0 / det;
 	float invDet = 1.0 / det;

+ 2 - 2
anki/math/Mat4.inl.h

@@ -882,7 +882,7 @@ inline Mat4 Mat4::getInverse() const
 	det = (*this)(0, 0) * m4(0, 0) + (*this)(1, 0) * m4(0, 1) +
 	det = (*this)(0, 0) * m4(0, 0) + (*this)(1, 0) * m4(0, 1) +
 		(*this)(2, 0) * m4(0, 2) + (*this)(3, 0) * m4(0, 3);
 		(*this)(2, 0) * m4(0, 2) + (*this)(3, 0) * m4(0, 3);
 
 
-	ASSERT(!Math::isZero(det)); // Cannot invert, det == 0
+	ANKI_ASSERT(!Math::isZero(det)); // Cannot invert, det == 0
 	det = 1.0 / det;
 	det = 1.0 / det;
 	m4 *= det;
 	m4 *= det;
 	return m4;
 	return m4;
@@ -934,7 +934,7 @@ inline Mat4 Mat4::combineTransformations(const Mat4& m0, const Mat4& m1)
 	*/
 	*/
 
 
 	// one of the 2 mat4 doesnt represent transformation
 	// one of the 2 mat4 doesnt represent transformation
-	ASSERT(Math::isZero(m0(3, 0) + m0(3, 1) + m0(3, 2) + m0(3, 3)-1.0) &&
+	ANKI_ASSERT(Math::isZero(m0(3, 0) + m0(3, 1) + m0(3, 2) + m0(3, 3)-1.0) &&
 		Math::isZero(m1(3, 0) + m1(3, 1) + m1(3, 2) + m1(3, 3)-1.0));
 		Math::isZero(m1(3, 0) + m1(3, 1) + m1(3, 2) + m1(3, 3)-1.0));
 
 
 	Mat4 m4;
 	Mat4 m4;

+ 1 - 1
anki/math/Quat.inl.h

@@ -312,7 +312,7 @@ inline Quat Quat::getInverted() const
 {
 {
 	float norm = w() * w() + x() * x() + y() * y() + z() * z();
 	float norm = w() * w() + x() * x() + y() * y() + z() * z();
 
 
-	ASSERT(!Math::isZero(norm)); // Norm is zero
+	ANKI_ASSERT(!Math::isZero(norm)); // Norm is zero
 
 
 	float normi = 1.0 / norm;
 	float normi = 1.0 / norm;
 	return Quat(-normi * x(), -normi * y(), -normi * z(), normi * w());
 	return Quat(-normi * x(), -normi * y(), -normi * z(), normi * w());

+ 1 - 1
anki/math/Vec3.inl.h

@@ -391,7 +391,7 @@ inline Vec3 Vec3::getProjection(const Vec3& toThis) const
 // getRotated
 // getRotated
 inline Vec3 Vec3::getRotated(const Quat& q) const
 inline Vec3 Vec3::getRotated(const Quat& q) const
 {
 {
-	ASSERT(Math::isZero(1.0 - q.getLength())); // Not normalized quat
+	ANKI_ASSERT(Math::isZero(1.0 - q.getLength())); // Not normalized quat
 
 
 	/*float vmult = 2.0f*(q.x*x + q.y*y + q.z*z);
 	/*float vmult = 2.0f*(q.x*x + q.y*y + q.z*z);
 	float crossmult = 2.0*q.w;
 	float crossmult = 2.0*q.w;

+ 1 - 1
anki/misc/TestHeader.cpp

@@ -1,4 +1,4 @@
-#include "anki/collision/CollisionAlgorithmsMatrix.h"
+#include "anki/resource/Resource.h"
 
 
 
 
 
 

+ 1 - 1
anki/physics/Character.cpp

@@ -40,7 +40,7 @@ Character::Character(PhysWorld& masterContainer_,
 
 
 	btAxisSweep3* sweepBp =
 	btAxisSweep3* sweepBp =
 		dynamic_cast<btAxisSweep3*>(masterContainer.broadphase);
 		dynamic_cast<btAxisSweep3*>(masterContainer.broadphase);
-	ASSERT(sweepBp != NULL);
+	ANKI_ASSERT(sweepBp != NULL);
 
 
 	ghostPairCallback = new btGhostPairCallback();
 	ghostPairCallback = new btGhostPairCallback();
 	sweepBp->getOverlappingPairCache()->setInternalGhostPairCallback(
 	sweepBp->getOverlappingPairCache()->setInternalGhostPairCallback(

+ 1 - 1
anki/physics/RigidBody.cpp

@@ -29,7 +29,7 @@ RigidBody::RigidBody(PhysWorld& masterContainer_,
 		btVector3(0.0, 0.0, 0.0))), // dummy init
 		btVector3(0.0, 0.0, 0.0))), // dummy init
 	masterContainer(masterContainer_)
 	masterContainer(masterContainer_)
 {
 {
-	ASSERT(init.shape != NULL &&
+	ANKI_ASSERT(init.shape != NULL &&
 		init.shape->getShapeType() != INVALID_SHAPE_PROXYTYPE);
 		init.shape->getShapeType() != INVALID_SHAPE_PROXYTYPE);
 
 
 	bool isDynamic = (init.mass != 0.0);
 	bool isDynamic = (init.mass != 0.0);

+ 4 - 4
anki/renderer/Bl.cpp

@@ -47,7 +47,7 @@ void Bl::init(const RendererInitializer& initializer)
 			"post-processing stage FBO: " + e.what());
 			"post-processing stage FBO: " + e.what());
 	}
 	}
 
 
-	hBlurSProg.loadRsrc(ShaderProgram::createSrcCodeToCache(
+	hBlurSProg.load(ShaderProgram::createSrcCodeToCache(
 		"shaders/PpsBlurGeneric.glsl", "#define HPASS\n").c_str());
 		"shaders/PpsBlurGeneric.glsl", "#define HPASS\n").c_str());
 
 
 	// Vertical
 	// Vertical
@@ -65,7 +65,7 @@ void Bl::init(const RendererInitializer& initializer)
 			"post-processing stage FBO: " + e.what());
 			"post-processing stage FBO: " + e.what());
 	}
 	}
 
 
-	vBlurSProg.loadRsrc(ShaderProgram::createSrcCodeToCache(
+	vBlurSProg.load(ShaderProgram::createSrcCodeToCache(
 		"shaders/PpsBlurGeneric.glsl", "#define VPASS\n").c_str());
 		"shaders/PpsBlurGeneric.glsl", "#define VPASS\n").c_str());
 
 
 	// Side blur
 	// Side blur
@@ -84,8 +84,8 @@ void Bl::init(const RendererInitializer& initializer)
 			e.what());
 			e.what());
 	}
 	}
 
 
-	sideBlurMap.loadRsrc("engine-rsrc/side-blur.png");
-	sideBlurSProg.loadRsrc("shaders/PpsSideBlur.glsl");
+	sideBlurMap.load("engine-rsrc/side-blur.png");
+	sideBlurSProg.load("shaders/PpsSideBlur.glsl");
 }
 }
 
 
 
 

+ 5 - 5
anki/renderer/Bl.h

@@ -3,7 +3,7 @@
 
 
 #include "anki/renderer/RenderingPass.h"
 #include "anki/renderer/RenderingPass.h"
 #include "anki/resource/Texture.h"
 #include "anki/resource/Texture.h"
-#include "anki/resource/RsrcPtr.h"
+#include "anki/resource/Resource.h"
 #include "anki/gl/Fbo.h"
 #include "anki/gl/Fbo.h"
 
 
 
 
@@ -55,12 +55,12 @@ class Bl: public SwitchableRenderingPass
 		Fbo vBlurFbo; ///< Fbo that writes to postPassSProg
 		Fbo vBlurFbo; ///< Fbo that writes to postPassSProg
 		Fbo sideBlurFbo;
 		Fbo sideBlurFbo;
 
 
-		RsrcPtr<ShaderProgram> hBlurSProg;
-		RsrcPtr<ShaderProgram> vBlurSProg;
-		RsrcPtr<ShaderProgram> sideBlurSProg;
+		ShaderProgramResourcePointer hBlurSProg;
+		ShaderProgramResourcePointer vBlurSProg;
+		ShaderProgramResourcePointer sideBlurSProg;
 
 
 		Texture blurFai; ///< Temp FAI for blurring
 		Texture blurFai; ///< Temp FAI for blurring
-		RsrcPtr<Texture> sideBlurMap;
+		TextureResourcePointer sideBlurMap;
 
 
 		uint blurringIterationsNum;
 		uint blurringIterationsNum;
 		float sideBlurFactor;
 		float sideBlurFactor;

+ 1 - 1
anki/renderer/Bs.cpp

@@ -84,7 +84,7 @@ void Bs::init(const RendererInitializer& /*initializer*/)
 	Renderer::createFai(r.getWidth(), r.getHeight(), GL_RGBA8, GL_RGBA,
 	Renderer::createFai(r.getWidth(), r.getHeight(), GL_RGBA8, GL_RGBA,
 		GL_FLOAT, refractFai);
 		GL_FLOAT, refractFai);
 	createRefractFbo();
 	createRefractFbo();
-	refractSProg.loadRsrc("shaders/BsRefract.glsl");
+	refractSProg.load("shaders/BsRefract.glsl");
 }
 }
 
 
 
 

+ 2 - 2
anki/renderer/Bs.h

@@ -3,7 +3,7 @@
 
 
 #include "anki/renderer/RenderingPass.h"
 #include "anki/renderer/RenderingPass.h"
 #include "anki/gl/Fbo.h"
 #include "anki/gl/Fbo.h"
-#include "anki/resource/RsrcPtr.h"
+#include "anki/resource/Resource.h"
 #include "anki/resource/Texture.h"
 #include "anki/resource/Texture.h"
 
 
 
 
@@ -27,7 +27,7 @@ class Bs: public RenderingPass
 	private:
 	private:
 		Fbo fbo; ///< Writes to Pps::prePassFai
 		Fbo fbo; ///< Writes to Pps::prePassFai
 		Fbo refractFbo; ///< Writes to refractFai
 		Fbo refractFbo; ///< Writes to refractFai
-		RsrcPtr<ShaderProgram> refractSProg;
+		ShaderProgramResourcePointer refractSProg;
 		Texture refractFai;
 		Texture refractFai;
 
 
 		void createFbo();
 		void createFbo();

+ 3 - 3
anki/renderer/CollisionDbgDrawer.h

@@ -25,21 +25,21 @@ class CollisionDbgDrawer: public CollisionShape::ConstVisitor
 
 
 		void visit(const LineSegment&)
 		void visit(const LineSegment&)
 		{
 		{
-			ASSERT(0 && "ToDo");
+			ANKI_ASSERT(0 && "ToDo");
 		}
 		}
 
 
 		void visit(const Obb&);
 		void visit(const Obb&);
 
 
 		void visit(const PerspectiveCameraShape&)
 		void visit(const PerspectiveCameraShape&)
 		{
 		{
-			ASSERT(0 && "ToDo");
+			ANKI_ASSERT(0 && "ToDo");
 		}
 		}
 
 
 		void visit(const Plane&);
 		void visit(const Plane&);
 
 
 		void visit(const Ray&)
 		void visit(const Ray&)
 		{
 		{
-			ASSERT(0 && "ToDo");
+			ANKI_ASSERT(0 && "ToDo");
 		}
 		}
 
 
 		void visit(const Sphere&);
 		void visit(const Sphere&);

+ 4 - 4
anki/renderer/Dbg.cpp

@@ -232,7 +232,7 @@ void Dbg::init(const RendererInitializer& initializer)
 	//
 	//
 	// Shader prog
 	// Shader prog
 	//
 	//
-	sProg.loadRsrc("shaders/Dbg.glsl");
+	sProg.load("shaders/Dbg.glsl");
 
 
 	//
 	//
 	// VAO & VBOs
 	// VAO & VBOs
@@ -407,7 +407,7 @@ void Dbg::run()
 //==============================================================================
 //==============================================================================
 void Dbg::setModelMat(const Mat4& modelMat_)
 void Dbg::setModelMat(const Mat4& modelMat_)
 {
 {
-	ASSERT(pointIndex == 0); // This means that the func called after begin
+	ANKI_ASSERT(pointIndex == 0); // This means that the func called after begin
 	                         // and before end
 	                         // and before end
 	modelMat = modelMat_;
 	modelMat = modelMat_;
 }
 }
@@ -418,7 +418,7 @@ void Dbg::setModelMat(const Mat4& modelMat_)
 //==============================================================================
 //==============================================================================
 void Dbg::begin()
 void Dbg::begin()
 {
 {
-	ASSERT(pointIndex == 0);
+	ANKI_ASSERT(pointIndex == 0);
 }
 }
 
 
 
 
@@ -427,7 +427,7 @@ void Dbg::begin()
 //==============================================================================
 //==============================================================================
 void Dbg::end()
 void Dbg::end()
 {
 {
-	ASSERT(pointIndex != 0);
+	ANKI_ASSERT(pointIndex != 0);
 
 
 	positionsVbo.write(&positions[0], 0, sizeof(Vec3) * pointIndex);
 	positionsVbo.write(&positions[0], 0, sizeof(Vec3) * pointIndex);
 	colorsVbo.write(&colors[0], 0, sizeof(Vec3) * pointIndex);
 	colorsVbo.write(&colors[0], 0, sizeof(Vec3) * pointIndex);

+ 2 - 2
anki/renderer/Dbg.h

@@ -6,7 +6,7 @@
 #include "anki/renderer/RenderingPass.h"
 #include "anki/renderer/RenderingPass.h"
 #include "anki/gl/Fbo.h"
 #include "anki/gl/Fbo.h"
 #include "anki/resource/ShaderProgram.h"
 #include "anki/resource/ShaderProgram.h"
-#include "anki/resource/RsrcPtr.h"
+#include "anki/resource/Resource.h"
 #include "anki/math/Math.h"
 #include "anki/math/Math.h"
 #include "anki/gl/Vbo.h"
 #include "anki/gl/Vbo.h"
 #include "anki/gl/Vao.h"
 #include "anki/gl/Vao.h"
@@ -66,7 +66,7 @@ class Dbg: public SwitchableRenderingPass
 		bool showCamerasEnabled;
 		bool showCamerasEnabled;
 		bool showVisibilityBoundingShapesFlag;
 		bool showVisibilityBoundingShapesFlag;
 		Fbo fbo;
 		Fbo fbo;
-		RsrcPtr<ShaderProgram> sProg;
+		ShaderProgramResourcePointer sProg;
 		static const uint MAX_POINTS_PER_DRAW = 256;
 		static const uint MAX_POINTS_PER_DRAW = 256;
 		boost::array<Vec3, MAX_POINTS_PER_DRAW> positions;
 		boost::array<Vec3, MAX_POINTS_PER_DRAW> positions;
 		boost::array<Vec3, MAX_POINTS_PER_DRAW> colors;
 		boost::array<Vec3, MAX_POINTS_PER_DRAW> colors;

+ 5 - 5
anki/renderer/Deformer.cpp

@@ -32,8 +32,8 @@ void Deformer::init()
 	//
 	//
 	// Load the shaders
 	// Load the shaders
 	//
 	//
-	tfHwSkinningAllSProg.loadRsrc("shaders/TfHwSkinningPosNormTan.glsl");
-	tfHwSkinningPosSProg.loadRsrc("shaders/TfHwSkinningPos.glsl");
+	tfHwSkinningAllSProg.load("shaders/TfHwSkinningPosNormTan.glsl");
+	tfHwSkinningPosSProg.load("shaders/TfHwSkinningPos.glsl");
 }
 }
 
 
 
 
@@ -42,10 +42,10 @@ void Deformer::init()
 //==============================================================================
 //==============================================================================
 void Deformer::deform(SkinPatchNode& node) const
 void Deformer::deform(SkinPatchNode& node) const
 {
 {
-	ASSERT(node.getParent() != NULL); // The SkinPatchNodes always have parent
-	ASSERT(node.getParent()->getSceneNodeType() ==
+	ANKI_ASSERT(node.getParent() != NULL); // The SkinPatchNodes always have parent
+	ANKI_ASSERT(node.getParent()->getSceneNodeType() ==
 		SceneNode::SNT_SKIN_NODE); // And their parent must be SkinNode
 		SceneNode::SNT_SKIN_NODE); // And their parent must be SkinNode
-	ASSERT(node.isFlagEnabled(SceneNode::SNF_VISIBLE)); // And it should be
+	ANKI_ASSERT(node.isFlagEnabled(SceneNode::SNF_VISIBLE)); // And it should be
 	                                                    // visible
 	                                                    // visible
 
 
 	SkinNode* skinNode = static_cast<SkinNode*>(node.getParent());
 	SkinNode* skinNode = static_cast<SkinNode*>(node.getParent());

+ 3 - 3
anki/renderer/Deformer.h

@@ -1,7 +1,7 @@
 #ifndef ANKI_RENDERER_DEFORMER_H
 #ifndef ANKI_RENDERER_DEFORMER_H
 #define ANKI_RENDERER_DEFORMER_H
 #define ANKI_RENDERER_DEFORMER_H
 
 
-#include "anki/resource/RsrcPtr.h"
+#include "anki/resource/Resource.h"
 
 
 
 
 namespace anki {
 namespace anki {
@@ -24,8 +24,8 @@ class Deformer
 
 
 	private:
 	private:
 		const MainRenderer& mainR; ///< Know your father
 		const MainRenderer& mainR; ///< Know your father
-		RsrcPtr<ShaderProgram> tfHwSkinningAllSProg;
-		RsrcPtr<ShaderProgram> tfHwSkinningPosSProg;
+		ShaderProgramResourcePointer tfHwSkinningAllSProg;
+		ShaderProgramResourcePointer tfHwSkinningPosSProg;
 
 
 		void init();
 		void init();
 };
 };

+ 3 - 3
anki/renderer/Hdr.cpp

@@ -85,16 +85,16 @@ void Hdr::init(const RendererInitializer& initializer)
 
 
 
 
 	// init shaders
 	// init shaders
-	toneSProg.loadRsrc("shaders/PpsHdr.glsl");
+	toneSProg.load("shaders/PpsHdr.glsl");
 
 
 	const char* SHADER_FILENAME = "shaders/GaussianBlurGeneric.glsl";
 	const char* SHADER_FILENAME = "shaders/GaussianBlurGeneric.glsl";
 
 
 	std::string pps = "#define HPASS\n#define COL_RGB\n";
 	std::string pps = "#define HPASS\n#define COL_RGB\n";
-	hblurSProg.loadRsrc(ShaderProgram::createSrcCodeToCache(SHADER_FILENAME,
+	hblurSProg.load(ShaderProgram::createSrcCodeToCache(SHADER_FILENAME,
 		pps.c_str()).c_str());
 		pps.c_str()).c_str());
 
 
 	pps = "#define VPASS\n#define COL_RGB\n";
 	pps = "#define VPASS\n#define COL_RGB\n";
-	vblurSProg.loadRsrc(ShaderProgram::createSrcCodeToCache(SHADER_FILENAME,
+	vblurSProg.load(ShaderProgram::createSrcCodeToCache(SHADER_FILENAME,
 		pps.c_str()).c_str());
 		pps.c_str()).c_str());
 }
 }
 
 

+ 4 - 4
anki/renderer/Hdr.h

@@ -4,7 +4,7 @@
 #include "anki/renderer/RenderingPass.h"
 #include "anki/renderer/RenderingPass.h"
 #include "anki/gl/Fbo.h"
 #include "anki/gl/Fbo.h"
 #include "anki/resource/Texture.h"
 #include "anki/resource/Texture.h"
-#include "anki/resource/RsrcPtr.h"
+#include "anki/resource/Resource.h"
 
 
 
 
 namespace anki {
 namespace anki {
@@ -92,9 +92,9 @@ class Hdr: public SwitchableRenderingPass
 		Fbo toneFbo;
 		Fbo toneFbo;
 		Fbo hblurFbo;
 		Fbo hblurFbo;
 		Fbo vblurFbo;
 		Fbo vblurFbo;
-		RsrcPtr<ShaderProgram> toneSProg;
-		RsrcPtr<ShaderProgram> hblurSProg;
-		RsrcPtr<ShaderProgram> vblurSProg;
+		ShaderProgramResourcePointer toneSProg;
+		ShaderProgramResourcePointer hblurSProg;
+		ShaderProgramResourcePointer vblurSProg;
 		Texture toneFai; ///< Vertical blur pass FAI
 		Texture toneFai; ///< Vertical blur pass FAI
 		Texture hblurFai; ///< pass0Fai with the horizontal blur FAI
 		Texture hblurFai; ///< pass0Fai with the horizontal blur FAI
 		Texture fai; ///< The final FAI
 		Texture fai; ///< The final FAI

+ 4 - 4
anki/renderer/Is.cpp

@@ -114,14 +114,14 @@ void Is::init(const RendererInitializer& initializer)
 	sm.init(initializer);
 	sm.init(initializer);
 
 
 	// load the shaders
 	// load the shaders
-	ambientPassSProg.loadRsrc("shaders/IsAp.glsl");
+	ambientPassSProg.load("shaders/IsAp.glsl");
 
 
 	// point light
 	// point light
-	pointLightSProg.loadRsrc(ShaderProgram::createSrcCodeToCache(
+	pointLightSProg.load(ShaderProgram::createSrcCodeToCache(
 		"shaders/IsLpGeneric.glsl", "#define POINT_LIGHT_ENABLED\n").c_str());
 		"shaders/IsLpGeneric.glsl", "#define POINT_LIGHT_ENABLED\n").c_str());
 
 
 	// spot light no shadow
 	// spot light no shadow
-	spotLightNoShadowSProg.loadRsrc(ShaderProgram::createSrcCodeToCache(
+	spotLightNoShadowSProg.load(ShaderProgram::createSrcCodeToCache(
 		"shaders/IsLpGeneric.glsl", "#define SPOT_LIGHT_ENABLED\n").c_str());
 		"shaders/IsLpGeneric.glsl", "#define SPOT_LIGHT_ENABLED\n").c_str());
 
 
 	// spot light w/t shadow
 	// spot light w/t shadow
@@ -131,7 +131,7 @@ void Is::init(const RendererInitializer& initializer)
 	{
 	{
 		pps += "#define PCF_ENABLED\n";
 		pps += "#define PCF_ENABLED\n";
 	}
 	}
-	spotLightShadowSProg.loadRsrc(ShaderProgram::createSrcCodeToCache(
+	spotLightShadowSProg.load(ShaderProgram::createSrcCodeToCache(
 		"shaders/IsLpGeneric.glsl", pps.c_str()).c_str());
 		"shaders/IsLpGeneric.glsl", pps.c_str()).c_str());
 
 
 	// init the rest
 	// init the rest

+ 5 - 5
anki/renderer/Is.h

@@ -4,7 +4,7 @@
 #include "anki/renderer/RenderingPass.h"
 #include "anki/renderer/RenderingPass.h"
 #include "anki/gl/Fbo.h"
 #include "anki/gl/Fbo.h"
 #include "anki/resource/Texture.h"
 #include "anki/resource/Texture.h"
-#include "anki/resource/RsrcPtr.h"
+#include "anki/resource/Resource.h"
 #include "anki/resource/ShaderProgram.h"
 #include "anki/resource/ShaderProgram.h"
 #include "anki/math/Math.h"
 #include "anki/math/Math.h"
 #include "anki/gl/Vbo.h"
 #include "anki/gl/Vbo.h"
@@ -46,13 +46,13 @@ class Is: private RenderingPass
 		Fbo readFbo;
 		Fbo readFbo;
 		Fbo writeFbo;
 		Fbo writeFbo;
 		/// Illumination stage ambient pass shader program
 		/// Illumination stage ambient pass shader program
-		RsrcPtr<ShaderProgram> ambientPassSProg;
+		ShaderProgramResourcePointer ambientPassSProg;
 		/// Illumination stage point light shader program
 		/// Illumination stage point light shader program
-		RsrcPtr<ShaderProgram> pointLightSProg;
+		ShaderProgramResourcePointer pointLightSProg;
 		/// Illumination stage spot light w/o shadow shader program
 		/// Illumination stage spot light w/o shadow shader program
-		RsrcPtr<ShaderProgram> spotLightNoShadowSProg;
+		ShaderProgramResourcePointer spotLightNoShadowSProg;
 		/// Illumination stage spot light w/ shadow shader program
 		/// Illumination stage spot light w/ shadow shader program
-		RsrcPtr<ShaderProgram> spotLightShadowSProg;
+		ShaderProgramResourcePointer spotLightShadowSProg;
 
 
 		/// The ambient pass
 		/// The ambient pass
 		void ambientPass(const Vec3& color);
 		void ambientPass(const Vec3& color);

+ 1 - 1
anki/renderer/MainRenderer.cpp

@@ -41,7 +41,7 @@ void MainRenderer::init(const RendererInitializer& initializer_)
 	ANKI_INFO("Initializing main renderer...");
 	ANKI_INFO("Initializing main renderer...");
 	initGl();
 	initGl();
 
 
-	sProg.loadRsrc("shaders/Final.glsl");
+	sProg.load("shaders/Final.glsl");
 
 
 	dbgTq.reset(new TimeQuery);
 	dbgTq.reset(new TimeQuery);
 
 

+ 1 - 1
anki/renderer/MainRenderer.h

@@ -81,7 +81,7 @@ class MainRenderer: public Renderer
 		boost::scoped_ptr<TimeQuery> dbgTq;
 		boost::scoped_ptr<TimeQuery> dbgTq;
 		/// @}
 		/// @}
 
 
-		RsrcPtr<ShaderProgram> sProg; ///< Final pass' shader program
+		ShaderProgramResourcePointer sProg; ///< Final pass' shader program
 		int screenshotJpegQuality; ///< The quality of the JPEG screenshots.
 		int screenshotJpegQuality; ///< The quality of the JPEG screenshots.
 		                           ///< From 0 to 100
 		                           ///< From 0 to 100
 
 

+ 2 - 2
anki/renderer/Pps.cpp

@@ -64,7 +64,7 @@ void Pps::init(const RendererInitializer& initializer)
 		pps += "#define SSAO_ENABLED\n";
 		pps += "#define SSAO_ENABLED\n";
 	}
 	}
 
 
-	prePassSProg.loadRsrc(ShaderProgram::createSrcCodeToCache(
+	prePassSProg.load(ShaderProgram::createSrcCodeToCache(
 		"shaders/PpsPrePass.glsl", pps.c_str()).c_str());
 		"shaders/PpsPrePass.glsl", pps.c_str()).c_str());
 
 
 	//
 	//
@@ -98,7 +98,7 @@ void Pps::init(const RendererInitializer& initializer)
 		pps += "#define HDR_ENABLED\n";
 		pps += "#define HDR_ENABLED\n";
 	}
 	}
 
 
-	postPassSProg.loadRsrc(ShaderProgram::createSrcCodeToCache(
+	postPassSProg.load(ShaderProgram::createSrcCodeToCache(
 		"shaders/PpsPostPass.glsl", pps.c_str()).c_str());
 		"shaders/PpsPostPass.glsl", pps.c_str()).c_str());
 
 
 	//
 	//

+ 3 - 3
anki/renderer/Pps.h

@@ -4,7 +4,7 @@
 #include "anki/renderer/RenderingPass.h"
 #include "anki/renderer/RenderingPass.h"
 #include "anki/gl/Fbo.h"
 #include "anki/gl/Fbo.h"
 #include "anki/resource/Texture.h"
 #include "anki/resource/Texture.h"
-#include "anki/resource/RsrcPtr.h"
+#include "anki/resource/Resource.h"
 #include "anki/renderer/Hdr.h"
 #include "anki/renderer/Hdr.h"
 #include "anki/renderer/Ssao.h"
 #include "anki/renderer/Ssao.h"
 #include "anki/renderer/Bl.h"
 #include "anki/renderer/Bl.h"
@@ -76,8 +76,8 @@ class Pps: private RenderingPass
 		Fbo prePassFbo;
 		Fbo prePassFbo;
 		Fbo postPassFbo;
 		Fbo postPassFbo;
 
 
-		RsrcPtr<ShaderProgram> prePassSProg;
-		RsrcPtr<ShaderProgram> postPassSProg;
+		ShaderProgramResourcePointer prePassSProg;
+		ShaderProgramResourcePointer postPassSProg;
 
 
 		Texture prePassFai; ///< FAI #1
 		Texture prePassFai; ///< FAI #1
 		Texture postPassFai; ///< FAI #2
 		Texture postPassFai; ///< FAI #2

+ 1 - 1
anki/renderer/Renderer.cpp

@@ -87,7 +87,7 @@ void Renderer::render(Camera& cam_)
 	//
 	//
 	calcPlanes(Vec2(cam->getZNear(), cam->getZFar()), planes);
 	calcPlanes(Vec2(cam->getZNear(), cam->getZFar()), planes);
 
 
-	ASSERT(cam->getCameraType() == Camera::CT_PERSPECTIVE);
+	ANKI_ASSERT(cam->getCameraType() == Camera::CT_PERSPECTIVE);
 	const PerspectiveCamera& pcam = static_cast<const PerspectiveCamera&>(*cam);
 	const PerspectiveCamera& pcam = static_cast<const PerspectiveCamera&>(*cam);
 	calcLimitsOfNearPlane(pcam, limitsOfNearPlane);
 	calcLimitsOfNearPlane(pcam, limitsOfNearPlane);
 	limitsOfNearPlane2 = limitsOfNearPlane * 2.0;
 	limitsOfNearPlane2 = limitsOfNearPlane * 2.0;

+ 1 - 1
anki/renderer/Renderer.h

@@ -7,7 +7,7 @@
 #include "anki/resource/ShaderProgram.h"
 #include "anki/resource/ShaderProgram.h"
 #include "anki/gl/Vbo.h"
 #include "anki/gl/Vbo.h"
 #include "anki/gl/Vao.h"
 #include "anki/gl/Vao.h"
-#include "anki/resource/RsrcPtr.h"
+#include "anki/resource/Resource.h"
 #include "anki/renderer/Ms.h"
 #include "anki/renderer/Ms.h"
 #include "anki/renderer/Is.h"
 #include "anki/renderer/Is.h"
 #include "anki/renderer/Pps.h"
 #include "anki/renderer/Pps.h"

+ 1 - 1
anki/renderer/SceneDbgDrawer.cpp

@@ -34,7 +34,7 @@ void SceneDbgDrawer::drawCamera(const Camera& cam) const
 		}
 		}
 
 
 		default:
 		default:
-			ASSERT(false && "WTF?");
+			ANKI_ASSERT(false && "WTF?");
 			break;
 			break;
 	}
 	}
 }
 }

+ 2 - 2
anki/renderer/SceneDrawer.cpp

@@ -38,9 +38,9 @@ void SceneDrawer::UsrDefVarVisitor::operator()(const Type& x) const
 }
 }
 
 
 
 
-void SceneDrawer::UsrDefVarVisitor::operator()(const RsrcPtr<Texture>* x) const
+void SceneDrawer::UsrDefVarVisitor::operator()(const TextureResourcePointer* x) const
 {
 {
-	const RsrcPtr<Texture>& texPtr = *x;
+	const TextureResourcePointer& texPtr = *x;
 	texPtr->setRepeat(true);
 	texPtr->setRepeat(true);
 	udvr.getMaterialUserVariable().getShaderProgramUniformVariable(pt).
 	udvr.getMaterialUserVariable().getShaderProgramUniformVariable(pt).
 		set(*texPtr, texUnit);
 		set(*texPtr, texUnit);

+ 2 - 2
anki/renderer/SceneDrawer.h

@@ -3,7 +3,7 @@
 
 
 #include "anki/math/Math.h"
 #include "anki/math/Math.h"
 #include "anki/resource/MaterialCommon.h"
 #include "anki/resource/MaterialCommon.h"
-#include "anki/resource/RsrcPtr.h"
+#include "anki/resource/Resource.h"
 #include <boost/variant.hpp>
 #include <boost/variant.hpp>
 
 
 
 
@@ -49,7 +49,7 @@ class SceneDrawer
 				void operator()(const Type& x) const;
 				void operator()(const Type& x) const;
 
 
 				/// Functor
 				/// Functor
-				void operator()(const RsrcPtr<Texture>* x) const;
+				void operator()(const TextureResourcePointer* x) const;
 		};
 		};
 
 
 		const Renderer& r; ///< Keep it here cause the class wants a few stuff
 		const Renderer& r; ///< Keep it here cause the class wants a few stuff

+ 2 - 2
anki/renderer/Sm.cpp

@@ -109,7 +109,7 @@ void Sm::run(const Light& light, float distance)
 		return;
 		return;
 	}
 	}
 
 
-	ASSERT(light.getVisibleMsRenderableNodes().size() > 0);
+	ANKI_ASSERT(light.getVisibleMsRenderableNodes().size() > 0);
 
 
 	//
 	//
 	// Determine the level
 	// Determine the level
@@ -159,7 +159,7 @@ void Sm::run(const Light& light, float distance)
 			}
 			}
 
 
 			default:
 			default:
-				ASSERT(0);
+				ANKI_ASSERT(0);
 		}
 		}
 	}
 	}
 
 

+ 5 - 5
anki/renderer/Smo.cpp

@@ -42,14 +42,14 @@ Smo::~Smo()
 //==============================================================================
 //==============================================================================
 void Smo::init(const RendererInitializer& /*initializer*/)
 void Smo::init(const RendererInitializer& /*initializer*/)
 {
 {
-	sProg.loadRsrc("shaders/IsSmo.glsl");
+	sProg.load("shaders/IsSmo.glsl");
 
 
 	//
 	//
 	// Geometry stuff
 	// Geometry stuff
 	//
 	//
 
 
 	// Sphere
 	// Sphere
-	sphereGeom.mesh.loadRsrc("engine-rsrc/sphere.mesh");
+	sphereGeom.mesh.load("engine-rsrc/sphere.mesh");
 	sphereGeom.vao.create();
 	sphereGeom.vao.create();
 	sphereGeom.vao.attachArrayBufferVbo(
 	sphereGeom.vao.attachArrayBufferVbo(
 		sphereGeom.mesh->getVbo(Mesh::VBO_VERT_POSITIONS),
 		sphereGeom.mesh->getVbo(Mesh::VBO_VERT_POSITIONS),
@@ -70,11 +70,11 @@ void Smo::initCamGeom()
 {
 {
 	boost::array<const char*, Camera::CT_NUM> files = {{
 	boost::array<const char*, Camera::CT_NUM> files = {{
 		"engine-rsrc/pyramid.mesh", "engine-rsrc/cube.mesh"}};
 		"engine-rsrc/pyramid.mesh", "engine-rsrc/cube.mesh"}};
-	ASSERT(Camera::CT_PERSPECTIVE == 0);
+	ANKI_ASSERT(Camera::CT_PERSPECTIVE == 0);
 
 
 	for(uint i = 0; i < Camera::CT_NUM; i++)
 	for(uint i = 0; i < Camera::CT_NUM; i++)
 	{
 	{
-		camGeom[i].mesh.loadRsrc(files[i]);
+		camGeom[i].mesh.load(files[i]);
 		camGeom[i].vao.create();
 		camGeom[i].vao.create();
 		camGeom[i].vao.attachArrayBufferVbo(
 		camGeom[i].vao.attachArrayBufferVbo(
 			camGeom[i].mesh->getVbo(Mesh::VBO_VERT_POSITIONS),
 			camGeom[i].mesh->getVbo(Mesh::VBO_VERT_POSITIONS),
@@ -219,7 +219,7 @@ void Smo::run(const SpotLight& light)
 		}
 		}
 
 
 		case Camera::CT_NUM:
 		case Camera::CT_NUM:
-			ASSERT(false && "WTF?");
+			ANKI_ASSERT(false && "WTF?");
 			break;
 			break;
 	}
 	}
 
 

+ 3 - 3
anki/renderer/Smo.h

@@ -4,7 +4,7 @@
 #include "anki/renderer/RenderingPass.h"
 #include "anki/renderer/RenderingPass.h"
 #include "anki/gl/Fbo.h"
 #include "anki/gl/Fbo.h"
 #include "anki/resource/ShaderProgram.h"
 #include "anki/resource/ShaderProgram.h"
-#include "anki/resource/RsrcPtr.h"
+#include "anki/resource/Resource.h"
 #include "anki/gl/Vbo.h"
 #include "anki/gl/Vbo.h"
 #include "anki/gl/Vao.h"
 #include "anki/gl/Vao.h"
 #include "anki/scene/Camera.h"
 #include "anki/scene/Camera.h"
@@ -37,7 +37,7 @@ class Smo: public RenderingPass
 			Geom();
 			Geom();
 			~Geom();
 			~Geom();
 
 
-			RsrcPtr<Mesh> mesh;
+			MeshResourcePointer mesh;
 			Vao vao;
 			Vao vao;
 		};
 		};
 
 
@@ -47,7 +47,7 @@ class Smo: public RenderingPass
 		/// pyramid, see the blend file with the vertex positions
 		/// pyramid, see the blend file with the vertex positions
 		boost::array<Geom, Camera::CT_NUM> camGeom;
 		boost::array<Geom, Camera::CT_NUM> camGeom;
 
 
-		RsrcPtr<ShaderProgram> sProg;
+		ShaderProgramResourcePointer sProg;
 
 
 		void initCamGeom();
 		void initCamGeom();
 
 

+ 4 - 4
anki/renderer/Ssao.cpp

@@ -72,18 +72,18 @@ void Ssao::init(const RendererInitializer& initializer)
 	//
 	//
 
 
 	// first pass prog
 	// first pass prog
-	ssaoSProg.loadRsrc("shaders/PpsSsao.glsl");
+	ssaoSProg.load("shaders/PpsSsao.glsl");
 
 
 	// blurring progs
 	// blurring progs
 	const char* SHADER_FILENAME = "shaders/GaussianBlurGeneric.glsl";
 	const char* SHADER_FILENAME = "shaders/GaussianBlurGeneric.glsl";
 
 
 	std::string pps = "#define HPASS\n#define COL_R\n";
 	std::string pps = "#define HPASS\n#define COL_R\n";
-	hblurSProg.loadRsrc(
+	hblurSProg.load(
 		ShaderProgram::createSrcCodeToCache(SHADER_FILENAME, 
 		ShaderProgram::createSrcCodeToCache(SHADER_FILENAME, 
 		pps.c_str()).c_str());
 		pps.c_str()).c_str());
 
 
 	pps = "#define VPASS\n#define COL_R\n";
 	pps = "#define VPASS\n#define COL_R\n";
-	vblurSProg.loadRsrc(
+	vblurSProg.load(
 		ShaderProgram::createSrcCodeToCache(SHADER_FILENAME, 
 		ShaderProgram::createSrcCodeToCache(SHADER_FILENAME, 
 		pps.c_str()).c_str());
 		pps.c_str()).c_str());
 
 
@@ -91,7 +91,7 @@ void Ssao::init(const RendererInitializer& initializer)
 	// noise map
 	// noise map
 	//
 	//
 
 
-	noiseMap.loadRsrc("engine-rsrc/noise.png");
+	noiseMap.load("engine-rsrc/noise.png");
 	noiseMap->setRepeat(true);
 	noiseMap->setRepeat(true);
 }
 }
 
 

+ 5 - 5
anki/renderer/Ssao.h

@@ -5,7 +5,7 @@
 #include "anki/gl/Fbo.h"
 #include "anki/gl/Fbo.h"
 #include "anki/resource/Texture.h"
 #include "anki/resource/Texture.h"
 #include "anki/resource/ShaderProgram.h"
 #include "anki/resource/ShaderProgram.h"
-#include "anki/resource/RsrcPtr.h"
+#include "anki/resource/Resource.h"
 #include "anki/gl/Vbo.h"
 #include "anki/gl/Vbo.h"
 #include "anki/gl/Vao.h"
 #include "anki/gl/Vao.h"
 
 
@@ -51,10 +51,10 @@ class Ssao: public SwitchableRenderingPass
 		Fbo ssaoFbo;
 		Fbo ssaoFbo;
 		Fbo hblurFbo;
 		Fbo hblurFbo;
 		Fbo vblurFbo;
 		Fbo vblurFbo;
-		RsrcPtr<Texture> noiseMap;
-		RsrcPtr<ShaderProgram> ssaoSProg;
-		RsrcPtr<ShaderProgram> hblurSProg;
-		RsrcPtr<ShaderProgram> vblurSProg;
+		TextureResourcePointer noiseMap;
+		ShaderProgramResourcePointer ssaoSProg;
+		ShaderProgramResourcePointer hblurSProg;
+		ShaderProgramResourcePointer vblurSProg;
 
 
 		void createFbo(Fbo& fbo, Texture& fai);
 		void createFbo(Fbo& fbo, Texture& fai);
 };
 };

+ 1 - 1
anki/resource/LightRsrc.cpp

@@ -187,7 +187,7 @@ void LightRsrc::load(const char* filename)
 			pt.get_optional<std::string>("texture");
 			pt.get_optional<std::string>("texture");
 		if(tex)
 		if(tex)
 		{
 		{
-			texture.loadRsrc(tex.get().c_str());
+			texture.load(tex.get().c_str());
 
 
 			if(type == LT_POINT)
 			if(type == LT_POINT)
 			{
 			{

+ 3 - 3
anki/resource/LightRsrc.h

@@ -2,7 +2,7 @@
 #define ANKI_RESOURCE_LIGHT_PROPS_H
 #define ANKI_RESOURCE_LIGHT_PROPS_H
 
 
 #include "anki/math/Math.h"
 #include "anki/math/Math.h"
-#include "anki/resource/RsrcPtr.h"
+#include "anki/resource/Resource.h"
 #include "anki/resource/Texture.h"
 #include "anki/resource/Texture.h"
 
 
 
 
@@ -116,13 +116,13 @@ class LightRsrc: private LightProps
 	private:
 	private:
 		LightType type;
 		LightType type;
 		SpotLightCameraType spotLightCameraType;
 		SpotLightCameraType spotLightCameraType;
-		RsrcPtr<Texture> texture;
+		TextureResourcePointer texture;
 };
 };
 
 
 
 
 inline const Texture& LightRsrc::getTexture() const
 inline const Texture& LightRsrc::getTexture() const
 {
 {
-	ASSERT(texture.get() != NULL);
+	ANKI_ASSERT(texture.get() != NULL);
 	return *texture;
 	return *texture;
 }
 }
 
 

+ 3 - 3
anki/resource/Material.cpp

@@ -184,7 +184,7 @@ void Material::parseMaterialTag(const boost::property_tree::ptree& pt)
 
 
 		std::string filename = createShaderProgSourceToCache(src);
 		std::string filename = createShaderProgSourceToCache(src);
 
 
-		sProgs[i].loadRsrc(filename.c_str());
+		sProgs[i].load(filename.c_str());
 	}
 	}
 
 
 	populateVariables(pt.get_child("shaderProgram.inputs"));
 	populateVariables(pt.get_child("shaderProgram.inputs"));
@@ -237,7 +237,7 @@ void Material::populateVariables(const boost::property_tree::ptree& pt)
 	//
 	//
 	std::map<std::string, GLenum> allVarNames;
 	std::map<std::string, GLenum> allVarNames;
 
 
-	BOOST_FOREACH(const RsrcPtr<ShaderProgram>& sProg, sProgs)
+	BOOST_FOREACH(const ShaderProgramResourcePointer& sProg, sProgs)
 	{
 	{
 		BOOST_FOREACH(const ShaderProgramVariable& v, sProg->getVariables())
 		BOOST_FOREACH(const ShaderProgramVariable& v, sProg->getVariables())
 		{
 		{
@@ -326,7 +326,7 @@ void Material::populateVariables(const boost::property_tree::ptree& pt)
 					break;
 					break;
 				// default is error
 				// default is error
 				default:
 				default:
-					ASSERT(0);
+					ANKI_ASSERT(0);
 			}
 			}
 
 
 			mtlVars.push_back(v);
 			mtlVars.push_back(v);

+ 2 - 2
anki/resource/Material.h

@@ -197,7 +197,7 @@ class Material: public MaterialProperties
 		// Nested                                                              =
 		// Nested                                                              =
 		//======================================================================
 		//======================================================================
 
 
-		typedef boost::array<RsrcPtr<ShaderProgram>, PASS_TYPES_NUM>
+		typedef boost::array<ShaderProgramResourcePointer, PASS_TYPES_NUM>
 			ShaderPrograms;
 			ShaderPrograms;
 
 
 		//======================================================================
 		//======================================================================
@@ -237,7 +237,7 @@ class Material: public MaterialProperties
 inline const MaterialBuildinVariable& Material::getBuildinVariable(
 inline const MaterialBuildinVariable& Material::getBuildinVariable(
 	MaterialBuildinVariable::MatchingVariable e) const
 	MaterialBuildinVariable::MatchingVariable e) const
 {
 {
-	ASSERT(buildinVariableExits(e));
+	ANKI_ASSERT(buildinVariableExits(e));
 	return *buildinsArr[e];
 	return *buildinsArr[e];
 }
 }
 
 

+ 1 - 1
anki/resource/MaterialBuildinVariable.cpp

@@ -115,7 +115,7 @@ bool MaterialBuildinVariable::isBuildin(const char* name,
 		MatchingVariableToGlType::const_iterator it2 =
 		MatchingVariableToGlType::const_iterator it2 =
 			matchingVariableToGlType.find(mv);
 			matchingVariableToGlType.find(mv);
 
 
-		ASSERT(it2 != matchingVariableToGlType.end());
+		ANKI_ASSERT(it2 != matchingVariableToGlType.end());
 
 
 		*dataType = it2->second;
 		*dataType = it2->second;
 	}
 	}

+ 1 - 1
anki/resource/MaterialBuildinVariable.h

@@ -87,7 +87,7 @@ class MaterialBuildinVariable: public MaterialVariable
 inline const ShaderProgramUniformVariable&
 inline const ShaderProgramUniformVariable&
 	MaterialBuildinVariable::getShaderProgramUniformVariable(PassType p) const
 	MaterialBuildinVariable::getShaderProgramUniformVariable(PassType p) const
 {
 {
-	ASSERT(getShaderProgramVariable(p).getType() ==
+	ANKI_ASSERT(getShaderProgramVariable(p).getType() ==
 		ShaderProgramVariable::T_UNIFORM);
 		ShaderProgramVariable::T_UNIFORM);
 	return static_cast<const ShaderProgramUniformVariable&>(
 	return static_cast<const ShaderProgramUniformVariable&>(
 		getShaderProgramVariable(p));
 		getShaderProgramVariable(p));

+ 12 - 12
anki/resource/MaterialUserVariable.cpp

@@ -15,8 +15,8 @@ MaterialUserVariable::MaterialUserVariable(
 	float val)
 	float val)
 :	MaterialVariable(T_USER, shaderProgVarName, shaderProgsArr)
 :	MaterialVariable(T_USER, shaderProgVarName, shaderProgsArr)
 {
 {
-	ASSERT(getGlDataType() == GL_FLOAT);
-	ASSERT(getShaderProgramVariableType() ==
+	ANKI_ASSERT(getGlDataType() == GL_FLOAT);
+	ANKI_ASSERT(getShaderProgramVariableType() ==
 		ShaderProgramVariable::T_UNIFORM);
 		ShaderProgramVariable::T_UNIFORM);
 	data = val;
 	data = val;
 }
 }
@@ -28,8 +28,8 @@ MaterialUserVariable::MaterialUserVariable(
 	const Vec2& val)
 	const Vec2& val)
 :	MaterialVariable(T_USER, shaderProgVarName, shaderProgsArr)
 :	MaterialVariable(T_USER, shaderProgVarName, shaderProgsArr)
 {
 {
-	ASSERT(getGlDataType() == GL_FLOAT_VEC2);
-	ASSERT(getShaderProgramVariableType() ==
+	ANKI_ASSERT(getGlDataType() == GL_FLOAT_VEC2);
+	ANKI_ASSERT(getShaderProgramVariableType() ==
 		ShaderProgramVariable::T_UNIFORM);
 		ShaderProgramVariable::T_UNIFORM);
 	data = val;
 	data = val;
 }
 }
@@ -41,8 +41,8 @@ MaterialUserVariable::MaterialUserVariable(
 	const Vec3& val)
 	const Vec3& val)
 :	MaterialVariable(T_USER, shaderProgVarName, shaderProgsArr)
 :	MaterialVariable(T_USER, shaderProgVarName, shaderProgsArr)
 {
 {
-	ASSERT(getGlDataType() == GL_FLOAT_VEC3);
-	ASSERT(getShaderProgramVariableType() ==
+	ANKI_ASSERT(getGlDataType() == GL_FLOAT_VEC3);
+	ANKI_ASSERT(getShaderProgramVariableType() ==
 		ShaderProgramVariable::T_UNIFORM);
 		ShaderProgramVariable::T_UNIFORM);
 	data = val;
 	data = val;
 }
 }
@@ -54,8 +54,8 @@ MaterialUserVariable::MaterialUserVariable(
 	const Vec4& val)
 	const Vec4& val)
 :	MaterialVariable(T_USER, shaderProgVarName, shaderProgsArr)
 :	MaterialVariable(T_USER, shaderProgVarName, shaderProgsArr)
 {
 {
-	ASSERT(getGlDataType() == GL_FLOAT_VEC4);
-	ASSERT(getShaderProgramVariableType() ==
+	ANKI_ASSERT(getGlDataType() == GL_FLOAT_VEC4);
+	ANKI_ASSERT(getShaderProgramVariableType() ==
 		ShaderProgramVariable::T_UNIFORM);
 		ShaderProgramVariable::T_UNIFORM);
 	data = val;
 	data = val;
 }
 }
@@ -67,11 +67,11 @@ MaterialUserVariable::MaterialUserVariable(
 	const char* texFilename)
 	const char* texFilename)
 :	MaterialVariable(T_USER, shaderProgVarName, shaderProgsArr)
 :	MaterialVariable(T_USER, shaderProgVarName, shaderProgsArr)
 {
 {
-	ASSERT(getGlDataType() == GL_SAMPLER_2D);
-	ASSERT(getShaderProgramVariableType() ==
+	ANKI_ASSERT(getGlDataType() == GL_SAMPLER_2D);
+	ANKI_ASSERT(getShaderProgramVariableType() ==
 		ShaderProgramVariable::T_UNIFORM);
 		ShaderProgramVariable::T_UNIFORM);
-	data = RsrcPtr<Texture>();
-	boost::get<RsrcPtr<Texture> >(data).loadRsrc(texFilename);
+	data = TextureResourcePointer();
+	boost::get<TextureResourcePointer >(data).load(texFilename);
 }
 }
 
 
 
 

+ 2 - 2
anki/resource/MaterialUserVariable.h

@@ -3,7 +3,7 @@
 
 
 #include "anki/resource/MaterialVariable.h"
 #include "anki/resource/MaterialVariable.h"
 #include "anki/math/Math.h"
 #include "anki/math/Math.h"
-#include "anki/resource/RsrcPtr.h"
+#include "anki/resource/Resource.h"
 #include "anki/resource/ShaderProgramUniformVariable.h"
 #include "anki/resource/ShaderProgramUniformVariable.h"
 #include <boost/variant.hpp>
 #include <boost/variant.hpp>
 
 
@@ -19,7 +19,7 @@ class MaterialUserVariable: public MaterialVariable
 {
 {
 	public:
 	public:
 		/// The data union
 		/// The data union
-		typedef boost::variant<float, Vec2, Vec3, Vec4, RsrcPtr<Texture> >
+		typedef boost::variant<float, Vec2, Vec3, Vec4, TextureResourcePointer >
 			DataVariant;
 			DataVariant;
 
 
 		/// @name Constructors & destructor
 		/// @name Constructors & destructor

+ 1 - 1
anki/resource/MaterialVariable.h

@@ -90,7 +90,7 @@ class MaterialVariable
 inline const ShaderProgramVariable& MaterialVariable::getShaderProgramVariable(
 inline const ShaderProgramVariable& MaterialVariable::getShaderProgramVariable(
 	PassType p) const
 	PassType p) const
 {
 {
-	ASSERT(inPass(p));
+	ANKI_ASSERT(inPass(p));
 	return *sProgVars[p];
 	return *sProgVars[p];
 }
 }
 
 

+ 1 - 1
anki/resource/Mesh.h

@@ -3,7 +3,7 @@
 
 
 #include <boost/array.hpp>
 #include <boost/array.hpp>
 #include "anki/math/Math.h"
 #include "anki/math/Math.h"
-#include "anki/resource/RsrcPtr.h"
+#include "anki/resource/Resource.h"
 #include "anki/gl/Vbo.h"
 #include "anki/gl/Vbo.h"
 #include "anki/collision/Obb.h"
 #include "anki/collision/Obb.h"
 
 

+ 1 - 1
anki/resource/Model.h

@@ -2,7 +2,7 @@
 #define ANKI_RESOURCE_MODEL_MODEL_H
 #define ANKI_RESOURCE_MODEL_MODEL_H
 
 
 #include <boost/ptr_container/ptr_vector.hpp>
 #include <boost/ptr_container/ptr_vector.hpp>
-#include "anki/resource/RsrcPtr.h"
+#include "anki/resource/Resource.h"
 #include "anki/gl/Vao.h"
 #include "anki/gl/Vao.h"
 #include "anki/resource/ModelPatch.h"
 #include "anki/resource/ModelPatch.h"
 #include "anki/collision/Obb.h"
 #include "anki/collision/Obb.h"

+ 2 - 2
anki/resource/ModelPatch.cpp

@@ -26,8 +26,8 @@ ModelPatch::~ModelPatch()
 void ModelPatch::load(const char* meshFName, const char* mtlFName)
 void ModelPatch::load(const char* meshFName, const char* mtlFName)
 {
 {
 	// Load
 	// Load
-	mesh.loadRsrc(meshFName);
-	mtl.loadRsrc(mtlFName);
+	mesh.load(meshFName);
+	mtl.load(mtlFName);
 }
 }
 
 
 
 

+ 3 - 3
anki/resource/ModelPatch.h

@@ -1,7 +1,7 @@
 #ifndef ANKI_RESOURCE_MODEL_PATCH_H
 #ifndef ANKI_RESOURCE_MODEL_PATCH_H
 #define ANKI_RESOURCE_MODEL_PATCH_H
 #define ANKI_RESOURCE_MODEL_PATCH_H
 
 
-#include "anki/resource/RsrcPtr.h"
+#include "anki/resource/Resource.h"
 
 
 
 
 namespace anki {
 namespace anki {
@@ -34,8 +34,8 @@ class ModelPatch
 		bool supportsHwSkinning() const;
 		bool supportsHwSkinning() const;
 
 
 	private:
 	private:
-		RsrcPtr<Mesh> mesh; ///< The geometry
-		RsrcPtr<Material> mtl; ///< Material for MS and BS
+		MeshResourcePointer mesh; ///< The geometry
+		MaterialResourcePointer mtl; ///< Material for MS and BS
 
 
 		/// Load the resources
 		/// Load the resources
 		void load(const char* meshFName, const char* mtlFName);
 		void load(const char* meshFName, const char* mtlFName);

+ 37 - 0
anki/resource/Resource.h

@@ -0,0 +1,37 @@
+#ifndef RESOURCE_RESOURCE_H
+#define RESOURCE_RESOURCE_H
+
+#include "anki/resource/ResourceManager.h"
+#include "anki/resource/ResourcePointer.h"
+#include "anki/util/Singleton.h"
+
+
+namespace anki {
+
+
+#define ANKI_RESOURCE_TYPEDEFS(x) \
+	class x; \
+	typedef ResourceManager<x> x ## ResourceManager; \
+	typedef Singleton<x ## ResourceManager> x ## ResourceManagerSingleton; \
+	typedef ResourcePointer<x, x ## ResourceManagerSingleton> \
+		x ## ResourcePointer;
+
+
+ANKI_RESOURCE_TYPEDEFS(Texture)
+ANKI_RESOURCE_TYPEDEFS(ShaderProgram)
+ANKI_RESOURCE_TYPEDEFS(Material)
+ANKI_RESOURCE_TYPEDEFS(Mesh)
+ANKI_RESOURCE_TYPEDEFS(Skeleton)
+ANKI_RESOURCE_TYPEDEFS(SkelAnim)
+ANKI_RESOURCE_TYPEDEFS(LightRsrc)
+ANKI_RESOURCE_TYPEDEFS(ParticleEmitterRsrc)
+ANKI_RESOURCE_TYPEDEFS(Script)
+ANKI_RESOURCE_TYPEDEFS(Model)
+ANKI_RESOURCE_TYPEDEFS(Skin)
+ANKI_RESOURCE_TYPEDEFS(DummyRsrc)
+
+
+} // end namespace
+
+
+#endif

+ 0 - 270
anki/resource/ResourceManager.cpp

@@ -1,270 +0,0 @@
-#include "anki/resource/ResourceManager.h"
-
-#include "anki/resource/Texture.h"
-#include "anki/resource/Material.h"
-#include "anki/resource/ShaderProgram.h"
-#include "anki/resource/Mesh.h"
-#include "anki/resource/Skeleton.h"
-#include "anki/resource/SkelAnim.h"
-#include "anki/resource/LightRsrc.h"
-#include "anki/resource/ParticleEmitterRsrc.h"
-#include "anki/resource/Script.h"
-#include "anki/resource/Model.h"
-#include "anki/resource/Skin.h"
-#include "anki/resource/DummyRsrc.h"
-
-#include "anki/resource/Image.h"
-#include "anki/core/Logger.h"
-#include "anki/core/Globals.h"
-
-
-namespace anki {
-
-
-//==============================================================================
-ResourceManager::ResourceManager()
-{}
-
-
-//==============================================================================
-ResourceManager::~ResourceManager()
-{}
-
-
-//==============================================================================
-template<typename Type>
-void ResourceManager::allocAndLoadRsrc(const char* filename, Type*& newInstance)
-{
-	newInstance = NULL;
-
-	try
-	{
-		newInstance = new Type();
-		newInstance->load(filename);
-	}
-	catch(std::exception& e)
-	{
-		//ANKI_ERROR("fuckkkkkkkkkk " << e.what());
-
-		/*if(newInstance != NULL)
-		{
-			delete newInstance;
-		}*/
-
-		throw ANKI_EXCEPTION("Cannot load \"" + filename + "\": " + e.what());
-	}
-}
-
-
-//==============================================================================
-template<typename Type>
-typename ResourceManager::Types<Type>::Iterator ResourceManager::find(
-	const char* filename, typename Types<Type>::Container& container)
-{
-	typename Types<Type>::Iterator it = container.begin();
-	for(; it != container.end(); it++)
-	{
-		if(it->uuid == filename)
-		{
-			break;
-		}
-	}
-
-	return it;
-}
-
-
-//==============================================================================
-template<typename Type>
-typename ResourceManager::Types<Type>::Hook& ResourceManager::loadR(
-	const char* filename)
-{
-	// Chose container
-	typename Types<Type>::Container& c = choseContainer<Type>();
-
-	// Find
-	typename Types<Type>::Iterator it = find<Type>(filename, c);
-
-	// If already loaded
-	if(it != c.end())
-	{
-		++it->referenceCounter;
-	}
-	// else create new, load it and update the container
-	else
-	{
-		typename Types<Type>::Hook* hook = NULL;
-
-		try
-		{
-			hook = new typename Types<Type>::Hook;
-			hook->uuid = filename;
-			hook->referenceCounter = 1;
-			allocAndLoadRsrc<Type>(filename, hook->resource);
-
-			c.push_back(hook);
-
-			it = c.end();
-			--it;
-		}
-		catch(std::exception& e)
-		{
-			if(hook != NULL)
-			{
-				delete hook;
-			}
-
-			throw ANKI_EXCEPTION("Cannot load \"" +
-				filename + "\": " + e.what());
-		}
-	}
-
-	return *it;
-}
-
-
-//==============================================================================
-template<typename Type>
-void ResourceManager::unloadR(const typename Types<Type>::Hook& hook)
-{
-	typedef char TypeMustBeComplete[sizeof(Type) ? 1 : -1];
-    (void) sizeof(TypeMustBeComplete);
-
-	// Chose container
-	typename Types<Type>::Container& c = choseContainer<Type>();
-
-	// Find
-	typename Types<Type>::Iterator it = find<Type>(hook.uuid.c_str(), c);
-
-	// If not found
-	if(it == c.end())
-	{
-		throw ANKI_EXCEPTION("Resource hook incorrect (\"" +
-			hook.uuid + "\")");
-	}
-
-	if(it->uuid != hook.uuid)
-	{
-		ANKI_INFO(it->uuid << " " << hook.uuid);
-	}
-
-	ANKI_ERROR(it->uuid << " " << hook.uuid << " " << it->resource << " " <<
-		hook.resource << " " << dummyTex.get());
-	ASSERT(it->uuid == hook.uuid);
-	ASSERT(it->referenceCounter == hook.referenceCounter);
-
-	--it->referenceCounter;
-
-	// Delete the resource
-	if(it->referenceCounter == 0)
-	{
-		deallocRsrc(it->resource);
-		c.erase(it);
-	}
-}
-
-
-//==============================================================================
-template<typename T>
-void ResourceManager::deallocRsrc(T* rsrc)
-{
-	delete rsrc;
-}
-
-
-//==============================================================================
-// Template specialization                                                     =
-//==============================================================================
-
-// Because we are bored to write the same
-#define SPECIALIZE_TEMPLATE_STUFF(type, container) \
-	template<> \
-	ResourceManager::Types<type>::Hook& \
-		ResourceManager::load<type>(const char* filename) \
-	{ \
-		return loadR<type>(filename); \
-	} \
-	\
-	template<> \
-	void ResourceManager::unload<type>(const Types<type>::Hook& info) \
-	{ \
-		unloadR<type>(info); \
-	} \
-	\
-	template<> \
-	ResourceManager::Types<type>::Container& \
-		ResourceManager::choseContainer<type>() \
-	{ \
-		return container; \
-	}
-
-SPECIALIZE_TEMPLATE_STUFF(Texture, textures)
-SPECIALIZE_TEMPLATE_STUFF(ShaderProgram, shaderProgs)
-SPECIALIZE_TEMPLATE_STUFF(Material, materials)
-SPECIALIZE_TEMPLATE_STUFF(Mesh, meshes)
-SPECIALIZE_TEMPLATE_STUFF(Skeleton, skeletons)
-SPECIALIZE_TEMPLATE_STUFF(SkelAnim, skelAnims)
-SPECIALIZE_TEMPLATE_STUFF(LightRsrc, lightProps)
-SPECIALIZE_TEMPLATE_STUFF(ParticleEmitterRsrc, particleEmitterProps)
-SPECIALIZE_TEMPLATE_STUFF(Script, scripts)
-SPECIALIZE_TEMPLATE_STUFF(Model, models)
-SPECIALIZE_TEMPLATE_STUFF(Skin, skins)
-SPECIALIZE_TEMPLATE_STUFF(DummyRsrc, dummies)
-
-//==============================================================================
-// Texture Specializations                                                     =
-//==============================================================================
-
-/*template<>
-ResourceManager::Types<Texture>::Container&
-	ResourceManager::choseContainer<Texture>()
-{
-	return textures;
-}
-
-
-template<>
-void ResourceManager::deallocRsrc<Texture>(Texture* rsrc)
-{
-	if(rsrc != dummyTex.get() && rsrc != dummyNormTex.get())
-	{
-		delete rsrc;
-	}
-}
-
-
-template<>
-void ResourceManager::allocAndLoadRsrc(const char* filename, Texture*& ptr)
-{
-	// Load the dummys
-	if(dummyTex.get() == NULL)
-	{
-		dummyTex.reset(new Texture);
-		dummyTex->load("engine-rsrc/dummy.png");
-	}
-	
-	if(dummyNormTex.get() == NULL)
-	{
-		dummyNormTex.reset(new Texture);
-		dummyNormTex->load("engine-rsrc/dummy.norm.png");
-	}
-
-	// Send a loading request
-	rsrcAsyncLoadingReqsHandler.sendNewLoadingRequest(filename, &ptr);
-
-	// Point to the dummy for now
-	std::string fname(filename);
-
-	size_t found = fname.find("norm.");
-	if(found != std::string::npos)
-	{
-		ptr = dummyNormTex.get();
-	}
-	else
-	{
-		ptr = dummyTex.get();
-	}
-}*/
-
-
-} // end namespace

+ 38 - 108
anki/resource/ResourceManager.h

@@ -2,140 +2,70 @@
 #define ANKI_RESOURCE_RESOURCE_MANAGER_H
 #define ANKI_RESOURCE_RESOURCE_MANAGER_H
 
 
 #include <boost/ptr_container/ptr_vector.hpp>
 #include <boost/ptr_container/ptr_vector.hpp>
-#include <boost/scoped_ptr.hpp>
 #include <string>
 #include <string>
-#include "anki/core/AsyncLoader.h"
-#include "anki/resource/RsrcHook.h"
-#include "anki/resource/RsrcAsyncLoadingReqsHandler.h"
 
 
 
 
 namespace anki {
 namespace anki {
 
 
 
 
-class Texture;
-class ShaderProgram;
-class Mesh;
-class Material;
-class Skeleton;
-class SkelAnim;
-class LightRsrc;
-class ParticleEmitterRsrc;
-class Script;
-class Model;
-class Skin;
-class DummyRsrc;
+/// Holds information about a resource
+template<typename Type>
+struct ResourceHook
+{
+	std::string uuid; ///< Unique identifier
+	int referenceCounter;
+	Type* resource;
+
+	bool operator==(const ResourceHook& b) const
+	{
+		return uuid == b.uuid &&
+			referenceCounter == b.referenceCounter &&
+			resource == b.resource;
+	}
+};
 
 
 
 
-/// Responsible of loading and unloading resources
+/// XXX
+template<typename Type>
 class ResourceManager
 class ResourceManager
 {
 {
 	public:
 	public:
-		/// Because the current C++ standard does not offer template typedefs
-		template<typename Type>
-		struct Types
-		{
-			typedef RsrcHook<Type> Hook;
-			typedef boost::ptr_vector<Hook> Container;
-			typedef typename Container::iterator Iterator;
-			typedef typename Container::const_iterator ConstIterator;
-		};
-
-		ResourceManager();
-		~ResourceManager();
-
-		/// Load a resource
-		/// See if its already loaded, if its not:
-		/// - Create an instance
-		/// - Call load method of the instance
-		/// If its loaded:
-		/// - Increase the resource counter
-		template<typename Type>
-		typename Types<Type>::Hook& load(const char* filename);
-
-		/// Unload a resource if no one uses it
-		template<typename Type>
-		void unload(const typename Types<Type>::Hook& info);
-		
-		/// See RsrcAsyncLoadingReqsHandler::postProcessFinishedRequests
-		void postProcessFinishedLoadingRequests(float maxTime);
-
-		/// Get the number of total pending requests
-		size_t getAsyncLoadingRequestsNum() const;
-
-	private:
-		/// @name Containers
-		/// @{
-		Types<Texture>::Container textures;
-		Types<ShaderProgram>::Container shaderProgs;
-		Types<Material>::Container materials;
-		Types<Mesh>::Container meshes;
-		Types<Skeleton>::Container skeletons;
-		Types<SkelAnim>::Container skelAnims;
-		Types<LightRsrc>::Container lightProps;
-		Types<ParticleEmitterRsrc>::Container particleEmitterProps;
-		Types<Script>::Container scripts;
-		Types<Model>::Container models;
-		Types<Skin>::Container skins;
-		Types<DummyRsrc>::Container dummies;
-		/// @}
-
-		RsrcAsyncLoadingReqsHandler rsrcAsyncLoadingReqsHandler;
-		
-		/// This will be used in every new texture until the async loader is
-		/// finished with the loading of the actual texture. Its initialized
-		/// when its first needed so that we wont have conflicts with opengl
-		/// initialization.
-		boost::scoped_ptr<Texture> dummyTex;
-
-		/// The same as dummyTex but for normals
-		boost::scoped_ptr<Texture> dummyNormTex;
-
-		/// The real load function
-		template<typename Type>
-		typename Types<Type>::Hook& loadR(const char* filename);
-
-		/// The real unload function
-		template<typename Type>
-		void unloadR(const typename Types<Type>::Hook& info);
-
-		/// Find a resource using the filename
-		template<typename Type>
-		typename Types<Type>::Iterator find(const char* filename,
-			typename Types<Type>::Container& container);
-
-		/// Specialized func
-		template<typename Type>
-		typename Types<Type>::Container& choseContainer();
-		
+		typedef ResourceManager<Type> Self;
+		typedef ResourceHook<Type> Hook;
+		typedef boost::ptr_vector<Hook> Container;
+		typedef typename Container::iterator Iterator;
+		typedef typename Container::const_iterator ConstIterator;
+
+		virtual ~ResourceManager()
+		{}
+
+		Hook& load(const char* filename);
+
+		void unload(const Hook& hook);
+
+	protected:
+		Container hooks;
+
+		Iterator find(const char* filename);
+
 		/// Allocate and load a resource.
 		/// Allocate and load a resource.
 		/// This method allocates memory for a resource and loads it (calls the
 		/// This method allocates memory for a resource and loads it (calls the
 		/// load method). Its been used by the load method. Its a separate
 		/// load method). Its been used by the load method. Its a separate
 		/// method because we want to specialize it for async loaded resources
 		/// method because we want to specialize it for async loaded resources
-		template<typename Type>
-		void allocAndLoadRsrc(const char* filename, Type*& ptr);
+		virtual void allocAndLoadRsrc(const char* filename, Type*& ptr);
 
 
 		/// Dealocate the resource. Its separate for two reasons:
 		/// Dealocate the resource. Its separate for two reasons:
 		/// - Because we want to specialize it for the async loaded resources
 		/// - Because we want to specialize it for the async loaded resources
 		/// - Because we cannot have the operator delete in a template body.
 		/// - Because we cannot have the operator delete in a template body.
 		///   Apparently the compiler is to dump to decide
 		///   Apparently the compiler is to dump to decide
-		template<typename Type>
 		void deallocRsrc(Type* rsrc);
 		void deallocRsrc(Type* rsrc);
 };
 };
 
 
 
 
-inline void ResourceManager::postProcessFinishedLoadingRequests(float maxTime)
-{
-	//rsrcAsyncLoadingReqsHandler.postProcessFinishedRequests(maxTime);
-}
-
-
-inline size_t ResourceManager::getAsyncLoadingRequestsNum() const
-{
-	return rsrcAsyncLoadingReqsHandler.getRequestsNum();
-}
+} // end namespace
 
 
 
 
-} // end namespace
+#include "anki/resource/ResourceManager.inl.h"
 
 
 
 
 #endif
 #endif

+ 138 - 0
anki/resource/ResourceManager.inl.h

@@ -0,0 +1,138 @@
+#include "anki/resource/ResourceManager.h"
+#include "anki/util/Exception.h"
+#include <iostream>
+
+
+namespace anki {
+
+
+//==============================================================================
+template<typename Type>
+void ResourceManager<Type>::allocAndLoadRsrc(
+	const char* filename, Type*& newInstance)
+{
+	newInstance = NULL;
+
+	// Alloc
+	try
+	{
+		newInstance = new Type();
+	}
+	catch(std::exception& e)
+	{
+		throw ANKI_EXCEPTION("Constructor failed for \"" + filename +
+			"\": " + e.what());
+	}
+
+	// Load
+	try
+	{
+		newInstance->load(filename);
+	}
+	catch(std::exception& e)
+	{
+		throw ANKI_EXCEPTION("Cannot load \"" + filename + "\": " + e.what());
+	}
+}
+
+
+//==============================================================================
+template<typename Type>
+typename ResourceManager<Type>::Hook& ResourceManager<Type>::load(
+	const char* filename)
+{
+	Iterator it = find(filename);
+
+	// If already loaded
+	if(it != hooks.end())
+	{
+		++it->referenceCounter;
+		return *it;
+	}
+	// else create new, load it and update the container
+	else
+	{
+		Hook* hook = NULL;
+		hook = new Hook;
+		hook->uuid = filename;
+		hook->referenceCounter = 1;
+
+		try
+		{
+			allocAndLoadRsrc(filename, hook->resource);
+		}
+		catch(std::exception& e)
+		{
+			if(hook != NULL)
+			{
+				delete hook;
+			}
+
+			throw ANKI_EXCEPTION("Cannot load \"" +
+				filename + "\": " + e.what());
+		}
+
+		hooks.push_back(hook);
+		return *hook;
+	}
+}
+
+
+//==============================================================================
+template<typename Type>
+void ResourceManager<Type>::deallocRsrc(Type* rsrc)
+{
+	typedef char TypeMustBeComplete[sizeof(Type) ? 1 : -1];
+    (void) sizeof(TypeMustBeComplete);
+
+	delete rsrc;
+}
+
+
+//==============================================================================
+template<typename Type>
+void ResourceManager<Type>::unload(const Hook& hook)
+{
+	// Find
+	Iterator it = find(hook.uuid.c_str());
+
+	// If not found
+	if(it == hooks.end())
+	{
+		throw ANKI_EXCEPTION("Resource hook incorrect (\"" +
+			hook.uuid + "\")");
+	}
+
+	assert(*it == hook);
+
+	--it->referenceCounter;
+
+	// Delete the resource
+	if(it->referenceCounter == 0)
+	{
+		deallocRsrc(it->resource);
+		hooks.erase(it);
+	}
+}
+
+
+//==============================================================================
+template<typename Type>
+typename ResourceManager<Type>::Iterator ResourceManager<Type>::find(
+	const char* filename)
+{
+	Iterator it = hooks.begin();
+	for(; it != hooks.end(); it++)
+	{
+		if(it->uuid == filename)
+		{
+			break;
+		}
+	}
+
+	return it;
+}
+
+
+
+} // end namespace

+ 86 - 0
anki/resource/ResourcePointer.h

@@ -0,0 +1,86 @@
+#ifndef ANKI_RESOURCE_RESOURCE_POINTER_H
+#define ANKI_RESOURCE_RESOURCE_POINTER_H
+
+#include "anki/util/Assert.h"
+
+
+namespace anki {
+
+
+/// This is a special smart pointer that points to Resource derivatives. It
+/// looks like auto_ptr but the main difference is that when its out of scope
+/// it tries to unload the resource.
+template<typename Type, typename ResourceManagerSingleton>
+class ResourcePointer
+{
+	public:
+		typedef ResourcePointer<Type, ResourceManagerSingleton> Self;
+
+		/// Default constructor
+		ResourcePointer()
+		:	hook(NULL)
+		{}
+
+		/// Copy constructor
+		ResourcePointer(const Self& a)
+		{
+			if(hook)
+			{
+				++hook->referenceCounter;
+			}
+		}
+
+		~ResourcePointer()
+		{
+			unload();
+		}
+
+		/// @name Accessors
+		/// @{
+		Type& operator*() const
+		{
+			ANKI_ASSERT(hook != NULL);
+			return *hook->resource;
+		}
+
+		Type* operator->() const
+		{
+			ANKI_ASSERT(hook != NULL);
+			return hook->resource;
+		}
+
+		Type* get() const
+		{
+			return hook->resource;
+		}
+
+		const std::string& getResourceName() const;
+		/// @}
+
+		/// Load the resource using the resource manager
+		void load(const char* filename)
+		{
+			ANKI_ASSERT(hook == NULL);
+			hook = &ResourceManagerSingleton::get().load(filename);
+		}
+
+	private:
+		/// Points to a container in the resource manager
+		typename ResourceManagerSingleton::ValueType::Hook* hook;
+
+		/// Unloads the resource @see loadRsrc
+		void unload()
+		{
+			if(hook != NULL)
+			{
+				ResourceManagerSingleton::get().unload(*hook);
+				hook = NULL;
+			}
+		}
+};
+
+
+} // end namespace
+
+
+#endif

+ 0 - 81
anki/resource/RsrcAsyncLoadingReqsHandler.cpp

@@ -1,81 +0,0 @@
-#include "anki/resource/RsrcAsyncLoadingReqsHandler.h"
-#include "anki/resource/Texture.h"
-#include "anki/core/Logger.h"
-#include "anki/util/HighRezTimer.h"
-#include "anki/util/Assert.h"
-#include "anki/core/Globals.h"
-
-
-namespace anki {
-
-
-/*
-//==============================================================================
-// sendNewLoadingRequest <Texture>                                             =
-//==============================================================================
-template<>
-void RsrcAsyncLoadingReqsHandler::sendNewLoadingRequest<Texture>(
-	const char* filename, Texture** objToLoad)
-{
-	RsrcTextureLoadingRequest* req = new RsrcTextureLoadingRequest(filename,
-		objToLoad);
-	requests.push_back(req);
-	req->postRequest(al);
-}
-
-
-//==============================================================================
-// postProcessFinishedRequests                                                 =
-//==============================================================================
-void RsrcAsyncLoadingReqsHandler::postProcessFinishedRequests(float maxTime)
-{
-	HighRezTimer t;
-	t.start();
-	frameServedRequestsNum = 0;
-
-	while(1)
-	{
-		std::string filename;
-		void* storage = NULL;
-		bool ok;
-		
-		if(!al.pollForFinished(filename, storage, ok)) // If no pending 
-		{
-			break;
-		}
-
-		RsrcLoadingRequestBase& req = requests.front();
-		ASSERT(filename == req.getFilename());
-
-		try
-		{
-			req.doPostLoading();
-		}
-		catch(std::exception& e)
-		{
-			ANKI_ERROR("Post-loading failed for \"" << filename << "\": " <<
-				e.what());
-		}
-		
-		++frameServedRequestsNum;
-
-		requests.pop_front();
-
-		// Leave if you passed the max time
-		if(t.getElapsedTime() >= maxTime)
-		{
-			break;
-		}
-	}
-
-	if(frameServedRequestsNum > 0)
-	{
-		ANKI_INFO(frameServedRequestsNum << " requests served. Time: " <<
-			t.getElapsedTime() << ", max time: " << maxTime);
-	}
-}
-
-*/
-
-
-} // end namespace

+ 0 - 61
anki/resource/RsrcAsyncLoadingReqsHandler.h

@@ -1,61 +0,0 @@
-#ifndef ANKI_RESOURCE_RSRC_ASYNC_LOADING_REQS_HANDLER_H
-#define ANKI_RESOURCE_RSRC_ASYNC_LOADING_REQS_HANDLER_H
-
-#include <string>
-#include <boost/ptr_container/ptr_list.hpp>
-#include "anki/core/AsyncLoader.h"
-#include "anki/resource/Image.h"
-#include "anki/resource/MeshData.h"
-#include "anki/resource/RsrcLoadingRequests.h"
-
-
-namespace anki {
-
-
-// Dont even think to include these files:
-class Texture;
-class Mesh;
-
-
-/// Handles the loading requests on behalf of the resource manager. Its a
-/// different class because we want to keep the source of the manager clean
-class RsrcAsyncLoadingReqsHandler
-{
-	public:
-		uint getFrameServedRequestsNum() const
-		{
-			return frameServedRequestsNum;
-		}
-
-		/// Send a loading request to an AsyncLoader
-		/// @tparam Type It should be Texture or Mesh
-		/// @param filename The file to load
-		/// @param objToLoad Pointer to a pointer to the object to load
-		/// asynchronously
-		template<typename Type>
-		void sendNewLoadingRequest(const char* filename, Type** objToLoad);
-		
-		/// Serve the finished requests. This should be called once every loop
-		/// of the main loop
-		/// @param maxTime The max time to spend serving finished requests. If
-		/// for example there are many that need more time than the max the
-		/// method will return. The pending requests will be served when it
-		/// will be called again.
-		/// In seconds
-		void postProcessFinishedRequests(float maxTime);
-
-		/// Get the number of total pending requests
-		size_t getRequestsNum() const {return requests.size();}
-	
-	private:
-		//AsyncLoader al; ///< Asynchronous loader
-		boost::ptr_list<RsrcLoadingRequestBase> requests; ///< Loading requests
-		/// The number of served requests for this frame
-		uint frameServedRequestsNum;
-};
-
-
-} // end namespace
-
-
-#endif

+ 0 - 23
anki/resource/RsrcHook.h

@@ -1,23 +0,0 @@
-#ifndef ANKI_RESOURCE_RSRC_HOOK_H
-#define ANKI_RESOURCE_RSRC_HOOK_H
-
-#include <string>
-
-
-namespace anki {
-
-
-/// Holds information about a resource
-template<typename Type>
-struct RsrcHook
-{
-	std::string uuid; ///< Unique identifier
-	int referenceCounter;
-	Type* resource;
-};
-
-
-} // end namespace
-
-
-#endif

+ 0 - 43
anki/resource/RsrcLoadingRequests.cpp

@@ -1,43 +0,0 @@
-#include "anki/resource/RsrcLoadingRequests.h"
-#include "anki/resource/Texture.h"
-#include "anki/core/AsyncLoader.h"
-#include "anki/core/Logger.h"
-#include "anki/core/Globals.h"
-
-
-namespace anki {
-
-
-//==============================================================================
-// postRequest                                                                 =
-//==============================================================================
-void RsrcTextureLoadingRequest::postRequest(AsyncLoader& al)
-{
-	al.load(getFilename().c_str(), &loadImageCallback, (void*)&img);
-}
-
-
-//==============================================================================
-// loadImageCallback                                                           =
-//==============================================================================
-void RsrcTextureLoadingRequest::loadImageCallback(const char* filename,
-	void* img_)
-{
-	Image* img = (Image*)img_;
-	img->load(filename);
-	//sleep(2);
-}
-
-
-//==============================================================================
-// doPostLoading                                                               =
-//==============================================================================
-void RsrcTextureLoadingRequest::doPostLoading()
-{
-	Texture* tex = new Texture;
-	tex->load(img);
-	*pTex = tex;
-}
-
-
-} // end namespace

+ 0 - 65
anki/resource/RsrcLoadingRequests.h

@@ -1,65 +0,0 @@
-#ifndef ANKI_RESOURCE_RSRC_LOADING_REQUESTS_H
-#define ANKI_RESOURCE_RSRC_LOADING_REQUESTS_H
-
-#include <string>
-#include "anki/resource/Image.h"
-
-
-namespace anki {
-
-
-class AsyncLoader;
-// Dont even think to include these files:
-class Texture;
-
-
-/// Request for the AsyncLoader [Base class]
-class RsrcLoadingRequestBase
-{
-	public:
-		RsrcLoadingRequestBase(const char* filename_)
-		:	filename(filename_)
-		{}
-
-		const std::string& getFilename() const
-		{
-			return filename;
-		}
-
-		virtual void postRequest(AsyncLoader& al) = 0;
-		virtual void doPostLoading() = 0;
-
-	private:
-		std::string filename;
-};
-
-
-/// @todo
-class RsrcTextureLoadingRequest: public RsrcLoadingRequestBase
-{
-	public:
-		RsrcTextureLoadingRequest(const char* filename_, Texture** pTex_);
-
-		void postRequest(AsyncLoader& al);
-		void doPostLoading();
-
-	private:
-		Image img;
-		Texture** pTex;
-
-		/// Load image callback. Passed to AsyncLoader
-		static void loadImageCallback(const char* filename, void* img);
-};
-
-
-inline RsrcTextureLoadingRequest::RsrcTextureLoadingRequest(
-	const char* filename_, Texture** pTex_)
-:	RsrcLoadingRequestBase(filename_),
-	pTex(pTex_)
-{}
-
-
-} // end namespace
-
-
-#endif

+ 0 - 58
anki/resource/RsrcPtr.h

@@ -1,58 +0,0 @@
-#ifndef ANKI_RESOURCE_RSRC_PTR_H
-#define ANKI_RESOURCE_RSRC_PTR_H
-
-#include "anki/resource/ResourceManager.h"
-#include "anki/core/Globals.h"
-
-
-namespace anki {
-
-
-/// This is a special smart pointer that points to Resource derivatives. It
-/// looks like auto_ptr but the main difference is that when its out of scope
-/// it tries to unload the resource.
-template<typename Type>
-class RsrcPtr
-{
-	public:
-		/// Default constructor
-		RsrcPtr()
-		:	hook(NULL)
-		{}
-
-		/// Copy constructor
-		RsrcPtr(const RsrcPtr<Type>& a);
-
-		~RsrcPtr();
-
-		/// Loads a resource and sets the RsrcPtr::p. The implementation of the
-		/// function is different for every Resource (see RsrcPtr.cpp)
-		/// @param filename
-		/// @return True on success
-		void loadRsrc(const char* filename);
-
-		Type& operator*() const;
-		Type* operator->() const;
-
-		Type* get() const
-		{
-			return hook->resource;
-		}
-
-		const std::string& getRsrcName() const;
-
-	private:
-		RsrcHook<Type>* hook; ///< Points to a container in the resource manager
-
-		/// Unloads the resource @see loadRsrc
-		void unload();
-};
-
-
-} // end namespace
-
-
-#include "anki/resource/RsrcPtr.inl.h"
-
-
-#endif

+ 0 - 92
anki/resource/RsrcPtr.inl.h

@@ -1,92 +0,0 @@
-#include "anki/resource/RsrcPtr.h"
-#include "anki/util/Exception.h"
-#include "anki/util/Assert.h"
-#include <boost/checked_delete.hpp>
-
-
-namespace anki {
-
-
-//==============================================================================
-// Constructor                                                                 =
-//==============================================================================
-template<typename Type>
-RsrcPtr<Type>::RsrcPtr(const RsrcPtr& a):
-	hook(a.hook)
-{
-	if(hook)
-	{
-		++hook->referenceCounter;
-	}
-}
-
-
-//==============================================================================
-// Constructor                                                                 =
-//==============================================================================
-template<typename Type>
-RsrcPtr<Type>::~RsrcPtr()
-{
-	unload();
-}
-
-
-//==============================================================================
-// operator*                                                                   =
-//==============================================================================
-template<typename Type>
-Type& RsrcPtr<Type>::operator*() const
-{
-	ASSERT(hook != NULL);
-	return *hook->resource;
-}
-
-
-//==============================================================================
-// operator->                                                                  =
-//==============================================================================
-template<typename Type>
-Type* RsrcPtr<Type>::operator->() const
-{
-	ASSERT(hook != NULL);
-	return hook->resource;
-}
-
-
-//==============================================================================
-// loadRsrc                                                                    =
-//==============================================================================
-template<typename Type>
-void RsrcPtr<Type>::loadRsrc(const char* filename)
-{
-	ASSERT(hook == NULL);
-	hook = &ResourceManagerSingleton::get().load<Type>(filename);
-}
-
-
-//==============================================================================
-// unload                                                                      =
-//==============================================================================
-template<typename Type>
-void RsrcPtr<Type>::unload()
-{
-	if(hook != NULL)
-	{
-		ResourceManagerSingleton::get().unload<Type>(*hook);
-		hook = NULL;
-	}
-}
-
-
-//==============================================================================
-// getRsrcName                                                                 =
-//==============================================================================
-template<typename Type>
-const std::string& RsrcPtr<Type>::getRsrcName() const
-{
-	ASSERT(hook != NULL);
-	return hook->uuid;
-}
-
-
-} // end namespace

+ 2 - 2
anki/resource/ShaderProgram.cpp

@@ -92,7 +92,7 @@ uint ShaderProgram::createAndCompileShader(const char* sourceCode,
 				shaderType = "Fragment shader";
 				shaderType = "Fragment shader";
 				break;
 				break;
 			default:
 			default:
-				ASSERT(0); // Not supported
+				ANKI_ASSERT(0); // Not supported
 		}
 		}
 		throw SHADER_PROGRAM_EXCEPTION(shaderType + 
 		throw SHADER_PROGRAM_EXCEPTION(shaderType + 
 			" compiler error log follows:\n"
 			" compiler error log follows:\n"
@@ -204,7 +204,7 @@ void ShaderProgram::getUniAndAttribVars()
 void ShaderProgram::load(const char* filename)
 void ShaderProgram::load(const char* filename)
 {
 {
 	rsrcFilename = filename;
 	rsrcFilename = filename;
-	ASSERT(glId == std::numeric_limits<uint>::max());
+	ANKI_ASSERT(glId == std::numeric_limits<uint>::max());
 
 
 	ShaderProgramPrePreprocessor pars(filename);
 	ShaderProgramPrePreprocessor pars(filename);
 
 

+ 2 - 2
anki/resource/ShaderProgram.h

@@ -141,14 +141,14 @@ inline ShaderProgram::ShaderProgram()
 
 
 inline GLuint ShaderProgram::getGlId() const
 inline GLuint ShaderProgram::getGlId() const
 {
 {
-	ASSERT(glId != std::numeric_limits<uint>::max());
+	ANKI_ASSERT(glId != std::numeric_limits<uint>::max());
 	return glId;
 	return glId;
 }
 }
 
 
 
 
 inline void ShaderProgram::bind() const
 inline void ShaderProgram::bind() const
 {
 {
-	ASSERT(glId != std::numeric_limits<uint>::max());
+	ANKI_ASSERT(glId != std::numeric_limits<uint>::max());
 	GlStateMachineSingleton::get().useShaderProg(glId);
 	GlStateMachineSingleton::get().useShaderProg(glId);
 }
 }
 
 

+ 11 - 11
anki/resource/ShaderProgramUniformVariable.cpp

@@ -12,10 +12,10 @@ namespace anki {
 //==============================================================================
 //==============================================================================
 void ShaderProgramUniformVariable::doSanityChecks() const
 void ShaderProgramUniformVariable::doSanityChecks() const
 {
 {
-	ASSERT(getLocation() != -1);
-	ASSERT(GlStateMachineSingleton::get().getCurrentProgramGlId() ==
+	ANKI_ASSERT(getLocation() != -1);
+	ANKI_ASSERT(GlStateMachineSingleton::get().getCurrentProgramGlId() ==
 		getFatherSProg().getGlId());
 		getFatherSProg().getGlId());
-	ASSERT(glGetUniformLocation(getFatherSProg().getGlId(),
+	ANKI_ASSERT(glGetUniformLocation(getFatherSProg().getGlId(),
 		getName().c_str()) == getLocation());
 		getName().c_str()) == getLocation());
 }
 }
 
 
@@ -27,7 +27,7 @@ void ShaderProgramUniformVariable::doSanityChecks() const
 void ShaderProgramUniformVariable::set(const float f) const
 void ShaderProgramUniformVariable::set(const float f) const
 {
 {
 	doSanityChecks();
 	doSanityChecks();
-	ASSERT(getGlDataType() == GL_FLOAT);
+	ANKI_ASSERT(getGlDataType() == GL_FLOAT);
 
 
 	glUniform1f(getLocation(), f);
 	glUniform1f(getLocation(), f);
 }
 }
@@ -35,7 +35,7 @@ void ShaderProgramUniformVariable::set(const float f) const
 void ShaderProgramUniformVariable::set(const float f[], uint size) const
 void ShaderProgramUniformVariable::set(const float f[], uint size) const
 {
 {
 	doSanityChecks();
 	doSanityChecks();
-	ASSERT(getGlDataType() == GL_FLOAT);
+	ANKI_ASSERT(getGlDataType() == GL_FLOAT);
 
 
 	if(size == 1)
 	if(size == 1)
 	{
 	{
@@ -51,7 +51,7 @@ void ShaderProgramUniformVariable::set(const float f[], uint size) const
 void ShaderProgramUniformVariable::set(const Vec2 v2[], uint size) const
 void ShaderProgramUniformVariable::set(const Vec2 v2[], uint size) const
 {
 {
 	doSanityChecks();
 	doSanityChecks();
-	ASSERT(getGlDataType() == GL_FLOAT_VEC2);
+	ANKI_ASSERT(getGlDataType() == GL_FLOAT_VEC2);
 	if(size == 1)
 	if(size == 1)
 	{
 	{
 		glUniform2f(getLocation(), v2[0].x(), v2[0].y());
 		glUniform2f(getLocation(), v2[0].x(), v2[0].y());
@@ -66,7 +66,7 @@ void ShaderProgramUniformVariable::set(const Vec2 v2[], uint size) const
 void ShaderProgramUniformVariable::set(const Vec3 v3[], uint size) const
 void ShaderProgramUniformVariable::set(const Vec3 v3[], uint size) const
 {
 {
 	doSanityChecks();
 	doSanityChecks();
-	ASSERT(getGlDataType() == GL_FLOAT_VEC3);
+	ANKI_ASSERT(getGlDataType() == GL_FLOAT_VEC3);
 
 
 	if(size == 1)
 	if(size == 1)
 	{
 	{
@@ -82,7 +82,7 @@ void ShaderProgramUniformVariable::set(const Vec3 v3[], uint size) const
 void ShaderProgramUniformVariable::set(const Vec4 v4[], uint size) const
 void ShaderProgramUniformVariable::set(const Vec4 v4[], uint size) const
 {
 {
 	doSanityChecks();
 	doSanityChecks();
-	ASSERT(getGlDataType() == GL_FLOAT_VEC4);
+	ANKI_ASSERT(getGlDataType() == GL_FLOAT_VEC4);
 	glUniform4fv(getLocation(), size, &(const_cast<Vec4&>(v4[0]))[0]);
 	glUniform4fv(getLocation(), size, &(const_cast<Vec4&>(v4[0]))[0]);
 }
 }
 
 
@@ -90,7 +90,7 @@ void ShaderProgramUniformVariable::set(const Vec4 v4[], uint size) const
 void ShaderProgramUniformVariable::set(const Mat3 m3[], uint size) const
 void ShaderProgramUniformVariable::set(const Mat3 m3[], uint size) const
 {
 {
 	doSanityChecks();
 	doSanityChecks();
-	ASSERT(getGlDataType() == GL_FLOAT_MAT3);
+	ANKI_ASSERT(getGlDataType() == GL_FLOAT_MAT3);
 	glUniformMatrix3fv(getLocation(), size, true, &(m3[0])[0]);
 	glUniformMatrix3fv(getLocation(), size, true, &(m3[0])[0]);
 }
 }
 
 
@@ -98,7 +98,7 @@ void ShaderProgramUniformVariable::set(const Mat3 m3[], uint size) const
 void ShaderProgramUniformVariable::set(const Mat4 m4[], uint size) const
 void ShaderProgramUniformVariable::set(const Mat4 m4[], uint size) const
 {
 {
 	doSanityChecks();
 	doSanityChecks();
-	ASSERT(getGlDataType() == GL_FLOAT_MAT4);
+	ANKI_ASSERT(getGlDataType() == GL_FLOAT_MAT4);
 	glUniformMatrix4fv(getLocation(), size, true, &(m4[0])[0]);
 	glUniformMatrix4fv(getLocation(), size, true, &(m4[0])[0]);
 }
 }
 
 
@@ -106,7 +106,7 @@ void ShaderProgramUniformVariable::set(const Mat4 m4[], uint size) const
 void ShaderProgramUniformVariable::set(const Texture& tex, uint texUnit) const
 void ShaderProgramUniformVariable::set(const Texture& tex, uint texUnit) const
 {
 {
 	doSanityChecks();
 	doSanityChecks();
-	ASSERT(getGlDataType() == GL_SAMPLER_2D ||
+	ANKI_ASSERT(getGlDataType() == GL_SAMPLER_2D ||
 		getGlDataType() == GL_SAMPLER_2D_SHADOW);
 		getGlDataType() == GL_SAMPLER_2D_SHADOW);
 	tex.bind(texUnit);
 	tex.bind(texUnit);
 	glUniform1i(getLocation(), texUnit);
 	glUniform1i(getLocation(), texUnit);

+ 5 - 5
anki/resource/Skin.cpp

@@ -41,10 +41,10 @@ void Skin::load(const char* filename)
 		const ptree& pt = pt_.get_child("skin");
 		const ptree& pt = pt_.get_child("skin");
 
 
 		// model
 		// model
-		model.loadRsrc(pt.get<std::string>("model").c_str());
+		model.load(pt.get<std::string>("model").c_str());
 
 
 		// skeleton
 		// skeleton
-		skeleton.loadRsrc(pt.get<std::string>("skeleton").c_str());
+		skeleton.load(pt.get<std::string>("skeleton").c_str());
 
 
 		// Anims
 		// Anims
 		boost::optional<const ptree&> skelAnimsTree =
 		boost::optional<const ptree&> skelAnimsTree =
@@ -59,8 +59,8 @@ void Skin::load(const char* filename)
 				}
 				}
 
 
 				const std::string& name = v.second.data();
 				const std::string& name = v.second.data();
-				skelAnims.push_back(RsrcPtr<SkelAnim>());
-				skelAnims.back().loadRsrc(name.c_str());
+				skelAnims.push_back(SkelAnimResourcePointer());
+				skelAnims.back().load(name.c_str());
 			}
 			}
 		}
 		}
 
 
@@ -69,7 +69,7 @@ void Skin::load(const char* filename)
 		//
 		//
 
 
 		// Anims and skel bones num check
 		// Anims and skel bones num check
-		BOOST_FOREACH(const RsrcPtr<SkelAnim>& skelAnim, skelAnims)
+		BOOST_FOREACH(const SkelAnimResourcePointer& skelAnim, skelAnims)
 		{
 		{
 			// Bone number problem
 			// Bone number problem
 			if(skelAnim->getBoneAnimations().size() !=
 			if(skelAnim->getBoneAnimations().size() !=

+ 6 - 6
anki/resource/Skin.h

@@ -1,7 +1,7 @@
 #ifndef ANKI_RESOURCE_SKIN_H
 #ifndef ANKI_RESOURCE_SKIN_H
 #define ANKI_RESOURCE_SKIN_H
 #define ANKI_RESOURCE_SKIN_H
 
 
-#include "anki/resource/RsrcPtr.h"
+#include "anki/resource/Resource.h"
 #include "anki/resource/Model.h"
 #include "anki/resource/Model.h"
 
 
 
 
@@ -38,16 +38,16 @@ class Skin
 		const Model& getModel() const;
 		const Model& getModel() const;
 		const boost::ptr_vector<ModelPatch>& getModelPatches() const;
 		const boost::ptr_vector<ModelPatch>& getModelPatches() const;
 		const Skeleton& getSkeleton() const;
 		const Skeleton& getSkeleton() const;
-		const std::vector<RsrcPtr<SkelAnim> >& getSkelAnims() const;
+		const std::vector<SkelAnimResourcePointer >& getSkelAnims() const;
 		/// @}
 		/// @}
 
 
 	private:
 	private:
 		/// @name The resources
 		/// @name The resources
 		/// @{
 		/// @{
-		RsrcPtr<Model> model;
-		RsrcPtr<Skeleton> skeleton; ///< The skeleton
+		ModelResourcePointer model;
+		SkeletonResourcePointer skeleton; ///< The skeleton
 		/// The standard skeleton animations
 		/// The standard skeleton animations
-		std::vector<RsrcPtr<SkelAnim> > skelAnims;
+		std::vector<SkelAnimResourcePointer > skelAnims;
 		/// @}
 		/// @}
 };
 };
 
 
@@ -70,7 +70,7 @@ inline const Skeleton& Skin::getSkeleton() const
 }
 }
 
 
 
 
-inline const std::vector<RsrcPtr<SkelAnim> >& Skin::getSkelAnims() const
+inline const std::vector<SkelAnimResourcePointer >& Skin::getSkelAnims() const
 {
 {
 	return skelAnims;
 	return skelAnims;
 }
 }

+ 4 - 4
anki/resource/Texture.h

@@ -122,28 +122,28 @@ class Texture
 
 
 inline uint Texture::getGlId() const
 inline uint Texture::getGlId() const
 {
 {
-	ASSERT(isLoaded());
+	ANKI_ASSERT(isLoaded());
 	return glId;
 	return glId;
 }
 }
 
 
 
 
 inline uint Texture::getInternalFormat() const
 inline uint Texture::getInternalFormat() const
 {
 {
-	ASSERT(isLoaded());
+	ANKI_ASSERT(isLoaded());
 	return internalFormat;
 	return internalFormat;
 }
 }
 
 
 
 
 inline uint Texture::getFormat() const
 inline uint Texture::getFormat() const
 {
 {
-	ASSERT(isLoaded());
+	ANKI_ASSERT(isLoaded());
 	return format;
 	return format;
 }
 }
 
 
 
 
 inline uint Texture::getType() const
 inline uint Texture::getType() const
 {
 {
-	ASSERT(isLoaded());
+	ANKI_ASSERT(isLoaded());
 	return type;
 	return type;
 }
 }
 
 

+ 1 - 1
anki/scene/Light.cpp

@@ -17,7 +17,7 @@ Light::~Light()
 //==============================================================================
 //==============================================================================
 void Light::init(const char* filename)
 void Light::init(const char* filename)
 {
 {
-	lightData.loadRsrc(filename);
+	lightData.load(filename);
 
 
 	diffuseCol = lightData->getDiffuseColor();
 	diffuseCol = lightData->getDiffuseColor();
 	specularCol = lightData->getSpecularColor();
 	specularCol = lightData->getSpecularColor();

+ 2 - 2
anki/scene/Light.h

@@ -3,7 +3,7 @@
 
 
 #include "anki/resource/Texture.h"
 #include "anki/resource/Texture.h"
 #include "anki/scene/SceneNode.h"
 #include "anki/scene/SceneNode.h"
-#include "anki/resource/RsrcPtr.h"
+#include "anki/resource/Resource.h"
 #include "anki/resource/LightRsrc.h"
 #include "anki/resource/LightRsrc.h"
 #include "anki/scene/VisibilityInfo.h"
 #include "anki/scene/VisibilityInfo.h"
 
 
@@ -60,7 +60,7 @@ class Light: public SceneNode, public VisibilityInfo
 		void init(const char* filename);
 		void init(const char* filename);
 
 
 	protected:
 	protected:
-		RsrcPtr<LightRsrc> lightData;
+		LightRsrcResourcePointer lightData;
 		Vec3 diffuseCol; ///< Diffuse color
 		Vec3 diffuseCol; ///< Diffuse color
 		Vec3 specularCol; ///< Specular color
 		Vec3 specularCol; ///< Specular color
 		bool castsShadowFlag; ///< Casts shadow
 		bool castsShadowFlag; ///< Casts shadow

+ 2 - 2
anki/scene/MaterialRuntimeVariable.cpp

@@ -6,11 +6,11 @@ namespace anki {
 
 
 
 
 //==============================================================================
 //==============================================================================
-// ConstructVisitor::operator() <RsrcPtr<Texture> >                            =
+// ConstructVisitor::operator() <TextureResourcePointer >                            =
 //==============================================================================
 //==============================================================================
 template <>
 template <>
 void MaterialRuntimeVariable::ConstructVisitor::
 void MaterialRuntimeVariable::ConstructVisitor::
-	operator()<RsrcPtr<Texture> >(const RsrcPtr<Texture>& x) const
+	operator()<TextureResourcePointer >(const TextureResourcePointer& x) const
 {
 {
 	udvr.data = &x;
 	udvr.data = &x;
 }
 }

+ 2 - 2
anki/scene/MaterialRuntimeVariable.h

@@ -2,7 +2,7 @@
 #define ANKI_SCENE_MATERIAL_RUNTIME_VARIABLE_H
 #define ANKI_SCENE_MATERIAL_RUNTIME_VARIABLE_H
 
 
 #include "anki/math/Math.h"
 #include "anki/math/Math.h"
-#include "anki/resource/RsrcPtr.h"
+#include "anki/resource/Resource.h"
 #include <boost/variant.hpp>
 #include <boost/variant.hpp>
 
 
 
 
@@ -19,7 +19,7 @@ class MaterialUserVariable;
 class MaterialRuntimeVariable
 class MaterialRuntimeVariable
 {
 {
 	public:
 	public:
-		typedef const RsrcPtr<Texture>* ConstPtrRsrcPtrTexture;
+		typedef const TextureResourcePointer* ConstPtrRsrcPtrTexture;
 
 
 		/// The data union. The Texture resource is read-only at runtime
 		/// The data union. The Texture resource is read-only at runtime
 		/// Don't EVER replace the texture with const Texture*. The asynchronous
 		/// Don't EVER replace the texture with const Texture*. The asynchronous

+ 1 - 1
anki/scene/ModelNode.cpp

@@ -25,7 +25,7 @@ ModelNode::~ModelNode()
 //==============================================================================
 //==============================================================================
 void ModelNode::init(const char* filename)
 void ModelNode::init(const char* filename)
 {
 {
-	model.loadRsrc(filename);
+	model.load(filename);
 
 
 	BOOST_FOREACH(const ModelPatch& patch, model->getModelPatches())
 	BOOST_FOREACH(const ModelPatch& patch, model->getModelPatches())
 	{
 	{

+ 2 - 2
anki/scene/ModelNode.h

@@ -2,7 +2,7 @@
 #define ANKI_SCENE_MODEL_NODE_H
 #define ANKI_SCENE_MODEL_NODE_H
 
 
 #include "anki/scene/SceneNode.h"
 #include "anki/scene/SceneNode.h"
-#include "anki/resource/RsrcPtr.h"
+#include "anki/resource/Resource.h"
 #include "anki/scene/ModelPatchNode.h"
 #include "anki/scene/ModelPatchNode.h"
 #include "anki/collision/Obb.h"
 #include "anki/collision/Obb.h"
 #include <boost/array.hpp>
 #include <boost/array.hpp>
@@ -60,7 +60,7 @@ class ModelNode: public SceneNode
 		void moveUpdate();
 		void moveUpdate();
 
 
 	private:
 	private:
-		RsrcPtr<Model> model;
+		ModelResourcePointer model;
 		std::vector<ModelPatchNode*> patches;
 		std::vector<ModelPatchNode*> patches;
 		Obb visibilityShapeWSpace;
 		Obb visibilityShapeWSpace;
 };
 };

+ 1 - 1
anki/scene/ParticleEmitterNode.cpp

@@ -59,7 +59,7 @@ Vec3 ParticleEmitterNode::getRandom(const Vec3& initial, const Vec3& deviation)
 //==============================================================================
 //==============================================================================
 void ParticleEmitterNode::init(const char* filename)
 void ParticleEmitterNode::init(const char* filename)
 {
 {
-	particleEmitterProps.loadRsrc(filename);
+	particleEmitterProps.load(filename);
 
 
 	// copy the resource to me
 	// copy the resource to me
 	ParticleEmitterRsrc& me = *this;
 	ParticleEmitterRsrc& me = *this;

+ 3 - 2
anki/scene/ParticleEmitterNode.h

@@ -6,7 +6,7 @@
 #include <btBulletCollisionCommon.h>
 #include <btBulletCollisionCommon.h>
 #include "anki/scene/SceneNode.h"
 #include "anki/scene/SceneNode.h"
 #include "anki/resource/ParticleEmitterRsrc.h"
 #include "anki/resource/ParticleEmitterRsrc.h"
-#include "anki/resource/RsrcPtr.h"
+#include "anki/resource/Resource.h"
 
 
 
 
 class btCollisionShape;
 class btCollisionShape;
@@ -33,7 +33,8 @@ class ParticleEmitterNode: public SceneNode, public ParticleEmitterRsrc
 		boost::scoped_ptr<btCollisionShape> collShape;
 		boost::scoped_ptr<btCollisionShape> collShape;
 		std::vector<Particle*> particles;
 		std::vector<Particle*> particles;
 		float timeLeftForNextEmission;
 		float timeLeftForNextEmission;
-		RsrcPtr<ParticleEmitterRsrc> particleEmitterProps; ///< The resource
+		/// The resource
+		ParticleEmitterRsrcResourcePointer particleEmitterProps;
 		static btTransform startingTrf;
 		static btTransform startingTrf;
 
 
 		static float getRandom(float initial, float deviation);
 		static float getRandom(float initial, float deviation);

+ 3 - 3
anki/scene/PatchNode.cpp

@@ -28,7 +28,7 @@ void PatchNode::createVao(const Material& mtl, const VboArray& vbos,
 
 
 	if(mtl.buildinVariableExits(MaterialBuildinVariable::MV_POSITION))
 	if(mtl.buildinVariableExits(MaterialBuildinVariable::MV_POSITION))
 	{
 	{
-		ASSERT(vbos[Mesh::VBO_VERT_POSITIONS] != NULL);
+		ANKI_ASSERT(vbos[Mesh::VBO_VERT_POSITIONS] != NULL);
 
 
 		vao.attachArrayBufferVbo(*vbos[Mesh::VBO_VERT_POSITIONS],
 		vao.attachArrayBufferVbo(*vbos[Mesh::VBO_VERT_POSITIONS],
 			0, 3, GL_FLOAT, GL_FALSE, 0, NULL);
 			0, 3, GL_FLOAT, GL_FALSE, 0, NULL);
@@ -36,7 +36,7 @@ void PatchNode::createVao(const Material& mtl, const VboArray& vbos,
 
 
 	if(mtl.buildinVariableExits(MaterialBuildinVariable::MV_NORMAL))
 	if(mtl.buildinVariableExits(MaterialBuildinVariable::MV_NORMAL))
 	{
 	{
-		ASSERT(vbos[Mesh::VBO_VERT_NORMALS] != NULL);
+		ANKI_ASSERT(vbos[Mesh::VBO_VERT_NORMALS] != NULL);
 
 
 		vao.attachArrayBufferVbo(*vbos[Mesh::VBO_VERT_NORMALS],
 		vao.attachArrayBufferVbo(*vbos[Mesh::VBO_VERT_NORMALS],
 			1, 3, GL_FLOAT, GL_FALSE, 0, NULL);
 			1, 3, GL_FLOAT, GL_FALSE, 0, NULL);
@@ -44,7 +44,7 @@ void PatchNode::createVao(const Material& mtl, const VboArray& vbos,
 
 
 	if(mtl.buildinVariableExits(MaterialBuildinVariable::MV_TANGENT))
 	if(mtl.buildinVariableExits(MaterialBuildinVariable::MV_TANGENT))
 	{
 	{
-		ASSERT(vbos[Mesh::VBO_VERT_TANGENTS] != NULL);
+		ANKI_ASSERT(vbos[Mesh::VBO_VERT_TANGENTS] != NULL);
 
 
 		vao.attachArrayBufferVbo(*vbos[Mesh::VBO_VERT_TANGENTS],
 		vao.attachArrayBufferVbo(*vbos[Mesh::VBO_VERT_TANGENTS],
 			2, 4, GL_FLOAT, GL_FALSE, 0, NULL);
 			2, 4, GL_FLOAT, GL_FALSE, 0, NULL);

+ 1 - 1
anki/scene/PatchNode.h

@@ -4,7 +4,7 @@
 #include "anki/gl/Vao.h"
 #include "anki/gl/Vao.h"
 #include "anki/gl/Vbo.h"
 #include "anki/gl/Vbo.h"
 #include "anki/resource/Mesh.h" // For the Vbos enum
 #include "anki/resource/Mesh.h" // For the Vbos enum
-#include "anki/resource/RsrcPtr.h"
+#include "anki/resource/Resource.h"
 #include "anki/resource/ModelPatch.h"
 #include "anki/resource/ModelPatch.h"
 #include "anki/scene/RenderableNode.h"
 #include "anki/scene/RenderableNode.h"
 #include "anki/scene/MaterialRuntime.h"
 #include "anki/scene/MaterialRuntime.h"

+ 4 - 4
anki/scene/Scene.cpp

@@ -103,7 +103,7 @@ void Scene::unregisterNode(SceneNode* node)
 //==============================================================================
 //==============================================================================
 void Scene::registerController(Controller* controller)
 void Scene::registerController(Controller* controller)
 {
 {
-	ASSERT(std::find(controllers.begin(), controllers.end(), controller) ==
+	ANKI_ASSERT(std::find(controllers.begin(), controllers.end(), controller) ==
 		controllers.end());
 		controllers.end());
 	controllers.push_back(controller);
 	controllers.push_back(controller);
 }
 }
@@ -112,7 +112,7 @@ void Scene::unregisterController(Controller* controller)
 {
 {
 	std::vector<Controller*>::iterator it = std::find(controllers.begin(),
 	std::vector<Controller*>::iterator it = std::find(controllers.begin(),
 		controllers.end(), controller);
 		controllers.end(), controller);
-	ASSERT(it != controllers.end());
+	ANKI_ASSERT(it != controllers.end());
 	controllers.erase(it);
 	controllers.erase(it);
 }
 }
 
 
@@ -122,7 +122,7 @@ void Scene::unregisterController(Controller* controller)
 //==============================================================================
 //==============================================================================
 void Scene::updateAllWorldStuff(float prevUpdateTime, float crntTime)
 void Scene::updateAllWorldStuff(float prevUpdateTime, float crntTime)
 {
 {
-	ASSERT(nodes.size() <= 1024);
+	ANKI_ASSERT(nodes.size() <= 1024);
 	boost::array<SceneNode*, 1024> queue;
 	boost::array<SceneNode*, 1024> queue;
 	uint head = 0, tail = 0;
 	uint head = 0, tail = 0;
 	uint num = 0;
 	uint num = 0;
@@ -153,7 +153,7 @@ void Scene::updateAllWorldStuff(float prevUpdateTime, float crntTime)
 		}
 		}
 	}
 	}
 
 
-	ASSERT(num == nodes.size());
+	ANKI_ASSERT(num == nodes.size());
 }
 }
 
 
 
 

+ 2 - 2
anki/scene/Scene.inl.h

@@ -4,7 +4,7 @@ namespace anki {
 template<typename ContainerType, typename Type>
 template<typename ContainerType, typename Type>
 inline void Scene::putBackNode(ContainerType& container, Type* x)
 inline void Scene::putBackNode(ContainerType& container, Type* x)
 {
 {
-	ASSERT(std::find(container.begin(), container.end(), x) == container.end());
+	ANKI_ASSERT(std::find(container.begin(), container.end(), x) == container.end());
 	container.push_back(x);
 	container.push_back(x);
 }
 }
 
 
@@ -14,7 +14,7 @@ inline void Scene::eraseNode(ContainerType& container, Type* x)
 {
 {
 	typename ContainerType::iterator it =
 	typename ContainerType::iterator it =
 		std::find(container.begin(), container.end(), x);
 		std::find(container.begin(), container.end(), x);
-	ASSERT(it != container.end());
+	ANKI_ASSERT(it != container.end());
 	container.erase(it);
 	container.erase(it);
 }
 }
 
 

+ 1 - 1
anki/scene/SceneNode.cpp

@@ -104,7 +104,7 @@ void SceneNode::updateWorldTransform()
 //==============================================================================
 //==============================================================================
 void SceneNode::addChild(SceneNode& child)
 void SceneNode::addChild(SceneNode& child)
 {
 {
-	ASSERT(child.parent == NULL); // Child already has parent
+	ANKI_ASSERT(child.parent == NULL); // Child already has parent
 
 
 	child.parent = this;
 	child.parent = this;
 	children.push_back(&child);
 	children.push_back(&child);

+ 3 - 3
anki/scene/SkinNode.cpp

@@ -29,7 +29,7 @@ SkinNode::~SkinNode()
 //==============================================================================
 //==============================================================================
 void SkinNode::init(const char* filename)
 void SkinNode::init(const char* filename)
 {
 {
-	skin.loadRsrc(filename);
+	skin.load(filename);
 
 
 	BOOST_FOREACH(const ModelPatch& patch, skin->getModelPatches())
 	BOOST_FOREACH(const ModelPatch& patch, skin->getModelPatches())
 	{
 	{
@@ -90,7 +90,7 @@ void SkinNode::frameUpdate(float /*prevUpdateTime*/, float /*crntTime*/)
 void SkinNode::interpolate(const SkelAnim& animation, float frame,
 void SkinNode::interpolate(const SkelAnim& animation, float frame,
 	std::vector<Vec3>& boneTranslations, std::vector<Mat3>& boneRotations)
 	std::vector<Vec3>& boneTranslations, std::vector<Mat3>& boneRotations)
 {
 {
-	ASSERT(frame < animation.getFramesNum());
+	ANKI_ASSERT(frame < animation.getFramesNum());
 
 
 	// calculate the t (used in slerp and lerp) using the keyframs and the
 	// calculate the t (used in slerp and lerp) using the keyframs and the
 	// frame and calc the lPose and rPose witch indicate the pose IDs in witch
 	// frame and calc the lPose and rPose witch indicate the pose IDs in witch
@@ -117,7 +117,7 @@ void SkinNode::interpolate(const SkelAnim& animation, float frame,
 	}
 	}
 
 
 	// now for all bones update bone's poses
 	// now for all bones update bone's poses
-	ASSERT(boneRotations.size() >= 1);
+	ANKI_ASSERT(boneRotations.size() >= 1);
 	for(uint i=0; i < boneRotations.size(); i++)
 	for(uint i=0; i < boneRotations.size(); i++)
 	{
 	{
 		const BoneAnim& banim = animation.getBoneAnimations()[i];
 		const BoneAnim& banim = animation.getBoneAnimations()[i];

+ 1 - 1
anki/scene/SkinNode.h

@@ -143,7 +143,7 @@ class SkinNode: public SceneNode
 		void frameUpdate(float prevUpdateTime, float crntTime);
 		void frameUpdate(float prevUpdateTime, float crntTime);
 
 
 	private:
 	private:
-		RsrcPtr<Skin> skin; ///< The resource
+		SkinResourcePointer skin; ///< The resource
 		std::vector<SkinPatchNode*> patches;
 		std::vector<SkinPatchNode*> patches;
 		Obb visibilityShapeWSpace;
 		Obb visibilityShapeWSpace;
 
 

+ 2 - 1
anki/scene/SkinPatchNode.cpp

@@ -1,5 +1,6 @@
 #include "anki/scene/SkinPatchNode.h"
 #include "anki/scene/SkinPatchNode.h"
 #include "anki/scene/SkinNode.h"
 #include "anki/scene/SkinNode.h"
+#include "anki/resource/MeshData.h"
 
 
 
 
 namespace anki {
 namespace anki {
@@ -87,7 +88,7 @@ SkinPatchNode::SkinPatchNode(const ModelPatch& modelPatch_, SkinNode& parent)
 	}
 	}
 
 
 	// Attach some extra stuff to the tfVao
 	// Attach some extra stuff to the tfVao
-	ASSERT(mesh.getVbo(Mesh::VBO_VERT_WEIGHTS).isCreated());
+	ANKI_ASSERT(mesh.getVbo(Mesh::VBO_VERT_WEIGHTS).isCreated());
 
 
 	tfVao.attachArrayBufferVbo(mesh.getVbo(Mesh::VBO_VERT_WEIGHTS),
 	tfVao.attachArrayBufferVbo(mesh.getVbo(Mesh::VBO_VERT_WEIGHTS),
 		VERT_WEIGHT_BONES_NUM_LOC,
 		VERT_WEIGHT_BONES_NUM_LOC,

+ 1 - 0
anki/scene/VisibilityTester.cpp

@@ -10,6 +10,7 @@
 #include "anki/scene/SpotLight.h"
 #include "anki/scene/SpotLight.h"
 #include "anki/core/ParallelManager.h"
 #include "anki/core/ParallelManager.h"
 #include "anki/core/Logger.h"
 #include "anki/core/Logger.h"
+#include "anki/core/Globals.h"
 
 
 
 
 namespace anki {
 namespace anki {

Some files were not shown because too many files changed in this diff