Panagiotis Christopoulos Charitos před 15 roky
rodič
revize
e1cfe4be01

Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 0 - 1
build/debug/Makefile


+ 1 - 0
src/Renderer/BufferObjects/Vbo.h

@@ -16,6 +16,7 @@ class Vbo: public BufferObject
 		/// Unbinds all VBOs, meaning both GL_ARRAY_BUFFER and GL_ELEMENT_ARRAY_BUFFER targets
 		static void unbindAllTargets();
 
+		/// The same as BufferObject::create but it only accepts GL_ARRAY_BUFFER or GL_ELEMENT_ARRAY_BUFFER in target
 		/// @see BufferObject::create
 		void create(GLenum target, uint sizeInBytes, const void* dataPtr, GLenum usage);
 };

+ 4 - 3
src/Resources/Model.cpp

@@ -7,12 +7,9 @@
 #include "Mesh.h"
 #include "SkelAnim.h"
 #include "MeshData.h"
-#include "Vao.h"
 #include "Skeleton.h"
 
 
-#define BUFFER_OFFSET(i) ((char *)NULL + (i))
-
 
 //======================================================================================================================
 // load                                                                                                                =
@@ -70,11 +67,14 @@ void Model::load(const char* filename)
   	//
   	// Sanity checks
   	//
+
+  	// Anims require skeleton
 		if(skelAnims.size() > 0 && !hasSkeleton())
 		{
 			throw EXCEPTION("You have skeleton animations but no skeleton");
 		}
 
+		// Anims and skel bones size check
 		for(uint i = 0; i < skelAnims.size(); i++)
 		{
 			// Bone number problem
@@ -85,6 +85,7 @@ void Model::load(const char* filename)
 			}
 		}
 
+		// if skeleton present then ModelPatches should support HW skinning
 		if(hasSkeleton())
 		{
 			for(uint i = 0; i < modelPatches.size(); i++)

+ 2 - 2
src/Resources/Model.h

@@ -40,7 +40,7 @@ class Scanner;
 /// @endcode
 ///
 /// Requirements:
-/// - If the materials need texture coords or/and vertex weights then mesh should have them
+/// - If the materials need texture coords then mesh should have them
 /// - The skeleton and skelAnims are optional
 /// - Its an error to have skelAnims without skeleton
 class Model: public Resource
@@ -60,7 +60,7 @@ class Model: public Resource
 		bool hasSkeleton() const {return skeleton.get() != NULL;}
 
 	private:
-		boost::ptr_vector<ModelPatch> modelPatches; ///< The vector of SubModel
+		boost::ptr_vector<ModelPatch> modelPatches; ///< The vector of ModelPatch
 		RsrcPtr<Skeleton> skeleton; ///< The skeleton. It can be empty
 		Vec<RsrcPtr<SkelAnim> > skelAnims; ///< The standard skeleton animations
 };

+ 1 - 0
src/Resources/ModelPatch.h

@@ -22,6 +22,7 @@ class ModelPatch
 		const Material& getDpMaterial() const {return *dpMaterial;}
 		/// @}
 
+		/// This only checks the mesh for vertex weights
 		bool supportsHardwareSkinning() const;
 
 	private:

+ 11 - 4
src/Scene/ModelNodePatch.cpp

@@ -1,6 +1,7 @@
 #include "ModelNodePatch.h"
 #include "Material.h"
 #include "MeshData.h"
+#include "ModelPatch.h"
 
 
 #define BUFFER_OFFSET(i) ((char *)NULL + (i))
@@ -9,7 +10,7 @@
 //======================================================================================================================
 // Constructor                                                                                                         =
 //======================================================================================================================
-ModelNodePatch::ModelNodePatch(const Model::SubModel& modelPatch_, bool isSkinPatch):
+ModelNodePatch::ModelNodePatch(const ModelPatch& modelPatch_, bool isSkinPatch):
 	modelPatch(modelPatch_)
 {
 	if(!isSkinPatch)
@@ -24,7 +25,13 @@ ModelNodePatch::ModelNodePatch(const Model::SubModel& modelPatch_, bool isSkinPa
 	}
 	else
 	{
-
+		//
+		// Create the TF VBOs
+		//
+		tfVbos[TF_VBO_POSITIONS].create(GL_ARRAY_BUFFER,
+		                                modelPatch.getMesh().getVbo(Mesh::VBO_VERT_POSITIONS).getSizeInBytes(),
+		                                NULL,
+		                                GL_STATIC_DRAW);
 	}
 }
 
@@ -60,7 +67,7 @@ void ModelNodePatch::createVao(const Material& mtl, const boost::array<const Vbo
 		                         2, GL_FLOAT, GL_FALSE, 0, NULL);
 	}
 
-	if(mtl.getStdAttribVar(Material::SAV_VERT_WEIGHT_BONES_NUM) != NULL)
+	/*if(mtl.getStdAttribVar(Material::SAV_VERT_WEIGHT_BONES_NUM) != NULL)
 	{
 		vao.attachArrayBufferVbo(*vbos[Mesh::VBO_VERT_WEIGHTS],
 		                         *mtl.getStdAttribVar(Material::SAV_VERT_WEIGHT_BONES_NUM), 1,
@@ -79,7 +86,7 @@ void ModelNodePatch::createVao(const Material& mtl, const boost::array<const Vbo
 		vao.attachArrayBufferVbo(*vbos[Mesh::VBO_VERT_WEIGHTS],
 		                         *mtl.getStdAttribVar(Material::SAV_VERT_WEIGHT_WEIGHTS), 4,
 		                         GL_FLOAT, GL_FALSE, sizeof(MeshData::VertexWeight), BUFFER_OFFSET(20));
-	}
+	}*/
 
 	vao.attachElementArrayBufferVbo(*vbos[Mesh::VBO_VERT_INDECES]);
 }

+ 3 - 2
src/Scene/ModelNodePatch.h

@@ -9,13 +9,14 @@
 
 
 class Material;
+class ModelPatch;
 
 
 /// A fragment of the ModelNode
 class ModelNodePatch
 {
 	public:
-		ModelNodePatch(const Model::SubModel& modelPatch, bool isSkinPatch);
+		ModelNodePatch(const ModelPatch& modelPatch, bool isSkinPatch);
 
 		/// Transform feedback VBOs
 		enum TfVbos
@@ -29,7 +30,7 @@ class ModelNodePatch
 		const Vbo& getTfVbo(TfVbos i) const {return tfVbos[i];}
 
 	private:
-		const Model::SubModel& modelPatch;
+		const ModelPatch& modelPatch;
 		boost::array<Vbo, TF_VBOS_NUM> tfVbos;
 		boost::array<const Vbo*, Mesh::VBOS_NUM> vbos;
 		Vao mainVao; ///< VAO for MS and BS

Některé soubory nejsou zobrazeny, neboť je v těchto rozdílových datech změněno mnoho souborů