Revision: 51333
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=51333
Author:   campbellbarton
Date:     2012-10-15 04:16:34 +0000 (Mon, 15 Oct 2012)
Log Message:
-----------
style cleanup: bge

Modified Paths:
--------------
    trunk/blender/source/blender/render/intern/source/shadeoutput.c
    trunk/blender/source/gameengine/Converter/KX_ConvertActuators.cpp
    trunk/blender/source/gameengine/Converter/KX_ConvertActuators.h
    trunk/blender/source/gameengine/Ketsji/KX_Scene.cpp

Modified: trunk/blender/source/blender/render/intern/source/shadeoutput.c
===================================================================
--- trunk/blender/source/blender/render/intern/source/shadeoutput.c     
2012-10-15 03:56:01 UTC (rev 51332)
+++ trunk/blender/source/blender/render/intern/source/shadeoutput.c     
2012-10-15 04:16:34 UTC (rev 51333)
@@ -468,9 +468,10 @@
 
        /* cross product */
 #define CROSS(dest, a, b) \
-       { dest[0]= a[1] * b[2] - a[2] * b[1]; \
-         dest[1]= a[2] * b[0] - a[0] * b[2]; \
-         dest[2]= a[0] * b[1] - a[1] * b[0]; \
+       { \
+               dest[0]= a[1] * b[2] - a[2] * b[1]; \
+               dest[1]= a[2] * b[0] - a[0] * b[2]; \
+               dest[2]= a[0] * b[1] - a[1] * b[0]; \
        } (void)0
 
        CROSS(cross[0], vec[0], vec[1]);

Modified: trunk/blender/source/gameengine/Converter/KX_ConvertActuators.cpp
===================================================================
--- trunk/blender/source/gameengine/Converter/KX_ConvertActuators.cpp   
2012-10-15 03:56:01 UTC (rev 51332)
+++ trunk/blender/source/gameengine/Converter/KX_ConvertActuators.cpp   
2012-10-15 04:16:34 UTC (rev 51333)
@@ -104,22 +104,25 @@
 #include "BL_BlenderDataConversion.h"
 
 /** 
- * KX_BLENDERTRUNC needed to round 'almost' zero values to zero, else 
velocities etc. are incorrectly set
+ * KX_flt_trunc needed to round 'almost' zero values to zero, else velocities 
etc. are incorrectly set
  */
 
-#define KX_BLENDERTRUNC(x)  (( x < 0.0001f && x > -0.0001f ) ? 0.0f : x)
+BLI_INLINE float KX_flt_trunc(const float x)
+{
+       return ( x < 0.0001f && x > -0.0001f ) ? 0.0f : x;
+}
 
 void BL_ConvertActuators(const char* maggiename,
-                                                struct Object* blenderobject,
-                                                KX_GameObject* gameobj,
-                                                SCA_LogicManager* logicmgr,
-                                                KX_Scene* scene,
-                                                KX_KetsjiEngine* ketsjiEngine,
-                                                int activeLayerBitInfo,
-                                                bool isInActiveLayer,
-                                                RAS_IRenderTools* rendertools,
-                                                KX_BlenderSceneConverter* 
converter
-                                                )
+                         struct Object* blenderobject,
+                         KX_GameObject* gameobj,
+                         SCA_LogicManager* logicmgr,
+                         KX_Scene* scene,
+                         KX_KetsjiEngine* ketsjiEngine,
+                         int activeLayerBitInfo,
+                         bool isInActiveLayer,
+                         RAS_IRenderTools* rendertools,
+                         KX_BlenderSceneConverter* converter
+                         )
 {
        
        int uniqueint = 0;
@@ -145,20 +148,23 @@
                        {
                                bObjectActuator* obact = (bObjectActuator*) 
bact->data;
                                KX_GameObject* obref = NULL;
-                               MT_Vector3 
forcevec(KX_BLENDERTRUNC(obact->forceloc[0]),
-                                       KX_BLENDERTRUNC(obact->forceloc[1]),
-                                       KX_BLENDERTRUNC(obact->forceloc[2]));
-                               MT_Vector3 
torquevec(obact->forcerot[0],obact->forcerot[1],obact->forcerot[2]);
-                               MT_Vector3 dlocvec ( 
KX_BLENDERTRUNC(obact->dloc[0]),
-                                       KX_BLENDERTRUNC(obact->dloc[1]),
-                                       KX_BLENDERTRUNC(obact->dloc[2]));
-                               MT_Vector3 drotvec ( 
KX_BLENDERTRUNC(obact->drot[0]),obact->drot[1],obact->drot[2]);
-                               MT_Vector3 linvelvec ( 
KX_BLENDERTRUNC(obact->linearvelocity[0]),
-                                       
KX_BLENDERTRUNC(obact->linearvelocity[1]),
-                                       
KX_BLENDERTRUNC(obact->linearvelocity[2]));
-                               MT_Vector3 angvelvec ( 
KX_BLENDERTRUNC(obact->angularvelocity[0]),
-                                       
KX_BLENDERTRUNC(obact->angularvelocity[1]),
-                                       
KX_BLENDERTRUNC(obact->angularvelocity[2]));
+                               MT_Vector3 
forcevec(KX_flt_trunc(obact->forceloc[0]),
+                                                   
KX_flt_trunc(obact->forceloc[1]),
+                                                   
KX_flt_trunc(obact->forceloc[2]));
+                               MT_Vector3 torquevec(obact->forcerot[0],
+                                                    obact->forcerot[1],
+                                                    obact->forcerot[2]);
+                               MT_Vector3 dlocvec(KX_flt_trunc(obact->dloc[0]),
+                                                  KX_flt_trunc(obact->dloc[1]),
+                                                  
KX_flt_trunc(obact->dloc[2]));
+                               MT_Vector3 drotvec(KX_flt_trunc(obact->drot[0]),
+                                                  
obact->drot[1],obact->drot[2]);
+                               MT_Vector3 
linvelvec(KX_flt_trunc(obact->linearvelocity[0]),
+                                                    
KX_flt_trunc(obact->linearvelocity[1]),
+                                                    
KX_flt_trunc(obact->linearvelocity[2]));
+                               MT_Vector3 
angvelvec(KX_flt_trunc(obact->angularvelocity[0]),
+                                                    
KX_flt_trunc(obact->angularvelocity[1]),
+                                                    
KX_flt_trunc(obact->angularvelocity[2]));
                                short damping = obact->damping;
 
                                /* Blender uses a bit vector internally for the 
local-flags. In */
@@ -180,17 +186,17 @@
                                        obref = 
converter->FindGameObject(obact->reference);
                                }
                                
-                               KX_ObjectActuator* tmpbaseact = new 
KX_ObjectActuator(gameobj,
-                                       obref,
-                                       forcevec.getValue(),
-                                       torquevec.getValue(),
-                                       dlocvec.getValue(),
-                                       drotvec.getValue(),
-                                       linvelvec.getValue(),
-                                       angvelvec.getValue(),
-                                       damping,
-                                       bitLocalFlag
-                                       );
+                               KX_ObjectActuator* tmpbaseact = new 
KX_ObjectActuator(
+                                           gameobj,
+                                           obref,
+                                           forcevec.getValue(),
+                                           torquevec.getValue(),
+                                           dlocvec.getValue(),
+                                           drotvec.getValue(),
+                                           linvelvec.getValue(),
+                                           angvelvec.getValue(),
+                                           damping,
+                                           bitLocalFlag);
                                baseact = tmpbaseact;
                                break;
                        }
