diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-07-19 03:03:27 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-07-19 03:03:27 +0400 |
commit | d0e892a7286791a4b2d1c5d7321fe8fe040819dd (patch) | |
tree | 43a9024562d8272d3211e75bea0b614d286196c8 /source/gameengine/Ketsji | |
parent | db14b97be6917d961c893ba6e0188c927ffa67b0 (diff) |
quiet double promotion warnings for the game engine.
Diffstat (limited to 'source/gameengine/Ketsji')
-rw-r--r-- | source/gameengine/Ketsji/KX_CameraActuator.cpp | 32 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_GameActuator.h | 52 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp | 65 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_SCA_AddObjectActuator.h | 52 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_SCA_DynamicActuator.cpp | 67 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_SCA_DynamicActuator.h | 52 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_SCA_EndObjectActuator.h | 52 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.cpp | 57 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.h | 52 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_SceneActuator.h | 52 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_TrackToActuator.cpp | 116 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_TrackToActuator.h | 52 |
12 files changed, 348 insertions, 353 deletions
diff --git a/source/gameengine/Ketsji/KX_CameraActuator.cpp b/source/gameengine/Ketsji/KX_CameraActuator.cpp index dfe45b8cfcd..e009478c803 100644 --- a/source/gameengine/Ketsji/KX_CameraActuator.cpp +++ b/source/gameengine/Ketsji/KX_CameraActuator.cpp @@ -192,10 +192,10 @@ static void Kx_VecUpMat3(float vec[3], float mat[][3], short axis) mat[coz][2] = 0.0f; } - inp= mat[coz][2]; - mat[coy][0]= - inp*mat[coz][0]; - mat[coy][1]= - inp*mat[coz][1]; - mat[coy][2]= 1.0 - inp*mat[coz][2]; + inp = mat[coz][2]; + mat[coy][0] = - inp * mat[coz][0]; + mat[coy][1] = - inp * mat[coz][1]; + mat[coy][2] = 1.0f - inp * mat[coz][2]; if (Kx_Normalize((float *)mat[coy]) == 0.f) { /* the camera is vertical, chose the y axis arbitrary */ @@ -260,7 +260,7 @@ bool KX_CameraActuator::Update(double curtime, bool frame) /* C2: blender test_visibility function. Can this be a ray-test? */ /* C3: fixed height */ - from[2] = (15.0*from[2] + lookat[2] + m_height)/16.0; + from[2] = (15.0f * from[2] + lookat[2] + m_height) / 16.0f; /* C4: camera behind actor */ @@ -310,22 +310,22 @@ bool KX_CameraActuator::Update(double curtime, bool frame) break; } - inp= fp1[0]*fp2[0] + fp1[1]*fp2[1] + fp1[2]*fp2[2]; - fac= (-1.0 + inp) * m_damping; + inp = fp1[0]*fp2[0] + fp1[1]*fp2[1] + fp1[2]*fp2[2]; + fac = (-1.0f + inp) * m_damping; from[0]+= fac*fp1[0]; from[1]+= fac*fp1[1]; from[2]+= fac*fp1[2]; /* alleen alstie ervoor ligt: cross testen en loodrechte bijtellen */ - if (inp<0.0) { - if (fp1[0]*fp2[1] - fp1[1]*fp2[0] > 0.0) { - from[0]-= fac*fp1[1]; - from[1]+= fac*fp1[0]; + if (inp < 0.0f) { + if (fp1[0] * fp2[1] - fp1[1] * fp2[0] > 0.0f) { + from[0] -= fac * fp1[1]; + from[1] += fac * fp1[0]; } else { - from[0]+= fac*fp1[1]; - from[1]-= fac*fp1[0]; + from[0] += fac * fp1[1]; + from[1] -= fac * fp1[0]; } } @@ -334,17 +334,17 @@ bool KX_CameraActuator::Update(double curtime, bool frame) rc[0]= (lookat[0]-from[0]); rc[1]= (lookat[1]-from[1]); rc[2]= (lookat[2]-from[2]); - distsq= rc[0]*rc[0] + rc[1]*rc[1] + rc[2]*rc[2]; + distsq = rc[0]*rc[0] + rc[1]*rc[1] + rc[2]*rc[2]; if (distsq > maxdistsq) { - distsq = 0.15*(distsq-maxdistsq)/distsq; + distsq = 0.15f * (distsq - maxdistsq) / distsq; from[0] += distsq*rc[0]; from[1] += distsq*rc[1]; from[2] += distsq*rc[2]; } else if (distsq < mindistsq) { - distsq = 0.15*(mindistsq-distsq)/mindistsq; + distsq = 0.15f * (mindistsq - distsq) / mindistsq; from[0] -= distsq*rc[0]; from[1] -= distsq*rc[1]; diff --git a/source/gameengine/Ketsji/KX_GameActuator.h b/source/gameengine/Ketsji/KX_GameActuator.h index 8356bc1068b..0c1c4f0c277 100644 --- a/source/gameengine/Ketsji/KX_GameActuator.h +++ b/source/gameengine/Ketsji/KX_GameActuator.h @@ -1,29 +1,29 @@ -// -// ***** BEGIN GPL LICENSE BLOCK ***** -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software Foundation, -// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -// -// The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. -// All rights reserved. -// -// The Original Code is: all of this file. -// -// Contributor(s): none yet. -// -// ***** END GPL LICENSE BLOCK ***** -// +/* + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): none yet. + * + * ***** END GPL LICENSE BLOCK ***** + */ /** \file KX_GameActuator.h * \ingroup ketsji diff --git a/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp b/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp index 39b7c44eda9..841feda5237 100644 --- a/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp +++ b/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp @@ -1,40 +1,39 @@ +/* + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): none yet. + * + * ***** END GPL LICENSE BLOCK ***** + */ + /** \file gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp * \ingroup ketsji + * + * Add an object when this actuator is triggered */ -// -// Add an object when this actuator is triggered -// -// -// ***** BEGIN GPL LICENSE BLOCK ***** -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software Foundation, -// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -// -// The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. -// All rights reserved. -// -// The Original Code is: all of this file. -// -// Contributor(s): none yet. -// -// ***** END GPL LICENSE BLOCK ***** -// Previously existed as: - -// \source\gameengine\GameLogic\SCA_AddObjectActuator.cpp - -// Please look here for revision history. +/* Previously existed as: + * \source\gameengine\GameLogic\SCA_AddObjectActuator.cpp + * Please look here for revision history. */ #include "KX_SCA_AddObjectActuator.h" #include "SCA_IScene.h" diff --git a/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.h b/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.h index 40136f429a2..e0aba795e01 100644 --- a/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.h +++ b/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.h @@ -1,28 +1,29 @@ -// -// ***** BEGIN GPL LICENSE BLOCK ***** -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software Foundation, -// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -// -// The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. -// All rights reserved. -// -// The Original Code is: all of this file. -// -// Contributor(s): none yet. -// -// ***** END GPL LICENSE BLOCK ***** +/* + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): none yet. + * + * ***** END GPL LICENSE BLOCK ***** + */ /** \file KX_SCA_AddObjectActuator.h * \ingroup ketsji @@ -40,7 +41,6 @@ #include "MT_Vector3.h" - class SCA_IScene; class KX_SCA_AddObjectActuator : public SCA_IActuator diff --git a/source/gameengine/Ketsji/KX_SCA_DynamicActuator.cpp b/source/gameengine/Ketsji/KX_SCA_DynamicActuator.cpp index ff44fad1f3f..35c791e427d 100644 --- a/source/gameengine/Ketsji/KX_SCA_DynamicActuator.cpp +++ b/source/gameengine/Ketsji/KX_SCA_DynamicActuator.cpp @@ -1,41 +1,38 @@ +/* + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): none yet. + * + * ***** END GPL LICENSE BLOCK ***** + */ + /** \file gameengine/Ketsji/KX_SCA_DynamicActuator.cpp * \ingroup ketsji + * Adjust dynamics settins for this object */ -// -// Adjust dynamics settins for this object -// -// -// ***** BEGIN GPL LICENSE BLOCK ***** -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software Foundation, -// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -// -// The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. -// All rights reserved. -// -// The Original Code is: all of this file. -// -// Contributor(s): none yet. -// -// ***** END GPL LICENSE BLOCK ***** - -// -// Previously existed as: - -// \source\gameengine\GameLogic\SCA_DynamicActuator.cpp - -// Please look here for revision history. + +/* Previously existed as: + * \source\gameengine\GameLogic\SCA_DynamicActuator.cpp + * Please look here for revision history. */ #include "KX_SCA_DynamicActuator.h" diff --git a/source/gameengine/Ketsji/KX_SCA_DynamicActuator.h b/source/gameengine/Ketsji/KX_SCA_DynamicActuator.h index 885c7a0297f..01a91624c41 100644 --- a/source/gameengine/Ketsji/KX_SCA_DynamicActuator.h +++ b/source/gameengine/Ketsji/KX_SCA_DynamicActuator.h @@ -1,29 +1,29 @@ -// -// ***** BEGIN GPL LICENSE BLOCK ***** -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software Foundation, -// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -// -// The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. -// All rights reserved. -// -// The Original Code is: all of this file. -// -// Contributor(s): Campbell Barton -// -// ***** END GPL LICENSE BLOCK ***** -// +/* + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): Campbell Barton + * + * ***** END GPL LICENSE BLOCK ***** + */ /** \file KX_SCA_DynamicActuator.h * \ingroup ketsji diff --git a/source/gameengine/Ketsji/KX_SCA_EndObjectActuator.h b/source/gameengine/Ketsji/KX_SCA_EndObjectActuator.h index 374d5f2f211..1a503c074ed 100644 --- a/source/gameengine/Ketsji/KX_SCA_EndObjectActuator.h +++ b/source/gameengine/Ketsji/KX_SCA_EndObjectActuator.h @@ -1,29 +1,29 @@ -// -// ***** BEGIN GPL LICENSE BLOCK ***** -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software Foundation, -// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -// -// The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. -// All rights reserved. -// -// The Original Code is: all of this file. -// -// Contributor(s): none yet. -// -// ***** END GPL LICENSE BLOCK ***** -// +/* + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): none yet. + * + * ***** END GPL LICENSE BLOCK ***** + */ /** \file KX_SCA_EndObjectActuator.h * \ingroup ketsji diff --git a/source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.cpp b/source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.cpp index 00a6e9e63d5..ffe5556cfe6 100644 --- a/source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.cpp +++ b/source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.cpp @@ -1,34 +1,35 @@ +/* + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): none yet. + * + * ***** END GPL LICENSE BLOCK ***** + */ + /** \file gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.cpp * \ingroup ketsji + * + * Replace the mesh for this actuator's parent */ -// -// Replace the mesh for this actuator's parent -// -// -// ***** BEGIN GPL LICENSE BLOCK ***** -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software Foundation, -// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -// -// The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. -// All rights reserved. -// -// The Original Code is: all of this file. -// -// Contributor(s): none yet. -// -// ***** END GPL LICENSE BLOCK ***** // // Previously existed as: diff --git a/source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.h b/source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.h index c8e6123024d..d756c48f0f9 100644 --- a/source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.h +++ b/source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.h @@ -1,29 +1,29 @@ -// -// ***** BEGIN GPL LICENSE BLOCK ***** -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software Foundation, -// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -// -// The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. -// All rights reserved. -// -// The Original Code is: all of this file. -// -// Contributor(s): none yet. -// -// ***** END GPL LICENSE BLOCK ***** -// +/* + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): none yet. + * + * ***** END GPL LICENSE BLOCK ***** + */ /** \file KX_SCA_ReplaceMeshActuator.h * \ingroup ketsji diff --git a/source/gameengine/Ketsji/KX_SceneActuator.h b/source/gameengine/Ketsji/KX_SceneActuator.h index 774f740dd00..8e157544e2e 100644 --- a/source/gameengine/Ketsji/KX_SceneActuator.h +++ b/source/gameengine/Ketsji/KX_SceneActuator.h @@ -1,29 +1,29 @@ -// -// ***** BEGIN GPL LICENSE BLOCK ***** -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software Foundation, -// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -// -// The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. -// All rights reserved. -// -// The Original Code is: all of this file. -// -// Contributor(s): none yet. -// -// ***** END GPL LICENSE BLOCK ***** -// +/* + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): none yet. + * + * ***** END GPL LICENSE BLOCK ***** + */ /** \file KX_SceneActuator.h * \ingroup ketsji diff --git a/source/gameengine/Ketsji/KX_TrackToActuator.cpp b/source/gameengine/Ketsji/KX_TrackToActuator.cpp index af93121b50e..99732130f83 100644 --- a/source/gameengine/Ketsji/KX_TrackToActuator.cpp +++ b/source/gameengine/Ketsji/KX_TrackToActuator.cpp @@ -1,39 +1,40 @@ +/* + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): none yet. + * + * ***** END GPL LICENSE BLOCK ***** + */ + /** \file gameengine/Ketsji/KX_TrackToActuator.cpp * \ingroup ketsji + * + * Replace the mesh for this actuator's parent */ -// -// Replace the mesh for this actuator's parent -// -// -// ***** BEGIN GPL LICENSE BLOCK ***** -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software Foundation, -// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -// -// The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. -// All rights reserved. -// -// The Original Code is: all of this file. -// -// Contributor(s): none yet. -// -// ***** END GPL LICENSE BLOCK ***** - -// todo: not all trackflags / upflags are implemented/tested ! -// m_trackflag is used to determine the forward tracking direction -// m_upflag for the up direction -// normal situation is +y for forward, +z for up + +/* todo: not all trackflags / upflags are implemented/tested ! + * m_trackflag is used to determine the forward tracking direction + * m_upflag for the up direction + * normal situation is +y for forward, +z for up */ #include "MT_Scalar.h" #include "SCA_IActuator.h" @@ -50,8 +51,6 @@ /* Native functions */ /* ------------------------------------------------------------------------- */ - - KX_TrackToActuator::KX_TrackToActuator(SCA_IObject *gameobj, SCA_IObject *ob, int time, @@ -123,19 +122,18 @@ MT_Matrix3x3 EulToMat3(float *eul) /* old function from Blender */ -void Mat3ToEulOld(MT_Matrix3x3 mat, float *eul) +void Mat3ToEulOld(MT_Matrix3x3 mat, float eul[3]) { - MT_Scalar cy; - - cy = sqrt(mat[0][0]*mat[0][0] + mat[0][1]*mat[0][1]); - - if (cy > 16.0*FLT_EPSILON) { - eul[0] = atan2(mat[1][2], mat[2][2]); - eul[1] = atan2(-mat[0][2], cy); - eul[2] = atan2(mat[0][1], mat[0][0]); - } else { - eul[0] = atan2(-mat[2][1], mat[1][1]); - eul[1] = atan2(-mat[0][2], cy); + const float cy = sqrtf(mat[0][0] * mat[0][0] + mat[0][1] * mat[0][1]); + + if (cy > (float)(16.0f * FLT_EPSILON)) { + eul[0] = atan2f( mat[1][2], mat[2][2]); + eul[1] = atan2f(-mat[0][2], cy); + eul[2] = atan2f( mat[0][1], mat[0][0]); + } + else { + eul[0] = atan2f(-mat[2][1], mat[1][1]); + eul[1] = atan2f(-mat[0][2], cy); eul[2] = 0.0; } } @@ -149,18 +147,18 @@ void compatible_eulFast(float *eul, float *oldrot) /* angular difference of 360 degrees */ - dx= eul[0] - oldrot[0]; - dy= eul[1] - oldrot[1]; - dz= eul[2] - oldrot[2]; + dx = eul[0] - oldrot[0]; + dy = eul[1] - oldrot[1]; + dz = eul[2] - oldrot[2]; - if ( fabs(dx) > MT_PI) { - if (dx > 0.0) eul[0] -= MT_2_PI; else eul[0]+= MT_2_PI; + if (fabsf(dx) > (float)MT_PI) { + if (dx > 0.0f) eul[0] -= (float)MT_2_PI; else eul[0] += (float)MT_2_PI; } - if ( fabs(dy) > MT_PI) { - if (dy > 0.0) eul[1] -= MT_2_PI; else eul[1]+= MT_2_PI; + if (fabsf(dy) > (float)MT_PI) { + if (dy > 0.0f) eul[1] -= (float)MT_2_PI; else eul[1] += (float)MT_2_PI; } - if ( fabs(dz) > MT_PI ) { - if (dz > 0.0) eul[2] -= MT_2_PI; else eul[2]+= MT_2_PI; + if (fabsf(dz) > (float)MT_PI) { + if (dz > 0.0f) eul[2] -= (float)MT_2_PI; else eul[2] += (float)MT_2_PI; } } @@ -174,9 +172,9 @@ MT_Matrix3x3 matrix3x3_interpol(MT_Matrix3x3 oldmat, MT_Matrix3x3 mat, int m_tim Mat3ToEulOld(mat, eul); compatible_eulFast(eul, oldeul); - eul[0]= (m_time*oldeul[0] + eul[0])/(1.0+m_time); - eul[1]= (m_time*oldeul[1] + eul[1])/(1.0+m_time); - eul[2]= (m_time*oldeul[2] + eul[2])/(1.0+m_time); + eul[0] = (m_time * oldeul[0] + eul[0]) / (1.0f + m_time); + eul[1] = (m_time * oldeul[1] + eul[1]) / (1.0f + m_time); + eul[2] = (m_time * oldeul[2] + eul[2]) / (1.0f + m_time); return EulToMat3(eul); } diff --git a/source/gameengine/Ketsji/KX_TrackToActuator.h b/source/gameengine/Ketsji/KX_TrackToActuator.h index 8eb69b1ad08..fb2ced2a415 100644 --- a/source/gameengine/Ketsji/KX_TrackToActuator.h +++ b/source/gameengine/Ketsji/KX_TrackToActuator.h @@ -1,29 +1,29 @@ -// -// ***** BEGIN GPL LICENSE BLOCK ***** -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software Foundation, -// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -// -// The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. -// All rights reserved. -// -// The Original Code is: all of this file. -// -// Contributor(s): none yet. -// -// ***** END GPL LICENSE BLOCK ***** -// +/* + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): none yet. + * + * ***** END GPL LICENSE BLOCK ***** + */ /** \file KX_TrackToActuator.h * \ingroup ketsji |