whitespace bge edits
authorCampbell Barton <ideasman42@gmail.com>
Thu, 1 Sep 2011 02:12:53 +0000 (02:12 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Thu, 1 Sep 2011 02:12:53 +0000 (02:12 +0000)
43 files changed:
CMakeLists.txt
source/gameengine/Converter/BL_BlenderDataConversion.cpp
source/gameengine/Converter/BL_ShapeDeformer.cpp
source/gameengine/Converter/BlenderWorldInfo.cpp
source/gameengine/Converter/KX_ConvertActuators.cpp
source/gameengine/Converter/KX_ConvertSensors.cpp
source/gameengine/Expressions/InputParser.cpp
source/gameengine/GameLogic/SCA_2DFilterActuator.cpp
source/gameengine/GameLogic/SCA_ISensor.cpp
source/gameengine/GameLogic/SCA_KeyboardSensor.cpp
source/gameengine/GameLogic/SCA_MouseSensor.cpp
source/gameengine/GameLogic/SCA_RandomNumberGenerator.cpp
source/gameengine/GameLogic/SCA_RandomSensor.cpp
source/gameengine/GameLogic/SCA_XORController.cpp
source/gameengine/GamePlayer/common/bmfont.cpp
source/gameengine/GamePlayer/ghost/GPG_Application.cpp
source/gameengine/GamePlayer/ghost/GPG_ghost.cpp
source/gameengine/Ketsji/BL_BlenderShader.cpp
source/gameengine/Ketsji/KXNetwork/KX_NetworkEventManager.cpp
source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageActuator.cpp
source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.cpp
source/gameengine/Ketsji/KX_BlenderMaterial.cpp
source/gameengine/Ketsji/KX_BulletPhysicsController.cpp
source/gameengine/Ketsji/KX_Camera.cpp
source/gameengine/Ketsji/KX_Dome.cpp
source/gameengine/Ketsji/KX_GameObject.cpp
source/gameengine/Ketsji/KX_KetsjiEngine.cpp
source/gameengine/Ketsji/KX_Light.cpp
source/gameengine/Ketsji/KX_MeshProxy.cpp
source/gameengine/Ketsji/KX_MouseFocusSensor.cpp
source/gameengine/Ketsji/KX_PythonInit.cpp
source/gameengine/Ketsji/KX_RaySensor.cpp
source/gameengine/Ketsji/KX_SCA_EndObjectActuator.cpp
source/gameengine/Ketsji/KX_TrackToActuator.cpp
source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
source/gameengine/SceneGraph/SG_BBox.cpp
source/gameengine/SceneGraph/SG_Spatial.cpp
source/gameengine/VideoTexture/Exception.cpp
source/gameengine/VideoTexture/ImageBase.cpp
source/gameengine/VideoTexture/ImageRender.cpp
source/gameengine/VideoTexture/ImageViewport.cpp
source/gameengine/VideoTexture/VideoFFmpeg.cpp
source/gameengine/VideoTexture/blendVideoTex.cpp

index 77f0bed1dce229fb85b42edf46263afb581cd30d..38ce86898552da0509a9143d596c3362e15507b3 100644 (file)
@@ -948,7 +948,7 @@ elseif(APPLE)
                # we use precompiled libraries for py 3.2 and up by default
 
                # normally cached but not since we include them with blender
-                set(PYTHON_VERSION 3.2)
+               set(PYTHON_VERSION 3.2)
                set(PYTHON_INCLUDE_DIR "${LIBDIR}/python/include/python${PYTHON_VERSION}")
                # set(PYTHON_BINARY "${LIBDIR}/python/bin/python${PYTHON_VERSION}") # not used yet
                set(PYTHON_LIBRARY python${PYTHON_VERSION})
index 887deb1ffa33af0b049f616f46b2f61ae1b6296b..fcfc07e631e435f26e36d9839a00f759c001a8a5 100644 (file)
@@ -1911,11 +1911,11 @@ void RBJconstraints(Object *ob)//not used
 
 KX_IPhysicsController* getPhId(CListValue* sumolist,STR_String busc){//not used
 
-    for (int j=0;j<sumolist->GetCount();j++)
+       for (int j=0;j<sumolist->GetCount();j++)
        {
-           KX_GameObject* gameobje = (KX_GameObject*) sumolist->GetValue(j);
-           if (gameobje->GetName()==busc)
-            return gameobje->GetPhysicsController();
+               KX_GameObject* gameobje = (KX_GameObject*) sumolist->GetValue(j);
+               if (gameobje->GetName()==busc)
+                       return gameobje->GetPhysicsController();
        }
 
        return 0;
@@ -1924,11 +1924,11 @@ KX_IPhysicsController* getPhId(CListValue* sumolist,STR_String busc){//not used
 
 KX_GameObject* getGameOb(STR_String busc,CListValue* sumolist){
 
-    for (int j=0;j<sumolist->GetCount();j++)
+       for (int j=0;j<sumolist->GetCount();j++)
        {
-           KX_GameObject* gameobje = (KX_GameObject*) sumolist->GetValue(j);
-           if (gameobje->GetName()==busc)
-            return gameobje;
+               KX_GameObject* gameobje = (KX_GameObject*) sumolist->GetValue(j);
+               if (gameobje->GetName()==busc)
+                       return gameobje;
        }
        
        return 0;
@@ -2629,7 +2629,7 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
                                                {
                                                        PHY_IPhysicsController* physctrl = (PHY_IPhysicsController*) gameobj->GetPhysicsController()->GetUserData();
                                                        //we need to pass a full constraint frame, not just axis
-                                   
+
                                                        //localConstraintFrameBasis
                                                        MT_Matrix3x3 localCFrame(MT_Vector3(dat->axX,dat->axY,dat->axZ));
                                                        MT_Vector3 axis0 = localCFrame.getColumn(0);
index befe0f6e78475fcbe817c9f97830ccd277769806..f4c683f60ba4322d08b3a234a307fd7243722cd2 100644 (file)
@@ -69,12 +69,12 @@ extern "C"{
 //#undef __NLA_DEFNORMALS
 
 BL_ShapeDeformer::BL_ShapeDeformer(BL_DeformableGameObject *gameobj,
-                    Object *bmeshobj,
-                    RAS_MeshObject *mesh)
-                               :       
-                                       BL_SkinDeformer(gameobj,bmeshobj, mesh),
-                                       m_useShapeDrivers(false),
-                                       m_lastShapeUpdate(-1)
+                                   Object *bmeshobj,
+                                   RAS_MeshObject *mesh)
+    :
+      BL_SkinDeformer(gameobj,bmeshobj, mesh),
+      m_useShapeDrivers(false),
+      m_lastShapeUpdate(-1)
 {
        m_key = m_bmesh->key;
        m_bmesh->key = copy_key(m_key);
index 8fc01032de75786d642a5cc94bd2b83f904d5e51..f003a0049e5ac01de76c1f26afb573f177a15d8a 100644 (file)
@@ -170,10 +170,10 @@ float BlenderWorldInfo::getMistStart()
 float BlenderWorldInfo::getMistDistance()
 {
        return m_mistdistance;
-}  
-    
+}
+
+
 
-    
 float BlenderWorldInfo::getMistColorRed()
 {
        return m_mistcolor[0];
index 9621d05b5cc6fb15b8534c216a04d935ff2065b2..a84a1419d0db768d1ae443dae3a08272b1a26dcc 100644 (file)
@@ -996,7 +996,7 @@ void BL_ConvertActuators(char* maggiename,
                                        filtermode = RAS_2DFilterManager::RAS_2DFILTER_NOFILTER;
                                        break;
                        }
-            
+
                        tmp = new SCA_2DFilterActuator(gameobj, filtermode, _2dfilter->flag,
                                _2dfilter->float_arg,_2dfilter->int_arg,ketsjiEngine->GetRasterizer(),scene);
 
@@ -1012,8 +1012,8 @@ void BL_ConvertActuators(char* maggiename,
                                }
                        }
 
-            baseact = tmp;
-                       
+                       baseact = tmp;
+
                }
                break;
                case ACT_PARENT:
index ad6941dcdc7389342a0b353b496388e98cf23382..a250bc6064be36b2ce29204d0b5d1b5c838cb9ab 100644 (file)
@@ -276,7 +276,7 @@ void BL_ConvertSensors(struct Object* blenderobject,
                gReverseKeyTranslateTable[ENDKEY                        ] = SCA_IInputDevice::KX_ENDKEY;
        }
 
-    int executePriority = 0;
+       int executePriority = 0;
        int uniqueint = 0;
        int count = 0;
        bSensor* sens = (bSensor*)blenderobject->sensors.first;
index 7957c82e7f9f9d7af708116231f1dac8915b4104..27f4f0b10cb90c2e46f1960789f32b01a41ddb83 100644 (file)
@@ -192,89 +192,89 @@ void CParser::NextSym()
 
        switch(ch)
        {
-    case '(':
-               sym = lbracksym; NextCh();
-               break;
-    case ')':
-               sym = rbracksym; NextCh();
-               break;
-    case ',':
-               sym = commasym; NextCh();
-               break;
-       case '%' :
-               sym = opsym; opkind = OPmodulus; NextCh();
-               break;
-    case '+' :
-               sym = opsym; opkind = OPplus; NextCh();
-               break;
-    case '-' :
-               sym = opsym; opkind = OPminus; NextCh();
-               break;
-    case '*' :
-               sym = opsym; opkind = OPtimes; NextCh();
-               break;
-    case '/' :
-               sym = opsym; opkind = OPdivide; NextCh();
-               break;
-       case '&' :
-               sym = opsym; opkind = OPand; NextCh(); TermChar('&');
-               break;
-       case '|' :
-               sym = opsym; opkind = OPor; NextCh(); TermChar('|');
-               break;
-       case '=' :
-               sym = opsym; opkind = OPequal; NextCh(); TermChar('=');
-               break;
-       case '!' :
-               sym = opsym;
-               NextCh();
-               if (ch == '=')
-               {
-                       opkind = OPunequal;
+               case '(':
+                       sym = lbracksym; NextCh();
+                       break;
+               case ')':
+                       sym = rbracksym; NextCh();
+                       break;
+               case ',':
+                       sym = commasym; NextCh();
+                       break;
+               case '%' :
+                       sym = opsym; opkind = OPmodulus; NextCh();
+                       break;
+               case '+' :
+                       sym = opsym; opkind = OPplus; NextCh();
+                       break;
+               case '-' :
+                       sym = opsym; opkind = OPminus; NextCh();
+                       break;
+               case '*' :
+                       sym = opsym; opkind = OPtimes; NextCh();
+                       break;
+               case '/' :
+                       sym = opsym; opkind = OPdivide; NextCh();
+                       break;
+               case '&' :
+                       sym = opsym; opkind = OPand; NextCh(); TermChar('&');
+                       break;
+               case '|' :
+                       sym = opsym; opkind = OPor; NextCh(); TermChar('|');
+                       break;
+               case '=' :
+                       sym = opsym; opkind = OPequal; NextCh(); TermChar('=');
+                       break;
+               case '!' :
+                       sym = opsym;
                        NextCh();
-               }
-               else
-               {
-                       opkind = OPnot;
-               }
-               break;
-       case '>':
-               sym = opsym;
-               NextCh();
-               if (ch == '=')
-               {
-                       opkind = OPgreaterequal;
+                       if (ch == '=')
+                       {
+                               opkind = OPunequal;
+                               NextCh();
+                       }
+                       else
+                       {
+                               opkind = OPnot;
+                       }
+                       break;
+               case '>':
+                       sym = opsym;
                        NextCh();
-               }
-               else
-               {
-                       opkind = OPgreater;
-               }
-               break;
-       case '<':
-               sym = opsym;
-               NextCh();
-               if (ch == '=') {
-                       opkind = OPlessequal;
+                       if (ch == '=')
+                       {
+                               opkind = OPgreaterequal;
+                               NextCh();
+                       }
+                       else
+                       {
+                               opkind = OPgreater;
+                       }
+                       break;
+               case '<':
+                       sym = opsym;
                        NextCh();
-               } else {
-                       opkind = OPless;
-               }
-               break;
-    case '\"' : {
-               int start;
-               sym = constsym;
-               constkind = stringtype;
-               NextCh();
-               start = chcount;
-               while ((ch != '\"') && (ch != 0x0))
+                       if (ch == '=') {
+                               opkind = OPlessequal;
+                               NextCh();
+                       } else {
+                               opkind = OPless;
+                       }
+                       break;
+               case '\"' : {
+                       int start;
+                       sym = constsym;
+                       constkind = stringtype;
                        NextCh();
-               GrabRealString(start);
-               TermChar('\"'); // check for eol before '\"'
-               break;
-                               }
-    case 0x0: sym = eolsym; break;
-    default: 
+                       start = chcount;
+                       while ((ch != '\"') && (ch != 0x0))
+                               NextCh();
+                       GrabRealString(start);
+                       TermChar('\"'); // check for eol before '\"'
+                       break;
+               }
+               case 0x0: sym = eolsym; break;
+               default:
                {
                        int start;
                        start = chcount;
@@ -301,7 +301,7 @@ void CParser::NextSym()
                                }
                                GrabString(start);
                        } else if (((ch >= 'a') && (ch <= 'z'))
-                               || ((ch >= 'A') && (ch <= 'Z')))
+                                  || ((ch >= 'A') && (ch <= 'Z')))
                        { // reserved word?
                                
                                start = chcount;
@@ -358,18 +358,18 @@ STR_String CParser::Symbol2Str(int s) {
        // returns a string representation of of symbol s,
        // for use in Term when generating an error
        switch(s) {
-    case errorsym: return "error";
-    case lbracksym: return "(";
-    case rbracksym: return ")";
-    case commasym: return ",";
-    case opsym: return "operator";
-    case constsym: return "constant";
-       case sumsym: return "SUM";
-       case ifsym: return "IF";
-       case whocodedsym: return "WHOMADE";
-    case eolsym: return "end of line";
-       case idsym: return "identifier";
-    default: return "unknown";  // should not happen
+               case errorsym: return "error";
+               case lbracksym: return "(";
+               case rbracksym: return ")";
+               case commasym: return ",";
+               case opsym: return "operator";
+               case constsym: return "constant";
+               case sumsym: return "SUM";
+               case ifsym: return "IF";
+               case whocodedsym: return "WHOMADE";
+               case eolsym: return "end of line";
+               case idsym: return "identifier";
+               default: return "unknown";  // should not happen
        }
 }
 
@@ -391,19 +391,19 @@ int CParser::Priority(int optorkind) {
        // returns the priority of an operator
        // higher number means higher priority
        switch(optorkind) {
-       case OPor: return 1;
-       case OPand: return 2;
-       case OPgreater:
-       case OPless:
-       case OPgreaterequal:
-       case OPlessequal:
-       case OPequal:
-       case OPunequal: return 3;
-    case OPplus:
-    case OPminus: return 4;
-       case OPmodulus:
-    case OPtimes:
-    case OPdivide: return 5;
+               case OPor: return 1;
+               case OPand: return 2;
+               case OPgreater:
+               case OPless:
+               case OPgreaterequal:
+               case OPlessequal:
+               case OPequal:
+               case OPunequal: return 3;
+               case OPplus:
+               case OPminus: return 4;
+               case OPmodulus:
+               case OPtimes:
+               case OPdivide: return 5;
        }
        MT_assert(false);
        return 0;      // should not happen
index c270d9a312b8f72c441d75a58a24de0fe7deb982..7c1824cd4eb862100bfb7167474b35e2e33ef949 100644 (file)
@@ -40,20 +40,20 @@ SCA_2DFilterActuator::~SCA_2DFilterActuator()
 }
 
 SCA_2DFilterActuator::SCA_2DFilterActuator(
-        SCA_IObject *gameobj, 
+        SCA_IObject *gameobj,
         RAS_2DFilterManager::RAS_2DFILTER_MODE type,
-               short flag,
-               float float_arg,
-               int int_arg,
-               RAS_IRasterizer* rasterizer,
-               SCA_IScene* scene)
+        short flag,
+        float float_arg,
+        int int_arg,
+        RAS_IRasterizer* rasterizer,
+        SCA_IScene* scene)
     : SCA_IActuator(gameobj, KX_ACT_2DFILTER),
-     m_type(type),
-        m_disableMotionBlur(flag),
-        m_float_arg(float_arg),
-        m_int_arg(int_arg),
-        m_rasterizer(rasterizer),
-        m_scene(scene)
+      m_type(type),
+      m_disableMotionBlur(flag),
+      m_float_arg(float_arg),
+      m_int_arg(int_arg),
+      m_rasterizer(rasterizer),
+      m_scene(scene)
 {
        m_gameobj = NULL;
        if(gameobj){
@@ -65,9 +65,9 @@ SCA_2DFilterActuator::SCA_2DFilterActuator(
 
 CValue* SCA_2DFilterActuator::GetReplica()
 {
-    SCA_2DFilterActuator* replica = new SCA_2DFilterActuator(*this);
-    replica->ProcessReplica();
-    return replica;
+       SCA_2DFilterActuator* replica = new SCA_2DFilterActuator(*this);
+       replica->ProcessReplica();
+       return replica;
 }
 
 
@@ -94,7 +94,7 @@ bool SCA_2DFilterActuator::Update()
                m_scene->Update2DFilter(m_propNames, m_gameobj, m_type, m_int_arg, m_shaderText);
        }
        // once the filter is in place, no need to update it again => disable the actuator
-    return false;
+       return false;
 }
 
 
index 0d09e33a81b9a0853f72cf09efb162fa2437c382..85982bd3c0ff0fda34347ed398c75f3caaecdfc5 100644 (file)
@@ -216,8 +216,8 @@ void SCA_ISensor::UnregisterToManager()
 
 void SCA_ISensor::ActivateControllers(class SCA_LogicManager* logicmgr)
 {
-    for(vector<SCA_IController*>::const_iterator c= m_linkedcontrollers.begin();
-               c!=m_linkedcontrollers.end();++c)
+       for(vector<SCA_IController*>::const_iterator c= m_linkedcontrollers.begin();
+           c!=m_linkedcontrollers.end();++c)
        {
                SCA_IController* contr = *c;
                if (contr->IsActive())
index 513be43ec28df6a0eab03f39cd3bafd7fd80feff..a2374ccb9da9b89dd34670636c4d72373dfad81a 100644 (file)
@@ -132,7 +132,7 @@ bool SCA_KeyboardSensor::Evaluate()
        //      cerr << "SCA_KeyboardSensor::Eval event, sensing for "<< m_hotkey << " at device " << inputdev << "\n";
 
        /* See if we need to do logging: togPropState exists and is
-     * different from 0 */
+        * different from 0 */
        CValue* myparent = GetParent();
        CValue* togPropState = myparent->GetProperty(m_toggleprop);
        if (togPropState &&
@@ -400,7 +400,7 @@ void SCA_KeyboardSensor::LogKeystrokes(void)
                
                int index = 0;
                /* Check on all keys whether they were pushed. This does not
-         * untangle the ordering, so don't type too fast :) */
+                * untangle the ordering, so don't type too fast :) */
                for (int i=SCA_IInputDevice::KX_BEGINKEY ; i<= SCA_IInputDevice::KX_ENDKEY;i++)
                {
                        const SCA_InputEvent & inevent = inputdev->GetEventValue((SCA_IInputDevice::KX_EnumInputs) i);
index a1836163e9c763e3e16c4e8b40165e85bd1bcea5..93d2ae2c1c5056962b0bf6e01290a9738616cfb3 100644 (file)
 /* ------------------------------------------------------------------------- */
 
 SCA_MouseSensor::SCA_MouseSensor(SCA_MouseManager* eventmgr, 
-                                                                int startx,int starty,
-                                                                short int mousemode,
-                                                                SCA_IObject* gameobj)
+                                 int startx,int starty,
+                                 short int mousemode,
+                                 SCA_IObject* gameobj)
     : SCA_ISensor(gameobj,eventmgr),
-       m_x(startx),
-       m_y(starty)
+      m_x(startx),
+      m_y(starty)
 {
        m_mousemode   = mousemode;
        m_triggermode = true;
@@ -72,7 +72,7 @@ void SCA_MouseSensor::Init()
 
 SCA_MouseSensor::~SCA_MouseSensor() 
 {
-    /* Nothing to be done here. */
+       /* Nothing to be done here. */
 }
 
 void SCA_MouseSensor::UpdateHotkey(void *self)
index 06c24c8211bef92f63182507f24fa6f2b908785a..67af6237a8da62cbfa7b0f55b8b1eb2ea809cfc1 100644 (file)
@@ -68,12 +68,12 @@ SCA_RandomNumberGenerator::~SCA_RandomNumberGenerator() {
 
 void SCA_RandomNumberGenerator::SetStartVector(void) {
        /* setting initial seeds to mt[N] using         */
-    /* the generator Line 25 of Table 1 in          */
-    /* [KNUTH 1981, The Art of Computer Programming */
-    /*    Vol. 2 (2nd Ed.), pp102]                  */
-    mt[0] = m_seed & 0xffffffff;
-    for (mti = 1; mti < N; mti++)
-        mt[mti] = (69069 * mt[mti-1]) & 0xffffffff;
+       /* the generator Line 25 of Table 1 in          */
+       /* [KNUTH 1981, The Art of Computer Programming */
+       /*    Vol. 2 (2nd Ed.), pp102]                  */
+       mt[0] = m_seed & 0xffffffff;
+       for (mti = 1; mti < N; mti++)
+               mt[mti] = (69069 * mt[mti-1]) & 0xffffffff;
 }
 
 long SCA_RandomNumberGenerator::GetSeed() { return m_seed; }
@@ -87,39 +87,39 @@ void SCA_RandomNumberGenerator::SetSeed(long newseed)
  * This is the important part: copied verbatim :)
  */
 unsigned long SCA_RandomNumberGenerator::Draw() {
-    static unsigned long mag01[2] = { 0x0, MATRIX_A };
-    /* mag01[x] = x * MATRIX_A  for x=0,1 */
-
-    unsigned long y;
-
-    if (mti >= N) { /* generate N words at one time */
-        int kk;
-
-        /* I set this in the constructor, so it is always satisfied ! */
-//          if (mti == N+1)   /* if sgenrand() has not been called, */
-//              GEN_srand(4357); /* a default initial seed is used   */
-        
-        for (kk = 0; kk < N - M; kk++) {
-            y = (mt[kk] & UPPER_MASK) | (mt[kk+1] & LOWER_MASK);
-            mt[kk] = mt[kk+M] ^ (y >> 1) ^ mag01[y & 0x1];
-        }
-        for (; kk < N-1; kk++) {
-            y = (mt[kk] & UPPER_MASK) | (mt[kk+1] & LOWER_MASK);
-            mt[kk] = mt[kk+(M-N)] ^ (y >> 1) ^ mag01[y & 0x1];
-        }
-        y = (mt[N-1] & UPPER_MASK) | (mt[0] & LOWER_MASK);
-        mt[N-1] = mt[M-1] ^ (y >> 1) ^ mag01[y & 0x1];
-
-        mti = 0;
-    }
-  
-    y = mt[mti++];
-    y ^= TEMPERING_SHIFT_U(y);
-    y ^= TEMPERING_SHIFT_S(y) & TEMPERING_MASK_B;
-    y ^= TEMPERING_SHIFT_T(y) & TEMPERING_MASK_C;
-    y ^= TEMPERING_SHIFT_L(y);
-
-    return y;
+       static unsigned long mag01[2] = { 0x0, MATRIX_A };
+       /* mag01[x] = x * MATRIX_A  for x=0,1 */
+
+       unsigned long y;
+
+       if (mti >= N) { /* generate N words at one time */
+               int kk;
+
+               /* I set this in the constructor, so it is always satisfied ! */
+               //          if (mti == N+1)   /* if sgenrand() has not been called, */
+               //              GEN_srand(4357); /* a default initial seed is used   */
+
+               for (kk = 0; kk < N - M; kk++) {
+                       y = (mt[kk] & UPPER_MASK) | (mt[kk+1] & LOWER_MASK);
+                       mt[kk] = mt[kk+M] ^ (y >> 1) ^ mag01[y & 0x1];
+               }
+               for (; kk < N-1; kk++) {
+                       y = (mt[kk] & UPPER_MASK) | (mt[kk+1] & LOWER_MASK);
+                       mt[kk] = mt[kk+(M-N)] ^ (y >> 1) ^ mag01[y & 0x1];
+               }
+               y = (mt[N-1] & UPPER_MASK) | (mt[0] & LOWER_MASK);
+               mt[N-1] = mt[M-1] ^ (y >> 1) ^ mag01[y & 0x1];
+
+               mti = 0;
+       }
+
+       y = mt[mti++];
+       y ^= TEMPERING_SHIFT_U(y);
+       y ^= TEMPERING_SHIFT_S(y) & TEMPERING_MASK_B;
+       y ^= TEMPERING_SHIFT_T(y) & TEMPERING_MASK_C;
+       y ^= TEMPERING_SHIFT_L(y);
+
+       return y;
 }
 
 float SCA_RandomNumberGenerator::DrawFloat() {
index 99e2504258278974678a1c741ca3214bc833c00d..c23722d2d3c432e7ee702291b4f3899a7217e426 100644 (file)
@@ -48,8 +48,8 @@
 /* ------------------------------------------------------------------------- */
 
 SCA_RandomSensor::SCA_RandomSensor(SCA_EventManager* eventmgr, 
-                                SCA_IObject* gameobj, 
-                                int startseed)
+                                   SCA_IObject* gameobj,
+                                   int startseed)
     : SCA_ISensor(gameobj,eventmgr)
 {
        m_basegenerator = new SCA_RandomNumberGenerator(startseed);
@@ -65,10 +65,10 @@ SCA_RandomSensor::~SCA_RandomSensor()
 
 void SCA_RandomSensor::Init()
 {
-    m_iteration  = 0;
+       m_iteration  = 0;
        m_interval = 0;
        m_lastdraw   = false;
-    m_currentDraw = m_basegenerator->Draw();
+       m_currentDraw = m_basegenerator->Draw();
 }
 
 
@@ -97,19 +97,19 @@ bool SCA_RandomSensor::IsPositiveTrigger()
 
 bool SCA_RandomSensor::Evaluate()
 {
-    /* Random generator is the generator from Line 25 of Table 1 in          */
-    /* [KNUTH 1981, The Art of Computer Programming Vol. 2                   */
-    /* (2nd Ed.), pp102]                                                     */
-    /* It's a very simple max. length sequence generator. We can             */
-    /* draw 32 bool values before having to generate the next                */
-    /* sequence value. There are some theorems that will tell you            */
-    /* this is a reasonable way of generating bools. Check Knuth.            */
-    /* Furthermore, we only draw each <delay>-eth frame.                     */
+       /* Random generator is the generator from Line 25 of Table 1 in          */
+       /* [KNUTH 1981, The Art of Computer Programming Vol. 2                   */
+       /* (2nd Ed.), pp102]                                                     */
+       /* It's a very simple max. length sequence generator. We can             */
+       /* draw 32 bool values before having to generate the next                */
+       /* sequence value. There are some theorems that will tell you            */
+       /* this is a reasonable way of generating bools. Check Knuth.            */
+       /* Furthermore, we only draw each <delay>-eth frame.                     */
 
        bool evaluateResult = false;
 
        if (++m_interval > m_pulse_frequency) {
-           bool drawResult = false;
+               bool drawResult = false;
                m_interval = 0;
                if (m_iteration > 31) {
                        m_currentDraw = m_basegenerator->Draw();
@@ -122,8 +122,8 @@ bool SCA_RandomSensor::Evaluate()
                evaluateResult = drawResult != m_lastdraw;
                m_lastdraw = drawResult;
        }
-    
-    /* now pass this result to some controller */
+
+       /* now pass this result to some controller */
        return evaluateResult;
 }
 
index f5eefd5cc08f42e162c69651f77af542da7d7b88..4a03062b6adf77cbe07fb98eb81a4e5238fc6feb 100644 (file)
@@ -63,22 +63,22 @@ void SCA_XORController::Trigger(SCA_LogicManager* logicmgr)
        bool sensorresult = false;
 
        for (vector<SCA_ISensor*>::const_iterator is=m_linkedsensors.begin();
-       !(is==m_linkedsensors.end());is++)
+            !(is==m_linkedsensors.end());is++)
        {
                SCA_ISensor* sensor = *is;
                if (sensor->GetState())
                {
                        if (sensorresult == true)
                        {
-                sensorresult = false;
+                               sensorresult = false;
                                break;
                        }
-            sensorresult = true;
+                       sensorresult = true;
                }
        }
        
        for (vector<SCA_IActuator*>::const_iterator i=m_linkedactuators.begin();
-       !(i==m_linkedactuators.end());i++)
+            !(i==m_linkedactuators.end());i++)
        {
                SCA_IActuator* actua = *i;
                logicmgr->AddActiveActuator(actua,sensorresult);
index e3b900173d96bbb928287506659b1795f60bc43b..ecb2c4f3bd159839f041331303971e6a14ec090f 100644 (file)
@@ -190,7 +190,7 @@ void detectBitmapFont(ImBuf *ibuf)
        long i;
        
        if (ibuf != NULL) {
-               // bitmap must have an x size that is a power of two
+               // bitmap must have an x size that is a power of two
                if (is_power_of_two(ibuf->x)) {
                        rect = (unsigned char *) (ibuf->rect + (ibuf->x * (ibuf->y - 1)));
                        // printf ("starts with: %s %c %c %c %c\n", rect, rect[0], rect[1], rect[2], rect[3]);
index 546ec69bf295e4ffe23c8a4e90f27f28628055a8..c5daae9c963d943179058be33b41404a13ea9aea 100644 (file)
@@ -139,7 +139,7 @@ GPG_Application::GPG_Application(GHOST_ISystem* system)
 
 GPG_Application::~GPG_Application(void)
 {
-    if(m_pyGlobalDictString) {
+       if(m_pyGlobalDictString) {
                delete [] m_pyGlobalDictString;
                m_pyGlobalDictString = 0;
                m_pyGlobalDictString_Length = 0;
index cbbeb9419d185483d64fdde5fb312d3d6c4b874b..3f8bcf9e2ad45b3e1b879c05a3d5c2a4da2e897c 100644 (file)
@@ -380,12 +380,12 @@ int main(int argc, char** argv)
 #endif /* __linux__ */
        BLI_where_am_i(bprogname, sizeof(bprogname), argv[0]);
 #ifdef __APPLE__
-    // Can't use Carbon right now because of double defined type ID (In Carbon.h and DNA_ID.h, sigh)
-    /*
-    IBNibRef           nibRef;
-    WindowRef          window;
-    OSStatus           err;
-       
+       // Can't use Carbon right now because of double defined type ID (In Carbon.h and DNA_ID.h, sigh)
+       /*
+       IBNibRef                nibRef;
+       WindowRef               window;
+       OSStatus                err;
+
          // Create a Nib reference passing the name of the nib file (without the .nib extension)
          // CreateNibReference only searches into the application bundle.
          err = ::CreateNibReference(CFSTR("main"), &nibRef);
@@ -398,7 +398,7 @@ int main(int argc, char** argv)
                
                  // We don't need the nib reference anymore.
                  ::DisposeNibReference(nibRef);
-    */
+       */
 #endif // __APPLE__
        
        // We don't use threads directly in the BGE, but we need to call this so things like
@@ -421,7 +421,7 @@ int main(int argc, char** argv)
        BLF_init(11, U.dpi);
        BLF_lang_init();
        BLF_load_mem("default", (unsigned char*)datatoc_bfont_ttf, datatoc_bfont_ttf_size);
+
        // Parse command line options
 #if defined(DEBUG)
        printf("argv[0] = '%s'\n", argv[0]);
index 91982a424c78f612e42081a54aa6678760d5be3b..4ae937cdcd6e5bfe0599006c5cf93a694afb911c 100644 (file)
@@ -63,7 +63,7 @@ int BL_BlenderShader::GetAttribNum()
 
        GPU_material_vertex_attributes(mGPUMat, &attribs);
 
-    for(i = 0; i < attribs.totlayer; i++)
+       for(i = 0; i < attribs.totlayer; i++)
                if(attribs.layer[i].glindex+1 > enabled)
                        enabled= attribs.layer[i].glindex+1;
        
index e8e65371d3a33f7ac0a85b19f2a7e3d322d13781..72f1cee8855f47e3e5490bd49fc82e05cc1802f2 100644 (file)
@@ -66,8 +66,8 @@ void KX_NetworkEventManager::NextFrame()
        for (it.begin();!it.end();++it)
        {
 //         printf("KX_NetworkEventManager::proceed sensor %.2f\n", curtime);
-           // process queue
-           (*it)->Activate(m_logicmgr);
+               // process queue
+               (*it)->Activate(m_logicmgr);
        }
 
        // now a list of triggerer sensors has been built
index 2e0abc0290cf831a5d5b166528a13878a72c4246..9fd09506c0d9b7d554d55dd21ca4953ad9fc279f 100644 (file)
@@ -91,8 +91,7 @@ bool KX_NetworkMessageActuator::Update()
 
 CValue* KX_NetworkMessageActuator::GetReplica()
 {
-       KX_NetworkMessageActuator* replica =
-           new KX_NetworkMessageActuator(*this);
+       KX_NetworkMessageActuator* replica = new KX_NetworkMessageActuator(*this);
        replica->ProcessReplica();
 
        return replica;
index 6dcf50fa18f756237df54b0e631dec20750538cd..a795a4eddc654fc45e3998f2d07fd917eba73e5e 100644 (file)
 #endif
 
 KX_NetworkMessageSensor::KX_NetworkMessageSensor(
-       class KX_NetworkEventManager* eventmgr, // our eventmanager
-       class NG_NetworkScene *NetworkScene,    // our scene
-       SCA_IObject* gameobj,                                   // the sensor controlling object
-       const STR_String &subject
-) :
+        class KX_NetworkEventManager* eventmgr,        // our eventmanager
+        class NG_NetworkScene *NetworkScene,   // our scene
+        SCA_IObject* gameobj,                                  // the sensor controlling object
+        const STR_String &subject
+        ) :
     SCA_ISensor(gameobj,eventmgr),
     m_NetworkScene(NetworkScene),
     m_subject(subject),
@@ -67,7 +67,7 @@ KX_NetworkMessageSensor::KX_NetworkMessageSensor(
 
 void KX_NetworkMessageSensor::Init()
 {
-    m_IsUp = false;
+       m_IsUp = false;
 }
 
 KX_NetworkMessageSensor::~KX_NetworkMessageSensor()
index 4226896aec00a0aad3c6130eadb7e43517c0fdb9..33da17cc50547323c4d280c799bc960bf72b0b23 100644 (file)
@@ -56,21 +56,21 @@ KX_BlenderMaterial::KX_BlenderMaterial()
 }
 
 void KX_BlenderMaterial::Initialize(
-    KX_Scene *scene,
-       BL_Material *data)
+        KX_Scene *scene,
+        BL_Material *data)
 {
        RAS_IPolyMaterial::Initialize(
-               data->texname[0],
-               data->matname,
-               data->materialindex,
-               data->tile,
-               data->tilexrep[0],
-               data->tileyrep[0],
-               data->mode,
-               data->transp,
-               ((data->ras_mode &ALPHA)!=0),
-               ((data->ras_mode &ZSORT)!=0)
-       );
+                   data->texname[0],
+                   data->matname,
+                   data->materialindex,
+                   data->tile,
+                   data->tilexrep[0],
+                   data->tileyrep[0],
+                   data->mode,
+                   data->transp,
+                   ((data->ras_mode &ALPHA)!=0),
+                   ((data->ras_mode &ZSORT)!=0)
+                   );
        mMaterial = data;
        mShader = 0;
        mBlenderShader = 0;
@@ -80,7 +80,7 @@ void KX_BlenderMaterial::Initialize(
        mConstructed = false;
        mPass = 0;
        // --------------------------------
-       // RAS_IPolyMaterial variables... 
+       // RAS_IPolyMaterial variables...
        m_flag |= RAS_BLENDERMAT;
        m_flag |= (mMaterial->IdMode>=ONETEX)? RAS_MULTITEX: 0;
        m_flag |= ((mMaterial->ras_mode & USE_LIGHT)!=0)? RAS_MULTILIGHT: 0;
@@ -93,14 +93,11 @@ void KX_BlenderMaterial::Initialize(
        mMaterial->num_enabled = enabled>=max?max:enabled;
 
        // test the sum of the various modes for equality
-       // so we can ether accept or reject this material 
-       // as being equal, this is rather important to 
+       // so we can ether accept or reject this material
+       // as being equal, this is rather important to
        // prevent material bleeding
        for(int i=0; i<mMaterial->num_enabled; i++) {
-               m_multimode     +=
-                       ( mMaterial->flag[i]    +
-                         mMaterial->blend_mode[i]
-                        );
+               m_multimode     += (mMaterial->flag[i] + mMaterial->blend_mode[i]);
        }
        m_multimode += mMaterial->IdMode+ (mMaterial->ras_mode & ~(COLLIDER|USE_LIGHT));
 }
index fde01961fd5ca63dfb14b597fcedd2af972381bd..6e5513991f9df51e1d7cbacb26b6707d475a9d02 100644 (file)
@@ -213,16 +213,16 @@ MT_Scalar KX_BulletPhysicsController::GetMass()
 
 MT_Vector3 KX_BulletPhysicsController::GetLocalInertia()
 {
-    MT_Vector3 inertia(0.f, 0.f, 0.f);
-    btVector3 inv_inertia;
-    if (GetRigidBody()) {
-        inv_inertia = GetRigidBody()->getInvInertiaDiagLocal();
-               if (!btFuzzyZero(inv_inertia.getX()) && 
-                       !btFuzzyZero(inv_inertia.getY()) && 
-                       !btFuzzyZero(inv_inertia.getZ()))
+       MT_Vector3 inertia(0.f, 0.f, 0.f);
+       btVector3 inv_inertia;
+       if (GetRigidBody()) {
+               inv_inertia = GetRigidBody()->getInvInertiaDiagLocal();
+               if (!btFuzzyZero(inv_inertia.getX()) &&
+                       !btFuzzyZero(inv_inertia.getY()) &&
+                       !btFuzzyZero(inv_inertia.getZ()))
                        inertia = MT_Vector3(1.f/inv_inertia.getX(), 1.f/inv_inertia.getY(), 1.f/inv_inertia.getZ());
-    }
-    return inertia;
+       }
+       return inertia;
 }
 
 MT_Vector3     KX_BulletPhysicsController::getReactionForce()
index c60c931c33b102d263f91ab2c48e02fa9e5ec19e..a488d64679211ce13765c2bab32658a362302307 100644 (file)
@@ -271,18 +271,18 @@ void KX_Camera::ExtractFrustumSphere()
        if (m_set_frustum_center)
                return;
 
-    // compute sphere for the general case and not only symmetric frustum:
-    // the mirror code in ImageRender can use very asymmetric frustum.
-    // We will put the sphere center on the line that goes from origin to the center of the far clipping plane
-    // This is the optimal position if the frustum is symmetric or very asymmetric and probably close
-    // to optimal for the general case. The sphere center position is computed so that the distance to 
-    // the near and far extreme frustum points are equal.
-
-    // get the transformation matrix from device coordinate to camera coordinate
+       // compute sphere for the general case and not only symmetric frustum:
+       // the mirror code in ImageRender can use very asymmetric frustum.
+       // We will put the sphere center on the line that goes from origin to the center of the far clipping plane
+       // This is the optimal position if the frustum is symmetric or very asymmetric and probably close
+       // to optimal for the general case. The sphere center position is computed so that the distance to
+       // the near and far extreme frustum points are equal.
+
+       // get the transformation matrix from device coordinate to camera coordinate
        MT_Matrix4x4 clip_camcs_matrix = m_projection_matrix;
        clip_camcs_matrix.invert();
 
-       if (m_projection_matrix[3][3] == MT_Scalar(0.0)) 
+       if (m_projection_matrix[3][3] == MT_Scalar(0.0))
        {
                // frustrum projection
                // detect which of the corner of the far clipping plane is the farthest to the origin
@@ -302,7 +302,7 @@ void KX_Camera::ExtractFrustumSphere()
                MT_Scalar len;
                for (int i=0; i<4; i++)
                {
-               hpoint = clip_camcs_matrix*npoint;
+                       hpoint = clip_camcs_matrix*npoint;
                        point.setValue(hpoint[0]/hpoint[3], hpoint[1]/hpoint[3], hpoint[2]/hpoint[3]);
                        len = point.dot(point);
                        if (len > F)
@@ -321,7 +321,7 @@ void KX_Camera::ExtractFrustumSphere()
                farcenter *= 0.25;
                // the extreme near point is the opposite point on the near clipping plane
                nfar.setValue(-nfar[0], -nfar[1], -1., 1.);
-               nfar = clip_camcs_matrix*nfar;
+               nfar = clip_camcs_matrix*nfar;
                nearpoint.setValue(nfar[0]/nfar[3], nfar[1]/nfar[3], nfar[2]/nfar[3]);
                // this is a frustrum projection
                N = nearpoint.dot(nearpoint);
@@ -340,7 +340,7 @@ void KX_Camera::ExtractFrustumSphere()
                z = (F-N)/(2.0*(e-s+c*(f-n)));
                m_frustum_center = MT_Point3(farcenter[0]*z/e, farcenter[1]*z/e, z);
                m_frustum_radius = m_frustum_center.distance(farpoint);
-       } 
+       }
        else
        {
                // orthographic projection
index 2e1fb933ad05f3588da6225e47366ea503669f20..00c5e5803a828eae6cf08a53121ddbfe848645f0 100644 (file)
@@ -42,34 +42,34 @@ Developed as part of a Research and Development project for SAT - La Société d
 
 // constructor
 KX_Dome::KX_Dome (
-       RAS_ICanvas* canvas,
-    /// rasterizer
-    RAS_IRasterizer* rasterizer,
-    /// render tools
-    RAS_IRenderTools* rendertools,
-    /// engine
-    KX_KetsjiEngine* engine,
-
-       short res,              //resolution of the mesh
-       short mode,             //mode - fisheye, truncated, warped, panoramic, ...
-       short angle,
-       float resbuf,   //size adjustment of the buffer
-       short tilt,
-       struct Text* warptext
-
-):
-       dlistSupported(false),
-       canvaswidth(-1), canvasheight(-1),
-       m_drawingmode(engine->GetDrawType()),
-       m_resolution(res),
-       m_mode(mode),
-       m_angle(angle),
-       m_resbuffer(resbuf),
-       m_tilt(tilt),
-       m_canvas(canvas),
-       m_rasterizer(rasterizer),
-       m_rendertools(rendertools),
-       m_engine(engine)
+        RAS_ICanvas* canvas,
+        /// rasterizer
+        RAS_IRasterizer* rasterizer,
+        /// render tools
+        RAS_IRenderTools* rendertools,
+        /// engine
+        KX_KetsjiEngine* engine,
+
+        short res,             //resolution of the mesh
+        short mode,            //mode - fisheye, truncated, warped, panoramic, ...
+        short angle,
+        float resbuf,  //size adjustment of the buffer
+        short tilt,
+        struct Text* warptext
+
+        ):
+    dlistSupported(false),
+    canvaswidth(-1), canvasheight(-1),
+    m_drawingmode(engine->GetDrawType()),
+    m_resolution(res),
+    m_mode(mode),
+    m_angle(angle),
+    m_resbuffer(resbuf),
+    m_tilt(tilt),
+    m_canvas(canvas),
+    m_rasterizer(rasterizer),
+    m_rendertools(rendertools),
+    m_engine(engine)
 {
        warp.usemesh = false;
        fboSupported = false;
@@ -1984,9 +1984,9 @@ void KX_Dome::DrawDomeWarped(void)
        int can_width = m_viewport.GetRight();
        int can_height = m_viewport.GetTop();
 
-       double screen_ratio = can_width/ (double) can_height;   
+       double screen_ratio = can_width/ (double) can_height;
 
-    glOrtho(-screen_ratio,screen_ratio,-1.0,1.0,-20.0,10.0);
+       glOrtho(-screen_ratio,screen_ratio,-1.0,1.0,-20.0,10.0);
 
 
        glMatrixMode(GL_TEXTURE);
index 7ced0c0c4d79d338e1593befa3e670b4cf04712d..67178803457b66f3ed920271ce81d74674987825 100644 (file)
@@ -87,32 +87,32 @@ typedef unsigned long uint_ptr;
 
 static MT_Point3 dummy_point= MT_Point3(0.0, 0.0, 0.0);
 static MT_Vector3 dummy_scaling = MT_Vector3(1.0, 1.0, 1.0);
-static MT_Matrix3x3 dummy_orientation = MT_Matrix3x3(  1.0, 0.0, 0.0,
-                                                                                                               0.0, 1.0, 0.0,
-                                                                                                               0.0, 0.0, 1.0);
+static MT_Matrix3x3 dummy_orientation = MT_Matrix3x3(1.0, 0.0, 0.0,
+                                                     0.0, 1.0, 0.0,
+                                                     0.0, 0.0, 1.0);
 
 KX_GameObject::KX_GameObject(
-       void* sgReplicationInfo,
-       SG_Callbacks callbacks)
-       : SCA_IObject(),
-       m_bDyna(false),
-       m_layer(0),
-       m_pBlenderObject(NULL),
-       m_pBlenderGroupObject(NULL),
-       m_bSuspendDynamics(false),
-       m_bUseObjectColor(false),
-       m_bIsNegativeScaling(false),
-       m_bVisible(true),
-       m_bCulled(true),
-       m_bOccluder(false),
-       m_pPhysicsController1(NULL),
-       m_pGraphicController(NULL),
-       m_xray(false),
-       m_pHitObject(NULL),
-    m_actionManager(NULL),
-       m_isDeformable(false)
-#ifdef WITH_PYTHON
-       , m_attr_dict(NULL)
+        void* sgReplicationInfo,
+        SG_Callbacks callbacks)
+    : SCA_IObject(),
+      m_bDyna(false),
+      m_layer(0),
+      m_pBlenderObject(NULL),
+      m_pBlenderGroupObject(NULL),
+      m_bSuspendDynamics(false),
+      m_bUseObjectColor(false),
+      m_bIsNegativeScaling(false),
+      m_bVisible(true),
+      m_bCulled(true),
+      m_bOccluder(false),
+      m_pPhysicsController1(NULL),
+      m_pGraphicController(NULL),
+      m_xray(false),
+      m_pHitObject(NULL),
+      m_actionManager(NULL),
+      m_isDeformable(false)
+    #ifdef WITH_PYTHON
+    , m_attr_dict(NULL)
 #endif
 {
        m_ignore_activity_culling = false;
index b1a214b7c1c7c79eb220a455ac09c4a562c610a1..878232f7a501ad708bad443dc4c66a2a382d03ac 100644 (file)
@@ -116,7 +116,7 @@ bool   KX_KetsjiEngine::m_restrict_anim_fps = false;
  *     Constructor of the Ketsji Engine
  */
 KX_KetsjiEngine::KX_KetsjiEngine(KX_ISystem* system)
-     : m_canvas(NULL),
+       :       m_canvas(NULL),
        m_rasterizer(NULL),
        m_kxsystem(system),
        m_rendertools(NULL),
index 3f09eee013e53b7493fbd849253d9c37a2782aa1..2f2c45cd5cceacb86c93bb5caeda04c9cbc8376c 100644 (file)
@@ -355,11 +355,11 @@ PyObject* KX_LightObject::pyattr_get_typeconst(void *self_v, const KX_PYATTRIBUT
        } else if (!strcmp(type, "NORMAL")) {
                retvalue = PyLong_FromSsize_t(RAS_LightObject::LIGHT_NORMAL);
        }
-    else {
-        /* should never happen */
-        PyErr_SetString(PyExc_TypeError, "light.type: internal error, invalid light type");
-        retvalue = NULL;
-    }
+       else {
+               /* should never happen */
+               PyErr_SetString(PyExc_TypeError, "light.type: internal error, invalid light type");
+               retvalue = NULL;
+       }
 
        return retvalue;
 }
index ba41dc355f76a1341e41f464c10898dd45358af8..9ad09f9793ba27d0c8f87fd04d909fcbbc301e67 100644 (file)
@@ -119,7 +119,7 @@ CValue*             KX_MeshProxy::GetReplica() { return NULL;}
 
 PyObject* KX_MeshProxy::PyGetMaterialName(PyObject* args, PyObject* kwds)
 {
-    int matid= 1;
+       int matid= 1;
        STR_String matname;
 
        if (PyArg_ParseTuple(args,"i:getMaterialName",&matid))
@@ -131,13 +131,13 @@ PyObject* KX_MeshProxy::PyGetMaterialName(PyObject* args, PyObject* kwds)
        }
 
        return PyUnicode_FromString(matname.Ptr());
-               
+
 }
-       
+
 
 PyObject* KX_MeshProxy::PyGetTextureName(PyObject* args, PyObject* kwds)
 {
-    int matid= 1;
+       int matid= 1;
        STR_String matname;
 
        if (PyArg_ParseTuple(args,"i:getTextureName",&matid))
@@ -154,7 +154,7 @@ PyObject* KX_MeshProxy::PyGetTextureName(PyObject* args, PyObject* kwds)
 
 PyObject* KX_MeshProxy::PyGetVertexArrayLength(PyObject* args, PyObject* kwds)
 {
-    int matid= 0;
+       int matid= 0;
        int length = 0;
 
        
@@ -177,7 +177,7 @@ PyObject* KX_MeshProxy::PyGetVertexArrayLength(PyObject* args, PyObject* kwds)
 
 PyObject* KX_MeshProxy::PyGetVertex(PyObject* args, PyObject* kwds)
 {
-    int vertexindex;
+       int vertexindex;
        int matindex;
 
        if (!PyArg_ParseTuple(args,"ii:getVertex",&matindex,&vertexindex))
@@ -195,7 +195,7 @@ PyObject* KX_MeshProxy::PyGetVertex(PyObject* args, PyObject* kwds)
 
 PyObject* KX_MeshProxy::PyGetPolygon(PyObject* args, PyObject* kwds)
 {
-    int polyindex= 1;
+       int polyindex= 1;
        PyObject* polyob = NULL;
 
        if (!PyArg_ParseTuple(args,"i:getPolygon",&polyindex))
index 6cb80028858416f80615b714f69d6d32a5932c5b..34f5c26415d5ea7fc9757104b47233e0384c0b59 100644 (file)
@@ -121,14 +121,14 @@ bool KX_MouseFocusSensor::Evaluate()
                        }
                } 
                if (reset) {
-                       // force an event 
+                       // force an event
                        result = true;
                }
        } else {
                /* No focus behaviour required: revert to the basic mode. This
-         * mode is never used, because the converter never makes this
-         * sensor for a mouse-key event. It is here for
-         * completeness. */
+                * mode is never used, because the converter never makes this
+                * sensor for a mouse-key event. It is here for
+                * completeness. */
                result = SCA_MouseSensor::Evaluate();
                m_positive_event = (m_val!=0);
        }
index 8557ebab0a9b3a4d6aa89a8c1ec2147b82cd6c2c..395e2048cb7a07e1ba5d594ca0d539ffb67f7ef7 100644 (file)
@@ -389,10 +389,10 @@ static PyObject* gPyGetSpectrum(PyObject*)
 {
        PyObject* resultlist = PyList_New(512);
 
-        for (int index = 0; index < 512; index++)
-        {
-                PyList_SET_ITEM(resultlist, index, PyFloat_FromDouble(0.0));
-        }
+       for (int index = 0; index < 512; index++)
+       {
+               PyList_SET_ITEM(resultlist, index, PyFloat_FromDouble(0.0));
+       }
 
        return resultlist;
 }
@@ -479,13 +479,13 @@ static PyObject* gPyGetBlendFileList(PyObject*, PyObject* args)
        char cpath[sizeof(gp_GamePythonPath)];
        char *searchpath = NULL;
        PyObject* list, *value;
-       
-    DIR *dp;
-    struct dirent *dirp;
-       
+
+       DIR *dp;
+       struct dirent *dirp;
+
        if (!PyArg_ParseTuple(args, "|s:getBlendFileList", &searchpath))
                return NULL;
-       
+
        list = PyList_New(0);
        
        if (searchpath) {
@@ -495,23 +495,23 @@ static PyObject* gPyGetBlendFileList(PyObject*, PyObject* args)
                /* Get the dir only */
                BLI_split_dirfile(gp_GamePythonPath, cpath, NULL);
        }
-       
-    if((dp  = opendir(cpath)) == NULL) {
+
+       if((dp  = opendir(cpath)) == NULL) {
                /* todo, show the errno, this shouldnt happen anyway if the blendfile is readable */
                fprintf(stderr, "Could not read directoty (%s) failed, code %d (%s)\n", cpath, errno, strerror(errno));
                return list;
-    }
+       }
        
-    while ((dirp = readdir(dp)) != NULL) {
+       while ((dirp = readdir(dp)) != NULL) {
                if (BLI_testextensie(dirp->d_name, ".blend")) {
                        value= PyUnicode_DecodeFSDefault(dirp->d_name);
                        PyList_Append(list, value);
                        Py_DECREF(value);
                }
-    }
+       }
        
-    closedir(dp);
-    return list;
+       closedir(dp);
+       return list;
 }
 
 static char gPyAddScene_doc[] = 
@@ -1662,9 +1662,9 @@ PyObject* initGameLogic(KX_KetsjiEngine *engine, KX_Scene* scene) // quick hack
 
        // Check for errors
        if (PyErr_Occurred())
-    {
+       {
                Py_FatalError("can't initialize module bge.logic");
-    }
+       }
 
        return m;
 }
@@ -1954,12 +1954,12 @@ PyObject* initRasterizer(RAS_IRasterizer* rasty,RAS_ICanvas* canvas)
        gp_Rasterizer = rasty;
 
 
-  PyObject* m;
-  PyObject* d;
-  PyObject* item;
+       PyObject* m;
+       PyObject* d;
+       PyObject* item;
 
        /* Use existing module where possible
-        * be careful not to init any runtime vars after this */
+  * be careful not to init any runtime vars after this */
        m = PyImport_ImportModule( "Rasterizer" );
        if(m) {
                Py_DECREF(m);
@@ -1967,32 +1967,32 @@ PyObject* initRasterizer(RAS_IRasterizer* rasty,RAS_ICanvas* canvas)
        }
        else {
                PyErr_Clear();
-       
+
                // Create the module and add the functions
                m = PyModule_Create(&Rasterizer_module_def);
                PyDict_SetItemString(PySys_GetObject("modules"), Rasterizer_module_def.m_name, m);
        }
 
-  // Add some symbolic constants to the module
-  d = PyModule_GetDict(m);
-  ErrorObject = PyUnicode_FromString("Rasterizer.error");
-  PyDict_SetItemString(d, "error", ErrorObject);
-  Py_DECREF(ErrorObject);
+       // Add some symbolic constants to the module
+       d = PyModule_GetDict(m);
+       ErrorObject = PyUnicode_FromString("Rasterizer.error");
+       PyDict_SetItemString(d, "error", ErrorObject);
+       Py_DECREF(ErrorObject);
 
-  /* needed for get/setMaterialType */
-  KX_MACRO_addTypesToDict(d, KX_TEXFACE_MATERIAL, KX_TEXFACE_MATERIAL);
-  KX_MACRO_addTypesToDict(d, KX_BLENDER_MULTITEX_MATERIAL, KX_BLENDER_MULTITEX_MATERIAL);
-  KX_MACRO_addTypesToDict(d, KX_BLENDER_GLSL_MATERIAL, KX_BLENDER_GLSL_MATERIAL);
+       /* needed for get/setMaterialType */
+       KX_MACRO_addTypesToDict(d, KX_TEXFACE_MATERIAL, KX_TEXFACE_MATERIAL);
+       KX_MACRO_addTypesToDict(d, KX_BLENDER_MULTITEX_MATERIAL, KX_BLENDER_MULTITEX_MATERIAL);
+       KX_MACRO_addTypesToDict(d, KX_BLENDER_GLSL_MATERIAL, KX_BLENDER_GLSL_MATERIAL);
 
-  // XXXX Add constants here
+       // XXXX Add constants here
 
-  // Check for errors
-  if (PyErr_Occurred())
-    {
-      Py_FatalError("can't initialize module Rasterizer");
-    }
+       // Check for errors
+       if (PyErr_Occurred())
+       {
+               Py_FatalError("can't initialize module Rasterizer");
+       }
 
-  return d;
+       return d;
 }
 
 
@@ -2231,9 +2231,9 @@ PyObject* initGameKeys()
 
        // Check for errors
        if (PyErr_Occurred())
-    {
+       {
                Py_FatalError("can't initialize module GameKeys");
-    }
+       }
 
        return d;
 }
index a683c9857aad566a5e271ce774f730cbc50bf690..aecf2ab359852b1ca22176481b831e5a7a49fc0e 100644 (file)
@@ -83,7 +83,7 @@ void KX_RaySensor::Init()
 
 KX_RaySensor::~KX_RaySensor() 
 {
-    /* Nothing to be done here. */
+       /* Nothing to be done here. */
 }
 
 
@@ -279,7 +279,7 @@ bool KX_RaySensor::Evaluate()
 
        /* now pass this result to some controller */
 
-    if (m_rayHit)
+       if (m_rayHit)
        {
                if (!m_bTriggered)
                {
@@ -288,14 +288,14 @@ bool KX_RaySensor::Evaluate()
                        m_bTriggered = true;
                }
                else
-                 {
+               {
                        // notify logicsystem that ray is STILL hitting ...
                        result = false;
-                   
-                 }
+
+               }
        }
-    else
-      {
+       else
+       {
                if (m_bTriggered)
                {
                        m_bTriggered = false;
@@ -306,9 +306,9 @@ bool KX_RaySensor::Evaluate()
                {
                        result = false;
                }
-       
-      }
-    if (reset)
+
+       }
+       if (reset)
                // force an event
                result = true;
 
index 076669e325aaa13f3bdacfa187169a535320c832..c5f3fefd4d33b2917e1c83f662f7d2fea3d7046e 100644 (file)
 #include "SCA_IScene.h"
 
 KX_SCA_EndObjectActuator::KX_SCA_EndObjectActuator(SCA_IObject *gameobj,
-                                                                                                  SCA_IScene* scene):
-       SCA_IActuator(gameobj, KX_ACT_END_OBJECT),
-       m_scene(scene)
+                                                   SCA_IScene* scene):
+    SCA_IActuator(gameobj, KX_ACT_END_OBJECT),
+    m_scene(scene)
 {
-    // intentionally empty 
+       // intentionally empty
 } /* End of constructor */
 
 
index edcba969811561a589b35dcc0382755ec58117f0..f13f152c5d5c30216fb904998a8af5e01f047dc5 100644 (file)
 
 
 KX_TrackToActuator::KX_TrackToActuator(SCA_IObject *gameobj, 
-                                                                      SCA_IObject *ob,
-                                                                          int time,
-                                                                          bool allow3D,
-                                                                          int trackflag,
-                                                                          int upflag)
-                                                                          : SCA_IActuator(gameobj, KX_ACT_TRACKTO)
+                                       SCA_IObject *ob,
+                                       int time,
+                                       bool allow3D,
+                                       int trackflag,
+                                       int upflag)
+    : SCA_IActuator(gameobj, KX_ACT_TRACKTO)
 {
-    m_time = time;
-    m_allow3D = allow3D;
-    m_object = ob;
+       m_time = time;
+       m_allow3D = allow3D;
+       m_object = ob;
        m_trackflag = trackflag;
        m_upflag = upflag;
        m_parentobj = 0;
index 3f0c4cb95a182116aa0560a43eebdbedfb1f0618..526176481ed807db58cad575034da27804d154d6 100644 (file)
@@ -1200,7 +1200,7 @@ PHY_IPhysicsController* CcdPhysicsEnvironment::rayTest(PHY_IRayCastFilterCallbac
                                                
                                        // Bullet returns the normal from "outside".
                                        // If the user requests the real normal, compute it now
-                    if (filterCallback.m_faceNormal)
+                                       if (filterCallback.m_faceNormal)
                                        {
                                                if (shape->isSoftBody()) 
                                                {
index b5618ebbf037451d715c81fad6ddd0d6f74952c0..011075574815bf04062314099199bbc4559bca69 100644 (file)
@@ -142,8 +142,8 @@ SG_BBox SG_BBox::transform(const MT_Transform &world) const
 bool SG_BBox::inside(const MT_Point3 &point) const
 {
        return point[0] >= m_min[0] && point[0] <= m_max[0] &&
-           point[1] >= m_min[1] && point[1] <= m_max[1] &&
-           point[2] >= m_min[2] && point[2] <= m_max[2];
+               point[1] >= m_min[1] && point[1] <= m_max[1] &&
+               point[2] >= m_min[2] && point[2] <= m_max[2];
 }
 
 bool SG_BBox::inside(const SG_BBox& other) const
index ca778d164c8b23453ee4f11358bba728c4275c2f..94b8584051ec643f0fc084c3e59ef571809d5cfc 100644 (file)
@@ -109,18 +109,17 @@ SetParentRelation(
  */
 
 
-       bool 
+       bool
 SG_Spatial::
 UpdateSpatialData(
-       const SG_Spatial *parent,
-       double time,
-       bool& parentUpdated
+               const SG_Spatial *parent,
+               double time,
+               bool& parentUpdated
 ){
-
-    bool bComputesWorldTransform = false;
+       bool bComputesWorldTransform = false;
 
        // update spatial controllers
-       
+
        SGControllerList::iterator cit = GetSGControllerList().begin();
        SGControllerList::const_iterator c_end = GetSGControllerList().end();
 
@@ -131,7 +130,7 @@ UpdateSpatialData(
        }
 
        // If none of the objects updated our values then we ask the
-       // parent_relation object owned by this class to update 
+       // parent_relation object owned by this class to update
        // our world coordinates.
 
        if (!bComputesWorldTransform)
index fc316f1c3f0eaf934e02dd66716689d936ce0665..30a8af4b1256b242a5218b28b4b2996fa673b3e4 100644 (file)
@@ -201,20 +201,20 @@ void Exception::copy (const Exception & xpt)
 
 void registerAllExceptions(void)
 {
-    errGenerDesc.registerDesc();
-    errNFoundDesc.registerDesc();
-    MaterialNotAvailDesc.registerDesc();
-    ImageSizesNotMatchDesc.registerDesc();
-    ImageHasExportsDesc.registerDesc();
+       errGenerDesc.registerDesc();
+       errNFoundDesc.registerDesc();
+       MaterialNotAvailDesc.registerDesc();
+       ImageSizesNotMatchDesc.registerDesc();
+       ImageHasExportsDesc.registerDesc();
        InvalidColorChannelDesc.registerDesc();
-    SceneInvalidDesc.registerDesc();
-    CameraInvalidDesc.registerDesc();
-    ObserverInvalidDesc.registerDesc();
-    MirrorInvalidDesc.registerDesc();
-    MirrorSizeInvalidDesc.registerDesc();
-    MirrorNormalInvalidDesc.registerDesc();
-    MirrorHorizontalDesc.registerDesc();
-    MirrorTooSmallDesc.registerDesc();
-    SourceVideoEmptyDesc.registerDesc();
-    SourceVideoCreationDesc.registerDesc();
+       SceneInvalidDesc.registerDesc();
+       CameraInvalidDesc.registerDesc();
+       ObserverInvalidDesc.registerDesc();
+       MirrorInvalidDesc.registerDesc();
+       MirrorSizeInvalidDesc.registerDesc();
+       MirrorNormalInvalidDesc.registerDesc();
+       MirrorHorizontalDesc.registerDesc();
+       MirrorTooSmallDesc.registerDesc();
+       SourceVideoEmptyDesc.registerDesc();
+       SourceVideoCreationDesc.registerDesc();
 }
index a70c56a070cea6e0e84c75b92ff27196fb7a250b..86de214e2d342815be0cc037ae7c01724782aa54 100644 (file)
@@ -645,7 +645,7 @@ PyObject * Image_valid(PyImage * self, void * closure)
 int Image_getbuffer(PyImage *self, Py_buffer *view, int flags)
 {
        unsigned int * image;
-    int ret;
+       int ret;
 
        try
        {
@@ -667,25 +667,25 @@ int Image_getbuffer(PyImage *self, Py_buffer *view, int flags)
                //return -1;
                goto error;
        }
-    if (view == NULL) 
+       if (view == NULL)
        {
-        self->m_image->m_exports++;
-        return 0;
-    }
-    ret = PyBuffer_FillInfo(view, (PyObject*)self, image, self->m_image->getBuffSize(), 0, flags);
-    if (ret >= 0)
-        self->m_image->m_exports++;
-    return ret;
+               self->m_image->m_exports++;
+               return 0;
+       }
+       ret = PyBuffer_FillInfo(view, (PyObject*)self, image, self->m_image->getBuffSize(), 0, flags);
+       if (ret >= 0)
+               self->m_image->m_exports++;
+       return ret;
 
 error:
        // Return a empty buffer to avoid a crash in Python 3.1
        // The bug is fixed in Python SVN 77916, as soon as the python revision used by Blender is
        // updated, you can simply return -1 and set the error
        static char* buf = (char *)"";
-    ret = PyBuffer_FillInfo(view, (PyObject*)self, buf, 0, 0, flags);
-    if (ret >= 0)
-        self->m_image->m_exports++;
-    return ret;
+       ret = PyBuffer_FillInfo(view, (PyObject*)self, buf, 0, 0, flags);
+       if (ret >= 0)
+               self->m_image->m_exports++;
+       return ret;
        
 }
 
index 6038416ba68c7e738aefc4f3be0f3c145fd37eb2..24833ace08f99f2a926aa3907120103e67d8ec65 100644 (file)
@@ -65,29 +65,29 @@ ImageRender::ImageRender (KX_Scene * scene, KX_Camera * camera) :
     m_owncamera(false),
     m_observer(NULL),
     m_mirror(NULL),
-       m_clip(100.f)
+    m_clip(100.f)
 {
        // initialize background color
        setBackground(0, 0, 255, 255);
-    // retrieve rendering objects
-    m_engine = KX_GetActiveEngine();
-    m_rasterizer = m_engine->GetRasterizer();
-    m_canvas = m_engine->GetCanvas();
-    m_rendertools = m_engine->GetRenderTools();
+       // retrieve rendering objects
+       m_engine = KX_GetActiveEngine();
+       m_rasterizer = m_engine->GetRasterizer();
+       m_canvas = m_engine->GetCanvas();
+       m_rendertools = m_engine->GetRenderTools();
 }
 
 // destructor
 ImageRender::~ImageRender (void)
 {
-    if (m_owncamera)
-        m_camera->Release();
+       if (m_owncamera)
+               m_camera->Release();
 }
 
 
 // set background color
 void ImageRender::setBackground (int red, int green, int blue, int alpha)
 {
-    m_background[0] = (red < 0) ? 0.f : (red > 255) ? 1.f : float(red)/255.f;
+       m_background[0] = (red < 0) ? 0.f : (red > 255) ? 1.f : float(red)/255.f;
        m_background[1] = (green < 0) ? 0.f : (green > 255) ? 1.f : float(green)/255.f;
        m_background[2] = (blue < 0) ? 0.f : (blue > 255) ? 1.f : float(blue)/255.f;
        m_background[3] = (alpha < 0) ? 0.f : (alpha > 255) ? 1.f : float(alpha)/255.f;
@@ -97,157 +97,157 @@ void ImageRender::setBackground (int red, int green, int blue, int alpha)
 // capture image from viewport
 void ImageRender::calcImage (unsigned int texId, double ts)
 {
-    if (m_rasterizer->GetDrawingMode() != RAS_IRasterizer::KX_TEXTURED ||   // no need for texture
-        m_camera->GetViewport() ||        // camera must be inactive
-        m_camera == m_scene->GetActiveCamera())
-    {
-        // no need to compute texture in non texture rendering
-        m_avail = false;
-        return;
-    }
-    // render the scene from the camera
-    Render();
+       if (m_rasterizer->GetDrawingMode() != RAS_IRasterizer::KX_TEXTURED ||   // no need for texture
+               m_camera->GetViewport() ||        // camera must be inactive
+               m_camera == m_scene->GetActiveCamera())
+       {
+               // no need to compute texture in non texture rendering
+               m_avail = false;
+               return;
+       }
+       // render the scene from the camera
+       Render();
        // get image from viewport
        ImageViewport::calcImage(texId, ts);
-    // restore OpenGL state
-    m_canvas->EndFrame();
+       // restore OpenGL state
+       m_canvas->EndFrame();
 }
 
 void ImageRender::Render()
 {
        RAS_FrameFrustum frustrum;
 
-    if (!m_render)
-        return;
-
-    if (m_mirror)
-    {
-        // mirror mode, compute camera frustrum, position and orientation
-        // convert mirror position and normal in world space
-        const MT_Matrix3x3 & mirrorObjWorldOri = m_mirror->GetSGNode()->GetWorldOrientation();
-        const MT_Point3 & mirrorObjWorldPos = m_mirror->GetSGNode()->GetWorldPosition();
-        const MT_Vector3 & mirrorObjWorldScale = m_mirror->GetSGNode()->GetWorldScaling();
-        MT_Point3 mirrorWorldPos = 
-            mirrorObjWorldPos + mirrorObjWorldScale * (mirrorObjWorldOri * m_mirrorPos);
-        MT_Vector3 mirrorWorldZ = mirrorObjWorldOri * m_mirrorZ;
-        // get observer world position
-        const MT_Point3 & observerWorldPos = m_observer->GetSGNode()->GetWorldPosition();
-        // get plane D term = mirrorPos . normal
-        MT_Scalar mirrorPlaneDTerm = mirrorWorldPos.dot(mirrorWorldZ);
-        // compute distance of observer to mirror = D - observerPos . normal
-        MT_Scalar observerDistance = mirrorPlaneDTerm - observerWorldPos.dot(mirrorWorldZ);
-        // if distance < 0.01 => observer is on wrong side of mirror, don't render
-        if (observerDistance < 0.01f)
-            return;
-        // set camera world position = observerPos + normal * 2 * distance
-        MT_Point3 cameraWorldPos = observerWorldPos + (MT_Scalar(2.0)*observerDistance)*mirrorWorldZ;
-        m_camera->GetSGNode()->SetLocalPosition(cameraWorldPos);
-        // set camera orientation: z=normal, y=mirror_up in world space, x= y x z
-        MT_Vector3 mirrorWorldY = mirrorObjWorldOri * m_mirrorY;
-        MT_Vector3 mirrorWorldX = mirrorObjWorldOri * m_mirrorX;
-        MT_Matrix3x3 cameraWorldOri(
-            mirrorWorldX[0], mirrorWorldY[0], mirrorWorldZ[0],
-            mirrorWorldX[1], mirrorWorldY[1], mirrorWorldZ[1], 
-            mirrorWorldX[2], mirrorWorldY[2], mirrorWorldZ[2]);
-        m_camera->GetSGNode()->SetLocalOrientation(cameraWorldOri);
-        m_camera->GetSGNode()->UpdateWorldData(0.0);
-        // compute camera frustrum:
-        //   get position of mirror relative to camera: offset = mirrorPos-cameraPos
-        MT_Vector3 mirrorOffset = mirrorWorldPos - cameraWorldPos;
-        //   convert to camera orientation
-        mirrorOffset = mirrorOffset * cameraWorldOri;
-        //   scale mirror size to world scale: 
-        //     get closest local axis for mirror Y and X axis and scale height and width by local axis scale
-        MT_Scalar x, y;
-        x = fabs(m_mirrorY[0]);
-        y = fabs(m_mirrorY[1]);
-        float height = (x > y) ? 
-            ((x > fabs(m_mirrorY[2])) ? mirrorObjWorldScale[0] : mirrorObjWorldScale[2]):
-            ((y > fabs(m_mirrorY[2])) ? mirrorObjWorldScale[1] : mirrorObjWorldScale[2]);
-        x = fabs(m_mirrorX[0]);
-        y = fabs(m_mirrorX[1]);
-        float width = (x > y) ? 
-            ((x > fabs(m_mirrorX[2])) ? mirrorObjWorldScale[0] : mirrorObjWorldScale[2]):
-            ((y > fabs(m_mirrorX[2])) ? mirrorObjWorldScale[1] : mirrorObjWorldScale[2]);
-        width *= m_mirrorHalfWidth;
-        height *= m_mirrorHalfHeight;
-        //   left = offsetx-width
-        //   right = offsetx+width
-        //   top = offsety+height
-        //   bottom = offsety-height
-        //   near = -offsetz
-        //   far = near+100
-        frustrum.x1 = mirrorOffset[0]-width;
-        frustrum.x2 = mirrorOffset[0]+width;
-        frustrum.y1 = mirrorOffset[1]-height;
-        frustrum.y2 = mirrorOffset[1]+height;
-        frustrum.camnear = -mirrorOffset[2];
-        frustrum.camfar = -mirrorOffset[2]+m_clip;
-    }
+       if (!m_render)
+               return;
+
+       if (m_mirror)
+       {
+               // mirror mode, compute camera frustrum, position and orientation
+               // convert mirror position and normal in world space
+               const MT_Matrix3x3 & mirrorObjWorldOri = m_mirror->GetSGNode()->GetWorldOrientation();
+               const MT_Point3 & mirrorObjWorldPos = m_mirror->GetSGNode()->GetWorldPosition();
+               const MT_Vector3 & mirrorObjWorldScale = m_mirror->GetSGNode()->GetWorldScaling();
+               MT_Point3 mirrorWorldPos =
+                       mirrorObjWorldPos + mirrorObjWorldScale * (mirrorObjWorldOri * m_mirrorPos);
+               MT_Vector3 mirrorWorldZ = mirrorObjWorldOri * m_mirrorZ;
+               // get observer world position
+               const MT_Point3 & observerWorldPos = m_observer->GetSGNode()->GetWorldPosition();
+               // get plane D term = mirrorPos . normal
+               MT_Scalar mirrorPlaneDTerm = mirrorWorldPos.dot(mirrorWorldZ);
+               // compute distance of observer to mirror = D - observerPos . normal
+               MT_Scalar observerDistance = mirrorPlaneDTerm - observerWorldPos.dot(mirrorWorldZ);
+               // if distance < 0.01 => observer is on wrong side of mirror, don't render
+               if (observerDistance < 0.01f)
+                       return;
+               // set camera world position = observerPos + normal * 2 * distance
+               MT_Point3 cameraWorldPos = observerWorldPos + (MT_Scalar(2.0)*observerDistance)*mirrorWorldZ;
+               m_camera->GetSGNode()->SetLocalPosition(cameraWorldPos);
+               // set camera orientation: z=normal, y=mirror_up in world space, x= y x z
+               MT_Vector3 mirrorWorldY = mirrorObjWorldOri * m_mirrorY;
+               MT_Vector3 mirrorWorldX = mirrorObjWorldOri * m_mirrorX;
+               MT_Matrix3x3 cameraWorldOri(
+                           mirrorWorldX[0], mirrorWorldY[0], mirrorWorldZ[0],
+                           mirrorWorldX[1], mirrorWorldY[1], mirrorWorldZ[1],
+                           mirrorWorldX[2], mirrorWorldY[2], mirrorWorldZ[2]);
+               m_camera->GetSGNode()->SetLocalOrientation(cameraWorldOri);
+               m_camera->GetSGNode()->UpdateWorldData(0.0);
+               // compute camera frustrum:
+               //   get position of mirror relative to camera: offset = mirrorPos-cameraPos
+               MT_Vector3 mirrorOffset = mirrorWorldPos - cameraWorldPos;
+               //   convert to camera orientation
+               mirrorOffset = mirrorOffset * cameraWorldOri;
+               //   scale mirror size to world scale:
+               //     get closest local axis for mirror Y and X axis and scale height and width by local axis scale
+               MT_Scalar x, y;
+               x = fabs(m_mirrorY[0]);
+               y = fabs(m_mirrorY[1]);
+               float height = (x > y) ?
+                           ((x > fabs(m_mirrorY[2])) ? mirrorObjWorldScale[0] : mirrorObjWorldScale[2]):
+                           ((y > fabs(m_mirrorY[2])) ? mirrorObjWorldScale[1] : mirrorObjWorldScale[2]);
+               x = fabs(m_mirrorX[0]);
+               y = fabs(m_mirrorX[1]);
+               float width = (x > y) ?
+                           ((x > fabs(m_mirrorX[2])) ? mirrorObjWorldScale[0] : mirrorObjWorldScale[2]):
+                           ((y > fabs(m_mirrorX[2])) ? mirrorObjWorldScale[1] : mirrorObjWorldScale[2]);
+               width *= m_mirrorHalfWidth;
+               height *= m_mirrorHalfHeight;
+               //   left = offsetx-width
+               //   right = offsetx+width
+               //   top = offsety+height
+               //   bottom = offsety-height
+               //   near = -offsetz
+               //   far = near+100
+               frustrum.x1 = mirrorOffset[0]-width;
+               frustrum.x2 = mirrorOffset[0]+width;
+               frustrum.y1 = mirrorOffset[1]-height;
+               frustrum.y2 = mirrorOffset[1]+height;
+               frustrum.camnear = -mirrorOffset[2];
+               frustrum.camfar = -mirrorOffset[2]+m_clip;
+       }
        // Store settings to be restored later
-    const RAS_IRasterizer::StereoMode stereomode = m_rasterizer->GetStereoMode();
+       const RAS_IRasterizer::StereoMode stereomode = m_rasterizer->GetStereoMode();
        RAS_Rect area = m_canvas->GetWindowArea();
 
-    // The screen area that ImageViewport will copy is also the rendering zone
-    m_canvas->SetViewPort(m_position[0], m_position[1], m_position[0]+m_capSize[0]-1, m_position[1]+m_capSize[1]-1);
-    m_canvas->ClearColor(m_background[0], m_background[1], m_background[2], m_background[3]);
-    m_canvas->ClearBuffer(RAS_ICanvas::COLOR_BUFFER|RAS_ICanvas::DEPTH_BUFFER);
-    m_rasterizer->BeginFrame(RAS_IRasterizer::KX_TEXTURED,m_engine->GetClockTime());
-    m_rendertools->BeginFrame(m_rasterizer);
-    m_engine->SetWorldSettings(m_scene->GetWorldInfo());
-    m_rendertools->SetAuxilaryClientInfo(m_scene);
-    m_rasterizer->DisplayFog();
-    // matrix calculation, don't apply any of the stereo mode
-    m_rasterizer->SetStereoMode(RAS_IRasterizer::RAS_STEREO_NOSTEREO);
-    if (m_mirror)
-    {
-        // frustrum was computed above
-        // get frustrum matrix and set projection matrix
+       // The screen area that ImageViewport will copy is also the rendering zone
+       m_canvas->SetViewPort(m_position[0], m_position[1], m_position[0]+m_capSize[0]-1, m_position[1]+m_capSize[1]-1);
+       m_canvas->ClearColor(m_background[0], m_background[1], m_background[2], m_background[3]);
+       m_canvas->ClearBuffer(RAS_ICanvas::COLOR_BUFFER|RAS_ICanvas::DEPTH_BUFFER);
+       m_rasterizer->BeginFrame(RAS_IRasterizer::KX_TEXTURED,m_engine->GetClockTime());
+       m_rendertools->BeginFrame(m_rasterizer);
+       m_engine->SetWorldSettings(m_scene->GetWorldInfo());
+       m_rendertools->SetAuxilaryClientInfo(m_scene);
+       m_rasterizer->DisplayFog();
+       // matrix calculation, don't apply any of the stereo mode
+       m_rasterizer->SetStereoMode(RAS_IRasterizer::RAS_STEREO_NOSTEREO);
+       if (m_mirror)
+       {
+               // frustrum was computed above
+               // get frustrum matrix and set projection matrix
                MT_Matrix4x4 projmat = m_rasterizer->GetFrustumMatrix(
-                       frustrum.x1, frustrum.x2, frustrum.y1, frustrum.y2, frustrum.camnear, frustrum.camfar);
+                           frustrum.x1, frustrum.x2, frustrum.y1, frustrum.y2, frustrum.camnear, frustrum.camfar);
 
                m_camera->SetProjectionMatrix(projmat);
-    } else if (m_camera->hasValidProjectionMatrix())
+       } else if (m_camera->hasValidProjectionMatrix())
        {
                m_rasterizer->SetProjectionMatrix(m_camera->GetProjectionMatrix());
-    } else 
-    {
+       } else
+       {
                float lens = m_camera->GetLens();
                bool orthographic = !m_camera->GetCameraData()->m_perspective;
                float nearfrust = m_camera->GetCameraNear();
                float farfrust = m_camera->GetCameraFar();
-        float aspect_ratio = 1.0f;
-        Scene *blenderScene = m_scene->GetBlenderScene();
+               float aspect_ratio = 1.0f;
+               Scene *blenderScene = m_scene->GetBlenderScene();
                MT_Matrix4x4 projmat;
 
                // compute the aspect ratio from frame blender scene settings so that render to texture
-        // works the same in Blender and in Blender player
-        if (blenderScene->r.ysch != 0)
-            aspect_ratio = float(blenderScene->r.xsch*blenderScene->r.xasp) / float(blenderScene->r.ysch*blenderScene->r.yasp);
+               // works the same in Blender and in Blender player
+               if (blenderScene->r.ysch != 0)
+                       aspect_ratio = float(blenderScene->r.xsch*blenderScene->r.xasp) / float(blenderScene->r.ysch*blenderScene->r.yasp);
 
                if (orthographic) {
 
                        RAS_FramingManager::ComputeDefaultOrtho(
-                               nearfrust,
-                               farfrust,
-                               m_camera->GetScale(),
-                               aspect_ratio,
-                               frustrum
-                       );
+                                   nearfrust,
+                                   farfrust,
+                                   m_camera->GetScale(),
+                                   aspect_ratio,
+                                   frustrum
+                                   );
 
                        projmat = m_rasterizer->GetOrthoMatrix(
-                               frustrum.x1, frustrum.x2, frustrum.y1, frustrum.y2, frustrum.camnear, frustrum.camfar);
-               } else 
+                                   frustrum.x1, frustrum.x2, frustrum.y1, frustrum.y2, frustrum.camnear, frustrum.camfar);
+               } else
                {
                        RAS_FramingManager::ComputeDefaultFrustum(
-                               nearfrust,
-                               farfrust,
-                               lens,
-                               aspect_ratio,
-                               frustrum);
+                                   nearfrust,
+                                   farfrust,
+                                   lens,
+                                   aspect_ratio,
+                                   frustrum);
                        
                        projmat = m_rasterizer->GetFrustumMatrix(
-                               frustrum.x1, frustrum.x2, frustrum.y1, frustrum.y2, frustrum.camnear, frustrum.camfar);
+                                   frustrum.x1, frustrum.x2, frustrum.y1, frustrum.y2, frustrum.camnear, frustrum.camfar);
                }
                m_camera->SetProjectionMatrix(projmat);
        }
@@ -257,8 +257,8 @@ void ImageRender::Render()
        
        m_rasterizer->SetViewMatrix(viewmat, m_camera->NodeGetWorldOrientation(), m_camera->NodeGetWorldPosition(), m_camera->GetCameraData()->m_perspective);
        m_camera->SetModelviewMatrix(viewmat);
-    // restore the stereo mode now that the matrix is computed
-    m_rasterizer->SetStereoMode(stereomode);
+       // restore the stereo mode now that the matrix is computed
+       m_rasterizer->SetStereoMode(stereomode);
 
        m_scene->CalculateVisibleMeshes(m_rasterizer,m_camera);
 
@@ -433,24 +433,24 @@ static int ImageMirror_init (PyObject * pySelf, PyObject * args, PyObject * kwds
        PyObject * scene;
        // reference object for mirror
        PyObject * observer;
-    // object holding the mirror
-    PyObject * mirror;
-    // material of the mirror
-    short materialID = 0;
+       // object holding the mirror
+       PyObject * mirror;
+       // material of the mirror
+       short materialID = 0;
        // parameter keywords
        static const char *kwlist[] = {"scene", "observer", "mirror", "material", NULL};
        // get parameters
        if (!PyArg_ParseTupleAndKeywords(args, kwds, "OOO|h",
-               const_cast<char**>(kwlist), &scene, &observer, &mirror, &materialID))
+                                        const_cast<char**>(kwlist), &scene, &observer, &mirror, &materialID))
                return -1;
        try
        {
                // get scene pointer
                KX_Scene * scenePtr (NULL);
-        if (scene != NULL && PyObject_TypeCheck(scene, &KX_Scene::Type))
-            scenePtr = static_cast<KX_Scene*>BGE_PROXY_REF(scene);
+               if (scene != NULL && PyObject_TypeCheck(scene, &KX_Scene::Type))
+                       scenePtr = static_cast<KX_Scene*>BGE_PROXY_REF(scene);
                else
-            THRWEXCP(SceneInvalid, S_OK);
+                       THRWEXCP(SceneInvalid, S_OK);
                
                if(scenePtr==NULL) /* incase the python proxy reference is invalid */
                        THRWEXCP(SceneInvalid, S_OK);
@@ -458,11 +458,11 @@ static int ImageMirror_init (PyObject * pySelf, PyObject * args, PyObject * kwds
                // get observer pointer
                KX_GameObject * observerPtr (NULL);
                if (observer != NULL && PyObject_TypeCheck(observer, &KX_GameObject::Type))
-            observerPtr = static_cast<KX_GameObject*>BGE_PROXY_REF(observer);
-        else if (observer != NULL && PyObject_TypeCheck(observer, &KX_Camera::Type))
-            observerPtr = static_cast<KX_Camera*>BGE_PROXY_REF(observer);
+                       observerPtr = static_cast<KX_GameObject*>BGE_PROXY_REF(observer);
+               else if (observer != NULL && PyObject_TypeCheck(observer, &KX_Camera::Type))
+                       observerPtr = static_cast<KX_Camera*>BGE_PROXY_REF(observer);
                else
-            THRWEXCP(ObserverInvalid, S_OK);
+                       THRWEXCP(ObserverInvalid, S_OK);
                
                if(observerPtr==NULL) /* incase the python proxy reference is invalid */
                        THRWEXCP(ObserverInvalid, S_OK);
@@ -470,27 +470,27 @@ static int ImageMirror_init (PyObject * pySelf, PyObject * args, PyObject * kwds
                // get mirror pointer
                KX_GameObject * mirrorPtr (NULL);
                if (mirror != NULL && PyObject_TypeCheck(mirror, &KX_GameObject::Type))
-            mirrorPtr = static_cast<KX_GameObject*>BGE_PROXY_REF(mirror);
+                       mirrorPtr = static_cast<KX_GameObject*>BGE_PROXY_REF(mirror);
                else
-            THRWEXCP(MirrorInvalid, S_OK);
+                       THRWEXCP(MirrorInvalid, S_OK);
                
                if(mirrorPtr==NULL) /* incase the python proxy reference is invalid */
                        THRWEXCP(MirrorInvalid, S_OK);
 
-        // locate the material in the mirror
+               // locate the material in the mirror
                RAS_IPolyMaterial * material = getMaterial(mirror, materialID);
                if (material == NULL)
-            THRWEXCP(MaterialNotAvail, S_OK);
+                       THRWEXCP(MaterialNotAvail, S_OK);
 
                // get pointer to image structure
                PyImage * self = reinterpret_cast<PyImage*>(pySelf);
 
                // create source object
-               if (self->m_image != NULL) 
-        {
-            delete self->m_image;
-            self->m_image = NULL;
-        }
+               if (self->m_image != NULL)
+               {
+                       delete self->m_image;
+                       self->m_image = NULL;
+               }
                self->m_image = new ImageRender(scenePtr, observerPtr, mirrorPtr, material);
        }
        catch (Exception & exp)
@@ -530,7 +530,7 @@ static PyGetSetDef imageMirrorGetSets[] =
        {(char*)"clip", (getter)getClip, (setter)setClip, (char*)"clipping distance", NULL},
        // attribute from ImageRender
        {(char*)"background", (getter)getBackground, (setter)setBackground, (char*)"background color", NULL},
-    // attribute from ImageViewport
+       // attribute from ImageViewport
        {(char*)"capsize", (getter)ImageViewport_getCaptureSize, (setter)ImageViewport_setCaptureSize, (char*)"size of render area", NULL},
        {(char*)"alpha", (getter)ImageViewport_getAlpha, (setter)ImageViewport_setAlpha, (char*)"use alpha in texture", NULL},
        {(char*)"whole", (getter)ImageViewport_getWhole, (setter)ImageViewport_setWhole, (char*)"use whole viewport to render", NULL},
@@ -552,164 +552,164 @@ ImageRender::ImageRender (KX_Scene * scene, KX_GameObject * observer, KX_GameObj
     m_scene(scene),
     m_observer(observer),
     m_mirror(mirror),
-       m_clip(100.f)
+    m_clip(100.f)
 {
-    // this constructor is used for automatic planar mirror
-    // create a camera, take all data by default, in any case we will recompute the frustrum on each frame
+       // this constructor is used for automatic planar mirror
+       // create a camera, take all data by default, in any case we will recompute the frustrum on each frame
        RAS_CameraData camdata;
-    vector<RAS_TexVert*> mirrorVerts;
-    vector<RAS_TexVert*>::iterator it;
-    float mirrorArea = 0.f;
-    float mirrorNormal[3] = {0.f, 0.f, 0.f};
-    float mirrorUp[3];
-    float dist, vec[3], axis[3];
-    float zaxis[3] = {0.f, 0.f, 1.f};
-    float yaxis[3] = {0.f, 1.f, 0.f};
-    float mirrorMat[3][3];
-    float left, right, top, bottom, back;
+       vector<RAS_TexVert*> mirrorVerts;
+       vector<RAS_TexVert*>::iterator it;
+       float mirrorArea = 0.f;
+       float mirrorNormal[3] = {0.f, 0.f, 0.f};
+       float mirrorUp[3];
+       float dist, vec[3], axis[3];
+       float zaxis[3] = {0.f, 0.f, 1.f};
+       float yaxis[3] = {0.f, 1.f, 0.f};
+       float mirrorMat[3][3];
+       float left, right, top, bottom, back;
        // make sure this camera will delete its node
        m_camera= new KX_Camera(scene, KX_Scene::m_callbacks, camdata, true, true);
        m_camera->SetName("__mirror__cam__");
-    // don't add the camera to the scene object list, it doesn't need to be accessible
-    m_owncamera = true;
-    // retrieve rendering objects
-    m_engine = KX_GetActiveEngine();
-    m_rasterizer = m_engine->GetRasterizer();
-    m_canvas = m_engine->GetCanvas();
-    m_rendertools = m_engine->GetRenderTools();
-    // locate the vertex assigned to mat and do following calculation in mesh coordinates
-    for (int meshIndex = 0; meshIndex < mirror->GetMeshCount(); meshIndex++)
-    {
-        RAS_MeshObject*        mesh = mirror->GetMesh(meshIndex);
-        int numPolygons = mesh->NumPolygons();
-        for (int polygonIndex=0; polygonIndex < numPolygons; polygonIndex++)
-        {
-            RAS_Polygon* polygon = mesh->GetPolygon(polygonIndex);
-            if (polygon->GetMaterial()->GetPolyMaterial() == mat)
-            {
-                RAS_TexVert *v1, *v2, *v3, *v4;
-                float normal[3];
-                float area;
-                // this polygon is part of the mirror,
-                v1 = polygon->GetVertex(0);
-                v2 = polygon->GetVertex(1);
-                v3 = polygon->GetVertex(2);
-                mirrorVerts.push_back(v1);
-                mirrorVerts.push_back(v2);
-                mirrorVerts.push_back(v3);
-                if (polygon->VertexCount() == 4) 
-                {
-                    v4 = polygon->GetVertex(3);
-                    mirrorVerts.push_back(v4);
-                    area = normal_quad_v3( normal,(float*)v1->getXYZ(), (float*)v2->getXYZ(), (float*)v3->getXYZ(), (float*)v4->getXYZ());
-                } else
-                {
-                    area = normal_tri_v3( normal,(float*)v1->getXYZ(), (float*)v2->getXYZ(), (float*)v3->getXYZ());
-                }
-                area = fabs(area);
-                mirrorArea += area;
-                mul_v3_fl(normal, area);
-                add_v3_v3v3(mirrorNormal, mirrorNormal, normal);
-            }
-        }
-    }
-    if (mirrorVerts.size() == 0 || mirrorArea < FLT_EPSILON)
-    {
-        // no vertex or zero size mirror
-       THRWEXCP(MirrorSizeInvalid, S_OK);
-    }
-    // compute average normal of mirror faces
-    mul_v3_fl(mirrorNormal, 1.0f/mirrorArea);
-    if (normalize_v3(mirrorNormal) == 0.f)
-    {
-        // no normal
-        THRWEXCP(MirrorNormalInvalid, S_OK);
-    }
-    // the mirror plane has an equation of the type ax+by+cz = d where (a,b,c) is the normal vector
+       // don't add the camera to the scene object list, it doesn't need to be accessible
+       m_owncamera = true;
+       // retrieve rendering objects
+       m_engine = KX_GetActiveEngine();
+       m_rasterizer = m_engine->GetRasterizer();
+       m_canvas = m_engine->GetCanvas();
+       m_rendertools = m_engine->GetRenderTools();
+       // locate the vertex assigned to mat and do following calculation in mesh coordinates
+       for (int meshIndex = 0; meshIndex < mirror->GetMeshCount(); meshIndex++)
+       {
+               RAS_MeshObject* mesh = mirror->GetMesh(meshIndex);
+               int numPolygons = mesh->NumPolygons();
+               for (int polygonIndex=0; polygonIndex < numPolygons; polygonIndex++)
+               {
+                       RAS_Polygon* polygon = mesh->GetPolygon(polygonIndex);
+                       if (polygon->GetMaterial()->GetPolyMaterial() == mat)
+                       {
+                               RAS_TexVert *v1, *v2, *v3, *v4;
+                               float normal[3];
+                               float area;
+                               // this polygon is part of the mirror,
+                               v1 = polygon->GetVertex(0);
+                               v2 = polygon->GetVertex(1);
+                               v3 = polygon->GetVertex(2);
+                               mirrorVerts.push_back(v1);
+                               mirrorVerts.push_back(v2);
+                               mirrorVerts.push_back(v3);
+                               if (polygon->VertexCount() == 4)
+                               {
+                                       v4 = polygon->GetVertex(3);
+                                       mirrorVerts.push_back(v4);
+                                       area = normal_quad_v3( normal,(float*)v1->getXYZ(), (float*)v2->getXYZ(), (float*)v3->getXYZ(), (float*)v4->getXYZ());
+                               } else
+                               {
+                                       area = normal_tri_v3( normal,(float*)v1->getXYZ(), (float*)v2->getXYZ(), (float*)v3->getXYZ());
+                               }
+                               area = fabs(area);
+                               mirrorArea += area;
+                               mul_v3_fl(normal, area);
+                               add_v3_v3v3(mirrorNormal, mirrorNormal, normal);
+                       }
+               }
+       }
+       if (mirrorVerts.size() == 0 || mirrorArea < FLT_EPSILON)
+       {
+               // no vertex or zero size mirror
+               THRWEXCP(MirrorSizeInvalid, S_OK);
+       }
+       // compute average normal of mirror faces
+       mul_v3_fl(mirrorNormal, 1.0f/mirrorArea);
+       if (normalize_v3(mirrorNormal) == 0.f)
+       {
+               // no normal
+               THRWEXCP(MirrorNormalInvalid, S_OK);
+       }
+       // the mirror plane has an equation of the type ax+by+cz = d where (a,b,c) is the normal vector
        // if the mirror is more vertical then horizontal, the Z axis is the up direction.
        // otherwise the Y axis is the up direction.
        // If the mirror is not perfectly vertical(horizontal), the Z(Y) axis projection on the mirror
        // plan by the normal will be the up direction.
        if (fabs(mirrorNormal[2]) > fabs(mirrorNormal[1]) &&
-               fabs(mirrorNormal[2]) > fabs(mirrorNormal[0]))
+               fabs(mirrorNormal[2]) > fabs(mirrorNormal[0]))
        {
                // the mirror is more horizontal than vertical
-        copy_v3_v3(axis, yaxis);
+               copy_v3_v3(axis, yaxis);
        }
        else
        {
                // the mirror is more vertical than horizontal
-        copy_v3_v3(axis, zaxis);
+               copy_v3_v3(axis, zaxis);
+       }
+       dist = dot_v3v3(mirrorNormal, axis);
+       if (fabs(dist) < FLT_EPSILON)
+       {
+               // the mirror is already fully aligned with up axis
+               copy_v3_v3(mirrorUp, axis);
+       }
+       else
+       {
+               // projection of axis to mirror plane through normal
+               copy_v3_v3(vec, mirrorNormal);
+               mul_v3_fl(vec, dist);
+               sub_v3_v3v3(mirrorUp, axis, vec);
+               if (normalize_v3(mirrorUp) == 0.f)
+               {
+                       // should not happen
+                       THRWEXCP(MirrorHorizontal, S_OK);
+                       return;
+               }
+       }
+       // compute rotation matrix between local coord and mirror coord
+       // to match camera orientation, we select mirror z = -normal, y = up, x = y x z
+       negate_v3_v3(mirrorMat[2], mirrorNormal);
+       copy_v3_v3(mirrorMat[1], mirrorUp);
+       cross_v3_v3v3(mirrorMat[0], mirrorMat[1], mirrorMat[2]);
+       // transpose to make it a orientation matrix from local space to mirror space
+       transpose_m3(mirrorMat);
+       // transform all vertex to plane coordinates and determine mirror position
+       left = FLT_MAX;
+       right = -FLT_MAX;
+       bottom = FLT_MAX;
+       top = -FLT_MAX;
+       back = -FLT_MAX; // most backward vertex (=highest Z coord in mirror space)
+       for (it = mirrorVerts.begin(); it != mirrorVerts.end(); it++)
+       {
+               copy_v3_v3(vec, (float*)(*it)->getXYZ());
+               mul_m3_v3(mirrorMat, vec);
+               if (vec[0] < left)
+                       left = vec[0];
+               if (vec[0] > right)
+                       right = vec[0];
+               if (vec[1] < bottom)
+                       bottom = vec[1];
+               if (vec[1] > top)
+                       top = vec[1];
+               if (vec[2] > back)
+                       back = vec[2];
+       }
+       // now store this information in the object for later rendering
+       m_mirrorHalfWidth = (right-left)*0.5f;
+       m_mirrorHalfHeight = (top-bottom)*0.5f;
+       if (m_mirrorHalfWidth < 0.01f || m_mirrorHalfHeight < 0.01f)
+       {
+               // mirror too small
+               THRWEXCP(MirrorTooSmall, S_OK);
        }
-    dist = dot_v3v3(mirrorNormal, axis);
-    if (fabs(dist) < FLT_EPSILON)
-    {
-        // the mirror is already fully aligned with up axis
-        copy_v3_v3(mirrorUp, axis);
-    }
-    else
-    {
-        // projection of axis to mirror plane through normal
-        copy_v3_v3(vec, mirrorNormal);
-        mul_v3_fl(vec, dist);
-        sub_v3_v3v3(mirrorUp, axis, vec);
-        if (normalize_v3(mirrorUp) == 0.f)
-        {
-            // should not happen
-            THRWEXCP(MirrorHorizontal, S_OK);
-            return;
-        }
-    }
-    // compute rotation matrix between local coord and mirror coord
-    // to match camera orientation, we select mirror z = -normal, y = up, x = y x z
-    negate_v3_v3(mirrorMat[2], mirrorNormal);
-    copy_v3_v3(mirrorMat[1], mirrorUp);
-    cross_v3_v3v3(mirrorMat[0], mirrorMat[1], mirrorMat[2]);
-    // transpose to make it a orientation matrix from local space to mirror space
-    transpose_m3(mirrorMat);
-    // transform all vertex to plane coordinates and determine mirror position
-    left = FLT_MAX; 
-    right = -FLT_MAX;
-    bottom = FLT_MAX;
-    top = -FLT_MAX;
-    back = -FLT_MAX; // most backward vertex (=highest Z coord in mirror space)
-    for (it = mirrorVerts.begin(); it != mirrorVerts.end(); it++)
-    {   
-        copy_v3_v3(vec, (float*)(*it)->getXYZ());
-        mul_m3_v3(mirrorMat, vec);
-        if (vec[0] < left)
-            left = vec[0];
-        if (vec[0] > right)
-            right = vec[0];
-        if (vec[1] < bottom)
-            bottom = vec[1];
-        if (vec[1] > top)
-            top = vec[1];
-        if (vec[2] > back)
-            back = vec[2];
-    }
-    // now store this information in the object for later rendering
-    m_mirrorHalfWidth = (right-left)*0.5f;
-    m_mirrorHalfHeight = (top-bottom)*0.5f;
-    if (m_mirrorHalfWidth < 0.01f || m_mirrorHalfHeight < 0.01f)
-    {
-        // mirror too small
-        THRWEXCP(MirrorTooSmall, S_OK);
-    }
-    // mirror position in mirror coord
-    vec[0] = (left+right)*0.5f;
-    vec[1] = (top+bottom)*0.5f;
-    vec[2] = back;
-    // convert it in local space: transpose again the matrix to get back to mirror to local transform
-    transpose_m3(mirrorMat);
-    mul_m3_v3(mirrorMat, vec);
-    // mirror position in local space
-    m_mirrorPos.setValue(vec[0], vec[1], vec[2]);
-    // mirror normal vector (pointed towards the back of the mirror) in local space
-    m_mirrorZ.setValue(-mirrorNormal[0], -mirrorNormal[1], -mirrorNormal[2]);
-    m_mirrorY.setValue(mirrorUp[0], mirrorUp[1], mirrorUp[2]);
-    m_mirrorX = m_mirrorY.cross(m_mirrorZ);
-    m_render = true;
+       // mirror position in mirror coord
+       vec[0] = (left+right)*0.5f;
+       vec[1] = (top+bottom)*0.5f;
+       vec[2] = back;
+       // convert it in local space: transpose again the matrix to get back to mirror to local transform
+       transpose_m3(mirrorMat);
+       mul_m3_v3(mirrorMat, vec);
+       // mirror position in local space
+       m_mirrorPos.setValue(vec[0], vec[1], vec[2]);
+       // mirror normal vector (pointed towards the back of the mirror) in local space
+       m_mirrorZ.setValue(-mirrorNormal[0], -mirrorNormal[1], -mirrorNormal[2]);
+       m_mirrorY.setValue(mirrorUp[0], mirrorUp[1], mirrorUp[2]);
+       m_mirrorX = m_mirrorY.cross(m_mirrorZ);
+       m_render = true;
 
        setBackground(0, 0, 255, 255);
 }
index d0e5ee74f6ea1a8ee3cc13ecffcc7cbcc1215771..0276ad6fd6b72a9968af0736d18c245f565672cb 100644 (file)
@@ -123,34 +123,34 @@ void ImageViewport::calcImage (unsigned int texId, double ts)
        }
        // if texture can be directly created
        if (texId != 0 && m_pyfilter == NULL && m_capSize[0] == calcSize(m_capSize[0])
-               && m_capSize[1] == calcSize(m_capSize[1]) && !m_flip)
+               && m_capSize[1] == calcSize(m_capSize[1]) && !m_flip)
        {
                // just copy current viewport to texture
-           glBindTexture(GL_TEXTURE_2D, texId);
-           glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, m_upLeft[0], m_upLeft[1], (GLsizei)m_capSize[0], (GLsizei)m_capSize[1]);
-           // image is not available
-           m_avail = false;
+               glBindTexture(GL_TEXTURE_2D, texId);
+               glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, m_upLeft[0], m_upLeft[1], (GLsizei)m_capSize[0], (GLsizei)m_capSize[1]);
+               // image is not available
+               m_avail = false;
        }
        // otherwise copy viewport to buffer, if image is not available
        else if (!m_avail)
        {
                // get frame buffer data
-        if (m_alpha)
-        {
-               glReadPixels(m_upLeft[0], m_upLeft[1], (GLsizei)m_capSize[0], (GLsizei)m_capSize[1], GL_RGBA,
-                           GL_UNSIGNED_BYTE, m_viewportImage);
-                   // filter loaded data
-                   FilterRGBA32 filt;
-                   filterImage(filt, m_viewportImage, m_capSize);
-        } 
-        else
-        {
-               glReadPixels(m_upLeft[0], m_upLeft[1], (GLsizei)m_capSize[0], (GLsizei)m_capSize[1], GL_RGB,
-                       GL_UNSIGNED_BYTE, m_viewportImage);
-               // filter loaded data
-                   FilterRGB24 filt;
-                   filterImage(filt, m_viewportImage, m_capSize);
-        }
+               if (m_alpha)
+               {
+                       glReadPixels(m_upLeft[0], m_upLeft[1], (GLsizei)m_capSize[0], (GLsizei)m_capSize[1], GL_RGBA,
+                                    GL_UNSIGNED_BYTE, m_viewportImage);
+                       // filter loaded data
+                       FilterRGBA32 filt;
+                       filterImage(filt, m_viewportImage, m_capSize);
+               }
+               else
+               {
+                       glReadPixels(m_upLeft[0], m_upLeft[1], (GLsizei)m_capSize[0], (GLsizei)m_capSize[1], GL_RGB,
+                                    GL_UNSIGNED_BYTE, m_viewportImage);
+                       // filter loaded data
+                       FilterRGB24 filt;
+                       filterImage(filt, m_viewportImage, m_capSize);
+               }
        }
 }
 
index f8274756c8be0ff7c92e806923df04779dbae58a..8a76b0c004d2f4a28a687653b4df690994d1fd30 100644 (file)
@@ -544,11 +544,11 @@ void VideoFFmpeg::openFile (char * filename)
                // It would be good to find this information from the context but there are no simple indication
                !strncmp(filename, "http://", 7) ||
 #ifdef FFMPEG_PB_IS_POINTER
-        (m_formatCtx->pb && m_formatCtx->pb->is_streamed)
+               (m_formatCtx->pb && m_formatCtx->pb->is_streamed)
 #else
-        m_formatCtx->pb.is_streamed
+               m_formatCtx->pb.is_streamed
 #endif
-        )
+               )
        {
                // the file is in fact a streaming source, treat as cam to prevent seeking
                m_isFile = false;
index c1258bbb6e4b102ee4ae6339fccb68450e947f9f..2cb3831de5254d416cd529bc2294f72dfb9af231 100644 (file)
@@ -175,9 +175,9 @@ PyObject* initVideoTexture(void)
 
        // prepare classes
        registerAllTypes();
-    registerAllExceptions();
+       registerAllExceptions();
 
-       if (!pyImageTypes.ready()) 
+       if (!pyImageTypes.ready())
                return NULL;
        if (!pyFilterTypes.ready()) 
                return NULL;