[Bf-blender-cvs] [19607b9] temp-bge-cleanup: Special cleanup for BL_SkinDeformer

Porteries Tristan noreply at git.blender.org
Mon May 4 21:50:19 CEST 2015


Commit: 19607b95a7d8905b7f726d9fec500993fce36088
Author: Porteries Tristan
Date:   Mon May 4 21:46:26 2015 +0200
Branches: temp-bge-cleanup
https://developer.blender.org/rB19607b95a7d8905b7f726d9fec500993fce36088

Special cleanup for BL_SkinDeformer

===================================================================

M	source/gameengine/Converter/BL_SkinDeformer.cpp
M	source/gameengine/Converter/BL_SkinDeformer.h

===================================================================

diff --git a/source/gameengine/Converter/BL_SkinDeformer.cpp b/source/gameengine/Converter/BL_SkinDeformer.cpp
index 46d0b22..33afd60 100644
--- a/source/gameengine/Converter/BL_SkinDeformer.cpp
+++ b/source/gameengine/Converter/BL_SkinDeformer.cpp
@@ -84,13 +84,12 @@ static short get_deformflags(struct Object *bmeshobj)
 }
 
 BL_SkinDeformer::BL_SkinDeformer(BL_DeformableGameObject *gameobj,
-                                 struct Object *bmeshobj,
-								 class RAS_MeshObject *mesh,
-									 BL_ArmatureObject *arma)
-	:                           //
-	BL_MeshDeformer(gameobj, bmeshobj, mesh),
+                                 Object *bmeshobj,
+								 RAS_MeshObject *mesh,
+								 BL_ArmatureObject *arma)
+	: BL_MeshDeformer(gameobj, bmeshobj, mesh),
 	m_armobj(arma),
-	m_lastArmaUpdate(-1),
+	m_lastArmaUpdate(-1.0),
 	//m_defbase(&bmeshobj->defbase),
 	m_releaseobject(false),
 	m_poseApplied(false),
@@ -100,19 +99,18 @@ BL_SkinDeformer::BL_SkinDeformer(BL_DeformableGameObject *gameobj,
 {
 	copy_m4_m4(m_obmat, bmeshobj->obmat);
 	m_deformflags = get_deformflags(bmeshobj);
-};
-
-BL_SkinDeformer::BL_SkinDeformer(
-    BL_DeformableGameObject *gameobj,
-    struct Object *bmeshobj_old,    // Blender object that owns the new mesh
-    struct Object *bmeshobj_new,    // Blender object that owns the original mesh
-	class RAS_MeshObject *mesh,
-		bool release_object,
-		bool recalc_normal,
-		BL_ArmatureObject *arma)    :
-	BL_MeshDeformer(gameobj, bmeshobj_old, mesh),
+}
+
+BL_SkinDeformer::BL_SkinDeformer(BL_DeformableGameObject *gameobj,
+								 Object *bmeshobj_old,    // Blender object that owns the new mesh
+								 Object *bmeshobj_new,    // Blender object that owns the original mesh
+								 RAS_MeshObject *mesh,
+								 bool release_object,
+								 bool recalc_normal,
+								 BL_ArmatureObject *arma)    
+	: BL_MeshDeformer(gameobj, bmeshobj_old, mesh),
 	m_armobj(arma),
-	m_lastArmaUpdate(-1),
+	m_lastArmaUpdate(-1.0),
 	//m_defbase(&bmeshobj_old->defbase),
 	m_releaseobject(release_object),
 	m_recalcNormal(recalc_normal),
@@ -169,7 +167,7 @@ RAS_Deformer *BL_SkinDeformer::GetReplica()
 void BL_SkinDeformer::ProcessReplica()
 {
 	BL_MeshDeformer::ProcessReplica();
-	m_lastArmaUpdate = -1;
+	m_lastArmaUpdate = -1.0;
 	m_releaseobject = false;
 	m_dfnrToPC = NULL;
 }
@@ -208,8 +206,7 @@ void BL_SkinDeformer::BGEDeformVerts()
 
 	defbase_tot = BLI_listbase_count(&m_objMesh->defbase);
 
