Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-09-01 06:12:53 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-09-01 06:12:53 +0400
commit2365c64014b3e067bb212b2061f1d14c1f944090 (patch)
treeccf060ca327a060e524ec92bba3622d9a1139a64 /source
parent00143a3d557d87dda2bb7074dfe2b1a3acf5f28f (diff)
whitespace bge edits
Diffstat (limited to 'source')
-rw-r--r--source/gameengine/Converter/BL_BlenderDataConversion.cpp18
-rw-r--r--source/gameengine/Converter/BL_ShapeDeformer.cpp12
-rw-r--r--source/gameengine/Converter/BlenderWorldInfo.cpp6
-rw-r--r--source/gameengine/Converter/KX_ConvertActuators.cpp6
-rw-r--r--source/gameengine/Converter/KX_ConvertSensors.cpp2
-rw-r--r--source/gameengine/Expressions/InputParser.cpp210
-rw-r--r--source/gameengine/GameLogic/SCA_2DFilterActuator.cpp32
-rw-r--r--source/gameengine/GameLogic/SCA_ISensor.cpp4
-rw-r--r--source/gameengine/GameLogic/SCA_KeyboardSensor.cpp4
-rw-r--r--source/gameengine/GameLogic/SCA_MouseSensor.cpp12
-rw-r--r--source/gameengine/GameLogic/SCA_RandomNumberGenerator.cpp78
-rw-r--r--source/gameengine/GameLogic/SCA_RandomSensor.cpp30
-rw-r--r--source/gameengine/GameLogic/SCA_XORController.cpp8
-rw-r--r--source/gameengine/GamePlayer/common/bmfont.cpp2
-rw-r--r--source/gameengine/GamePlayer/ghost/GPG_Application.cpp2
-rw-r--r--source/gameengine/GamePlayer/ghost/GPG_ghost.cpp16
-rw-r--r--source/gameengine/Ketsji/BL_BlenderShader.cpp2
-rw-r--r--source/gameengine/Ketsji/KXNetwork/KX_NetworkEventManager.cpp4
-rw-r--r--source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageActuator.cpp3
-rw-r--r--source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.cpp12
-rw-r--r--source/gameengine/Ketsji/KX_BlenderMaterial.cpp37
-rw-r--r--source/gameengine/Ketsji/KX_BulletPhysicsController.cpp18
-rw-r--r--source/gameengine/Ketsji/KX_Camera.cpp24
-rw-r--r--source/gameengine/Ketsji/KX_Dome.cpp60
-rw-r--r--source/gameengine/Ketsji/KX_GameObject.cpp48
-rw-r--r--source/gameengine/Ketsji/KX_KetsjiEngine.cpp2
-rw-r--r--source/gameengine/Ketsji/KX_Light.cpp10
-rw-r--r--source/gameengine/Ketsji/KX_MeshProxy.cpp14
-rw-r--r--source/gameengine/Ketsji/KX_MouseFocusSensor.cpp8
-rw-r--r--source/gameengine/Ketsji/KX_PythonInit.cpp82
-rw-r--r--source/gameengine/Ketsji/KX_RaySensor.cpp20
-rw-r--r--source/gameengine/Ketsji/KX_SCA_EndObjectActuator.cpp8
-rw-r--r--source/gameengine/Ketsji/KX_TrackToActuator.cpp18
-rw-r--r--source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp2
-rw-r--r--source/gameengine/SceneGraph/SG_BBox.cpp4
-rw-r--r--source/gameengine/SceneGraph/SG_Spatial.cpp15
-rw-r--r--source/gameengine/VideoTexture/Exception.cpp30
-rw-r--r--source/gameengine/VideoTexture/ImageBase.cpp26
-rw-r--r--source/gameengine/VideoTexture/ImageRender.cpp584
-rw-r--r--source/gameengine/VideoTexture/ImageViewport.cpp42
-rw-r--r--source/gameengine/VideoTexture/VideoFFmpeg.cpp6
-rw-r--r--source/gameengine/VideoTexture/blendVideoTex.cpp4
42 files changed, 760 insertions, 765 deletions
diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp b/source/gameengine/Converter/BL_BlenderDataConversion.cpp
index 887deb1ffa3..fcfc07e631e 100644
--- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp
+++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp
@@ -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);
diff --git a/source/gameengine/Converter/BL_ShapeDeformer.cpp b/source/gameengine/Converter/BL_ShapeDeformer.cpp
index befe0f6e784..f4c683f60ba 100644
--- a/source/gameengine/Converter/BL_ShapeDeformer.cpp
+++ b/source/gameengine/Converter/BL_ShapeDeformer.cpp
@@ -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);
diff --git a/source/gameengine/Converter/BlenderWorldInfo.cpp b/source/gameengine/Converter/BlenderWorldInfo.cpp
index 8fc01032de7..f003a0049e5 100644
--- a/source/gameengine/Converter/BlenderWorldInfo.cpp
+++ b/source/gameengine/Converter/BlenderWorldInfo.cpp
@@ -170,10 +170,10 @@ float BlenderWorldInfo::getMistStart()
float BlenderWorldInfo::getMistDistance()
{
return m_mistdistance;
-}
-
+}
+
+
-
float BlenderWorldInfo::getMistColorRed()
{
return m_mistcolor[0];
diff --git a/source/gameengine/Converter/KX_ConvertActuators.cpp b/source/gameengine/Converter/KX_ConvertActuators.cpp
index 9621d05b5cc..a84a1419d0d 100644
--- a/source/gameengine/Converter/KX_ConvertActuators.cpp
+++ b/source/gameengine/Converter/KX_ConvertActuators.cpp
@@ -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:
diff --git a/source/gameengine/Converter/KX_ConvertSensors.cpp b/source/gameengine/Converter/KX_ConvertSensors.cpp
index ad6941dcdc7..a250bc6064b 100644
--- a/source/gameengine/Converter/KX_ConvertSensors.cpp
+++ b/source/gameengine/Converter/KX_ConvertSensors.cpp
@@ -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;
diff --git a/source/gameengine/Expressions/InputParser.cpp b/source/gameengine/Expressions/InputParser.cpp
index 7957c82e7f9..27f4f0b10cb 100644
--- a/source/gameengine/Expressions/InputParser.cpp
+++ b/source/gameengine/Expressions/InputParser.cpp
@@ -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
diff --git a/source/gameengine/GameLogic/SCA_2DFilterActuator.cpp b/source/gameengine/GameLogic/SCA_2DFilterActuator.cpp
index c270d9a312b..7c1824cd4eb 100644
--- a/source/gameengine/GameLogic/SCA_2DFilterActuator.cpp
+++ b/source/gameengine/GameLogic/SCA_2DFilterActuator.cpp
@@ -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;
}
diff --git a/source/gameengine/GameLogic/SCA_ISensor.cpp b/source/gameengine/GameLogic/SCA_ISensor.cpp
index 0d09e33a81b..85982bd3c0f 100644
--- a/source/gameengine/GameLogic/SCA_ISensor.cpp
+++ b/source/gameengine/GameLogic/SCA_ISensor.cpp
@@ -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())
diff --git a/source/gameengine/GameLogic/SCA_KeyboardSensor.cpp b/source/gameengine/GameLogic/SCA_KeyboardSensor.cpp
index 513be43ec28..a2374ccb9da 100644
--- a/source/gameengine/GameLogic/SCA_KeyboardSensor.cpp
+++ b/source/gameengine/GameLogic/SCA_KeyboardSensor.cpp
@@ -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);
diff --git a/source/gameengine/GameLogic/SCA_MouseSensor.cpp b/source/gameengine/GameLogic/SCA_MouseSensor.cpp
index a1836163e9c..93d2ae2c1c5 100644
--- a/source/gameengine/GameLogic/SCA_MouseSensor.cpp
+++ b/source/gameengine/GameLogic/SCA_MouseSensor.cpp
@@ -50,12 +50,12 @@
/* ------------------------------------------------------------------------- */
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)
diff --git a/source/gameengine/GameLogic/SCA_RandomNumberGenerator.cpp b/source/gameengine/GameLogic/SCA_RandomNumberGenerator.cpp
index 06c24c8211b..67af6237a8d 100644
--- a/source/gameengine/GameLogic/SCA_RandomNumberGenerator.cpp
+++ b/source/gameengine/GameLogic/SCA_RandomNumberGenerator.cpp
@@ -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() {
diff --git a/source/gameengine/GameLogic/SCA_RandomSensor.cpp b/source/gameengine/GameLogic/SCA_RandomSensor.cpp
index 99e25042582..c23722d2d3c 100644
--- a/source/gameengine/GameLogic/SCA_RandomSensor.cpp
+++ b/source/gameengine/GameLogic/SCA_RandomSensor.cpp
@@ -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;
}
diff --git a/source/gameengine/GameLogic/SCA_XORController.cpp b/source/gameengine/GameLogic/SCA_XORController.cpp
index f5eefd5cc08..4a03062b6ad 100644
--- a/source/gameengine/GameLogic/SCA_XORController.cpp
+++ b/source/gameengine/GameLogic/SCA_XORController.cpp
@@ -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);
diff --git a/source/gameengine/GamePlayer/common/bmfont.cpp b/source/gameengine/GamePlayer/common/bmfont.cpp
index e3b900173d9..ecb2c4f3bd1 100644
--- a/source/gameengine/GamePlayer/common/bmfont.cpp
+++ b/source/gameengine/GamePlayer/common/bmfont.cpp
@@ -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]);
diff --git a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp
index 546ec69bf29..c5daae9c963 100644
--- a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp
+++ b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp
@@ -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;
diff --git a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp
index cbbeb9419d1..3f8bcf9e2ad 100644
--- a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp
+++ b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp
@@ -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]);
diff --git a/source/gameengine/Ketsji/BL_BlenderShader.cpp b/source/gameengine/Ketsji/BL_BlenderShader.cpp
index 91982a424c7..4ae937cdcd6 100644
--- a/source/gameengine/Ketsji/BL_BlenderShader.cpp
+++ b/source/gameengine/Ketsji/BL_BlenderShader.cpp
@@ -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;
diff --git a/source/gameengine/Ketsji/KXNetwork/KX_NetworkEventManager.cpp b/source/gameengine/Ketsji/KXNetwork/KX_NetworkEventManager.cpp
index e8e65371d3a..72f1cee8855 100644
--- a/source/gameengine/Ketsji/KXNetwork/KX_NetworkEventManager.cpp
+++ b/source/gameengine/Ketsji/KXNetwork/KX_NetworkEventManager.cpp
@@ -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
diff --git a/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageActuator.cpp b/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageActuator.cpp
index 2e0abc0290c..9fd09506c0d 100644
--- a/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageActuator.cpp
+++ b/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageActuator.cpp
@@ -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;
diff --git a/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.cpp b/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.cpp
index 6dcf50fa18f..a795a4eddc6 100644
--- a/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.cpp
+++ b/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.cpp
@@ -50,11 +50,11 @@
#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()
diff --git a/source/gameengine/Ketsji/KX_BlenderMaterial.cpp b/source/gameengine/Ketsji/KX_BlenderMaterial.cpp
index 4226896aec0..33da17cc505 100644
--- a/source/gameengine/Ketsji/KX_BlenderMaterial.cpp
+++ b/source/gameengine/Ketsji/KX_BlenderMaterial.cpp
@@ -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));
}
diff --git a/source/gameengine/Ketsji/KX_BulletPhysicsController.cpp b/source/gameengine/Ketsji/KX_BulletPhysicsController.cpp
index fde01961fd5..6e5513991f9 100644
--- a/source/gameengine/Ketsji/KX_BulletPhysicsController.cpp
+++ b/source/gameengine/Ketsji/KX_BulletPhysicsController.cpp
@@ -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()
diff --git a/source/gameengine/Ketsji/KX_Camera.cpp b/source/gameengine/Ketsji/KX_Camera.cpp
index c60c931c33b..a488d646792 100644
--- a/source/gameengine/Ketsji/KX_Camera.cpp
+++ b/source/gameengine/Ketsji/KX_Camera.cpp
@@ -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
diff --git a/source/gameengine/Ketsji/KX_Dome.cpp b/source/gameengine/Ketsji/KX_Dome.cpp
index 2e1fb933ad0..00c5e5803a8 100644
--- a/source/gameengine/Ketsji/KX_Dome.cpp
+++ b/source/gameengine/Ketsji/KX_Dome.cpp
@@ -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);
diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp b/source/gameengine/Ketsji/KX_GameObject.cpp
index 7ced0c0c4d7..67178803457 100644
--- a/source/gameengine/Ketsji/KX_GameObject.cpp
+++ b/source/gameengine/Ketsji/KX_GameObject.cpp
@@ -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;
diff --git a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp
index b1a214b7c1c..878232f7a50 100644
--- a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp
+++ b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp
@@ -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),
diff --git a/source/gameengine/Ketsji/KX_Light.cpp b/source/gameengine/Ketsji/KX_Light.cpp
index 3f09eee013e..2f2c45cd5cc 100644
--- a/source/gameengine/Ketsji/KX_Light.cpp
+++ b/source/gameengine/Ketsji/KX_Light.cpp
@@ -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;
}
diff --git a/source/gameengine/Ketsji/KX_MeshProxy.cpp b/source/gameengine/Ketsji/KX_MeshProxy.cpp
index ba41dc355f7..9ad09f9793b 100644
--- a/source/gameengine/Ketsji/KX_MeshProxy.cpp
+++ b/source/gameengine/Ketsji/KX_MeshProxy.cpp
@@ -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))
diff --git a/source/gameengine/Ketsji/KX_MouseFocusSensor.cpp b/source/gameengine/Ketsji/KX_MouseFocusSensor.cpp
index 6cb80028858..34f5c26415d 100644
--- a/source/gameengine/Ketsji/KX_MouseFocusSensor.cpp
+++ b/source/gameengine/Ketsji/KX_MouseFocusSensor.cpp
@@ -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);
}
diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp
index 8557ebab0a9..395e2048cb7 100644
--- a/source/gameengine/Ketsji/KX_PythonInit.cpp
+++ b/source/gameengine/Ketsji/KX_PythonInit.cpp
@@ -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;
}
diff --git a/source/gameengine/Ketsji/KX_RaySensor.cpp b/source/gameengine/Ketsji/KX_RaySensor.cpp
index a683c9857aa..aecf2ab3598 100644
--- a/source/gameengine/Ketsji/KX_RaySensor.cpp
+++ b/source/gameengine/Ketsji/KX_RaySensor.cpp
@@ -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;
diff --git a/source/gameengine/Ketsji/KX_SCA_EndObjectActuator.cpp b/source/gameengine/Ketsji/KX_SCA_EndObjectActuator.cpp
index 076669e325a..c5f3fefd4d3 100644
--- a/source/gameengine/Ketsji/KX_SCA_EndObjectActuator.cpp
+++ b/source/gameengine/Ketsji/KX_SCA_EndObjectActuator.cpp
@@ -44,11 +44,11 @@
#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 */
diff --git a/source/gameengine/Ketsji/KX_TrackToActuator.cpp b/source/gameengine/Ketsji/KX_TrackToActuator.cpp
index edcba969811..f13f152c5d5 100644
--- a/source/gameengine/Ketsji/KX_TrackToActuator.cpp
+++ b/source/gameengine/Ketsji/KX_TrackToActuator.cpp
@@ -54,16 +54,16 @@
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;
diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
index 3f0c4cb95a1..526176481ed 100644
--- a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
+++ b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
@@ -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())
{
diff --git a/source/gameengine/SceneGraph/SG_BBox.cpp b/source/gameengine/SceneGraph/SG_BBox.cpp
index b5618ebbf03..01107557481 100644
--- a/source/gameengine/SceneGraph/SG_BBox.cpp
+++ b/source/gameengine/SceneGraph/SG_BBox.cpp
@@ -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
diff --git a/source/gameengine/SceneGraph/SG_Spatial.cpp b/source/gameengine/SceneGraph/SG_Spatial.cpp
index ca778d164c8..94b8584051e 100644
--- a/source/gameengine/SceneGraph/SG_Spatial.cpp
+++ b/source/gameengine/SceneGraph/SG_Spatial.cpp
@@ -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)
diff --git a/source/gameengine/VideoTexture/Exception.cpp b/source/gameengine/VideoTexture/Exception.cpp
index fc316f1c3f0..30a8af4b125 100644
--- a/source/gameengine/VideoTexture/Exception.cpp
+++ b/source/gameengine/VideoTexture/Exception.cpp
@@ -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();
}
diff --git a/source/gameengine/VideoTexture/ImageBase.cpp b/source/gameengine/VideoTexture/ImageBase.cpp
index a70c56a070c..86de214e2d3 100644
--- a/source/gameengine/VideoTexture/ImageBase.cpp
+++ b/source/gameengine/VideoTexture/ImageBase.cpp
@@ -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;
}
diff --git a/source/gameengine/VideoTexture/ImageRender.cpp b/source/gameengine/VideoTexture/ImageRender.cpp
index 6038416ba68..24833ace08f 100644
--- a/source/gameengine/VideoTexture/ImageRender.cpp
+++ b/source/gameengine/VideoTexture/ImageRender.cpp
@@ -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);
}
diff --git a/source/gameengine/VideoTexture/ImageViewport.cpp b/source/gameengine/VideoTexture/ImageViewport.cpp
index d0e5ee74f6e..0276ad6fd6b 100644
--- a/source/gameengine/VideoTexture/ImageViewport.cpp
+++ b/source/gameengine/VideoTexture/ImageViewport.cpp
@@ -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);
+ }
}
}
diff --git a/source/gameengine/VideoTexture/VideoFFmpeg.cpp b/source/gameengine/VideoTexture/VideoFFmpeg.cpp
index f8274756c8b..8a76b0c004d 100644
--- a/source/gameengine/VideoTexture/VideoFFmpeg.cpp
+++ b/source/gameengine/VideoTexture/VideoFFmpeg.cpp
@@ -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;
diff --git a/source/gameengine/VideoTexture/blendVideoTex.cpp b/source/gameengine/VideoTexture/blendVideoTex.cpp
index c1258bbb6e4..2cb3831de52 100644
--- a/source/gameengine/VideoTexture/blendVideoTex.cpp
+++ b/source/gameengine/VideoTexture/blendVideoTex.cpp
@@ -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;