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

Same as befor. Wont compile

Panagiotis Christopoulos Charitos пре 13 година
родитељ
комит
234436292e
3 измењених фајлова са 23 додато и 7 уклоњено
  1. 13 1
      include/anki/gl/BufferObject.h
  2. 8 4
      include/anki/resource/Model.h
  3. 2 2
      src/resource/Model.cpp

+ 13 - 1
include/anki/gl/BufferObject.h

@@ -3,6 +3,7 @@
 
 #include "anki/gl/Ogl.h"
 #include "anki/util/Assert.h"
+#include "anki/util/NonCopyable.h"
 #include "anki/util/StdTypes.h"
 
 namespace anki {
@@ -12,14 +13,25 @@ namespace anki {
 	
 /// A wrapper for OpenGL buffer objects (vertex arrays, texture buffers etc)
 /// to prevent us from making idiotic errors
-class BufferObject
+class BufferObject: public NonCopyable
 {
 public:
 	/// @name Constructors/Destructor
 	/// @{
+
+	/// Default
 	BufferObject()
 	{}
 
+	/// Move
+	BufferObject(BufferObject&& b)
+		: glId(b.glId), target(b.target), usage(b.usage), 
+			sizeInBytes(b.sizeInBytes)
+#if ANKI_DEBUG
+			, mapped(b.mapped)
+#endif
+	{}
+
 	/// @see create
 	BufferObject(GLenum target, U32 sizeInBytes,
 		const void* dataPtr, GLenum usage)

+ 8 - 4
include/anki/resource/Model.h

@@ -15,8 +15,8 @@ namespace anki {
 class ModelPatchBase
 {
 public:
-	/// For garbage collection
-	typedef PtrVector<Vao> VaosContainer;
+	/// VAOs container
+	typedef Vector<Vao> VaosContainer;
 	/// Map to get the VAO given a PassLod key
 	typedef PassLevelHashMap<Vao*> PassLevelToVaoMap;
 
@@ -28,10 +28,13 @@ public:
 
 	const Vao& getVao(const PassLevelKey& key) const
 	{
-		return *vaosMap.at(key);
+		PassLevelToVaoMap::const_iterator it = vaosMap.find(key);
+		ANKI_ASSERT(it != vaosMap.end());
+		return *(*it);
 	}
 
-	U32 getIndecesNumber(const U32 lod) const
+	/// Allias to MeshBase::getIndicesCount()
+	U32 getIndecesCount(const U32 lod) const
 	{
 		return getMeshBase().getIndicesCount(lod);
 	}
@@ -52,6 +55,7 @@ protected:
 		VaosContainer& vaos,
 		PassLevelToVaoMap& vaosMap);
 
+private:
 	/// Called by @a createVaos multiple times to create and populate a single
 	/// VAO
 	static Vao* createNewVao(const Material& mtl,

+ 2 - 2
src/resource/Model.cpp

@@ -75,9 +75,9 @@ void ModelPatchBase::createVaos(const Material& mtl,
 	VaosContainer& vaos,
 	PassLevelToVaoMap& vaosMap)
 {
-	for(uint level = 0; level < mtl.getLevelsOfDetail(); ++level)
+	for(U32 level = 0; level < mtl.getLevelsOfDetail(); ++level)
 	{
-		for(uint pass = 0; pass < mtl.getPasses().size(); ++pass)
+		for(U32 pass = 0; pass < mtl.getPasses().size(); ++pass)
 		{
 			PassLevelKey key(pass, level);