-	if (m_dfnrToPC == NULL)
-	{
+	if (m_dfnrToPC == NULL) {
 		m_dfnrToPC = new bPoseChannel *[defbase_tot];
 		int i;
 		for (i = 0, dg = (bDeformGroup *)m_objMesh->defbase.first;
@@ -229,16 +226,15 @@ void BL_SkinDeformer::BGEDeformVerts()
 	MDeformVert *dv = dverts;
 	MDeformWeight *dw;
 
-	for (int i = 0; i < m_bmesh->totvert; ++i, dv++)
-	{
-		float contrib = 0.f, weight, max_weight = -1.f;
+	for (int i = 0; i < m_bmesh->totvert; ++i, dv++) {
+		float contrib = 0.0f, weight, max_weight = -1.0f;
 		bPoseChannel *pchan = NULL;
 		Eigen::Map<Eigen::Vector3f> norm = Eigen::Vector3f::Map(m_transnors[i]);
-		Eigen::Vector4f vec(0, 0, 0, 1);
+		Eigen::Vector4f vec(0.0f, 0.0f, 0.0f, 1.0f);
 		Eigen::Vector4f co(m_transverts[i][0],
 		                   m_transverts[i][1],
 		                   m_transverts[i][2],
-		                   1.f);
+		                   1.0f);
 
 		if (!dv->totweight)
 			continue;
@@ -247,24 +243,20 @@ void BL_SkinDeformer::BGEDeformVerts()
 
 		dw = dv->dw;
 
-		for (unsigned int j = dv->totweight; j != 0; j--, dw++)
-		{
+		for (unsigned int j = dv->totweight; j != 0; j--, dw++) {
 			const int index = dw->def_nr;
 
-			if (index < defbase_tot && (pchan = m_dfnrToPC[index]))
-			{
+			if (index < defbase_tot && (pchan = m_dfnrToPC[index])) {
 				weight = dw->weight;
 
-				if (weight)
-				{
+				if (weight) {
 					chan_mat = Eigen::Matrix4f::Map((float *)pchan->chan_mat);
 
 					// Update Vertex Position
 					vec.noalias() += (chan_mat * co - co) * weight;
 
 					// Save the most influential channel so we can use it to update the vertex normal
-					if (weight > max_weight)
-					{
+					if (weight > max_weight) {
 						max_weight = weight;
 						norm_chan_mat = chan_mat;
 					}
@@ -278,7 +270,7 @@ void BL_SkinDeformer::BGEDeformVerts()
 		norm = norm_chan_mat.topLeftCorner<3, 3>() * norm;
 
 		co.noalias() += vec / contrib;
-		co[3] = 1.f; // Make sure we have a 1 for the w component!
+		co[3] = 1.0f; // Make sure we have a 1 for the w component!
 
 		co = post_mat * co;
 
@@ -330,14 +322,12 @@ bool BL_SkinDeformer::UpdateInternal(bool shape_applied)
 {
 	/* See if the armature has been updated for this frame */
 	if (PoseUpdated()) {
-
 		if (!shape_applied) {
 			/* store verts locally */
 			VerifyStorage();
 
 			/* duplicate */
-			for (int v = 0; v < m_bmesh->totvert; v++)
-			{
+			for (int v = 0; v < m_bmesh->totvert; v++) {
 				copy_v3_v3(m_transverts[v], m_bmesh->mvert[v].co);
 				normal_short_to_float_v3(m_transnors[v], m_bmesh->mvert[v].no);
 			}
diff --git a/source/gameengine/Converter/BL_SkinDeformer.h b/source/gameengine/Converter/BL_SkinDeformer.h
index fa8f808..7b82a28 100644
--- a/source/gameengine/Converter/BL_SkinDeformer.h
+++ b/source/gameengine/Converter/BL_SkinDeformer.h
@@ -47,27 +47,26 @@
 
 #include "RAS_Deformer.h"
 
-
 class BL_SkinDeformer : public BL_MeshDeformer
 {
 public:
 //	void SetArmatureController (BL_ArmatureController *cont);
-	virtual void Relink(CTR_Map<class CTR_HashedPtr, void *> *map);
+	virtual void Relink(CTR_Map<CTR_HashedPtr, void *> *map);
 	void SetArmature(class BL_ArmatureObject *armobj);
 
 	BL_SkinDeformer(BL_DeformableGameObject *gameobj,
-	                struct Object *bmeshobj,
-					class RAS_MeshObject *mesh,
+	                Object *bmeshobj,
+					RAS_MeshObject *mesh,
 						BL_ArmatureObject *arma = NULL);
 
 	/* this second constructor is needed for making a mesh deformable on the fly. */
 	BL_SkinDeformer(BL_DeformableGameObject *gameobj,
-	                struct Object *bmeshobj_old,
-	                struct Object *bmeshobj_new,
-					class RAS_MeshObject *mesh,
-						bool release_object,
-						bool recalc_normal,
-						BL_ArmatureObject *arma = NULL);
+	                Object *bmeshobj_old,
+	                Object *bmeshobj_new,
+					RAS_MeshObject *mesh,
+					bool release_object,
+					bool recalc_normal,
+					BL_ArmatureObject *arma = NULL);
 
 	virtual RAS_Deformer *GetReplica();
 	virtual void ProcessReplica();
@@ -92,7 +91,7 @@ public:
 	void ForceUpdate()
 	{
 		m_lastArmaUpdate = -1.0;
-	};
+	}
 	virtual bool ShareVertexArray()
 	{
 		return false;




More information about the Bf-blender-cvs mailing list