@@ -209,22 +215,22 @@
                                if (actact->flag & ACT_IPOCHILD) ipo_flags |= 
BL_Action::ACT_IPOFLAG_CHILD;
                                        
                                BL_ActionActuator* tmpbaseact = new 
BL_ActionActuator(
-                                       gameobj,
-                                       propname,
-                                       propframe,
-                                       actact->sta,
-                                       actact->end,
-                                       actact->act,
-                                       actact->type, // + 1, because Blender 
starts to count at zero,
-                                       actact->blendin,
-                                       actact->priority,
-                                       actact->layer,
-                                       actact->layer_weight,
-                                       ipo_flags,
-                                       actact->end_reset,
-                                       actact->stridelength
-                                       // Ketsji at 1, because zero is 
reserved for "NoDef"
-                                       );
+                                           gameobj,
+                                           propname,
+                                           propframe,
+                                           actact->sta,
+                                           actact->end,
+                                           actact->act,
+                                           actact->type, // + 1, because 
Blender starts to count at zero,
+                                           actact->blendin,
+                                           actact->priority,
+                                           actact->layer,
+                                           actact->layer_weight,
+                                           ipo_flags,
+                                           actact->end_reset,
+                                           actact->stridelength
+                                           // Ketsji at 1, because zero is 
reserved for "NoDef"
+                                           );
                                baseact= tmpbaseact;
                                break;
                        }
@@ -236,18 +242,17 @@
                                        STR_String propframe = 
(actact->frameProp ? actact->frameProp : "");
                                        
                                        BL_ShapeActionActuator* tmpbaseact = 
new BL_ShapeActionActuator(
-                                               gameobj,
-                                               propname,
-                                               propframe,
-                                               actact->sta,
-                                               actact->end,
-                                               actact->act,
-                                               actact->type, // + 1, because 
Blender starts to count at zero,
-                                               actact->blendin,
-                                               actact->priority,
-                                               actact->stridelength
-                                               // Ketsji at 1, because zero is 
reserved for "NoDef"
-                                               );
+                                                   gameobj,
+                                                   propname,
+                                                   propframe,
+                                                   actact->sta,
+                                                   actact->end,
+                                                   actact->act,
+                                                   actact->type, // + 1, 
because Blender starts to count at zero,
+                                                   actact->blendin,
+                                                   actact->priority,
+                                                   actact->stridelength);
+                                       // Ketsji at 1, because zero is 
reserved for "NoDef"
                                        baseact= tmpbaseact;
                                        break;
                                }
@@ -266,17 +271,17 @@
                                bool ipo_add = (ipoact->flag & ACT_IPOADD);
                                
                                KX_IpoActuator* tmpbaseact = new KX_IpoActuator(
-                                       gameobj,
-                                       propname ,
-                                       frameProp,
-                                       ipoact->sta,
-                                       ipoact->end,
-                                       ipochild,
-                                       ipoact->type + 1, // + 1, because 
Blender starts to count at zero,
-                                       // Ketsji at 1, because zero is 
reserved for "NoDef"
-                                       ipo_as_force,
-                                       ipo_add,
-                                       local);
+                                           gameobj,
+                                           propname ,
+                                           frameProp,
+                                           ipoact->sta,
+                                           ipoact->end,
+                                           ipochild,
+                                           ipoact->type + 1, // + 1, because 
Blender starts to count at zero,
+                                           // Ketsji at 1, because zero is 
reserved for "NoDef"
+                                           ipo_as_force,
+                                           ipo_add,
+                                           local);
                                baseact = tmpbaseact;
                                break;
                        }
@@ -292,14 +297,14 @@
                                        
                                        /* visifac, fac and axis are not copied 
from the struct...   */ 
                                        /* that's some internal state...        
                     */
-                                       KX_CameraActuator *tmpcamact
-                                               = new KX_CameraActuator(gameobj,
-                                               tmpgob,
-                                               camact->height,
-                                               camact->min,
-                                               camact->max,
-                                               camact->axis,
-                                               camact->damping);
+                                       KX_CameraActuator *tmpcamact = new 
KX_CameraActuator(
+                                                   gameobj,
+                                                   tmpgob,
+                                                   camact->height,
+                                                   camact->min,
+                                                   camact->max,
+                                                   camact->axis,
+                                                   camact->damping);
                                        baseact = tmpcamact;
                                }
                                break;
@@ -332,14 +337,13 @@
                                        ? (char*) msgAct->body
                                        : "");
                                
-                               KX_NetworkMessageActuator *tmpmsgact = 
-                                       new KX_NetworkMessageActuator(
-                                       gameobj,                                
        // actuator controlling object
-                                       scene->GetNetworkScene(),       // 
needed for replication
-                                       toPropName,
-                                       subject,
-                                       bodyType,
-                                       body);
+                               KX_NetworkMessageActuator *tmpmsgact = new 
KX_NetworkMessageActuator(
+                                           gameobj,                            
        // actuator controlling object
+                                           scene->GetNetworkScene(),   // 
needed for replication
+                                           toPropName,
+                                           subject,
+                                           bodyType,
+                                           body);
                                baseact = tmpmsgact;
                                break;
                        }
@@ -456,11 +460,11 @@
                                        destinationObj = 
converter->FindGameObject(propact->ob);
                                
                                SCA_PropertyActuator* tmppropact = new 
SCA_PropertyActuator(
-                                       gameobj,
-                                       destinationObj,
-                                       propact->name,
-                                       propact->value,
-                                       propact->type+1); // + 1 because Ketsji 
Logic starts
+                                           gameobj,
+                                           destinationObj,
+                                           propact->name,
+                                           propact->value,
+                                           propact->type + 1); // + 1 because 
Ketsji Logic starts
                                // with 0 for KX_ACT_PROP_NODEF
                                baseact = tmppropact;
                                break;
@@ -490,18 +494,16 @@
                                                        }
                                                }
                                                
-                                               KX_SCA_AddObjectActuator* 
tmpaddact = 
-                                                       new 
KX_SCA_AddObjectActuator(
-                                                               gameobj, 
-                                                               originalval,
-                                                               editobact->time,
-                                                               scene,

@@ Diff output truncated at 10240 characters. @@
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to