From 4be752a93cf37700668c604296f37ea08248f13b Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 17 Jun 2018 17:01:43 +0200 Subject: Cleanup: trailing space in source/gameengine/ --- .../BlenderRoutines/BL_KetsjiEmbedStart.cpp | 64 +-- .../BlenderRoutines/KX_BlenderCanvas.cpp | 2 +- .../gameengine/BlenderRoutines/KX_BlenderCanvas.h | 34 +- .../BlenderRoutines/KX_BlenderKeyboardDevice.cpp | 12 +- .../BlenderRoutines/KX_BlenderMouseDevice.cpp | 18 +- source/gameengine/Converter/BL_ActionActuator.cpp | 78 ++-- source/gameengine/Converter/BL_ActionActuator.h | 10 +- .../gameengine/Converter/BL_ArmatureActuator.cpp | 12 +- source/gameengine/Converter/BL_ArmatureActuator.h | 6 +- source/gameengine/Converter/BL_ArmatureChannel.cpp | 18 +- source/gameengine/Converter/BL_ArmatureChannel.h | 2 +- .../gameengine/Converter/BL_ArmatureConstraint.cpp | 8 +- .../gameengine/Converter/BL_ArmatureConstraint.h | 8 +- source/gameengine/Converter/BL_ArmatureObject.cpp | 36 +- source/gameengine/Converter/BL_ArmatureObject.h | 10 +- .../Converter/BL_BlenderDataConversion.cpp | 496 ++++++++++----------- .../Converter/BL_BlenderDataConversion.h | 4 +- .../Converter/BL_DeformableGameObject.cpp | 4 +- .../gameengine/Converter/BL_DeformableGameObject.h | 8 +- source/gameengine/Converter/BL_MeshDeformer.cpp | 6 +- source/gameengine/Converter/BL_MeshDeformer.h | 4 +- .../gameengine/Converter/BL_ModifierDeformer.cpp | 2 +- source/gameengine/Converter/BL_ModifierDeformer.h | 2 +- .../Converter/BL_ShapeActionActuator.cpp | 58 +-- .../gameengine/Converter/BL_ShapeActionActuator.h | 8 +- source/gameengine/Converter/BL_ShapeDeformer.cpp | 8 +- source/gameengine/Converter/BL_ShapeDeformer.h | 2 +- source/gameengine/Converter/BL_SkinDeformer.cpp | 8 +- source/gameengine/Converter/BL_SkinDeformer.h | 6 +- .../Converter/KX_BlenderScalarInterpolator.cpp | 4 +- .../Converter/KX_BlenderScalarInterpolator.h | 2 +- .../Converter/KX_BlenderSceneConverter.cpp | 64 +-- .../Converter/KX_BlenderSceneConverter.h | 22 +- .../gameengine/Converter/KX_ConvertActuators.cpp | 102 ++--- .../gameengine/Converter/KX_ConvertControllers.cpp | 14 +- .../gameengine/Converter/KX_ConvertControllers.h | 2 +- .../gameengine/Converter/KX_ConvertProperties.cpp | 12 +- source/gameengine/Converter/KX_ConvertSensors.cpp | 2 +- source/gameengine/Converter/KX_ConvertSensors.h | 2 +- source/gameengine/Converter/KX_LibLoadStatus.cpp | 6 +- .../gameengine/Converter/KX_SoftBodyDeformer.cpp | 2 +- source/gameengine/Converter/KX_SoftBodyDeformer.h | 2 +- source/gameengine/Expressions/EXP_BoolValue.h | 6 +- source/gameengine/Expressions/EXP_ConstExpr.h | 6 +- source/gameengine/Expressions/EXP_EmptyValue.h | 2 +- source/gameengine/Expressions/EXP_ErrorValue.h | 2 +- source/gameengine/Expressions/EXP_Expression.h | 22 +- source/gameengine/Expressions/EXP_FloatValue.h | 2 +- source/gameengine/Expressions/EXP_HashedPtr.h | 4 +- source/gameengine/Expressions/EXP_IfExpr.h | 6 +- source/gameengine/Expressions/EXP_InputParser.h | 14 +- source/gameengine/Expressions/EXP_IntValue.h | 8 +- source/gameengine/Expressions/EXP_ListValue.h | 6 +- source/gameengine/Expressions/EXP_ListWrapper.h | 2 +- source/gameengine/Expressions/EXP_Operator1Expr.h | 8 +- source/gameengine/Expressions/EXP_Operator2Expr.h | 8 +- source/gameengine/Expressions/EXP_PyObjectPlus.h | 24 +- source/gameengine/Expressions/EXP_StringValue.h | 6 +- source/gameengine/Expressions/EXP_Value.h | 58 +-- source/gameengine/Expressions/EXP_VectorValue.h | 16 +- source/gameengine/Expressions/EXP_VoidValue.h | 8 +- source/gameengine/Expressions/intern/BoolValue.cpp | 4 +- source/gameengine/Expressions/intern/ConstExpr.cpp | 4 +- .../gameengine/Expressions/intern/EmptyValue.cpp | 6 +- .../gameengine/Expressions/intern/ErrorValue.cpp | 4 +- .../gameengine/Expressions/intern/Expression.cpp | 6 +- .../gameengine/Expressions/intern/FloatValue.cpp | 10 +- .../Expressions/intern/IdentifierExpr.cpp | 2 +- source/gameengine/Expressions/intern/IfExpr.cpp | 4 +- .../gameengine/Expressions/intern/InputParser.cpp | 38 +- source/gameengine/Expressions/intern/IntValue.cpp | 16 +- source/gameengine/Expressions/intern/ListValue.cpp | 56 +-- .../Expressions/intern/Operator1Expr.cpp | 12 +- .../Expressions/intern/Operator2Expr.cpp | 40 +- .../gameengine/Expressions/intern/PyObjectPlus.cpp | 84 ++-- .../gameengine/Expressions/intern/StringValue.cpp | 12 +- source/gameengine/Expressions/intern/Value.cpp | 28 +- .../gameengine/Expressions/intern/VectorValue.cpp | 42 +- .../gameengine/GameLogic/Joystick/SCA_Joystick.cpp | 26 +- .../gameengine/GameLogic/Joystick/SCA_Joystick.h | 24 +- .../GameLogic/Joystick/SCA_JoystickEvents.cpp | 12 +- .../GameLogic/Joystick/SCA_JoystickPrivate.h | 2 +- source/gameengine/GameLogic/SCA_ANDController.cpp | 2 +- source/gameengine/GameLogic/SCA_ActuatorSensor.cpp | 2 +- source/gameengine/GameLogic/SCA_ActuatorSensor.h | 4 +- source/gameengine/GameLogic/SCA_AlwaysSensor.cpp | 4 +- source/gameengine/GameLogic/SCA_DelaySensor.cpp | 2 +- source/gameengine/GameLogic/SCA_DelaySensor.h | 2 +- source/gameengine/GameLogic/SCA_EventManager.h | 6 +- .../GameLogic/SCA_ExpressionController.h | 2 +- source/gameengine/GameLogic/SCA_IActuator.cpp | 8 +- source/gameengine/GameLogic/SCA_IActuator.h | 14 +- source/gameengine/GameLogic/SCA_IController.cpp | 20 +- source/gameengine/GameLogic/SCA_IController.h | 2 +- source/gameengine/GameLogic/SCA_IInputDevice.cpp | 2 +- source/gameengine/GameLogic/SCA_IInputDevice.h | 86 ++-- source/gameengine/GameLogic/SCA_ILogicBrick.cpp | 14 +- source/gameengine/GameLogic/SCA_ILogicBrick.h | 10 +- source/gameengine/GameLogic/SCA_IObject.cpp | 8 +- source/gameengine/GameLogic/SCA_IObject.h | 14 +- source/gameengine/GameLogic/SCA_IScene.cpp | 8 +- source/gameengine/GameLogic/SCA_IScene.h | 8 +- source/gameengine/GameLogic/SCA_ISensor.cpp | 34 +- source/gameengine/GameLogic/SCA_ISensor.h | 16 +- source/gameengine/GameLogic/SCA_JoystickSensor.cpp | 50 +-- source/gameengine/GameLogic/SCA_JoystickSensor.h | 10 +- source/gameengine/GameLogic/SCA_KeyboardManager.h | 4 +- source/gameengine/GameLogic/SCA_KeyboardSensor.cpp | 124 +++--- source/gameengine/GameLogic/SCA_KeyboardSensor.h | 10 +- source/gameengine/GameLogic/SCA_LogicManager.cpp | 16 +- source/gameengine/GameLogic/SCA_LogicManager.h | 16 +- source/gameengine/GameLogic/SCA_MouseManager.cpp | 10 +- source/gameengine/GameLogic/SCA_MouseManager.h | 4 +- source/gameengine/GameLogic/SCA_MouseSensor.cpp | 28 +- source/gameengine/GameLogic/SCA_MouseSensor.h | 12 +- source/gameengine/GameLogic/SCA_NANDController.cpp | 2 +- source/gameengine/GameLogic/SCA_NORController.cpp | 2 +- source/gameengine/GameLogic/SCA_ORController.cpp | 2 +- .../gameengine/GameLogic/SCA_PropertyActuator.cpp | 12 +- source/gameengine/GameLogic/SCA_PropertyActuator.h | 12 +- source/gameengine/GameLogic/SCA_PropertySensor.cpp | 10 +- source/gameengine/GameLogic/SCA_PropertySensor.h | 2 +- .../gameengine/GameLogic/SCA_PythonController.cpp | 64 +-- source/gameengine/GameLogic/SCA_PythonController.h | 12 +- source/gameengine/GameLogic/SCA_PythonJoystick.cpp | 14 +- source/gameengine/GameLogic/SCA_PythonKeyboard.cpp | 6 +- source/gameengine/GameLogic/SCA_PythonMouse.cpp | 6 +- source/gameengine/GameLogic/SCA_RandomActuator.cpp | 46 +- source/gameengine/GameLogic/SCA_RandomActuator.h | 14 +- .../GameLogic/SCA_RandomNumberGenerator.cpp | 14 +- .../GameLogic/SCA_RandomNumberGenerator.h | 4 +- source/gameengine/GameLogic/SCA_RandomSensor.cpp | 6 +- source/gameengine/GameLogic/SCA_RandomSensor.h | 2 +- .../gameengine/GameLogic/SCA_TimeEventManager.cpp | 4 +- source/gameengine/GameLogic/SCA_TimeEventManager.h | 2 +- source/gameengine/GameLogic/SCA_XORController.cpp | 2 +- source/gameengine/GamePlayer/common/GPC_Canvas.cpp | 6 +- source/gameengine/GamePlayer/common/GPC_Canvas.h | 20 +- .../GamePlayer/common/GPC_KeyboardDevice.cpp | 6 +- .../GamePlayer/common/GPC_KeyboardDevice.h | 4 +- .../GamePlayer/common/GPC_MouseDevice.cpp | 14 +- .../GamePlayer/ghost/GPG_Application.cpp | 78 ++-- .../gameengine/GamePlayer/ghost/GPG_Application.h | 4 +- source/gameengine/GamePlayer/ghost/GPG_ghost.cpp | 82 ++-- source/gameengine/Ketsji/BL_Action.cpp | 20 +- source/gameengine/Ketsji/BL_ActionManager.h | 4 +- source/gameengine/Ketsji/BL_BlenderShader.cpp | 6 +- source/gameengine/Ketsji/BL_BlenderShader.h | 6 +- source/gameengine/Ketsji/BL_Material.cpp | 2 +- source/gameengine/Ketsji/BL_Material.h | 6 +- source/gameengine/Ketsji/BL_Shader.cpp | 2 +- source/gameengine/Ketsji/BL_Texture.cpp | 46 +- source/gameengine/Ketsji/BL_Texture.h | 2 +- .../Ketsji/KXNetwork/KX_NetworkMessageActuator.h | 4 +- .../Ketsji/KXNetwork/KX_NetworkMessageSensor.h | 2 +- source/gameengine/Ketsji/KX_ArmatureSensor.h | 4 +- source/gameengine/Ketsji/KX_BlenderMaterial.cpp | 82 ++-- source/gameengine/Ketsji/KX_BlenderMaterial.h | 28 +- source/gameengine/Ketsji/KX_Camera.cpp | 106 ++--- source/gameengine/Ketsji/KX_Camera.h | 58 +-- source/gameengine/Ketsji/KX_CameraActuator.cpp | 38 +- source/gameengine/Ketsji/KX_CameraActuator.h | 16 +- .../gameengine/Ketsji/KX_CameraIpoSGController.cpp | 12 +- .../gameengine/Ketsji/KX_CameraIpoSGController.h | 6 +- source/gameengine/Ketsji/KX_CharacterWrapper.h | 2 +- source/gameengine/Ketsji/KX_ClientObjectInfo.h | 14 +- source/gameengine/Ketsji/KX_ConstraintActuator.cpp | 24 +- source/gameengine/Ketsji/KX_ConstraintActuator.h | 4 +- source/gameengine/Ketsji/KX_ConstraintWrapper.cpp | 10 +- source/gameengine/Ketsji/KX_ConstraintWrapper.h | 2 +- source/gameengine/Ketsji/KX_Dome.cpp | 48 +- source/gameengine/Ketsji/KX_Dome.h | 12 +- source/gameengine/Ketsji/KX_EmptyObject.h | 2 +- source/gameengine/Ketsji/KX_FontObject.cpp | 16 +- source/gameengine/Ketsji/KX_FontObject.h | 4 +- source/gameengine/Ketsji/KX_GameActuator.cpp | 24 +- source/gameengine/Ketsji/KX_GameActuator.h | 4 +- source/gameengine/Ketsji/KX_GameObject.cpp | 304 ++++++------- source/gameengine/Ketsji/KX_GameObject.h | 146 +++--- source/gameengine/Ketsji/KX_IInterpolator.h | 4 +- source/gameengine/Ketsji/KX_IPOTransform.h | 8 +- source/gameengine/Ketsji/KX_IPO_SGController.cpp | 12 +- source/gameengine/Ketsji/KX_IPO_SGController.h | 2 +- source/gameengine/Ketsji/KX_IScalarInterpolator.h | 4 +- source/gameengine/Ketsji/KX_ISceneConverter.h | 6 +- source/gameengine/Ketsji/KX_ISystem.h | 2 +- source/gameengine/Ketsji/KX_IpoConvert.cpp | 22 +- source/gameengine/Ketsji/KX_KetsjiEngine.cpp | 162 +++---- source/gameengine/Ketsji/KX_KetsjiEngine.h | 50 +-- source/gameengine/Ketsji/KX_Light.cpp | 4 +- source/gameengine/Ketsji/KX_Light.h | 2 +- .../gameengine/Ketsji/KX_LightIpoSGController.cpp | 8 +- source/gameengine/Ketsji/KX_LightIpoSGController.h | 8 +- .../gameengine/Ketsji/KX_MaterialIpoController.cpp | 18 +- .../gameengine/Ketsji/KX_MaterialIpoController.h | 4 +- source/gameengine/Ketsji/KX_MeshProxy.cpp | 52 +-- source/gameengine/Ketsji/KX_MeshProxy.h | 4 +- source/gameengine/Ketsji/KX_MotionState.cpp | 8 +- source/gameengine/Ketsji/KX_MouseFocusSensor.cpp | 84 ++-- source/gameengine/Ketsji/KX_MouseFocusSensor.h | 16 +- source/gameengine/Ketsji/KX_NavMeshObject.cpp | 32 +- source/gameengine/Ketsji/KX_NavMeshObject.h | 8 +- source/gameengine/Ketsji/KX_NearSensor.cpp | 42 +- source/gameengine/Ketsji/KX_NearSensor.h | 4 +- .../Ketsji/KX_ObColorIpoSGController.cpp | 8 +- .../gameengine/Ketsji/KX_ObColorIpoSGController.h | 10 +- source/gameengine/Ketsji/KX_ObjectActuator.cpp | 40 +- source/gameengine/Ketsji/KX_ObjectActuator.h | 10 +- source/gameengine/Ketsji/KX_ObstacleSimulation.cpp | 18 +- source/gameengine/Ketsji/KX_ObstacleSimulation.h | 20 +- .../Ketsji/KX_OrientationInterpolator.cpp | 6 +- .../gameengine/Ketsji/KX_OrientationInterpolator.h | 2 +- source/gameengine/Ketsji/KX_ParentActuator.cpp | 18 +- source/gameengine/Ketsji/KX_ParentActuator.h | 14 +- source/gameengine/Ketsji/KX_PositionInterpolator.h | 8 +- .../gameengine/Ketsji/KX_PyConstraintBinding.cpp | 16 +- source/gameengine/Ketsji/KX_PyMath.cpp | 14 +- source/gameengine/Ketsji/KX_PyMath.h | 26 +- source/gameengine/Ketsji/KX_PythonInit.cpp | 210 ++++----- source/gameengine/Ketsji/KX_PythonInitTypes.cpp | 2 +- source/gameengine/Ketsji/KX_RadarSensor.cpp | 10 +- source/gameengine/Ketsji/KX_RadarSensor.h | 4 +- source/gameengine/Ketsji/KX_RayCast.cpp | 14 +- source/gameengine/Ketsji/KX_RayCast.h | 26 +- source/gameengine/Ketsji/KX_RaySensor.cpp | 18 +- source/gameengine/Ketsji/KX_RaySensor.h | 10 +- .../gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp | 30 +- .../gameengine/Ketsji/KX_SCA_AddObjectActuator.h | 36 +- .../gameengine/Ketsji/KX_SCA_DynamicActuator.cpp | 6 +- source/gameengine/Ketsji/KX_SCA_DynamicActuator.h | 6 +- .../gameengine/Ketsji/KX_SCA_EndObjectActuator.cpp | 6 +- .../gameengine/Ketsji/KX_SCA_EndObjectActuator.h | 6 +- .../Ketsji/KX_SCA_ReplaceMeshActuator.cpp | 10 +- .../gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.h | 12 +- .../Ketsji/KX_SG_BoneParentNodeRelationship.cpp | 38 +- .../Ketsji/KX_SG_BoneParentNodeRelationship.h | 8 +- .../gameengine/Ketsji/KX_SG_NodeRelationships.cpp | 30 +- source/gameengine/Ketsji/KX_SG_NodeRelationships.h | 48 +- source/gameengine/Ketsji/KX_ScalarInterpolator.h | 4 +- source/gameengine/Ketsji/KX_ScalingInterpolator.h | 6 +- source/gameengine/Ketsji/KX_Scene.cpp | 224 +++++----- source/gameengine/Ketsji/KX_Scene.h | 76 ++-- source/gameengine/Ketsji/KX_SceneActuator.cpp | 20 +- source/gameengine/Ketsji/KX_SceneActuator.h | 12 +- source/gameengine/Ketsji/KX_SoundActuator.cpp | 8 +- source/gameengine/Ketsji/KX_StateActuator.cpp | 6 +- source/gameengine/Ketsji/KX_StateActuator.h | 4 +- source/gameengine/Ketsji/KX_SteeringActuator.cpp | 26 +- source/gameengine/Ketsji/KX_SteeringActuator.h | 8 +- source/gameengine/Ketsji/KX_TimeCategoryLogger.h | 4 +- source/gameengine/Ketsji/KX_TimeLogger.cpp | 4 +- source/gameengine/Ketsji/KX_TouchEventManager.cpp | 18 +- source/gameengine/Ketsji/KX_TouchEventManager.h | 16 +- source/gameengine/Ketsji/KX_TouchSensor.cpp | 40 +- source/gameengine/Ketsji/KX_TouchSensor.h | 14 +- source/gameengine/Ketsji/KX_TrackToActuator.cpp | 48 +- source/gameengine/Ketsji/KX_TrackToActuator.h | 4 +- source/gameengine/Ketsji/KX_VehicleWrapper.cpp | 10 +- source/gameengine/Ketsji/KX_VehicleWrapper.h | 14 +- source/gameengine/Ketsji/KX_VertexProxy.cpp | 4 +- source/gameengine/Ketsji/KX_VertexProxy.h | 2 +- source/gameengine/Ketsji/KX_VisibilityActuator.cpp | 6 +- source/gameengine/Ketsji/KX_VisibilityActuator.h | 2 +- source/gameengine/Ketsji/KX_WorldInfo.cpp | 6 +- source/gameengine/Ketsji/KX_WorldIpoController.cpp | 4 +- source/gameengine/Ketsji/KX_WorldIpoController.h | 8 +- .../NG_LoopBackNetworkDeviceInterface.cpp | 2 +- .../gameengine/Network/NG_NetworkDeviceInterface.h | 6 +- source/gameengine/Network/NG_NetworkMessage.h | 4 +- source/gameengine/Network/NG_NetworkScene.cpp | 10 +- .../Physics/Bullet/CcdGraphicController.cpp | 12 +- .../Physics/Bullet/CcdGraphicController.h | 6 +- .../Physics/Bullet/CcdPhysicsController.cpp | 104 ++--- .../Physics/Bullet/CcdPhysicsController.h | 80 ++-- .../Physics/Bullet/CcdPhysicsEnvironment.cpp | 174 ++++---- .../Physics/Bullet/CcdPhysicsEnvironment.h | 42 +- .../Physics/Dummy/DummyPhysicsEnvironment.cpp | 8 +- .../Physics/Dummy/DummyPhysicsEnvironment.h | 2 +- .../gameengine/Physics/common/PHY_DynamicTypes.h | 8 +- source/gameengine/Physics/common/PHY_ICharacter.h | 4 +- source/gameengine/Physics/common/PHY_IController.h | 2 +- .../gameengine/Physics/common/PHY_IMotionState.h | 6 +- .../Physics/common/PHY_IPhysicsController.h | 6 +- .../Physics/common/PHY_IPhysicsEnvironment.h | 12 +- source/gameengine/Physics/common/PHY_IVehicle.h | 12 +- source/gameengine/Physics/common/PHY_Pro.h | 8 +- .../gameengine/Rasterizer/RAS_2DFilterManager.cpp | 24 +- source/gameengine/Rasterizer/RAS_2DFilterManager.h | 4 +- source/gameengine/Rasterizer/RAS_BucketManager.cpp | 22 +- source/gameengine/Rasterizer/RAS_BucketManager.h | 4 +- .../gameengine/Rasterizer/RAS_FramingManager.cpp | 30 +- source/gameengine/Rasterizer/RAS_FramingManager.h | 30 +- source/gameengine/Rasterizer/RAS_ICanvas.h | 64 +-- source/gameengine/Rasterizer/RAS_ILightObject.h | 4 +- .../gameengine/Rasterizer/RAS_IPolygonMaterial.cpp | 10 +- .../gameengine/Rasterizer/RAS_IPolygonMaterial.h | 14 +- source/gameengine/Rasterizer/RAS_IRasterizer.h | 22 +- .../gameengine/Rasterizer/RAS_MaterialBucket.cpp | 40 +- source/gameengine/Rasterizer/RAS_MaterialBucket.h | 14 +- source/gameengine/Rasterizer/RAS_MeshObject.cpp | 40 +- source/gameengine/Rasterizer/RAS_MeshObject.h | 6 +- .../RAS_OpenGLFilters/RAS_GrayScale2DFilter.h | 2 +- .../RAS_OpenGLFilters/RAS_Sepia2DFilter.h | 2 +- .../RAS_OpenGLRasterizer/RAS_ListRasterizer.cpp | 4 +- .../RAS_OpenGLRasterizer/RAS_OpenGLLight.cpp | 2 +- .../RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp | 38 +- .../RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h | 14 +- .../RAS_OpenGLRasterizer/RAS_StorageVA.cpp | 4 +- source/gameengine/Rasterizer/RAS_Polygon.cpp | 2 +- source/gameengine/Rasterizer/RAS_Polygon.h | 6 +- source/gameengine/Rasterizer/RAS_Rect.h | 2 +- source/gameengine/Rasterizer/RAS_TexVert.cpp | 2 +- source/gameengine/Rasterizer/RAS_TexVert.h | 14 +- source/gameengine/Rasterizer/RAS_texmatrix.cpp | 12 +- source/gameengine/SceneGraph/SG_BBox.cpp | 22 +- source/gameengine/SceneGraph/SG_BBox.h | 22 +- source/gameengine/SceneGraph/SG_Controller.cpp | 2 +- source/gameengine/SceneGraph/SG_Controller.h | 22 +- source/gameengine/SceneGraph/SG_DList.h | 6 +- source/gameengine/SceneGraph/SG_IObject.cpp | 10 +- source/gameengine/SceneGraph/SG_IObject.h | 64 +-- source/gameengine/SceneGraph/SG_Node.cpp | 24 +- source/gameengine/SceneGraph/SG_Node.h | 26 +- source/gameengine/SceneGraph/SG_ParentRelation.h | 52 +-- source/gameengine/SceneGraph/SG_QList.h | 2 +- source/gameengine/SceneGraph/SG_Spatial.cpp | 28 +- source/gameengine/SceneGraph/SG_Spatial.h | 56 +-- source/gameengine/SceneGraph/SG_Tree.cpp | 64 +-- source/gameengine/SceneGraph/SG_Tree.h | 46 +- source/gameengine/VideoTexture/BlendType.h | 2 +- source/gameengine/VideoTexture/DeckLink.cpp | 14 +- source/gameengine/VideoTexture/Exception.h | 4 +- .../gameengine/VideoTexture/FilterBlueScreen.cpp | 4 +- source/gameengine/VideoTexture/FilterBlueScreen.h | 2 +- source/gameengine/VideoTexture/FilterColor.cpp | 14 +- source/gameengine/VideoTexture/FilterColor.h | 2 +- source/gameengine/VideoTexture/FilterNormal.cpp | 4 +- source/gameengine/VideoTexture/FilterSource.cpp | 6 +- source/gameengine/VideoTexture/FilterSource.h | 10 +- source/gameengine/VideoTexture/ImageBase.cpp | 8 +- source/gameengine/VideoTexture/ImageBase.h | 4 +- source/gameengine/VideoTexture/ImageBuff.cpp | 12 +- source/gameengine/VideoTexture/ImageMix.cpp | 2 +- source/gameengine/VideoTexture/ImageRender.cpp | 16 +- source/gameengine/VideoTexture/ImageViewport.cpp | 6 +- source/gameengine/VideoTexture/PyTypeList.cpp | 2 +- source/gameengine/VideoTexture/Texture.cpp | 12 +- source/gameengine/VideoTexture/VideoBase.cpp | 4 +- source/gameengine/VideoTexture/VideoDeckLink.cpp | 16 +- source/gameengine/VideoTexture/VideoDeckLink.h | 2 +- source/gameengine/VideoTexture/VideoFFmpeg.cpp | 128 +++--- source/gameengine/VideoTexture/VideoFFmpeg.h | 6 +- source/gameengine/VideoTexture/blendVideoTex.cpp | 10 +- 353 files changed, 3730 insertions(+), 3730 deletions(-) diff --git a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp index 6e698166fd9..22616458b54 100644 --- a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp +++ b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp @@ -108,7 +108,7 @@ static BlendFileData *load_game_data(const char *filename) { ReportList reports; BlendFileData *bfd; - + BKE_reports_init(&reports, RPT_STORE); bfd= BLO_read_from_file(filename, &reports, BLO_READ_SKIP_USERDEF); @@ -202,13 +202,13 @@ static int BL_KetsjiPyNextFrame(void *state0) { BL_KetsjiNextFrameState *state = (BL_KetsjiNextFrameState *) state0; return BL_KetsjiNextFrame( - state->ketsjiengine, - state->C, - state->win, - state->scene, + state->ketsjiengine, + state->C, + state->win, + state->scene, state->ar, - state->keyboarddevice, - state->mousedevice, + state->keyboarddevice, + state->mousedevice, state->draw_letterbox); } #endif @@ -246,7 +246,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c // Acquire Python's GIL (global interpreter lock) // so we can safely run Python code and API calls PyGILState_STATE gilstate = PyGILState_Ensure(); - + PyObject *pyGlobalDict = PyDict_New(); /* python utility storage, spans blend file loading */ #endif @@ -276,14 +276,14 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c bool restrictAnimFPS = (startscene->gm.flag & GAME_RESTRICT_ANIM_UPDATES) != 0; short drawtype = v3d->drawtype; - + /* we do not support material mode in game engine, force change to texture mode */ if (drawtype == OB_MATERIAL) drawtype = OB_TEXTURE; if (animation_record) usefixed= false; /* override since you don't want to run full-speed for sim recording */ // create the canvas and rasterizer RAS_ICanvas* canvas = new KX_BlenderCanvas(wm, win, area_rect, ar); - + // default mouse state set on render panel if (mouse_state) canvas->SetMouseState(RAS_ICanvas::MOUSE_NORMAL); @@ -316,11 +316,11 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c RAS_IRasterizer::MipmapOption mipmapval = rasterizer->GetMipmapping(); - + // create the inputdevices KX_BlenderKeyboardDevice* keyboarddevice = new KX_BlenderKeyboardDevice(); KX_BlenderMouseDevice* mousedevice = new KX_BlenderMouseDevice(); - + // create a networkdevice NG_NetworkDeviceInterface* networkdevice = new NG_LoopBackNetworkDeviceInterface(); @@ -328,10 +328,10 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c // // create a ketsji/blendersystem (only needed for timing and stuff) KX_BlenderSystem* kxsystem = new KX_BlenderSystem(); - + // create the ketsjiengine KX_KetsjiEngine* ketsjiengine = new KX_KetsjiEngine(kxsystem); - + // set the devices ketsjiengine->SetKeyboardDevice(keyboarddevice); ketsjiengine->SetMouseDevice(mousedevice); @@ -382,7 +382,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c { exitrequested = KX_EXIT_REQUEST_NO_REQUEST; if (bfd) BLO_blendfiledata_free(bfd); - + char basedpath[FILE_MAX]; // base the actuator filename with respect // to the original file working directory @@ -396,18 +396,18 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c // that happened to be loaded first BLI_path_abs(basedpath, pathname); bfd = load_game_data(basedpath); - + // if it wasn't loaded, try it forced relative if (!bfd) { // just add "//" in front of it char temppath[FILE_MAX] = "//"; BLI_strncpy(temppath + 2, basedpath, FILE_MAX - 2); - + BLI_path_abs(temppath, pathname); bfd = load_game_data(temppath); } - + // if we got a loaded blendfile, proceed if (bfd) { @@ -435,7 +435,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c { int startFrame = scene->r.cfra; ketsjiengine->SetAnimRecordMode(animation_record, startFrame); - + // Quad buffered needs a special window. if (scene->gm.stereoflag == STEREO_ENABLED) { if (scene->gm.stereomode != RAS_IRasterizer::RAS_STEREO_QUADBUFFERED) @@ -446,7 +446,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c rasterizer->SetBackColor(scene->gm.framing.col); } - + if (exitrequested != KX_EXIT_REQUEST_QUIT_GAME) { if (rv3d->persp != RV3D_CAMOB) @@ -458,7 +458,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c ketsjiengine->SetCameraOverrideClipping(v3d->near, v3d->far); ketsjiengine->SetCameraOverrideLens(v3d->lens); } - + // create a scene converter, create and convert the startingscene KX_ISceneConverter* sceneconverter = new KX_BlenderSceneConverter(blenderdata, ketsjiengine); ketsjiengine->SetSceneConverter(sceneconverter); @@ -471,7 +471,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c sceneconverter->SetGLSLMaterials(true); if (scene->gm.flag & GAME_NO_MATERIAL_CACHING) sceneconverter->SetCacheMaterials(false); - + KX_Scene* startscene = new KX_Scene(keyboarddevice, mousedevice, networkdevice, @@ -509,19 +509,19 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c rasterizer, canvas); ketsjiengine->AddScene(startscene); - + // init the rasterizer rasterizer->Init(); - + // start the engine ketsjiengine->StartEngine(true); - + // Set the animation playback rate for ipo's and actions // the framerate below should patch with FPS macro defined in blendef.h // Could be in StartEngine set the framerate, we need the scene to do this ketsjiengine->SetAnimFrameRate(FPS); - + #ifdef WITH_PYTHON char *python_main = NULL; pynextframestate.state = NULL; @@ -545,7 +545,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c ketsjinextframestate.keyboarddevice = keyboarddevice; ketsjinextframestate.mousedevice = mousedevice; ketsjinextframestate.draw_letterbox = draw_letterbox; - + pynextframestate.state = &ketsjinextframestate; pynextframestate.func = &BL_KetsjiPyNextFrame; printf("Yielding control to Python script '%s'...\n", python_main); @@ -577,9 +577,9 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c // inside the GameLogic dictionary when the python interpreter is finalized. // which allows the scene to safely delete them :) // see: (space.c)->start_game - + //PyDict_Clear(PyModule_GetDict(gameLogic)); - + // Keep original items, means python plugins will autocomplete members PyObject *gameLogic_keys_new = PyDict_Keys(PyModule_GetDict(gameLogic)); const Py_ssize_t numitems= PyList_GET_SIZE(gameLogic_keys_new); @@ -624,7 +624,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c // set mipmap setting back to its original value rasterizer->SetMipmapping(mipmapval); } - + // clean up some stuff if (ketsjiengine) { @@ -665,9 +665,9 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c // stop all remaining playing sounds AUD_Device_stopAll(BKE_sound_get_device()); - + } while (exitrequested == KX_EXIT_REQUEST_RESTART_GAME || exitrequested == KX_EXIT_REQUEST_START_OTHER_GAME); - + if (bfd) BLO_blendfiledata_free(bfd); BLI_strncpy(G.main->name, oldsce, sizeof(G.main->name)); diff --git a/source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp b/source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp index a6b2340d7b4..fdfa64cbd91 100644 --- a/source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp +++ b/source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp @@ -293,7 +293,7 @@ void KX_BlenderCanvas::SetMousePosition(int x,int y) int winX = m_frame_rect.GetLeft(); int winY = m_frame_rect.GetBottom(); int winH = m_frame_rect.GetHeight(); - + WM_cursor_warp(m_win, winX + x, winY + (winH-y)); } diff --git a/source/gameengine/BlenderRoutines/KX_BlenderCanvas.h b/source/gameengine/BlenderRoutines/KX_BlenderCanvas.h index 6f408f86551..8029360273b 100644 --- a/source/gameengine/BlenderRoutines/KX_BlenderCanvas.h +++ b/source/gameengine/BlenderRoutines/KX_BlenderCanvas.h @@ -48,7 +48,7 @@ struct wmWindow; struct wmWindowManager; /** - * 2D Blender device context abstraction. + * 2D Blender device context abstraction. * The connection from 3d rendercontext to 2d Blender surface embedding. */ @@ -63,17 +63,17 @@ private: public: /* Construct a new canvas. - * + * * \param area The Blender ARegion to run the game within. */ KX_BlenderCanvas(struct wmWindowManager *wm, struct wmWindow* win, RAS_Rect &rect, struct ARegion* ar); ~KX_BlenderCanvas(); - void + void Init( ); - - void + + void SwapBuffers( ); @@ -89,7 +89,7 @@ public: void GetDisplayDimensions(int &width, int &height); - void + void ResizeWindow( int width, int height @@ -107,11 +107,11 @@ public: BeginFrame( ); - void + void EndFrame( ); - void + void ClearColor( float r, float g, @@ -119,16 +119,16 @@ public: float a ); - void + void ClearBuffer( int type ); - int + int GetWidth( ) const; - int + int GetHeight( ) const; @@ -180,27 +180,27 @@ public: const int* GetViewPort(); - void + void SetMouseState( RAS_MouseState mousestate ); - void + void SetMousePosition( int x, int y ); - void + void MakeScreenShot( const char* filename ); - - bool + + bool BeginDraw( ); - void + void EndDraw( ); diff --git a/source/gameengine/BlenderRoutines/KX_BlenderKeyboardDevice.cpp b/source/gameengine/BlenderRoutines/KX_BlenderKeyboardDevice.cpp index ea78d2d389e..073f91bf8c4 100644 --- a/source/gameengine/BlenderRoutines/KX_BlenderKeyboardDevice.cpp +++ b/source/gameengine/BlenderRoutines/KX_BlenderKeyboardDevice.cpp @@ -33,7 +33,7 @@ #ifdef _MSC_VER /* annoying warnings about truncated STL debug info */ # pragma warning (disable:4786) -#endif +#endif #include "KX_BlenderKeyboardDevice.h" #include "KX_KetsjiEngine.h" @@ -55,7 +55,7 @@ KX_BlenderKeyboardDevice::~KX_BlenderKeyboardDevice() bool KX_BlenderKeyboardDevice::IsPressed(SCA_IInputDevice::KX_EnumInputs inputcode) { const SCA_InputEvent & inevent = m_eventStatusTables[m_currentTable][inputcode]; - bool pressed = (inevent.m_status == SCA_InputEvent::KX_JUSTACTIVATED || + bool pressed = (inevent.m_status == SCA_InputEvent::KX_JUSTACTIVATED || inevent.m_status == SCA_InputEvent::KX_ACTIVE); return pressed; } @@ -72,7 +72,7 @@ bool KX_BlenderKeyboardDevice::IsPressed(SCA_IInputDevice::KX_EnumInputs inputco void KX_BlenderKeyboardDevice::NextFrame() { SCA_IInputDevice::NextFrame(); - + // now convert justpressed keyevents into regular (active) keyevents int previousTable = 1-m_currentTable; for (int keyevent= KX_BEGINKEY; keyevent<= KX_ENDKEY;keyevent++) @@ -94,7 +94,7 @@ void KX_BlenderKeyboardDevice::NextFrame() bool KX_BlenderKeyboardDevice::ConvertBlenderEvent(unsigned short incode, short val, unsigned int unicode) { bool result = false; - + // convert event KX_EnumInputs kxevent = this->ToNative(incode); @@ -122,7 +122,7 @@ bool KX_BlenderKeyboardDevice::ConvertBlenderEvent(unsigned short incode, short break; } case SCA_InputEvent::KX_ACTIVE: - + { m_eventStatusTables[m_currentTable][kxevent].m_status = SCA_InputEvent::KX_ACTIVE; break; @@ -137,7 +137,7 @@ bool KX_BlenderKeyboardDevice::ConvertBlenderEvent(unsigned short incode, short m_eventStatusTables[m_currentTable][kxevent].m_status = SCA_InputEvent::KX_JUSTACTIVATED; } } - + } else if (val == KM_RELEASE) { // blender eventval == 0 diff --git a/source/gameengine/BlenderRoutines/KX_BlenderMouseDevice.cpp b/source/gameengine/BlenderRoutines/KX_BlenderMouseDevice.cpp index 9df06e83b92..fee184e1902 100644 --- a/source/gameengine/BlenderRoutines/KX_BlenderMouseDevice.cpp +++ b/source/gameengine/BlenderRoutines/KX_BlenderMouseDevice.cpp @@ -32,7 +32,7 @@ #ifdef _MSC_VER /* annoying warnings about truncated STL debug info */ # pragma warning (disable:4786) -#endif +#endif #include "KX_BlenderMouseDevice.h" @@ -52,7 +52,7 @@ KX_BlenderMouseDevice::~KX_BlenderMouseDevice() bool KX_BlenderMouseDevice::IsPressed(SCA_IInputDevice::KX_EnumInputs inputcode) { const SCA_InputEvent & inevent = m_eventStatusTables[m_currentTable][inputcode]; - bool pressed = (inevent.m_status == SCA_InputEvent::KX_JUSTACTIVATED || + bool pressed = (inevent.m_status == SCA_InputEvent::KX_JUSTACTIVATED || inevent.m_status == SCA_InputEvent::KX_ACTIVE); return pressed; } @@ -70,7 +70,7 @@ bool KX_BlenderMouseDevice::IsPressed(SCA_IInputDevice::KX_EnumInputs inputcode) void KX_BlenderMouseDevice::NextFrame() { SCA_IInputDevice::NextFrame(); - + // now convert justpressed keyevents into regular (active) keyevents int previousTable = 1-m_currentTable; for (int mouseevent= KX_BEGINMOUSE; mouseevent< KX_ENDMOUSEBUTTONS;mouseevent++) @@ -90,13 +90,13 @@ void KX_BlenderMouseDevice::NextFrame() if (oldevent.m_status == SCA_InputEvent::KX_JUSTACTIVATED || oldevent.m_status == SCA_InputEvent::KX_ACTIVE ) { - + m_eventStatusTables[m_currentTable][mousemove].m_status = SCA_InputEvent::KX_JUSTRELEASED; } else { if (oldevent.m_status == SCA_InputEvent::KX_JUSTRELEASED) { - + m_eventStatusTables[m_currentTable][mousemove].m_status = SCA_InputEvent::KX_NO_INPUTSTATUS; } } @@ -111,7 +111,7 @@ void KX_BlenderMouseDevice::NextFrame() bool KX_BlenderMouseDevice::ConvertBlenderEvent(unsigned short incode, short val, unsigned int unicode) { bool result = false; - + // convert event KX_EnumInputs kxevent = this->ToNative(incode); int previousTable = 1-m_currentTable; @@ -125,7 +125,7 @@ bool KX_BlenderMouseDevice::ConvertBlenderEvent(unsigned short incode, short val switch (m_eventStatusTables[previousTable][kxevent].m_status) { - + case SCA_InputEvent::KX_ACTIVE: case SCA_InputEvent::KX_JUSTACTIVATED: { @@ -142,7 +142,7 @@ bool KX_BlenderMouseDevice::ConvertBlenderEvent(unsigned short incode, short val m_eventStatusTables[m_currentTable][kxevent].m_status = SCA_InputEvent::KX_JUSTACTIVATED; } } - + } else if (val == KM_RELEASE) { // blender eventval == 0 @@ -168,7 +168,7 @@ bool KX_BlenderMouseDevice::ConvertBlenderEvent(unsigned short incode, short val switch (m_eventStatusTables[previousTable][kxevent].m_status) { - + case SCA_InputEvent::KX_ACTIVE: case SCA_InputEvent::KX_JUSTACTIVATED: { diff --git a/source/gameengine/Converter/BL_ActionActuator.cpp b/source/gameengine/Converter/BL_ActionActuator.cpp index d28cdb84275..558fd6cd2b5 100644 --- a/source/gameengine/Converter/BL_ActionActuator.cpp +++ b/source/gameengine/Converter/BL_ActionActuator.cpp @@ -74,9 +74,9 @@ BL_ActionActuator::BL_ActionActuator(SCA_IObject *gameobj, float layer_weight, short ipo_flags, short end_reset, - float stride) + float stride) : SCA_IActuator(gameobj, KX_ACT_ACTION), - + m_lastpos(0, 0, 0), m_blendframe(0), m_flag(0), @@ -112,7 +112,7 @@ void BL_ActionActuator::ProcessReplica() m_localtime=m_startframe; m_lastUpdate=-1; - + } void BL_ActionActuator::SetBlendTime(float newtime) @@ -128,7 +128,7 @@ void BL_ActionActuator::SetLocalTime(float curtime) dt = -dt; m_localtime = m_startframe + dt; - + // Handle wrap around if (m_localtime < min(m_startframe, m_endframe) || m_localtime > max(m_startframe, m_endframe)) { @@ -198,7 +198,7 @@ bool BL_ActionActuator::Update(double curtime, bool frame) // We handle ping pong ourselves to increase compabitility // with files made prior to animation changes from GSoC 2011. playtype = BL_Action::ACT_MODE_PLAY; - + if (m_flag & ACT_FLAG_REVERSE) { start = m_endframe; @@ -220,8 +220,8 @@ bool BL_ActionActuator::Update(double curtime, bool frame) if (m_flag & ACT_FLAG_CONTINUE) bUseContinue = true; - - + + // Handle events if (frame) { @@ -265,7 +265,7 @@ bool BL_ActionActuator::Update(double curtime, bool frame) return false; } } - + // If a different action is playing, we've been overruled and are no longer active if (obj->GetCurrentAction(m_layer) != m_action && !obj->IsActionDone(m_layer)) m_flag &= ~ACT_FLAG_ACTIVE; @@ -320,7 +320,7 @@ bool BL_ActionActuator::Update(double curtime, bool frame) m_flag |= ACT_FLAG_PLAY_END; break; - + case ACT_ACTION_FLIPPER: // Convert into a play action and play back to the beginning float temp = end; @@ -365,19 +365,19 @@ PyObject *BL_ActionActuator::PyGetChannel(PyObject *value) PyErr_SetString(PyExc_NotImplementedError, "actuator.getChannel(): Only armatures support channels"); return NULL; } - + if (!string) { PyErr_SetString(PyExc_TypeError, "expected a single string"); return NULL; } - + bPoseChannel *pchan; - + if (m_userpose==NULL && m_pose==NULL) { BL_ArmatureObject *obj = (BL_ArmatureObject*)GetParent(); obj->GetPose(&m_pose); /* Get the underlying pose from the armature */ } - + // BKE_pose_channel_find_name accounts for NULL pose, run on both in case one exists but // the channel doesnt if ( !(pchan=BKE_pose_channel_find_name(m_userpose, string)) && @@ -388,19 +388,19 @@ PyObject *BL_ActionActuator::PyGetChannel(PyObject *value) } PyObject *ret = PyTuple_New(3); - - PyObject *list = PyList_New(3); + + PyObject *list = PyList_New(3); PyList_SET_ITEM(list, 0, PyFloat_FromDouble(pchan->loc[0])); PyList_SET_ITEM(list, 1, PyFloat_FromDouble(pchan->loc[1])); PyList_SET_ITEM(list, 2, PyFloat_FromDouble(pchan->loc[2])); PyTuple_SET_ITEM(ret, 0, list); - + list = PyList_New(3); PyList_SET_ITEM(list, 0, PyFloat_FromDouble(pchan->size[0])); PyList_SET_ITEM(list, 1, PyFloat_FromDouble(pchan->size[1])); PyList_SET_ITEM(list, 2, PyFloat_FromDouble(pchan->size[2])); PyTuple_SET_ITEM(ret, 1, list); - + list = PyList_New(4); PyList_SET_ITEM(list, 0, PyFloat_FromDouble(pchan->quat[0])); PyList_SET_ITEM(list, 1, PyFloat_FromDouble(pchan->quat[1])); @@ -440,7 +440,7 @@ KX_PYMETHODDEF_DOC(BL_ActionActuator, setChannel, PyErr_SetString(PyExc_NotImplementedError, "actuator.setChannel(): Only armatures support channels"); return NULL; } - + if (PyTuple_Size(args)==2) { if (!PyArg_ParseTuple(args,"sO:setChannel", &string, &pymat)) // matrix return NULL; @@ -453,18 +453,18 @@ KX_PYMETHODDEF_DOC(BL_ActionActuator, setChannel, PyErr_SetString(PyExc_ValueError, "Expected a string and a 4x4 matrix (2 args) or a string and loc/size/quat sequences (4 args)"); return NULL; } - + if (pymat) { float matrix[4][4]; MT_Matrix4x4 mat; - + if (!PyMatTo(pymat, mat)) return NULL; - + mat.getValue((float*)matrix); - + BL_ArmatureObject *obj = (BL_ArmatureObject*)GetParent(); - + if (!m_userpose) { if (!m_pose) obj->GetPose(&m_pose); /* Get the underlying pose from the armature */ @@ -472,7 +472,7 @@ KX_PYMETHODDEF_DOC(BL_ActionActuator, setChannel, } // pchan= BKE_pose_channel_verify(m_userpose, string); // adds the channel if its not there. pchan= BKE_pose_channel_find_name(m_userpose, string); // adds the channel if its not there. - + if (pchan) { copy_v3_v3(pchan->loc, matrix[3]); mat4_to_size(pchan->size, matrix); @@ -483,10 +483,10 @@ KX_PYMETHODDEF_DOC(BL_ActionActuator, setChannel, MT_Vector3 loc; MT_Vector3 size; MT_Quaternion quat; - + if (!PyVecTo(pyloc, loc) || !PyVecTo(pysize, size) || !PyQuatTo(pyquat, quat)) return NULL; - + // same as above if (!m_userpose) { if (!m_pose) @@ -495,7 +495,7 @@ KX_PYMETHODDEF_DOC(BL_ActionActuator, setChannel, } // pchan= BKE_pose_channel_verify(m_userpose, string); pchan= BKE_pose_channel_find_name(m_userpose, string); // adds the channel if its not there. - + // for some reason loc.setValue(pchan->loc) fails if (pchan) { pchan->loc[0] = loc[0]; pchan->loc[1] = loc[1]; pchan->loc[2] = loc[2]; @@ -503,12 +503,12 @@ KX_PYMETHODDEF_DOC(BL_ActionActuator, setChannel, pchan->quat[0] = quat[3]; pchan->quat[1] = quat[0]; pchan->quat[2] = quat[1]; pchan->quat[3] = quat[2]; /* notice xyzw -> wxyz is intentional */ } } - + if (pchan==NULL) { PyErr_SetString(PyExc_ValueError, "Channel could not be found, use the 'channelNames' attribute to get a list of valid channels"); return NULL; } - + Py_RETURN_NONE; #endif } @@ -572,7 +572,7 @@ PyObject *BL_ActionActuator::pyattr_get_action(void *self_v, const KX_PYATTRIBUT int BL_ActionActuator::pyattr_set_action(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) { BL_ActionActuator* self = static_cast(self_v); - + if (!PyUnicode_Check(value)) { PyErr_SetString(PyExc_ValueError, "actuator.action = val: Action Actuator, expected the string name of the action"); @@ -581,7 +581,7 @@ int BL_ActionActuator::pyattr_set_action(void *self_v, const KX_PYATTRIBUTE_DEF bAction *action= NULL; STR_String val = _PyUnicode_AsString(value); - + if (val != "") { action= (bAction*)self->GetLogicManager()->GetActionByName(val); @@ -591,7 +591,7 @@ int BL_ActionActuator::pyattr_set_action(void *self_v, const KX_PYATTRIBUTE_DEF return PY_SET_ATTR_FAIL; } } - + self->SetAction(action); return PY_SET_ATTR_SUCCESS; @@ -606,7 +606,7 @@ PyObject *BL_ActionActuator::pyattr_get_channel_names(void *self_v, const KX_PYA BL_ActionActuator* self = static_cast(self_v); PyObject *ret= PyList_New(0); PyObject *item; - + if (self->GetParent()->GetGameObjectType() != SCA_IObject::OBJ_ARMATURE) { PyErr_SetString(PyExc_NotImplementedError, "actuator.channelNames: Only armatures support channels"); @@ -614,7 +614,7 @@ PyObject *BL_ActionActuator::pyattr_get_channel_names(void *self_v, const KX_PYA } bPose *pose= ((BL_ArmatureObject*)self->GetParent())->GetOrigPose(); - + if (pose) { bPoseChannel *pchan; for (pchan= (bPoseChannel *)pose->chanbase.first; pchan; pchan= (bPoseChannel *)pchan->next) { @@ -623,7 +623,7 @@ PyObject *BL_ActionActuator::pyattr_get_channel_names(void *self_v, const KX_PYA Py_DECREF(item); } } - + return ret; #endif } @@ -637,12 +637,12 @@ PyObject *BL_ActionActuator::pyattr_get_use_continue(void *self_v, const KX_PYAT int BL_ActionActuator::pyattr_set_use_continue(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) { BL_ActionActuator* self = static_cast(self_v); - + if (PyObject_IsTrue(value)) self->m_flag |= ACT_FLAG_CONTINUE; else self->m_flag &= ~ACT_FLAG_CONTINUE; - + return PY_SET_ATTR_SUCCESS; } @@ -655,9 +655,9 @@ PyObject *BL_ActionActuator::pyattr_get_frame(void *self_v, const KX_PYATTRIBUTE int BL_ActionActuator::pyattr_set_frame(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) { BL_ActionActuator* self = static_cast(self_v); - + ((KX_GameObject*)self->m_gameobj)->SetActionFrame(self->m_layer, PyFloat_AsDouble(value)); - + return PY_SET_ATTR_SUCCESS; } diff --git a/source/gameengine/Converter/BL_ActionActuator.h b/source/gameengine/Converter/BL_ActionActuator.h index a43cf0f0a7b..a1ba2e4a98f 100644 --- a/source/gameengine/Converter/BL_ActionActuator.h +++ b/source/gameengine/Converter/BL_ActionActuator.h @@ -37,7 +37,7 @@ #include "DNA_actuator_types.h" #include "MT_Point3.h" -class BL_ActionActuator : public SCA_IActuator +class BL_ActionActuator : public SCA_IActuator { public: Py_Header @@ -61,11 +61,11 @@ public: virtual bool Update(double curtime, bool frame); virtual CValue* GetReplica(); virtual void ProcessReplica(); - + void SetBlendTime(float newtime); void SetLocalTime(float curtime); void ResetStartTime(float curtime); - + bAction* GetAction() { return m_action; } void SetAction(bAction* act) { m_action= act; } @@ -112,7 +112,7 @@ public: } } #endif /* WITH_PYTHON */ - + protected: MT_Point3 m_lastpos; float m_blendframe; @@ -125,7 +125,7 @@ protected: float m_starttime; /** The current time of the action */ float m_localtime; - + float m_lastUpdate; float m_blendin; float m_blendstart; diff --git a/source/gameengine/Converter/BL_ArmatureActuator.cpp b/source/gameengine/Converter/BL_ArmatureActuator.cpp index 67cc7d2c291..21364075429 100644 --- a/source/gameengine/Converter/BL_ArmatureActuator.cpp +++ b/source/gameengine/Converter/BL_ArmatureActuator.cpp @@ -41,8 +41,8 @@ /** * This class is the conversion of the Pose channel constraint. * It makes a link between the pose constraint and the KX scene. - * The main purpose is to give access to the constraint target - * to link it to a game object. + * The main purpose is to give access to the constraint target + * to link it to a game object. * It also allows to activate/deactivate constraints during the game. * Later it will also be possible to create constraint on the fly */ @@ -242,18 +242,18 @@ int BL_ArmatureActuator::pyattr_set_object(void *self, const struct KX_PYATTRIBU BL_ArmatureActuator* actuator = static_cast(self); KX_GameObject* &target = (!strcmp(attrdef->m_name, "target")) ? actuator->m_gametarget : actuator->m_gamesubtarget; KX_GameObject *gameobj; - + if (!ConvertPythonToGameObject(actuator->GetLogicManager(), value, &gameobj, true, "actuator.object = value: BL_ArmatureActuator")) return PY_SET_ATTR_FAIL; // ConvertPythonToGameObject sets the error - + if (target != NULL) target->UnregisterActuator(actuator); target = gameobj; - + if (target) target->RegisterActuator(actuator); - + return PY_SET_ATTR_SUCCESS; } diff --git a/source/gameengine/Converter/BL_ArmatureActuator.h b/source/gameengine/Converter/BL_ArmatureActuator.h index ba02c5aa362..3c455498508 100644 --- a/source/gameengine/Converter/BL_ArmatureActuator.h +++ b/source/gameengine/Converter/BL_ArmatureActuator.h @@ -38,8 +38,8 @@ /** * This class is the conversion of the Pose channel constraint. * It makes a link between the pose constraint and the KX scene. - * The main purpose is to give access to the constraint target - * to link it to a game object. + * The main purpose is to give access to the constraint target + * to link it to a game object. * It also allows to activate/deactivate constraints during the game. * Later it will also be possible to create constraint on the fly */ @@ -69,7 +69,7 @@ public: virtual void Relink(CTR_Map *obj_map); virtual bool Update(double curtime, bool frame); virtual void ReParent(SCA_IObject* parent); - + #ifdef WITH_PYTHON /* These are used to get and set m_target */ diff --git a/source/gameengine/Converter/BL_ArmatureChannel.cpp b/source/gameengine/Converter/BL_ArmatureChannel.cpp index 2b8dfd8f8d1..711c96e32c1 100644 --- a/source/gameengine/Converter/BL_ArmatureChannel.cpp +++ b/source/gameengine/Converter/BL_ArmatureChannel.cpp @@ -80,7 +80,7 @@ PyObject *BL_ArmatureChannel::NewProxy(bool py_owns) #endif // WITH_PYTHON BL_ArmatureChannel::BL_ArmatureChannel( - BL_ArmatureObject *armature, + BL_ArmatureObject *armature, bPoseChannel *posechannel) : PyObjectPlus(), m_posechannel(posechannel), m_armature(armature) { @@ -106,7 +106,7 @@ PyAttributeDef BL_ArmatureChannel::Attributes[] = { // Keep these attributes in order of BCA_ defines!!! used by py_attr_getattr and py_attr_setattr KX_PYATTRIBUTE_RO_FUNCTION("bone",BL_ArmatureChannel,py_attr_getattr), KX_PYATTRIBUTE_RO_FUNCTION("parent",BL_ArmatureChannel,py_attr_getattr), - + { NULL } //Sentinel }; @@ -190,7 +190,7 @@ int BL_ArmatureChannel::py_attr_setattr(void *self_v, const struct KX_PYATTRIBUT PyErr_SetString(PyExc_AttributeError, "channel is NULL"); return PY_SET_ATTR_FAIL; } - + switch (attr_order) { default: break; @@ -396,13 +396,13 @@ PyTypeObject BL_ArmatureBone::Type = { }; // not used since this class is never instantiated -PyObject *BL_ArmatureBone::GetProxy() -{ - return NULL; +PyObject *BL_ArmatureBone::GetProxy() +{ + return NULL; } -PyObject *BL_ArmatureBone::NewProxy(bool py_owns) -{ - return NULL; +PyObject *BL_ArmatureBone::NewProxy(bool py_owns) +{ + return NULL; } PyObject *BL_ArmatureBone::py_bone_repr(PyObject *self) diff --git a/source/gameengine/Converter/BL_ArmatureChannel.h b/source/gameengine/Converter/BL_ArmatureChannel.h index a07097f8178..8e6bc94c488 100644 --- a/source/gameengine/Converter/BL_ArmatureChannel.h +++ b/source/gameengine/Converter/BL_ArmatureChannel.h @@ -56,7 +56,7 @@ private: BL_ArmatureObject* m_armature; public: - BL_ArmatureChannel(class BL_ArmatureObject *armature, + BL_ArmatureChannel(class BL_ArmatureObject *armature, struct bPoseChannel *posechannel); virtual ~BL_ArmatureChannel(); diff --git a/source/gameengine/Converter/BL_ArmatureConstraint.cpp b/source/gameengine/Converter/BL_ArmatureConstraint.cpp index d0c7e061fb7..224ae259fa2 100644 --- a/source/gameengine/Converter/BL_ArmatureConstraint.cpp +++ b/source/gameengine/Converter/BL_ArmatureConstraint.cpp @@ -70,9 +70,9 @@ PyObject *BL_ArmatureConstraint::py_repr(void) #endif // WITH_PYTHON BL_ArmatureConstraint::BL_ArmatureConstraint( - BL_ArmatureObject *armature, + BL_ArmatureObject *armature, bPoseChannel *posechannel, - bConstraint *constraint, + bConstraint *constraint, KX_GameObject* target, KX_GameObject* subtarget) : PyObjectPlus(), m_constraint(constraint), m_posechannel(posechannel), m_armature(armature) @@ -282,7 +282,7 @@ PyAttributeDef BL_ArmatureConstraint::Attributes[] = { KX_PYATTRIBUTE_RO_FUNCTION("ik_flag",BL_ArmatureConstraint,py_attr_getattr), KX_PYATTRIBUTE_RW_FUNCTION("ik_dist",BL_ArmatureConstraint,py_attr_getattr,py_attr_setattr), KX_PYATTRIBUTE_RW_FUNCTION("ik_mode",BL_ArmatureConstraint,py_attr_getattr,py_attr_setattr), - + { NULL } //Sentinel }; @@ -368,7 +368,7 @@ int BL_ArmatureConstraint::py_attr_setattr(void *self_v, const struct KX_PYATTRI PyErr_SetString(PyExc_AttributeError, "constraint is NULL"); return PY_SET_ATTR_FAIL; } - + switch (attr_order) { case BCA_ENFORCE: dval = PyFloat_AsDouble(value); diff --git a/source/gameengine/Converter/BL_ArmatureConstraint.h b/source/gameengine/Converter/BL_ArmatureConstraint.h index 1d9f7f0d548..a2c70f37902 100644 --- a/source/gameengine/Converter/BL_ArmatureConstraint.h +++ b/source/gameengine/Converter/BL_ArmatureConstraint.h @@ -46,7 +46,7 @@ struct Object; struct bPose; /** - * SG_DList : element of controlled constraint list + * SG_DList : element of controlled constraint list * head = BL_ArmatureObject::m_controlledConstraints * SG_QList : not used */ @@ -69,9 +69,9 @@ private: struct bPose* m_subpose; public: - BL_ArmatureConstraint(class BL_ArmatureObject *armature, - struct bPoseChannel *posechannel, - struct bConstraint *constraint, + BL_ArmatureConstraint(class BL_ArmatureObject *armature, + struct bPoseChannel *posechannel, + struct bConstraint *constraint, KX_GameObject* target, KX_GameObject* subtarget); virtual ~BL_ArmatureConstraint(); diff --git a/source/gameengine/Converter/BL_ArmatureObject.cpp b/source/gameengine/Converter/BL_ArmatureObject.cpp index a5af525e13a..d9ecfd1cbee 100644 --- a/source/gameengine/Converter/BL_ArmatureObject.cpp +++ b/source/gameengine/Converter/BL_ArmatureObject.cpp @@ -67,13 +67,13 @@ extern "C" { #include "MT_Matrix4x4.h" -/** +/** * Move here pose function for game engine so that we can mix with GE objects * Principle is as follow: * Use Blender structures so that BKE_pose_where_is can be used unchanged * Copy the constraint so that they can be enabled/disabled/added/removed at runtime * Don't copy the constraints for the pose used by the Action actuator, it does not need them. - * Scan the constraint structures so that the KX equivalent of target objects are identified and + * Scan the constraint structures so that the KX equivalent of target objects are identified and * stored in separate list. * When it is about to evaluate the pose, set the KX object position in the obmat of the corresponding * Blender objects and restore after the evaluation. @@ -83,7 +83,7 @@ static void game_copy_pose(bPose **dst, bPose *src, int copy_constraint) bPose *out; bPoseChannel *pchan, *outpchan; GHash *ghash; - + /* the game engine copies the current armature pose and then swaps * the object pose pointer. this makes it possible to change poses * without affecting the original blender data. */ @@ -97,7 +97,7 @@ static void game_copy_pose(bPose **dst, bPose *src, int copy_constraint) *dst=NULL; return; } - + out= (bPose*)MEM_dupallocN(src); out->chanhash = NULL; out->agroups.first= out->agroups.last= NULL; @@ -167,14 +167,14 @@ static void game_blend_poses(bPose *dst, bPose *src, float srcweight, short mode } else { dstweight = 1.0f; } - + schan= (bPoseChannel *)src->chanbase.first; for (dchan = (bPoseChannel *)dst->chanbase.first; dchan; dchan=(bPoseChannel *)dchan->next, schan= (bPoseChannel *)schan->next) { // always blend on all channels since we don't know which one has been set /* quat interpolation done separate */ if (schan->rotmode == ROT_MODE_QUAT) { float dquat[4], squat[4]; - + copy_qt_qt(dquat, dchan->quat); copy_qt_qt(squat, schan->quat); // Normalize quaternions so that interpolation/multiplication result is correct. @@ -187,7 +187,7 @@ static void game_blend_poses(bPose *dst, bPose *src, float srcweight, short mode mul_fac_qt_fl(squat, srcweight); mul_qt_qtqt(dchan->quat, dquat, squat); } - + normalize_qt(dchan->quat); } @@ -195,7 +195,7 @@ static void game_blend_poses(bPose *dst, bPose *src, float srcweight, short mode /* blending for loc and scale are pretty self-explanatory... */ dchan->loc[i] = (dchan->loc[i]*dstweight) + (schan->loc[i]*srcweight); dchan->size[i] = 1.0f + ((dchan->size[i]-1.0f)*dstweight) + ((schan->size[i]-1.0f)*srcweight); - + /* euler-rotation interpolation done here instead... */ // FIXME: are these results decent? if (schan->rotmode) @@ -209,14 +209,14 @@ static void game_blend_poses(bPose *dst, bPose *src, float srcweight, short mode dcon->enforce= dcon->enforce*(1.0f-srcweight) + scon->enforce*srcweight; } } - + /* this pose is now in src time */ dst->ctime= src->ctime; } BL_ArmatureObject::BL_ArmatureObject( - void* sgReplicationInfo, - SG_Callbacks callbacks, + void* sgReplicationInfo, + SG_Callbacks callbacks, Object *armature, Scene *scene, int vert_deform_type) @@ -375,7 +375,7 @@ void BL_ArmatureObject::LoadChannels() if (m_poseChannels.Empty()) { bPoseChannel* pchan; BL_ArmatureChannel* proxy; - + m_channelNumber = 0; for (pchan = (bPoseChannel *)m_pose->chanbase.first; pchan; pchan=(bPoseChannel *)pchan->next) { proxy = new BL_ArmatureChannel(this, pchan); @@ -389,7 +389,7 @@ BL_ArmatureChannel* BL_ArmatureObject::GetChannel(bPoseChannel* pchan) { LoadChannels(); SG_DList::iterator cit(m_poseChannels); - for (cit.begin(); !cit.end(); ++cit) + for (cit.begin(); !cit.end(); ++cit) { BL_ArmatureChannel* channel = *cit; if (channel->m_posechannel == pchan) @@ -402,7 +402,7 @@ BL_ArmatureChannel* BL_ArmatureObject::GetChannel(const char* str) { LoadChannels(); SG_DList::iterator cit(m_poseChannels); - for (cit.begin(); !cit.end(); ++cit) + for (cit.begin(); !cit.end(); ++cit) { BL_ArmatureChannel* channel = *cit; if (!strcmp(channel->m_posechannel->name, str)) @@ -535,11 +535,11 @@ void BL_ArmatureObject::GetPose(bPose **pose) { /* If the caller supplies a null pose, create a new one. */ /* Otherwise, copy the armature's pose channels into the caller-supplied pose */ - + if (!*pose) { /* probably not to good of an idea to - * duplicate everything, but it clears up - * a crash and memory leakage when + * duplicate everything, but it clears up + * a crash and memory leakage when * &BL_ActionActuator::m_pose is freed */ game_copy_pose(pose, m_pose, 0); @@ -674,7 +674,7 @@ PyObject *BL_ArmatureObject::pyattr_get_channels(void *self_v, const KX_PYATTRIB NULL))->NewProxy(true); } -KX_PYMETHODDEF_DOC_NOARGS(BL_ArmatureObject, update, +KX_PYMETHODDEF_DOC_NOARGS(BL_ArmatureObject, update, "update()\n" "Make sure that the armature will be updated on next graphic frame.\n" "This is automatically done if a KX_ArmatureActuator with mode run is active\n" diff --git a/source/gameengine/Converter/BL_ArmatureObject.h b/source/gameengine/Converter/BL_ArmatureObject.h index 691e73d6bde..65513aa579c 100644 --- a/source/gameengine/Converter/BL_ArmatureObject.h +++ b/source/gameengine/Converter/BL_ArmatureObject.h @@ -49,7 +49,7 @@ class MT_Matrix4x4; struct Object; class KX_BlenderSceneConverter; -class BL_ArmatureObject : public KX_GameObject +class BL_ArmatureObject : public KX_GameObject { Py_Header public: @@ -80,11 +80,11 @@ public: void RestorePose(); bool UpdateTimestep(double curtime); - + struct bArmature *GetArmature() { return (bArmature*)m_objArma->data; } const struct bArmature * GetArmature() const { return (bArmature*)m_objArma->data; } const struct Scene * GetScene() const { return m_scene; } - + Object* GetArmatureObject() {return m_objArma;} Object* GetOrigArmatureObject() {return m_origObjArma;} @@ -106,7 +106,7 @@ public: /// Retrieve the pose matrix for the specified bone. /// Returns true on success. bool GetBoneMatrix(Bone* bone, MT_Matrix4x4& matrix); - + /// Returns the bone length. The end of the bone is in the local y direction. float GetBoneLength(Bone* bone) const; @@ -130,7 +130,7 @@ protected: Object *m_origObjArma; struct bPose *m_pose; struct bPose *m_armpose; - struct Scene *m_scene; // need for BKE_pose_where_is + struct Scene *m_scene; // need for BKE_pose_where_is double m_lastframe; double m_timestep; // delta since last pose evaluation. int m_vert_deform_type; diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp b/source/gameengine/Converter/BL_BlenderDataConversion.cpp index a12437befaa..e31ad6b5cc4 100644 --- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp +++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp @@ -185,7 +185,7 @@ static bool default_light_mode = 0; static std::map create_translate_table() { std::map m; - + /* The reverse table. In order to not confuse ourselves, we */ /* immediately convert all events that come in to KX codes. */ m[LEFTMOUSE ] = SCA_IInputDevice::KX_LEFTMOUSE; @@ -195,136 +195,136 @@ static std::map create_translate_table() m[WHEELDOWNMOUSE ] = SCA_IInputDevice::KX_WHEELDOWNMOUSE; m[MOUSEX ] = SCA_IInputDevice::KX_MOUSEX; m[MOUSEY ] = SCA_IInputDevice::KX_MOUSEY; - - // TIMERS - - m[TIMER0 ] = SCA_IInputDevice::KX_TIMER0; - m[TIMER1 ] = SCA_IInputDevice::KX_TIMER1; - m[TIMER2 ] = SCA_IInputDevice::KX_TIMER2; - - // SYSTEM - + + // TIMERS + + m[TIMER0 ] = SCA_IInputDevice::KX_TIMER0; + m[TIMER1 ] = SCA_IInputDevice::KX_TIMER1; + m[TIMER2 ] = SCA_IInputDevice::KX_TIMER2; + + // SYSTEM + #if 0 /* **** XXX **** */ - m[KEYBD ] = SCA_IInputDevice::KX_KEYBD; - m[RAWKEYBD ] = SCA_IInputDevice::KX_RAWKEYBD; - m[REDRAW ] = SCA_IInputDevice::KX_REDRAW; - m[INPUTCHANGE ] = SCA_IInputDevice::KX_INPUTCHANGE; - m[QFULL ] = SCA_IInputDevice::KX_QFULL; - m[WINFREEZE ] = SCA_IInputDevice::KX_WINFREEZE; - m[WINTHAW ] = SCA_IInputDevice::KX_WINTHAW; - m[WINCLOSE ] = SCA_IInputDevice::KX_WINCLOSE; - m[WINQUIT ] = SCA_IInputDevice::KX_WINQUIT; - m[Q_FIRSTTIME ] = SCA_IInputDevice::KX_Q_FIRSTTIME; + m[KEYBD ] = SCA_IInputDevice::KX_KEYBD; + m[RAWKEYBD ] = SCA_IInputDevice::KX_RAWKEYBD; + m[REDRAW ] = SCA_IInputDevice::KX_REDRAW; + m[INPUTCHANGE ] = SCA_IInputDevice::KX_INPUTCHANGE; + m[QFULL ] = SCA_IInputDevice::KX_QFULL; + m[WINFREEZE ] = SCA_IInputDevice::KX_WINFREEZE; + m[WINTHAW ] = SCA_IInputDevice::KX_WINTHAW; + m[WINCLOSE ] = SCA_IInputDevice::KX_WINCLOSE; + m[WINQUIT ] = SCA_IInputDevice::KX_WINQUIT; + m[Q_FIRSTTIME ] = SCA_IInputDevice::KX_Q_FIRSTTIME; /* **** XXX **** */ #endif - - // standard keyboard - - m[AKEY ] = SCA_IInputDevice::KX_AKEY; - m[BKEY ] = SCA_IInputDevice::KX_BKEY; - m[CKEY ] = SCA_IInputDevice::KX_CKEY; - m[DKEY ] = SCA_IInputDevice::KX_DKEY; - m[EKEY ] = SCA_IInputDevice::KX_EKEY; - m[FKEY ] = SCA_IInputDevice::KX_FKEY; - m[GKEY ] = SCA_IInputDevice::KX_GKEY; - m[HKEY ] = SCA_IInputDevice::KX_HKEY; - m[IKEY ] = SCA_IInputDevice::KX_IKEY; - m[JKEY ] = SCA_IInputDevice::KX_JKEY; - m[KKEY ] = SCA_IInputDevice::KX_KKEY; - m[LKEY ] = SCA_IInputDevice::KX_LKEY; - m[MKEY ] = SCA_IInputDevice::KX_MKEY; - m[NKEY ] = SCA_IInputDevice::KX_NKEY; - m[OKEY ] = SCA_IInputDevice::KX_OKEY; - m[PKEY ] = SCA_IInputDevice::KX_PKEY; - m[QKEY ] = SCA_IInputDevice::KX_QKEY; - m[RKEY ] = SCA_IInputDevice::KX_RKEY; - m[SKEY ] = SCA_IInputDevice::KX_SKEY; - m[TKEY ] = SCA_IInputDevice::KX_TKEY; - m[UKEY ] = SCA_IInputDevice::KX_UKEY; - m[VKEY ] = SCA_IInputDevice::KX_VKEY; - m[WKEY ] = SCA_IInputDevice::KX_WKEY; - m[XKEY ] = SCA_IInputDevice::KX_XKEY; - m[YKEY ] = SCA_IInputDevice::KX_YKEY; - m[ZKEY ] = SCA_IInputDevice::KX_ZKEY; - - m[ZEROKEY ] = SCA_IInputDevice::KX_ZEROKEY; - m[ONEKEY ] = SCA_IInputDevice::KX_ONEKEY; - m[TWOKEY ] = SCA_IInputDevice::KX_TWOKEY; - m[THREEKEY ] = SCA_IInputDevice::KX_THREEKEY; - m[FOURKEY ] = SCA_IInputDevice::KX_FOURKEY; - m[FIVEKEY ] = SCA_IInputDevice::KX_FIVEKEY; - m[SIXKEY ] = SCA_IInputDevice::KX_SIXKEY; - m[SEVENKEY ] = SCA_IInputDevice::KX_SEVENKEY; - m[EIGHTKEY ] = SCA_IInputDevice::KX_EIGHTKEY; - m[NINEKEY ] = SCA_IInputDevice::KX_NINEKEY; - - m[CAPSLOCKKEY ] = SCA_IInputDevice::KX_CAPSLOCKKEY; - - m[LEFTCTRLKEY ] = SCA_IInputDevice::KX_LEFTCTRLKEY; - m[LEFTALTKEY ] = SCA_IInputDevice::KX_LEFTALTKEY; - m[RIGHTALTKEY ] = SCA_IInputDevice::KX_RIGHTALTKEY; - m[RIGHTCTRLKEY ] = SCA_IInputDevice::KX_RIGHTCTRLKEY; - m[RIGHTSHIFTKEY ] = SCA_IInputDevice::KX_RIGHTSHIFTKEY; - m[LEFTSHIFTKEY ] = SCA_IInputDevice::KX_LEFTSHIFTKEY; - - m[ESCKEY ] = SCA_IInputDevice::KX_ESCKEY; - m[TABKEY ] = SCA_IInputDevice::KX_TABKEY; - m[RETKEY ] = SCA_IInputDevice::KX_RETKEY; - m[SPACEKEY ] = SCA_IInputDevice::KX_SPACEKEY; - m[LINEFEEDKEY ] = SCA_IInputDevice::KX_LINEFEEDKEY; - m[BACKSPACEKEY ] = SCA_IInputDevice::KX_BACKSPACEKEY; - m[DELKEY ] = SCA_IInputDevice::KX_DELKEY; - m[SEMICOLONKEY ] = SCA_IInputDevice::KX_SEMICOLONKEY; - m[PERIODKEY ] = SCA_IInputDevice::KX_PERIODKEY; - m[COMMAKEY ] = SCA_IInputDevice::KX_COMMAKEY; - m[QUOTEKEY ] = SCA_IInputDevice::KX_QUOTEKEY; - m[ACCENTGRAVEKEY ] = SCA_IInputDevice::KX_ACCENTGRAVEKEY; - m[MINUSKEY ] = SCA_IInputDevice::KX_MINUSKEY; + + // standard keyboard + + m[AKEY ] = SCA_IInputDevice::KX_AKEY; + m[BKEY ] = SCA_IInputDevice::KX_BKEY; + m[CKEY ] = SCA_IInputDevice::KX_CKEY; + m[DKEY ] = SCA_IInputDevice::KX_DKEY; + m[EKEY ] = SCA_IInputDevice::KX_EKEY; + m[FKEY ] = SCA_IInputDevice::KX_FKEY; + m[GKEY ] = SCA_IInputDevice::KX_GKEY; + m[HKEY ] = SCA_IInputDevice::KX_HKEY; + m[IKEY ] = SCA_IInputDevice::KX_IKEY; + m[JKEY ] = SCA_IInputDevice::KX_JKEY; + m[KKEY ] = SCA_IInputDevice::KX_KKEY; + m[LKEY ] = SCA_IInputDevice::KX_LKEY; + m[MKEY ] = SCA_IInputDevice::KX_MKEY; + m[NKEY ] = SCA_IInputDevice::KX_NKEY; + m[OKEY ] = SCA_IInputDevice::KX_OKEY; + m[PKEY ] = SCA_IInputDevice::KX_PKEY; + m[QKEY ] = SCA_IInputDevice::KX_QKEY; + m[RKEY ] = SCA_IInputDevice::KX_RKEY; + m[SKEY ] = SCA_IInputDevice::KX_SKEY; + m[TKEY ] = SCA_IInputDevice::KX_TKEY; + m[UKEY ] = SCA_IInputDevice::KX_UKEY; + m[VKEY ] = SCA_IInputDevice::KX_VKEY; + m[WKEY ] = SCA_IInputDevice::KX_WKEY; + m[XKEY ] = SCA_IInputDevice::KX_XKEY; + m[YKEY ] = SCA_IInputDevice::KX_YKEY; + m[ZKEY ] = SCA_IInputDevice::KX_ZKEY; + + m[ZEROKEY ] = SCA_IInputDevice::KX_ZEROKEY; + m[ONEKEY ] = SCA_IInputDevice::KX_ONEKEY; + m[TWOKEY ] = SCA_IInputDevice::KX_TWOKEY; + m[THREEKEY ] = SCA_IInputDevice::KX_THREEKEY; + m[FOURKEY ] = SCA_IInputDevice::KX_FOURKEY; + m[FIVEKEY ] = SCA_IInputDevice::KX_FIVEKEY; + m[SIXKEY ] = SCA_IInputDevice::KX_SIXKEY; + m[SEVENKEY ] = SCA_IInputDevice::KX_SEVENKEY; + m[EIGHTKEY ] = SCA_IInputDevice::KX_EIGHTKEY; + m[NINEKEY ] = SCA_IInputDevice::KX_NINEKEY; + + m[CAPSLOCKKEY ] = SCA_IInputDevice::KX_CAPSLOCKKEY; + + m[LEFTCTRLKEY ] = SCA_IInputDevice::KX_LEFTCTRLKEY; + m[LEFTALTKEY ] = SCA_IInputDevice::KX_LEFTALTKEY; + m[RIGHTALTKEY ] = SCA_IInputDevice::KX_RIGHTALTKEY; + m[RIGHTCTRLKEY ] = SCA_IInputDevice::KX_RIGHTCTRLKEY; + m[RIGHTSHIFTKEY ] = SCA_IInputDevice::KX_RIGHTSHIFTKEY; + m[LEFTSHIFTKEY ] = SCA_IInputDevice::KX_LEFTSHIFTKEY; + + m[ESCKEY ] = SCA_IInputDevice::KX_ESCKEY; + m[TABKEY ] = SCA_IInputDevice::KX_TABKEY; + m[RETKEY ] = SCA_IInputDevice::KX_RETKEY; + m[SPACEKEY ] = SCA_IInputDevice::KX_SPACEKEY; + m[LINEFEEDKEY ] = SCA_IInputDevice::KX_LINEFEEDKEY; + m[BACKSPACEKEY ] = SCA_IInputDevice::KX_BACKSPACEKEY; + m[DELKEY ] = SCA_IInputDevice::KX_DELKEY; + m[SEMICOLONKEY ] = SCA_IInputDevice::KX_SEMICOLONKEY; + m[PERIODKEY ] = SCA_IInputDevice::KX_PERIODKEY; + m[COMMAKEY ] = SCA_IInputDevice::KX_COMMAKEY; + m[QUOTEKEY ] = SCA_IInputDevice::KX_QUOTEKEY; + m[ACCENTGRAVEKEY ] = SCA_IInputDevice::KX_ACCENTGRAVEKEY; + m[MINUSKEY ] = SCA_IInputDevice::KX_MINUSKEY; m[PLUSKEY ] = SCA_IInputDevice::KX_PLUSKEY; m[SLASHKEY ] = SCA_IInputDevice::KX_SLASHKEY; - m[BACKSLASHKEY ] = SCA_IInputDevice::KX_BACKSLASHKEY; - m[EQUALKEY ] = SCA_IInputDevice::KX_EQUALKEY; - m[LEFTBRACKETKEY ] = SCA_IInputDevice::KX_LEFTBRACKETKEY; - m[RIGHTBRACKETKEY ] = SCA_IInputDevice::KX_RIGHTBRACKETKEY; - - m[LEFTARROWKEY ] = SCA_IInputDevice::KX_LEFTARROWKEY; - m[DOWNARROWKEY ] = SCA_IInputDevice::KX_DOWNARROWKEY; - m[RIGHTARROWKEY ] = SCA_IInputDevice::KX_RIGHTARROWKEY; - m[UPARROWKEY ] = SCA_IInputDevice::KX_UPARROWKEY; - - m[PAD2 ] = SCA_IInputDevice::KX_PAD2; - m[PAD4 ] = SCA_IInputDevice::KX_PAD4; - m[PAD6 ] = SCA_IInputDevice::KX_PAD6; - m[PAD8 ] = SCA_IInputDevice::KX_PAD8; - - m[PAD1 ] = SCA_IInputDevice::KX_PAD1; - m[PAD3 ] = SCA_IInputDevice::KX_PAD3; - m[PAD5 ] = SCA_IInputDevice::KX_PAD5; - m[PAD7 ] = SCA_IInputDevice::KX_PAD7; - m[PAD9 ] = SCA_IInputDevice::KX_PAD9; - - m[PADPERIOD ] = SCA_IInputDevice::KX_PADPERIOD; - m[PADSLASHKEY ] = SCA_IInputDevice::KX_PADSLASHKEY; - m[PADASTERKEY ] = SCA_IInputDevice::KX_PADASTERKEY; - - m[PAD0 ] = SCA_IInputDevice::KX_PAD0; - m[PADMINUS ] = SCA_IInputDevice::KX_PADMINUS; - m[PADENTER ] = SCA_IInputDevice::KX_PADENTER; - m[PADPLUSKEY ] = SCA_IInputDevice::KX_PADPLUSKEY; - - - m[F1KEY ] = SCA_IInputDevice::KX_F1KEY; - m[F2KEY ] = SCA_IInputDevice::KX_F2KEY; - m[F3KEY ] = SCA_IInputDevice::KX_F3KEY; - m[F4KEY ] = SCA_IInputDevice::KX_F4KEY; - m[F5KEY ] = SCA_IInputDevice::KX_F5KEY; - m[F6KEY ] = SCA_IInputDevice::KX_F6KEY; - m[F7KEY ] = SCA_IInputDevice::KX_F7KEY; - m[F8KEY ] = SCA_IInputDevice::KX_F8KEY; - m[F9KEY ] = SCA_IInputDevice::KX_F9KEY; - m[F10KEY ] = SCA_IInputDevice::KX_F10KEY; - m[F11KEY ] = SCA_IInputDevice::KX_F11KEY; + m[BACKSLASHKEY ] = SCA_IInputDevice::KX_BACKSLASHKEY; + m[EQUALKEY ] = SCA_IInputDevice::KX_EQUALKEY; + m[LEFTBRACKETKEY ] = SCA_IInputDevice::KX_LEFTBRACKETKEY; + m[RIGHTBRACKETKEY ] = SCA_IInputDevice::KX_RIGHTBRACKETKEY; + + m[LEFTARROWKEY ] = SCA_IInputDevice::KX_LEFTARROWKEY; + m[DOWNARROWKEY ] = SCA_IInputDevice::KX_DOWNARROWKEY; + m[RIGHTARROWKEY ] = SCA_IInputDevice::KX_RIGHTARROWKEY; + m[UPARROWKEY ] = SCA_IInputDevice::KX_UPARROWKEY; + + m[PAD2 ] = SCA_IInputDevice::KX_PAD2; + m[PAD4 ] = SCA_IInputDevice::KX_PAD4; + m[PAD6 ] = SCA_IInputDevice::KX_PAD6; + m[PAD8 ] = SCA_IInputDevice::KX_PAD8; + + m[PAD1 ] = SCA_IInputDevice::KX_PAD1; + m[PAD3 ] = SCA_IInputDevice::KX_PAD3; + m[PAD5 ] = SCA_IInputDevice::KX_PAD5; + m[PAD7 ] = SCA_IInputDevice::KX_PAD7; + m[PAD9 ] = SCA_IInputDevice::KX_PAD9; + + m[PADPERIOD ] = SCA_IInputDevice::KX_PADPERIOD; + m[PADSLASHKEY ] = SCA_IInputDevice::KX_PADSLASHKEY; + m[PADASTERKEY ] = SCA_IInputDevice::KX_PADASTERKEY; + + m[PAD0 ] = SCA_IInputDevice::KX_PAD0; + m[PADMINUS ] = SCA_IInputDevice::KX_PADMINUS; + m[PADENTER ] = SCA_IInputDevice::KX_PADENTER; + m[PADPLUSKEY ] = SCA_IInputDevice::KX_PADPLUSKEY; + + + m[F1KEY ] = SCA_IInputDevice::KX_F1KEY; + m[F2KEY ] = SCA_IInputDevice::KX_F2KEY; + m[F3KEY ] = SCA_IInputDevice::KX_F3KEY; + m[F4KEY ] = SCA_IInputDevice::KX_F4KEY; + m[F5KEY ] = SCA_IInputDevice::KX_F5KEY; + m[F6KEY ] = SCA_IInputDevice::KX_F6KEY; + m[F7KEY ] = SCA_IInputDevice::KX_F7KEY; + m[F8KEY ] = SCA_IInputDevice::KX_F8KEY; + m[F9KEY ] = SCA_IInputDevice::KX_F9KEY; + m[F10KEY ] = SCA_IInputDevice::KX_F10KEY; + m[F11KEY ] = SCA_IInputDevice::KX_F11KEY; m[F12KEY ] = SCA_IInputDevice::KX_F12KEY; m[F13KEY ] = SCA_IInputDevice::KX_F13KEY; m[F14KEY ] = SCA_IInputDevice::KX_F14KEY; @@ -336,11 +336,11 @@ static std::map create_translate_table() m[OSKEY ] = SCA_IInputDevice::KX_OSKEY; - m[PAUSEKEY ] = SCA_IInputDevice::KX_PAUSEKEY; - m[INSERTKEY ] = SCA_IInputDevice::KX_INSERTKEY; - m[HOMEKEY ] = SCA_IInputDevice::KX_HOMEKEY; - m[PAGEUPKEY ] = SCA_IInputDevice::KX_PAGEUPKEY; - m[PAGEDOWNKEY ] = SCA_IInputDevice::KX_PAGEDOWNKEY; + m[PAUSEKEY ] = SCA_IInputDevice::KX_PAUSEKEY; + m[INSERTKEY ] = SCA_IInputDevice::KX_INSERTKEY; + m[HOMEKEY ] = SCA_IInputDevice::KX_HOMEKEY; + m[PAGEUPKEY ] = SCA_IInputDevice::KX_PAGEUPKEY; + m[PAGEDOWNKEY ] = SCA_IInputDevice::KX_PAGEDOWNKEY; m[ENDKEY ] = SCA_IInputDevice::KX_ENDKEY; return m; @@ -360,13 +360,13 @@ static unsigned int KX_rgbaint2uint_new(unsigned int icol) unsigned int integer; unsigned char cp[4]; } out_color, in_color; - + in_color.integer = icol; out_color.cp[0] = in_color.cp[3]; // red out_color.cp[1] = in_color.cp[2]; // green out_color.cp[2] = in_color.cp[1]; // blue out_color.cp[3] = in_color.cp[0]; // alpha - + return out_color.integer; } @@ -386,7 +386,7 @@ static unsigned int KX_Mcol2uint_new(MCol col) out_color.cp[1] = in_color.cp[2]; // green out_color.cp[2] = in_color.cp[1]; // blue out_color.cp[3] = in_color.cp[0]; // alpha - + return out_color.integer; } @@ -487,19 +487,19 @@ static void GetUVs(BL_Material *material, MTF_localLayer *layers, MFace *mface, int unit = 0; if (tface) { - + uvs[0][0].setValue(tface->uv[0]); uvs[1][0].setValue(tface->uv[1]); uvs[2][0].setValue(tface->uv[2]); - if (mface->v4) + if (mface->v4) uvs[3][0].setValue(tface->uv[3]); } else { uvs[0][0] = uvs[1][0] = uvs[2][0] = uvs[3][0] = MT_Point2(0.f, 0.f); } - + vector found_layers; for (int vind = 0; vinduv[0]); uvs[1][unit].setValue(tface->uv[1]); uvs[2][unit].setValue(tface->uv[2]); - if (mface->v4) + if (mface->v4) uvs[3][unit].setValue(tface->uv[3]); ++unit; @@ -537,7 +537,7 @@ static void GetUVs(BL_Material *material, MTF_localLayer *layers, MFace *mface, uvs[1][unit].setValue(layer.face->uv[1]); uvs[2][unit].setValue(layer.face->uv[2]); - if (mface->v4) + if (mface->v4) uvs[3][unit].setValue(layer.face->uv[3]); else uvs[3][unit].setValue(0.0f, 0.0f); @@ -565,7 +565,7 @@ static bool ConvertMaterial( const bool validmat = (mat != NULL); const bool validface = (tface != NULL); const bool use_vcol = GetMaterialUseVColor(mat, glslmat); - + material->IdMode = DEFAULT_BLENDER; material->glslmat = (validmat) ? glslmat: false; material->materialindex = mface->mat_nr; @@ -685,7 +685,7 @@ static bool ConvertMaterial( if (mat->septex & (1 << i)) { // If this texture slot isn't in use, set it to disabled to prevent multi-uv problems material->mapping[i].mapping = DISABLE; - } + } else { material->mapping[i].mapping |= (mttmp->texco & TEXCO_REFL) ? USEREFL : 0; @@ -728,7 +728,7 @@ static bool ConvertMaterial( material->mapping[i].projplane[2] = mttmp->projz; } /// -------------------------------- - + switch (mttmp->blendtype) { case MTEX_BLEND: material->blend_mode[i] = BLEND_MIX; @@ -913,10 +913,10 @@ static RAS_MaterialBucket *material_from_mesh(Material *ma, MFace *mface, MTFace if (ma && (ma->mode & MA_FACETEXTURE) == 0) converter->CachePolyMaterial(scene, ma, polymat); } - + // see if a bucket was reused or a new one was created // this way only one KX_BlenderMaterial object has to exist per bucket - bool bucketCreated; + bool bucketCreated; RAS_MaterialBucket* bucket = scene->FindBucket(polymat, bucketCreated); // this is needed to free up memory afterwards. @@ -1087,7 +1087,7 @@ RAS_MeshObject* BL_ConvertMesh(Mesh* mesh, Object* blenderobj, KX_Scene* scene, /* mark face as flat, so vertices are split */ bool flat = (mface->flag & ME_SMOOTH) == 0; - + int nverts = (mface->v4)? 4: 3; RAS_Polygon *poly = meshobj->AddPolygon(bucket, nverts); @@ -1105,7 +1105,7 @@ RAS_MeshObject* BL_ConvertMesh(Mesh* mesh, Object* blenderobj, KX_Scene* scene, meshobj->AddVertex(poly,3,pt[3],uvs[3],tan[3],rgb[3],no[3],flat,mface->v4); } - if (tface) + if (tface) tface++; if (mcol) mcol+=4; @@ -1134,27 +1134,27 @@ RAS_MeshObject* BL_ConvertMesh(Mesh* mesh, Object* blenderobj, KX_Scene* scene, if (layers) delete []layers; - + dm->release(dm); converter->RegisterGameMesh(meshobj, mesh); return meshobj; } - - + + static PHY_MaterialProps *CreateMaterialFromBlenderObject(struct Object* blenderobject) { PHY_MaterialProps *materialProps = new PHY_MaterialProps; - + MT_assert(materialProps && "Create physics material properties failed"); - + Material* blendermat = give_current_material(blenderobject, 1); - + if (blendermat) { MT_assert(0.0f <= blendermat->reflect && blendermat->reflect <= 1.0f); - + materialProps->m_restitution = blendermat->reflect; materialProps->m_friction = blendermat->friction; materialProps->m_fh_spring = blendermat->fh; @@ -1172,38 +1172,38 @@ static PHY_MaterialProps *CreateMaterialFromBlenderObject(struct Object* blender materialProps->m_fh_normal = false; } - + return materialProps; } static PHY_ShapeProps *CreateShapePropsFromBlenderObject(struct Object* blenderobject) { PHY_ShapeProps *shapeProps = new PHY_ShapeProps; - + MT_assert(shapeProps); - + shapeProps->m_mass = blenderobject->mass; - + // This needs to be fixed in blender. For now, we use: - + // in Blender, inertia stands for the size value which is equivalent to // the sphere radius shapeProps->m_inertia = blenderobject->formfactor; - + MT_assert(0.0f <= blenderobject->damping && blenderobject->damping <= 1.0f); MT_assert(0.0f <= blenderobject->rdamping && blenderobject->rdamping <= 1.0f); - + shapeProps->m_lin_drag = 1.0f - blenderobject->damping; shapeProps->m_ang_drag = 1.0f - blenderobject->rdamping; - - shapeProps->m_friction_scaling[0] = blenderobject->anisotropicFriction[0]; + + shapeProps->m_friction_scaling[0] = blenderobject->anisotropicFriction[0]; shapeProps->m_friction_scaling[1] = blenderobject->anisotropicFriction[1]; shapeProps->m_friction_scaling[2] = blenderobject->anisotropicFriction[2]; shapeProps->m_do_anisotropic = ((blenderobject->gameflag & OB_ANISOTROPIC_FRICTION) != 0); - - shapeProps->m_do_fh = (blenderobject->gameflag & OB_DO_FH) != 0; + + shapeProps->m_do_fh = (blenderobject->gameflag & OB_DO_FH) != 0; shapeProps->m_do_rot_fh = (blenderobject->gameflag & OB_ROT_FH) != 0; - + // velocity clamping XXX shapeProps->m_clamp_vel_min = blenderobject->min_vel; shapeProps->m_clamp_vel_max = blenderobject->max_vel; @@ -1219,12 +1219,12 @@ static PHY_ShapeProps *CreateShapePropsFromBlenderObject(struct Object* blendero return shapeProps; } - - - - + + + + ////////////////////////////////////////////////////////// - + static float my_boundbox_mesh(Mesh *me, float *loc, float *size) @@ -1235,36 +1235,36 @@ static float my_boundbox_mesh(Mesh *me, float *loc, float *size) float mloc[3], msize[3]; float radius_sq=0.0f, vert_radius_sq, *co; int a; - + if (me->bb==0) { me->bb = BKE_boundbox_alloc_unit(); } bb= me->bb; - + INIT_MINMAX(min, max); if (!loc) loc= mloc; if (!size) size= msize; - + mvert= me->mvert; for (a = 0; atotvert; a++, mvert++) { co = mvert->co; - + /* bounds */ minmax_v3v3_v3(min, max, co); - + /* radius */ vert_radius_sq = len_squared_v3(co); if (vert_radius_sq > radius_sq) radius_sq = vert_radius_sq; } - + if (me->totvert) { loc[0] = (min[0] + max[0]) / 2.0f; loc[1] = (min[1] + max[1]) / 2.0f; loc[2] = (min[2] + max[2]) / 2.0f; - + size[0] = (max[0] - min[0]) / 2.0f; size[1] = (max[1] - min[1]) / 2.0f; size[2] = (max[2] - min[2]) / 2.0f; @@ -1273,10 +1273,10 @@ static float my_boundbox_mesh(Mesh *me, float *loc, float *size) loc[0] = loc[1] = loc[2] = 0.0f; size[0] = size[1] = size[2] = 0.0f; } - + bb->vec[0][0] = bb->vec[1][0] = bb->vec[2][0] = bb->vec[3][0] = loc[0]-size[0]; bb->vec[4][0] = bb->vec[5][0] = bb->vec[6][0] = bb->vec[7][0] = loc[0]+size[0]; - + bb->vec[0][1] = bb->vec[1][1] = bb->vec[4][1] = bb->vec[5][1] = loc[1]-size[1]; bb->vec[2][1] = bb->vec[3][1] = bb->vec[6][1] = bb->vec[7][1] = loc[1]+size[1]; @@ -1377,8 +1377,8 @@ static void BL_CreatePhysicsObjectNew(KX_GameObject* gameobj, PHY_ShapeProps* shapeprops = CreateShapePropsFromBlenderObject(blenderobject); - - PHY_MaterialProps* smmaterial = + + PHY_MaterialProps* smmaterial = CreateMaterialFromBlenderObject(blenderobject); DerivedMesh* dm = NULL; @@ -1415,7 +1415,7 @@ static KX_LightObject *gamelight_from_blamp(Object *ob, Lamp *la, unsigned int l { RAS_ILightObject *lightobj = rasterizer->CreateLight(); KX_LightObject *gamelight; - + lightobj->m_att1 = la->att1; lightobj->m_att2 = (la->mode & LA_QUAD) ? la->att2 : 0.0f; lightobj->m_coeff_const = la->coeff_const; @@ -1438,10 +1438,10 @@ static KX_LightObject *gamelight_from_blamp(Object *ob, Lamp *la, unsigned int l lightobj->m_layer = layerflag; lightobj->m_spotblend = la->spotblend; lightobj->m_spotsize = la->spotsize; - + lightobj->m_nodiffuse = (la->mode & LA_NO_DIFF) != 0; lightobj->m_nospecular = (la->mode & LA_NO_SPEC) != 0; - + bool glslmat = converter->GetGLSLMaterials(); // in GLSL NEGATIVE LAMP is handled inside the lamp update function @@ -1453,7 +1453,7 @@ static KX_LightObject *gamelight_from_blamp(Object *ob, Lamp *la, unsigned int l lightobj->m_color[2] = -lightobj->m_color[2]; } } - + if (la->type==LA_SUN) { lightobj->m_type = RAS_ILightObject::LIGHT_SUN; } else if (la->type==LA_SPOT) { @@ -1464,7 +1464,7 @@ static KX_LightObject *gamelight_from_blamp(Object *ob, Lamp *la, unsigned int l gamelight = new KX_LightObject(kxscene, KX_Scene::m_callbacks, rasterizer, lightobj, glslmat); - + return gamelight; } @@ -1473,29 +1473,29 @@ static KX_Camera *gamecamera_from_bcamera(Object *ob, KX_Scene *kxscene, KX_Blen Camera* ca = static_cast(ob->data); RAS_CameraData camdata(ca->lens, ca->ortho_scale, ca->sensor_x, ca->sensor_y, ca->sensor_fit, ca->shiftx, ca->shifty, ca->clipsta, ca->clipend, ca->type == CAM_PERSP, ca->YF_dofdist); KX_Camera *gamecamera; - + gamecamera= new KX_Camera(kxscene, KX_Scene::m_callbacks, camdata); gamecamera->SetName(ca->id.name + 2); - + return gamecamera; } static KX_GameObject *gameobject_from_blenderobject( - Object *ob, - KX_Scene *kxscene, + Object *ob, + KX_Scene *kxscene, RAS_IRasterizer *rendertools, KX_BlenderSceneConverter *converter, - bool libloading) + bool libloading) { KX_GameObject *gameobj = NULL; Scene *blenderscene = kxscene->GetBlenderScene(); - + switch (ob->type) { case OB_LAMP: { KX_LightObject* gamelight = gamelight_from_blamp(ob, static_cast(ob->data), ob->lay, kxscene, rendertools, converter); gameobj = gamelight; - + if (blenderscene->lay & ob->lay) { gamelight->AddRef(); @@ -1504,26 +1504,26 @@ static KX_GameObject *gameobject_from_blenderobject( break; } - + case OB_CAMERA: { KX_Camera* gamecamera = gamecamera_from_bcamera(ob, kxscene, converter); gameobj = gamecamera; - + //don't add a reference: the camera list in kxscene->m_cameras is not released at the end //gamecamera->AddRef(); kxscene->AddCamera(gamecamera); - + break; } - + case OB_MESH: { Mesh* mesh = static_cast(ob->data); float center[3], extents[3]; float radius = my_boundbox_mesh((Mesh*) ob->data, center, extents); RAS_MeshObject* meshobj = BL_ConvertMesh(mesh,ob,kxscene,converter, libloading); - + // needed for python scripting kxscene->GetLogicManager()->RegisterMeshName(meshobj->GetName(),meshobj); @@ -1535,7 +1535,7 @@ static KX_GameObject *gameobject_from_blenderobject( } gameobj = new BL_DeformableGameObject(ob,kxscene,KX_Scene::m_callbacks); - + // set transformation gameobj->AddMesh(meshobj); @@ -1560,10 +1560,10 @@ static KX_GameObject *gameobject_from_blenderobject( kxscene->SetLodHysteresisValue(blenderscene->gm.scehysteresis); } } - + // for all objects: check whether they want to // respond to updates - bool ignoreActivityCulling = + bool ignoreActivityCulling = ((ob->gameflag2 & OB_NEVER_DO_ACTIVITY_CULLING)!=0); gameobj->SetIgnoreActivityCulling(ignoreActivityCulling); gameobj->SetOccluder((ob->gameflag & OB_OCCLUDER) != 0, false); @@ -1572,7 +1572,7 @@ static KX_GameObject *gameobject_from_blenderobject( // that requires it Material *mat= NULL; bool bUseObjectColor=false; - + for (int i=0;itotcol;i++) { mat=mesh->mat[i]; if (!mat) break; @@ -1583,7 +1583,7 @@ static KX_GameObject *gameobject_from_blenderobject( } if (bUseObjectColor) gameobj->SetObjectColor(ob->col); - + // two options exists for deform: shape keys and armature // only support relative shape key bool bHasShapeKey = mesh->key != NULL && mesh->key->type==KEY_RELATIVE; @@ -1598,8 +1598,8 @@ static KX_GameObject *gameobject_from_blenderobject( kxscene->GetBlenderScene(), ob, meshobj); ((BL_DeformableGameObject*)gameobj)->SetDeformer(dcont); } else if (bHasShapeKey) { - // not that we can have shape keys without dvert! - BL_ShapeDeformer *dcont = new BL_ShapeDeformer((BL_DeformableGameObject*)gameobj, + // not that we can have shape keys without dvert! + BL_ShapeDeformer *dcont = new BL_ShapeDeformer((BL_DeformableGameObject*)gameobj, ob, meshobj); ((BL_DeformableGameObject*)gameobj)->SetDeformer(dcont); } else if (bHasArmature) { @@ -1619,16 +1619,16 @@ static KX_GameObject *gameobject_from_blenderobject( ((BL_DeformableGameObject*)gameobj)->SetDeformer(dcont); #endif } - + MT_Point3 min = MT_Point3(center) - MT_Vector3(extents); MT_Point3 max = MT_Point3(center) + MT_Vector3(extents); SG_BBox bbox = SG_BBox(min, max); gameobj->GetSGNode()->SetBBox(bbox); gameobj->GetSGNode()->SetRadius(radius); - + break; } - + case OB_ARMATURE: { bArmature *arm = (bArmature*)ob->data; @@ -1642,7 +1642,7 @@ static KX_GameObject *gameobject_from_blenderobject( /* Get the current pose from the armature object and apply it as the rest pose */ break; } - + case OB_EMPTY: { gameobj = new KX_EmptyObject(kxscene,KX_Scene::m_callbacks); @@ -1672,7 +1672,7 @@ static KX_GameObject *gameobject_from_blenderobject( #endif } - if (gameobj) + if (gameobj) { gameobj->SetLayer(ob->lay); gameobj->SetBlenderObject(ob); @@ -1691,13 +1691,13 @@ static bPoseChannel *get_active_posechannel2(Object *ob) { bArmature *arm= (bArmature*)ob->data; bPoseChannel *pchan; - + /* find active */ for (pchan= (bPoseChannel *)ob->pose->chanbase.first; pchan; pchan= pchan->next) { if (pchan->bone && (pchan->bone == arm->act_bone) && (pchan->bone->layer & arm->layer)) return pchan; } - + return NULL; } @@ -1707,14 +1707,14 @@ static ListBase *get_active_constraints2(Object *ob) return NULL; // XXX - shouldnt we care about the pose data and not the mode??? - if (ob->mode & OB_MODE_POSE) { + if (ob->mode & OB_MODE_POSE) { bPoseChannel *pchan; pchan = get_active_posechannel2(ob); if (pchan) return &pchan->constraints; } - else + else return &ob->constraints; return NULL; @@ -1753,7 +1753,7 @@ static KX_GameObject* getGameOb(STR_String busc,CListValue* sumolist) if (gameobje->GetName()==busc) return gameobje; } - + return 0; } @@ -1945,11 +1945,11 @@ void BL_ConvertBlenderObjects(struct Main* maggie, } else { frame_type = RAS_FrameSettings::e_frame_scale; } - + aspect_width = (int)(blenderscene->r.xsch * blenderscene->r.xasp); aspect_height = (int)(blenderscene->r.ysch * blenderscene->r.yasp); } - + RAS_FrameSettings frame_settings( frame_type, blenderscene->gm.framing.col[0], @@ -1961,33 +1961,33 @@ void BL_ConvertBlenderObjects(struct Main* maggie, kxscene->SetFramingType(frame_settings); kxscene->SetGravity(MT_Vector3(0,0, -blenderscene->gm.gravity)); - + /* set activity culling parameters */ kxscene->SetActivityCulling( (blenderscene->gm.mode & WO_ACTIVITY_CULLING) != 0); kxscene->SetActivityCullingRadius(blenderscene->gm.activityBoxRadius); kxscene->SetDbvtCulling((blenderscene->gm.mode & WO_DBVT_CULLING) != 0); - + // no occlusion culling by default kxscene->SetDbvtOcclusionRes(0); int activeLayerBitInfo = blenderscene->lay; - + // list of all object converted, active and inactive CListValue* sumolist = new CListValue(); - + vector vec_parent_child; - + CListValue* objectlist = kxscene->GetObjectList(); CListValue* inactivelist = kxscene->GetInactiveList(); CListValue* parentlist = kxscene->GetRootParentList(); - + SCA_LogicManager* logicmgr = kxscene->GetLogicManager(); SCA_TimeEventManager* timemgr = kxscene->GetTimeEventManager(); - + CListValue* logicbrick_conversionlist = new CListValue(); - + //SG_TreeFactory tf; - + // Convert actions to actionmap bAction *curAct; for (curAct = (bAction*)maggie->action.first; curAct; curAct=(bAction*)curAct->id.next) @@ -2009,9 +2009,9 @@ void BL_ConvertBlenderObjects(struct Main* maggie, allblobj.insert(blenderobject); KX_GameObject* gameobj = gameobject_from_blenderobject( - base->object, - kxscene, - rendertools, + base->object, + kxscene, + rendertools, converter, libloading); @@ -2061,9 +2061,9 @@ void BL_ConvertBlenderObjects(struct Main* maggie, allblobj.insert(blenderobject); groupobj.insert(blenderobject); KX_GameObject* gameobj = gameobject_from_blenderobject( - blenderobject, - kxscene, - rendertools, + blenderobject, + kxscene, + rendertools, converter, libloading); @@ -2097,7 +2097,7 @@ void BL_ConvertBlenderObjects(struct Main* maggie, // non-camera objects not supported as camera currently if (blenderscene->camera && blenderscene->camera->type == OB_CAMERA) { KX_Camera *gamecamera= (KX_Camera*) converter->FindGameObject(blenderscene->camera); - + if (gamecamera) kxscene->SetActiveCamera(gamecamera); } @@ -2109,7 +2109,7 @@ void BL_ConvertBlenderObjects(struct Main* maggie, Object* blenderobj = *oit; if (blenderobj->type==OB_MESH) { Mesh *me = (Mesh*)blenderobj->data; - + if (me->dvert) { BL_DeformableGameObject *obj = (BL_DeformableGameObject*)converter->FindGameObject(blenderobj); @@ -2121,14 +2121,14 @@ void BL_ConvertBlenderObjects(struct Main* maggie, } } } - + // create hierarchy information int i; vector::iterator pcit; - + for (pcit = vec_parent_child.begin();!(pcit==vec_parent_child.end());++pcit) { - + struct Object* blenderchild = pcit->m_blenderchild; struct Object* blenderparent = blenderchild->parent; KX_GameObject* parentobj = converter->FindGameObject(blenderparent); @@ -2138,7 +2138,7 @@ void BL_ConvertBlenderObjects(struct Main* maggie, if (!parentobj || objectlist->SearchValue(childobj) != objectlist->SearchValue(parentobj)) { - // special case: the parent and child object are not in the same layer. + // special case: the parent and child object are not in the same layer. // This weird situation is used in Apricot for test purposes. // Resolve it by not converting the child childobj->GetSGNode()->DisconnectFromParent(); @@ -2158,11 +2158,11 @@ void BL_ConvertBlenderObjects(struct Main* maggie, obj->Release(); } childrenlist->Release(); - + // now destroy recursively converter->UnregisterGameObject(childobj); // removing objects during conversion make sure this runs too kxscene->RemoveObject(childobj); - + continue; } @@ -2192,7 +2192,7 @@ void BL_ConvertBlenderObjects(struct Main* maggie, KX_BoneParentRelation *bone_parent_relation = KX_BoneParentRelation::New(parent_bone); pcit->m_gamechildnode->SetParentRelation(bone_parent_relation); } - + break; } case PARSKEL: // skinned - ignore @@ -2203,11 +2203,11 @@ void BL_ConvertBlenderObjects(struct Main* maggie, // unhandled break; } - + parentobj-> GetSGNode()->AddChild(pcit->m_gamechildnode); } vec_parent_child.clear(); - + // find 'root' parents (object that has not parents in SceneGraph) for (i=0;iGetCount();++i) { @@ -2226,7 +2226,7 @@ void BL_ConvertBlenderObjects(struct Main* maggie, for (i=0; iGetCount();i++) { KX_GameObject* gameobj = (KX_GameObject*) sumolist->GetValue(i); - if (gameobj->GetMeshCount() > 0) + if (gameobj->GetMeshCount() > 0) { MT_Point3 box[2]; gameobj->GetSGNode()->BBox().getmm(box, MT_Transform::Identity()); @@ -2322,7 +2322,7 @@ void BL_ConvertBlenderObjects(struct Main* maggie, continue; bRigidBodyJointConstraint *dat = (bRigidBodyJointConstraint *)curcon->data; - + /* Skip if no target or a child object is selected or constraints are deactivated */ if (!dat->tar || dat->child || (curcon->flag & CONSTRAINT_OFF)) continue; @@ -2336,7 +2336,7 @@ void BL_ConvertBlenderObjects(struct Main* maggie, if (libloading) continue; - /* Skipped already converted constraints. + /* Skipped already converted constraints. * This will happen when a group instance is made from a linked group instance * and both are on the active layer. */ if (bl_isConstraintInList(gameobj, convertedlist)) @@ -2356,7 +2356,7 @@ void BL_ConvertBlenderObjects(struct Main* maggie, set::iterator gobit; for (gobit = convertedlist.begin(); gobit != convertedlist.end(); gobit++) (*gobit)->Release(); - + convertedlist.clear(); sumolist->Release(); @@ -2440,7 +2440,7 @@ void BL_ConvertBlenderObjects(struct Main* maggie, } logicbrick_conversionlist->Release(); - + // Calculate the scene btree - // too slow - commented out. //kxscene->SetNodeTree(tf.MakeTree()); diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.h b/source/gameengine/Converter/BL_BlenderDataConversion.h index 22210cc6035..c120de85d74 100644 --- a/source/gameengine/Converter/BL_BlenderDataConversion.h +++ b/source/gameengine/Converter/BL_BlenderDataConversion.h @@ -45,8 +45,8 @@ void BL_ConvertBlenderObjects(struct Main* maggie, class KX_KetsjiEngine* ketsjiEngine, e_PhysicsEngine physics_engine, class RAS_IRasterizer* rendertools, - class RAS_ICanvas* canvas, - class KX_BlenderSceneConverter* sceneconverter, + class RAS_ICanvas* canvas, + class KX_BlenderSceneConverter* sceneconverter, bool alwaysUseExpandFraming, bool libloading=false ); diff --git a/source/gameengine/Converter/BL_DeformableGameObject.cpp b/source/gameengine/Converter/BL_DeformableGameObject.cpp index 3a4a27a6722..bd29ac4d72e 100644 --- a/source/gameengine/Converter/BL_DeformableGameObject.cpp +++ b/source/gameengine/Converter/BL_DeformableGameObject.cpp @@ -73,7 +73,7 @@ bool BL_DeformableGameObject::SetActiveAction(BL_ShapeActionActuator *act, short m_activeAct = act; m_activePriority = priority; m_lastframe = curtime; - + return true; } else { @@ -91,7 +91,7 @@ bool BL_DeformableGameObject::GetShape(vector &shape) // this check is normally superfluous: a shape deformer can only be created if the mesh // has relative keys Key* key = shape_deformer->GetKey(); - if (key && key->type==KEY_RELATIVE) + if (key && key->type==KEY_RELATIVE) { KeyBlock *kb; for (kb = (KeyBlock *)key->block.first; kb; kb = (KeyBlock *)kb->next) diff --git a/source/gameengine/Converter/BL_DeformableGameObject.h b/source/gameengine/Converter/BL_DeformableGameObject.h index 95e3b7c517d..6a97e57e477 100644 --- a/source/gameengine/Converter/BL_DeformableGameObject.h +++ b/source/gameengine/Converter/BL_DeformableGameObject.h @@ -45,7 +45,7 @@ class BL_ShapeActionActuator; struct Key; -class BL_DeformableGameObject : public KX_GameObject +class BL_DeformableGameObject : public KX_GameObject { public: CValue* GetReplica(); @@ -80,7 +80,7 @@ public: bool SetActiveAction(class BL_ShapeActionActuator *act, short priority, double curtime); bool GetShape(vector &shape); - + virtual void SetDeformer(class RAS_Deformer* deformer); virtual class RAS_Deformer* GetDeformer() { @@ -88,9 +88,9 @@ public: } public: - + protected: - + RAS_Deformer *m_pDeformer; class BL_ShapeActionActuator *m_activeAct; diff --git a/source/gameengine/Converter/BL_MeshDeformer.cpp b/source/gameengine/Converter/BL_MeshDeformer.cpp index 911ff245ab4..3b5f12d7b29 100644 --- a/source/gameengine/Converter/BL_MeshDeformer.cpp +++ b/source/gameengine/Converter/BL_MeshDeformer.cpp @@ -89,7 +89,7 @@ BL_MeshDeformer::~BL_MeshDeformer() if (m_transnors) delete [] m_transnors; } - + void BL_MeshDeformer::ProcessReplica() { m_transverts = NULL; @@ -146,7 +146,7 @@ void BL_MeshDeformer::RecalcNormals() const float *co2 = m_transverts[v2.getOrigIndex()]; const float *co3 = m_transverts[v3.getOrigIndex()]; const float *co4 = NULL; - + /* compute face normal */ float fnor[3], n1[3], n2[3]; @@ -230,7 +230,7 @@ void BL_MeshDeformer::VerifyStorage() delete [] m_transverts; if (m_transnors) delete [] m_transnors; - + m_transverts=new float[m_bmesh->totvert][3]; m_transnors=new float[m_bmesh->totvert][3]; m_tvtot = m_bmesh->totvert; diff --git a/source/gameengine/Converter/BL_MeshDeformer.h b/source/gameengine/Converter/BL_MeshDeformer.h index 6e84cdf03f8..f2073994a4a 100644 --- a/source/gameengine/Converter/BL_MeshDeformer.h +++ b/source/gameengine/Converter/BL_MeshDeformer.h @@ -77,12 +77,12 @@ public: protected: class RAS_MeshObject* m_pMeshObject; struct Mesh* m_bmesh; - + // this is so m_transverts doesn't need to be converted // before deformation float (*m_transverts)[3]; float (*m_transnors)[3]; - struct Object* m_objMesh; + struct Object* m_objMesh; // -- int m_tvtot; BL_DeformableGameObject* m_gameobj; diff --git a/source/gameengine/Converter/BL_ModifierDeformer.cpp b/source/gameengine/Converter/BL_ModifierDeformer.cpp index b40fb7a9f47..44b24927843 100644 --- a/source/gameengine/Converter/BL_ModifierDeformer.cpp +++ b/source/gameengine/Converter/BL_ModifierDeformer.cpp @@ -136,7 +136,7 @@ struct DerivedMesh* BL_ModifierDeformer::GetPhysicsMesh() /* we need to compute the deformed mesh taking into account the current * shape and skin deformers, we cannot just call mesh_create_derived_physics() * because that would use the m_transvers already deformed previously by BL_ModifierDeformer::Update(), - * so restart from scratch by forcing a full update the shape/skin deformers + * so restart from scratch by forcing a full update the shape/skin deformers * (will do nothing if there is no such deformer) */ BL_ShapeDeformer::ForceUpdate(); BL_ShapeDeformer::Update(); diff --git a/source/gameengine/Converter/BL_ModifierDeformer.h b/source/gameengine/Converter/BL_ModifierDeformer.h index 4efe4ca5bfc..7de64745534 100644 --- a/source/gameengine/Converter/BL_ModifierDeformer.h +++ b/source/gameengine/Converter/BL_ModifierDeformer.h @@ -43,7 +43,7 @@ struct DerivedMesh; struct Object; -class BL_ModifierDeformer : public BL_ShapeDeformer +class BL_ModifierDeformer : public BL_ShapeDeformer { public: static bool HasCompatibleDeformer(Object *ob); diff --git a/source/gameengine/Converter/BL_ShapeActionActuator.cpp b/source/gameengine/Converter/BL_ShapeActionActuator.cpp index f21db419ebc..38eab7d5c30 100644 --- a/source/gameengine/Converter/BL_ShapeActionActuator.cpp +++ b/source/gameengine/Converter/BL_ShapeActionActuator.cpp @@ -66,9 +66,9 @@ BL_ShapeActionActuator::BL_ShapeActionActuator(SCA_IObject* gameobj, short playtype, short blendin, short priority, - float stride) + float stride) : SCA_IActuator(gameobj, KX_ACT_SHAPEACTION), - + m_lastpos(0, 0, 0), m_blendframe(0), m_flag(0), @@ -110,7 +110,7 @@ void BL_ShapeActionActuator::SetBlendTime(float newtime) m_blendframe = newtime; } -CValue* BL_ShapeActionActuator::GetReplica() +CValue* BL_ShapeActionActuator::GetReplica() { BL_ShapeActionActuator* replica = new BL_ShapeActionActuator(*this);//m_float,GetName()); replica->ProcessReplica(); @@ -124,7 +124,7 @@ bool BL_ShapeActionActuator::ClampLocalTime() { m_localtime = m_startframe; return true; - } + } else if (m_localtime > m_endframe) { m_localtime = m_endframe; @@ -148,7 +148,7 @@ bool BL_ShapeActionActuator::ClampLocalTime() void BL_ShapeActionActuator::SetStartTime(float curtime) { float direction = m_startframe < m_endframe ? 1.0 : -1.0; - + if (!(m_flag & ACT_FLAG_REVERSE)) m_starttime = curtime - direction*(m_localtime - m_startframe)/KX_KetsjiEngine::GetAnimFrameRate(); else @@ -158,7 +158,7 @@ void BL_ShapeActionActuator::SetStartTime(float curtime) void BL_ShapeActionActuator::SetLocalTime(float curtime) { float delta_time = (curtime - m_starttime)*KX_KetsjiEngine::GetAnimFrameRate(); - + if (m_endframe < m_startframe) delta_time = -delta_time; @@ -173,10 +173,10 @@ void BL_ShapeActionActuator::BlendShape(Key* key, float srcweight) vector::const_iterator it; float dstweight; KeyBlock *kb; - + dstweight = 1.0F - srcweight; - for (it=m_blendshape.begin(), kb = (KeyBlock *)key->block.first; + for (it=m_blendshape.begin(), kb = (KeyBlock *)key->block.first; kb && it != m_blendshape.end(); kb = (KeyBlock *)kb->next, it++) { @@ -195,7 +195,7 @@ bool BL_ShapeActionActuator::Update(double curtime, bool frame) float newweight; curtime -= KX_KetsjiEngine::GetSuspendedDelta(); - + // result = true if animation has to be continued, false if animation stops // maybe there are events for us in the queue ! if (frame) @@ -203,10 +203,10 @@ bool BL_ShapeActionActuator::Update(double curtime, bool frame) bNegativeEvent = m_negevent; bPositiveEvent = m_posevent; RemoveAllEvents(); - + if (bPositiveEvent) m_flag |= ACT_FLAG_ACTIVE; - + if (bNegativeEvent) { if (!(m_flag & ACT_FLAG_ACTIVE)) @@ -214,13 +214,13 @@ bool BL_ShapeActionActuator::Update(double curtime, bool frame) m_flag &= ~ACT_FLAG_ACTIVE; } } - + /* This action can only be attached to a deform object */ BL_DeformableGameObject *obj = (BL_DeformableGameObject*)GetParent(); float length = m_endframe - m_startframe; - + priority = m_priority; - + /* Determine pre-incrementation behavior and set appropriate flags */ switch (m_playtype) { case ACT_ACTION_MOTION: @@ -302,15 +302,15 @@ bool BL_ShapeActionActuator::Update(double curtime, bool frame) default: break; } - + /* Perform increment */ if (keepgoing) { if (m_playtype == ACT_ACTION_MOTION) { MT_Point3 newpos; MT_Point3 deltapos; - + newpos = obj->NodeGetWorldPosition(); - + /* Find displacement */ deltapos = newpos-m_lastpos; m_localtime += (length/m_stridelength) * deltapos.length(); @@ -320,7 +320,7 @@ bool BL_ShapeActionActuator::Update(double curtime, bool frame) SetLocalTime(curtime); } } - + /* Check if a wrapping response is needed */ if (length) { if (m_localtime < m_startframe || m_localtime > m_endframe) @@ -331,7 +331,7 @@ bool BL_ShapeActionActuator::Update(double curtime, bool frame) } else m_localtime = m_startframe; - + /* Perform post-increment tasks */ switch (m_playtype) { case ACT_ACTION_FROM_PROP: @@ -339,7 +339,7 @@ bool BL_ShapeActionActuator::Update(double curtime, bool frame) CValue* propval = GetParent()->GetProperty(m_propname); if (propval) m_localtime = propval->GetNumber(); - + if (bNegativeEvent) { keepgoing=false; } @@ -353,7 +353,7 @@ bool BL_ShapeActionActuator::Update(double curtime, bool frame) if (wrap) { if (!(m_flag & ACT_FLAG_REVERSE)) m_localtime = m_endframe; - else + else m_localtime = m_startframe; m_flag &= ~ACT_FLAG_LOCKINPUT; @@ -394,7 +394,7 @@ bool BL_ShapeActionActuator::Update(double curtime, bool frame) keepgoing = false; break; } - + /* Set the property if its defined */ if (m_framepropname[0] != '\0') { CValue* propowner = GetParent(); @@ -407,10 +407,10 @@ bool BL_ShapeActionActuator::Update(double curtime, bool frame) } newval->Release(); } - + if (bNegativeEvent) m_blendframe=0.0f; - + /* Apply the pose if necessary*/ if (apply) { @@ -429,7 +429,7 @@ bool BL_ShapeActionActuator::Update(double curtime, bool frame) } else { ListBase tchanbase= {NULL, NULL}; - + if (m_blendin && m_blendframe==0.0f) { // this is the start of the blending, remember the startup shape obj->GetShape(m_blendshape); @@ -448,7 +448,7 @@ bool BL_ShapeActionActuator::Update(double curtime, bool frame) if (0) { // XXX !execute_ipochannels(&tchanbase)) { // no update, this is possible if action does not match the keys, stop the action keepgoing = false; - } + } else { // the key have changed, apply blending if needed if (m_blendin && (m_blendframeGetLogicManager()->GetActionByName(val); @@ -554,7 +554,7 @@ int BL_ShapeActionActuator::pyattr_set_action(void *self_v, const KX_PYATTRIBUTE return PY_SET_ATTR_FAIL; } } - + self->SetAction(action); return PY_SET_ATTR_SUCCESS; diff --git a/source/gameengine/Converter/BL_ShapeActionActuator.h b/source/gameengine/Converter/BL_ShapeActionActuator.h index e96d0e0ebb4..899bbbc616d 100644 --- a/source/gameengine/Converter/BL_ShapeActionActuator.h +++ b/source/gameengine/Converter/BL_ShapeActionActuator.h @@ -39,7 +39,7 @@ #include struct Key; -class BL_ShapeActionActuator : public SCA_IActuator +class BL_ShapeActionActuator : public SCA_IActuator { public: Py_Header @@ -57,10 +57,10 @@ public: virtual bool Update(double curtime, bool frame); virtual CValue* GetReplica(); virtual void ProcessReplica(); - + void SetBlendTime (float newtime); void BlendShape(struct Key* key, float weight); - + bAction* GetAction() { return m_action; } void SetAction(bAction* act) { m_action= act; } @@ -127,7 +127,7 @@ protected: float m_starttime; /** The current time of the action */ float m_localtime; - + float m_lastUpdate; float m_blendin; float m_blendstart; diff --git a/source/gameengine/Converter/BL_ShapeDeformer.cpp b/source/gameengine/Converter/BL_ShapeDeformer.cpp index 94256a64d75..7653bb3f99b 100644 --- a/source/gameengine/Converter/BL_ShapeDeformer.cpp +++ b/source/gameengine/Converter/BL_ShapeDeformer.cpp @@ -181,7 +181,7 @@ bool BL_ShapeDeformer::Update(void) if (m_lastShapeUpdate != m_gameobj->GetLastFrame()) { /* the key coefficient have been set already, we just need to blend the keys */ Object* blendobj = m_gameobj->GetBlendObject(); - + /* we will blend the key directly in m_transverts array: it is used by armature as the start position */ /* m_key can be NULL in case of Modifier deformer */ if (m_key) { @@ -199,9 +199,9 @@ bool BL_ShapeDeformer::Update(void) m_bDynamic = true; } - // Don't release the weight array as in Blender, it will most likely be reusable on next frame + // Don't release the weight array as in Blender, it will most likely be reusable on next frame // The weight array are ultimately deleted when the skin mesh is destroyed - + /* Update the current frame */ m_lastShapeUpdate=m_gameobj->GetLastFrame(); @@ -215,7 +215,7 @@ bool BL_ShapeDeformer::Update(void) // non dynamic deformer = Modifer without armature and shape keys, no need to create storage if (!bSkinUpdate && bShapeUpdate && m_bDynamic) { - // this means that there is no armature, we still need to + // this means that there is no armature, we still need to // update the normal (was not done after shape key calculation) #ifdef __NLA_DEFNORMALS diff --git a/source/gameengine/Converter/BL_ShapeDeformer.h b/source/gameengine/Converter/BL_ShapeDeformer.h index f6746dd2302..80a6f908db5 100644 --- a/source/gameengine/Converter/BL_ShapeDeformer.h +++ b/source/gameengine/Converter/BL_ShapeDeformer.h @@ -40,7 +40,7 @@ #include "BL_DeformableGameObject.h" #include -class BL_ShapeDeformer : public BL_SkinDeformer +class BL_ShapeDeformer : public BL_SkinDeformer { public: BL_ShapeDeformer(BL_DeformableGameObject *gameobj, diff --git a/source/gameengine/Converter/BL_SkinDeformer.cpp b/source/gameengine/Converter/BL_SkinDeformer.cpp index 68da99f9fa5..16700859ebe 100644 --- a/source/gameengine/Converter/BL_SkinDeformer.cpp +++ b/source/gameengine/Converter/BL_SkinDeformer.cpp @@ -58,7 +58,7 @@ extern "C"{ #include "BKE_lattice.h" #include "BKE_deform.h" } - + #include "BLI_blenlib.h" #include "BLI_math.h" @@ -188,8 +188,8 @@ void BL_SkinDeformer::BlenderDeformVerts() copy_m4_m4(m_objMesh->obmat, m_obmat); armature_deform_verts( par_arma, m_objMesh, NULL, m_transverts, NULL, m_bmesh->totvert, m_deformflags, NULL, NULL ); - - // restore matrix + + // restore matrix copy_m4_m4(m_objMesh->obmat, obmat); #ifdef __NLA_DEFNORMALS @@ -276,7 +276,7 @@ void BL_SkinDeformer::BGEDeformVerts() } } } - + // Update Vertex Normal norm = norm_chan_mat.topLeftCorner<3, 3>()*norm; diff --git a/source/gameengine/Converter/BL_SkinDeformer.h b/source/gameengine/Converter/BL_SkinDeformer.h index 79043f60db8..1feed3c3d16 100644 --- a/source/gameengine/Converter/BL_SkinDeformer.h +++ b/source/gameengine/Converter/BL_SkinDeformer.h @@ -48,7 +48,7 @@ #include "RAS_Deformer.h" -class BL_SkinDeformer : public BL_MeshDeformer +class BL_SkinDeformer : public BL_MeshDeformer { public: // void SetArmatureController (BL_ArmatureController *cont); @@ -76,13 +76,13 @@ public: bool Update (void); bool UpdateInternal (bool shape_applied); bool Apply (class RAS_IPolyMaterial *polymat); - bool UpdateBuckets(void) + bool UpdateBuckets(void) { // update the deformer and all the mesh slots; Apply() does it well, so just call it. return Apply(NULL); } bool PoseUpdated(void) - { + { if (m_armobj && m_lastArmaUpdate!=m_armobj->GetLastFrame()) { return true; } diff --git a/source/gameengine/Converter/KX_BlenderScalarInterpolator.cpp b/source/gameengine/Converter/KX_BlenderScalarInterpolator.cpp index 4d344cdf16a..434f5753396 100644 --- a/source/gameengine/Converter/KX_BlenderScalarInterpolator.cpp +++ b/source/gameengine/Converter/KX_BlenderScalarInterpolator.cpp @@ -50,10 +50,10 @@ BL_InterpolatorList::BL_InterpolatorList(bAction *action) { if (action==NULL) return; - + for (FCurve *fcu = (FCurve *)action->curves.first; fcu; fcu = fcu->next) { if (fcu->rna_path) { - BL_ScalarInterpolator *new_ipo = new BL_ScalarInterpolator(fcu); + BL_ScalarInterpolator *new_ipo = new BL_ScalarInterpolator(fcu); //assert(new_ipo); push_back(new_ipo); } diff --git a/source/gameengine/Converter/KX_BlenderScalarInterpolator.h b/source/gameengine/Converter/KX_BlenderScalarInterpolator.h index d828910233f..a82688cea20 100644 --- a/source/gameengine/Converter/KX_BlenderScalarInterpolator.h +++ b/source/gameengine/Converter/KX_BlenderScalarInterpolator.h @@ -46,7 +46,7 @@ public: {} virtual ~BL_ScalarInterpolator() {} - + virtual float GetValue(float currentTime) const; struct FCurve *GetFCurve() { return m_fcu; } diff --git a/source/gameengine/Converter/KX_BlenderSceneConverter.cpp b/source/gameengine/Converter/KX_BlenderSceneConverter.cpp index 34e363b8fc2..5d9f32a0969 100644 --- a/source/gameengine/Converter/KX_BlenderSceneConverter.cpp +++ b/source/gameengine/Converter/KX_BlenderSceneConverter.cpp @@ -307,7 +307,7 @@ void KX_BlenderSceneConverter::RemoveScene(KX_Scene *scene) *worldit = m_worldinfos.back(); m_worldinfos.pop_back(); size--; - } + } else { i++; worldit++; @@ -323,7 +323,7 @@ void KX_BlenderSceneConverter::RemoveScene(KX_Scene *scene) *polymit = m_polymaterials.back(); m_polymaterials.pop_back(); size--; - } + } else { i++; polymit++; @@ -341,7 +341,7 @@ void KX_BlenderSceneConverter::RemoveScene(KX_Scene *scene) *matit = m_materials.back(); m_materials.pop_back(); size--; - } + } else { i++; matit++; @@ -358,7 +358,7 @@ void KX_BlenderSceneConverter::RemoveScene(KX_Scene *scene) *meshit = m_meshobjects.back(); m_meshobjects.pop_back(); size--; - } + } else { i++; meshit++; @@ -415,7 +415,7 @@ void KX_BlenderSceneConverter::SetAlwaysUseExpandFraming(bool to_what) m_alwaysUseExpandFraming= to_what; } -void KX_BlenderSceneConverter::RegisterGameObject(KX_GameObject *gameobject, Object *for_blenderobject) +void KX_BlenderSceneConverter::RegisterGameObject(KX_GameObject *gameobject, Object *for_blenderobject) { /* only maintained while converting, freed during game runtime */ m_map_blender_to_gameobject.insert(CHashedPtr(for_blenderobject), gameobject); @@ -423,7 +423,7 @@ void KX_BlenderSceneConverter::RegisterGameObject(KX_GameObject *gameobject, Obj /* only need to run this during conversion since * m_map_blender_to_gameobject is freed after conversion */ -void KX_BlenderSceneConverter::UnregisterGameObject(KX_GameObject *gameobject) +void KX_BlenderSceneConverter::UnregisterGameObject(KX_GameObject *gameobject) { Object *bobp = gameobject->GetBlenderObject(); if (bobp) { @@ -437,7 +437,7 @@ void KX_BlenderSceneConverter::UnregisterGameObject(KX_GameObject *gameobject) } } -KX_GameObject *KX_BlenderSceneConverter::FindGameObject(Object *for_blenderobject) +KX_GameObject *KX_BlenderSceneConverter::FindGameObject(Object *for_blenderobject) { KX_GameObject **obp = m_map_blender_to_gameobject[CHashedPtr(for_blenderobject)]; @@ -458,7 +458,7 @@ RAS_MeshObject *KX_BlenderSceneConverter::FindGameMesh(Mesh *for_blendermesh) if (meshp) { return *meshp; - } + } else { return NULL; } @@ -580,7 +580,7 @@ void KX_BlenderSceneConverter::ResetPhysicsObjectsAnimationIpo(bool clearIpo) localDel_ipoCurve( tmpicu ); } } - } + } else { ipo = NULL; // XXX add_ipo(blenderObject->id.name+2, ID_OB); blenderObject->ipo = ipo; @@ -637,11 +637,11 @@ void KX_BlenderSceneConverter::WritePhysicsObjectToAnimationIpo(int frameNumber) const MT_Point3& position = gameObj->NodeGetWorldPosition(); //const MT_Vector3& scale = gameObj->NodeGetWorldScaling(); const MT_Matrix3x3& orn = gameObj->NodeGetWorldOrientation(); - + float eulerAngles[3]; float eulerAnglesOld[3] = {0.0f, 0.0f, 0.0f}; float tmat[3][3]; - + // XXX animato Ipo* ipo = blenderObject->ipo; @@ -677,23 +677,23 @@ void KX_BlenderSceneConverter::WritePhysicsObjectToAnimationIpo(int frameNumber) icu_rz = verify_ipocurve(&blenderObject->id, ipo->blocktype, NULL, NULL, NULL, OB_ROT_Z, 1); if (icu_rz) icu_rz->ipo = IPO_LIN; } - + if (icu_rx) eulerAnglesOld[0] = eval_icu( icu_rx, frameNumber - 1 ) / ((180 / 3.14159265f) / 10); if (icu_ry) eulerAnglesOld[1] = eval_icu( icu_ry, frameNumber - 1 ) / ((180 / 3.14159265f) / 10); if (icu_rz) eulerAnglesOld[2] = eval_icu( icu_rz, frameNumber - 1 ) / ((180 / 3.14159265f) / 10); - + // orn.getValue((float *)tmat); // uses the wrong ordering, cant use this for (int r = 0; r < 3; r++) for (int c = 0; c < 3; c++) tmat[r][c] = orn[c][r]; - + // mat3_to_eul( eulerAngles,tmat); // better to use Mat3ToCompatibleEul mat3_to_compatible_eul( eulerAngles, eulerAnglesOld,tmat); - + //eval_icu for (int x = 0; x < 3; x++) eulerAngles[x] *= (float) ((180 / 3.14159265f) / 10.0); - + //fill the curves with data if (icu_lx) insert_vert_icu(icu_lx, frameNumber, position.x(), 1); if (icu_ly) insert_vert_icu(icu_ly, frameNumber, position.y(), 1); @@ -701,7 +701,7 @@ void KX_BlenderSceneConverter::WritePhysicsObjectToAnimationIpo(int frameNumber) if (icu_rx) insert_vert_icu(icu_rx, frameNumber, eulerAngles[0], 1); if (icu_ry) insert_vert_icu(icu_ry, frameNumber, eulerAngles[1], 1); if (icu_rz) insert_vert_icu(icu_rz, frameNumber, eulerAngles[2], 1); - + // Handles are corrected at the end, testhandles_ipocurve isn't needed yet #endif } @@ -775,7 +775,7 @@ Main *KX_BlenderSceneConverter::GetMainDynamicPath(const char *path) for (vector
::iterator it = m_DynamicMaggie.begin(); !(it == m_DynamicMaggie.end()); it++) if (BLI_path_cmp((*it)->name, path) == 0) return *it; - + return NULL; } @@ -868,7 +868,7 @@ static void load_datablocks(Main *main_tmp, BlendHandle *bpy_openlib, const char int totnames_dummy; names = BLO_blendhandle_get_datablock_names(bpy_openlib, idcode, &totnames_dummy); - + int i = 0; LinkNode *n = names; while (n) { @@ -897,7 +897,7 @@ KX_LibLoadStatus *KX_BlenderSceneConverter::LinkBlendFile(BlendHandle *bpy_openl BLO_blendhandle_close(bpy_openlib); return NULL; } - + if (GetMainDynamicPath(path)) { snprintf(err_local, sizeof(err_local), "blend file already open \"%s\"\n", path); *err_str = err_local; @@ -935,18 +935,18 @@ KX_LibLoadStatus *KX_BlenderSceneConverter::LinkBlendFile(BlendHandle *bpy_openl BKE_reports_clear(&reports); /* done linking */ - + /* needed for lookups*/ GetMainDynamic().push_back(main_newlib); BLI_strncpy(main_newlib->name, path, sizeof(main_newlib->name)); - - + + status = new KX_LibLoadStatus(this, m_ketsjiEngine, scene_merge, path); if (idcode == ID_ME) { /* Convert all new meshes into BGE meshes */ ID *mesh; - + for (mesh = (ID *)main_newlib->mesh.first; mesh; mesh = (ID *)mesh->next ) { if (options & LIB_LOAD_VERBOSE) printf("MeshName: %s\n", mesh->name + 2); @@ -973,15 +973,15 @@ KX_LibLoadStatus *KX_BlenderSceneConverter::LinkBlendFile(BlendHandle *bpy_openl for (scene = (ID *)main_newlib->scene.first; scene; scene = (ID *)scene->next ) { if (options & LIB_LOAD_VERBOSE) printf("SceneName: %s\n", scene->name + 2); - + if (options & LIB_LOAD_ASYNC) { scenes->push_back((Scene *)scene); - } + } else { /* merge into the base scene */ KX_Scene* other = m_ketsjiEngine->CreateScene((Scene *)scene, true); scene_merge->MergeScene(other); - + // RemoveScene(other); // Don't run this, it frees the entire scene converter data, just delete the scene delete other; } @@ -1077,7 +1077,7 @@ bool KX_BlenderSceneConverter::FreeBlendFile(Main *maggie) /* in case the mesh might be refered to later */ { CTR_Map &mapStringToMeshes = scene->GetLogicManager()->GetMeshMap(); - + for (int i = 0; i < mapStringToMeshes.size(); i++) { RAS_MeshObject *meshobj = (RAS_MeshObject *) *mapStringToMeshes.at(i); if (meshobj && IS_TAGGED(meshobj->GetMesh())) { @@ -1104,7 +1104,7 @@ bool KX_BlenderSceneConverter::FreeBlendFile(Main *maggie) } } } - + //scene->FreeTagged(); /* removed tagged objects and meshes*/ CListValue *obj_lists[] = {scene->GetObjectList(), scene->GetInactiveList(), NULL}; @@ -1201,7 +1201,7 @@ bool KX_BlenderSceneConverter::FreeBlendFile(Main *maggie) *worldit = m_worldinfos.back(); m_worldinfos.pop_back(); size--; - } + } else { i++; worldit++; @@ -1260,7 +1260,7 @@ bool KX_BlenderSceneConverter::FreeBlendFile(Main *maggie) *matit = m_materials.back(); m_materials.pop_back(); size--; - } + } else { i++; matit++; @@ -1308,7 +1308,7 @@ bool KX_BlenderSceneConverter::FreeBlendFile(Main *maggie) *meshit = m_meshobjects.back(); m_meshobjects.pop_back(); size--; - } + } else { i++; meshit++; diff --git a/source/gameengine/Converter/KX_BlenderSceneConverter.h b/source/gameengine/Converter/KX_BlenderSceneConverter.h index 40c71a4d74b..3379f00c38a 100644 --- a/source/gameengine/Converter/KX_BlenderSceneConverter.h +++ b/source/gameengine/Converter/KX_BlenderSceneConverter.h @@ -76,16 +76,16 @@ class KX_BlenderSceneConverter : public KX_ISceneConverter // Saved KX_LibLoadStatus objects map m_status_map; - // Should also have a list of collision shapes. + // Should also have a list of collision shapes. // For the time being this is held in KX_Scene::m_shapes CTR_Map m_map_blender_to_gameobject; /* cleared after conversion */ CTR_Map m_map_mesh_to_gamemesh; /* cleared after conversion */ CTR_Map m_map_blender_to_gameactuator; /* cleared after conversion */ CTR_Mapm_map_blender_to_gamecontroller; /* cleared after conversion */ - + CTR_Map m_map_blender_to_gameAdtList; - + Main* m_maggie; vector m_DynamicMaggie; @@ -121,7 +121,7 @@ public: bool TryAndLoadNewFile(); void SetAlwaysUseExpandFraming(bool to_what); - + void RegisterGameObject(KX_GameObject *gameobject, struct Object *for_blenderobject); void UnregisterGameObject(KX_GameObject *gameobject); KX_GameObject *FindGameObject(struct Object *for_blenderobject); @@ -136,7 +136,7 @@ public: void RegisterBlenderMaterial(BL_Material *mat); void CacheBlenderMaterial(KX_Scene *scene, Material *mat, BL_Material *blmat); BL_Material *FindCachedBlenderMaterial(KX_Scene *scene, Material *mat); - + void RegisterInterpolatorList(BL_InterpolatorList *actList, struct bAction *for_act); BL_InterpolatorList *FindInterpolatorList(struct bAction *for_act); @@ -152,7 +152,7 @@ public: ///this is for reseting the position,rotation and scale of the gameobjet that is not dynamic virtual void resetNoneDynamicObjectToIpo(); - + ///this generates ipo curves for position, rotation, allowing to use game physics in animation virtual void WritePhysicsObjectToAnimationIpo(int frameNumber); virtual void TestHandlesPhysicsObjectToAnimationIpo(); @@ -174,7 +174,7 @@ public: // struct Main* GetMain() { return m_maggie; } struct Main* GetMainDynamicPath(const char *path); vector &GetMainDynamic(); - + class KX_LibLoadStatus *LinkBlendFileMemory(void *data, int length, const char *path, char *group, KX_Scene *scene_merge, char **err_str, short options); class KX_LibLoadStatus *LinkBlendFilePath(const char *path, char *group, KX_Scene *scene_merge, char **err_str, short options); class KX_LibLoadStatus *LinkBlendFile(struct BlendHandle *bpy_openlib, const char *path, char *group, KX_Scene *scene_merge, char **err_str, short options); @@ -186,7 +186,7 @@ public: virtual void MergeAsyncLoads(); virtual void FinalizeAsyncLoads(); void AddScenesToMergeQueue(class KX_LibLoadStatus *status); - + void PrintStats() { printf("BGE STATS!\n"); @@ -208,9 +208,9 @@ public: #endif // /printf("\t m_ketsjiEngine->m_scenes: %d\n", m_ketsjiEngine->CurrentScenes()->size()); } - + /* LibLoad Options */ - enum + enum { LIB_LOAD_LOAD_ACTIONS = 1, LIB_LOAD_VERBOSE = 2, @@ -223,7 +223,7 @@ public: #ifdef WITH_PYTHON PyObject *GetPyNamespace(); #endif - + #ifdef WITH_CXX_GUARDEDALLOC MEM_CXX_CLASS_ALLOC_FUNCS("GE:KX_BlenderSceneConverter") #endif diff --git a/source/gameengine/Converter/KX_ConvertActuators.cpp b/source/gameengine/Converter/KX_ConvertActuators.cpp index 974dcbca95b..d4582425b36 100644 --- a/source/gameengine/Converter/KX_ConvertActuators.cpp +++ b/source/gameengine/Converter/KX_ConvertActuators.cpp @@ -102,7 +102,7 @@ #include "BL_BlenderDataConversion.h" -/** +/** * KX_flt_trunc needed to round 'almost' zero values to zero, else velocities etc. are incorrectly set */ @@ -122,7 +122,7 @@ void BL_ConvertActuators(const char* maggiename, KX_BlenderSceneConverter* converter ) { - + int uniqueint = 0; int actcount = 0; int executePriority = 0; @@ -138,7 +138,7 @@ void BL_ConvertActuators(const char* maggiename, { STR_String uniquename = bact->name; STR_String& objectname = gameobj->GetName(); - + SCA_IActuator* baseact = NULL; switch (bact->type) { @@ -168,9 +168,9 @@ void BL_ConvertActuators(const char* maggiename, /* Blender uses a bit vector internally for the local-flags. In */ /* KX, we have four bools. The compiler should be smart enough */ /* to do the right thing. We need to explicitly convert here! */ - + KX_LocalFlags bitLocalFlag; - + bitLocalFlag.Force = bool((obact->flag & ACT_FORCE_LOCAL)!=0); bitLocalFlag.Torque = bool((obact->flag & ACT_TORQUE_LOCAL) !=0);//rlocal; bitLocalFlag.DLoc = bool((obact->flag & ACT_DLOC_LOCAL)!=0); @@ -186,7 +186,7 @@ void BL_ConvertActuators(const char* maggiename, { obref = converter->FindGameObject(obact->reference); } - + KX_ObjectActuator* tmpbaseact = new KX_ObjectActuator( gameobj, obref, @@ -214,7 +214,7 @@ void BL_ConvertActuators(const char* maggiename, if (actact->flag & ACT_IPOLOCAL) ipo_flags |= BL_Action::ACT_IPOFLAG_LOCAL; if (actact->flag & ACT_IPOADD) ipo_flags |= BL_Action::ACT_IPOFLAG_ADD; if (actact->flag & ACT_IPOCHILD) ipo_flags |= BL_Action::ACT_IPOFLAG_CHILD; - + BL_ActionActuator* tmpbaseact = new BL_ActionActuator( gameobj, propname, @@ -242,7 +242,7 @@ void BL_ConvertActuators(const char* maggiename, bActionActuator* actact = (bActionActuator*) bact->data; STR_String propname = actact->name; STR_String propframe = actact->frameProp; - + BL_ShapeActionActuator* tmpbaseact = new BL_ShapeActionActuator( gameobj, propname, @@ -270,8 +270,8 @@ void BL_ConvertActuators(const char* maggiename, bCameraActuator *camact = (bCameraActuator *) bact->data; if (camact->ob) { KX_GameObject *tmpgob = converter->FindGameObject(camact->ob); - - /* visifac, fac and axis are not copied from the struct... */ + + /* visifac, fac and axis are not copied from the struct... */ /* that's some internal state... */ KX_CameraActuator *tmpcamact = new KX_CameraActuator( gameobj, @@ -288,16 +288,16 @@ void BL_ConvertActuators(const char* maggiename, case ACT_MESSAGE: { bMessageActuator *msgAct = (bMessageActuator *) bact->data; - + /* Get the name of the properties that objects must own that * we're sending to, if present */ STR_String toPropName = msgAct->toPropName; - + /* Get the Message Subject to send. */ STR_String subject = msgAct->subject; - + /* Get the bodyType */ int bodyType = msgAct->bodyType; @@ -306,7 +306,7 @@ void BL_ConvertActuators(const char* maggiename, * we'll be sending, might be empty */ const STR_String body = msgAct->body; - + KX_NetworkMessageActuator *tmpmsgact = new KX_NetworkMessageActuator( gameobj, // actuator controlling object scene->GetNetworkScene(), // needed for replication @@ -327,7 +327,7 @@ void BL_ConvertActuators(const char* maggiename, /* get type, and possibly a start and end frame */ KX_SoundActuator::KX_SOUNDACT_TYPE soundActuatorType = KX_SoundActuator::KX_SOUNDACT_NODEF; - + switch (soundact->type) { case ACT_SND_PLAY_STOP_SOUND: soundActuatorType = KX_SoundActuator::KX_SOUNDACT_PLAYSTOP; @@ -347,13 +347,13 @@ void BL_ConvertActuators(const char* maggiename, case ACT_SND_LOOP_BIDIRECTIONAL_STOP_SOUND: soundActuatorType = KX_SoundActuator::KX_SOUNDACT_LOOPBIDIRECTIONAL_STOP; break; - + default: /* This is an error!!! */ soundActuatorType = KX_SoundActuator::KX_SOUNDACT_NODEF; } - - if (soundActuatorType != KX_SoundActuator::KX_SOUNDACT_NODEF) + + if (soundActuatorType != KX_SoundActuator::KX_SOUNDACT_NODEF) { bSound* sound = soundact->sound; bool is3d = soundact->flag & ACT_SND_3D_SOUND ? true : false; @@ -407,7 +407,7 @@ void BL_ConvertActuators(const char* maggiename, { bPropertyActuator* propact = (bPropertyActuator*) bact->data; SCA_IObject* destinationObj = NULL; - + /* * here the destinationobject is searched. problem with multiple scenes: other scenes * have not been converted yet, so the destobj will not be found, so the prop will @@ -418,7 +418,7 @@ void BL_ConvertActuators(const char* maggiename, */ if (propact->ob) destinationObj = converter->FindGameObject(propact->ob); - + SCA_PropertyActuator* tmppropact = new SCA_PropertyActuator( gameobj, destinationObj, @@ -431,16 +431,16 @@ void BL_ConvertActuators(const char* maggiename, } case ACT_EDIT_OBJECT: { - bEditObjectActuator *editobact + bEditObjectActuator *editobact = (bEditObjectActuator *) bact->data; /* There are four different kinds of 'edit object' thingies */ /* The alternative to this lengthy conversion is packing */ /* several actuators in one, which is not very nice design.. */ switch (editobact->type) { - case ACT_EDOB_ADD_OBJECT: + case ACT_EDOB_ADD_OBJECT: { - - // does the 'original' for replication exists, and + + // does the 'original' for replication exists, and // is it in a non-active layer ? SCA_IObject* originalval = NULL; if (editobact->ob) @@ -453,7 +453,7 @@ void BL_ConvertActuators(const char* maggiename, originalval = converter->FindGameObject(editobact->ob); } } - + KX_SCA_AddObjectActuator* tmpaddact = new KX_SCA_AddObjectActuator( gameobj, originalval, @@ -470,7 +470,7 @@ void BL_ConvertActuators(const char* maggiename, break; case ACT_EDOB_END_OBJECT: { - KX_SCA_EndObjectActuator* tmpendact + KX_SCA_EndObjectActuator* tmpendact = new KX_SCA_EndObjectActuator(gameobj,scene); baseact = tmpendact; } @@ -501,7 +501,7 @@ void BL_ConvertActuators(const char* maggiename, SCA_IObject* originalval = NULL; if (editobact->ob) originalval = converter->FindGameObject(editobact->ob); - + KX_TrackToActuator* tmptrackact = new KX_TrackToActuator( gameobj, originalval, @@ -528,10 +528,10 @@ void BL_ConvertActuators(const char* maggiename, float min = 0.0, max = 0.0; char *prop = NULL; KX_ConstraintActuator::KX_CONSTRAINTTYPE locrot = KX_ConstraintActuator::KX_ACT_CONSTRAINT_NODEF; - bConstraintActuator *conact + bConstraintActuator *conact = (bConstraintActuator*) bact->data; - /* convert settings... degrees in the ui become radians */ - /* internally */ + /* convert settings... degrees in the ui become radians */ + /* internally */ if (conact->type == ACT_CONST_TYPE_ORI) { min = conact->minloc[0]; max = conact->maxloc[0]; @@ -617,12 +617,12 @@ void BL_ConvertActuators(const char* maggiename, } else { switch (conact->flag) { case ACT_CONST_LOCX: - locrot = KX_ConstraintActuator::KX_ACT_CONSTRAINT_LOCX; + locrot = KX_ConstraintActuator::KX_ACT_CONSTRAINT_LOCX; min = conact->minloc[0]; max = conact->maxloc[0]; break; case ACT_CONST_LOCY: - locrot = KX_ConstraintActuator::KX_ACT_CONSTRAINT_LOCY; + locrot = KX_ConstraintActuator::KX_ACT_CONSTRAINT_LOCY; min = conact->minloc[1]; max = conact->maxloc[1]; break; @@ -647,7 +647,7 @@ void BL_ConvertActuators(const char* maggiename, max = conact->maxrot[2] * (float)MT_RADS_PER_DEG; break; default: - ; /* error */ + ; /* error */ } } KX_ConstraintActuator *tmpconact = new KX_ConstraintActuator( @@ -673,7 +673,7 @@ void BL_ConvertActuators(const char* maggiename, { bSceneActuator *sceneact = (bSceneActuator *) bact->data; STR_String nextSceneName(""); - + KX_SceneActuator* tmpsceneact; int mode = KX_SceneActuator::KX_SCENE_NODEF; KX_Camera *cam = NULL; @@ -709,11 +709,11 @@ void BL_ConvertActuators(const char* maggiename, mode = KX_SceneActuator::KX_SCENE_SET_SCENE; break; }; - + if (sceneact->scene) { nextSceneName = sceneact->scene->id.name + 2; } - + break; } case ACT_SCENE_CAMERA: @@ -727,7 +727,7 @@ void BL_ConvertActuators(const char* maggiename, break; case ACT_SCENE_RESTART: { - + mode = KX_SceneActuator::KX_SCENE_RESTART; break; } @@ -809,21 +809,21 @@ void BL_ConvertActuators(const char* maggiename, } case ACT_RANDOM: { - bRandomActuator *randAct + bRandomActuator *randAct = (bRandomActuator *) bact->data; - + unsigned long seedArg = randAct->seed; if (seedArg == 0) { seedArg = (int)(ketsjiEngine->GetRealTime()*100000.0); seedArg ^= (intptr_t)randAct; } - SCA_RandomActuator::KX_RANDOMACT_MODE modeArg + SCA_RandomActuator::KX_RANDOMACT_MODE modeArg = SCA_RandomActuator::KX_RANDOMACT_NODEF; SCA_RandomActuator *tmprandomact; float paraArg1 = 0.0; float paraArg2 = 0.0; - + switch (randAct->distribution) { case ACT_RANDOM_BOOL_CONST: modeArg = SCA_RandomActuator::KX_RANDOMACT_BOOL_CONST; @@ -890,7 +890,7 @@ void BL_ConvertActuators(const char* maggiename, bool recursive = ((vis_act->flag & ACT_VISIBILITY_RECURSIVE) != 0); tmp_vis_act = new KX_VisibilityActuator(gameobj, !v, o, recursive); - + baseact = tmp_vis_act; } break; @@ -900,9 +900,9 @@ void BL_ConvertActuators(const char* maggiename, bStateActuator *sta_act = (bStateActuator *) bact->data; KX_StateActuator * tmp_sta_act = NULL; - tmp_sta_act = + tmp_sta_act = new KX_StateActuator(gameobj, sta_act->type, sta_act->mask); - + baseact = tmp_sta_act; } break; @@ -1004,7 +1004,7 @@ void BL_ConvertActuators(const char* maggiename, tmpgob = NULL; break; } - + KX_ParentActuator *tmpparact = new KX_ParentActuator(gameobj, mode, @@ -1014,7 +1014,7 @@ void BL_ConvertActuators(const char* maggiename, baseact = tmpparact; break; } - + case ACT_ARMATURE: { bArmatureActuator* armAct = (bArmatureActuator*) bact->data; @@ -1064,8 +1064,8 @@ void BL_ConvertActuators(const char* maggiename, bool normalup = (stAct->flag & ACT_STEERING_NORMALUP) !=0; bool lockzvel = (stAct->flag & ACT_STEERING_LOCKZVEL) !=0; KX_SteeringActuator *tmpstact - = new KX_SteeringActuator(gameobj, mode, targetob, navmeshob,stAct->dist, - stAct->velocity, stAct->acceleration, stAct->turnspeed, + = new KX_SteeringActuator(gameobj, mode, targetob, navmeshob,stAct->dist, + stAct->velocity, stAct->acceleration, stAct->turnspeed, selfTerminated, stAct->updateTime, scene->GetObstacleSimulation(), facingMode, normalup, enableVisualization, lockzvel); baseact = tmpstact; @@ -1118,7 +1118,7 @@ void BL_ConvertActuators(const char* maggiename, default: ; /* generate some error */ } - + if (baseact && !(bact->flag & ACT_DEACTIVATE)) { baseact->SetExecutePriority(executePriority++); @@ -1131,14 +1131,14 @@ void BL_ConvertActuators(const char* maggiename, baseact->SetLogicManager(logicmgr); //gameobj->SetProperty(uniquename,baseact); gameobj->AddActuator(baseact); - + converter->RegisterGameActuator(baseact, bact); // done with baseact, release it baseact->Release(); } else if (baseact) baseact->Release(); - + bact = bact->next; } } diff --git a/source/gameengine/Converter/KX_ConvertControllers.cpp b/source/gameengine/Converter/KX_ConvertControllers.cpp index f55d81adb80..a00a90428da 100644 --- a/source/gameengine/Converter/KX_ConvertControllers.cpp +++ b/source/gameengine/Converter/KX_ConvertControllers.cpp @@ -161,7 +161,7 @@ void BL_ConvertControllers( // When libloading, this is delayed to KX_Scene::MergeScene_LogicBrick to avoid GIL issues if (!libloading) pyctrl->SetNamespace(converter->GetPyNamespace()); - + if (pycont->mode==SCA_PythonController::SCA_PYEXEC_SCRIPT) { if (pycont->text) { @@ -174,12 +174,12 @@ void BL_ConvertControllers( pyctrl->SetScriptName(pycont->text->id.name+2); MEM_freeN(buf); } - + } } else { /* let the controller print any warnings here when importing */ - pyctrl->SetScriptText(STR_String(pycont->module)); + pyctrl->SetScriptText(STR_String(pycont->module)); pyctrl->SetScriptName(pycont->module); /* will be something like module.func so using it as the name is OK */ if (pycont->flag & CONT_PY_DEBUG) { @@ -193,7 +193,7 @@ void BL_ConvertControllers( } default: { - + } } @@ -216,7 +216,7 @@ void BL_ConvertControllers( gamecontroller->SetName(bcontr->name); gamecontroller->SetLogicManager(logicmgr); gameobj->AddController(gamecontroller); - + converter->RegisterGameController(gamecontroller, bcontr); #ifdef WITH_PYTHON @@ -231,7 +231,7 @@ void BL_ConvertControllers( /* We cant do this because importing runs the script which could end up accessing * internal BGE functions, this is unstable while we're converting the scene. * This is a pity because its useful to see errors at startup but cant help it */ - + // pyctrl->Import(); } } @@ -243,7 +243,7 @@ void BL_ConvertControllers( } else if (gamecontroller) gamecontroller->Release(); - + bcontr = bcontr->next; } diff --git a/source/gameengine/Converter/KX_ConvertControllers.h b/source/gameengine/Converter/KX_ConvertControllers.h index 2f93d70a6f9..b5bc4148e1a 100644 --- a/source/gameengine/Converter/KX_ConvertControllers.h +++ b/source/gameengine/Converter/KX_ConvertControllers.h @@ -39,7 +39,7 @@ void BL_ConvertControllers( class KX_GameObject* gameobj, class SCA_LogicManager* logicmgr, int activeLayerBitInfo, - bool isInActiveLayer, + bool isInActiveLayer, class KX_BlenderSceneConverter* converter, bool libloading ); diff --git a/source/gameengine/Converter/KX_ConvertProperties.cpp b/source/gameengine/Converter/KX_ConvertProperties.cpp index 2cb61207fb5..5dd7d0e4066 100644 --- a/source/gameengine/Converter/KX_ConvertProperties.cpp +++ b/source/gameengine/Converter/KX_ConvertProperties.cpp @@ -65,7 +65,7 @@ void BL_ConvertTextProperty(Object* object, KX_FontObject* fontobj,SCA_TimeEvent void BL_ConvertProperties(Object* object,KX_GameObject* gameobj,SCA_TimeEventManager* timemgr,SCA_IScene* scene, bool isInActiveLayer) { - + bProperty* prop = (bProperty*)object->prop.first; CValue* propval; bool show_debug_info; @@ -108,8 +108,8 @@ void BL_ConvertProperties(Object* object,KX_GameObject* gameobj,SCA_TimeEventMan float floatprop = *((float*)&prop->data); CValue* timeval = new CFloatValue(floatprop); - // set a subproperty called 'timer' so that - // we can register the replica of this property + // set a subproperty called 'timer' so that + // we can register the replica of this property // at the time a game object is replicated (AddObjectActuator triggers this) CValue *bval = new CBoolValue(true); timeval->SetProperty("timer",bval); @@ -118,7 +118,7 @@ void BL_ConvertProperties(Object* object,KX_GameObject* gameobj,SCA_TimeEventMan { timemgr->AddTimeProperty(timeval); } - + propval = timeval; gameobj->SetProperty(prop->name,timeval); @@ -128,7 +128,7 @@ void BL_ConvertProperties(Object* object,KX_GameObject* gameobj,SCA_TimeEventMan // todo make an assert etc. } } - + if (propval) { if (show_debug_info && isInActiveLayer) @@ -138,7 +138,7 @@ void BL_ConvertProperties(Object* object,KX_GameObject* gameobj,SCA_TimeEventMan // done with propval, release it propval->Release(); } - + #ifdef WITH_PYTHON /* Warn if we double up on attributes, this isn't quite right since it wont find inherited attributes however there arnt many */ for (PyAttributeDef *attrdef = KX_GameObject::Attributes; attrdef->m_name; attrdef++) { diff --git a/source/gameengine/Converter/KX_ConvertSensors.cpp b/source/gameengine/Converter/KX_ConvertSensors.cpp index 5e897bb4a62..618be1e1c9b 100644 --- a/source/gameengine/Converter/KX_ConvertSensors.cpp +++ b/source/gameengine/Converter/KX_ConvertSensors.cpp @@ -109,7 +109,7 @@ void BL_ConvertSensors(struct Object* blenderobject, bool invert = false; bool level = false; bool tap = false; - + while (sens) { sens = sens->next; diff --git a/source/gameengine/Converter/KX_ConvertSensors.h b/source/gameengine/Converter/KX_ConvertSensors.h index 56248721a37..2ed2c9b3226 100644 --- a/source/gameengine/Converter/KX_ConvertSensors.h +++ b/source/gameengine/Converter/KX_ConvertSensors.h @@ -39,7 +39,7 @@ void BL_ConvertSensors(struct Object* blenderobject, class KX_KetsjiEngine* kxengine, int activeLayerBitInfo, bool isInActiveLayer, - class RAS_ICanvas* canvas, + class RAS_ICanvas* canvas, class KX_BlenderSceneConverter* converter); #endif /* __KX_CONVERTSENSORS_H__ */ diff --git a/source/gameengine/Converter/KX_LibLoadStatus.cpp b/source/gameengine/Converter/KX_LibLoadStatus.cpp index 66fcd998269..c43958ebc85 100644 --- a/source/gameengine/Converter/KX_LibLoadStatus.cpp +++ b/source/gameengine/Converter/KX_LibLoadStatus.cpp @@ -148,7 +148,7 @@ void KX_LibLoadStatus::AddProgress(float progress) #ifdef WITH_PYTHON -PyMethodDef KX_LibLoadStatus::Methods[] = +PyMethodDef KX_LibLoadStatus::Methods[] = { {NULL} //Sentinel }; @@ -189,7 +189,7 @@ PyTypeObject KX_LibLoadStatus::Type = { PyObject* KX_LibLoadStatus::pyattr_get_onfinish(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) { KX_LibLoadStatus* self = static_cast(self_v); - + if (self->m_finish_cb) { Py_INCREF(self->m_finish_cb); return self->m_finish_cb; @@ -219,7 +219,7 @@ int KX_LibLoadStatus::pyattr_set_onfinish(void *self_v, const KX_PYATTRIBUTE_DEF PyObject* KX_LibLoadStatus::pyattr_get_onprogress(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) { KX_LibLoadStatus* self = static_cast(self_v); - + if (self->m_progress_cb) { Py_INCREF(self->m_progress_cb); return self->m_progress_cb; diff --git a/source/gameengine/Converter/KX_SoftBodyDeformer.cpp b/source/gameengine/Converter/KX_SoftBodyDeformer.cpp index 877aebff556..6c8b7fc3e29 100644 --- a/source/gameengine/Converter/KX_SoftBodyDeformer.cpp +++ b/source/gameengine/Converter/KX_SoftBodyDeformer.cpp @@ -92,7 +92,7 @@ bool KX_SoftBodyDeformer::Apply(class RAS_IPolyMaterial *polymat) slot = *mmat->m_slots[(void*)m_gameobj]; // for each array - for (slot->begin(it); !slot->end(it); slot->next(it)) + for (slot->begin(it); !slot->end(it); slot->next(it)) { btSoftBody::tNodeArray& nodes(softBody->m_nodes); diff --git a/source/gameengine/Converter/KX_SoftBodyDeformer.h b/source/gameengine/Converter/KX_SoftBodyDeformer.h index d7bc088e1c0..cc7f81ce0c7 100644 --- a/source/gameengine/Converter/KX_SoftBodyDeformer.h +++ b/source/gameengine/Converter/KX_SoftBodyDeformer.h @@ -68,7 +68,7 @@ public: } virtual bool UpdateBuckets(void) { - // this is to update the mesh slots outside the rasterizer, + // this is to update the mesh slots outside the rasterizer, // no need to do it for this deformer, it's done in any case in Apply() return false; } diff --git a/source/gameengine/Expressions/EXP_BoolValue.h b/source/gameengine/Expressions/EXP_BoolValue.h index 98ba1d75e52..89c724e87ee 100644 --- a/source/gameengine/Expressions/EXP_BoolValue.h +++ b/source/gameengine/Expressions/EXP_BoolValue.h @@ -26,7 +26,7 @@ * Is used by parser when an expression tree is build containing booleans. */ -class CBoolValue : public CPropValue +class CBoolValue : public CPropValue { //PLUGIN_DECLARE_SERIAL(CBoolValue,CValue) @@ -44,10 +44,10 @@ public: virtual int GetValueType(); bool GetBool(); virtual void SetValue(CValue* newval); - + virtual CValue* Calc(VALUE_OPERATOR op, CValue *val); virtual CValue* CalcFinal(VALUE_DATA_TYPE dtype, VALUE_OPERATOR op, CValue *val); - + void Configure(CValue* menuvalue); virtual CValue* GetReplica(); #ifdef WITH_PYTHON diff --git a/source/gameengine/Expressions/EXP_ConstExpr.h b/source/gameengine/Expressions/EXP_ConstExpr.h index b4456dacdf3..ddc7df14ff1 100644 --- a/source/gameengine/Expressions/EXP_ConstExpr.h +++ b/source/gameengine/Expressions/EXP_ConstExpr.h @@ -22,12 +22,12 @@ #include "EXP_Expression.h" #include "EXP_Value.h" // Added by ClassView -class CConstExpr : public CExpression +class CConstExpr : public CExpression { //PLUGIN_DECLARE_SERIAL_EXPRESSION (CConstExpr,CExpression) public: virtual bool MergeExpression(CExpression* otherexpr); - + void BroadcastOperators(VALUE_OPERATOR op); virtual unsigned char GetExpressionID(); @@ -40,7 +40,7 @@ public: CConstExpr(CValue* constval); CConstExpr(); virtual ~CConstExpr(); - + private: CValue* m_value; diff --git a/source/gameengine/Expressions/EXP_EmptyValue.h b/source/gameengine/Expressions/EXP_EmptyValue.h index d23addb9f9f..e3be9f0c2c4 100644 --- a/source/gameengine/Expressions/EXP_EmptyValue.h +++ b/source/gameengine/Expressions/EXP_EmptyValue.h @@ -23,7 +23,7 @@ class CListValue; -class CEmptyValue : public CPropValue +class CEmptyValue : public CPropValue { //PLUGIN_DECLARE_SERIAL (CEmptyValue,CValue) public: diff --git a/source/gameengine/Expressions/EXP_ErrorValue.h b/source/gameengine/Expressions/EXP_ErrorValue.h index a6f91ca200a..aa2b1a68241 100644 --- a/source/gameengine/Expressions/EXP_ErrorValue.h +++ b/source/gameengine/Expressions/EXP_ErrorValue.h @@ -21,7 +21,7 @@ #include "EXP_Value.h" -class CErrorValue : public CPropValue +class CErrorValue : public CPropValue { public: diff --git a/source/gameengine/Expressions/EXP_Expression.h b/source/gameengine/Expressions/EXP_Expression.h index 66a6e9476ff..0ed8c9503b3 100644 --- a/source/gameengine/Expressions/EXP_Expression.h +++ b/source/gameengine/Expressions/EXP_Expression.h @@ -56,7 +56,7 @@ class CBrokenLinkInfo CBrokenLinkInfo(CExpression** pmemexpr,CExpression* expr) :m_pmemExpr(pmemexpr), m_pExpr(expr) - { + { assertd(pmemexpr); m_bRestored=false; }; @@ -64,15 +64,15 @@ class CBrokenLinkInfo virtual ~CBrokenLinkInfo(); void RestoreLink(); void BreakLink(); - - + + // members vars private: CExpression** m_pmemExpr; CExpression* m_pExpr; bool m_bRestored; - - + + #ifdef WITH_CXX_GUARDEDALLOC MEM_CXX_CLASS_ALLOC_FUNCS("GE:CBrokenLinkInfo") #endif @@ -85,7 +85,7 @@ class CBrokenLinkInfo -class CExpression +class CExpression { public: enum { @@ -104,7 +104,7 @@ public: virtual bool MergeExpression(CExpression* otherexpr) = 0; CExpression(); - + virtual CValue* Calculate() = 0; //pure virtual virtual unsigned char GetExpressionID() = 0; //virtual bool IsInside(float x,float y,float z,bool bBorderInclude=true) = 0; //pure virtual @@ -120,21 +120,21 @@ public: //gRefCountExpr++; assertd(m_refcount < 255); #endif - m_refcount++; + m_refcount++; return this; }; - virtual CExpression* Release(CExpression* complicatedtrick=NULL) { + virtual CExpression* Release(CExpression* complicatedtrick=NULL) { #ifdef DEBUG //gRefCountExpr--; #endif - if (--m_refcount < 1) + if (--m_refcount < 1) { delete this; } //else // return this; return complicatedtrick; }; - + protected: diff --git a/source/gameengine/Expressions/EXP_FloatValue.h b/source/gameengine/Expressions/EXP_FloatValue.h index 3c16c57d16d..5ec22d0fcb4 100644 --- a/source/gameengine/Expressions/EXP_FloatValue.h +++ b/source/gameengine/Expressions/EXP_FloatValue.h @@ -21,7 +21,7 @@ #include "EXP_Value.h" -class CFloatValue : public CPropValue +class CFloatValue : public CPropValue { //PLUGIN_DECLARE_SERIAL (CFloatValue,CValue) public: diff --git a/source/gameengine/Expressions/EXP_HashedPtr.h b/source/gameengine/Expressions/EXP_HashedPtr.h index 7c7c5f6e5ec..fbb6762c351 100644 --- a/source/gameengine/Expressions/EXP_HashedPtr.h +++ b/source/gameengine/Expressions/EXP_HashedPtr.h @@ -49,8 +49,8 @@ public: { return rhs.m_valptr == lhs.m_valptr; } - - + + #ifdef WITH_CXX_GUARDEDALLOC MEM_CXX_CLASS_ALLOC_FUNCS("GE:CHashedPtr") #endif diff --git a/source/gameengine/Expressions/EXP_IfExpr.h b/source/gameengine/Expressions/EXP_IfExpr.h index 43b4b8faf53..929f3a3ada9 100644 --- a/source/gameengine/Expressions/EXP_IfExpr.h +++ b/source/gameengine/Expressions/EXP_IfExpr.h @@ -21,7 +21,7 @@ #include "EXP_Expression.h" -class CIfExpr : public CExpression +class CIfExpr : public CExpression { //PLUGIN_DECLARE_SERIAL_EXPRESSION (CIfExpr,CExpression) @@ -32,11 +32,11 @@ public: virtual bool MergeExpression(CExpression* otherexpr); CIfExpr(CExpression *guard, CExpression *e1, CExpression *e2); CIfExpr(); - + virtual unsigned char GetExpressionID(); virtual ~CIfExpr(); virtual CValue* Calculate(); - + virtual bool IsInside(float x,float y,float z,bool bBorderInclude=true); virtual bool NeedsRecalculated(); diff --git a/source/gameengine/Expressions/EXP_InputParser.h b/source/gameengine/Expressions/EXP_InputParser.h index 80471009a16..a59ca433024 100644 --- a/source/gameengine/Expressions/EXP_InputParser.h +++ b/source/gameengine/Expressions/EXP_InputParser.h @@ -75,21 +75,21 @@ private: floattype, stringtype }; // all kinds of constants - + int sym, // current symbol opkind, // kind of operator, if symbol is an operator constkind; // kind of operator, if symbol is a constant - + char ch; // current character int chcount; // index to character in input string CExpression *errmsg; // contains a errormessage, if scanner error - + STR_String text, // contains a copy of the original text const_as_string; // string representation of the symbol, if symbol is a constant bool boolvalue; // value of the boolean, if symbol is a constant of type boolean CValue* m_identifierContext;// context in which identifiers are looked up - - + + void ScanError(const char *str); CExpression* Error(const char *str); void NextCh(); @@ -107,8 +107,8 @@ private: int Priority(int optor); CExpression *Ex(int i); CExpression *Expr(); - - + + #ifdef WITH_CXX_GUARDEDALLOC MEM_CXX_CLASS_ALLOC_FUNCS("GE:CParser") #endif diff --git a/source/gameengine/Expressions/EXP_IntValue.h b/source/gameengine/Expressions/EXP_IntValue.h index a1cd96a888e..8c66ba7c3bf 100644 --- a/source/gameengine/Expressions/EXP_IntValue.h +++ b/source/gameengine/Expressions/EXP_IntValue.h @@ -22,9 +22,9 @@ #include "EXP_Value.h" -typedef long long cInt; +typedef long long cInt; -class CIntValue : public CPropValue +class CIntValue : public CPropValue { //PLUGIN_DECLARE_SERIAL (CIntValue,CValue) @@ -32,14 +32,14 @@ public: virtual const STR_String& GetText(); virtual double GetNumber(); virtual int GetValueType(); - + cInt GetInt(); CIntValue(); CIntValue(cInt innie); CIntValue(cInt innie, const char *name, AllocationTYPE alloctype=CValue::HEAPVALUE); - + virtual CValue* Calc(VALUE_OPERATOR op, CValue *val); diff --git a/source/gameengine/Expressions/EXP_ListValue.h b/source/gameengine/Expressions/EXP_ListValue.h index f5421066f62..d5c14be8c37 100644 --- a/source/gameengine/Expressions/EXP_ListValue.h +++ b/source/gameengine/Expressions/EXP_ListValue.h @@ -21,7 +21,7 @@ #include "EXP_Value.h" -class CListValue : public CPropValue +class CListValue : public CPropValue { Py_Header //PLUGIN_DECLARE_SERIAL (CListValue,CValue) @@ -48,7 +48,7 @@ public: bool RemoveValue(CValue* val); void SetReleaseOnDestruct(bool bReleaseContents); bool SearchValue(CValue* val); - + CValue* FindValue(const STR_String & name); CValue* FindValue(const char *name); @@ -81,7 +81,7 @@ public: KX_PYMETHOD_VARARGS(CListValue,get); KX_PYMETHOD_O(CListValue,from_id); #endif - + private: std::vector m_pValueArray; diff --git a/source/gameengine/Expressions/EXP_ListWrapper.h b/source/gameengine/Expressions/EXP_ListWrapper.h index e4c97691acb..c0f149aa1af 100644 --- a/source/gameengine/Expressions/EXP_ListWrapper.h +++ b/source/gameengine/Expressions/EXP_ListWrapper.h @@ -31,7 +31,7 @@ #include "EXP_Value.h" -class CListWrapper : public CValue +class CListWrapper : public CValue { Py_Header private: diff --git a/source/gameengine/Expressions/EXP_Operator1Expr.h b/source/gameengine/Expressions/EXP_Operator1Expr.h index 9a05ce9c0c4..e8b5e07a03d 100644 --- a/source/gameengine/Expressions/EXP_Operator1Expr.h +++ b/source/gameengine/Expressions/EXP_Operator1Expr.h @@ -21,7 +21,7 @@ #include "EXP_Expression.h" -class COperator1Expr : public CExpression +class COperator1Expr : public CExpression { //PLUGIN_DECLARE_SERIAL_EXPRESSION (COperator1Expr,CExpression) @@ -43,9 +43,9 @@ public: COperator1Expr(VALUE_OPERATOR op, CExpression *lhs); COperator1Expr(); virtual ~COperator1Expr(); - - - + + + private: VALUE_OPERATOR m_op; CExpression * m_lhs; diff --git a/source/gameengine/Expressions/EXP_Operator2Expr.h b/source/gameengine/Expressions/EXP_Operator2Expr.h index cd7a492fde0..da01bfacb87 100644 --- a/source/gameengine/Expressions/EXP_Operator2Expr.h +++ b/source/gameengine/Expressions/EXP_Operator2Expr.h @@ -23,7 +23,7 @@ #include "EXP_Expression.h" #include "EXP_Value.h" // Added by ClassView -class COperator2Expr : public CExpression +class COperator2Expr : public CExpression { //PLUGIN_DECLARE_SERIAL_EXPRESSION (COperator2Expr,CExpression) @@ -36,7 +36,7 @@ public: //virtual bool IsLeftInside(float x,float y,float z,bool bBorderInclude); //virtual bool IsRightInside(float x,float y,float z,bool bBorderInclude); bool NeedsRecalculated(); - void ClearModified() { + void ClearModified() { if (m_lhs) m_lhs->ClearModified(); if (m_rhs) @@ -47,12 +47,12 @@ public: COperator2Expr(); virtual ~COperator2Expr(); - + protected: CExpression * m_rhs; CExpression * m_lhs; CValue* m_cached_calculate; // cached result - + private: VALUE_OPERATOR m_op; diff --git a/source/gameengine/Expressions/EXP_PyObjectPlus.h b/source/gameengine/Expressions/EXP_PyObjectPlus.h index 32dc79cf6eb..308fae6e6af 100644 --- a/source/gameengine/Expressions/EXP_PyObjectPlus.h +++ b/source/gameengine/Expressions/EXP_PyObjectPlus.h @@ -115,9 +115,9 @@ typedef struct PyObjectPlus_Proxy { #define BGE_PROXY_FROM_REF_BORROW(_self) _bge_proxy_from_ref_borrow((void *)_self) -// This must be the first line of each +// This must be the first line of each // PyC++ class -// AttributesPtr correspond to attributes of proxy generic pointer +// AttributesPtr correspond to attributes of proxy generic pointer // each PyC++ class must be registered in KX_PythonInitTypes.cpp #define __Py_Header \ public: \ @@ -362,9 +362,9 @@ typedef struct KX_PYATTRIBUTE_DEF { const char *m_name; // name of the python attribute KX_PYATTRIBUTE_TYPE m_type; // type of value KX_PYATTRIBUTE_ACCESS m_access; // read/write access or read-only - int m_imin; // minimum value in case of integer attributes + int m_imin; // minimum value in case of integer attributes // (for string: minimum string length, for flag: mask value, for float: matrix row size) - int m_imax; // maximum value in case of integer attributes + int m_imax; // maximum value in case of integer attributes // (for string: maximum string length, for flag: 1 if flag is negative, float: vector/matrix col size) float m_fmin; // minimum value in case of float attributes float m_fmax; // maximum value in case of float attributes @@ -500,7 +500,7 @@ typedef struct KX_PYATTRIBUTE_DEF { #define KX_PYATTRIBUTE_STRING_RO(name, object, field) \ { name, KX_PYATTRIBUTE_TYPE_STRING, KX_PYATTRIBUTE_RO, 0, 0, 0.f, 0.f, false, false, offsetof(object, field), 0, 1 , NULL, NULL, NULL, {NULL, NULL, NULL, NULL, &((object *)0)->field, NULL, NULL} } -// only for char [] array +// only for char [] array #define KX_PYATTRIBUTE_CHAR_RW(name, object, field) \ { name, KX_PYATTRIBUTE_TYPE_CHAR, KX_PYATTRIBUTE_RW, 0, 0, 0.f, 0.f, true, false, offsetof(object, field), sizeof(((object *)0)->field), 1, NULL, NULL, NULL, {NULL, NULL, NULL, NULL, NULL, NULL, ((object *)0)->field} } #define KX_PYATTRIBUTE_CHAR_RW_CHECK(name, object, field, function) \ @@ -558,7 +558,7 @@ public: \ // By making SG_QList the ultimate parent for PyObjectPlus objects, it // allows to put them in 2 different dynamic lists at the same time // The use of these links is interesting because they free of memory allocation -// but it's very important not to mess up with them. If you decide that +// but it's very important not to mess up with them. If you decide that // the SG_QList or SG_DList component is used for something for a certain class, // they cannot can be used for anything else at a parent level! // What these lists are and what they are used for must be carefully documented @@ -569,12 +569,12 @@ public: \ class PyObjectPlus : public SG_QList { // The PyObjectPlus abstract class Py_Header // Always start with Py_Header - + public: PyObjectPlus(); - + virtual ~PyObjectPlus(); // destructor - + #ifdef WITH_PYTHON PyObject *m_proxy; /* actually a PyObjectPlus_Proxy */ @@ -595,7 +595,7 @@ public: static PyObject* py_get_attrdef(PyObject *self_py, const PyAttributeDef *attrdef); static int py_set_attrdef(PyObject *self_py, PyObject *value, const PyAttributeDef *attrdef); - + /* Kindof dumb, always returns True, the false case is checked for, before this function gets accessed */ static PyObject* pyattr_get_invalid(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); @@ -612,13 +612,13 @@ public: static void SetDeprecationWarningFirst(WarnLink* wlink); static void SetDeprecationWarningLinkLast(WarnLink* wlink); static void NullDeprecationWarning(); - + /** enable/disable display of deprecation warnings */ static void SetDeprecationWarnings(bool ignoreDeprecationWarnings); /** Shows a deprecation warning */ static void ShowDeprecationWarning_func(const char *method, const char *prop); static void ClearDeprecationWarning(); - + #endif void InvalidateProxy(); diff --git a/source/gameengine/Expressions/EXP_StringValue.h b/source/gameengine/Expressions/EXP_StringValue.h index ca59ebf1f82..57c5de2206b 100644 --- a/source/gameengine/Expressions/EXP_StringValue.h +++ b/source/gameengine/Expressions/EXP_StringValue.h @@ -21,10 +21,10 @@ #include "EXP_Value.h" -class CStringValue : public CPropValue +class CStringValue : public CPropValue { - + //PLUGIN_DECLARE_SERIAL(CStringValue,CValue) public: /// Construction / destruction @@ -37,7 +37,7 @@ public: virtual const STR_String & GetText(); virtual double GetNumber(); virtual int GetValueType(); - + virtual CValue* Calc(VALUE_OPERATOR op, CValue *val); virtual CValue* CalcFinal(VALUE_DATA_TYPE dtype, VALUE_OPERATOR op, CValue *val); virtual void SetValue(CValue* newval) { m_strString = newval->GetText(); SetModified(true); } diff --git a/source/gameengine/Expressions/EXP_Value.h b/source/gameengine/Expressions/EXP_Value.h index 014fc59405f..dd0cee3dbb8 100644 --- a/source/gameengine/Expressions/EXP_Value.h +++ b/source/gameengine/Expressions/EXP_Value.h @@ -54,7 +54,7 @@ using namespace std; #endif enum VALUE_OPERATOR { - + VALUE_MOD_OPERATOR, // % VALUE_ADD_OPERATOR, // + VALUE_SUB_OPERATOR, // - @@ -94,14 +94,14 @@ enum VALUE_DATA_TYPE { //extern int gRefCountValue; // debugonly variable to check if all CValue Refences are Dereferenced at programexit #endif -struct HashableInt +struct HashableInt { HashableInt(int id) : mData(id) { } unsigned long Hash() const { return 0;} ////}gHash(&mData, sizeof(int));} - + bool operator==(HashableInt rhs) { return mData == rhs.mData; } - + int mData; }; @@ -137,7 +137,7 @@ struct ValueFlags { unsigned short CustomFlag1 : 1; unsigned short CustomFlag2 : 1; - + }; /** @@ -151,8 +151,8 @@ public: virtual ~CAction() { }; virtual void Execute() const =0; - - + + #ifdef WITH_CXX_GUARDEDALLOC MEM_CXX_CLASS_ALLOC_FUNCS("GE:CAction") #endif @@ -169,11 +169,11 @@ public: * * Together with CExpression, CValue and it's derived classes can be used to * parse expressions into a parsetree with error detecting/correcting capabilities - * also expandable by a CFactory pluginsystem + * also expandable by a CFactory pluginsystem * * Base class for all editor functionality, flexible object type that allows * calculations and uses reference counting for memory management. - * + * * Features: * - Reference Counting (AddRef() / Release()) * - Calculations (Calc() / CalcFinal()) @@ -182,10 +182,10 @@ public: * - Property system (SetProperty() / GetProperty() / FindIdentifier()) * - Replication (GetReplica()) * - Flags (IsSelected() / IsModified() / SetSelected()...) - * + * * - Some small editor-specific things added * - A helperclass CompressorArchive handles the serialization - * + * */ class CValue : public PyObjectPlus @@ -196,7 +196,7 @@ public: STACKVALUE = 0, HEAPVALUE = 1 }; - + enum DrawTYPE { STARTFRAME = 0, ENDFRAME = 1, @@ -219,20 +219,20 @@ public: } virtual CValue *ConvertPythonToValue(PyObject *pyobj, const bool do_type_exception, const char *error_prefix); - + static PyObject *pyattr_get_name(void *self, const KX_PYATTRIBUTE_DEF *attrdef); - + virtual PyObject *ConvertKeysToPython( void ); #endif /* WITH_PYTHON */ - - + + // Expression Calculation virtual CValue* Calc(VALUE_OPERATOR op, CValue *val) = 0; virtual CValue* CalcFinal(VALUE_DATA_TYPE dtype, VALUE_OPERATOR op, CValue *val) = 0; virtual void SetOwnerExpression(class CExpression* expr); - + void Execute(const CAction& a) { @@ -241,8 +241,8 @@ public: /// Reference Counting int GetRefCount() - { - return m_refcount; + { + return m_refcount; } // Add a reference to this value @@ -254,7 +254,7 @@ public: #ifdef DEBUG //gRefCountValue++; #endif - m_refcount++; + m_refcount++; return this; } @@ -277,7 +277,7 @@ public: { // Reference count reached 0, delete ourselves and return 0 // MT_assert(m_refcount==0, "Reference count reached sub-zero, object released too much"); - + delete this; return 0; } @@ -321,9 +321,9 @@ public: virtual CValue* GetReplica() =0; virtual void ProcessReplica(); //virtual CValue* Copy() = 0; - + STR_String op2str(VALUE_OPERATOR op); - + // setting / getting flags inline void SetSelected(bool bSelected) { m_ValFlags.Selected = bSelected; } virtual void SetModified(bool bModified) { m_ValFlags.Modified = bModified; } @@ -331,7 +331,7 @@ public: inline void SetReleaseRequested(bool bReleaseRequested) { m_ValFlags.ReleaseRequested=bReleaseRequested; } inline void SetError(bool err) { m_ValFlags.Error=err; } inline void SetVisible (bool vis) { m_ValFlags.Visible=vis; } - + virtual bool IsModified() { return m_ValFlags.Modified; } inline bool IsError() { return m_ValFlags.Error; } virtual bool IsAffected() { return m_ValFlags.Affected || m_ValFlags.Modified; } @@ -392,7 +392,7 @@ public: \ //////////////////////////////////////////////////////////////////////////////// // CPropValue is a CValue derived class, that implements the identification (String name) -// SetName() / GetName(), +// SetName() / GetName(), // normal classes should derive from CPropValue, real lightweight classes straight from CValue @@ -405,22 +405,22 @@ public: { } - + virtual ~CPropValue() { } - + virtual void SetName(const char *name) { m_strNewName = name; } - + virtual STR_String& GetName() { //STR_String namefromprop = GetPropertyText("Name"); //if (namefromprop.Length() > 0) // return namefromprop; return m_strNewName; } // name of Value - + protected: STR_String m_strNewName; // Identification diff --git a/source/gameengine/Expressions/EXP_VectorValue.h b/source/gameengine/Expressions/EXP_VectorValue.h index d87d5097156..8eda8f3ac6b 100644 --- a/source/gameengine/Expressions/EXP_VectorValue.h +++ b/source/gameengine/Expressions/EXP_VectorValue.h @@ -26,7 +26,7 @@ #define KX_Z 2 -class CVectorValue : public CPropValue +class CVectorValue : public CPropValue { //PLUGIN_DECLARE_SERIAL(CVectorValue,CValue) @@ -38,14 +38,14 @@ public: virtual double* GetVector3(bool bGetTransformedVec=false); virtual double GetNumber(); virtual int GetValueType(); - + CValue* Calc(VALUE_OPERATOR op, CValue *val) { return val->CalcFinal(VALUE_VECTOR_TYPE, op, this); } - + CValue* CalcFinal(VALUE_DATA_TYPE dtype, VALUE_OPERATOR op, CValue *val); - - + + CVectorValue(double vec[3], const char *name,AllocationTYPE alloctype=CValue::HEAPVALUE); CVectorValue() {}; @@ -54,7 +54,7 @@ public: virtual ~CVectorValue(); //virtual bool ExportT3D(File *txtfile,bool bNoName=false); void AddConfigurationData(CValue* menuvalue); - + virtual CValue* GetReplica(); @@ -70,14 +70,14 @@ public: void SnapPosition(const double snapvec[]) { - + if (snapvec[KX_X] >= 1) SnapPoint(m_vec[KX_X],snapvec[KX_X]); if (snapvec[KX_Y] >= 1) SnapPoint(m_vec[KX_Y],snapvec[KX_Y]); if (snapvec[KX_Z] >= 1) SnapPoint(m_vec[KX_Z],snapvec[KX_Z]); - + } #endif diff --git a/source/gameengine/Expressions/EXP_VoidValue.h b/source/gameengine/Expressions/EXP_VoidValue.h index 8b2c29488d7..ba7a383e911 100644 --- a/source/gameengine/Expressions/EXP_VoidValue.h +++ b/source/gameengine/Expressions/EXP_VoidValue.h @@ -39,7 +39,7 @@ // // Void value, used to transport *any* type of data // -class CVoidValue : public CPropValue +class CVoidValue : public CPropValue { //PLUGIN_DECLARE_SERIAL (CVoidValue,CValue) @@ -67,12 +67,12 @@ public: /// Value replication virtual CValue* GetReplica(); - + /// Data members bool m_bDeleteOnDestruct; void* m_pAnything; - - + + #ifdef WITH_CXX_GUARDEDALLOC MEM_CXX_CLASS_ALLOC_FUNCS("GE:CVoidValue") #endif diff --git a/source/gameengine/Expressions/intern/BoolValue.cpp b/source/gameengine/Expressions/intern/BoolValue.cpp index 1523a9212ba..6d29a07aada 100644 --- a/source/gameengine/Expressions/intern/BoolValue.cpp +++ b/source/gameengine/Expressions/intern/BoolValue.cpp @@ -103,7 +103,7 @@ this object */ { CValue *ret; - + switch (dtype) { case VALUE_EMPTY_TYPE: case VALUE_BOOL_TYPE: @@ -204,7 +204,7 @@ CValue* CBoolValue::GetReplica() { CBoolValue* replica = new CBoolValue(*this); replica->ProcessReplica(); - + return replica; } diff --git a/source/gameengine/Expressions/intern/ConstExpr.cpp b/source/gameengine/Expressions/intern/ConstExpr.cpp index 597427ecfe5..f7853d2dfac 100644 --- a/source/gameengine/Expressions/intern/ConstExpr.cpp +++ b/source/gameengine/Expressions/intern/ConstExpr.cpp @@ -30,7 +30,7 @@ CConstExpr::CConstExpr() -CConstExpr::CConstExpr(CValue* constval) +CConstExpr::CConstExpr(CValue* constval) /* pre: effect: constructs a CConstExpr cointing the value constval @@ -73,7 +73,7 @@ ret: a new object containing the value of the stored CValue void CConstExpr::ClearModified() -{ +{ if (m_value) { m_value->SetModified(false); diff --git a/source/gameengine/Expressions/intern/EmptyValue.cpp b/source/gameengine/Expressions/intern/EmptyValue.cpp index 9227626777d..5083b50668f 100644 --- a/source/gameengine/Expressions/intern/EmptyValue.cpp +++ b/source/gameengine/Expressions/intern/EmptyValue.cpp @@ -58,7 +58,7 @@ CValue *CEmptyValue::Calc(VALUE_OPERATOR op, CValue *val) */ { return val->CalcFinal(VALUE_EMPTY_TYPE, op, this); - + } @@ -107,7 +107,7 @@ bool CEmptyValue::IsInside(CValue* testpoint,bool bBorderInclude) double* CEmptyValue::GetVector3(bool bGetTransformedVec) -{ +{ assertd(false); // don't get vector from me return ZeroVector(); } @@ -125,7 +125,7 @@ const STR_String & CEmptyValue::GetText() CValue* CEmptyValue::GetReplica() -{ +{ CEmptyValue* replica = new CEmptyValue(*this); replica->ProcessReplica(); return replica; diff --git a/source/gameengine/Expressions/intern/ErrorValue.cpp b/source/gameengine/Expressions/intern/ErrorValue.cpp index c03ceb88073..502608a6dcf 100644 --- a/source/gameengine/Expressions/intern/ErrorValue.cpp +++ b/source/gameengine/Expressions/intern/ErrorValue.cpp @@ -82,7 +82,7 @@ ret: a new object containing the result of applying operator op to this break; } } - + return errorval; } @@ -122,7 +122,7 @@ const STR_String & CErrorValue::GetText() CValue* CErrorValue::GetReplica() -{ +{ // who would want a copy of an error ? trace ("Error: ErrorValue::GetReplica() not implemented yet"); assertd(false); diff --git a/source/gameengine/Expressions/intern/Expression.cpp b/source/gameengine/Expressions/intern/Expression.cpp index 6a98a15aa12..4eab64ab249 100644 --- a/source/gameengine/Expressions/intern/Expression.cpp +++ b/source/gameengine/Expressions/intern/Expression.cpp @@ -50,21 +50,21 @@ CBrokenLinkInfo::~CBrokenLinkInfo() void CBrokenLinkInfo::RestoreLink() { - + assertd(m_pExpr); if (m_pExpr) { if (!m_bRestored) { m_bRestored=true; - + } if (*m_pmemExpr) { (*m_pmemExpr)->Release(); } *m_pmemExpr = m_pExpr; - + // m_pExpr=NULL; } } diff --git a/source/gameengine/Expressions/intern/FloatValue.cpp b/source/gameengine/Expressions/intern/FloatValue.cpp index 0f86a429d81..814d3d3b908 100644 --- a/source/gameengine/Expressions/intern/FloatValue.cpp +++ b/source/gameengine/Expressions/intern/FloatValue.cpp @@ -55,7 +55,7 @@ pre: effect: constructs a new CFloatValue containing value fl */ { - + m_float = fl; SetName(name); if (alloctype==CValue::STACKVALUE) @@ -119,7 +119,7 @@ ret: a new object containing the result of applying operator op to val and */ { CValue *ret; - + switch (dtype) { case VALUE_INT_TYPE: { @@ -293,8 +293,8 @@ int CFloatValue::GetValueType() void CFloatValue::SetValue(CValue* newval) -{ - m_float = (float)newval->GetNumber(); +{ + m_float = (float)newval->GetNumber(); SetModified(true); } @@ -312,7 +312,7 @@ const STR_String & CFloatValue::GetText() CValue* CFloatValue::GetReplica() -{ +{ CFloatValue* replica = new CFloatValue(*this); replica->m_pstrRep = NULL; /* should be in CFloatValue::ProcessReplica() but its not defined, no matter */ replica->ProcessReplica(); diff --git a/source/gameengine/Expressions/intern/IdentifierExpr.cpp b/source/gameengine/Expressions/intern/IdentifierExpr.cpp index 8fbbf41cd63..3a1342815af 100644 --- a/source/gameengine/Expressions/intern/IdentifierExpr.cpp +++ b/source/gameengine/Expressions/intern/IdentifierExpr.cpp @@ -90,7 +90,7 @@ CExpression* CIdentifierExpr::CheckLink(std::vector& brokenlin -void CIdentifierExpr::ClearModified() +void CIdentifierExpr::ClearModified() { assertd(false); // not implemented yet } diff --git a/source/gameengine/Expressions/intern/IfExpr.cpp b/source/gameengine/Expressions/intern/IfExpr.cpp index b4e2fe7315b..549f53749d6 100644 --- a/source/gameengine/Expressions/intern/IfExpr.cpp +++ b/source/gameengine/Expressions/intern/IfExpr.cpp @@ -104,10 +104,10 @@ bool CIfExpr::IsInside(float x,float y,float z,bool bBorderInclude) assertd(false); return false; } - -bool CIfExpr::NeedsRecalculated() + +bool CIfExpr::NeedsRecalculated() { return (m_guard->NeedsRecalculated() || m_e1->NeedsRecalculated() || diff --git a/source/gameengine/Expressions/intern/InputParser.cpp b/source/gameengine/Expressions/intern/InputParser.cpp index 583d8da63cb..1f5f9800a33 100644 --- a/source/gameengine/Expressions/intern/InputParser.cpp +++ b/source/gameengine/Expressions/intern/InputParser.cpp @@ -33,7 +33,7 @@ #include "EXP_IdentifierExpr.h" // this is disable at the moment, I expected a memleak from it, but the error-cleanup was the reason -// well, looks we don't need it anyway, until maybe the Curved Surfaces are integrated into CSG +// well, looks we don't need it anyway, until maybe the Curved Surfaces are integrated into CSG // cool things like (IF(LOD==1,CCurvedValue,IF(LOD==2,CCurvedValue2)) etc... #include "EXP_IfExpr.h" @@ -185,7 +185,7 @@ void CParser::NextSym() // sets the global variable constkind to the kind of operator // if it is a reference to a cell // sets the global variable cellcoord to the kind of operator - + errmsg = NULL; while (ch == ' ' || ch == 0x9) NextCh(); @@ -303,7 +303,7 @@ void CParser::NextSym() } else if (((ch >= 'a') && (ch <= 'z')) || ((ch >= 'A') && (ch <= 'Z'))) { // reserved word? - + start = chcount; CharRep(); GrabString(start); @@ -421,7 +421,7 @@ CExpression *CParser::Ex(int i) // returns an CExpression, containing the parsed input CExpression *e1 = NULL, *e2 = NULL; int opkind2; - + if (i < NUM_PRIORITY) { e1 = Ex(i + 1); while ((sym == opsym) && (Priority(opkind) == i)) { @@ -522,7 +522,7 @@ CExpression *CParser::Ex(int i) { e1 = new CIdentifierExpr(const_as_string,m_identifierContext); NextSym(); - + break; } case errorsym: @@ -536,7 +536,7 @@ CExpression *CParser::Ex(int i) errmsgval->Release(); //e1 = Error(errmsg->Calculate()->GetText());//new CConstExpr(errmsg->Calculate()); - + if ( !(errmsg->Release()) ) { errmsg=NULL; @@ -569,19 +569,19 @@ CExpression *CParser::Expr() CExpression* CParser::ProcessText (const char *intext) { - + // and parses the string in intext and returns it. - - + + CExpression* expr; text = intext; - - + + chcount = 0; if (text.Length() == 0) { return NULL; } - + ch = text[0]; /* if (ch != '=') { * expr = new CConstExpr(new CStringValue(text)); @@ -599,7 +599,7 @@ CExpression* CParser::ProcessText } if (errmsg) errmsg->Release(); - + return expr; } @@ -609,7 +609,7 @@ float CParser::GetFloat(STR_String& txt) { // returns parsed text into a float // empty string returns -1 - + // AfxMessageBox("parsed string="+txt); CValue* val=NULL; float result=-1; @@ -619,9 +619,9 @@ float CParser::GetFloat(STR_String& txt) if (expr) { val = expr->Calculate(); result=(float)val->GetNumber(); - - - + + + val->Release(); expr->Release(); } @@ -632,10 +632,10 @@ float CParser::GetFloat(STR_String& txt) CValue* CParser::GetValue(STR_String& txt, bool bFallbackToText) { - // returns parsed text into a value, + // returns parsed text into a value, // empty string returns NULL value ! // if bFallbackToText then unparsed stuff is put into text - + CValue* result=NULL; CExpression* expr = ProcessText(txt); if (expr) { diff --git a/source/gameengine/Expressions/intern/IntValue.cpp b/source/gameengine/Expressions/intern/IntValue.cpp index 7b2e841f13f..3315b3a3e3c 100644 --- a/source/gameengine/Expressions/intern/IntValue.cpp +++ b/source/gameengine/Expressions/intern/IntValue.cpp @@ -34,7 +34,7 @@ pre: false effect: constructs a new CIntValue */ { - + #ifdef DEBUG_ m_textval = "Int illegal constructor"; #endif @@ -59,13 +59,13 @@ CIntValue::CIntValue(cInt innie,const char *name,AllocationTYPE alloctype) { m_int = innie; SetName(name); - + if (alloctype==CValue::STACKVALUE) { CValue::DisableRefCount(); } m_pstrRep=NULL; - + } @@ -118,7 +118,7 @@ object and val CValue* CIntValue::CalcFinal(VALUE_DATA_TYPE dtype, VALUE_OPERATOR op, CValue *val) { CValue *ret; - + switch (dtype) { case VALUE_EMPTY_TYPE: case VALUE_INT_TYPE: @@ -312,7 +312,7 @@ const STR_String & CIntValue::GetText() if (!m_pstrRep) m_pstrRep=new STR_String(); m_pstrRep->Format("%lld",m_int); - + return *m_pstrRep; } @@ -323,15 +323,15 @@ CValue* CIntValue::GetReplica() CIntValue* replica = new CIntValue(*this); replica->ProcessReplica(); replica->m_pstrRep = NULL; - + return replica; } void CIntValue::SetValue(CValue* newval) -{ - m_int = (cInt)newval->GetNumber(); +{ + m_int = (cInt)newval->GetNumber(); SetModified(true); } diff --git a/source/gameengine/Expressions/intern/ListValue.cpp b/source/gameengine/Expressions/intern/ListValue.cpp index 557ce7be300..ce45c6cf8f5 100644 --- a/source/gameengine/Expressions/intern/ListValue.cpp +++ b/source/gameengine/Expressions/intern/ListValue.cpp @@ -290,7 +290,7 @@ static Py_ssize_t listvalue_bufferlen(PyObject *self) CListValue *list= static_cast(BGE_PROXY_REF(self)); if (list==NULL) return 0; - + return (Py_ssize_t)list->GetCount(); } @@ -298,24 +298,24 @@ static PyObject *listvalue_buffer_item(PyObject *self, Py_ssize_t index) { CListValue *list= static_cast(BGE_PROXY_REF(self)); CValue *cval; - + if (list==NULL) { PyErr_SetString(PyExc_SystemError, "val = CList[i], " BGE_PROXY_ERROR_MSG); return NULL; } - + int count = list->GetCount(); - + if (index < 0) index = count+index; - + if (index < 0 || index >= count) { PyErr_SetString(PyExc_IndexError, "CList[i]: Python ListIndex out of range in CValueList"); return NULL; } - + cval= list->GetValue(index); - + PyObject *pyobj = cval->ConvertValueToPython(); if (pyobj) return pyobj; @@ -360,7 +360,7 @@ static PyObject *listvalue_mapping_subscript(PyObject *self, PyObject *key) PyErr_SetString(PyExc_SystemError, "value = CList[i], " BGE_PROXY_ERROR_MSG); return NULL; } - + if (PyUnicode_Check(key)) { CValue *item = ((CListValue*) list)->FindValue(_PyUnicode_AsString(key)); if (item) { @@ -403,37 +403,37 @@ static PyObject *listvalue_buffer_concat(PyObject *self, PyObject *other) { CListValue *listval= static_cast(BGE_PROXY_REF(self)); Py_ssize_t i, numitems, numitems_orig; - + if (listval==NULL) { PyErr_SetString(PyExc_SystemError, "CList+other, " BGE_PROXY_ERROR_MSG); return NULL; } - + numitems_orig= listval->GetCount(); - + // for now, we support CListValue concatenated with items // and CListValue concatenated to Python Lists // and CListValue concatenated with another CListValue - + /* Shallow copy, don't use listval->GetReplica(), it will screw up with KX_GameObjects */ CListValue* listval_new = new CListValue(); - + if (PyList_Check(other)) { CValue* listitemval; bool error = false; - + numitems = PyList_GET_SIZE(other); - + /* copy the first part of the list */ listval_new->Resize(numitems_orig + numitems); for (i=0;iSetValue(i, listval->GetValue(i)->AddRef()); - + for (i=0;iConvertPythonToValue(PyList_GET_ITEM(other, i), true, "cList + pyList: CListValue, "); - + if (listitemval) { listval_new->SetValue(i+numitems_orig, listitemval); } else { @@ -441,13 +441,13 @@ static PyObject *listvalue_buffer_concat(PyObject *self, PyObject *other) break; } } - + if (error) { listval_new->Resize(numitems_orig+i); /* resize so we don't try release NULL pointers */ listval_new->Release(); - return NULL; /* ConvertPythonToValue above sets the error */ + return NULL; /* ConvertPythonToValue above sets the error */ } - + } else if (PyObject_TypeCheck(other, &CListValue::Type)) { // add items from otherlist to this list @@ -457,18 +457,18 @@ static PyObject *listvalue_buffer_concat(PyObject *self, PyObject *other) PyErr_SetString(PyExc_SystemError, "CList+other, " BGE_PROXY_ERROR_MSG); return NULL; } - + numitems = otherval->GetCount(); - + /* copy the first part of the list */ listval_new->Resize(numitems_orig + numitems); /* resize so we don't try release NULL pointers */ for (i=0;iSetValue(i, listval->GetValue(i)->AddRef()); - + /* now copy the other part of the list */ for (i=0;iSetValue(i+numitems_orig, otherval->GetValue(i)->AddRef()); - + } return listval_new->NewProxy(true); /* python owns this list */ } @@ -476,12 +476,12 @@ static PyObject *listvalue_buffer_concat(PyObject *self, PyObject *other) static int listvalue_buffer_contains(PyObject *self_v, PyObject *value) { CListValue *self = static_cast(BGE_PROXY_REF(self_v)); - + if (self == NULL) { PyErr_SetString(PyExc_SystemError, "val in CList, " BGE_PROXY_ERROR_MSG); return -1; } - + if (PyUnicode_Check(value)) { if (self->FindValue((const char *)_PyUnicode_AsString(value))) { return 1; @@ -492,9 +492,9 @@ static int listvalue_buffer_contains(PyObject *self_v, PyObject *value) for (int i=0; i < self->GetCount(); i++) if (self->GetValue(i) == item) // Com return 1; - + } // not using CheckEqual - + return 0; } diff --git a/source/gameengine/Expressions/intern/Operator1Expr.cpp b/source/gameengine/Expressions/intern/Operator1Expr.cpp index add0376f487..11bb2c06caf 100644 --- a/source/gameengine/Expressions/intern/Operator1Expr.cpp +++ b/source/gameengine/Expressions/intern/Operator1Expr.cpp @@ -63,7 +63,7 @@ ret: a new object containing the result of applying the operator m_op to the ret = empty->Calc(m_op, temp); empty->Release(); temp->Release(); - + return ret; } @@ -74,10 +74,10 @@ bool COperator1Expr::IsInside(float x, float y, float z,bool bBorderInclude) bool result = true; switch (m_op) { - + case VALUE_ADD_OPERATOR: { - + if (m_lhs) { result = result || m_lhs->IsInside(x,y,z,bBorderInclude); @@ -116,7 +116,7 @@ CExpression* COperator1Expr::CheckLink(std::vector& brokenlink // changed //numchanges++; newlhs->AddRef(); - + //m_lhs->Release(); brokenlinks.push_back(new CBrokenLinkInfo(&m_lhs,m_lhs)); @@ -129,7 +129,7 @@ CExpression* COperator1Expr::CheckLink(std::vector& brokenlink return Release(); } - + } void COperator1Expr::BroadcastOperators(VALUE_OPERATOR op) @@ -145,7 +145,7 @@ bool COperator1Expr::MergeExpression(CExpression *otherexpr) { if (m_lhs) return m_lhs->MergeExpression(otherexpr); - + assertd(false); // should not get here, expression is not compatible for merge return false; } diff --git a/source/gameengine/Expressions/intern/Operator2Expr.cpp b/source/gameengine/Expressions/intern/Operator2Expr.cpp index 0a7f30b8cc8..aaf6f49943d 100644 --- a/source/gameengine/Expressions/intern/Operator2Expr.cpp +++ b/source/gameengine/Expressions/intern/Operator2Expr.cpp @@ -28,7 +28,7 @@ ////////////////////////////////////////////////////////////////////// COperator2Expr::COperator2Expr(VALUE_OPERATOR op, CExpression *lhs, CExpression *rhs) -: +: m_rhs(rhs), m_lhs(lhs), m_cached_calculate(NULL), @@ -51,7 +51,7 @@ pre: effect: constucts an empty COperator2Expr */ { - + } COperator2Expr::~COperator2Expr() @@ -66,7 +66,7 @@ effect: deletes the object m_rhs->Release(); if (m_cached_calculate) m_cached_calculate->Release(); - + } CValue* COperator2Expr::Calculate() /* @@ -75,11 +75,11 @@ ret: a new object containing the result of applying operator m_op to m_lhs and m_rhs */ { - + bool leftmodified,rightmodified; leftmodified = m_lhs->NeedsRecalculated(); rightmodified = m_rhs->NeedsRecalculated(); - + // if no modifications on both left and right subtree, and result is already calculated // then just return cached result... if (!leftmodified && !rightmodified && (m_cached_calculate)) @@ -87,30 +87,30 @@ and m_rhs // not modified, just return m_cached_calculate } else { // if not yet calculated, or modified... - - + + if (m_cached_calculate) { m_cached_calculate->Release(); m_cached_calculate=NULL; } - + CValue* ffleft = m_lhs->Calculate(); CValue* ffright = m_rhs->Calculate(); - + ffleft->SetOwnerExpression(this);//->m_pOwnerExpression=this; ffright->SetOwnerExpression(this);//->m_pOwnerExpression=this; - + m_cached_calculate = ffleft->Calc(m_op,ffright); - + //if (m_cached_calculate) // m_cached_calculate->Action(CValue::SETOWNEREXPR,&CVoidValue(this,false,CValue::STACKVALUE)); ffleft->Release(); ffright->Release(); } - + return m_cached_calculate->AddRef(); - + } #if 0 @@ -118,7 +118,7 @@ bool COperator2Expr::IsInside(float x, float y, float z,bool bBorderInclude) { bool inside; inside = false; - + switch (m_op) { case VALUE_ADD_OPERATOR: { @@ -164,7 +164,7 @@ bool COperator2Expr::IsInside(float x, float y, float z,bool bBorderInclude) // not yet implemented, only add or sub csg operations } } - + return inside; } @@ -193,7 +193,7 @@ bool COperator2Expr::NeedsRecalculated() return m_lhs->NeedsRecalculated(); //modleft = m_lhs->NeedsRecalculated(); //return (modleft || modright); - + } @@ -213,7 +213,7 @@ CExpression* COperator2Expr::CheckLink(std::vector& brokenlink /* if (m_cached_calculate) m_cached_calculate->Action(CValue::REFRESH_CACHE); - + CExpression* newlhs = m_lhs->CheckLink(brokenlinks); CExpression* newrhs = m_rhs->CheckLink(brokenlinks); @@ -235,11 +235,11 @@ CExpression* COperator2Expr::CheckLink(std::vector& brokenlink if (m_lhs && m_rhs) { return this; } - + AddRef(); - if (m_lhs) + if (m_lhs) return Release(m_lhs->AddRef()); - + if (m_rhs) return Release(m_rhs->AddRef()); / diff --git a/source/gameengine/Expressions/intern/PyObjectPlus.cpp b/source/gameengine/Expressions/intern/PyObjectPlus.cpp index 1e4a59aeb5c..317faac7fa9 100644 --- a/source/gameengine/Expressions/intern/PyObjectPlus.cpp +++ b/source/gameengine/Expressions/intern/PyObjectPlus.cpp @@ -38,9 +38,9 @@ * Derived from work by * David Redish * graduate student - * Computer Science Department + * Computer Science Department * Carnegie Mellon University (CMU) - * Center for the Neural Basis of Cognition (CNBC) + * Center for the Neural Basis of Cognition (CNBC) * http://www.python.org/doc/PyCPP.html * * ----------------------------- */ @@ -141,7 +141,7 @@ PyObject *PyObjectPlus::py_base_repr(PyObject *self) // This should be the ent PyErr_SetString(PyExc_SystemError, BGE_PROXY_ERROR_MSG); return NULL; } - return self_plus->py_repr(); + return self_plus->py_repr(); } @@ -420,7 +420,7 @@ PyObject *PyObjectPlus::py_get_attrdef(PyObject *self_py, const PyAttributeDef * return PyFloat_FromDouble(*val); } else { // vector, verify size - if (attrdef->m_size != attrdef->m_imax*sizeof(float)) + if (attrdef->m_size != attrdef->m_imax*sizeof(float)) { return NULL; } @@ -437,7 +437,7 @@ PyObject *PyObjectPlus::py_get_attrdef(PyObject *self_py, const PyAttributeDef * } } else { // matrix case - if (attrdef->m_size != attrdef->m_imax*attrdef->m_imin*sizeof(float)) + if (attrdef->m_size != attrdef->m_imax*attrdef->m_imin*sizeof(float)) { return NULL; } @@ -530,11 +530,11 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt size_t bufferSize = 0; PyObject *item = NULL; // to store object that must be dereferenced in case of error PyObject *list = NULL; // to store object that must be dereferenced in case of error - + ptr += attrdef->m_offset; if (attrdef->m_length > 1) { - if (!PySequence_Check(value)) + if (!PySequence_Check(value)) { PyErr_Format(PyExc_TypeError, "expected a sequence for attribute \"%s\"", attrdef->m_name); return PY_SET_ATTR_FAIL; @@ -544,10 +544,10 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt PyErr_Format(PyExc_TypeError, "incorrect number of elements in sequence for attribute \"%s\"", attrdef->m_name); return PY_SET_ATTR_FAIL; } - switch (attrdef->m_type) + switch (attrdef->m_type) { case KX_PYATTRIBUTE_TYPE_FUNCTION: - if (attrdef->m_setFunction == NULL) + if (attrdef->m_setFunction == NULL) { PyErr_Format(PyExc_AttributeError, "function attribute without function for attribute \"%s\", report to blender.org", attrdef->m_name); return PY_SET_ATTR_FAIL; @@ -582,16 +582,16 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt for (int i=0; im_length; i++) { item = PySequence_GetItem(value, i); /* new ref */ - switch (attrdef->m_type) + switch (attrdef->m_type) { case KX_PYATTRIBUTE_TYPE_BOOL: { bool *var = reinterpret_cast(ptr); ptr += sizeof(bool); - if (PyLong_Check(item)) + if (PyLong_Check(item)) { *var = (PyLong_AsLong(item) != 0); - } + } else if (PyBool_Check(item)) { *var = (item == Py_True); @@ -607,7 +607,7 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt { short int *var = reinterpret_cast(ptr); ptr += sizeof(short int); - if (PyLong_Check(item)) + if (PyLong_Check(item)) { int val = PyLong_AsLong(item); if (attrdef->m_clamp) @@ -643,7 +643,7 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt { int *var = reinterpret_cast(ptr); ptr += sizeof(int); - if (PyLong_Check(item)) + if (PyLong_Check(item)) { int val = PyLong_AsLong(item); if (attrdef->m_clamp) @@ -709,7 +709,7 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt // if the checing function didnt set an error then set a generic one here so we don't set an error with no exception if (PyErr_Occurred()==0) PyErr_Format(PyExc_AttributeError, "type check error for attribute \"%s\", reasion unknown", attrdef->m_name); - + // post check returned an error, restore values UNDO_AND_ERROR: if (undoBuffer) @@ -741,7 +741,7 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt { // post check function is provided, prepare undo buffer sourceBuffer = ptr; - switch (attrdef->m_type) + switch (attrdef->m_type) { case KX_PYATTRIBUTE_TYPE_BOOL: bufferSize = sizeof(bool); @@ -785,16 +785,16 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt } } } - - switch (attrdef->m_type) + + switch (attrdef->m_type) { case KX_PYATTRIBUTE_TYPE_BOOL: { bool *var = reinterpret_cast(ptr); - if (PyLong_Check(value)) + if (PyLong_Check(value)) { *var = (PyLong_AsLong(value) != 0); - } + } else if (PyBool_Check(value)) { *var = (value == Py_True); @@ -809,10 +809,10 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt case KX_PYATTRIBUTE_TYPE_FLAG: { bool bval; - if (PyLong_Check(value)) + if (PyLong_Check(value)) { bval = (PyLong_AsLong(value) != 0); - } + } else if (PyBool_Check(value)) { bval = (value == Py_True); @@ -852,7 +852,7 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt case KX_PYATTRIBUTE_TYPE_SHORT: { short int *var = reinterpret_cast(ptr); - if (PyLong_Check(value)) + if (PyLong_Check(value)) { int val = PyLong_AsLong(value); if (attrdef->m_clamp) @@ -887,7 +887,7 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt case KX_PYATTRIBUTE_TYPE_INT: { int *var = reinterpret_cast(ptr); - if (PyLong_Check(value)) + if (PyLong_Check(value)) { int val = PyLong_AsLong(value); if (attrdef->m_clamp) @@ -914,14 +914,14 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt case KX_PYATTRIBUTE_TYPE_FLOAT: { float *var = reinterpret_cast(ptr); - if (attrdef->m_imin != 0) + if (attrdef->m_imin != 0) { - if (attrdef->m_size != attrdef->m_imin*attrdef->m_imax*sizeof(float)) + if (attrdef->m_size != attrdef->m_imin*attrdef->m_imax*sizeof(float)) { PyErr_Format(PyExc_TypeError, "internal error: incorrect field size for attribute \"%s\"", attrdef->m_name); goto FREE_AND_ERROR; } - if (!PySequence_Check(value) || PySequence_Size(value) != attrdef->m_imin) + if (!PySequence_Check(value) || PySequence_Size(value) != attrdef->m_imin) { PyErr_Format(PyExc_TypeError, "expected a sequence of [%d][%d] floats for attribute \"%s\"", attrdef->m_imin, attrdef->m_imax, attrdef->m_name); goto FREE_AND_ERROR; @@ -929,7 +929,7 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt for (int i=0; im_imin; i++) { PyObject *list = PySequence_GetItem(value, i); /* new ref */ - if (!PySequence_Check(list) || PySequence_Size(list) != attrdef->m_imax) + if (!PySequence_Check(list) || PySequence_Size(list) != attrdef->m_imax) { PyErr_Format(PyExc_TypeError, "expected a sequence of [%d][%d] floats for attribute \"%s\"", attrdef->m_imin, attrdef->m_imax, attrdef->m_name); goto RESTORE_AND_ERROR; @@ -949,15 +949,15 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt Py_DECREF(list); list = NULL; } - } - else if (attrdef->m_imax != 0) + } + else if (attrdef->m_imax != 0) { - if (attrdef->m_size != attrdef->m_imax*sizeof(float)) + if (attrdef->m_size != attrdef->m_imax*sizeof(float)) { PyErr_Format(PyExc_TypeError, "internal error: incorrect field size for attribute \"%s\"", attrdef->m_name); goto FREE_AND_ERROR; } - if (!PySequence_Check(value) || PySequence_Size(value) != attrdef->m_imax) + if (!PySequence_Check(value) || PySequence_Size(value) != attrdef->m_imax) { PyErr_Format(PyExc_TypeError, "expected a sequence of [%d] floats for attribute \"%s\"", attrdef->m_imax, attrdef->m_name); goto FREE_AND_ERROR; @@ -973,7 +973,7 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt item = NULL; ++var; } - } + } else { if (!py_check_attr_float(var, value, attrdef)) @@ -983,7 +983,7 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt } case KX_PYATTRIBUTE_TYPE_VECTOR: { - if (!PySequence_Check(value) || PySequence_Size(value) != 3) + if (!PySequence_Check(value) || PySequence_Size(value) != 3) { PyErr_Format(PyExc_TypeError, "expected a sequence of 3 floats for attribute \"%s\"", attrdef->m_name); goto FREE_AND_ERROR; @@ -1018,7 +1018,7 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt } case KX_PYATTRIBUTE_TYPE_CHAR: { - if (PyUnicode_Check(value)) + if (PyUnicode_Check(value)) { Py_ssize_t val_size; const char *val = _PyUnicode_AsStringAndSize(value, &val_size); @@ -1035,7 +1035,7 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt case KX_PYATTRIBUTE_TYPE_STRING: { STR_String *var = reinterpret_cast(ptr); - if (PyUnicode_Check(value)) + if (PyUnicode_Check(value)) { Py_ssize_t val_len; const char *val = _PyUnicode_AsStringAndSize(value, &val_len); /* XXX, should be 'const' but we do a silly trick to have a shorter string */ @@ -1134,7 +1134,7 @@ PyObject *PyObjectPlus::GetProxyPlus_Ext(PyObjectPlus *self, PyTypeObject *tp, v } //PyObject_Print(self->m_proxy, stdout, 0); //printf("ref %d\n", self->m_proxy->ob_refcnt); - + BGE_PROXY_REF(self->m_proxy) = self; /* Its possible this was set to NULL, so set it back here */ BGE_PROXY_PTR(self->m_proxy) = ptr; Py_INCREF(self->m_proxy); /* we own one, thos ones fore the return */ @@ -1143,13 +1143,13 @@ PyObject *PyObjectPlus::GetProxyPlus_Ext(PyObjectPlus *self, PyTypeObject *tp, v PyObject *PyObjectPlus::NewProxyPlus_Ext(PyObjectPlus *self, PyTypeObject *tp, void *ptr, bool py_owns) { - if (!self) + if (!self) { // in case of proxy without reference to game object PyObject *proxy = reinterpret_castPyObject_NEW( PyObjectPlus_Proxy, tp); BGE_PROXY_PYREF(proxy) = false; BGE_PROXY_PYOWNS(proxy) = py_owns; - BGE_PROXY_REF(proxy) = NULL; + BGE_PROXY_REF(proxy) = NULL; BGE_PROXY_PTR(proxy) = ptr; #ifdef USE_WEAKREFS BGE_PROXY_WKREF(proxy) = NULL; @@ -1168,9 +1168,9 @@ PyObject *PyObjectPlus::NewProxyPlus_Ext(PyObjectPlus *self, PyTypeObject *tp, v Py_INCREF(self->m_proxy); return self->m_proxy; } - + } - + GetProxyPlus_Ext(self, tp, ptr); if (py_owns) { BGE_PROXY_PYOWNS(self->m_proxy) = py_owns; @@ -1204,7 +1204,7 @@ void PyObjectPlus::ClearDeprecationWarning() { WarnLink *wlink_next; WarnLink *wlink = GetDeprecationWarningLinkFirst(); - + while (wlink) { wlink->warn_done= false; /* no need to NULL the link, its cleared before adding to the list next time round */ wlink_next= reinterpret_cast(wlink->link); diff --git a/source/gameengine/Expressions/intern/StringValue.cpp b/source/gameengine/Expressions/intern/StringValue.cpp index ddf61dc441c..8b979b2af0c 100644 --- a/source/gameengine/Expressions/intern/StringValue.cpp +++ b/source/gameengine/Expressions/intern/StringValue.cpp @@ -41,14 +41,14 @@ CStringValue::CStringValue(const char *txt,const char *name,AllocationTYPE alloc { m_strString = txt; SetName(name); - + if (alloctype==CValue::STACKVALUE) { CValue::DisableRefCount(); - + } - - + + } @@ -71,7 +71,7 @@ CValue* CStringValue::Calc(VALUE_OPERATOR op, CValue *val) CValue* CStringValue::CalcFinal(VALUE_DATA_TYPE dtype, VALUE_OPERATOR op, CValue *val) { CValue *ret; - + if (op == VALUE_ADD_OPERATOR) { if (dtype == VALUE_ERROR_TYPE) ret = new CErrorValue(val->GetText() + op2str(op) + GetText()); @@ -138,7 +138,7 @@ bool CStringValue::IsEqual(const STR_String & other) } CValue* CStringValue::GetReplica() -{ +{ CStringValue* replica = new CStringValue(*this); replica->ProcessReplica(); return replica; diff --git a/source/gameengine/Expressions/intern/Value.cpp b/source/gameengine/Expressions/intern/Value.cpp index f8796a76e76..9b42bdb7bff 100644 --- a/source/gameengine/Expressions/intern/Value.cpp +++ b/source/gameengine/Expressions/intern/Value.cpp @@ -70,7 +70,7 @@ PyMethodDef CValue::Methods[] = { /*#define CVALUE_DEBUG*/ #ifdef CVALUE_DEBUG int gRefCount; -struct SmartCValueRef +struct SmartCValueRef { CValue *m_ref; int m_count; @@ -92,7 +92,7 @@ std::vector gRefList; CValue::CValue() : PyObjectPlus(), - + m_pNamedPropertyArray(NULL), m_refcount(1) /* @@ -148,7 +148,7 @@ STR_String CValue::op2str(VALUE_OPERATOR op) { //pre: //ret: the stringrepresentation of operator op - + STR_String opmsg; switch (op) { case VALUE_MOD_OPERATOR: @@ -225,7 +225,7 @@ void CValue::SetProperty(const STR_String & name,CValue* ioProperty) else { // Make sure we have a property array m_pNamedPropertyArray = new std::map; } - + // Add property at end of array (*m_pNamedPropertyArray)[name] = ioProperty->AddRef();//->Add(ioProperty); } @@ -247,7 +247,7 @@ void CValue::SetProperty(const char* name,CValue* ioProperty) else { // Make sure we have a property array m_pNamedPropertyArray = new std::map; } - + // Add property at end of array (*m_pNamedPropertyArray)[name] = ioProperty->AddRef();//->Add(ioProperty); } @@ -293,7 +293,7 @@ float CValue::GetPropertyNumber(const STR_String& inName,float defnumber) { CValue *property = GetProperty(inName); if (property) - return property->GetNumber(); + return property->GetNumber(); else return defnumber; } @@ -316,7 +316,7 @@ bool CValue::RemoveProperty(const char *inName) return true; } } - + return false; } @@ -328,7 +328,7 @@ vector CValue::GetPropertyNames() vector result; if (!m_pNamedPropertyArray) return result; result.reserve(m_pNamedPropertyArray->size()); - + std::map::iterator it; for (it= m_pNamedPropertyArray->begin(); (it != m_pNamedPropertyArray->end()); it++) { @@ -369,7 +369,7 @@ void CValue::SetPropertiesModified(bool inModified) { if (!m_pNamedPropertyArray) return; std::map::iterator it; - + for (it= m_pNamedPropertyArray->begin();(it != m_pNamedPropertyArray->end()); it++) ((*it).second)->SetModified(inModified); } @@ -383,11 +383,11 @@ bool CValue::IsAnyPropertyModified() { if (!m_pNamedPropertyArray) return false; std::map::iterator it; - + for (it= m_pNamedPropertyArray->begin();(it != m_pNamedPropertyArray->end()); it++) if (((*it).second)->IsModified()) return true; - + return false; } @@ -471,7 +471,7 @@ void CValue::DisableRefCount() void CValue::ProcessReplica() /* was AddDataToReplica in 2.48 */ { m_refcount = 1; - + #ifdef DEBUG //gRefCountValue++; #endif @@ -518,7 +518,7 @@ CValue* CValue::FindIdentifier(const STR_String& identifiername) if (tempresult) { result=tempresult->FindIdentifier(rightstring); - } + } } else { result = GetProperty(identifiername); @@ -666,7 +666,7 @@ void CValue::SetColorOperator(VALUE_OPERATOR op) /* intentionally empty */ } void CValue::SetValue(CValue* newval) -{ +{ // no one should get here assertd(newval->GetNumber() == 10121969); } diff --git a/source/gameengine/Expressions/intern/VectorValue.cpp b/source/gameengine/Expressions/intern/VectorValue.cpp index a3d44116317..dcb1f11ad1a 100644 --- a/source/gameengine/Expressions/intern/VectorValue.cpp +++ b/source/gameengine/Expressions/intern/VectorValue.cpp @@ -36,51 +36,51 @@ CVectorValue::CVectorValue(float x,float y,float z, AllocationTYPE alloctype) { SetCustomFlag1(false);//FancyOutput=false; - + if (alloctype == STACKVALUE) { CValue::DisableRefCount(); }; - + m_vec[KX_X] = m_transformedvec[KX_X] = x; m_vec[KX_Y] = m_transformedvec[KX_Y] = y; m_vec[KX_Z] = m_transformedvec[KX_Z] = z; - + } CVectorValue::CVectorValue(double vec[3], const char *name,AllocationTYPE alloctype) { - + SetCustomFlag1(false);//FancyOutput=false; - + m_vec[KX_X] = m_transformedvec[KX_X] = vec[KX_X]; m_vec[KX_Y] = m_transformedvec[KX_Y] = vec[KX_Y]; m_vec[KX_Z] = m_transformedvec[KX_Z] = vec[KX_Z]; - + if (alloctype == STACKVALUE) { CValue::DisableRefCount(); - + } - + SetName(name); } CVectorValue::CVectorValue(double vec[3], AllocationTYPE alloctype) { - + SetCustomFlag1(false);//FancyOutput=false; - + m_vec[KX_X] = m_transformedvec[KX_X] = vec[KX_X]; m_vec[KX_Y] = m_transformedvec[KX_Y] = vec[KX_Y]; m_vec[KX_Z] = m_transformedvec[KX_Z] = vec[KX_Z]; - + if (alloctype == STACKVALUE) { CValue::DisableRefCount(); - + } - - + + } CVectorValue::~CVectorValue() { @@ -95,7 +95,7 @@ CVectorValue::~CVectorValue() CValue* CVectorValue::CalcFinal(VALUE_DATA_TYPE dtype, VALUE_OPERATOR op, CValue *val) { CValue *ret = NULL; - + switch (op) { case VALUE_ADD_OPERATOR: { @@ -122,7 +122,7 @@ CValue* CVectorValue::CalcFinal(VALUE_DATA_TYPE dtype, VALUE_OPERATOR op, CValue { switch (dtype) { - + case VALUE_EMPTY_TYPE: case VALUE_VECTOR_TYPE: { @@ -152,7 +152,7 @@ CValue* CVectorValue::CalcFinal(VALUE_DATA_TYPE dtype, VALUE_OPERATOR op, CValue ret = new CErrorValue(val->GetText() + op2str(op) + GetText()); } - + return ret; } @@ -174,7 +174,7 @@ double* CVectorValue::GetVector3(bool bGetTransformedVec) { if (bGetTransformedVec) return m_transformedvec; - // else + // else return m_vec; } @@ -187,19 +187,19 @@ void CVectorValue::SetVector(double newvec[]) m_vec[KX_X] = m_transformedvec[KX_X] = newvec[KX_X]; m_vec[KX_Y] = m_transformedvec[KX_Y] = newvec[KX_Y]; m_vec[KX_Z] = m_transformedvec[KX_Z] = newvec[KX_Z]; - + SetModified(true); } void CVectorValue::SetValue(CValue *newval) { - + double* newvec = ((CVectorValue*)newval)->GetVector3(); m_vec[KX_X] = m_transformedvec[KX_X] = newvec[KX_X]; m_vec[KX_Y] = m_transformedvec[KX_Y] = newvec[KX_Y]; m_vec[KX_Z] = m_transformedvec[KX_Z] = newvec[KX_Z]; - + SetModified(true); } diff --git a/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp b/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp index 9f532527a80..369ec4257cf 100644 --- a/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp +++ b/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp @@ -59,10 +59,10 @@ SCA_Joystick::SCA_Joystick(short int index) { for (int i=0; i < JOYAXIS_MAX; i++) m_axis_array[i] = 0; - + for (int i=0; i < JOYHAT_MAX; i++) m_hat_array[i] = 0; - + #ifdef WITH_SDL m_private = new PrivateData(); #endif @@ -94,7 +94,7 @@ SCA_Joystick *SCA_Joystick::GetInstance( short int joyindex ) return NULL; } - if (m_refCount == 0) + if (m_refCount == 0) { int i; @@ -124,9 +124,9 @@ SCA_Joystick *SCA_Joystick::GetInstance( short int joyindex ) JOYSTICK_ECHO("Error-Initializing-SDL: " << SDL_GetError()); return NULL; } - + m_joynum = SDL_NumJoysticks(); - + for (i = 0; i < m_joynum; i++) { m_instance[i] = new SCA_Joystick(i); m_instance[i]->CreateJoystickDevice(); @@ -189,7 +189,7 @@ bool SCA_Joystick::aAxisPairDirectionIsPositive(int axis, int dir) res = pGetAxis(axis, 1); else /* JOYAXIS_LEFT || JOYAXIS_RIGHT */ res = pGetAxis(axis, 0); - + if (dir==JOYAXIS_DOWN || dir==JOYAXIS_RIGHT) return (res > m_prec) ? true : false; else /* JOYAXIS_UP || JOYAXIS_LEFT */ @@ -273,7 +273,7 @@ bool SCA_Joystick::CreateJoystickDevice(void) if (m_joyindex>=m_joynum) { /* don't print a message, because this is done anyway */ //JOYSTICK_ECHO("Joystick-Error: " << SDL_NumJoysticks() << " avaiable joystick(s)"); - + /* Need this so python args can return empty lists */ m_axismax = m_buttonmax = m_hatmax = 0; return false; @@ -282,9 +282,9 @@ bool SCA_Joystick::CreateJoystickDevice(void) m_private->m_joystick = SDL_JoystickOpen(m_joyindex); SDL_JoystickEventState(SDL_ENABLE); m_isinit = true; - + JOYSTICK_ECHO("Joystick " << m_joyindex << " initialized"); - + /* must run after being initialized */ m_axismax = SDL_JoystickNumAxes(m_private->m_joystick); m_buttonmax = SDL_JoystickNumButtons(m_private->m_joystick); @@ -292,12 +292,12 @@ bool SCA_Joystick::CreateJoystickDevice(void) if (m_axismax > JOYAXIS_MAX) m_axismax = JOYAXIS_MAX; /* very unlikely */ else if (m_axismax < 0) m_axismax = 0; - + if (m_hatmax > JOYHAT_MAX) m_hatmax = JOYHAT_MAX; /* very unlikely */ else if (m_hatmax < 0) m_hatmax = 0; - + if (m_buttonmax < 0) m_buttonmax = 0; - + } return true; #endif /* WITH_SDL */ @@ -355,7 +355,7 @@ int SCA_Joystick::pAxisTest(int axisnum) * than what a short can hold. In other words, abs(MIN_SHORT) > MAX_SHRT. */ int i1 = m_axis_array[(axisnum * 2)]; int i2 = m_axis_array[(axisnum * 2) + 1]; - + /* long winded way to do: * return max_ff(absf(i1), absf(i2)) * ...avoid abs from math.h */ diff --git a/source/gameengine/GameLogic/Joystick/SCA_Joystick.h b/source/gameengine/GameLogic/Joystick/SCA_Joystick.h index c9221753d45..98b117b70d1 100644 --- a/source/gameengine/GameLogic/Joystick/SCA_Joystick.h +++ b/source/gameengine/GameLogic/Joystick/SCA_Joystick.h @@ -68,16 +68,16 @@ class SCA_Joystick #endif int m_joyindex; - /** + /** *support for JOYAXIS_MAX axes (in pairs) */ int m_axis_array[JOYAXIS_MAX]; - /** + /** *support for JOYHAT_MAX hats (each is a direction) */ int m_hat_array[JOYHAT_MAX]; - + /** * Precision or range of the axes */ @@ -86,15 +86,15 @@ class SCA_Joystick /** * max # of buttons avail */ - + int m_axismax; int m_buttonmax; int m_hatmax; - + /** is the joystick initialized ?*/ bool m_isinit; - + /** is triggered for each event type */ bool m_istrig_axis; bool m_istrig_button; @@ -112,7 +112,7 @@ class SCA_Joystick #if 0 /* not used yet */ void OnBallMotion(SDL_Event *sdl_event) {} #endif - + #endif /* WITH_SDL */ /** * Open the joystick @@ -142,13 +142,13 @@ class SCA_Joystick SCA_Joystick(short int index); ~SCA_Joystick(); - + public: static SCA_Joystick *GetInstance(short int joyindex); static void HandleEvents(void); void ReleaseInstance(); - + /* */ @@ -182,11 +182,11 @@ public: bool IsTrigAxis(void) { return m_istrig_axis; } - + bool IsTrigButton(void) { return m_istrig_button; } - + bool IsTrigHat(void) { return m_istrig_hat; } @@ -198,7 +198,7 @@ public: int GetNumberOfAxes(void); int GetNumberOfButtons(void); int GetNumberOfHats(void); - + /** * Test if the joystick is connected */ diff --git a/source/gameengine/GameLogic/Joystick/SCA_JoystickEvents.cpp b/source/gameengine/GameLogic/Joystick/SCA_JoystickEvents.cpp index 1dee1de9de2..b1ce31662ed 100644 --- a/source/gameengine/GameLogic/Joystick/SCA_JoystickEvents.cpp +++ b/source/gameengine/GameLogic/Joystick/SCA_JoystickEvents.cpp @@ -41,7 +41,7 @@ void SCA_Joystick::OnAxisMotion(SDL_Event* sdl_event) { if (sdl_event->jaxis.axis >= JOYAXIS_MAX) return; - + m_axis_array[sdl_event->jaxis.axis] = sdl_event->jaxis.value; m_istrig_axis = 1; } @@ -68,7 +68,7 @@ void SCA_Joystick::OnButtonDown(SDL_Event* sdl_event) //if (sdl_event->jbutton.button > m_buttonmax) /* unsigned int so always above 0 */ // return; // sdl_event->jbutton.button; - + m_istrig_button = 1; } @@ -93,17 +93,17 @@ void SCA_Joystick::HandleEvents(void) if (SCA_Joystick::m_instance[i]) SCA_Joystick::m_instance[i]->OnNothing(&sdl_event); } - + while (SDL_PollEvent(&sdl_event)) { /* Note! m_instance[sdl_event.jaxis.which] * will segfault if over JOYINDEX_MAX, not too nice but what are the chances? */ - + /* Note!, with buttons, this wont care which button is pressed, * only to set 'm_istrig_button', actual pressed buttons are detected by SDL_JoystickGetButton */ - + /* Note!, if you manage to press and release a button within 1 logic tick * it wont work as it should */ - + switch (sdl_event.type) { case SDL_JOYAXISMOTION: SCA_Joystick::m_instance[sdl_event.jaxis.which]->OnAxisMotion(&sdl_event); diff --git a/source/gameengine/GameLogic/Joystick/SCA_JoystickPrivate.h b/source/gameengine/GameLogic/Joystick/SCA_JoystickPrivate.h index 472a7353190..ab42eb57079 100644 --- a/source/gameengine/GameLogic/Joystick/SCA_JoystickPrivate.h +++ b/source/gameengine/GameLogic/Joystick/SCA_JoystickPrivate.h @@ -24,7 +24,7 @@ * * ***** END GPL LICENSE BLOCK ***** */ - + /** \file SCA_JoystickPrivate.h * \ingroup gamelogic */ diff --git a/source/gameengine/GameLogic/SCA_ANDController.cpp b/source/gameengine/GameLogic/SCA_ANDController.cpp index 2cb7406779c..26380105e91 100644 --- a/source/gameengine/GameLogic/SCA_ANDController.cpp +++ b/source/gameengine/GameLogic/SCA_ANDController.cpp @@ -71,7 +71,7 @@ void SCA_ANDController::Trigger(SCA_LogicManager* logicmgr) break; } } - + for (vector::const_iterator i=m_linkedactuators.begin(); !(i==m_linkedactuators.end());i++) { diff --git a/source/gameengine/GameLogic/SCA_ActuatorSensor.cpp b/source/gameengine/GameLogic/SCA_ActuatorSensor.cpp index 8b7702228ce..03c142e8c14 100644 --- a/source/gameengine/GameLogic/SCA_ActuatorSensor.cpp +++ b/source/gameengine/GameLogic/SCA_ActuatorSensor.cpp @@ -96,7 +96,7 @@ bool SCA_ActuatorSensor::Evaluate() { bool result = m_actuator->IsActive(); bool reset = m_reset && m_level; - + m_reset = false; if (m_lastresult != result || m_midresult != result) { diff --git a/source/gameengine/GameLogic/SCA_ActuatorSensor.h b/source/gameengine/GameLogic/SCA_ActuatorSensor.h index 6005bd3ac6c..f728dc5c0ca 100644 --- a/source/gameengine/GameLogic/SCA_ActuatorSensor.h +++ b/source/gameengine/GameLogic/SCA_ActuatorSensor.h @@ -47,7 +47,7 @@ public: SCA_ActuatorSensor(class SCA_EventManager* eventmgr, SCA_IObject* gameobj, const STR_String& actname); - + virtual ~SCA_ActuatorSensor(); virtual CValue* GetReplica(); virtual void Init(); @@ -63,7 +63,7 @@ public: /* --------------------------------------------------------------------- */ static int CheckActuator(void *self, const PyAttributeDef*); - + #endif /* WITH_PYTHON */ }; diff --git a/source/gameengine/GameLogic/SCA_AlwaysSensor.cpp b/source/gameengine/GameLogic/SCA_AlwaysSensor.cpp index 1a6a82a33eb..28f8b2123e1 100644 --- a/source/gameengine/GameLogic/SCA_AlwaysSensor.cpp +++ b/source/gameengine/GameLogic/SCA_AlwaysSensor.cpp @@ -78,7 +78,7 @@ CValue* SCA_AlwaysSensor::GetReplica() bool SCA_AlwaysSensor::IsPositiveTrigger() -{ +{ return (m_invert ? false : true); } @@ -90,7 +90,7 @@ bool SCA_AlwaysSensor::Evaluate() //return true; /* even nicer ;) */ //return false; - + /* nicest ! */ bool result = m_alwaysresult; m_alwaysresult = false; diff --git a/source/gameengine/GameLogic/SCA_DelaySensor.cpp b/source/gameengine/GameLogic/SCA_DelaySensor.cpp index af751cffc2e..5222d1961af 100644 --- a/source/gameengine/GameLogic/SCA_DelaySensor.cpp +++ b/source/gameengine/GameLogic/SCA_DelaySensor.cpp @@ -85,7 +85,7 @@ CValue* SCA_DelaySensor::GetReplica() bool SCA_DelaySensor::IsPositiveTrigger() -{ +{ return (m_invert ? !m_lastResult : m_lastResult); } diff --git a/source/gameengine/GameLogic/SCA_DelaySensor.h b/source/gameengine/GameLogic/SCA_DelaySensor.h index 9b39de7e099..0544bfef8c4 100644 --- a/source/gameengine/GameLogic/SCA_DelaySensor.h +++ b/source/gameengine/GameLogic/SCA_DelaySensor.h @@ -41,7 +41,7 @@ class SCA_DelaySensor : public SCA_ISensor Py_Header bool m_lastResult; bool m_repeat; - int m_delay; + int m_delay; int m_duration; int m_frameCount; diff --git a/source/gameengine/GameLogic/SCA_EventManager.h b/source/gameengine/GameLogic/SCA_EventManager.h index eb9a6d9aca1..53cd16a810d 100644 --- a/source/gameengine/GameLogic/SCA_EventManager.h +++ b/source/gameengine/GameLogic/SCA_EventManager.h @@ -51,8 +51,8 @@ public: enum EVENT_MANAGER_TYPE { KEYBOARD_EVENTMGR = 0, MOUSE_EVENTMGR, - ALWAYS_EVENTMGR, - TOUCH_EVENTMGR, + ALWAYS_EVENTMGR, + TOUCH_EVENTMGR, PROPERTY_EVENTMGR, TIME_EVENTMGR, RANDOM_EVENTMGR, @@ -65,7 +65,7 @@ public: SCA_EventManager(SCA_LogicManager* logicmgr, EVENT_MANAGER_TYPE mgrtype); virtual ~SCA_EventManager(); - + virtual void RemoveSensor(class SCA_ISensor* sensor); virtual void NextFrame(double curtime, double fixedtime); virtual void NextFrame(); diff --git a/source/gameengine/GameLogic/SCA_ExpressionController.h b/source/gameengine/GameLogic/SCA_ExpressionController.h index c16944ccde1..993b3b67a96 100644 --- a/source/gameengine/GameLogic/SCA_ExpressionController.h +++ b/source/gameengine/GameLogic/SCA_ExpressionController.h @@ -51,7 +51,7 @@ public: virtual CValue* GetReplica(); virtual void Trigger(SCA_LogicManager* logicmgr); virtual CValue* FindIdentifier(const STR_String& identifiername); - /** + /** * used to release the expression cache * so that self references are removed before the controller itself is released */ diff --git a/source/gameengine/GameLogic/SCA_IActuator.cpp b/source/gameengine/GameLogic/SCA_IActuator.cpp index 9a355fdf3c9..ca67f5b672e 100644 --- a/source/gameengine/GameLogic/SCA_IActuator.cpp +++ b/source/gameengine/GameLogic/SCA_IActuator.cpp @@ -49,7 +49,7 @@ bool SCA_IActuator::Update(double curtime, bool frame) { if (frame) return Update(); - + return true; } @@ -99,7 +99,7 @@ SCA_IActuator::~SCA_IActuator() void SCA_IActuator::DecLink() { m_links--; - if (m_links < 0) + if (m_links < 0) { printf("Warning: actuator %s has negative m_links: %d\n", m_name.Ptr(), m_links); m_links = 0; @@ -123,8 +123,8 @@ void SCA_IActuator::UnlinkController(SCA_IController* controller) return; } } - printf("Missing link from actuator %s:%s to controller %s:%s\n", - m_gameobj->GetName().ReadPtr(), GetName().ReadPtr(), + printf("Missing link from actuator %s:%s to controller %s:%s\n", + m_gameobj->GetName().ReadPtr(), GetName().ReadPtr(), controller->GetParent()->GetName().ReadPtr(), controller->GetName().ReadPtr()); } diff --git a/source/gameengine/GameLogic/SCA_IActuator.h b/source/gameengine/GameLogic/SCA_IActuator.h index b63cb633b4e..bca0b1ad764 100644 --- a/source/gameengine/GameLogic/SCA_IActuator.h +++ b/source/gameengine/GameLogic/SCA_IActuator.h @@ -92,7 +92,7 @@ public: KX_ACT_MOUSE, }; - SCA_IActuator(SCA_IObject* gameobj, KX_ACTUATOR_TYPE type); + SCA_IActuator(SCA_IObject* gameobj, KX_ACTUATOR_TYPE type); /** * UnlinkObject(...) @@ -105,11 +105,11 @@ public: /** * Update(...) - * Update the actuator based upon the events received since + * Update the actuator based upon the events received since * the last call to Update, the current time and deltatime the * time elapsed in this frame ? * It is the responsibility of concrete Actuators to clear - * their event's. This is usually done in the Update() method via + * their event's. This is usually done in the Update() method via * a call to RemoveAllEvents() */ @@ -117,9 +117,9 @@ public: virtual bool Update(double curtime, bool frame); virtual bool Update(); - /** + /** * Add an event to an actuator. - */ + */ //void AddEvent(CValue* event) void AddEvent(bool event) { @@ -131,7 +131,7 @@ public: virtual void ProcessReplica(); - /** + /** * Return true if all the current events * are negative. The definition of negative event is * not immediately clear. But usually refers to key-up events @@ -159,7 +159,7 @@ public: virtual void DecLink(); bool IsNoLink() const { return !m_links; } bool IsType(KX_ACTUATOR_TYPE type) { return m_type == type; } - + #ifdef WITH_CXX_GUARDEDALLOC MEM_CXX_CLASS_ALLOC_FUNCS("GE:SCA_IActuator") #endif diff --git a/source/gameengine/GameLogic/SCA_IController.cpp b/source/gameengine/GameLogic/SCA_IController.cpp index c4176d66688..46ea2910a74 100644 --- a/source/gameengine/GameLogic/SCA_IController.cpp +++ b/source/gameengine/GameLogic/SCA_IController.cpp @@ -48,9 +48,9 @@ SCA_IController::SCA_IController(SCA_IObject* gameobj) m_justActivated(false) { } - - + + SCA_IController::~SCA_IController() { //UnlinkAllActuators(); @@ -77,7 +77,7 @@ void SCA_IController::UnlinkAllSensors() std::vector::iterator sensit; for (sensit = m_linkedsensors.begin();!(sensit==m_linkedsensors.end());++sensit) { - if (IsActive()) + if (IsActive()) { (*sensit)->DecLink(); } @@ -93,7 +93,7 @@ void SCA_IController::UnlinkAllActuators() std::vector::iterator actit; for (actit = m_linkedactuators.begin();!(actit==m_linkedactuators.end());++actit) { - if (IsActive()) + if (IsActive()) { (*actit)->DecLink(); } @@ -127,8 +127,8 @@ void SCA_IController::UnlinkActuator(class SCA_IActuator* actua) return; } } - printf("Missing link from controller %s:%s to actuator %s:%s\n", - m_gameobj->GetName().ReadPtr(), GetName().ReadPtr(), + printf("Missing link from controller %s:%s to actuator %s:%s\n", + m_gameobj->GetName().ReadPtr(), GetName().ReadPtr(), actua->GetParent()->GetName().ReadPtr(), actua->GetName().ReadPtr()); } @@ -157,8 +157,8 @@ void SCA_IController::UnlinkSensor(class SCA_ISensor* sensor) return; } } - printf("Missing link from controller %s:%s to sensor %s:%s\n", - m_gameobj->GetName().ReadPtr(), GetName().ReadPtr(), + printf("Missing link from controller %s:%s to sensor %s:%s\n", + m_gameobj->GetName().ReadPtr(), GetName().ReadPtr(), sensor->GetParent()->GetName().ReadPtr(), sensor->GetName().ReadPtr()); } @@ -168,9 +168,9 @@ void SCA_IController::ApplyState(unsigned int state) std::vector::iterator actit; std::vector::iterator sensit; - if (m_statemask & state) + if (m_statemask & state) { - if (!IsActive()) + if (!IsActive()) { // reactive the controller, all the links to actuator are valid again for (actit = m_linkedactuators.begin();!(actit==m_linkedactuators.end());++actit) diff --git a/source/gameengine/GameLogic/SCA_IController.h b/source/gameengine/GameLogic/SCA_IController.h index 4ec872c2316..a249a6e85f9 100644 --- a/source/gameengine/GameLogic/SCA_IController.h +++ b/source/gameengine/GameLogic/SCA_IController.h @@ -100,7 +100,7 @@ public: } } } - + #ifdef WITH_PYTHON static PyObject* pyattr_get_state(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); diff --git a/source/gameengine/GameLogic/SCA_IInputDevice.cpp b/source/gameengine/GameLogic/SCA_IInputDevice.cpp index f4fce034c87..0808028fed3 100644 --- a/source/gameengine/GameLogic/SCA_IInputDevice.cpp +++ b/source/gameengine/GameLogic/SCA_IInputDevice.cpp @@ -111,7 +111,7 @@ void SCA_IInputDevice::NextFrame() m_currentTable = 1 - m_currentTable; // cerr << "SCA_IInputDevice::NextFrame " << GetNumActiveEvents() << endl; - + for (int i=0;iRelease(); return result; -} +} @@ -107,7 +107,7 @@ CValue* SCA_ILogicBrick::CalcFinal(VALUE_DATA_TYPE dtype, const STR_String& SCA_ILogicBrick::GetText() -{ +{ if (m_name.Length()) return m_name; @@ -137,8 +137,8 @@ void SCA_ILogicBrick::SetName(const char *name) bool SCA_ILogicBrick::LessComparedTo(SCA_ILogicBrick* other) { - return (this->m_Execute_Ueber_Priority < other->m_Execute_Ueber_Priority) - || ((this->m_Execute_Ueber_Priority == other->m_Execute_Ueber_Priority) && + return (this->m_Execute_Ueber_Priority < other->m_Execute_Ueber_Priority) + || ((this->m_Execute_Ueber_Priority == other->m_Execute_Ueber_Priority) && (this->m_Execute_Priority < other->m_Execute_Priority)); } @@ -178,7 +178,7 @@ CValue* SCA_ILogicBrick::GetEvent() { return m_eventval->AddRef(); } - + return NULL; } @@ -244,10 +244,10 @@ PyObject *SCA_ILogicBrick::pyattr_get_owner(void *self_v, const KX_PYATTRIBUTE_D { SCA_ILogicBrick* self = static_cast(self_v); CValue* parent = self->GetParent(); - + if (parent) return parent->GetProxy(); - + Py_RETURN_NONE; } diff --git a/source/gameengine/GameLogic/SCA_ILogicBrick.h b/source/gameengine/GameLogic/SCA_ILogicBrick.h index f9ef18cc348..46c62f0258a 100644 --- a/source/gameengine/GameLogic/SCA_ILogicBrick.h +++ b/source/gameengine/GameLogic/SCA_ILogicBrick.h @@ -81,7 +81,7 @@ public: virtual double GetNumber(); virtual STR_String& GetName(); virtual void SetName(const char *); - + bool IsActive() { return m_bActive; @@ -101,7 +101,7 @@ public: } // insert in a QList at position corresponding to m_Execute_Priority - // inside a longer list that contains elements of other objects. + // inside a longer list that contains elements of other objects. // Sorting is done only between the elements of the same object. // head is the head of the combined list // current points to the first element of the object in the list, NULL if none yet @@ -138,7 +138,7 @@ public: #ifdef WITH_PYTHON // python methods - + static PyObject* pyattr_get_owner(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); // check that attribute is a property @@ -152,14 +152,14 @@ public: }; -protected: +protected: /* Some conversions to go with the bool type. */ /** Convert a KX_TRUE, KX_FALSE in Python to a c++ value. */ bool PyArgToBool(int boolArg); /** Convert a a c++ value to KX_TRUE, KX_FALSE in Python. */ PyObject *BoolToPyArg(bool); - + #endif /* WITH_PYTHON */ }; diff --git a/source/gameengine/GameLogic/SCA_IObject.cpp b/source/gameengine/GameLogic/SCA_IObject.cpp index 526e695e792..c5eab53d67e 100644 --- a/source/gameengine/GameLogic/SCA_IObject.cpp +++ b/source/gameengine/GameLogic/SCA_IObject.cpp @@ -60,7 +60,7 @@ SCA_IObject::~SCA_IObject() (*its)->Delete(); //((CValue*)(*its))->Release(); } - SCA_ControllerList::iterator itc; + SCA_ControllerList::iterator itc; for (itc = m_controllers.begin(); !(itc == m_controllers.end()); ++itc) { //Use Delete for controller to ensure proper cleaning (expression controller) @@ -250,7 +250,7 @@ SCA_IActuator* SCA_IObject::FindActuator(const STR_String& actuatorname) void SCA_IObject::Suspend() { - if ((!m_ignore_activity_culling) + if ((!m_ignore_activity_culling) && (!m_suspended)) { m_suspended = true; /* flag suspend for all sensors */ @@ -286,8 +286,8 @@ void SCA_IObject::SetState(unsigned int state) // 1) set the new state bits that are 1 // 2) clr the new state bits that are 0 // This to ensure continuity if a sensor is attached to two states - // that are switching state: no need to deactive and reactive the sensor - + // that are switching state: no need to deactive and reactive the sensor + tmpstate = m_state | state; if (tmpstate != m_state) { diff --git a/source/gameengine/GameLogic/SCA_IObject.h b/source/gameengine/GameLogic/SCA_IObject.h index 29a21fd8708..5c2dd351fb3 100644 --- a/source/gameengine/GameLogic/SCA_IObject.h +++ b/source/gameengine/GameLogic/SCA_IObject.h @@ -53,9 +53,9 @@ typedef std::vector SCA_ObjectList; class SCA_IObject : public CValue { - + Py_Header - + protected: friend class KX_StateActuator; friend class SCA_IActuator; @@ -110,7 +110,7 @@ protected: SG_QList* m_firstState; public: - + SCA_IObject(); virtual ~SCA_IObject(); @@ -148,7 +148,7 @@ public: } void RegisterActuator(SCA_IActuator* act); void UnregisterActuator(SCA_IActuator* act); - + void RegisterObject(SCA_IObject* objs); void UnregisterObject(SCA_IObject* objs); /** @@ -165,7 +165,7 @@ public: void SetCurrentTime(float currentTime) {} virtual void ReParentLogic(); - + /** * Set whether or not to ignore activity culling requests */ @@ -187,7 +187,7 @@ public: * Suspend all progress. */ void Suspend(void); - + /** * Resume progress */ @@ -216,7 +216,7 @@ public: // const class MT_Point3& ConvertPythonPylist(PyObject *pylist); virtual int GetGameObjectType() {return -1;} - + typedef enum ObjectTypes { OBJ_ARMATURE=0, OBJ_CAMERA=1, diff --git a/source/gameengine/GameLogic/SCA_IScene.cpp b/source/gameengine/GameLogic/SCA_IScene.cpp index a4c905096d7..07b7e008e83 100644 --- a/source/gameengine/GameLogic/SCA_IScene.cpp +++ b/source/gameengine/GameLogic/SCA_IScene.cpp @@ -39,8 +39,8 @@ SCA_DebugProp::SCA_DebugProp(): m_obj(NULL) SCA_DebugProp::~SCA_DebugProp() { - if (m_obj) - m_obj->Release(); + if (m_obj) + m_obj->Release(); } SCA_IScene::SCA_IScene() @@ -64,7 +64,7 @@ SCA_IScene::~SCA_IScene() } -std::vector& SCA_IScene::GetDebugProperties() +std::vector& SCA_IScene::GetDebugProperties() { return m_debugList; } @@ -129,7 +129,7 @@ void SCA_IScene::RemoveDebugProperty(class CValue *gameobj, void SCA_IScene::RemoveObjectDebugProperties(class CValue* gameobj) -{ +{ vector::iterator it = m_debugList.begin(); while (it != m_debugList.end()) { CValue* debugobj = (*it)->m_obj; diff --git a/source/gameengine/GameLogic/SCA_IScene.h b/source/gameengine/GameLogic/SCA_IScene.h index b76b5636b13..e08c68f63e4 100644 --- a/source/gameengine/GameLogic/SCA_IScene.h +++ b/source/gameengine/GameLogic/SCA_IScene.h @@ -51,7 +51,7 @@ struct SCA_DebugProp ~SCA_DebugProp(); }; -class SCA_IScene +class SCA_IScene { std::vector m_debugList; public: @@ -63,7 +63,7 @@ public: virtual void RemoveObject(class CValue* gameobj)=0; virtual void DelayedRemoveObject(class CValue* gameobj)=0; //virtual void DelayedReleaseObject(class CValue* gameobj)=0; - + virtual void ReplaceMesh(class CValue* gameobj, void* meshobj, bool use_gfx, bool use_phys)=0; std::vector& GetDebugProperties(); @@ -74,8 +74,8 @@ public: void RemoveDebugProperty(class CValue *gameobj, const STR_String &name); void RemoveObjectDebugProperties(class CValue* gameobj); - virtual void Update2DFilter(std::vector& propNames, void* gameObj, - RAS_2DFilterManager::RAS_2DFILTER_MODE filtermode, + virtual void Update2DFilter(std::vector& propNames, void* gameObj, + RAS_2DFilterManager::RAS_2DFILTER_MODE filtermode, int pass, STR_String& text) {} diff --git a/source/gameengine/GameLogic/SCA_ISensor.cpp b/source/gameengine/GameLogic/SCA_ISensor.cpp index 66dd69f93c4..44fbe1d4692 100644 --- a/source/gameengine/GameLogic/SCA_ISensor.cpp +++ b/source/gameengine/GameLogic/SCA_ISensor.cpp @@ -70,12 +70,12 @@ SCA_ISensor::SCA_ISensor(SCA_IObject* gameobj, m_skipped_ticks = 0; m_state = false; m_prev_state = false; - + m_eventmgr = eventmgr; } -SCA_ISensor::~SCA_ISensor() +SCA_ISensor::~SCA_ISensor() { // intentionally empty } @@ -89,18 +89,18 @@ void SCA_ISensor::ProcessReplica() bool SCA_ISensor::IsPositiveTrigger() { bool result = false; - + if (m_eventval) { result = (m_eventval->GetNumber() != 0.0); } if (m_invert) { result = !result; } - + return result; } -void SCA_ISensor::SetPulseMode(bool posmode, +void SCA_ISensor::SetPulseMode(bool posmode, bool negmode, int skippedticks) { @@ -153,7 +153,7 @@ void SCA_ISensor::Init() void SCA_ISensor::DecLink() { m_links--; - if (m_links < 0) + if (m_links < 0) { printf("Warning: sensor %s has negative m_links: %d\n", m_name.Ptr(), m_links); m_links = 0; @@ -203,8 +203,8 @@ void SCA_ISensor::UnlinkController(SCA_IController* controller) return; } } - printf("Missing link from sensor %s:%s to controller %s:%s\n", - m_gameobj->GetName().ReadPtr(), GetName().ReadPtr(), + printf("Missing link from sensor %s:%s to controller %s:%s\n", + m_gameobj->GetName().ReadPtr(), GetName().ReadPtr(), controller->GetParent()->GetName().ReadPtr(), controller->GetName().ReadPtr()); } @@ -237,7 +237,7 @@ void SCA_ISensor::ActivateControllers(class SCA_LogicManager* logicmgr) void SCA_ISensor::Activate(class SCA_LogicManager* logicmgr) { - + // calculate if a __triggering__ is wanted // don't evaluate a sensor that is not connected to any controller if (m_links && !m_suspended) { @@ -270,7 +270,7 @@ void SCA_ISensor::Activate(class SCA_LogicManager* logicmgr) result = true; } m_pos_ticks = 0; - } + } } // negative pulse doesn't make sense in tap mode, skip if (m_neg_pulsemode && !m_tap) @@ -304,8 +304,8 @@ void SCA_ISensor::Activate(class SCA_LogicManager* logicmgr) } if (!result && m_level) { - // This level sensor is connected to at least one controller that was just made - // active but it did not generate an event yet, do it now to those controllers only + // This level sensor is connected to at least one controller that was just made + // active but it did not generate an event yet, do it now to those controllers only for (vector::const_iterator c= m_linkedcontrollers.begin(); c!=m_linkedcontrollers.end();++c) { @@ -314,7 +314,7 @@ void SCA_ISensor::Activate(class SCA_LogicManager* logicmgr) logicmgr->AddTriggeredController(contr, this); } } - } + } } #ifdef WITH_PYTHON @@ -400,18 +400,18 @@ PyObject *SCA_ISensor::pyattr_get_status(void *self_v, const KX_PYATTRIBUTE_DEF { SCA_ISensor* self = static_cast(self_v); int status = 0; - if (self->GetState()) + if (self->GetState()) { - if (self->GetState() == self->GetPrevState()) + if (self->GetState() == self->GetPrevState()) { status = 2; } - else + else { status = 1; } } - else if (self->GetState() != self->GetPrevState()) + else if (self->GetState() != self->GetPrevState()) { status = 3; } diff --git a/source/gameengine/GameLogic/SCA_ISensor.h b/source/gameengine/GameLogic/SCA_ISensor.h index 1e82f3ab11f..f8276b1c79f 100644 --- a/source/gameengine/GameLogic/SCA_ISensor.h +++ b/source/gameengine/GameLogic/SCA_ISensor.h @@ -40,7 +40,7 @@ /** * Interface Class for all logic Sensors. Implements - * pulsemode,pulsefrequency + * pulsemode,pulsefrequency * Use of SG_DList element: link sensors to their respective event manager * Head: SCA_EventManager::m_sensors * Use of SG_QList element: not used @@ -126,7 +126,7 @@ public: void SetPulseMode(bool posmode, bool negmode, int skippedticks); - + /** Set inversion of pulses on or off. */ void SetInvert(bool inv); /** set the level detection on or off */ @@ -156,13 +156,13 @@ public: /** Is this sensor switched off? */ bool IsSuspended(); - + /** get the state of the sensor: positive or negative */ bool GetState() { return m_state; } - + /** get the previous state of the sensor: positive or negative */ bool GetPrevState() { @@ -189,13 +189,13 @@ public: void IncLink() { if (!m_links++) RegisterToManager(); } void DecLink(); - bool IsNoLink() const + bool IsNoLink() const { return !m_links; } #ifdef WITH_PYTHON /* Python functions: */ KX_PYMETHOD_DOC_NOARGS(SCA_ISensor,reset); - + static PyObject* pyattr_get_triggered(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); static PyObject* pyattr_get_positive(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); static PyObject* pyattr_get_status(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); @@ -206,13 +206,13 @@ public: static int pyattr_check_level(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); static int pyattr_check_tap(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); - + enum SensorStatus { KX_SENSOR_INACTIVE = 0, KX_SENSOR_JUST_ACTIVATED, KX_SENSOR_ACTIVE, KX_SENSOR_JUST_DEACTIVATED - + }; #endif /* WITH_PYTHON */ }; diff --git a/source/gameengine/GameLogic/SCA_JoystickSensor.cpp b/source/gameengine/GameLogic/SCA_JoystickSensor.cpp index 56df9692e72..c98efd6db08 100644 --- a/source/gameengine/GameLogic/SCA_JoystickSensor.cpp +++ b/source/gameengine/GameLogic/SCA_JoystickSensor.cpp @@ -95,7 +95,7 @@ CValue* SCA_JoystickSensor::GetReplica() bool SCA_JoystickSensor::IsPositiveTrigger() -{ +{ bool result = m_istrig; if (m_invert) result = !result; @@ -108,10 +108,10 @@ bool SCA_JoystickSensor::Evaluate() SCA_Joystick *js = ((SCA_JoystickManager *)m_eventmgr)->GetJoystickDevice(m_joyindex); bool result = false; bool reset = m_reset && m_level; - + if (js==NULL) /* no joystick - don't do anything */ return false; - + m_reset = false; switch (m_joymode) { @@ -128,10 +128,10 @@ bool SCA_JoystickSensor::Evaluate() * also note that this starts at 1 where functions its used * with expect a zero index. */ - + if (!js->IsTrigAxis() && !reset) /* No events from SDL? - don't bother */ return false; - + js->cSetPrecision(m_precision); if (m_bAllEvents) { if (js->aAxisPairIsPositive(m_axis-1)) { /* use zero based axis index internally */ @@ -164,7 +164,7 @@ bool SCA_JoystickSensor::Evaluate() /* Like KX_JOYSENSORMODE_AXIS but don't pair up axis */ if (!js->IsTrigAxis() && !reset) /* No events from SDL? - don't bother */ return false; - + /* No need for 'm_bAllEvents' check here since were only checking 1 axis */ js->cSetPrecision(m_precision); if (js->aAxisIsPositive(m_axis-1)) { /* use zero based axis index internally */ @@ -187,7 +187,7 @@ bool SCA_JoystickSensor::Evaluate() */ if (!js->IsTrigButton() && !reset) /* No events from SDL? - don't bother */ return false; - + if (( m_bAllEvents && js->aAnyButtonPressIsPositive()) || (!m_bAllEvents && js->aButtonPressIsPositive(m_button))) { m_istrig = 1; result = true; @@ -206,10 +206,10 @@ bool SCA_JoystickSensor::Evaluate() * numberof = m_hat -- max 4 * direction= m_hatf -- max 12 */ - + if (!js->IsTrigHat() && !reset) /* No events from SDL? - don't bother */ return false; - + if ((m_bAllEvents && js->GetHat(m_hat-1)) || js->aHatIsPositive(m_hat-1, m_hatf)) { m_istrig = 1; result = true; @@ -227,7 +227,7 @@ bool SCA_JoystickSensor::Evaluate() printf("Error invalid switch statement\n"); break; } - + /* if not all events are enabled, only send a positive pulse when * the button state changes */ if (!m_bAllEvents) { @@ -238,10 +238,10 @@ bool SCA_JoystickSensor::Evaluate() m_istrig_prev = m_istrig; } } - + if (reset) result = true; - + return result; } @@ -306,7 +306,7 @@ PyAttributeDef SCA_JoystickSensor::Attributes[] = { }; /* get button active list -------------------------------------------------- */ -const char SCA_JoystickSensor::GetButtonActiveList_doc[] = +const char SCA_JoystickSensor::GetButtonActiveList_doc[] = "getButtonActiveList\n" "\tReturns a list containing the indices of the button currently pressed.\n"; PyObject *SCA_JoystickSensor::PyGetButtonActiveList( ) @@ -315,7 +315,7 @@ PyObject *SCA_JoystickSensor::PyGetButtonActiveList( ) PyObject *ls = PyList_New(0); PyObject *value; int i; - + if (joy) { for (i=0; i < joy->GetNumberOfButtons(); i++) { if (joy->aButtonPressIsPositive(i)) { @@ -329,14 +329,14 @@ PyObject *SCA_JoystickSensor::PyGetButtonActiveList( ) } /* get button status -------------------------------------------------- */ -const char SCA_JoystickSensor::GetButtonStatus_doc[] = +const char SCA_JoystickSensor::GetButtonStatus_doc[] = "getButtonStatus(buttonIndex)\n" "\tReturns a bool of the current pressed state of the specified button.\n"; PyObject *SCA_JoystickSensor::PyGetButtonStatus( PyObject *args ) { SCA_Joystick *joy = ((SCA_JoystickManager *)m_eventmgr)->GetJoystickDevice(m_joyindex); int index; - + if (!PyArg_ParseTuple(args, "i:getButtonStatus", &index)) { return NULL; } @@ -350,14 +350,14 @@ PyObject *SCA_JoystickSensor::pyattr_get_axis_values(void *self_v, const KX_PYAT { SCA_JoystickSensor* self = static_cast(self_v); SCA_Joystick *joy = ((SCA_JoystickManager *)self->m_eventmgr)->GetJoystickDevice(self->m_joyindex); - + int axis_index = (joy ? joy->GetNumberOfAxes() : 0); PyObject *list = PyList_New(axis_index); - + while (axis_index--) { PyList_SET_ITEM(list, axis_index, PyLong_FromLong(joy->GetAxisPosition(axis_index))); } - + return list; } @@ -365,12 +365,12 @@ PyObject *SCA_JoystickSensor::pyattr_get_axis_single(void *self_v, const KX_PYAT { SCA_JoystickSensor* self = static_cast(self_v); SCA_Joystick *joy = ((SCA_JoystickManager *)self->m_eventmgr)->GetJoystickDevice(self->m_joyindex); - + if (self->m_joymode != KX_JOYSENSORMODE_AXIS_SINGLE) { PyErr_SetString(PyExc_AttributeError, "val = sensor.axisSingle: Joystick Sensor, not 'Single Axis' type"); return NULL; } - + return PyLong_FromLong(joy ? joy->GetAxisPosition(self->m_axis - 1) : 0); } @@ -378,14 +378,14 @@ PyObject *SCA_JoystickSensor::pyattr_get_hat_values(void *self_v, const KX_PYATT { SCA_JoystickSensor* self = static_cast(self_v); SCA_Joystick *joy = ((SCA_JoystickManager *)self->m_eventmgr)->GetJoystickDevice(self->m_joyindex); - + int hat_index = (joy ? joy->GetNumberOfHats() : 0); PyObject *list = PyList_New(hat_index); - + while (hat_index--) { PyList_SET_ITEM(list, hat_index, PyLong_FromLong(joy->GetHat(hat_index))); } - + return list; } @@ -393,7 +393,7 @@ PyObject *SCA_JoystickSensor::pyattr_get_hat_single(void *self_v, const KX_PYATT { SCA_JoystickSensor* self = static_cast(self_v); SCA_Joystick *joy = ((SCA_JoystickManager *)self->m_eventmgr)->GetJoystickDevice(self->m_joyindex); - + return PyLong_FromLong(joy ? joy->GetHat(self->m_hat - 1) : 0); } diff --git a/source/gameengine/GameLogic/SCA_JoystickSensor.h b/source/gameengine/GameLogic/SCA_JoystickSensor.h index 6c6dc019a5e..30c2d1a30c3 100644 --- a/source/gameengine/GameLogic/SCA_JoystickSensor.h +++ b/source/gameengine/GameLogic/SCA_JoystickSensor.h @@ -39,7 +39,7 @@ class SCA_JoystickSensor :public SCA_ISensor { Py_Header - + /** * Axis 1-JOYAXIS_MAX, MUST be followed by m_axisf */ @@ -112,11 +112,11 @@ public: int hat, int hatf, bool allevents); virtual ~SCA_JoystickSensor(); virtual CValue* GetReplica(); - + virtual bool Evaluate(); virtual bool IsPositiveTrigger(); virtual void Init(); - + short int GetJoyIndex(void) { return m_joyindex; } @@ -139,7 +139,7 @@ public: static PyObject* pyattr_get_num_buttons(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); static PyObject* pyattr_get_num_hats(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); static PyObject* pyattr_get_connected(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); - + /* attribute check */ static int CheckAxis(void *self, const PyAttributeDef*) @@ -160,7 +160,7 @@ public: sensor->m_hat = JOYHAT_MAX; return 0; } - + #endif /* WITH_PYTHON */ }; diff --git a/source/gameengine/GameLogic/SCA_KeyboardManager.h b/source/gameengine/GameLogic/SCA_KeyboardManager.h index cd1cbf4adee..5a5c8e77b21 100644 --- a/source/gameengine/GameLogic/SCA_KeyboardManager.h +++ b/source/gameengine/GameLogic/SCA_KeyboardManager.h @@ -47,13 +47,13 @@ using namespace std; class SCA_KeyboardManager : public SCA_EventManager { class SCA_IInputDevice* m_inputDevice; - + public: SCA_KeyboardManager(class SCA_LogicManager* logicmgr,class SCA_IInputDevice* inputdev); virtual ~SCA_KeyboardManager(); bool IsPressed(SCA_IInputDevice::KX_EnumInputs inputcode); - + virtual void NextFrame(); SCA_IInputDevice* GetInputDevice(); diff --git a/source/gameengine/GameLogic/SCA_KeyboardSensor.cpp b/source/gameengine/GameLogic/SCA_KeyboardSensor.cpp index 414a685d358..a502158f453 100644 --- a/source/gameengine/GameLogic/SCA_KeyboardSensor.cpp +++ b/source/gameengine/GameLogic/SCA_KeyboardSensor.cpp @@ -106,19 +106,19 @@ short int SCA_KeyboardSensor::GetHotkey() bool SCA_KeyboardSensor::IsPositiveTrigger() -{ +{ bool result = (m_val != 0); if (m_invert) result = !result; - + return result; } bool SCA_KeyboardSensor::TriggerOnAllKeys() -{ +{ return m_bAllKeys; } @@ -131,7 +131,7 @@ bool SCA_KeyboardSensor::Evaluate() bool qual = true; bool qual_change = false; short int m_val_orig = m_val; - + SCA_IInputDevice* inputdev = ((SCA_KeyboardManager *)m_eventmgr)->GetInputDevice(); // cerr << "SCA_KeyboardSensor::Eval event, sensing for "<< m_hotkey << " at device " << inputdev << "\n"; @@ -157,8 +157,8 @@ bool SCA_KeyboardSensor::Evaluate() for (int i=SCA_IInputDevice::KX_BEGINKEY ; i<= SCA_IInputDevice::KX_ENDKEY;i++) { const SCA_InputEvent & inevent = inputdev->GetEventValue((SCA_IInputDevice::KX_EnumInputs) i); - switch (inevent.m_status) - { + switch (inevent.m_status) + { case SCA_InputEvent::KX_JUSTACTIVATED: justactivated = true; break; @@ -216,10 +216,10 @@ bool SCA_KeyboardSensor::Evaluate() // cerr << "======= SCA_KeyboardSensor::Evaluate:: peeking at key status" << endl; const SCA_InputEvent & inevent = inputdev->GetEventValue( (SCA_IInputDevice::KX_EnumInputs) m_hotkey); - + // cerr << "======= SCA_KeyboardSensor::Evaluate:: status: " << inevent.m_status << endl; - - + + /* Check qualifier keys * - see if the qualifiers we request are pressed - 'qual' true/false * - see if the qualifiers we request changed their state - 'qual_change' true/false @@ -260,12 +260,12 @@ bool SCA_KeyboardSensor::Evaluate() } } /* done reading qualifiers */ - + if (inevent.m_status == SCA_InputEvent::KX_NO_INPUTSTATUS) { if (m_val == 1) { - // this situation may occur after a scene suspend: the keyboard release + // this situation may occur after a scene suspend: the keyboard release // event was not captured, produce now the event off m_val = 0; result = true; @@ -282,14 +282,14 @@ bool SCA_KeyboardSensor::Evaluate() { m_val = 0; result = true; - } else + } else { if (inevent.m_status == SCA_InputEvent::KX_ACTIVE) { if (m_val == 0) { m_val = 1; - if (m_level) + if (m_level) { result = true; } @@ -298,14 +298,14 @@ bool SCA_KeyboardSensor::Evaluate() } } } - + /* Modify the key state based on qual(s) * Tested carefully. don't touch unless your really sure. * note, this will only change the results if key modifiers are set. * * When all modifiers and keys are positive * - pulse true - * + * * When ANY of the modifiers or main key become inactive, * - pulse false */ @@ -322,9 +322,9 @@ bool SCA_KeyboardSensor::Evaluate() } } /* done with key quals */ - + } - + if (reset) // force an event result = true; @@ -371,21 +371,21 @@ void SCA_KeyboardSensor::AddToTargetProp(int keyIndex, int unicode) } } } - + /** * Tests whether shift is pressed */ bool SCA_KeyboardSensor::IsShifted(void) { SCA_IInputDevice* inputdev = ((SCA_KeyboardManager *)m_eventmgr)->GetInputDevice(); - - if ( (inputdev->GetEventValue(SCA_IInputDevice::KX_RIGHTSHIFTKEY).m_status + + if ( (inputdev->GetEventValue(SCA_IInputDevice::KX_RIGHTSHIFTKEY).m_status == SCA_InputEvent::KX_ACTIVE) - || (inputdev->GetEventValue(SCA_IInputDevice::KX_RIGHTSHIFTKEY).m_status + || (inputdev->GetEventValue(SCA_IInputDevice::KX_RIGHTSHIFTKEY).m_status == SCA_InputEvent::KX_JUSTACTIVATED) - || (inputdev->GetEventValue(SCA_IInputDevice::KX_LEFTSHIFTKEY).m_status + || (inputdev->GetEventValue(SCA_IInputDevice::KX_LEFTSHIFTKEY).m_status == SCA_InputEvent::KX_ACTIVE) - || (inputdev->GetEventValue(SCA_IInputDevice::KX_LEFTSHIFTKEY).m_status + || (inputdev->GetEventValue(SCA_IInputDevice::KX_LEFTSHIFTKEY).m_status == SCA_InputEvent::KX_JUSTACTIVATED) ) { return true; @@ -395,7 +395,7 @@ bool SCA_KeyboardSensor::IsShifted(void) } } -void SCA_KeyboardSensor::LogKeystrokes(void) +void SCA_KeyboardSensor::LogKeystrokes(void) { SCA_IInputDevice* inputdev = ((SCA_KeyboardManager *)m_eventmgr)->GetInputDevice(); int num = inputdev->GetNumActiveEvents(); @@ -403,7 +403,7 @@ void SCA_KeyboardSensor::LogKeystrokes(void) /* weird loop, this one... */ if (num > 0) { - + int index = 0; /* Check on all keys whether they were pushed. This does not * untangle the ordering, so don't type too fast :) */ @@ -436,16 +436,16 @@ KX_PYMETHODDEF_DOC_O(SCA_KeyboardSensor, getKeyStatus, PyErr_SetString(PyExc_ValueError, "sensor.getKeyStatus(int): Keyboard Sensor, expected an int"); return NULL; } - + SCA_IInputDevice::KX_EnumInputs keycode = (SCA_IInputDevice::KX_EnumInputs)PyLong_AsLong(value); - + if ((keycode < SCA_IInputDevice::KX_BEGINKEY) || (keycode > SCA_IInputDevice::KX_ENDKEY)) { PyErr_SetString(PyExc_AttributeError, "sensor.getKeyStatus(int): Keyboard Sensor, invalid keycode specified!"); return NULL; } - + SCA_IInputDevice* inputdev = ((SCA_KeyboardManager *)m_eventmgr)->GetInputDevice(); const SCA_InputEvent & inevent = inputdev->GetEventValue(keycode); return PyLong_FromLong(inevent.m_status); @@ -497,11 +497,11 @@ PyAttributeDef SCA_KeyboardSensor::Attributes[] = { PyObject *SCA_KeyboardSensor::pyattr_get_events(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) { SCA_KeyboardSensor* self = static_cast(self_v); - + SCA_IInputDevice* inputdev = ((SCA_KeyboardManager *)self->m_eventmgr)->GetInputDevice(); PyObject *resultlist = PyList_New(0); - + for (int i=SCA_IInputDevice::KX_BEGINKEY ; i<= SCA_IInputDevice::KX_ENDKEY;i++) { const SCA_InputEvent & inevent = inputdev->GetEventValue((SCA_IInputDevice::KX_EnumInputs) i); @@ -526,42 +526,42 @@ PyObject *SCA_KeyboardSensor::pyattr_get_events(void *self_v, const KX_PYATTRIBU char ToCharacter(int keyIndex, bool shifted) { /* numerals */ - if ( (keyIndex >= SCA_IInputDevice::KX_ZEROKEY) + if ( (keyIndex >= SCA_IInputDevice::KX_ZEROKEY) && (keyIndex <= SCA_IInputDevice::KX_NINEKEY) ) { if (shifted) { char numshift[] = ")!@#$%^&*("; - return numshift[keyIndex - '0']; + return numshift[keyIndex - '0']; } else { - return keyIndex - SCA_IInputDevice::KX_ZEROKEY + '0'; + return keyIndex - SCA_IInputDevice::KX_ZEROKEY + '0'; } } - + /* letters... always lowercase... is that desirable? */ - if ( (keyIndex >= SCA_IInputDevice::KX_AKEY) + if ( (keyIndex >= SCA_IInputDevice::KX_AKEY) && (keyIndex <= SCA_IInputDevice::KX_ZKEY) ) { if (shifted) { - return keyIndex - SCA_IInputDevice::KX_AKEY + 'A'; + return keyIndex - SCA_IInputDevice::KX_AKEY + 'A'; } else { - return keyIndex - SCA_IInputDevice::KX_AKEY + 'a'; + return keyIndex - SCA_IInputDevice::KX_AKEY + 'a'; } } - + if (keyIndex == SCA_IInputDevice::KX_SPACEKEY) { return ' '; } if (keyIndex == SCA_IInputDevice::KX_RETKEY || keyIndex == SCA_IInputDevice::KX_PADENTER) { return '\n'; } - - + + if (keyIndex == SCA_IInputDevice::KX_PADASTERKEY) { return '*'; } - + if (keyIndex == SCA_IInputDevice::KX_TABKEY) { return '\t'; } - + /* comma to period */ char commatoperiod[] = ",-."; char commatoperiodshifted[] = "<_>"; @@ -586,11 +586,11 @@ char ToCharacter(int keyIndex, bool shifted) return commatoperiod[2]; } } - + /* semicolon to rightbracket */ char semicolontorightbracket[] = ";\'`/\\=[]"; char semicolontorightbracketshifted[] = ":\"~\?|+{}"; - if ((keyIndex >= SCA_IInputDevice::KX_SEMICOLONKEY) + if ((keyIndex >= SCA_IInputDevice::KX_SEMICOLONKEY) && (keyIndex <= SCA_IInputDevice::KX_RIGHTBRACKETKEY)) { if (shifted) { return semicolontorightbracketshifted[keyIndex - SCA_IInputDevice::KX_SEMICOLONKEY]; @@ -598,11 +598,11 @@ char ToCharacter(int keyIndex, bool shifted) return semicolontorightbracket[keyIndex - SCA_IInputDevice::KX_SEMICOLONKEY]; } } - + /* keypad2 to padplus */ char pad2topadplus[] = "246813579. 0- +"; - if ((keyIndex >= SCA_IInputDevice::KX_PAD2) - && (keyIndex <= SCA_IInputDevice::KX_PADPLUSKEY)) { + if ((keyIndex >= SCA_IInputDevice::KX_PAD2) + && (keyIndex <= SCA_IInputDevice::KX_PADPLUSKEY)) { return pad2topadplus[keyIndex - SCA_IInputDevice::KX_PAD2]; } @@ -617,33 +617,33 @@ char ToCharacter(int keyIndex, bool shifted) * keycodes. */ bool IsPrintable(int keyIndex) { - /* only print + /* only print * - numerals: KX_ZEROKEY to KX_NINEKEY - * - alphas: KX_AKEY to KX_ZKEY. + * - alphas: KX_AKEY to KX_ZKEY. * - specials: KX_RETKEY, KX_PADASTERKEY, KX_PADCOMMAKEY to KX_PERIODKEY, * KX_TABKEY, KX_SEMICOLONKEY to KX_RIGHTBRACKETKEY, * KX_PAD2 to KX_PADPLUSKEY - * - delete and backspace: also printable in the sense that they modify + * - delete and backspace: also printable in the sense that they modify * the string * - retkey: should this be printable? * - virgule: prints a space... don't know which key that's supposed * to be... */ - if ( ((keyIndex >= SCA_IInputDevice::KX_ZEROKEY) + if ( ((keyIndex >= SCA_IInputDevice::KX_ZEROKEY) && (keyIndex <= SCA_IInputDevice::KX_NINEKEY)) - || ((keyIndex >= SCA_IInputDevice::KX_AKEY) - && (keyIndex <= SCA_IInputDevice::KX_ZKEY)) - || (keyIndex == SCA_IInputDevice::KX_SPACEKEY) + || ((keyIndex >= SCA_IInputDevice::KX_AKEY) + && (keyIndex <= SCA_IInputDevice::KX_ZKEY)) + || (keyIndex == SCA_IInputDevice::KX_SPACEKEY) || (keyIndex == SCA_IInputDevice::KX_RETKEY) || (keyIndex == SCA_IInputDevice::KX_PADENTER) - || (keyIndex == SCA_IInputDevice::KX_PADASTERKEY) - || (keyIndex == SCA_IInputDevice::KX_TABKEY) - || ((keyIndex >= SCA_IInputDevice::KX_COMMAKEY) - && (keyIndex <= SCA_IInputDevice::KX_PERIODKEY)) - || ((keyIndex >= SCA_IInputDevice::KX_SEMICOLONKEY) - && (keyIndex <= SCA_IInputDevice::KX_RIGHTBRACKETKEY)) - || ((keyIndex >= SCA_IInputDevice::KX_PAD2) - && (keyIndex <= SCA_IInputDevice::KX_PADPLUSKEY)) + || (keyIndex == SCA_IInputDevice::KX_PADASTERKEY) + || (keyIndex == SCA_IInputDevice::KX_TABKEY) + || ((keyIndex >= SCA_IInputDevice::KX_COMMAKEY) + && (keyIndex <= SCA_IInputDevice::KX_PERIODKEY)) + || ((keyIndex >= SCA_IInputDevice::KX_SEMICOLONKEY) + && (keyIndex <= SCA_IInputDevice::KX_RIGHTBRACKETKEY)) + || ((keyIndex >= SCA_IInputDevice::KX_PAD2) + && (keyIndex <= SCA_IInputDevice::KX_PADPLUSKEY)) || (keyIndex == SCA_IInputDevice::KX_DELKEY) || (keyIndex == SCA_IInputDevice::KX_BACKSPACEKEY) ) diff --git a/source/gameengine/GameLogic/SCA_KeyboardSensor.h b/source/gameengine/GameLogic/SCA_KeyboardSensor.h index 51d7756bd1f..0429ccf9bd1 100644 --- a/source/gameengine/GameLogic/SCA_KeyboardSensor.h +++ b/source/gameengine/GameLogic/SCA_KeyboardSensor.h @@ -75,7 +75,7 @@ class SCA_KeyboardSensor : public SCA_ISensor * Log the keystrokes from the current input buffer. */ void LogKeystrokes(void); - + /** * Adds this key-code to the target prop. */ @@ -85,7 +85,7 @@ class SCA_KeyboardSensor : public SCA_ISensor * Tests whether shift is pressed. */ bool IsShifted(void); - + public: SCA_KeyboardSensor(class SCA_KeyboardManager* keybdmgr, short int hotkey, @@ -111,11 +111,11 @@ public: /* Python interface ---------------------------------------------------- */ /* --------------------------------------------------------------------- */ - // KeyEvents: + // KeyEvents: KX_PYMETHOD_DOC_NOARGS(SCA_KeyboardSensor,getEventList); - // KeyStatus: + // KeyStatus: KX_PYMETHOD_DOC_O(SCA_KeyboardSensor,getKeyStatus); - + static PyObject* pyattr_get_events(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef); #endif }; diff --git a/source/gameengine/GameLogic/SCA_LogicManager.cpp b/source/gameengine/GameLogic/SCA_LogicManager.cpp index 978f6d6b836..0913f576d00 100644 --- a/source/gameengine/GameLogic/SCA_LogicManager.cpp +++ b/source/gameengine/GameLogic/SCA_LogicManager.cpp @@ -104,12 +104,12 @@ void SCA_LogicManager::RegisterGameMeshName(const STR_String& gamemeshname, void -void SCA_LogicManager::RegisterGameObj(void* blendobj, CValue* gameobj) +void SCA_LogicManager::RegisterGameObj(void* blendobj, CValue* gameobj) { m_map_blendobj_to_gameobj.insert(CHashedPtr(blendobj), gameobj); } -void SCA_LogicManager::UnregisterGameObj(void* blendobj, CValue* gameobj) +void SCA_LogicManager::UnregisterGameObj(void* blendobj, CValue* gameobj) { void **obp = m_map_blendobj_to_gameobj[CHashedPtr(blendobj)]; if (obp && (CValue*)(*obp) == gameobj) @@ -120,7 +120,7 @@ CValue* SCA_LogicManager::GetGameObjectByName(const STR_String& gameobjname) { STR_HashedString mn = gameobjname; CValue** gameptr = m_mapStringToGameObjects[mn]; - + if (gameptr) return *gameptr; @@ -128,7 +128,7 @@ CValue* SCA_LogicManager::GetGameObjectByName(const STR_String& gameobjname) } -CValue* SCA_LogicManager::FindGameObjByBlendObj(void* blendobj) +CValue* SCA_LogicManager::FindGameObjByBlendObj(void* blendobj) { void **obp= m_map_blendobj_to_gameobj[CHashedPtr(blendobj)]; return obp?(CValue*)(*obp):NULL; @@ -136,7 +136,7 @@ CValue* SCA_LogicManager::FindGameObjByBlendObj(void* blendobj) -void* SCA_LogicManager::FindBlendObjByGameMeshName(const STR_String& gamemeshname) +void* SCA_LogicManager::FindBlendObjByGameMeshName(const STR_String& gamemeshname) { STR_HashedString mn = gamemeshname; void **obp= m_map_gamemeshname_to_blendobj[mn]; @@ -225,15 +225,15 @@ void SCA_LogicManager::UpdateFrame(double curtime, bool frame) if (!actua->Update(curtime, frame)) { // this actuator is not active anymore, remove - actua->QDelink(); - actua->SetActive(false); + actua->QDelink(); + actua->SetActive(false); } else if (actua->IsNoLink()) { // This actuator has no more links but it still active // make sure it will get a negative event on next frame to stop it // Do this check after Update() rather than before to make sure // that all the actuators that are activated at same time than a state - // actuator have a chance to execute. + // actuator have a chance to execute. bool event = false; actua->RemoveAllEvents(); actua->AddEvent(event); diff --git a/source/gameengine/GameLogic/SCA_LogicManager.h b/source/gameengine/GameLogic/SCA_LogicManager.h index 7319bb537dd..231af077c8e 100644 --- a/source/gameengine/GameLogic/SCA_LogicManager.h +++ b/source/gameengine/GameLogic/SCA_LogicManager.h @@ -33,7 +33,7 @@ #ifdef _MSC_VER # pragma warning (disable:4786) -#endif +#endif #include //#include "CTR_Map.h" @@ -73,7 +73,7 @@ typedef std::map sensormap_t; class SCA_LogicManager { vector m_eventmanagers; - + // SG_DList: Head of objects having activated actuators // element: SCA_IObject::m_activeActuators SG_DList m_activeActuators; @@ -99,7 +99,7 @@ public: class SCA_ISensor* sensor); void RegisterToActuator(SCA_IController* controller, class SCA_IActuator* actuator); - + void BeginFrame(double curtime, double fixedtime); void UpdateFrame(double curtime, bool frame); void EndFrame(); @@ -113,7 +113,7 @@ public: void AddTriggeredController(SCA_IController* controller, SCA_ISensor* sensor); SCA_EventManager* FindEventManager(int eventmgrtype); vector GetEventManagers() { return m_eventmanagers; } - + void RemoveGameObject(const STR_String& gameobjname); /** @@ -122,14 +122,14 @@ public: void RemoveSensor(SCA_ISensor* sensor); void RemoveController(SCA_IController* controller); void RemoveActuator(SCA_IActuator* actuator); - + // for the scripting... needs a FactoryManager later (if we would have time... ;) void RegisterMeshName(const STR_String& meshname,void* mesh); void UnregisterMeshName(const STR_String& meshname,void* mesh); CTR_Map& GetMeshMap() { return m_mapStringToMeshes; } CTR_Map& GetActionMap() { return m_mapStringToActions; } - + void RegisterActionName(const STR_String& actname,void* action); void* GetActionByName (const STR_String& actname); @@ -144,8 +144,8 @@ public: void RegisterGameObj(void* blendobj, CValue* gameobj); void UnregisterGameObj(void* blendobj, CValue* gameobj); CValue* FindGameObjByBlendObj(void* blendobj); - - + + #ifdef WITH_CXX_GUARDEDALLOC MEM_CXX_CLASS_ALLOC_FUNCS("GE:SCA_LogicManager") #endif diff --git a/source/gameengine/GameLogic/SCA_MouseManager.cpp b/source/gameengine/GameLogic/SCA_MouseManager.cpp index 51c03d1e350..1842b7a9ded 100644 --- a/source/gameengine/GameLogic/SCA_MouseManager.cpp +++ b/source/gameengine/GameLogic/SCA_MouseManager.cpp @@ -85,17 +85,17 @@ void SCA_MouseManager::NextFrame() // coordinates if (!mousesensor->IsSuspended()) { - const SCA_InputEvent& event1 = + const SCA_InputEvent& event1 = m_mousedevice->GetEventValue(SCA_IInputDevice::KX_MOUSEX); - const SCA_InputEvent& event2 = + const SCA_InputEvent& event2 = m_mousedevice->GetEventValue(SCA_IInputDevice::KX_MOUSEY); int mx = this->m_canvas->GetMouseX(event1.m_eventval); int my = this->m_canvas->GetMouseY(event2.m_eventval); - + mousesensor->setX(mx); mousesensor->setY(my); - + mousesensor->Activate(m_logicmgr); } } @@ -107,6 +107,6 @@ bool SCA_MouseManager::IsPressed(SCA_IInputDevice::KX_EnumInputs inputcode) /* We should guard for non-mouse events maybe? A rather silly side */ /* effect here is that position-change events are considered presses as */ /* well. */ - + return m_mousedevice->IsPressed(inputcode); } diff --git a/source/gameengine/GameLogic/SCA_MouseManager.h b/source/gameengine/GameLogic/SCA_MouseManager.h index a57e52070a7..de932584ede 100644 --- a/source/gameengine/GameLogic/SCA_MouseManager.h +++ b/source/gameengine/GameLogic/SCA_MouseManager.h @@ -50,10 +50,10 @@ class SCA_MouseManager : public SCA_EventManager class SCA_IInputDevice* m_mousedevice; class RAS_ICanvas* m_canvas; - + unsigned short m_xpos; // Cached location of the mouse pointer unsigned short m_ypos; - + public: SCA_MouseManager(class SCA_LogicManager* logicmgr,class SCA_IInputDevice* mousedev, class RAS_ICanvas* canvas); virtual ~SCA_MouseManager(); diff --git a/source/gameengine/GameLogic/SCA_MouseSensor.cpp b/source/gameengine/GameLogic/SCA_MouseSensor.cpp index 2479e859dea..c1ad1c4543a 100644 --- a/source/gameengine/GameLogic/SCA_MouseSensor.cpp +++ b/source/gameengine/GameLogic/SCA_MouseSensor.cpp @@ -48,7 +48,7 @@ /* Native functions */ /* ------------------------------------------------------------------------- */ -SCA_MouseSensor::SCA_MouseSensor(SCA_MouseManager* eventmgr, +SCA_MouseSensor::SCA_MouseSensor(SCA_MouseManager* eventmgr, int startx,int starty, short int mousemode, SCA_IObject* gameobj) @@ -69,7 +69,7 @@ void SCA_MouseSensor::Init() m_reset = true; } -SCA_MouseSensor::~SCA_MouseSensor() +SCA_MouseSensor::~SCA_MouseSensor() { /* Nothing to be done here. */ } @@ -78,8 +78,8 @@ void SCA_MouseSensor::UpdateHotkey(void *self) { // gosh, this function is so damn stupid // its here because of a design mistake in the mouse sensor, it should only - // have 3 trigger modes (button, wheel, move), and let the user set the - // hotkey separately, like the other sensors. but instead it has a mode for + // have 3 trigger modes (button, wheel, move), and let the user set the + // hotkey separately, like the other sensors. but instead it has a mode for // each friggin key and i have to update the hotkey based on it... genius! SCA_MouseSensor* sensor = reinterpret_cast(self); @@ -121,21 +121,21 @@ bool SCA_MouseSensor::IsPositiveTrigger() bool result = (m_val != 0); if (m_invert) result = !result; - + return result; } short int SCA_MouseSensor::GetModeKey() -{ +{ return m_mousemode; } SCA_IInputDevice::KX_EnumInputs SCA_MouseSensor::GetHotKey() -{ +{ return m_hotkey; } @@ -195,22 +195,22 @@ bool SCA_MouseSensor::Evaluate() { m_val = 1; result = true; - } + } else if (eventX.m_status == SCA_InputEvent::KX_JUSTRELEASED || eventY.m_status == SCA_InputEvent::KX_JUSTRELEASED ) { m_val = 0; result = true; - } + } else //KX_NO_IMPUTSTATUS - { + { if (m_val == 1) { m_val = 0; result = true; } } - + break; } default: @@ -251,19 +251,19 @@ KX_PYMETHODDEF_DOC_O(SCA_MouseSensor, getButtonStatus, if (PyLong_Check(value)) { SCA_IInputDevice::KX_EnumInputs button = (SCA_IInputDevice::KX_EnumInputs)PyLong_AsLong(value); - + if ((button < SCA_IInputDevice::KX_LEFTMOUSE) || (button > SCA_IInputDevice::KX_RIGHTMOUSE)) { PyErr_SetString(PyExc_ValueError, "sensor.getButtonStatus(int): Mouse Sensor, invalid button specified!"); return NULL; } - + SCA_IInputDevice* mousedev = ((SCA_MouseManager *)m_eventmgr)->GetInputDevice(); const SCA_InputEvent& event = mousedev->GetEventValue(button); return PyLong_FromLong(event.m_status); } - + Py_RETURN_NONE; } diff --git a/source/gameengine/GameLogic/SCA_MouseSensor.h b/source/gameengine/GameLogic/SCA_MouseSensor.h index 2660aaeacb5..53785fa40da 100644 --- a/source/gameengine/GameLogic/SCA_MouseSensor.h +++ b/source/gameengine/GameLogic/SCA_MouseSensor.h @@ -40,7 +40,7 @@ class SCA_MouseSensor : public SCA_ISensor { Py_Header - + /** * Use SCA_IInputDevice values to encode the mouse mode for now. */ @@ -51,12 +51,12 @@ class SCA_MouseSensor : public SCA_ISensor */ bool m_triggermode; /** - * Remember the last state update + * Remember the last state update */ int m_val; SCA_IInputDevice::KX_EnumInputs m_hotkey; - + /** * valid x coordinate, MUST be followed by y coordinate */ @@ -66,7 +66,7 @@ class SCA_MouseSensor : public SCA_ISensor * valid y coordinate */ short m_y; - + public: /** * Allowable modes for the trigger status of the mouse sensor. @@ -86,7 +86,7 @@ class SCA_MouseSensor : public SCA_ISensor }; bool isValid(KX_MOUSESENSORMODE); - + SCA_MouseSensor(class SCA_MouseManager* keybdmgr, int startx,int starty, short int mousemode, @@ -109,7 +109,7 @@ class SCA_MouseSensor : public SCA_ISensor /* --------------------------------------------------------------------- */ /* Python interface ---------------------------------------------------- */ /* --------------------------------------------------------------------- */ - + static int UpdateHotkeyPy(void *self, const PyAttributeDef *); // get button status diff --git a/source/gameengine/GameLogic/SCA_NANDController.cpp b/source/gameengine/GameLogic/SCA_NANDController.cpp index 6a00c110e2b..ce98c8a5d7c 100644 --- a/source/gameengine/GameLogic/SCA_NANDController.cpp +++ b/source/gameengine/GameLogic/SCA_NANDController.cpp @@ -71,7 +71,7 @@ void SCA_NANDController::Trigger(SCA_LogicManager* logicmgr) break; } } - + for (vector::const_iterator i=m_linkedactuators.begin(); !(i==m_linkedactuators.end());i++) { diff --git a/source/gameengine/GameLogic/SCA_NORController.cpp b/source/gameengine/GameLogic/SCA_NORController.cpp index fb09617e060..16a82a6d23e 100644 --- a/source/gameengine/GameLogic/SCA_NORController.cpp +++ b/source/gameengine/GameLogic/SCA_NORController.cpp @@ -71,7 +71,7 @@ void SCA_NORController::Trigger(SCA_LogicManager* logicmgr) break; } } - + for (vector::const_iterator i=m_linkedactuators.begin(); !(i==m_linkedactuators.end());i++) { diff --git a/source/gameengine/GameLogic/SCA_ORController.cpp b/source/gameengine/GameLogic/SCA_ORController.cpp index 8a59bdf1b89..f758c096cc0 100644 --- a/source/gameengine/GameLogic/SCA_ORController.cpp +++ b/source/gameengine/GameLogic/SCA_ORController.cpp @@ -78,7 +78,7 @@ void SCA_ORController::Trigger(SCA_LogicManager* logicmgr) if (sensor->GetState()) sensorresult = true; is++; } - + for (vector::const_iterator i=m_linkedactuators.begin(); !(i==m_linkedactuators.end());i++) { diff --git a/source/gameengine/GameLogic/SCA_PropertyActuator.cpp b/source/gameengine/GameLogic/SCA_PropertyActuator.cpp index f2907ca6361..87b0503ede8 100644 --- a/source/gameengine/GameLogic/SCA_PropertyActuator.cpp +++ b/source/gameengine/GameLogic/SCA_PropertyActuator.cpp @@ -89,9 +89,9 @@ bool SCA_PropertyActuator::Update() CParser parser; parser.SetContext( propowner->AddRef()); - + CExpression* userexpr= NULL; - + if (m_type==KX_ACT_PROP_TOGGLE) { /* don't use */ @@ -127,7 +127,7 @@ bool SCA_PropertyActuator::Update() case KX_ACT_PROP_ASSIGN: { - + CValue* newval = userexpr->Calculate(); CValue* oldprop = propowner->GetProperty(m_propname); if (oldprop) @@ -184,11 +184,11 @@ bool SCA_PropertyActuator::Update() userexpr->Release(); } - + return result; } - bool + bool SCA_PropertyActuator:: @@ -203,7 +203,7 @@ isValid( } - CValue* + CValue* SCA_PropertyActuator:: diff --git a/source/gameengine/GameLogic/SCA_PropertyActuator.h b/source/gameengine/GameLogic/SCA_PropertyActuator.h index 228ecf94bc4..57483bd0e05 100644 --- a/source/gameengine/GameLogic/SCA_PropertyActuator.h +++ b/source/gameengine/GameLogic/SCA_PropertyActuator.h @@ -37,7 +37,7 @@ class SCA_PropertyActuator : public SCA_IActuator { Py_Header - + enum KX_ACT_PROP_MODE { KX_ACT_PROP_NODEF = 0, KX_ACT_PROP_ASSIGN, @@ -47,10 +47,10 @@ class SCA_PropertyActuator : public SCA_IActuator KX_ACT_PROP_LEVEL, KX_ACT_PROP_MAX }; - + /**check whether this value is valid */ bool isValid(KX_ACT_PROP_MODE mode); - + int m_type; STR_String m_propname; STR_String m_exprtxt; @@ -70,7 +70,7 @@ public: ~SCA_PropertyActuator(); - CValue* + CValue* GetReplica( ); @@ -78,13 +78,13 @@ public: virtual bool UnlinkObject(SCA_IObject* clientobj); virtual void Relink(CTR_Map *obj_map); - virtual bool + virtual bool Update(); /* --------------------------------------------------------------------- */ /* Python interface ---------------------------------------------------- */ /* --------------------------------------------------------------------- */ - + }; #endif /* __KX_PROPERTYACTUATOR_DOC */ diff --git a/source/gameengine/GameLogic/SCA_PropertySensor.cpp b/source/gameengine/GameLogic/SCA_PropertySensor.cpp index e34a5296139..f823320a417 100644 --- a/source/gameengine/GameLogic/SCA_PropertySensor.cpp +++ b/source/gameengine/GameLogic/SCA_PropertySensor.cpp @@ -86,7 +86,7 @@ CValue* SCA_PropertySensor::GetReplica() // m_range_expr must be recalculated on replica! replica->ProcessReplica(); replica->Init(); - + return replica; } @@ -113,7 +113,7 @@ bool SCA_PropertySensor::Evaluate() { bool result = CheckPropertyCondition(); bool reset = m_reset && m_level; - + m_reset = false; if (m_lastresult!=result) { @@ -147,7 +147,7 @@ bool SCA_PropertySensor::CheckPropertyCondition() m_checkpropval.Upper(); } result = (testprop == m_checkpropval); - + /* Patch: floating point values cant use strings usefully since you can have "0.0" == "0.0000" * this could be made into a generic Value class function for comparing values with a string. */ @@ -155,7 +155,7 @@ bool SCA_PropertySensor::CheckPropertyCondition() float f; if (sscanf(m_checkpropval.ReadPtr(), "%f", &f) == 1) { result = (f == ((CFloatValue *)orgprop)->GetFloat()); - } + } else { /* error */ } @@ -215,7 +215,7 @@ bool SCA_PropertySensor::CheckPropertyCondition() case KX_PROPSENSOR_CHANGED: { CValue* orgprop = GetParent()->FindIdentifier(m_checkpropname); - + if (!orgprop->IsError()) { if (m_previoustext != orgprop->GetText()) diff --git a/source/gameengine/GameLogic/SCA_PropertySensor.h b/source/gameengine/GameLogic/SCA_PropertySensor.h index f9cfb5fb1d2..eac1f22cccb 100644 --- a/source/gameengine/GameLogic/SCA_PropertySensor.h +++ b/source/gameengine/GameLogic/SCA_PropertySensor.h @@ -63,7 +63,7 @@ public: }; const STR_String S_KX_PROPSENSOR_EQ_STRING; - + SCA_PropertySensor(class SCA_EventManager* eventmgr, SCA_IObject* gameobj, const STR_String& propname, diff --git a/source/gameengine/GameLogic/SCA_PythonController.cpp b/source/gameengine/GameLogic/SCA_PythonController.cpp index fd2e723741c..8da660686ef 100644 --- a/source/gameengine/GameLogic/SCA_PythonController.cpp +++ b/source/gameengine/GameLogic/SCA_PythonController.cpp @@ -68,7 +68,7 @@ SCA_PythonController::SCA_PythonController(SCA_IObject* gameobj, int mode) #endif { - + } #if 0 @@ -90,10 +90,10 @@ SCA_PythonController::~SCA_PythonController() #ifdef WITH_PYTHON //printf("released python byte script\n"); - + Py_XDECREF(m_bytecode); Py_XDECREF(m_function); - + if (m_pythondictionary) { // break any circular references in the dictionary PyDict_Clear(m_pythondictionary); @@ -112,14 +112,14 @@ CValue* SCA_PythonController::GetReplica() /* why is this needed at all??? - m_bytecode is NULL'd below so this doesnt make sense * but removing it crashes blender (with YoFrankie). so leave in for now - Campbell */ Py_XINCREF(replica->m_bytecode); - + Py_XINCREF(replica->m_function); // this is ok since its not set to NULL replica->m_bModified = replica->m_bytecode == NULL; - + // The replica->m_pythondictionary is stolen - replace with a copy. if (m_pythondictionary) replica->m_pythondictionary = PyDict_Copy(m_pythondictionary); - + #if 0 // The other option is to incref the replica->m_pythondictionary - // the replica objects can then share data. @@ -128,7 +128,7 @@ CValue* SCA_PythonController::GetReplica() #endif #endif /* WITH_PYTHON */ - + // this will copy properties and so on... replica->ProcessReplica(); @@ -138,7 +138,7 @@ CValue* SCA_PythonController::GetReplica() void SCA_PythonController::SetScriptText(const STR_String& text) -{ +{ m_scriptText = text; m_bModified = true; } @@ -160,19 +160,19 @@ void SCA_PythonController::SetNamespace(PyObject* pythondictionary) Py_DECREF(m_pythondictionary); } m_pythondictionary = PyDict_Copy(pythondictionary); /* new reference */ - + /* Without __file__ set the sys.argv[0] is used for the filename * which ends up with lines from the blender binary being printed in the console */ PyObject *value = PyUnicode_From_STR_String(m_scriptName); PyDict_SetItemString(m_pythondictionary, "__file__", value); Py_DECREF(value); - + } #endif bool SCA_PythonController::IsTriggered(class SCA_ISensor* sensor) { - if (std::find(m_triggeredSensors.begin(), m_triggeredSensors.end(), sensor) != + if (std::find(m_triggeredSensors.begin(), m_triggeredSensors.end(), sensor) != m_triggeredSensors.end()) { return true; @@ -201,7 +201,7 @@ SCA_IActuator* SCA_PythonController::LinkedActuatorFromPy(PyObject *value) // we don't want to crash gameengine/blender by python scripts std::vector lacts = m_sCurrentController->GetLinkedActuators(); std::vector::iterator it; - + if (PyUnicode_Check(value)) { /* get the actuator from the name */ const char *name= _PyUnicode_AsString(value); @@ -278,7 +278,7 @@ void SCA_PythonController::ErrorPrint(const char *error_msg) } printf("%s - object '%s', controller '%s':\n", error_msg, obj_name, ctr_name); PyErr_Print(); - + /* Added in 2.48a, the last_traceback can reference Objects for example, increasing * their user count. Not to mention holding references to wrapped data. * This is especially bad when the PyObject for the wrapped data is freed, after blender @@ -291,16 +291,16 @@ bool SCA_PythonController::Compile() { //printf("py script modified '%s'\n", m_scriptName.Ptr()); m_bModified= false; - + // if a script already exists, decref it before replace the pointer to a new script if (m_bytecode) { Py_DECREF(m_bytecode); m_bytecode=NULL; } - + // recompile the scripttext into bytecode m_bytecode = Py_CompileString(m_scriptText.Ptr(), m_scriptName.Ptr(), Py_file_input); - + if (m_bytecode) { return true; } else { @@ -317,7 +317,7 @@ bool SCA_PythonController::Import() /* in case we re-import */ Py_XDECREF(m_function); m_function= NULL; - + STR_String mod_path_str= m_scriptText; /* just for storage, use C style string access */ char *mod_path= mod_path_str.Ptr(); char *function_string; @@ -361,26 +361,26 @@ bool SCA_PythonController::Import() printf("Python module error in object '%s', controller '%s':\n '%s' module found but function missing\n", GetParent()->GetName().Ptr(), GetName().Ptr(), m_scriptText.Ptr()); return false; } - + if (!PyCallable_Check(m_function)) { Py_DECREF(m_function); m_function = NULL; printf("Python module function error in object '%s', controller '%s':\n '%s' not callable\n", GetParent()->GetName().Ptr(), GetName().Ptr(), m_scriptText.Ptr()); return false; } - + m_function_argc = 0; /* rare cases this could be a function that isn't defined in python, assume zero args */ if (PyFunction_Check(m_function)) { m_function_argc= ((PyCodeObject *)PyFunction_GET_CODE(m_function))->co_argcount; } - + if (m_function_argc > 1) { Py_DECREF(m_function); m_function = NULL; printf("Python module function in object '%s', controller '%s':\n '%s' takes %d args, should be zero or 1 controller arg\n", GetParent()->GetName().Ptr(), GetName().Ptr(), m_scriptText.Ptr(), m_function_argc); return false; } - + return true; } @@ -391,7 +391,7 @@ void SCA_PythonController::Trigger(SCA_LogicManager* logicmgr) PyObject *excdict= NULL; PyObject *resultobj= NULL; - + switch (m_mode) { case SCA_PYEXEC_SCRIPT: { @@ -454,7 +454,7 @@ void SCA_PythonController::Trigger(SCA_LogicManager* logicmgr) Py_DECREF(resultobj); else ErrorPrint("Python script error"); - + if (excdict) /* Only for SCA_PYEXEC_SCRIPT types */ { /* clear after PyErrPrint - seems it can be using @@ -463,7 +463,7 @@ void SCA_PythonController::Trigger(SCA_LogicManager* logicmgr) //PyDict_Clear(excdict); Py_DECREF(excdict); } - + m_triggeredSensors.clear(); m_sCurrentController = NULL; } @@ -474,11 +474,11 @@ PyObject *SCA_PythonController::PyActivate(PyObject *value) PyErr_SetString(PyExc_SystemError, "Cannot activate an actuator from a non-active controller"); return NULL; } - + SCA_IActuator* actu = LinkedActuatorFromPy(value); if (actu==NULL) return NULL; - + m_logicManager->AddActiveActuator((SCA_IActuator*)actu, true); Py_RETURN_NONE; } @@ -489,11 +489,11 @@ PyObject *SCA_PythonController::PyDeActivate(PyObject *value) PyErr_SetString(PyExc_SystemError, "Cannot deactivate an actuator from a non-active controller"); return NULL; } - + SCA_IActuator* actu = LinkedActuatorFromPy(value); if (actu==NULL) return NULL; - + m_logicManager->AddActiveActuator((SCA_IActuator*)actu, false); Py_RETURN_NONE; } @@ -512,18 +512,18 @@ PyObject *SCA_PythonController::pyattr_get_script(void *self_v, const KX_PYATTRI int SCA_PythonController::pyattr_set_script(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) { SCA_PythonController* self = static_cast(self_v); - + const char *scriptArg = _PyUnicode_AsString(value); - + if (scriptArg==NULL) { PyErr_SetString(PyExc_TypeError, "controller.script = string: Python Controller, expected a string script text"); return PY_SET_ATTR_FAIL; } - /* set scripttext sets m_bModified to true, + /* set scripttext sets m_bModified to true, * so next time the script is needed, a reparse into byte code is done */ self->SetScriptText(scriptArg); - + return PY_SET_ATTR_SUCCESS; } diff --git a/source/gameengine/GameLogic/SCA_PythonController.h b/source/gameengine/GameLogic/SCA_PythonController.h index 11241da9117..ffb23c152ea 100644 --- a/source/gameengine/GameLogic/SCA_PythonController.h +++ b/source/gameengine/GameLogic/SCA_PythonController.h @@ -52,7 +52,7 @@ class SCA_PythonController : public SCA_IController bool m_debug; /* use with SCA_PYEXEC_MODULE for reloading every logic run */ int m_mode; - + protected: STR_String m_scriptText; STR_String m_scriptName; @@ -61,7 +61,7 @@ class SCA_PythonController : public SCA_IController PyObject* m_pythonfunction; /* for SCA_PYEXEC_MODULE only */ #endif std::vector m_triggeredSensors; - + public: enum SCA_PyExecMode { @@ -81,7 +81,7 @@ class SCA_PythonController : public SCA_IController virtual CValue* GetReplica(); virtual void Trigger(class SCA_LogicManager* logicmgr); - + void SetScriptText(const STR_String& text); void SetScriptName(const STR_String& name); #ifdef WITH_PYTHON @@ -94,7 +94,7 @@ class SCA_PythonController : public SCA_IController bool Compile(); bool Import(); void ErrorPrint(const char *error_msg); - + #ifdef WITH_PYTHON static const char *sPyGetCurrentController__doc__; static PyObject *sPyGetCurrentController(PyObject *self); @@ -103,13 +103,13 @@ class SCA_PythonController : public SCA_IController PyObject *args); static SCA_IActuator* LinkedActuatorFromPy(PyObject *value); - + KX_PYMETHOD_O(SCA_PythonController,Activate); KX_PYMETHOD_O(SCA_PythonController,DeActivate); KX_PYMETHOD_O(SCA_PythonController,SetScript); KX_PYMETHOD_NOARGS(SCA_PythonController,GetScript); - + static PyObject* pyattr_get_script(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); static int pyattr_set_script(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); #endif diff --git a/source/gameengine/GameLogic/SCA_PythonJoystick.cpp b/source/gameengine/GameLogic/SCA_PythonJoystick.cpp index 9b24ad7bcf2..06f42e84147 100644 --- a/source/gameengine/GameLogic/SCA_PythonJoystick.cpp +++ b/source/gameengine/GameLogic/SCA_PythonJoystick.cpp @@ -125,7 +125,7 @@ PyObject* SCA_PythonJoystick::pyattr_get_num_x(void *self_v, const KX_PYATTRIBUT PyObject* SCA_PythonJoystick::pyattr_get_active_buttons(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) { SCA_PythonJoystick* self = static_cast(self_v); - + const int button_number = self->m_joystick->GetNumberOfButtons(); PyObject *list = PyList_New(0); @@ -145,25 +145,25 @@ PyObject* SCA_PythonJoystick::pyattr_get_active_buttons(void *self_v, const KX_P PyObject* SCA_PythonJoystick::pyattr_get_hat_values(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) { SCA_PythonJoystick* self = static_cast(self_v); - + int hat_index = self->m_joystick->GetNumberOfHats(); PyObject *list = PyList_New(hat_index); - + while (hat_index--) { PyList_SET_ITEM(list, hat_index, PyLong_FromLong(self->m_joystick->GetHat(hat_index))); } - + return list; } PyObject* SCA_PythonJoystick::pyattr_get_axis_values(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) { SCA_PythonJoystick* self = static_cast(self_v); - + int axis_index = self->m_joystick->GetNumberOfAxes(); PyObject *list = PyList_New(axis_index); int position; - + while (axis_index--) { position = self->m_joystick->GetAxisPosition(axis_index); @@ -175,7 +175,7 @@ PyObject* SCA_PythonJoystick::pyattr_get_axis_values(void *self_v, const KX_PYAT else PyList_SET_ITEM(list, axis_index, PyFloat_FromDouble(position/(double)SHRT_MAX)); } - + return list; } diff --git a/source/gameengine/GameLogic/SCA_PythonKeyboard.cpp b/source/gameengine/GameLogic/SCA_PythonKeyboard.cpp index 9a96a7b0334..388ee5b9d4f 100644 --- a/source/gameengine/GameLogic/SCA_PythonKeyboard.cpp +++ b/source/gameengine/GameLogic/SCA_PythonKeyboard.cpp @@ -112,7 +112,7 @@ PyAttributeDef SCA_PythonKeyboard::Attributes[] = { PyObject *SCA_PythonKeyboard::pyattr_get_events(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) { SCA_PythonKeyboard* self = static_cast(self_v); - + for (int i = SCA_IInputDevice::KX_BEGINKEY; i <= SCA_IInputDevice::KX_ENDKEY; i++) { const SCA_InputEvent & inevent = self->m_keyboard->GetEventValue((SCA_IInputDevice::KX_EnumInputs)i); PyObject *key = PyLong_FromLong(i); @@ -132,10 +132,10 @@ PyObject *SCA_PythonKeyboard::pyattr_get_active_events(void *self_v, const KX_PY SCA_PythonKeyboard* self = static_cast(self_v); PyDict_Clear(self->m_event_dict); - + for (int i = SCA_IInputDevice::KX_BEGINKEY; i <= SCA_IInputDevice::KX_ENDKEY; i++) { const SCA_InputEvent & inevent = self->m_keyboard->GetEventValue((SCA_IInputDevice::KX_EnumInputs)i); - + if (inevent.m_status != SCA_InputEvent::KX_NO_INPUTSTATUS) { PyObject *key = PyLong_FromLong(i); PyObject *value = PyLong_FromLong(inevent.m_status); diff --git a/source/gameengine/GameLogic/SCA_PythonMouse.cpp b/source/gameengine/GameLogic/SCA_PythonMouse.cpp index 184b306a665..111d8abe8c5 100644 --- a/source/gameengine/GameLogic/SCA_PythonMouse.cpp +++ b/source/gameengine/GameLogic/SCA_PythonMouse.cpp @@ -95,7 +95,7 @@ PyAttributeDef SCA_PythonMouse::Attributes[] = { PyObject *SCA_PythonMouse::pyattr_get_events(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) { SCA_PythonMouse* self = static_cast(self_v); - + for (int i = SCA_IInputDevice::KX_BEGINMOUSE; i <= SCA_IInputDevice::KX_ENDMOUSE; i++) { const SCA_InputEvent &inevent = self->m_mouse->GetEventValue((SCA_IInputDevice::KX_EnumInputs)i); PyObject *key = PyLong_FromLong(i); @@ -115,10 +115,10 @@ PyObject *SCA_PythonMouse::pyattr_get_active_events(void *self_v, const KX_PYATT SCA_PythonMouse* self = static_cast(self_v); PyDict_Clear(self->m_event_dict); - + for (int i = SCA_IInputDevice::KX_BEGINMOUSE; i <= SCA_IInputDevice::KX_ENDMOUSE; i++) { const SCA_InputEvent &inevent = self->m_mouse->GetEventValue((SCA_IInputDevice::KX_EnumInputs)i); - + if (inevent.m_status != SCA_InputEvent::KX_NO_INPUTSTATUS) { PyObject *key = PyLong_FromLong(i); diff --git a/source/gameengine/GameLogic/SCA_RandomActuator.cpp b/source/gameengine/GameLogic/SCA_RandomActuator.cpp index 8d75be9089d..121be5f003e 100644 --- a/source/gameengine/GameLogic/SCA_RandomActuator.cpp +++ b/source/gameengine/GameLogic/SCA_RandomActuator.cpp @@ -47,7 +47,7 @@ /* Native functions */ /* ------------------------------------------------------------------------- */ -SCA_RandomActuator::SCA_RandomActuator(SCA_IObject *gameobj, +SCA_RandomActuator::SCA_RandomActuator(SCA_IObject *gameobj, long seed, SCA_RandomActuator::KX_RANDOMACT_MODE mode, float para1, @@ -62,14 +62,14 @@ SCA_RandomActuator::SCA_RandomActuator(SCA_IObject *gameobj, m_base = new SCA_RandomNumberGenerator(seed); m_counter = 0; enforceConstraints(); -} +} SCA_RandomActuator::~SCA_RandomActuator() { m_base->Release(); -} +} @@ -112,7 +112,7 @@ bool SCA_RandomActuator::Update() break; case KX_RANDOMACT_BOOL_UNIFORM: { /* flip a coin */ - bool res; + bool res; if (m_counter > 31) { m_previous = m_base->Draw(); res = ((m_previous & 0x1) == 0); @@ -138,7 +138,7 @@ bool SCA_RandomActuator::Update() break; case KX_RANDOMACT_INT_UNIFORM: { /* uniform (toss a die) */ - int res; + int res; /* The [0, 1] interval is projected onto the [min, max+1] domain, */ /* and then rounded. */ res = (int)floor( ((m_parameter2 - m_parameter1 + 1) * m_base->DrawFloat()) + m_parameter1); @@ -267,7 +267,7 @@ void SCA_RandomActuator::enforceConstraints() ; /* Nothing to be done here. We allow uniform distro's to have */ /* 'funny' domains, i.e. max < min. This does not give problems. */ break; - case KX_RANDOMACT_BOOL_BERNOUILLI: + case KX_RANDOMACT_BOOL_BERNOUILLI: /* clamp to [0, 1] */ if (m_parameter1 < 0.0) { m_parameter1 = 0.0; @@ -275,19 +275,19 @@ void SCA_RandomActuator::enforceConstraints() m_parameter1 = 1.0; } break; - case KX_RANDOMACT_INT_POISSON: + case KX_RANDOMACT_INT_POISSON: /* non-negative */ if (m_parameter1 < 0.0) { m_parameter1 = 0.0; } break; - case KX_RANDOMACT_FLOAT_NORMAL: + case KX_RANDOMACT_FLOAT_NORMAL: /* standard dev. is non-negative */ if (m_parameter2 < 0.0) { m_parameter2 = 0.0; } break; - case KX_RANDOMACT_FLOAT_NEGATIVE_EXPONENTIAL: + case KX_RANDOMACT_FLOAT_NEGATIVE_EXPONENTIAL: /* halflife must be non-negative */ if (m_parameter1 < 0.0) { m_parameter1 = 0.0; @@ -375,22 +375,22 @@ int SCA_RandomActuator::pyattr_set_seed(void *self, const struct KX_PYATTRIBUTE_ KX_PYMETHODDEF_DOC_VARARGS(SCA_RandomActuator, setBoolConst, "setBoolConst(value)\n" "\t- value: 0 or 1\n" -"\tSet this generator to produce a constant boolean value.\n") +"\tSet this generator to produce a constant boolean value.\n") { int paraArg; if (!PyArg_ParseTuple(args, "i:setBoolConst", ¶Arg)) { return NULL; } - + m_distribution = KX_RANDOMACT_BOOL_CONST; m_parameter1 = (paraArg) ? 1.0 : 0.0; - + Py_RETURN_NONE; } /* 12. setBoolUniform, */ KX_PYMETHODDEF_DOC_NOARGS(SCA_RandomActuator, setBoolUniform, "setBoolUniform()\n" -"\tSet this generator to produce true and false, each with 50%% chance of occurring\n") +"\tSet this generator to produce true and false, each with 50%% chance of occurring\n") { /* no args */ m_distribution = KX_RANDOMACT_BOOL_UNIFORM; @@ -407,7 +407,7 @@ KX_PYMETHODDEF_DOC_VARARGS(SCA_RandomActuator, setBoolBernouilli, if (!PyArg_ParseTuple(args, "f:setBoolBernouilli", ¶Arg)) { return NULL; } - + m_distribution = KX_RANDOMACT_BOOL_BERNOUILLI; m_parameter1 = paraArg; enforceConstraints(); @@ -417,13 +417,13 @@ KX_PYMETHODDEF_DOC_VARARGS(SCA_RandomActuator, setBoolBernouilli, KX_PYMETHODDEF_DOC_VARARGS(SCA_RandomActuator, setIntConst, "setIntConst(value)\n" "\t- value: integer\n" -"\tAlways return value\n") +"\tAlways return value\n") { int paraArg; if (!PyArg_ParseTuple(args, "i:setIntConst", ¶Arg)) { return NULL; } - + m_distribution = KX_RANDOMACT_INT_CONST; m_parameter1 = paraArg; enforceConstraints(); @@ -441,7 +441,7 @@ KX_PYMETHODDEF_DOC_VARARGS(SCA_RandomActuator, setIntUniform, if (!PyArg_ParseTuple(args, "ii:setIntUniform", ¶Arg1, ¶Arg2)) { return NULL; } - + m_distribution = KX_RANDOMACT_INT_UNIFORM; m_parameter1 = paraArg1; m_parameter2 = paraArg2; @@ -460,7 +460,7 @@ KX_PYMETHODDEF_DOC_VARARGS(SCA_RandomActuator, setIntPoisson, if (!PyArg_ParseTuple(args, "f:setIntPoisson", ¶Arg)) { return NULL; } - + m_distribution = KX_RANDOMACT_INT_POISSON; m_parameter1 = paraArg; enforceConstraints(); @@ -476,7 +476,7 @@ KX_PYMETHODDEF_DOC_VARARGS(SCA_RandomActuator, setFloatConst, if (!PyArg_ParseTuple(args, "f:setFloatConst", ¶Arg)) { return NULL; } - + m_distribution = KX_RANDOMACT_FLOAT_CONST; m_parameter1 = paraArg; enforceConstraints(); @@ -494,7 +494,7 @@ KX_PYMETHODDEF_DOC_VARARGS(SCA_RandomActuator, setFloatUniform, if (!PyArg_ParseTuple(args, "ff:setFloatUniform", ¶Arg1, ¶Arg2)) { return NULL; } - + m_distribution = KX_RANDOMACT_FLOAT_UNIFORM; m_parameter1 = paraArg1; m_parameter2 = paraArg2; @@ -513,7 +513,7 @@ KX_PYMETHODDEF_DOC_VARARGS(SCA_RandomActuator, setFloatNormal, if (!PyArg_ParseTuple(args, "ff:setFloatNormal", ¶Arg1, ¶Arg2)) { return NULL; } - + m_distribution = KX_RANDOMACT_FLOAT_NORMAL; m_parameter1 = paraArg1; m_parameter2 = paraArg2; @@ -521,7 +521,7 @@ KX_PYMETHODDEF_DOC_VARARGS(SCA_RandomActuator, setFloatNormal, Py_RETURN_NONE; } /* 20. setFloatNegativeExponential, */ -KX_PYMETHODDEF_DOC_VARARGS(SCA_RandomActuator, setFloatNegativeExponential, +KX_PYMETHODDEF_DOC_VARARGS(SCA_RandomActuator, setFloatNegativeExponential, "setFloatNegativeExponential(half_life)\n" "\t- half_life: float\n" "\tReturn negative-exponentially distributed numbers. The half-life 'time'\n" @@ -531,7 +531,7 @@ KX_PYMETHODDEF_DOC_VARARGS(SCA_RandomActuator, setFloatNegativeExponential, if (!PyArg_ParseTuple(args, "f:setFloatNegativeExponential", ¶Arg)) { return NULL; } - + m_distribution = KX_RANDOMACT_FLOAT_NEGATIVE_EXPONENTIAL; m_parameter1 = paraArg; enforceConstraints(); diff --git a/source/gameengine/GameLogic/SCA_RandomActuator.h b/source/gameengine/GameLogic/SCA_RandomActuator.h index 32b29fc4f43..0bce4b765f6 100644 --- a/source/gameengine/GameLogic/SCA_RandomActuator.h +++ b/source/gameengine/GameLogic/SCA_RandomActuator.h @@ -41,11 +41,11 @@ class SCA_RandomActuator : public SCA_IActuator Py_Header /** Property to assign to */ STR_String m_propname; - - /** First parameter. The meaning of the parameters depends on the + + /** First parameter. The meaning of the parameters depends on the * distribution */ float m_parameter1; - /** Second parameter. The meaning of the parameters depends on the + /** Second parameter. The meaning of the parameters depends on the * distribution */ float m_parameter2; @@ -60,7 +60,7 @@ class SCA_RandomActuator : public SCA_IActuator /** apply constraints for the chosen distribution to the parameters */ void enforceConstraints(void); - + public: enum KX_RANDOMACT_MODE { @@ -79,7 +79,7 @@ class SCA_RandomActuator : public SCA_IActuator }; /** distribution type */ KX_RANDOMACT_MODE m_distribution; - + SCA_RandomActuator(class SCA_IObject* gameobj, long seed, KX_RANDOMACT_MODE mode, @@ -88,12 +88,12 @@ class SCA_RandomActuator : public SCA_IActuator const STR_String &propName); virtual ~SCA_RandomActuator(); virtual bool Update(); - + virtual CValue* GetReplica(); virtual void ProcessReplica(); #ifdef WITH_PYTHON - + /* --------------------------------------------------------------------- */ /* Python interface ---------------------------------------------------- */ /* --------------------------------------------------------------------- */ diff --git a/source/gameengine/GameLogic/SCA_RandomNumberGenerator.cpp b/source/gameengine/GameLogic/SCA_RandomNumberGenerator.cpp index eca678f4e89..e6c1b51ea23 100644 --- a/source/gameengine/GameLogic/SCA_RandomNumberGenerator.cpp +++ b/source/gameengine/GameLogic/SCA_RandomNumberGenerator.cpp @@ -2,8 +2,8 @@ * \ingroup gamelogic */ /** - * Generate random numbers that can be used by other components. We - * convert to different types/distributions elsewhere. This just + * Generate random numbers that can be used by other components. We + * convert to different types/distributions elsewhere. This just * delivers a clean, random bitvector. * */ @@ -29,7 +29,7 @@ /* See the GNU Library General Public License for more details. */ /* You should have received a copy of the GNU Library General */ /* Public License along with this library; if not, write to the */ -/* Free Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA */ +/* Free Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA */ /* 02110-1301, USA */ /* Copyright (C) 1997 Makoto Matsumoto and Takuji Nishimura. */ @@ -39,14 +39,14 @@ #include #include "SCA_RandomNumberGenerator.h" -/* Period parameters */ +/* Period parameters */ #define N 624 #define M 397 #define MATRIX_A 0x9908b0df /* constant vector a */ #define UPPER_MASK 0x80000000 /* most significant w-r bits */ #define LOWER_MASK 0x7fffffff /* least significant r bits */ -/* Tempering parameters */ +/* Tempering parameters */ #define TEMPERING_MASK_B 0x9d2c5680 #define TEMPERING_MASK_C 0xefc60000 #define TEMPERING_SHIFT_U(y) (y >> 11) @@ -79,8 +79,8 @@ void SCA_RandomNumberGenerator::SetStartVector(void) } long SCA_RandomNumberGenerator::GetSeed() { return m_seed; } -void SCA_RandomNumberGenerator::SetSeed(long newseed) -{ +void SCA_RandomNumberGenerator::SetSeed(long newseed) +{ m_seed = newseed; SetStartVector(); } diff --git a/source/gameengine/GameLogic/SCA_RandomNumberGenerator.h b/source/gameengine/GameLogic/SCA_RandomNumberGenerator.h index 10818cb4e8f..574958e9bec 100644 --- a/source/gameengine/GameLogic/SCA_RandomNumberGenerator.h +++ b/source/gameengine/GameLogic/SCA_RandomNumberGenerator.h @@ -74,8 +74,8 @@ class SCA_RandomNumberGenerator { if (--m_refcount == 0) delete this; } - - + + #ifdef WITH_CXX_GUARDEDALLOC MEM_CXX_CLASS_ALLOC_FUNCS("GE:SCA_RandomNumberGenerator") #endif diff --git a/source/gameengine/GameLogic/SCA_RandomSensor.cpp b/source/gameengine/GameLogic/SCA_RandomSensor.cpp index 8f2dc8d80f5..0757655e7db 100644 --- a/source/gameengine/GameLogic/SCA_RandomSensor.cpp +++ b/source/gameengine/GameLogic/SCA_RandomSensor.cpp @@ -46,7 +46,7 @@ /* Native functions */ /* ------------------------------------------------------------------------- */ -SCA_RandomSensor::SCA_RandomSensor(SCA_EventManager* eventmgr, +SCA_RandomSensor::SCA_RandomSensor(SCA_EventManager* eventmgr, SCA_IObject* gameobj, int startseed) : SCA_ISensor(gameobj,eventmgr) @@ -57,7 +57,7 @@ SCA_RandomSensor::SCA_RandomSensor(SCA_EventManager* eventmgr, -SCA_RandomSensor::~SCA_RandomSensor() +SCA_RandomSensor::~SCA_RandomSensor() { m_basegenerator->Release(); } @@ -89,7 +89,7 @@ void SCA_RandomSensor::ProcessReplica() bool SCA_RandomSensor::IsPositiveTrigger() -{ +{ return (m_invert !=m_lastdraw); } diff --git a/source/gameengine/GameLogic/SCA_RandomSensor.h b/source/gameengine/GameLogic/SCA_RandomSensor.h index 66107b7b74b..40d7d7d66cd 100644 --- a/source/gameengine/GameLogic/SCA_RandomSensor.h +++ b/source/gameengine/GameLogic/SCA_RandomSensor.h @@ -62,7 +62,7 @@ public: /* --------------------------------------------------------------------- */ /* Python interface ---------------------------------------------------- */ /* --------------------------------------------------------------------- */ - + static PyObject* pyattr_get_seed(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); static int pyattr_set_seed(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); #endif diff --git a/source/gameengine/GameLogic/SCA_TimeEventManager.cpp b/source/gameengine/GameLogic/SCA_TimeEventManager.cpp index c56a1496823..7aa57b1b6b3 100644 --- a/source/gameengine/GameLogic/SCA_TimeEventManager.cpp +++ b/source/gameengine/GameLogic/SCA_TimeEventManager.cpp @@ -75,7 +75,7 @@ void SCA_TimeEventManager::NextFrame(double curtime, double fixedtime) if (m_timevalues.size() > 0 && fixedtime > 0.0) { CFloatValue* floatval = new CFloatValue(curtime); - + // update sensors, but ... need deltatime ! for (vector::iterator it = m_timevalues.begin(); !(it == m_timevalues.end()); ++it) @@ -84,7 +84,7 @@ void SCA_TimeEventManager::NextFrame(double curtime, double fixedtime) floatval->SetFloat(newtime); (*it)->SetValue(floatval); } - + floatval->Release(); } } diff --git a/source/gameengine/GameLogic/SCA_TimeEventManager.h b/source/gameengine/GameLogic/SCA_TimeEventManager.h index 38d7e3fc4d4..723a6ee10a7 100644 --- a/source/gameengine/GameLogic/SCA_TimeEventManager.h +++ b/source/gameengine/GameLogic/SCA_TimeEventManager.h @@ -41,7 +41,7 @@ using namespace std; class SCA_TimeEventManager : public SCA_EventManager { vector m_timevalues; // values that need their time updated regularly - + public: SCA_TimeEventManager(class SCA_LogicManager* logicmgr); virtual ~SCA_TimeEventManager(); diff --git a/source/gameengine/GameLogic/SCA_XORController.cpp b/source/gameengine/GameLogic/SCA_XORController.cpp index bb1ea822bd8..70e99a7f819 100644 --- a/source/gameengine/GameLogic/SCA_XORController.cpp +++ b/source/gameengine/GameLogic/SCA_XORController.cpp @@ -75,7 +75,7 @@ void SCA_XORController::Trigger(SCA_LogicManager* logicmgr) sensorresult = true; } } - + for (vector::const_iterator i=m_linkedactuators.begin(); !(i==m_linkedactuators.end());i++) { diff --git a/source/gameengine/GamePlayer/common/GPC_Canvas.cpp b/source/gameengine/GamePlayer/common/GPC_Canvas.cpp index 2b355407d46..1ab64c592a4 100644 --- a/source/gameengine/GamePlayer/common/GPC_Canvas.cpp +++ b/source/gameengine/GamePlayer/common/GPC_Canvas.cpp @@ -43,7 +43,7 @@ GPC_Canvas::GPC_Canvas( int width, int height -) : +) : m_width(width), m_height(height) { @@ -88,13 +88,13 @@ void GPC_Canvas::SetViewPort(int x1, int y1, int x2, int y2) the width,height is calculated including both pixels therefore: max - min + 1 */ - + /* XXX, nasty, this needs to go somewhere else, * but where... definitely need to clean up this * whole canvas/rendertools mess. */ glEnable(GL_SCISSOR_TEST); - + m_viewport[0] = x1; m_viewport[1] = y1; m_viewport[2] = x2-x1 + 1; diff --git a/source/gameengine/GamePlayer/common/GPC_Canvas.h b/source/gameengine/GamePlayer/common/GPC_Canvas.h index 688ed8ac0f4..615e3eaaf9e 100644 --- a/source/gameengine/GamePlayer/common/GPC_Canvas.h +++ b/source/gameengine/GamePlayer/common/GPC_Canvas.h @@ -74,20 +74,20 @@ public: /** * \section Methods inherited from abstract base class RAS_ICanvas. */ - - int + + int GetWidth( ) const { return m_width; } - - int + + int GetHeight( ) const { return m_height; } - const + const RAS_Rect & GetDisplayArea( ) const { @@ -100,24 +100,24 @@ public: ) { m_displayarea= *rect; }; - + RAS_Rect & GetWindowArea( ) { return m_displayarea; } - void + void BeginFrame( ) {}; /** * Draws overlay banners and progress bars. */ - void + void EndFrame( ) {}; - + void SetViewPort(int x1, int y1, int x2, int y2); void UpdateViewPort(int x1, int y1, int x2, int y2); const int *GetViewPort(); @@ -128,7 +128,7 @@ public: * \section Methods inherited from abstract base class RAS_ICanvas. * Semantics are not yet honored. */ - + void SetMouseState(RAS_MouseState mousestate) { // not yet diff --git a/source/gameengine/GamePlayer/common/GPC_KeyboardDevice.cpp b/source/gameengine/GamePlayer/common/GPC_KeyboardDevice.cpp index 0821d1d3b23..a48540e2bdb 100644 --- a/source/gameengine/GamePlayer/common/GPC_KeyboardDevice.cpp +++ b/source/gameengine/GamePlayer/common/GPC_KeyboardDevice.cpp @@ -34,7 +34,7 @@ #include -/** +/** * NextFrame toggles currentTable with previousTable, * and copies relevant event information from previous to current table * (pressed keys need to be remembered). @@ -60,7 +60,7 @@ void GPC_KeyboardDevice::NextFrame() -/** +/** * ConvertBPEvent translates Windows keyboard events into ketsji kbd events. * Extra event information is stored, like ramp-mode (just released/pressed) */ @@ -100,7 +100,7 @@ bool GPC_KeyboardDevice::ConvertEvent(int incode, int val, unsigned int unicode) m_eventStatusTables[m_currentTable][kxevent].m_status = SCA_InputEvent::KX_JUSTACTIVATED; } } - + } else { diff --git a/source/gameengine/GamePlayer/common/GPC_KeyboardDevice.h b/source/gameengine/GamePlayer/common/GPC_KeyboardDevice.h index d9842a42e0a..dc517b6ec25 100644 --- a/source/gameengine/GamePlayer/common/GPC_KeyboardDevice.h +++ b/source/gameengine/GamePlayer/common/GPC_KeyboardDevice.h @@ -76,14 +76,14 @@ public: } virtual void NextFrame(); - + virtual KX_EnumInputs ToNative(int incode) { return m_reverseKeyTranslateTable[incode]; } virtual bool ConvertEvent(int incode, int val, unsigned int unicode); - + virtual void HookEscape(); }; diff --git a/source/gameengine/GamePlayer/common/GPC_MouseDevice.cpp b/source/gameengine/GamePlayer/common/GPC_MouseDevice.cpp index 94045d532af..df388d4f5db 100644 --- a/source/gameengine/GamePlayer/common/GPC_MouseDevice.cpp +++ b/source/gameengine/GamePlayer/common/GPC_MouseDevice.cpp @@ -47,13 +47,13 @@ GPC_MouseDevice::~GPC_MouseDevice() bool GPC_MouseDevice::IsPressed(SCA_IInputDevice::KX_EnumInputs inputcode) { const SCA_InputEvent & inevent = m_eventStatusTables[m_currentTable][inputcode]; - bool pressed = (inevent.m_status == SCA_InputEvent::KX_JUSTACTIVATED || + bool pressed = (inevent.m_status == SCA_InputEvent::KX_JUSTACTIVATED || inevent.m_status == SCA_InputEvent::KX_ACTIVE); return pressed; } -/** +/** * NextFrame toggles currentTable with previousTable, * and copies relevant event information from previous to current table * (pressed keys need to be remembered). @@ -61,7 +61,7 @@ bool GPC_MouseDevice::IsPressed(SCA_IInputDevice::KX_EnumInputs inputcode) void GPC_MouseDevice::NextFrame() { SCA_IInputDevice::NextFrame(); - + // Convert just pressed events into regular (active) events int previousTable = 1-m_currentTable; for (int mouseevent= KX_BEGINMOUSE; mouseevent< KX_ENDMOUSEBUTTONS; mouseevent++) { @@ -156,7 +156,7 @@ bool GPC_MouseDevice::ConvertMoveEvent(int x, int y) bool GPC_MouseDevice::ConvertEvent(KX_EnumInputs kxevent, int eventval, unsigned int unicode) { bool result = true; - + // Only process it, if it's a mouse event if (kxevent > KX_BEGINMOUSE && kxevent < KX_ENDMOUSE) { int previousTable = 1-m_currentTable; @@ -180,7 +180,7 @@ bool GPC_MouseDevice::ConvertEvent(KX_EnumInputs kxevent, int eventval, unsigned } else { m_eventStatusTables[m_currentTable][kxevent].m_status = SCA_InputEvent::KX_ACTIVE; - + } break; } @@ -189,8 +189,8 @@ bool GPC_MouseDevice::ConvertEvent(KX_EnumInputs kxevent, int eventval, unsigned m_eventStatusTables[m_currentTable][kxevent].m_status = SCA_InputEvent::KX_JUSTACTIVATED; } } - - } + + } else { switch (m_eventStatusTables[previousTable][kxevent].m_status) { diff --git a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp index 50c34bbadaf..8cdeb0f2849 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp +++ b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp @@ -86,7 +86,7 @@ extern "C" #include "NG_LoopBackNetworkDeviceInterface.h" #include "GPC_MouseDevice.h" -#include "GPG_Canvas.h" +#include "GPG_Canvas.h" #include "GPG_KeyboardDevice.h" #include "GPG_System.h" @@ -108,24 +108,24 @@ static GHOST_ISystem* fSystem = 0; static const int kTimerFreq = 10; GPG_Application::GPG_Application(GHOST_ISystem* system) - : m_startSceneName(""), + : m_startSceneName(""), m_startScene(0), m_maggie(0), m_kxStartScene(NULL), m_exitRequested(0), - m_system(system), - m_mainWindow(0), - m_frameTimer(0), + m_system(system), + m_mainWindow(0), + m_frameTimer(0), m_cursor(GHOST_kStandardCursorFirstCursor), - m_engineInitialized(0), - m_engineRunning(0), + m_engineInitialized(0), + m_engineRunning(0), m_isEmbedded(false), m_ketsjiengine(0), - m_kxsystem(0), - m_keyboard(0), - m_mouse(0), + m_kxsystem(0), + m_keyboard(0), + m_mouse(0), m_canvas(0), - m_rasterizer(0), + m_rasterizer(0), m_sceneconverter(0), m_networkdevice(0), m_blendermat(0), @@ -164,7 +164,7 @@ bool GPG_Application::SetGameEngineData(struct Main* maggie, Scene *scene, Globa m_startScene = scene; result = true; } - + /* Python needs these */ m_argc= argc; m_argv= argv; @@ -190,8 +190,8 @@ static LRESULT CALLBACK screenSaverWindowProc(HWND hwnd, UINT uMsg, WPARAM wPara switch (uMsg) { case WM_MOUSEMOVE: - { - POINT pt; + { + POINT pt; GetCursorPos(&pt); LONG dx = scr_save_mouse_pos.x - pt.x; LONG dy = scr_save_mouse_pos.y - pt.y; @@ -203,9 +203,9 @@ static LRESULT CALLBACK screenSaverWindowProc(HWND hwnd, UINT uMsg, WPARAM wPara scr_save_mouse_pos = pt; break; } - case WM_LBUTTONDOWN: - case WM_MBUTTONDOWN: - case WM_RBUTTONDOWN: + case WM_LBUTTONDOWN: + case WM_MBUTTONDOWN: + case WM_RBUTTONDOWN: case WM_KEYDOWN: close = true; } @@ -432,7 +432,7 @@ bool GPG_Application::startFullScreen( bool GPG_Application::StartGameEngine(int stereoMode) { bool success = initEngine(m_mainWindow, stereoMode); - + if (success) success = startEngine(); @@ -464,7 +464,7 @@ bool GPG_Application::processEvent(GHOST_IEvent* event) case GHOST_kEventButtonUp: handled = handleButton(event, false); break; - + case GHOST_kEventWheel: handled = handleWheel(event); break; @@ -534,7 +534,7 @@ bool GPG_Application::processEvent(GHOST_IEvent* event) } } break; - + default: handled = false; break; @@ -574,7 +574,7 @@ bool GPG_Application::initEngine(GHOST_IWindow* window, const int stereoMode) SYS_SystemHandle syshandle = SYS_GetSystem(); if (!syshandle) return false; - + // SYS_WriteCommandLineInt(syshandle, "fixedtime", 0); // SYS_WriteCommandLineInt(syshandle, "vertexarrays",1); GameData *gm= &m_startScene->gm; @@ -606,7 +606,7 @@ bool GPG_Application::initEngine(GHOST_IWindow* window, const int stereoMode) m_canvas->Init(); if (gm->flag & GAME_SHOW_MOUSE) m_canvas->SetMouseState(RAS_ICanvas::MOUSE_NORMAL); - + RAS_STORAGE_TYPE raster_storage = RAS_AUTO_STORAGE; if (gm->raster_storage == RAS_STORE_VBO) { @@ -625,7 +625,7 @@ bool GPG_Application::initEngine(GHOST_IWindow* window, const int stereoMode) /* Stereo parameters - Eye Separation from the UI - stereomode from the command-line/UI */ m_rasterizer->SetStereoMode((RAS_IRasterizer::StereoMode) stereoMode); m_rasterizer->SetEyeSeparation(m_startScene->gm.eyeseparation); - + if (!m_rasterizer) goto initFailed; @@ -635,26 +635,26 @@ bool GPG_Application::initEngine(GHOST_IWindow* window, const int stereoMode) m_keyboard = new GPG_KeyboardDevice(); if (!m_keyboard) goto initFailed; - + m_mouse = new GPC_MouseDevice(); if (!m_mouse) goto initFailed; - + // create a networkdevice m_networkdevice = new NG_LoopBackNetworkDeviceInterface(); if (!m_networkdevice) goto initFailed; - + BKE_sound_init(m_maggie); // create a ketsjisystem (only needed for timing and stuff) m_kxsystem = new GPG_System (m_system); if (!m_kxsystem) goto initFailed; - + // create the ketsjiengine m_ketsjiengine = new KX_KetsjiEngine(m_kxsystem); - + // set the devices m_ketsjiengine->SetKeyboardDevice(m_keyboard); m_ketsjiengine->SetMouseDevice(m_mouse); @@ -705,7 +705,7 @@ bool GPG_Application::startEngine(void) if (m_engineRunning) { return false; } - + // Temporary hack to disable banner display for NaN approved content. /* m_canvas->SetBannerDisplayEnabled(true); @@ -721,7 +721,7 @@ bool GPG_Application::startEngine(void) return false; } */ - + // create a scene converter, create and convert the stratingscene m_sceneconverter = new KX_BlenderSceneConverter(m_maggie, m_ketsjiengine); if (m_sceneconverter) @@ -744,7 +744,7 @@ bool GPG_Application::startEngine(void) m_kxStartScenename, m_startScene, m_canvas); - + #ifdef WITH_PYTHON // some python things PyObject *gameLogic, *gameLogic_keys; @@ -771,7 +771,7 @@ bool GPG_Application::startEngine(void) m_rasterizer, m_canvas); m_ketsjiengine->AddScene(m_kxStartScene); - + // Create a timer that is used to kick the engine if (!m_frameTimer) { m_frameTimer = m_system->installTimer(0, kTimerFreq, frameTimerProc, m_mainWindow); @@ -779,19 +779,19 @@ bool GPG_Application::startEngine(void) m_rasterizer->Init(); m_ketsjiengine->StartEngine(true); m_engineRunning = true; - + // Set the animation playback rate for ipo's and actions // the framerate below should patch with FPS macro defined in blendef.h // Could be in StartEngine set the framerate, we need the scene to do this Scene *scene= m_kxStartScene->GetBlenderScene(); // needed for macro m_ketsjiengine->SetAnimFrameRate(FPS); } - + if (!m_engineRunning) { stopEngine(); } - + return m_engineRunning; } @@ -809,7 +809,7 @@ void GPG_Application::stopEngine() m_pyGlobalDictString_Length = saveGamePythonConfig(&m_pyGlobalDictString); #endif - + m_ketsjiengine->StopEngine(); m_networkdevice->Disconnect(); @@ -836,7 +836,7 @@ void GPG_Application::EngineNextFrame() // first check if we want to exit m_exitRequested = m_ketsjiengine->GetExitCode(); - + // kick the engine bool renderFrame = m_ketsjiengine->NextFrame(); if (renderFrame && m_mainWindow) @@ -907,7 +907,7 @@ bool GPG_Application::handleWheel(GHOST_IEvent* event) { bool handled = false; MT_assert(event); - if (m_mouse) + if (m_mouse) { GHOST_TEventDataPtr eventData = ((GHOST_IEvent*)event)->getData(); GHOST_TEventWheelData* wheelData = static_cast(eventData); @@ -926,7 +926,7 @@ bool GPG_Application::handleButton(GHOST_IEvent* event, bool isDown) { bool handled = false; MT_assert(event); - if (m_mouse) + if (m_mouse) { GHOST_TEventDataPtr eventData = ((GHOST_IEvent*)event)->getData(); GHOST_TEventButtonData* buttonData = static_cast(eventData); diff --git a/source/gameengine/GamePlayer/ghost/GPG_Application.h b/source/gameengine/GamePlayer/ghost/GPG_Application.h index e757cc10e32..37e3ea15f8a 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_Application.h +++ b/source/gameengine/GamePlayer/ghost/GPG_Application.h @@ -167,14 +167,14 @@ protected: bool m_blendermat; bool m_blenderglslmat; - + /* * GameLogic.globalDict as a string so that loading new blend files can use the same dict. * Do this because python starts/stops when loading blend files. */ char* m_pyGlobalDictString; int m_pyGlobalDictString_Length; - + /* argc and argv need to be passed on to python */ int m_argc; char** m_argv; diff --git a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp index 906e9d9a821..6c541758cb4 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp +++ b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp @@ -83,11 +83,11 @@ extern "C" #include "IMB_imbuf.h" #include "IMB_moviecache.h" - + #ifdef __APPLE__ int GHOST_HACK_getFirstFile(char buf[]); #endif - + // For BLF #include "BLF_api.h" #include "BLT_translation.h" @@ -161,7 +161,7 @@ typedef enum { static ScreenSaverMode scr_saver_mode = SCREEN_SAVER_MODE_NONE; static HWND scr_saver_hwnd = NULL; -static BOOL scr_saver_init(int argc, char **argv) +static BOOL scr_saver_init(int argc, char **argv) { scr_saver_mode = SCREEN_SAVER_MODE_NONE; scr_saver_hwnd = NULL; @@ -232,7 +232,7 @@ static void usage(const char* program, bool isBlenderPlayer) printf("Default values are set in the blend file.\n\n"); printf(" -h: Prints this command summary\n\n"); printf(" -w: display in a window\n"); - printf(" --Optional parameters--\n"); + printf(" --Optional parameters--\n"); printf(" w = window width\n"); printf(" h = window height\n"); printf(" l = window left coordinate\n"); @@ -303,7 +303,7 @@ static void get_filename(int argc, char **argv, char *filename) int srclen = ::strlen(argv[0]); int len = 0; char *gamefile = NULL; - + filename[0] = '\0'; if (argc > 1) { @@ -317,21 +317,21 @@ static void get_filename(int argc, char **argv, char *filename) } } } - + srclen -= ::strlen("MacOS/blenderplayer"); if (srclen > 0) { - len = srclen + ::strlen("Resources/game.blend"); + len = srclen + ::strlen("Resources/game.blend"); gamefile = new char [len + 1]; ::strcpy(gamefile, argv[0]); ::strcpy(gamefile + srclen, "Resources/game.blend"); //::printf("looking for file: %s\n", filename); - + if (BLI_exists(gamefile)) BLI_strncpy(filename, gamefile, FILE_MAX); delete [] gamefile; } - + #else filename[0] = '\0'; @@ -346,7 +346,7 @@ static BlendFileData *load_game_data(const char *progname, char *filename = NULL BlendFileData *bfd = NULL; BKE_reports_init(&reports, RPT_STORE); - + /* try to load ourself, will only work if we are a runtime */ if (BLO_is_a_runtime(progname)) { bfd= BLO_read_runtime(progname, &reports); @@ -357,7 +357,7 @@ static BlendFileData *load_game_data(const char *progname, char *filename = NULL } else { bfd= BLO_read_from_file(progname, &reports, BLO_READ_SKIP_NONE); } - + if (!bfd && filename) { bfd = load_game_data(filename); if (!bfd) { @@ -367,7 +367,7 @@ static BlendFileData *load_game_data(const char *progname, char *filename = NULL } BKE_reports_clear(&reports); - + return bfd; } @@ -397,9 +397,9 @@ static int GPG_PyNextFrame(void *state0) int exitcode; STR_String exitstring; bool run = GPG_NextFrame(state->system, state->app, exitcode, exitstring, state->gs); - if (run) return 0; + if (run) return 0; else { - if (exitcode) + if (exitcode) fprintf(stderr, "Exit code %d: %s\n", exitcode, exitstring.ReadPtr()); return 1; } @@ -447,7 +447,7 @@ int main( bool samplesParFound = false; GHOST_TUns16 aasamples = 0; int alphaBackground = 0; - + #ifdef WIN32 char **argv; int argv_num; @@ -488,7 +488,7 @@ int main( BKE_appdir_program_path_init(argv[0]); BKE_tempdir_init(NULL); - + // We don't use threads directly in the BGE, but we need to call this so things like // freeing up GPU_Textures works correctly. BLI_threadapi_init(); @@ -498,7 +498,7 @@ int main( RNA_init(); init_nodesystem(); - + BKE_blender_globals_init(); // We load our own G.main, so free the one that BKE_blender_globals_init() gives us @@ -584,7 +584,7 @@ int main( printf("Num of arguments is: %i\n", validArguments-1); //-1 because i starts at 1 #endif - for (i = 1; (i < validArguments) && !error + for (i = 1; (i < validArguments) && !error #ifdef WIN32 && scr_saver_mode == SCREEN_SAVER_MODE_NONE #endif @@ -601,7 +601,7 @@ int main( argc_py_clamped= i; break; } - + switch (argv[i][1]) { case 'g': //game engine options (show_framerate, fixedtime, etc) @@ -823,16 +823,16 @@ int main( i++; if (!strcmp(argv[i], "fisheye")) domeMode = DOME_FISHEYE; - + else if (!strcmp(argv[i], "truncatedfront")) domeMode = DOME_TRUNCATED_FRONT; - + else if (!strcmp(argv[i], "truncatedrear")) domeMode = DOME_TRUNCATED_REAR; - + else if (!strcmp(argv[i], "cubemap")) domeMode = DOME_ENVMAP; - + else if (!strcmp(argv[i], "sphericalpanoramic")) domeMode = DOME_PANORAM_SPH; @@ -867,7 +867,7 @@ int main( error = true; printf("error: window size too small.\n"); } - + if (error ) { usage(argv[0], isBlenderPlayer); @@ -882,15 +882,15 @@ int main( if (GHOST_ISystem::createSystem() == GHOST_kSuccess) { GHOST_ISystem* system = GHOST_ISystem::getSystem(); assertd(system); - + if (!fullScreenWidth || !fullScreenHeight) system->getMainDisplayDimensions(fullScreenWidth, fullScreenHeight); // process first batch of events. If the user // drops a file on top off the blenderplayer icon, we // receive an event with the filename - + system->processEvents(0); - + // this bracket is needed for app (see below) to get out // of scope before GHOST_ISystem::disposeSystem() is called. { @@ -905,7 +905,7 @@ int main( get_filename(argc_py_clamped, argv, filename); if (filename[0]) BLI_path_cwd(filename, sizeof(filename)); - + // fill the GlobalSettings with the first scene files // those may change during the game and persist after using Game Actuator @@ -914,16 +914,16 @@ int main( do { // Read the Blender file BlendFileData *bfd; - + // if we got an exitcode 3 (KX_EXIT_REQUEST_START_OTHER_GAME) load a different file if (exitcode == KX_EXIT_REQUEST_START_OTHER_GAME) { char basedpath[FILE_MAX]; - + // base the actuator filename relative to the last file BLI_strncpy(basedpath, exitstring.Ptr(), sizeof(basedpath)); BLI_path_abs(basedpath, pathname); - + bfd = load_game_data(basedpath); if (!bfd) { @@ -942,7 +942,7 @@ int main( #if defined(DEBUG) printf("Game data loaded from %s\n", filename); #endif - + if (!bfd) { usage(argv[0], isBlenderPlayer); error = true; @@ -970,9 +970,9 @@ int main( //Seg Fault; icon.c gIcons == 0 BKE_icons_init(1); - + titlename = maggie->name; - + // Check whether the game should be displayed full-screen if ((!fullScreenParFound) && (!windowParFound)) { // Only use file settings when command line did not override @@ -991,8 +991,8 @@ int main( windowHeight = scene->gm.yplay; } } - - + + // Check whether the game should be displayed in stereo (dome included) if (!stereoParFound) { // Only use file settings when command line did not override @@ -1028,7 +1028,7 @@ int main( scene->gm.dome.warptext = domeText; } } - + // GPG_Application app (system, maggie, startscenename); app.SetGameEngineData(maggie, scene, &gs, argc, argv); /* this argc cant be argc_py_clamped, since python uses it */ BLI_strncpy(pathname, maggie->name, sizeof(pathname)); @@ -1061,7 +1061,7 @@ int main( // on Mac's we'll show the executable name instead of the 'game.blend' name char tempname[1024], *appstring; ::strcpy(tempname, titlename); - + appstring = strstr(tempname, ".app/"); if (appstring) { appstring[2] = 0; @@ -1074,7 +1074,7 @@ int main( vector parts = path.Explode('/'); #else // WIN32 vector parts = path.Explode('\\'); -#endif // WIN32 +#endif // WIN32 STR_String title; if (parts.size()) { title = parts[parts.size()-1]; @@ -1114,10 +1114,10 @@ int main( app.StartGameEngine(stereomode); exitcode = KX_EXIT_REQUEST_NO_REQUEST; } - + // Add the application as event consumer system->addEventConsumer(&app); - + // Enter main loop bool run = true; char *python_main = NULL; diff --git a/source/gameengine/Ketsji/BL_Action.cpp b/source/gameengine/Ketsji/BL_Action.cpp index 7175eb877dd..43ec3016f51 100644 --- a/source/gameengine/Ketsji/BL_Action.cpp +++ b/source/gameengine/Ketsji/BL_Action.cpp @@ -59,10 +59,10 @@ extern "C" { #include "BLI_threads.h" // for lock /* Lock to solve animation thread issues. - * A spin lock is better than a mutex in case of short wait + * A spin lock is better than a mutex in case of short wait * because spin lock stop the thread by a loop contrary to mutex * which switch all memory, process. - */ + */ static SpinLock BL_ActionLock; BL_Action::BL_Action(class KX_GameObject* gameobj) @@ -232,7 +232,7 @@ bool BL_Action::Play(const char* name, m_obj->GetSGNode()->AddSGController(sg_contr); sg_contr->SetObject(m_obj->GetSGNode()); } - + m_ipo_flags = ipo_flags; InitIPO(); @@ -246,7 +246,7 @@ bool BL_Action::Play(const char* name, { BL_DeformableGameObject *obj = (BL_DeformableGameObject*)m_obj; BL_ShapeDeformer *shape_deformer = dynamic_cast(obj->GetDeformer()); - + if (shape_deformer && shape_deformer->GetKey()) { obj->GetShape(m_blendinshape); @@ -270,7 +270,7 @@ bool BL_Action::Play(const char* name, m_blendstart = 0.f; m_speed = playback_speed; m_layer_weight = layer_weight; - + m_done = false; m_initializedTime = false; @@ -314,7 +314,7 @@ const char *BL_Action::GetName() return ""; } - + } void BL_Action::SetFrame(float frame) @@ -324,7 +324,7 @@ void BL_Action::SetFrame(float frame) frame = min(m_startframe, m_endframe); else if (frame > max(m_startframe, m_endframe)) frame = max(m_startframe, m_endframe); - + m_localframe = frame; m_calc_localtime = false; } @@ -363,7 +363,7 @@ void BL_Action::IncrementBlending(float curtime) // Setup m_blendstart if we need to if (m_blendstart == 0.f) m_blendstart = curtime; - + // Bump the blend frame m_blendframe = (curtime - m_blendstart)*(float)KX_KetsjiEngine::GetAnimFrameRate(); @@ -378,10 +378,10 @@ void BL_Action::BlendShape(Key* key, float srcweight, std::vector& blends vector::const_iterator it; float dstweight; KeyBlock *kb; - + dstweight = 1.0F - srcweight; //printf("Dst: %f\tSrc: %f\n", srcweight, dstweight); - for (it=blendshape.begin(), kb = (KeyBlock *)key->block.first; + for (it=blendshape.begin(), kb = (KeyBlock *)key->block.first; kb && it != blendshape.end(); kb = (KeyBlock *)kb->next, it++) { diff --git a/source/gameengine/Ketsji/BL_ActionManager.h b/source/gameengine/Ketsji/BL_ActionManager.h index 69c6d611df0..90fa164853e 100644 --- a/source/gameengine/Ketsji/BL_ActionManager.h +++ b/source/gameengine/Ketsji/BL_ActionManager.h @@ -81,14 +81,14 @@ public: /** * Gets the name of the current action - */ + */ const char *GetActionName(short layer); /** * Sets the current frame of an action */ void SetActionFrame(short layer, float frame); - + /** * Gets the currently running action on the given layer */ diff --git a/source/gameengine/Ketsji/BL_BlenderShader.cpp b/source/gameengine/Ketsji/BL_BlenderShader.cpp index 9cbd61590b6..afcd6ca3a5c 100644 --- a/source/gameengine/Ketsji/BL_BlenderShader.cpp +++ b/source/gameengine/Ketsji/BL_BlenderShader.cpp @@ -41,7 +41,7 @@ #include "RAS_BucketManager.h" #include "RAS_MeshObject.h" #include "RAS_IRasterizer.h" - + BL_BlenderShader::BL_BlenderShader(KX_Scene *scene, struct Material *ma, int lightlayer) : mMat(ma), @@ -97,7 +97,7 @@ int BL_BlenderShader::GetAttribNum() for (i = 0; i < attribs.totlayer; i++) if (attribs.layer[i].glindex+1 > enabled) enabled= attribs.layer[i].glindex+1; - + if (enabled > BL_MAX_ATTRIB) enabled = BL_MAX_ATTRIB; @@ -114,7 +114,7 @@ void BL_BlenderShader::SetAttribs(RAS_IRasterizer* ras, const BL_Material *mat) if (!VerifyShader()) return; - + gpumat = mGPUMat; if (ras->GetDrawingMode() == RAS_IRasterizer::KX_TEXTURED || (ras->GetDrawingMode() == RAS_IRasterizer::KX_SHADOW && mat->alphablend != GEMAT_SOLID && !ras->GetUsingOverrideShader())) { diff --git a/source/gameengine/Ketsji/BL_BlenderShader.h b/source/gameengine/Ketsji/BL_BlenderShader.h index e03bb5a11d9..5222369c6b5 100644 --- a/source/gameengine/Ketsji/BL_BlenderShader.h +++ b/source/gameengine/Ketsji/BL_BlenderShader.h @@ -63,7 +63,7 @@ private: int mAlphaBlend; GPUMaterial *mGPUMat; - bool VerifyShader() + bool VerifyShader() { return (NULL != mGPUMat); } @@ -86,8 +86,8 @@ public: int GetAlphaBlend(); bool Equals(BL_BlenderShader *blshader); - - + + #ifdef WITH_CXX_GUARDEDALLOC MEM_CXX_CLASS_ALLOC_FUNCS("GE:BL_BlenderShader") #endif diff --git a/source/gameengine/Ketsji/BL_Material.cpp b/source/gameengine/Ketsji/BL_Material.cpp index 4f707e6267f..aad49b418fc 100644 --- a/source/gameengine/Ketsji/BL_Material.cpp +++ b/source/gameengine/Ketsji/BL_Material.cpp @@ -108,7 +108,7 @@ void BL_Material::SetSharedMaterial(bool v) { if ((v && num_users == -1) || num_users > 1 ) share = true; - else + else share = false; } diff --git a/source/gameengine/Ketsji/BL_Material.h b/source/gameengine/Ketsji/BL_Material.h index 9207a41f56d..14f9dfa4665 100644 --- a/source/gameengine/Ketsji/BL_Material.h +++ b/source/gameengine/Ketsji/BL_Material.h @@ -78,7 +78,7 @@ public: int blend_mode[MAXTEX]; int num_enabled; - + BL_Mapping mapping[MAXTEX]; STR_String imageId[MAXTEX]; @@ -93,8 +93,8 @@ public: void SetSharedMaterial(bool v); bool IsShared(); void SetUsers(int num); - - + + #ifdef WITH_CXX_GUARDEDALLOC MEM_CXX_CLASS_ALLOC_FUNCS("GE:BL_Material") #endif diff --git a/source/gameengine/Ketsji/BL_Shader.cpp b/source/gameengine/Ketsji/BL_Shader.cpp index d344e18c313..660924e2e67 100644 --- a/source/gameengine/Ketsji/BL_Shader.cpp +++ b/source/gameengine/Ketsji/BL_Shader.cpp @@ -373,7 +373,7 @@ bool BL_Shader::LinkProgram() goto programError; } } - + if (!tmpFrag && !tmpVert) { spit("---- No shader given ----"); goto programError; diff --git a/source/gameengine/Ketsji/BL_Texture.cpp b/source/gameengine/Ketsji/BL_Texture.cpp index c3b799b9424..7dac7993b8c 100644 --- a/source/gameengine/Ketsji/BL_Texture.cpp +++ b/source/gameengine/Ketsji/BL_Texture.cpp @@ -56,7 +56,7 @@ extern "C" { void my_free_envmapdata(EnvMap *env); } -// (n&(n-1)) zeros the least significant bit of n +// (n&(n-1)) zeros the least significant bit of n static int is_power_of_2_i(int num) { return ((num)&(num-1))==0; @@ -122,7 +122,7 @@ bool BL_Texture::InitFromImage(int unit, Image *img, bool mipmap) { ImBuf *ibuf; - if (!img || img->ok==0) + if (!img || img->ok==0) { mOk = false; return mOk; @@ -217,7 +217,7 @@ void BL_Texture::InitGLTex(unsigned int *pix,int x,int y,bool mipmap) glTexImage2D(GL_TEXTURE_2D, i, GL_RGBA, mip->x, mip->y, 0, GL_RGBA, GL_UNSIGNED_BYTE, mip->rect); } IMB_freeImBuf(ibuf); - } + } else { glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); @@ -237,7 +237,7 @@ void BL_Texture::InitGLCompressedTex(ImBuf *ibuf, bool mipmap) return; #else glBindTexture(GL_TEXTURE_2D, mTexture); - + if (GPU_upload_dxt_texture(ibuf) == 0) { InitGLTex(ibuf->rect, ibuf->x, ibuf->y, mipmap); return; @@ -289,7 +289,7 @@ bool BL_Texture::InitCubeMap(int unit, EnvMap *cubemap) mOk = false; return mOk; } - else if (!cubemap || cubemap->ima->ok==0) + else if (!cubemap || cubemap->ima->ok==0) { mOk = false; return mOk; @@ -336,7 +336,7 @@ bool BL_Texture::InitCubeMap(int unit, EnvMap *cubemap) bool needs_split = false; - if (!cubemap->cube[0]) + if (!cubemap->cube[0]) { needs_split = true; spit ("Re-Generating texture buffer"); @@ -407,7 +407,7 @@ void BL_Texture::Validate() bool BL_Texture::Ok() { - return (mTexture!= 0); + return (mTexture!= 0); } @@ -518,14 +518,14 @@ void BL_Texture::SetMapping(int mode) return; } - if ( mType == GL_TEXTURE_CUBE_MAP_ARB && + if ( mType == GL_TEXTURE_CUBE_MAP_ARB && GLEW_ARB_texture_cube_map && - mode &USEREFL) + mode &USEREFL) { glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_ARB ); glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_ARB ); glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_ARB ); - + glEnable(GL_TEXTURE_GEN_S); glEnable(GL_TEXTURE_GEN_T); glEnable(GL_TEXTURE_GEN_R); @@ -632,7 +632,7 @@ void BL_Texture::setTexEnv(BL_Material *mat, bool modulate) glTexEnvf( GL_TEXTURE_ENV, op2, alphaOp); }break; - case BLEND_MUL: + case BLEND_MUL: { // ------------------------------ glTexEnvf( GL_TEXTURE_ENV, combiner, GL_MODULATE); @@ -644,7 +644,7 @@ void BL_Texture::setTexEnv(BL_Material *mat, bool modulate) else glTexEnvf( GL_TEXTURE_ENV, op1, blend_operand); }break; - case BLEND_ADD: + case BLEND_ADD: { // ------------------------------ glTexEnvf( GL_TEXTURE_ENV, combiner, GL_ADD_SIGNED_ARB); @@ -656,7 +656,7 @@ void BL_Texture::setTexEnv(BL_Material *mat, bool modulate) else glTexEnvf( GL_TEXTURE_ENV, op1, blend_operand); }break; - case BLEND_SUB: + case BLEND_SUB: { // ------------------------------ glTexEnvf( GL_TEXTURE_ENV, combiner, GL_SUBTRACT_ARB); @@ -665,7 +665,7 @@ void BL_Texture::setTexEnv(BL_Material *mat, bool modulate) glTexEnvf( GL_TEXTURE_ENV, source1, GL_TEXTURE ); glTexEnvf( GL_TEXTURE_ENV, op1, blend_operand); }break; - case BLEND_SCR: + case BLEND_SCR: { // ------------------------------ glTexEnvf( GL_TEXTURE_ENV, combiner, GL_ADD); @@ -708,9 +708,9 @@ extern "C" { void my_envmap_split_ima(EnvMap *env, ImBuf *ibuf) { int dx, part; - + my_free_envmapdata(env); - + dx= ibuf->y; dx/= 2; if (3*dx != ibuf->x) { @@ -722,17 +722,17 @@ void my_envmap_split_ima(EnvMap *env, ImBuf *ibuf) for (part=0; part<6; part++) { env->cube[part] = IMB_allocImBuf(dx, dx, 24, IB_rect); } - IMB_rectcpy(env->cube[0], ibuf, + IMB_rectcpy(env->cube[0], ibuf, 0, 0, 0, 0, dx, dx); - IMB_rectcpy(env->cube[1], ibuf, + IMB_rectcpy(env->cube[1], ibuf, 0, 0, dx, 0, dx, dx); - IMB_rectcpy(env->cube[2], ibuf, + IMB_rectcpy(env->cube[2], ibuf, 0, 0, 2*dx, 0, dx, dx); - IMB_rectcpy(env->cube[3], ibuf, + IMB_rectcpy(env->cube[3], ibuf, 0, 0, 0, dx, dx, dx); - IMB_rectcpy(env->cube[4], ibuf, + IMB_rectcpy(env->cube[4], ibuf, 0, 0, dx, dx, dx, dx); - IMB_rectcpy(env->cube[5], ibuf, + IMB_rectcpy(env->cube[5], ibuf, 0, 0, 2*dx, dx, dx, dx); env->ok= 2;// ENV_OSA @@ -743,7 +743,7 @@ void my_envmap_split_ima(EnvMap *env, ImBuf *ibuf) void my_free_envmapdata(EnvMap *env) { unsigned int part; - + for (part=0; part<6; part++) { ImBuf *ibuf= env->cube[part]; if (ibuf) { diff --git a/source/gameengine/Ketsji/BL_Texture.h b/source/gameengine/Ketsji/BL_Texture.h index cd18ef93822..b2e17522e40 100644 --- a/source/gameengine/Ketsji/BL_Texture.h +++ b/source/gameengine/Ketsji/BL_Texture.h @@ -28,7 +28,7 @@ private: unsigned int mTexture; // Bound texture unit data bool mOk; // ... bool mNeedsDeleted; // If generated - unsigned int mType; // enum TEXTURE_2D | CUBE_MAP + unsigned int mType; // enum TEXTURE_2D | CUBE_MAP int mUnit; // Texture unit associated with mTexture unsigned int mEnvState; // cache textureEnv static unsigned int mDisableState; // speed up disabling calls diff --git a/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageActuator.h b/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageActuator.h index 325a7be9bd7..7b00129257a 100644 --- a/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageActuator.h +++ b/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageActuator.h @@ -58,8 +58,8 @@ public: virtual bool Update(); virtual CValue* GetReplica(); - virtual void Replace_NetworkScene(NG_NetworkScene *val) - { + virtual void Replace_NetworkScene(NG_NetworkScene *val) + { m_networkscene= val; }; diff --git a/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.h b/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.h index a1f0692b7b3..a519ccdab22 100644 --- a/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.h +++ b/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.h @@ -67,7 +67,7 @@ public: virtual bool IsPositiveTrigger(); virtual void Init(); void EndFrame(); - + virtual void Replace_NetworkScene(NG_NetworkScene *val) { m_NetworkScene= val; diff --git a/source/gameengine/Ketsji/KX_ArmatureSensor.h b/source/gameengine/Ketsji/KX_ArmatureSensor.h index b3ea905d198..725d6f208d6 100644 --- a/source/gameengine/Ketsji/KX_ArmatureSensor.h +++ b/source/gameengine/Ketsji/KX_ArmatureSensor.h @@ -52,8 +52,8 @@ public: const char *constraintname, int type, float value); - - /** + + /** * For property sensor, it is used to release the pre-calculated expression * so that self references are removed before the sensor itself is released */ diff --git a/source/gameengine/Ketsji/KX_BlenderMaterial.cpp b/source/gameengine/Ketsji/KX_BlenderMaterial.cpp index d26e35f8138..80ac8d9693f 100644 --- a/source/gameengine/Ketsji/KX_BlenderMaterial.cpp +++ b/source/gameengine/Ketsji/KX_BlenderMaterial.cpp @@ -223,7 +223,7 @@ void KX_BlenderMaterial::InitTextures() else if (!mMaterial->glslmat || mShader) { if ( mMaterial->img[i] ) { if ( ! mTextures[i].InitFromImage(i, mMaterial->img[i], (mMaterial->flag[i] &MIPMAP)!=0 )) - spit("unable to initialize image("<matname<< ", image will not be available"); } } @@ -235,7 +235,7 @@ void KX_BlenderMaterial::OnConstruction() if (mConstructed) // when material are reused between objects return; - + if (mMaterial->glslmat) SetBlenderGLSLShader(); @@ -318,7 +318,7 @@ void KX_BlenderMaterial::setShaderData( bool enable, RAS_IRasterizer *ras) BL_Texture::DisableAllTextures(); mShader->SetProg(true); mLastShader = mShader; - + BL_Texture::ActivateFirst(); mShader->ApplyShader(); @@ -411,7 +411,7 @@ void KX_BlenderMaterial::setTexData( bool enable, RAS_IRasterizer *ras) setObjectMatrixData(i, ras); else mTextures[i].SetMapping(mode); - + if (!(mode &USEOBJ)) setTexMatrixData( i ); } @@ -430,13 +430,13 @@ void KX_BlenderMaterial::setTexData( bool enable, RAS_IRasterizer *ras) void KX_BlenderMaterial::ActivatShaders( - RAS_IRasterizer* rasty, + RAS_IRasterizer* rasty, TCachingInfo& cachingInfo)const { KX_BlenderMaterial *tmp = const_cast(this); - // reset... - if (tmp->mMaterial->IsShared()) + // reset... + if (tmp->mMaterial->IsShared()) cachingInfo =0; if (mLastBlenderShader) { @@ -448,9 +448,9 @@ KX_BlenderMaterial::ActivatShaders( if (!cachingInfo) tmp->setShaderData(false, rasty); - + cachingInfo = GetCachingInfo(); - + if (rasty->GetDrawingMode() == RAS_IRasterizer::KX_TEXTURED) tmp->setShaderData(true, rasty); else if (rasty->GetDrawingMode() == RAS_IRasterizer::KX_SHADOW && mMaterial->alphablend != GEMAT_SOLID && !rasty->GetUsingOverrideShader()) @@ -466,7 +466,7 @@ KX_BlenderMaterial::ActivatShaders( if ((mMaterial->ras_mode &WIRE) || (rasty->GetDrawingMode() <= RAS_IRasterizer::KX_WIREFRAME)) { - if (mMaterial->ras_mode &WIRE) + if (mMaterial->ras_mode &WIRE) rasty->SetCullFace(false); rasty->SetLines(true); } @@ -482,7 +482,7 @@ KX_BlenderMaterial::ActivatShaders( void KX_BlenderMaterial::ActivateBlenderShaders( - RAS_IRasterizer* rasty, + RAS_IRasterizer* rasty, TCachingInfo& cachingInfo)const { KX_BlenderMaterial *tmp = const_cast(this); @@ -495,9 +495,9 @@ KX_BlenderMaterial::ActivateBlenderShaders( if (GetCachingInfo() != cachingInfo) { if (!cachingInfo) tmp->setBlenderShaderData(false, rasty); - + cachingInfo = GetCachingInfo(); - + if (rasty->GetDrawingMode() == RAS_IRasterizer::KX_TEXTURED) tmp->setBlenderShaderData(true, rasty); else if (rasty->GetDrawingMode() == RAS_IRasterizer::KX_SHADOW && mMaterial->alphablend != GEMAT_SOLID && !rasty->GetUsingOverrideShader()) @@ -513,7 +513,7 @@ KX_BlenderMaterial::ActivateBlenderShaders( if ((mMaterial->ras_mode &WIRE) || (rasty->GetDrawingMode() <= RAS_IRasterizer::KX_WIREFRAME)) { - if (mMaterial->ras_mode &WIRE) + if (mMaterial->ras_mode &WIRE) rasty->SetCullFace(false); rasty->SetLines(true); } @@ -526,8 +526,8 @@ KX_BlenderMaterial::ActivateBlenderShaders( } void -KX_BlenderMaterial::ActivateMat( - RAS_IRasterizer* rasty, +KX_BlenderMaterial::ActivateMat( + RAS_IRasterizer* rasty, TCachingInfo& cachingInfo )const { @@ -544,9 +544,9 @@ KX_BlenderMaterial::ActivateMat( } if (GetCachingInfo() != cachingInfo) { - if (!cachingInfo) + if (!cachingInfo) tmp->setTexData( false,rasty ); - + cachingInfo = GetCachingInfo(); if (rasty->GetDrawingMode() == RAS_IRasterizer::KX_TEXTURED) @@ -564,7 +564,7 @@ KX_BlenderMaterial::ActivateMat( if ((mMaterial->ras_mode &WIRE) || (rasty->GetDrawingMode() <= RAS_IRasterizer::KX_WIREFRAME)) { - if (mMaterial->ras_mode &WIRE) + if (mMaterial->ras_mode &WIRE) rasty->SetCullFace(false); rasty->SetLines(true); } @@ -578,9 +578,9 @@ KX_BlenderMaterial::ActivateMat( //ActivateTexGen(rasty); } -bool -KX_BlenderMaterial::Activate( - RAS_IRasterizer* rasty, +bool +KX_BlenderMaterial::Activate( + RAS_IRasterizer* rasty, TCachingInfo& cachingInfo )const { @@ -666,7 +666,7 @@ void KX_BlenderMaterial::ActivatGLMaterials( RAS_IRasterizer* rasty )const rasty->SetShinyness( mMaterial->hard ); rasty->SetDiffuse( - mMaterial->matcolor[0]*mMaterial->ref+mMaterial->emit, + mMaterial->matcolor[0]*mMaterial->ref+mMaterial->emit, mMaterial->matcolor[1]*mMaterial->ref+mMaterial->emit, mMaterial->matcolor[2]*mMaterial->ref+mMaterial->emit, 1.0f); @@ -687,7 +687,7 @@ void KX_BlenderMaterial::ActivatGLMaterials( RAS_IRasterizer* rasty )const void KX_BlenderMaterial::ActivateTexGen(RAS_IRasterizer *ras) const { - if (ras->GetDrawingMode() == RAS_IRasterizer::KX_TEXTURED || + if (ras->GetDrawingMode() == RAS_IRasterizer::KX_TEXTURED || (ras->GetDrawingMode() == RAS_IRasterizer::KX_SHADOW && mMaterial->alphablend != GEMAT_SOLID && !ras->GetUsingOverrideShader())) { ras->SetAttribNum(0); if (mShader && GLEW_ARB_shader_objects) { @@ -713,7 +713,7 @@ void KX_BlenderMaterial::ActivateTexGen(RAS_IRasterizer *ras) const ras->SetTexCoord(RAS_IRasterizer::RAS_TEXCO_UV, i); else if (mode &USETANG) ras->SetTexCoord(RAS_IRasterizer::RAS_TEXTANGENT, i); - else + else ras->SetTexCoord(RAS_IRasterizer::RAS_TEXCO_DISABLE, i); } } @@ -724,26 +724,26 @@ void KX_BlenderMaterial::setTexMatrixData(int i) glMatrixMode(GL_TEXTURE); glLoadIdentity(); - if ( GLEW_ARB_texture_cube_map && - mTextures[i].GetTextureType() == GL_TEXTURE_CUBE_MAP_ARB && + if ( GLEW_ARB_texture_cube_map && + mTextures[i].GetTextureType() == GL_TEXTURE_CUBE_MAP_ARB && mMaterial->mapping[i].mapping & USEREFL) { - glScalef( - mMaterial->mapping[i].scale[0], - -mMaterial->mapping[i].scale[1], + glScalef( + mMaterial->mapping[i].scale[0], + -mMaterial->mapping[i].scale[1], -mMaterial->mapping[i].scale[2] ); } else { - glScalef( - mMaterial->mapping[i].scale[0], - mMaterial->mapping[i].scale[1], + glScalef( + mMaterial->mapping[i].scale[0], + mMaterial->mapping[i].scale[1], mMaterial->mapping[i].scale[2] ); } glTranslatef( mMaterial->mapping[i].offsets[0], - mMaterial->mapping[i].offsets[1], + mMaterial->mapping[i].offsets[1], mMaterial->mapping[i].offsets[2] ); @@ -764,7 +764,7 @@ static void GetProjPlane(BL_Material *mat, int index,int num, float*param) void KX_BlenderMaterial::setObjectMatrixData(int i, RAS_IRasterizer *ras) { - KX_GameObject *obj = + KX_GameObject *obj = (KX_GameObject*) mScene->GetObjectList()->FindValue(mMaterial->mapping[i].objconame); @@ -780,7 +780,7 @@ void KX_BlenderMaterial::setObjectMatrixData(int i, RAS_IRasterizer *ras) float proj[4] = {0.f,0.f,0.f,0.f}; GetProjPlane(mMaterial, i, 0, proj); glTexGenfv(GL_S, plane, proj); - + GetProjPlane(mMaterial, i, 1, proj); glTexGenfv(GL_T, plane, proj); @@ -795,9 +795,9 @@ void KX_BlenderMaterial::setObjectMatrixData(int i, RAS_IRasterizer *ras) glMatrixMode(GL_TEXTURE); glLoadIdentity(); - glScalef( - mMaterial->mapping[i].scale[0], - mMaterial->mapping[i].scale[1], + glScalef( + mMaterial->mapping[i].scale[0], + mMaterial->mapping[i].scale[1], mMaterial->mapping[i].scale[2] ); @@ -968,7 +968,7 @@ void KX_BlenderMaterial_Mathutils_Callback_Init() #ifdef WITH_PYTHON -PyMethodDef KX_BlenderMaterial::Methods[] = +PyMethodDef KX_BlenderMaterial::Methods[] = { KX_PYMETHODTABLE( KX_BlenderMaterial, getShader ), KX_PYMETHODTABLE( KX_BlenderMaterial, getMaterialIndex ), @@ -1214,7 +1214,7 @@ KX_PYMETHODDEF_DOC( KX_BlenderMaterial, getShader , "getShader()") if ( !GLEW_ARB_fragment_shader) { if (!mModified) spit("Fragment shaders not supported"); - + mModified = true; Py_RETURN_NONE; } diff --git a/source/gameengine/Ketsji/KX_BlenderMaterial.h b/source/gameengine/Ketsji/KX_BlenderMaterial.h index a3d10c0a89d..02b60913b91 100644 --- a/source/gameengine/Ketsji/KX_BlenderMaterial.h +++ b/source/gameengine/Ketsji/KX_BlenderMaterial.h @@ -55,30 +55,30 @@ public: return (void*) this; } - virtual + virtual bool Activate( - RAS_IRasterizer* rasty, + RAS_IRasterizer* rasty, TCachingInfo& cachingInfo ) const; - - virtual + + virtual void ActivateMeshSlot( - const RAS_MeshSlot & ms, - RAS_IRasterizer* rasty + const RAS_MeshSlot & ms, + RAS_IRasterizer* rasty ) const; - + void ActivateMat( RAS_IRasterizer* rasty, TCachingInfo& cachingInfo )const; void ActivatShaders( - RAS_IRasterizer* rasty, + RAS_IRasterizer* rasty, TCachingInfo& cachingInfo )const; void ActivateBlenderShaders( - RAS_IRasterizer* rasty, + RAS_IRasterizer* rasty, TCachingInfo& cachingInfo )const; @@ -86,11 +86,11 @@ public: Image* GetBlenderImage() const; MTexPoly *GetMTexPoly() const; unsigned int* GetMCol() const; - BL_Texture * getTex (unsigned int idx) { - return (idx < MAXTEX) ? mTextures + idx : NULL; + BL_Texture * getTex (unsigned int idx) { + return (idx < MAXTEX) ? mTextures + idx : NULL; } - Image * getImage (unsigned int idx) { - return (idx < MAXTEX && mMaterial) ? mMaterial->img[idx] : NULL; + Image * getImage (unsigned int idx) { + return (idx < MAXTEX && mMaterial) ? mMaterial->img[idx] : NULL; } unsigned int* getBlendFunc() { return mBlendFunc; @@ -101,7 +101,7 @@ public: MT_Scalar hard, MT_Scalar spec, MT_Scalar ref, MT_Scalar emit, MT_Scalar alpha ); - + virtual void Replace_IScene(SCA_IScene *val); BL_Material *GetBLMaterial(); diff --git a/source/gameengine/Ketsji/KX_Camera.cpp b/source/gameengine/Ketsji/KX_Camera.cpp index 89aea80bb67..93f1621255d 100644 --- a/source/gameengine/Ketsji/KX_Camera.cpp +++ b/source/gameengine/Ketsji/KX_Camera.cpp @@ -30,7 +30,7 @@ * \ingroup ketsji */ - + #include "glew-mx.h" #include "KX_Camera.h" #include "KX_Scene.h" @@ -76,10 +76,10 @@ KX_Camera::~KX_Camera() CValue* KX_Camera::GetReplica() { KX_Camera* replica = new KX_Camera(*this); - + // this will copy properties and so on... replica->ProcessReplica(); - + return replica; } @@ -91,15 +91,15 @@ void KX_Camera::ProcessReplica() } MT_Transform KX_Camera::GetWorldToCamera() const -{ +{ MT_Transform camtrans; camtrans.invert(MT_Transform(NodeGetWorldPosition(), NodeGetWorldOrientation())); - + return camtrans; } - + MT_Transform KX_Camera::GetCameraToWorld() const { return MT_Transform(NodeGetWorldPosition(), NodeGetWorldOrientation()); @@ -121,7 +121,7 @@ const MT_Point3 KX_Camera::GetCameraLocation() const /* .... I want it in world coords */ //MT_Transform trans; //trans.setBasis(NodeGetWorldOrientation()); - + return NodeGetWorldPosition(); } @@ -261,7 +261,7 @@ float KX_Camera::GetFocalLength() const RAS_CameraData* KX_Camera::GetCameraData() { - return &m_camdata; + return &m_camdata; } void KX_Camera::ExtractClipPlanes() @@ -282,7 +282,7 @@ void KX_Camera::ExtractClipPlanes() m_planes[4] = m[3] + m[2]; // Far clip plane m_planes[5] = m[3] - m[2]; - + m_dirty = false; m_normalized = false; } @@ -291,14 +291,14 @@ void KX_Camera::NormalizeClipPlanes() { if (m_normalized) return; - + for (unsigned int p = 0; p < 6; p++) { MT_Scalar factor = sqrtf(m_planes[p][0]*m_planes[p][0] + m_planes[p][1]*m_planes[p][1] + m_planes[p][2]*m_planes[p][2]); if (!MT_fuzzyZero(factor)) m_planes[p] /= factor; } - + m_normalized = true; } @@ -382,15 +382,15 @@ void KX_Camera::ExtractFrustumSphere() // orthographic projection // The most extreme points on the near and far plane. (normalized device coords) MT_Vector4 hnear(1.0f, 1.0f, 1.0f, 1.0f), hfar(-1.0f, -1.0f, -1.0f, 1.0f); - + // Transform to hom camera local space hnear = clip_camcs_matrix*hnear; hfar = clip_camcs_matrix*hfar; - + // Tranform to 3d camera local space. MT_Point3 nearpoint(hnear[0]/hnear[3], hnear[1]/hnear[3], hnear[2]/hnear[3]); MT_Point3 farpoint(hfar[0]/hfar[3], hfar[1]/hfar[3], hfar[2]/hfar[3]); - + // just use mediant point m_frustum_center = (farpoint + nearpoint)*0.5f; m_frustum_radius = m_frustum_center.distance(farpoint); @@ -398,14 +398,14 @@ void KX_Camera::ExtractFrustumSphere() // Transform to world space. m_frustum_center = GetCameraToWorld()(m_frustum_center); m_frustum_radius /= fabsf(NodeGetWorldScaling()[NodeGetWorldScaling().closestAxis()]); - + m_set_frustum_center = true; } bool KX_Camera::PointInsideFrustum(const MT_Point3& x) { ExtractClipPlanes(); - + for ( unsigned int i = 0; i < 6 ; i++ ) { if (m_planes[i][0] * x[0] + m_planes[i][1] * x[1] + m_planes[i][2] * x[2] + m_planes[i][3] < 0.0f) @@ -417,7 +417,7 @@ bool KX_Camera::PointInsideFrustum(const MT_Point3& x) int KX_Camera::BoxInsideFrustum(const MT_Point3 *box) { ExtractClipPlanes(); - + unsigned int insideCount = 0; // 6 view frustum planes for ( unsigned int p = 0; p < 6 ; p++ ) @@ -429,7 +429,7 @@ int KX_Camera::BoxInsideFrustum(const MT_Point3 *box) if (m_planes[p][0] * box[v][0] + m_planes[p][1] * box[v][1] + m_planes[p][2] * box[v][2] + m_planes[p][3] < 0.0f) behindCount++; } - + // 8 points behind this plane if (behindCount == 8) return OUTSIDE; @@ -438,11 +438,11 @@ int KX_Camera::BoxInsideFrustum(const MT_Point3 *box) if (!behindCount) insideCount++; } - + // All box vertices are on the front side of all frustum planes. if (insideCount == 6) return INSIDE; - + return INTERSECT; } @@ -455,7 +455,7 @@ int KX_Camera::SphereInsideFrustum(const MT_Point3& center, const MT_Scalar &rad unsigned int p; ExtractClipPlanes(); NormalizeClipPlanes(); - + MT_Scalar distance; int intersect = INSIDE; // distance: <-------- OUTSIDE -----|----- INTERSECT -----0----- INTERSECT -----|----- INSIDE --------> @@ -468,7 +468,7 @@ int KX_Camera::SphereInsideFrustum(const MT_Point3& center, const MT_Scalar &rad else if (distance < -radius) return OUTSIDE; } - + return intersect; } @@ -476,7 +476,7 @@ bool KX_Camera::GetFrustumCulling() const { return m_frustum_culling; } - + void KX_Camera::EnableViewport(bool viewport) { InvalidateProjectionMatrix(false); // We need to reset projection matrix @@ -536,10 +536,10 @@ PyMethodDef KX_Camera::Methods[] = { }; PyAttributeDef KX_Camera::Attributes[] = { - + KX_PYATTRIBUTE_BOOL_RW("frustum_culling", KX_Camera, m_frustum_culling), KX_PYATTRIBUTE_RW_FUNCTION("perspective", KX_Camera, pyattr_get_perspective, pyattr_set_perspective), - + KX_PYATTRIBUTE_RW_FUNCTION("lens", KX_Camera, pyattr_get_lens, pyattr_set_lens), KX_PYATTRIBUTE_RW_FUNCTION("fov", KX_Camera, pyattr_get_fov, pyattr_set_fov), KX_PYATTRIBUTE_RW_FUNCTION("ortho_scale", KX_Camera, pyattr_get_ortho_scale, pyattr_set_ortho_scale), @@ -549,17 +549,17 @@ PyAttributeDef KX_Camera::Attributes[] = { KX_PYATTRIBUTE_RW_FUNCTION("shift_y", KX_Camera, pyattr_get_shift_y, pyattr_set_shift_y), KX_PYATTRIBUTE_RW_FUNCTION("useViewport", KX_Camera, pyattr_get_use_viewport, pyattr_set_use_viewport), - + KX_PYATTRIBUTE_RW_FUNCTION("projection_matrix", KX_Camera, pyattr_get_projection_matrix, pyattr_set_projection_matrix), KX_PYATTRIBUTE_RO_FUNCTION("modelview_matrix", KX_Camera, pyattr_get_modelview_matrix), KX_PYATTRIBUTE_RO_FUNCTION("camera_to_world", KX_Camera, pyattr_get_camera_to_world), KX_PYATTRIBUTE_RO_FUNCTION("world_to_camera", KX_Camera, pyattr_get_world_to_camera), - + /* Grrr, functions for constants? */ KX_PYATTRIBUTE_RO_FUNCTION("INSIDE", KX_Camera, pyattr_get_INSIDE), KX_PYATTRIBUTE_RO_FUNCTION("OUTSIDE", KX_Camera, pyattr_get_OUTSIDE), KX_PYATTRIBUTE_RO_FUNCTION("INTERSECT", KX_Camera, pyattr_get_INTERSECT), - + { NULL } //Sentinel }; @@ -621,7 +621,7 @@ KX_PYMETHODDEF_DOC_VARARGS(KX_Camera, sphereInsideFrustum, } PyErr_SetString(PyExc_TypeError, "camera.sphereInsideFrustum(center, radius): KX_Camera, expected arguments: (center, radius)"); - + return NULL; } @@ -656,7 +656,7 @@ KX_PYMETHODDEF_DOC_O(KX_Camera, boxInsideFrustum, PyErr_Format(PyExc_TypeError, "camera.boxInsideFrustum(box): KX_Camera, expected eight (8) points, got %d", num_points); return NULL; } - + MT_Point3 box[8]; for (unsigned int p = 0; p < 8 ; p++) { @@ -666,7 +666,7 @@ KX_PYMETHODDEF_DOC_O(KX_Camera, boxInsideFrustum, if (error) return NULL; } - + return PyLong_FromLong(BoxInsideFrustum(box)); /* new ref */ } @@ -691,7 +691,7 @@ KX_PYMETHODDEF_DOC_O(KX_Camera, pointInsideFrustum, { return PyLong_FromLong(PointInsideFrustum(point)); /* new ref */ } - + PyErr_SetString(PyExc_TypeError, "camera.pointInsideFrustum(point): KX_Camera, expected point argument."); return NULL; } @@ -721,7 +721,7 @@ KX_PYMETHODDEF_DOC_VARARGS(KX_Camera, setViewport, int left, bottom, right, top; if (!PyArg_ParseTuple(args,"iiii:setViewport",&left, &bottom, &right, &top)) return NULL; - + SetViewport(left, bottom, right, top); Py_RETURN_NONE; } @@ -749,7 +749,7 @@ int KX_Camera::pyattr_set_perspective(void *self_v, const KX_PYATTRIBUTE_DEF *at PyErr_SetString(PyExc_AttributeError, "camera.perspective = bool: KX_Camera, expected True/False or 0/1"); return PY_SET_ATTR_FAIL; } - + self->m_camdata.m_perspective= param; self->InvalidateProjectionMatrix(); return PY_SET_ATTR_SUCCESS; @@ -769,7 +769,7 @@ int KX_Camera::pyattr_set_lens(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyErr_SetString(PyExc_AttributeError, "camera.lens = float: KX_Camera, expected a float greater than zero"); return PY_SET_ATTR_FAIL; } - + self->m_camdata.m_lens= param; self->m_set_projection_matrix = false; return PY_SET_ATTR_SUCCESS; @@ -798,7 +798,7 @@ int KX_Camera::pyattr_set_fov(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, P fov *= MT_RADS_PER_DEG; float width = self->m_camdata.m_sensor_x; float lens = width / (2.0f * tanf(0.5f * fov)); - + self->m_camdata.m_lens= lens; self->m_set_projection_matrix = false; return PY_SET_ATTR_SUCCESS; @@ -818,7 +818,7 @@ int KX_Camera::pyattr_set_ortho_scale(void *self_v, const KX_PYATTRIBUTE_DEF *at PyErr_SetString(PyExc_AttributeError, "camera.ortho_scale = float: KX_Camera, expected a float greater than zero"); return PY_SET_ATTR_FAIL; } - + self->m_camdata.m_scale= param; self->m_set_projection_matrix = false; return PY_SET_ATTR_SUCCESS; @@ -838,7 +838,7 @@ int KX_Camera::pyattr_set_near(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyErr_SetString(PyExc_AttributeError, "camera.near = float: KX_Camera, expected a float greater than zero"); return PY_SET_ATTR_FAIL; } - + self->m_camdata.m_clipstart= param; self->m_set_projection_matrix = false; return PY_SET_ATTR_SUCCESS; @@ -858,7 +858,7 @@ int KX_Camera::pyattr_set_far(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, P PyErr_SetString(PyExc_AttributeError, "camera.far = float: KX_Camera, expected a float greater than zero"); return PY_SET_ATTR_FAIL; } - + self->m_camdata.m_clipend= param; self->m_set_projection_matrix = false; return PY_SET_ATTR_SUCCESS; @@ -926,16 +926,16 @@ int KX_Camera::pyattr_set_use_viewport(void *self_v, const KX_PYATTRIBUTE_DEF *a PyObject *KX_Camera::pyattr_get_projection_matrix(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) { KX_Camera* self = static_cast(self_v); - return PyObjectFrom(self->GetProjectionMatrix()); + return PyObjectFrom(self->GetProjectionMatrix()); } int KX_Camera::pyattr_set_projection_matrix(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) { KX_Camera* self = static_cast(self_v); MT_Matrix4x4 mat; - if (!PyMatTo(value, mat)) + if (!PyMatTo(value, mat)) return PY_SET_ATTR_FAIL; - + self->SetProjectionMatrix(mat); return PY_SET_ATTR_SUCCESS; } @@ -955,7 +955,7 @@ PyObject *KX_Camera::pyattr_get_camera_to_world(void *self_v, const KX_PYATTRIBU PyObject *KX_Camera::pyattr_get_world_to_camera(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) { KX_Camera* self = static_cast(self_v); - return PyObjectFrom(self->GetWorldToCamera()); + return PyObjectFrom(self->GetWorldToCamera()); } @@ -974,10 +974,10 @@ bool ConvertPythonToCamera(PyObject *value, KX_Camera **object, bool py_none_ok, *object = NULL; return false; } - + if (value==Py_None) { *object = NULL; - + if (py_none_ok) { return true; } else { @@ -985,11 +985,11 @@ bool ConvertPythonToCamera(PyObject *value, KX_Camera **object, bool py_none_ok, return false; } } - + if (PyUnicode_Check(value)) { STR_String value_str = _PyUnicode_AsString(value); *object = KX_GetActiveScene()->FindCamera(value_str); - + if (*object) { return true; } else { @@ -999,27 +999,27 @@ bool ConvertPythonToCamera(PyObject *value, KX_Camera **object, bool py_none_ok, return false; } } - + if (PyObject_TypeCheck(value, &KX_Camera::Type)) { *object = static_castBGE_PROXY_REF(value); - + /* sets the error */ if (*object==NULL) { PyErr_Format(PyExc_SystemError, "%s, " BGE_PROXY_ERROR_MSG, error_prefix); return false; } - + return true; } - + *object = NULL; - + if (py_none_ok) { PyErr_Format(PyExc_TypeError, "%s, expect a KX_Camera, a string or None", error_prefix); } else { PyErr_Format(PyExc_TypeError, "%s, expect a KX_Camera or a string", error_prefix); } - + return false; } diff --git a/source/gameengine/Ketsji/KX_Camera.h b/source/gameengine/Ketsji/KX_Camera.h index 8addf0b7aed..3b96d7d01b8 100644 --- a/source/gameengine/Ketsji/KX_Camera.h +++ b/source/gameengine/Ketsji/KX_Camera.h @@ -82,7 +82,7 @@ protected: * Storage for the modelview matrix that is passed to the * rasterizer. */ MT_Matrix4x4 m_modelview_matrix; - + /** * true if the view frustum (modelview/projection matrix) * has changed - the clip planes (m_planes) will have to be @@ -93,23 +93,23 @@ protected: * true if the frustum planes have been normalized. */ bool m_normalized; - + /** * View Frustum clip planes. */ MT_Vector4 m_planes[6]; - + /** * This camera is frustum culling. * Some cameras (ie if the game was started from a non camera view should not cull.) */ bool m_frustum_culling; - + /** * true if this camera has a valid projection matrix. */ bool m_set_projection_matrix; - + /** * The center point of the frustum. */ @@ -150,10 +150,10 @@ public: KX_Camera(void* sgReplicationInfo,SG_Callbacks callbacks,const RAS_CameraData& camdata, bool frustum_culling = true, bool delete_node = false); virtual ~KX_Camera(); - - /** + + /** * Inherited from CValue -- return a new copy of this - * instance allocated on the heap. Ownership of the new + * instance allocated on the heap. Ownership of the new * object belongs with the caller. */ virtual CValue* @@ -172,26 +172,26 @@ public: /* I want the camera orientation as well. */ const MT_Quaternion GetCameraOrientation() const; - + /** Sets the projection matrix that is used by the rasterizer. */ void SetProjectionMatrix(const MT_Matrix4x4 & mat); /** Sets the modelview matrix that is used by the rasterizer. */ void SetModelviewMatrix(const MT_Matrix4x4 & mat); - + /** Gets the projection matrix that is used by the rasterizer. */ const MT_Matrix4x4& GetProjectionMatrix() const; - + /** returns true if this camera has been set a projection matrix. */ bool hasValidProjectionMatrix() const; - + /** Sets the validity of the projection matrix. Call this if you change camera * data (eg lens, near plane, far plane) and require the projection matrix to be * recalculated. */ void InvalidateProjectionMatrix(bool valid = false); - - /** Gets the modelview matrix that is used by the rasterizer. + + /** Gets the modelview matrix that is used by the rasterizer. * \warning If the Camera is a dynamic object then this method may return garbage. Use GetWorldToCamera() instead. */ const MT_Matrix4x4& GetModelviewMatrix() const; @@ -218,7 +218,7 @@ public: float GetFocalLength() const; /** Gets all camera data. */ RAS_CameraData* GetCameraData(); - + /** * Tests if the given sphere is inside this camera's view frustum. * @@ -239,42 +239,42 @@ public: * \return true if the given point is inside or on the view frustum; false if it is outside. */ bool PointInsideFrustum(const MT_Point3& x); - + /** * Gets this camera's culling status. */ bool GetFrustumCulling() const; - + /** * Sets this camera's viewport status. */ void EnableViewport(bool viewport); - + /** * Sets this camera's viewport. */ void SetViewport(int left, int bottom, int right, int top); - + /** * Gets this camera's viewport status. */ bool GetViewport() const; - + /** * Gets this camera's viewport left. */ int GetViewportLeft() const; - + /** * Gets this camera's viewport bottom. */ int GetViewportBottom() const; - + /** * Gets this camera's viewport right. */ int GetViewportRight() const; - + /** * Gets this camera's viewport top. */ @@ -286,17 +286,17 @@ public: KX_PYMETHOD_DOC_VARARGS(KX_Camera, sphereInsideFrustum); KX_PYMETHOD_DOC_O(KX_Camera, boxInsideFrustum); KX_PYMETHOD_DOC_O(KX_Camera, pointInsideFrustum); - + KX_PYMETHOD_DOC_NOARGS(KX_Camera, getCameraToWorld); KX_PYMETHOD_DOC_NOARGS(KX_Camera, getWorldToCamera); - + KX_PYMETHOD_DOC_VARARGS(KX_Camera, setViewport); KX_PYMETHOD_DOC_NOARGS(KX_Camera, setOnTop); KX_PYMETHOD_DOC_O(KX_Camera, getScreenPosition); KX_PYMETHOD_DOC_VARARGS(KX_Camera, getScreenVect); KX_PYMETHOD_DOC_VARARGS(KX_Camera, getScreenRay); - + static PyObject* pyattr_get_perspective(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); static int pyattr_set_perspective(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); @@ -317,14 +317,14 @@ public: static PyObject* pyattr_get_use_viewport(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); static int pyattr_set_use_viewport(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); - + static PyObject* pyattr_get_projection_matrix(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); static int pyattr_set_projection_matrix(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); - + static PyObject* pyattr_get_modelview_matrix(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); static PyObject* pyattr_get_camera_to_world(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); static PyObject* pyattr_get_world_to_camera(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); - + static PyObject* pyattr_get_INSIDE(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); static PyObject* pyattr_get_OUTSIDE(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); static PyObject* pyattr_get_INTERSECT(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); diff --git a/source/gameengine/Ketsji/KX_CameraActuator.cpp b/source/gameengine/Ketsji/KX_CameraActuator.cpp index e488bf3c30a..f71699da5d8 100644 --- a/source/gameengine/Ketsji/KX_CameraActuator.cpp +++ b/source/gameengine/Ketsji/KX_CameraActuator.cpp @@ -40,21 +40,21 @@ #include #include "KX_GameObject.h" -#include "EXP_PyObjectPlus.h" +#include "EXP_PyObjectPlus.h" /* ------------------------------------------------------------------------- */ /* Native functions */ /* ------------------------------------------------------------------------- */ KX_CameraActuator::KX_CameraActuator( - SCA_IObject* gameobj, + SCA_IObject* gameobj, SCA_IObject *obj, float hght, float minhght, float maxhght, short axis, float damping -): +): SCA_IActuator(gameobj, KX_ACT_CAMERA), m_ob (obj), m_height (hght), @@ -73,7 +73,7 @@ KX_CameraActuator::~KX_CameraActuator() m_ob->UnregisterActuator(this); } - CValue* + CValue* KX_CameraActuator:: GetReplica( ) { @@ -126,7 +126,7 @@ static void Kx_VecUpMat3(float vec[3], float mat[3][3], short axis) float inp; short cox = 0, coy = 0, coz = 0; - + /* up range has no meaning, is not really up! * see: VecUpMat3old */ @@ -163,7 +163,7 @@ static void Kx_VecUpMat3(float vec[3], float mat[3][3], short axis) mat[coz][1] = 0.0f; mat[coz][2] = 0.0f; } - + inp = mat[coz][2]; mat[coy][0] = - inp * mat[coz][0]; mat[coy][1] = - inp * mat[coz][1]; @@ -175,7 +175,7 @@ static void Kx_VecUpMat3(float vec[3], float mat[3][3], short axis) mat[coy][1] = 1.f; mat[coy][2] = 0.f; } - + cross_v3_v3v3(mat[cox], mat[coy], mat[coz]); } @@ -186,9 +186,9 @@ bool KX_CameraActuator::Update(double curtime, bool frame) bool bNegativeEvent = IsNegativeEvent(); RemoveAllEvents(); - if (bNegativeEvent || !m_ob) + if (bNegativeEvent || !m_ob) return false; - + KX_GameObject *obj = (KX_GameObject*) GetParent(); MT_Point3 from = obj->NodeGetWorldPosition(); MT_Matrix3x3 frommat = obj->NodeGetWorldOrientation(); @@ -200,7 +200,7 @@ bool KX_CameraActuator::Update(double curtime, bool frame) float inp, fac; //, factor = 0.0; /* some factor... */ float mindistsq, maxdistsq, distsq; float mat[3][3]; - + /* The rules: */ /* CONSTRAINT 1: not implemented */ /* CONSTRAINT 2: can camera see actor? */ @@ -287,7 +287,7 @@ bool KX_CameraActuator::Update(double curtime, bool frame) from[0] += fac * fp1[0]; from[1] += fac * fp1[1]; from[2] += fac * fp1[2]; - + /* only for it lies: cross test and perpendicular bites up */ if (inp < 0.0f) { /* Don't do anything if the cross product is too small. @@ -313,14 +313,14 @@ bool KX_CameraActuator::Update(double curtime, bool frame) if (distsq > maxdistsq) { 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.15f * (mindistsq - distsq) / mindistsq; - + from[0] -= distsq*rc[0]; from[1] -= distsq*rc[1]; from[2] -= distsq*rc[2]; @@ -332,14 +332,14 @@ bool KX_CameraActuator::Update(double curtime, bool frame) rc[1] = (lookat[1]-from[1]); rc[2] = (lookat[2]-from[2]); Kx_VecUpMat3(rc, mat, 3); /* y up Track -z */ - + /* now set the camera position and rotation */ - + obj->NodeSetLocalPosition(from); - + actormat[0][0] = mat[0][0]; actormat[0][1] = mat[1][0]; actormat[0][2] = mat[2][0]; actormat[1][0] = mat[0][1]; actormat[1][1] = mat[1][1]; actormat[1][2] = mat[2][1]; actormat[2][0] = mat[0][2]; actormat[2][1] = mat[1][2]; actormat[2][2] = mat[2][2]; @@ -410,16 +410,16 @@ int KX_CameraActuator::pyattr_set_object(void *self_v, const KX_PYATTRIBUTE_DEF { KX_CameraActuator* self = static_cast(self_v); KX_GameObject *gameobj; - + if (!ConvertPythonToGameObject(self->GetLogicManager(), value, &gameobj, true, "actuator.object = value: KX_CameraActuator")) return PY_SET_ATTR_FAIL; // ConvertPythonToGameObject sets the error - + if (self->m_ob) self->m_ob->UnregisterActuator(self); if ((self->m_ob = (SCA_IObject*)gameobj)) self->m_ob->RegisterActuator(self); - + return PY_SET_ATTR_SUCCESS; } diff --git a/source/gameengine/Ketsji/KX_CameraActuator.h b/source/gameengine/Ketsji/KX_CameraActuator.h index fb0a7d88dd9..83668d8bf40 100644 --- a/source/gameengine/Ketsji/KX_CameraActuator.h +++ b/source/gameengine/Ketsji/KX_CameraActuator.h @@ -60,19 +60,19 @@ private : //const MT_Scalar m_minHeight; /** max (float), */ //const MT_Scalar m_maxHeight; - + /** height (float), */ float m_height; - + /** min (float), */ float m_minHeight; - + /** max (float), */ float m_maxHeight; - + /** axis the camera tries to get behind: +x/+y/-x/-y */ short m_axis; - + /** damping (float), */ float m_damping; @@ -81,11 +81,11 @@ private : /* parse x or y to a toggle pick */ bool string2axischoice(const char *axisString); - + public: static STR_String X_AXIS_STRING; static STR_String Y_AXIS_STRING; - + /** * Set the bool toggle to true to use x lock, false for y lock */ @@ -109,7 +109,7 @@ private : /** Methods Inherited from CValue */ CValue* GetReplica(); virtual void ProcessReplica(); - + /** Methods inherited from SCA_IActuator */ virtual bool Update( diff --git a/source/gameengine/Ketsji/KX_CameraIpoSGController.cpp b/source/gameengine/Ketsji/KX_CameraIpoSGController.cpp index a1c726209e1..70f5386fbb7 100644 --- a/source/gameengine/Ketsji/KX_CameraIpoSGController.cpp +++ b/source/gameengine/Ketsji/KX_CameraIpoSGController.cpp @@ -49,11 +49,11 @@ bool KX_CameraIpoSGController::Update(double currentTime) for (i = m_interpolators.begin(); !(i == m_interpolators.end()); ++i) { (*i)->Execute(m_ipotime); } - + SG_Spatial* ob = (SG_Spatial*)m_pObject; KX_Camera* kxcamera = (KX_Camera*) ob->GetSGClientObject(); RAS_CameraData* camdata = kxcamera->GetCameraData(); - + if (m_modify_lens) camdata->m_lens = m_lens; @@ -62,7 +62,7 @@ bool KX_CameraIpoSGController::Update(double currentTime) if (m_modify_clipend) camdata->m_clipend = m_clipend; - + if (m_modify_lens || m_modify_clipstart || m_modify_clipend) kxcamera->InvalidateProjectionMatrix(); @@ -102,7 +102,7 @@ SG_Controller* KX_CameraIpoSGController::GetReplica(class SG_Node* destnode) MT_Scalar* blaptr = (MT_Scalar*) newaddrbase; copyipo->SetNewTarget((MT_Scalar*)blaptr); } - + return iporeplica; } @@ -113,13 +113,13 @@ KX_CameraIpoSGController::~KX_CameraIpoSGController() for (i = m_interpolators.begin(); !(i == m_interpolators.end()); ++i) { delete (*i); } - + } void KX_CameraIpoSGController::SetOption( int option, - int value) + int value) { /* Setting options */ diff --git a/source/gameengine/Ketsji/KX_CameraIpoSGController.h b/source/gameengine/Ketsji/KX_CameraIpoSGController.h index 1f6f211622c..211c1a4e198 100644 --- a/source/gameengine/Ketsji/KX_CameraIpoSGController.h +++ b/source/gameengine/Ketsji/KX_CameraIpoSGController.h @@ -55,7 +55,7 @@ private: double m_ipotime; public: - KX_CameraIpoSGController() : + KX_CameraIpoSGController() : m_modify_lens(false), m_modify_clipstart(false), m_modify_clipend(false), @@ -87,8 +87,8 @@ public: m_modify_clipstart = modify; } void AddInterpolator(KX_IInterpolator* interp); - - + + #ifdef WITH_CXX_GUARDEDALLOC MEM_CXX_CLASS_ALLOC_FUNCS("GE:KX_CameraIpoSGController") #endif diff --git a/source/gameengine/Ketsji/KX_CharacterWrapper.h b/source/gameengine/Ketsji/KX_CharacterWrapper.h index dd7ba680ec7..262242b251b 100644 --- a/source/gameengine/Ketsji/KX_CharacterWrapper.h +++ b/source/gameengine/Ketsji/KX_CharacterWrapper.h @@ -23,7 +23,7 @@ public: KX_PYMETHOD_DOC_NOARGS(KX_CharacterWrapper, jump); static PyObject* pyattr_get_onground(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef); - + static PyObject* pyattr_get_gravity(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); static int pyattr_set_gravity(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); static PyObject* pyattr_get_max_jumps(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); diff --git a/source/gameengine/Ketsji/KX_ClientObjectInfo.h b/source/gameengine/Ketsji/KX_ClientObjectInfo.h index 81ae5b58009..bcbf06b947c 100644 --- a/source/gameengine/Ketsji/KX_ClientObjectInfo.h +++ b/source/gameengine/Ketsji/KX_ClientObjectInfo.h @@ -58,24 +58,24 @@ public: m_type(type), m_gameobject(gameobject) {} - + KX_ClientObjectInfo(const KX_ClientObjectInfo ©) : m_type(copy.m_type), m_gameobject(copy.m_gameobject) { } - + virtual ~KX_ClientObjectInfo() {} - - virtual bool hasCollisionCallback() + + virtual bool hasCollisionCallback() { return m_sensors.size() != 0; } - + bool isActor() { return m_type <= ACTOR; } bool isSensor() { return m_type >= SENSOR && m_type <= OBACTORSENSOR; } - - + + #ifdef WITH_CXX_GUARDEDALLOC MEM_CXX_CLASS_ALLOC_FUNCS("GE:KX_ClientObjectInfo") #endif diff --git a/source/gameengine/Ketsji/KX_ConstraintActuator.cpp b/source/gameengine/Ketsji/KX_ConstraintActuator.cpp index 27c074393b4..a1ccd9f8bf8 100644 --- a/source/gameengine/Ketsji/KX_ConstraintActuator.cpp +++ b/source/gameengine/Ketsji/KX_ConstraintActuator.cpp @@ -49,7 +49,7 @@ /* Native functions */ /* ------------------------------------------------------------------------- */ -KX_ConstraintActuator::KX_ConstraintActuator(SCA_IObject *gameobj, +KX_ConstraintActuator::KX_ConstraintActuator(SCA_IObject *gameobj, int posDampTime, int rotDampTime, float minBound, @@ -113,7 +113,7 @@ KX_ConstraintActuator::KX_ConstraintActuator(SCA_IObject *gameobj, } /* End of constructor */ KX_ConstraintActuator::~KX_ConstraintActuator() -{ +{ // there's nothing to be done here, really.... } /* end of destructor */ @@ -121,7 +121,7 @@ bool KX_ConstraintActuator::RayHit(KX_ClientObjectInfo *client, KX_RayCast *resu { m_hitObject = client->m_gameobject; - + bool bFound = false; if (m_property.IsEmpty()) @@ -339,7 +339,7 @@ bool KX_ConstraintActuator::Update(double curtime, bool frame) if (!pe) { std::cout << "WARNING: Constraint actuator " << GetName() << ": There is no physics environment!" << std::endl; goto CHECK_TIME; - } + } if (!spc) { // the object is not physical, we probably want to avoid hitting its own parent KX_GameObject *parent = obj->GetParent(); @@ -353,7 +353,7 @@ bool KX_ConstraintActuator::Update(double curtime, bool frame) MT_Vector3 newnormal = callback.m_hitNormal; // compute new position & orientation if ((m_option & (KX_ACT_CONSTRAINT_NORMAL|KX_ACT_CONSTRAINT_DISTANCE)) == 0) { - // if none option is set, the actuator does nothing but detect ray + // if none option is set, the actuator does nothing but detect ray // (works like a sensor) goto CHECK_TIME; } @@ -398,7 +398,7 @@ bool KX_ConstraintActuator::Update(double curtime, bool frame) goto CHECK_TIME; } } - break; + break; case KX_ACT_CONSTRAINT_FHPX: case KX_ACT_CONSTRAINT_FHPY: case KX_ACT_CONSTRAINT_FHPZ: @@ -451,7 +451,7 @@ bool KX_ConstraintActuator::Update(double curtime, bool frame) if (!pe) { std::cout << "WARNING: Constraint actuator " << GetName() << ": There is no physics environment!" << std::endl; goto CHECK_TIME; - } + } if (!spc || !spc->IsDynamic()) { // the object is not dynamic, it won't support setting speed goto CHECK_TIME; @@ -468,7 +468,7 @@ bool KX_ConstraintActuator::Update(double curtime, bool frame) { MT_Vector3 newnormal = callback.m_hitNormal; // compute new position & orientation - MT_Scalar distance = (callback.m_hitPoint-position).length()-spc->GetRadius(); + MT_Scalar distance = (callback.m_hitPoint-position).length()-spc->GetRadius(); // estimate the velocity of the hit point MT_Point3 relativeHitPoint; relativeHitPoint = (callback.m_hitPoint-m_hitObject->NodeGetWorldPosition()); @@ -502,7 +502,7 @@ bool KX_ConstraintActuator::Update(double curtime, bool frame) // don't set the position with this constraint goto CHECK_TIME; } - break; + break; case KX_ACT_CONSTRAINT_LOCX: case KX_ACT_CONSTRAINT_LOCY: case KX_ACT_CONSTRAINT_LOCZ: @@ -541,8 +541,8 @@ bool KX_ConstraintActuator::Update(double curtime, bool frame) return result; } /* end of KX_ConstraintActuator::Update(double curtime,double deltatime) */ -void KX_ConstraintActuator::Clamp(MT_Scalar &var, - float min, +void KX_ConstraintActuator::Clamp(MT_Scalar &var, + float min, float max) { if (var < min) { var = min; @@ -552,7 +552,7 @@ void KX_ConstraintActuator::Clamp(MT_Scalar &var, } -bool KX_ConstraintActuator::IsValidMode(KX_ConstraintActuator::KX_CONSTRAINTTYPE m) +bool KX_ConstraintActuator::IsValidMode(KX_ConstraintActuator::KX_CONSTRAINTTYPE m) { bool res = false; diff --git a/source/gameengine/Ketsji/KX_ConstraintActuator.h b/source/gameengine/Ketsji/KX_ConstraintActuator.h index af617655d5e..61f106321de 100644 --- a/source/gameengine/Ketsji/KX_ConstraintActuator.h +++ b/source/gameengine/Ketsji/KX_ConstraintActuator.h @@ -49,7 +49,7 @@ protected: // Damp time (int), int m_posDampTime; int m_rotDampTime; - // min (float) + // min (float) float m_minimumBound; // max (float) float m_maximumBound; @@ -78,7 +78,7 @@ protected: */ void Clamp(MT_Scalar &var, float min, float max); - + public: // m_locrot enum KX_CONSTRAINTTYPE { diff --git a/source/gameengine/Ketsji/KX_ConstraintWrapper.cpp b/source/gameengine/Ketsji/KX_ConstraintWrapper.cpp index 2f32b5e3216..9c3ece2fb55 100644 --- a/source/gameengine/Ketsji/KX_ConstraintWrapper.cpp +++ b/source/gameengine/Ketsji/KX_ConstraintWrapper.cpp @@ -60,23 +60,23 @@ PyObject *KX_ConstraintWrapper::PyGetParam(PyObject *args, PyObject *kwds) { int dof; float value; - + if (!PyArg_ParseTuple(args,"i:getParam",&dof)) return NULL; - + value = m_physenv->GetConstraintParam(m_constraintId,dof); return PyFloat_FromDouble(value); - + } PyObject *KX_ConstraintWrapper::PySetParam(PyObject *args, PyObject *kwds) { int dof; float minLimit,maxLimit; - + if (!PyArg_ParseTuple(args,"iff:setParam",&dof,&minLimit,&maxLimit)) return NULL; - + m_physenv->SetConstraintParam(m_constraintId,dof,minLimit,maxLimit); Py_RETURN_NONE; } diff --git a/source/gameengine/Ketsji/KX_ConstraintWrapper.h b/source/gameengine/Ketsji/KX_ConstraintWrapper.h index 5e20b7a9aca..8c645615fe8 100644 --- a/source/gameengine/Ketsji/KX_ConstraintWrapper.h +++ b/source/gameengine/Ketsji/KX_ConstraintWrapper.h @@ -42,7 +42,7 @@ public: KX_ConstraintWrapper(PHY_ConstraintType ctype,int constraintId,class PHY_IPhysicsEnvironment* physenv); virtual ~KX_ConstraintWrapper (); int getConstraintId() { return m_constraintId; } - + #ifdef WITH_PYTHON KX_PYMETHOD_NOARGS(KX_ConstraintWrapper,GetConstraintId); KX_PYMETHOD(KX_ConstraintWrapper,SetParam); diff --git a/source/gameengine/Ketsji/KX_Dome.cpp b/source/gameengine/Ketsji/KX_Dome.cpp index d08372e47d4..46ba00e4cb1 100644 --- a/source/gameengine/Ketsji/KX_Dome.cpp +++ b/source/gameengine/Ketsji/KX_Dome.cpp @@ -180,7 +180,7 @@ void KX_Dome::SetViewPort(const int viewport[4]) { if (canvaswidth != m_viewport.GetWidth() || canvasheight != m_viewport.GetHeight()) { - m_viewport.SetLeft(viewport[0]); + m_viewport.SetLeft(viewport[0]); m_viewport.SetBottom(viewport[1]); m_viewport.SetRight(viewport[2]); m_viewport.SetTop(viewport[3]); @@ -237,7 +237,7 @@ void KX_Dome::CalculateImageSize(void) m_buffersize = (canvaswidth > canvasheight?canvasheight:canvaswidth); m_buffersize = (int)(m_buffersize*m_resbuffer); //reduce buffer size for better performance - + int i = 0; while ((1 << i) <= m_buffersize) i++; @@ -315,7 +315,7 @@ bool KX_Dome::CreateDL() glEndList(); } - //clearing the vectors + //clearing the vectors cubetop.clear(); cubebottom.clear(); cuberight.clear(); @@ -591,9 +591,9 @@ void KX_Dome::CreateMeshDome180(void) cubebottom[0].v[2] = 0.0; nfacesbottom = 1; - + /* Left face - two triangles */ - + cubeleft[0].verts[0][0] = (float)(-M_SQRT2) / 2.0f; cubeleft[0].verts[0][1] = 0.0f; cubeleft[0].verts[0][2] = -0.5f; @@ -632,7 +632,7 @@ void KX_Dome::CreateMeshDome180(void) cubeleft[1].v[2] = uv_ratio; nfacesleft = 2; - + /* Right face - two triangles */ cuberight[0].verts[0][0] = 0.0f; cuberight[0].verts[0][1] = (float)M_SQRT2 / 2.0f; @@ -672,7 +672,7 @@ void KX_Dome::CreateMeshDome180(void) cuberight[1].v[2] = uv_ratio; nfacesright = 2; - + //Refine a triangular mesh by bisecting each edge forms 3 new triangles for each existing triangle on each iteration //Could be made more efficient for drawing if the triangles were ordered in a fan. Not that important since we are using DisplayLists @@ -750,7 +750,7 @@ void KX_Dome::CreateMeshDome250(void) uv_height = uv_ratio * ( (verts_height / 2.0f) + 0.5f); uv_base = uv_ratio * (1.0f - ((verts_height / 2.0f) + 0.5f)); - + //creating faces for the env mapcube 180deg Dome // Front Face - 2 triangles cubefront[0].verts[0][0] =-1.0f; @@ -1133,7 +1133,7 @@ void KX_Dome::CreateMeshPanorama(void) nfacesleftback = 2; /* Left face - two triangles */ - + cubeleft[0].verts[0][0] = (float)(-M_SQRT2); cubeleft[0].verts[0][1] = 0.0f; cubeleft[0].verts[0][2] = -1.0f; @@ -1172,7 +1172,7 @@ void KX_Dome::CreateMeshPanorama(void) cubeleft[1].v[2] = uv_ratio; nfacesleft = 2; - + /* Right face - two triangles */ cuberight[0].verts[0][0] = 0.0f; cuberight[0].verts[0][1] = (float)M_SQRT2; @@ -1212,7 +1212,7 @@ void KX_Dome::CreateMeshPanorama(void) cuberight[1].v[2] = uv_ratio; nfacesright = 2; - + /* Right Back (-135deg) face - two triangles */ cuberightback[0].verts[0][0] = (float)M_SQRT2; cuberightback[0].verts[0][1] = 0.0f; @@ -1435,7 +1435,7 @@ void KX_Dome::SplitFace(vector & face, int *nfaces) void KX_Dome::CalculateFrustum(KX_Camera *cam) { #if 0 - // manually creating a 90deg Field of View Frustum + // manually creating a 90deg Field of View Frustum // the original formula: top = tan(fov*3.14159f/30.0f)) * near [for fov in degrees] @@ -1462,7 +1462,7 @@ void KX_Dome::CalculateFrustum(KX_Camera *cam) m_frustum.x2 = top; m_frustum.y1 = -top; m_frustum.y2 = top; - + m_projmat = m_rasterizer->GetFrustumMatrix( m_frustum.x1, m_frustum.x2, m_frustum.y1, m_frustum.y2, m_frustum.camnear, m_frustum.camfar); } @@ -1479,7 +1479,7 @@ void KX_Dome::CalculateCameraOrientation() MT_Scalar c = cosf(deg45); MT_Scalar s = sinf(deg45); - if (m_angle <= 180 && (m_mode == DOME_FISHEYE + if (m_angle <= 180 && (m_mode == DOME_FISHEYE || m_mode == DOME_TRUNCATED_FRONT || m_mode == DOME_TRUNCATED_REAR)) { @@ -1504,7 +1504,7 @@ void KX_Dome::CalculateCameraOrientation() s, 0.0f, c); } else if (m_mode == DOME_ENVMAP || (m_angle > 180 && (m_mode == DOME_FISHEYE - || m_mode == DOME_TRUNCATED_FRONT + || m_mode == DOME_TRUNCATED_FRONT || m_mode == DOME_TRUNCATED_REAR))) { m_locRot[0] = MT_Matrix3x3( // 90deg - Top @@ -1526,7 +1526,7 @@ void KX_Dome::CalculateCameraOrientation() 0.0f, 0.0f,-1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f); - + m_locRot[4] = MT_Matrix3x3( // 0deg - Front 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, @@ -1539,7 +1539,7 @@ void KX_Dome::CalculateCameraOrientation() } else if (m_mode == DOME_PANORAM_SPH) { - m_locRot[0] = MT_Matrix3x3( // Top + m_locRot[0] = MT_Matrix3x3( // Top c, s, 0.0f, 0.0f,0.0f, -1.0f, -s, c, 0.0f); @@ -1658,7 +1658,7 @@ void KX_Dome::DrawEnvMap(void) glMatrixMode(GL_PROJECTION); glLoadIdentity(); - // Making the viewport always square + // Making the viewport always square int can_width = m_viewport.GetRight(); int can_height = m_viewport.GetTop(); @@ -1677,7 +1677,7 @@ void KX_Dome::DrawEnvMap(void) ortho_height = 2.0f / 3; ortho_width = (float)can_width/can_height * ortho_height; } - + glOrtho((-ortho_width), ortho_width, (-ortho_height), ortho_height, -20.0f, 10.0f); } @@ -1788,7 +1788,7 @@ void KX_Dome::DrawDomeFisheye(void) glMatrixMode(GL_PROJECTION); glLoadIdentity(); - // Making the viewport always square + // Making the viewport always square int can_width = m_viewport.GetRight(); int can_height = m_viewport.GetTop(); @@ -1808,7 +1808,7 @@ void KX_Dome::DrawDomeFisheye(void) ortho_width = (float)can_width/can_height; ortho_height = 1.0f; } - + glOrtho((-ortho_width), ortho_width, (-ortho_height), ortho_height, -20.0f, 10.0f); } } @@ -1884,7 +1884,7 @@ void KX_Dome::DrawPanorama(void) glMatrixMode(GL_PROJECTION); glLoadIdentity(); - // Making the viewport always square + // Making the viewport always square int can_width = m_viewport.GetRight(); int can_height = m_viewport.GetTop(); @@ -1905,7 +1905,7 @@ void KX_Dome::DrawPanorama(void) ortho_width = (float)can_width / can_height * 0.5f; ortho_height = 0.5f; } - + glOrtho((-ortho_width), ortho_width, (-ortho_height), ortho_height, -20.0f, 10.0f); } @@ -1968,7 +1968,7 @@ void KX_Dome::DrawDomeWarped(void) glMatrixMode(GL_PROJECTION); glLoadIdentity(); - // Making the viewport always square + // Making the viewport always square int can_width = m_viewport.GetRight(); int can_height = m_viewport.GetTop(); diff --git a/source/gameengine/Ketsji/KX_Dome.h b/source/gameengine/Ketsji/KX_Dome.h index 5a0c4588ae2..26079a10e1d 100644 --- a/source/gameengine/Ketsji/KX_Dome.h +++ b/source/gameengine/Ketsji/KX_Dome.h @@ -83,7 +83,7 @@ public: GLuint domefacesId[7]; /* ID of the images -- room for 7 images, using only 4 for 180deg x 360deg dome, * 6 for panoramic and +1 for warp mesh */ GLuint dlistId; /* ID of the Display Lists of the images (used as an offset) */ - + typedef struct { double u[3], v[3]; MT_Vector3 verts[3]; //three verts @@ -108,7 +108,7 @@ public: vector cubetop, cubebottom, cuberight, cubeleft, cubefront, cubeback; //for fisheye vector cubeleftback, cuberightback; //for panorama - + int nfacestop, nfacesbottom, nfacesleft, nfacesright, nfacesfront, nfacesback; int nfacesleftback, nfacesrightback; @@ -145,7 +145,7 @@ public: void CreateGLImages(void); void ClearGLImages(void);//called on resize bool CreateDL(void); //create Display Lists - void ClearDL(void); //remove Display Lists + void ClearDL(void); //remove Display Lists bool CreateFBO(void);//create FBO (for warp mesh) void ClearFBO(void); //remove FBO @@ -169,7 +169,7 @@ protected: float m_radangle; //the angle of the fisheye in radians float m_resbuffer; //the resolution of the buffer short m_tilt; //the dome tilt (camera rotation on horizontal axis) - + RAS_Rect m_viewport; MT_Matrix4x4 m_projmat; @@ -187,8 +187,8 @@ protected: RAS_IRenderTools* m_rendertools; /// engine KX_KetsjiEngine* m_engine; - - + + #ifdef WITH_CXX_GUARDEDALLOC MEM_CXX_CLASS_ALLOC_FUNCS("GE:KX_Dome") #endif diff --git a/source/gameengine/Ketsji/KX_EmptyObject.h b/source/gameengine/Ketsji/KX_EmptyObject.h index 63a0782a544..80d8620894a 100644 --- a/source/gameengine/Ketsji/KX_EmptyObject.h +++ b/source/gameengine/Ketsji/KX_EmptyObject.h @@ -37,7 +37,7 @@ class KX_EmptyObject : public KX_GameObject { public: KX_EmptyObject(void* sgReplicationInfo,SG_Callbacks callbacks) : - KX_GameObject(sgReplicationInfo,callbacks) + KX_GameObject(sgReplicationInfo,callbacks) {}; virtual ~KX_EmptyObject(); diff --git a/source/gameengine/Ketsji/KX_FontObject.cpp b/source/gameengine/Ketsji/KX_FontObject.cpp index ae79284288d..a597b2981a2 100644 --- a/source/gameengine/Ketsji/KX_FontObject.cpp +++ b/source/gameengine/Ketsji/KX_FontObject.cpp @@ -92,9 +92,9 @@ KX_FontObject::KX_FontObject(void* sgReplicationInfo, m_fsize = text->fsize; m_line_spacing = text->linedist; m_offset = MT_Vector3(text->xof, text->yof, 0); - + m_fontid = GetFontId(text->vfont); - + /* initialize the color with the object color and store it in the KX_Object class * This is a workaround waiting for the fix: * [#25487] BGE: Object Color only works when it has a keyed frame */ @@ -128,19 +128,19 @@ int GetFontId(VFont *vfont) if (vfont->packedfile) { packedfile= vfont->packedfile; fontid= BLF_load_mem(vfont->name, (unsigned char*)packedfile->data, packedfile->size); - + if (fontid == -1) { printf("ERROR: packed font \"%s\" could not be loaded.\n", vfont->name); fontid = BLF_load("default"); } return fontid; } - + /* once we have packed working we can load the builtin font */ const char *filepath = vfont->name; if (BKE_vfont_is_builtin(vfont)) { fontid = BLF_load("default"); - + /* XXX the following code is supposed to work (after you add get_builtin_packedfile to BKE_font.h ) * unfortunately it's crashing on blf_glyph.c:173 because gc->glyph_width_max is 0 */ @@ -150,18 +150,18 @@ int GetFontId(VFont *vfont) return BLF_load("default"); } - + /* convert from absolute to relative */ char expanded[256]; // font names can be bigger than FILE_MAX (240) BLI_strncpy(expanded, filepath, 256); BLI_path_abs(expanded, G.main->name); - + fontid = BLF_load(expanded); /* fallback */ if (fontid == -1) fontid = BLF_load("default"); - + return fontid; } diff --git a/source/gameengine/Ketsji/KX_FontObject.h b/source/gameengine/Ketsji/KX_FontObject.h index bf70eedfde6..27f642f0f9b 100644 --- a/source/gameengine/Ketsji/KX_FontObject.h +++ b/source/gameengine/Ketsji/KX_FontObject.h @@ -47,9 +47,9 @@ public: void DrawFontText(); - /** + /** * Inherited from CValue -- return a new copy of this - * instance allocated on the heap. Ownership of the new + * instance allocated on the heap. Ownership of the new * object belongs with the caller. */ virtual CValue* GetReplica(); diff --git a/source/gameengine/Ketsji/KX_GameActuator.cpp b/source/gameengine/Ketsji/KX_GameActuator.cpp index f1bd253f8b3..8bfe6966764 100644 --- a/source/gameengine/Ketsji/KX_GameActuator.cpp +++ b/source/gameengine/Ketsji/KX_GameActuator.cpp @@ -50,7 +50,7 @@ /* Native functions */ /* ------------------------------------------------------------------------- */ -KX_GameActuator::KX_GameActuator(SCA_IObject *gameobj, +KX_GameActuator::KX_GameActuator(SCA_IObject *gameobj, int mode, const STR_String& filename, const STR_String& loadinganimationname, @@ -68,7 +68,7 @@ KX_GameActuator::KX_GameActuator(SCA_IObject *gameobj, KX_GameActuator::~KX_GameActuator() -{ +{ // there's nothing to be done here, really.... } /* end of destructor */ @@ -78,7 +78,7 @@ CValue* KX_GameActuator::GetReplica() { KX_GameActuator* replica = new KX_GameActuator(*this); replica->ProcessReplica(); - + return replica; } @@ -138,10 +138,10 @@ bool KX_GameActuator::Update() char *marshal_buffer = NULL; unsigned int marshal_length; FILE *fp = NULL; - + pathGamePythonConfig(mashal_path); marshal_length = saveGamePythonConfig(&marshal_buffer); - + if (marshal_length && marshal_buffer) { fp = fopen(mashal_path, "wb"); if (fp) { @@ -171,9 +171,9 @@ bool KX_GameActuator::Update() int marshal_length; FILE *fp = NULL; int result; - + pathGamePythonConfig(mashal_path); - + fp = fopen(mashal_path, "rb"); if (fp) { // obtain file size: @@ -185,17 +185,17 @@ bool KX_GameActuator::Update() break; } rewind(fp); - + marshal_buffer = (char*) malloc (sizeof(char)*marshal_length); - + result = fread (marshal_buffer, 1, marshal_length, fp); - + if (result == marshal_length) { loadGamePythonConfig(marshal_buffer, marshal_length); } else { printf("warning: could not read all of '%s'\n", mashal_path); } - + free(marshal_buffer); fclose(fp); } else { @@ -219,7 +219,7 @@ bool KX_GameActuator::Update() default: ; /* do nothing? this is an internal error !!! */ } - + return false; } diff --git a/source/gameengine/Ketsji/KX_GameActuator.h b/source/gameengine/Ketsji/KX_GameActuator.h index 57472836bb2..6a3f03ea6a6 100644 --- a/source/gameengine/Ketsji/KX_GameActuator.h +++ b/source/gameengine/Ketsji/KX_GameActuator.h @@ -75,7 +75,7 @@ protected: virtual CValue* GetReplica(); virtual bool Update(); - + virtual void Replace_IScene(SCA_IScene *val) { m_scene= val; @@ -84,7 +84,7 @@ protected: /* --------------------------------------------------------------------- */ /* Python interface ---------------------------------------------------- */ /* --------------------------------------------------------------------- */ - + }; /* end of class KX_GameActuator */ #endif diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp b/source/gameengine/Ketsji/KX_GameObject.cpp index 3244400e1bd..a4dc5f5c4a2 100644 --- a/source/gameengine/Ketsji/KX_GameObject.cpp +++ b/source/gameengine/Ketsji/KX_GameObject.cpp @@ -124,8 +124,8 @@ KX_GameObject::KX_GameObject( m_pSGNode = new SG_Node(this,sgReplicationInfo,callbacks); // define the relationship between this node and it's parent. - - KX_NormalParentRelation * parent_relation = + + KX_NormalParentRelation * parent_relation = KX_NormalParentRelation::New(); m_pSGNode->SetParentRelation(parent_relation); }; @@ -209,7 +209,7 @@ KX_GameObject* KX_GameObject::GetClientObject(KX_ClientObjectInfo *info) return info->m_gameobject; } -CValue* KX_GameObject:: Calc(VALUE_OPERATOR op, CValue *val) +CValue* KX_GameObject:: Calc(VALUE_OPERATOR op, CValue *val) { return NULL; } @@ -255,12 +255,12 @@ PHY_IPhysicsController* KX_GameObject::GetPhysicsController() } KX_GameObject* KX_GameObject::GetDupliGroupObject() -{ +{ return m_pDupliGroupObject; } CListValue* KX_GameObject::GetInstanceObjects() -{ +{ return m_pInstanceObjects; } @@ -313,7 +313,7 @@ KX_GameObject* KX_GameObject::GetParent() { KX_GameObject* result = NULL; SG_Node* node = m_pSGNode; - + while (node && !result) { node = node->GetSGParent(); @@ -322,13 +322,13 @@ KX_GameObject* KX_GameObject::GetParent() } return result; - + } void KX_GameObject::SetParent(KX_Scene *scene, KX_GameObject* obj, bool addToCompound, bool ghost) { // check on valid node in case a python controller holds a reference to a deleted object - if (obj && + if (obj && GetSGNode() && // object is not zombi obj->GetSGNode() && // object is not zombi GetSGNode()->GetSGParent() != obj->GetSGNode() && // not already parented to same object @@ -377,7 +377,7 @@ void KX_GameObject::SetParent(KX_Scene *scene, KX_GameObject* obj, bool addToCom // step 1: find the top parent (not necessarily obj) KX_GameObject* rootobj = (KX_GameObject*)obj->GetSGNode()->GetRootSGParent()->GetSGClientObject(); // step 2: verify it has a physical controller and compound shape - if (rootobj != NULL && + if (rootobj != NULL && rootobj->m_pPhysicsController != NULL && rootobj->m_pPhysicsController->IsCompound()) { @@ -395,7 +395,7 @@ void KX_GameObject::RemoveParent(KX_Scene *scene) { // get the root object to remove us from compound object if needed KX_GameObject* rootobj = (KX_GameObject*)GetSGNode()->GetRootSGParent()->GetSGClientObject(); - // Set us to the right spot + // Set us to the right spot GetSGNode()->SetLocalScale(GetSGNode()->GetWorldScaling()); GetSGNode()->SetLocalOrientation(GetSGNode()->GetWorldOrientation()); GetSGNode()->SetLocalPosition(GetSGNode()->GetWorldPosition()); @@ -411,7 +411,7 @@ void KX_GameObject::RemoveParent(KX_Scene *scene) if (m_pPhysicsController) { // in case this controller was added as a child shape to the parent - if (rootobj != NULL && + if (rootobj != NULL && rootobj->m_pPhysicsController != NULL && rootobj->m_pPhysicsController->IsCompound()) { @@ -540,7 +540,7 @@ void KX_GameObject::ProcessReplica() if (m_attr_dict) m_attr_dict= PyDict_Copy(m_attr_dict); #endif - + } static void setGraphicController_recursive(SG_Node* node) @@ -553,7 +553,7 @@ static void setGraphicController_recursive(SG_Node* node) KX_GameObject *clientgameobj = static_cast( (*childit)->GetSGClientObject()); if (clientgameobj != NULL) // This is a GameObject clientgameobj->ActivateGraphicController(false); - + // if the childobj is NULL then this may be an inverse parent link // so a non recursive search should still look down this node. setGraphicController_recursive(childnode); @@ -670,7 +670,7 @@ void KX_GameObject::ApplyTorque(const MT_Vector3& torque,bool local) void KX_GameObject::ApplyMovement(const MT_Vector3& dloc,bool local) { - if (GetSGNode()) + if (GetSGNode()) { if (m_pPhysicsController) // (IsDynamic()) { @@ -685,7 +685,7 @@ void KX_GameObject::ApplyMovement(const MT_Vector3& dloc,bool local) void KX_GameObject::ApplyRotation(const MT_Vector3& drot,bool local) { MT_Matrix3x3 rotmat(drot); - + if (GetSGNode()) { GetSGNode()->RelativeRotate(rotmat,local); @@ -706,10 +706,10 @@ float *KX_GameObject::GetOpenGLMatrix() float *fl = m_OpenGL_4x4Matrix.getPointer(); if (GetSGNode()) { MT_Transform trans; - + trans.setOrigin(GetSGNode()->GetWorldPosition()); trans.setBasis(GetSGNode()->GetWorldOrientation()); - + MT_Vector3 scaling = GetSGNode()->GetWorldScaling(); m_bIsNegativeScaling = ((scaling[0] < 0.0f) ^ (scaling[1] < 0.0f) ^ (scaling[2] < 0.0f)) ? true : false; trans.scale(scaling[0], scaling[1], scaling[2]); @@ -763,7 +763,7 @@ static void UpdateBuckets_recursive(SG_Node* node) KX_GameObject *clientgameobj = static_cast( (*childit)->GetSGClientObject()); if (clientgameobj != NULL) // This is a GameObject clientgameobj->UpdateBuckets(0); - + // if the childobj is NULL then this may be an inverse parent link // so a non recursive search should still look down this node. UpdateBuckets_recursive(childnode); @@ -786,15 +786,15 @@ void KX_GameObject::UpdateBuckets( bool recursive ) ms->m_RGBAcolor = m_objectColor; ms->m_bVisible = m_bVisible; ms->m_bCulled = m_bCulled || !m_bVisible; - if (!ms->m_bCulled) + if (!ms->m_bCulled) ms->m_bucket->ActivateMesh(ms); - + /* split if necessary */ #ifdef USE_SPLIT ms->Split(); #endif } - + if (recursive) { UpdateBuckets_recursive(GetSGNode()); } @@ -823,7 +823,7 @@ static float calcHysteresis(KX_Scene *kxscene, LodLevel *lod) if (!kxscene->IsActivedLodHysteresis()) return hystvariance; - + short hysteresis = 0; // if exists, LoD level hysteresis will override scene hysteresis if (lod->next->flags & OB_LOD_USE_HYST) @@ -944,12 +944,12 @@ void KX_GameObject::InitIPO(bool ipo_as_force, (*it)->SetOption(SG_Controller::SG_CONTR_IPO_LOCAL, ipo_local); it++; } -} +} void KX_GameObject::UpdateIPO(float curframetime, - bool recurse) + bool recurse) { - /* This function shouldn't call BL_Action::Update, not even indirectly, + /* This function shouldn't call BL_Action::Update, not even indirectly, * as it will cause deadlock due to the lock in BL_Action::Update. */ // just the 'normal' update procedure. @@ -959,7 +959,7 @@ void KX_GameObject::UpdateIPO(float curframetime, } // IPO update -void +void KX_GameObject::UpdateMaterialData( dword matname_hash, MT_Vector4 rgba, @@ -983,7 +983,7 @@ KX_GameObject::UpdateMaterialData( if (poly->GetFlag() & RAS_BLENDERMAT ) { KX_BlenderMaterial *m = static_cast(poly); - + if (matname_hash == 0) { m->UpdateIPO(rgba, specrgb,hard,spec,ref,emit, alpha); @@ -996,7 +996,7 @@ KX_GameObject::UpdateMaterialData( { m->UpdateIPO(rgba, specrgb,hard,spec,ref,emit, alpha); m_meshes[mesh]->SetVertexColor(poly,rgba); - + // no break here, because one blender material can be split into several game engine materials // (e.g. one uvsphere material is split into one material at poles with ras_mode TRIANGLE and one material for the body // if here was a break then would miss some vertices if material was split @@ -1024,7 +1024,7 @@ static void setVisible_recursive(SG_Node* node, bool v) KX_GameObject *clientgameobj = static_cast( (*childit)->GetSGClientObject()); if (clientgameobj != NULL) // This is a GameObject clientgameobj->SetVisible(v, 0); - + // if the childobj is NULL then this may be an inverse parent link // so a non recursive search should still look down this node. setVisible_recursive(childnode, v); @@ -1057,7 +1057,7 @@ static void setOccluder_recursive(SG_Node* node, bool v) KX_GameObject *clientgameobj = static_cast( (*childit)->GetSGClientObject()); if (clientgameobj != NULL) // This is a GameObject clientgameobj->SetOccluder(v, false); - + // if the childobj is NULL then this may be an inverse parent link // so a non recursive search should still look down this node. setOccluder_recursive(childnode, v); @@ -1203,11 +1203,11 @@ void KX_GameObject::AlignAxisToVect(const MT_Vector3& dir, int axis, float fac) cout << "alignAxisToVect() Error: Null vector!\n"; return; } - + if (fac <= 0.0f) { return; } - + // normalize vect /= len; orimat = GetSGNode()->GetWorldOrientation(); @@ -1277,7 +1277,7 @@ void KX_GameObject::AlignAxisToVect(const MT_Vector3& dir, int axis, float fac) if (GetSGNode()->GetSGParent() != NULL) { - // the object is a child, adapt its local orientation so that + // the object is a child, adapt its local orientation so that // the global orientation is aligned as we want (cancelling out the parent orientation) MT_Matrix3x3 invori = GetSGNode()->GetSGParent()->GetWorldOrientation().inverse(); NodeSetLocalOrientation(invori*orimat); @@ -1313,11 +1313,11 @@ MT_Vector3 KX_GameObject::GetLinearVelocity(bool local) if (m_pPhysicsController) { velocity = m_pPhysicsController->GetLinearVelocity(); - + if (local) { ori = GetSGNode()->GetWorldOrientation(); - + locvel = velocity * ori; return locvel; } @@ -1332,11 +1332,11 @@ MT_Vector3 KX_GameObject::GetAngularVelocity(bool local) if (m_pPhysicsController) { velocity = m_pPhysicsController->GetAngularVelocity(); - + if (local) { ori = GetSGNode()->GetWorldOrientation(); - + locvel = velocity * ori; return locvel; } @@ -1426,7 +1426,7 @@ void KX_GameObject::NodeSetRelativeScale(const MT_Vector3& scale) if (m_pPhysicsController && (!GetSGNode()->GetSGParent())) { // see note above - // we can use the local scale: it's the same thing for a root object + // we can use the local scale: it's the same thing for a root object // and the world scale is not yet updated MT_Vector3 newscale = GetSGNode()->GetLocalScale(); m_pPhysicsController->SetScaling(newscale); @@ -1446,8 +1446,8 @@ void KX_GameObject::NodeSetWorldScale(const MT_Vector3& scale) if (fabs(p_scale[0]) < (MT_Scalar)FLT_EPSILON || fabs(p_scale[1]) < (MT_Scalar)FLT_EPSILON || fabs(p_scale[2]) < (MT_Scalar)FLT_EPSILON) - { - return; + { + return; } p_scale[0] = 1/p_scale[0]; @@ -1474,8 +1474,8 @@ void KX_GameObject::NodeSetWorldPosition(const MT_Point3& trans) if (fabs(scale[0]) < (MT_Scalar)FLT_EPSILON || fabs(scale[1]) < (MT_Scalar)FLT_EPSILON || fabs(scale[2]) < (MT_Scalar)FLT_EPSILON) - { - return; + { + return; } scale[0] = 1.0f/scale[0]; scale[1] = 1.0f/scale[1]; @@ -1650,7 +1650,7 @@ static void walk_children(SG_Node* node, CListValue* list, bool recursive) // add to the list list->Add(childobj->AddRef()); } - + // if the childobj is NULL then this may be an inverse parent link // so a non recursive search should still look down this node. if (recursive || childobj==NULL) { @@ -1726,7 +1726,7 @@ static int mathutils_kxgameob_generic_check(BaseMathObject *bmo) KX_GameObject* self = static_castBGE_PROXY_REF(bmo->cb_user); if (self == NULL) return -1; - + return 0; } @@ -1774,11 +1774,11 @@ static int mathutils_kxgameob_vector_get(BaseMathObject *bmo, int subtype) if (!self->GetPhysicsController()) return PHYS_ERR("worldLinearVelocity"), -1; self->GetAngularVelocity(false).getValue(bmo->data); break; - + } - + #undef PHYS_ERR - + return 0; } @@ -1787,7 +1787,7 @@ static int mathutils_kxgameob_vector_set(BaseMathObject *bmo, int subtype) KX_GameObject* self = static_castBGE_PROXY_REF(bmo->cb_user); if (self == NULL) return -1; - + switch (subtype) { case MATHUTILS_VEC_CB_POS_LOCAL: self->NodeSetLocalPosition(MT_Point3(bmo->data)); @@ -1823,7 +1823,7 @@ static int mathutils_kxgameob_vector_set(BaseMathObject *bmo, int subtype) self->setAngularVelocity(MT_Point3(bmo->data),false); break; } - + return 0; } @@ -1838,11 +1838,11 @@ static int mathutils_kxgameob_vector_get_index(BaseMathObject *bmo, int subtype, static int mathutils_kxgameob_vector_set_index(BaseMathObject *bmo, int subtype, int index) { float f= bmo->data[index]; - + /* lazy, avoid repeteing the case statement */ if (mathutils_kxgameob_vector_get(bmo, subtype) == -1) return -1; - + bmo->data[index] = f; return mathutils_kxgameob_vector_set(bmo, subtype); } @@ -1875,7 +1875,7 @@ static int mathutils_kxgameob_matrix_get(BaseMathObject *bmo, int subtype) self->NodeGetWorldOrientation().getValue3x3(bmo->data); break; } - + return 0; } @@ -1885,7 +1885,7 @@ static int mathutils_kxgameob_matrix_set(BaseMathObject *bmo, int subtype) KX_GameObject* self = static_castBGE_PROXY_REF(bmo->cb_user); if (self == NULL) return -1; - + MT_Matrix3x3 mat3x3; switch (subtype) { case MATHUTILS_MAT_CB_ORI_LOCAL: @@ -1899,7 +1899,7 @@ static int mathutils_kxgameob_matrix_set(BaseMathObject *bmo, int subtype) self->NodeUpdateGS(0.f); break; } - + return 0; } @@ -1954,7 +1954,7 @@ PyMethodDef KX_GameObject::Methods[] = { {"replaceMesh",(PyCFunction) KX_GameObject::sPyReplaceMesh, METH_VARARGS}, {"endObject",(PyCFunction) KX_GameObject::sPyEndObject, METH_NOARGS}, {"reinstancePhysicsMesh", (PyCFunction)KX_GameObject::sPyReinstancePhysicsMesh,METH_VARARGS}, - + KX_PYMETHODTABLE(KX_GameObject, rayCastTo), KX_PYMETHODTABLE(KX_GameObject, rayCast), KX_PYMETHODTABLE_O(KX_GameObject, getDistanceTo), @@ -1968,10 +1968,10 @@ PyMethodDef KX_GameObject::Methods[] = { KX_PYMETHODTABLE(KX_GameObject, getActionName), KX_PYMETHODTABLE(KX_GameObject, setActionFrame), KX_PYMETHODTABLE(KX_GameObject, isPlayingAction), - + // dict style access for props {"get",(PyCFunction) KX_GameObject::sPyget, METH_VARARGS}, - + {NULL,NULL} //Sentinel }; @@ -2024,7 +2024,7 @@ PyAttributeDef KX_GameObject::Attributes[] = { KX_PYATTRIBUTE_RW_FUNCTION("color", KX_GameObject, pyattr_get_obcolor, pyattr_set_obcolor), KX_PYATTRIBUTE_RW_FUNCTION("debug", KX_GameObject, pyattr_get_debug, pyattr_set_debug), KX_PYATTRIBUTE_RW_FUNCTION("debugRecursive", KX_GameObject, pyattr_get_debugRecursive, pyattr_set_debugRecursive), - + /* experimental, don't rely on these yet */ KX_PYATTRIBUTE_RO_FUNCTION("sensors", KX_GameObject, pyattr_get_sensors), KX_PYATTRIBUTE_RO_FUNCTION("controllers", KX_GameObject, pyattr_get_controllers), @@ -2040,13 +2040,13 @@ PyObject *KX_GameObject::PyReplaceMesh(PyObject *args) PyObject *value; int use_gfx= 1, use_phys= 0; RAS_MeshObject *new_mesh; - + if (!PyArg_ParseTuple(args,"O|ii:replaceMesh", &value, &use_gfx, &use_phys)) return NULL; - + if (!ConvertPythonToMesh(logicmgr, value, &new_mesh, false, "gameOb.replaceMesh(value): KX_GameObject")) return NULL; - + scene->ReplaceMesh(this, new_mesh, (bool)use_gfx, (bool)use_phys); Py_RETURN_NONE; } @@ -2054,9 +2054,9 @@ PyObject *KX_GameObject::PyReplaceMesh(PyObject *args) PyObject *KX_GameObject::PyEndObject() { KX_Scene* scene = GetScene(); - + scene->DelayedRemoveObject(this); - + Py_RETURN_NONE; } @@ -2066,12 +2066,12 @@ PyObject *KX_GameObject::PyReinstancePhysicsMesh(PyObject *args) KX_GameObject *gameobj= NULL; RAS_MeshObject *mesh= NULL; SCA_LogicManager *logicmgr = GetScene()->GetLogicManager(); - + PyObject *gameobj_py= NULL; PyObject *mesh_py= NULL; if ( !PyArg_ParseTuple(args,"|OO:reinstancePhysicsMesh",&gameobj_py, &mesh_py) || - (gameobj_py && !ConvertPythonToGameObject(logicmgr, gameobj_py, &gameobj, true, "gameOb.reinstancePhysicsMesh(obj, mesh): KX_GameObject")) || + (gameobj_py && !ConvertPythonToGameObject(logicmgr, gameobj_py, &gameobj, true, "gameOb.reinstancePhysicsMesh(obj, mesh): KX_GameObject")) || (mesh_py && !ConvertPythonToMesh(logicmgr, mesh_py, &mesh, true, "gameOb.reinstancePhysicsMesh(obj, mesh): KX_GameObject")) ) { return NULL; @@ -2090,12 +2090,12 @@ static PyObject *Map_GetItem(PyObject *self_v, PyObject *item) const char *attr_str= _PyUnicode_AsString(item); CValue* resultattr; PyObject *pyconvert; - + if (self == NULL) { PyErr_SetString(PyExc_SystemError, "val = gameOb[key]: KX_GameObject, " BGE_PROXY_ERROR_MSG); return NULL; } - + /* first see if the attributes a string and try get the cvalue attribute */ if (attr_str && (resultattr=self->GetProperty(attr_str))) { pyconvert = resultattr->ConvertValueToPython(); @@ -2103,7 +2103,7 @@ static PyObject *Map_GetItem(PyObject *self_v, PyObject *item) } /* no CValue attribute, try get the python only m_attr_dict attribute */ else if (self->m_attr_dict && (pyconvert=PyDict_GetItem(self->m_attr_dict, item))) { - + if (attr_str) PyErr_Clear(); Py_INCREF(pyconvert); @@ -2114,7 +2114,7 @@ static PyObject *Map_GetItem(PyObject *self_v, PyObject *item) else PyErr_SetString(PyExc_KeyError, "value = gameOb[key]: KX_GameObject, key does not exist"); return NULL; } - + } @@ -2124,22 +2124,22 @@ static int Map_SetItem(PyObject *self_v, PyObject *key, PyObject *val) const char *attr_str= _PyUnicode_AsString(key); if (attr_str==NULL) PyErr_Clear(); - + if (self == NULL) { PyErr_SetString(PyExc_SystemError, "gameOb[key] = value: KX_GameObject, " BGE_PROXY_ERROR_MSG); return -1; } - + if (val==NULL) { /* del ob["key"] */ int del= 0; - + /* try remove both just in case */ if (attr_str) del |= (self->RemoveProperty(attr_str)==true) ? 1:0; - + if (self->m_attr_dict) del |= (PyDict_DelItem(self->m_attr_dict, key)==0) ? 1:0; - + if (del==0) { if (attr_str) PyErr_Format(PyExc_KeyError, "gameOb[key] = value: KX_GameObject, key \"%s\" could not be set", attr_str); else PyErr_SetString(PyExc_KeyError, "del gameOb[key]: KX_GameObject, key could not be deleted"); @@ -2151,23 +2151,23 @@ static int Map_SetItem(PyObject *self_v, PyObject *key, PyObject *val) } else { /* ob["key"] = value */ bool set = false; - + /* as CValue */ if (attr_str && PyObject_TypeCheck(val, &PyObjectPlus::Type)==0) /* don't allow GameObjects for eg to be assigned to CValue props */ { CValue *vallie = self->ConvertPythonToValue(val, false, "gameOb[key] = value: "); - + if (vallie) { CValue* oldprop = self->GetProperty(attr_str); - + if (oldprop) oldprop->SetValue(vallie); else self->SetProperty(attr_str, vallie); - + vallie->Release(); set = true; - + /* try remove dict value to avoid double ups */ if (self->m_attr_dict) { if (PyDict_DelItem(self->m_attr_dict, key) != 0) @@ -2178,12 +2178,12 @@ static int Map_SetItem(PyObject *self_v, PyObject *key, PyObject *val) return -1; } } - + if (set == false) { if (self->m_attr_dict==NULL) /* lazy init */ self->m_attr_dict= PyDict_New(); - - + + if (PyDict_SetItem(self->m_attr_dict, key, val)==0) { if (attr_str) @@ -2195,31 +2195,31 @@ static int Map_SetItem(PyObject *self_v, PyObject *key, PyObject *val) else PyErr_SetString(PyExc_KeyError, "gameOb[key] = value: KX_GameObject, key not be added to internal dictionary"); } } - + if (set == false) { return -1; /* pythons error value */ } - + } - + return 0; /* success */ } static int Seq_Contains(PyObject *self_v, PyObject *value) { KX_GameObject* self = static_castBGE_PROXY_REF(self_v); - + if (self == NULL) { PyErr_SetString(PyExc_SystemError, "val in gameOb: KX_GameObject, " BGE_PROXY_ERROR_MSG); return -1; } - + if (PyUnicode_Check(value) && self->GetProperty(_PyUnicode_AsString(value))) return 1; - + if (self->m_attr_dict && PyDict_GetItem(self->m_attr_dict, value)) return 1; - + return 0; } @@ -2622,7 +2622,7 @@ int KX_GameObject::pyattr_set_worldPosition(void *self_v, const KX_PYATTRIBUTE_D MT_Point3 pos; if (!PyVecTo(value, pos)) return PY_SET_ATTR_FAIL; - + self->NodeSetWorldPosition(pos); self->NodeUpdateGS(0.f); return PY_SET_ATTR_SUCCESS; @@ -2646,7 +2646,7 @@ int KX_GameObject::pyattr_set_localPosition(void *self_v, const KX_PYATTRIBUTE_D MT_Point3 pos; if (!PyVecTo(value, pos)) return PY_SET_ATTR_FAIL; - + self->NodeSetLocalPosition(pos); self->NodeUpdateGS(0.f); return PY_SET_ATTR_SUCCESS; @@ -2681,14 +2681,14 @@ PyObject *KX_GameObject::pyattr_get_worldOrientation(void *self_v, const KX_PYAT int KX_GameObject::pyattr_set_worldOrientation(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) { KX_GameObject* self = static_cast(self_v); - + /* if value is not a sequence PyOrientationTo makes an error */ MT_Matrix3x3 rot; if (!PyOrientationTo(value, rot, "gameOb.worldOrientation = sequence: KX_GameObject, ")) return PY_SET_ATTR_FAIL; self->NodeSetGlobalOrientation(rot); - + self->NodeUpdateGS(0.f); return PY_SET_ATTR_SUCCESS; } @@ -2708,7 +2708,7 @@ PyObject *KX_GameObject::pyattr_get_localOrientation(void *self_v, const KX_PYAT int KX_GameObject::pyattr_set_localOrientation(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) { KX_GameObject* self = static_cast(self_v); - + /* if value is not a sequence PyOrientationTo makes an error */ MT_Matrix3x3 rot; if (!PyOrientationTo(value, rot, "gameOb.localOrientation = sequence: KX_GameObject, ")) @@ -2774,10 +2774,10 @@ PyObject *KX_GameObject::pyattr_get_localTransform(void *self_v, const KX_PYATTR float mat[16]; MT_Transform trans; - + trans.setOrigin(self->GetSGNode()->GetLocalPosition()); trans.setBasis(self->GetSGNode()->GetLocalOrientation()); - + MT_Vector3 scaling = self->GetSGNode()->GetLocalScale(); trans.scale(scaling[0], scaling[1], scaling[2]); @@ -3012,12 +3012,12 @@ int KX_GameObject::pyattr_set_state(void *self_v, const KX_PYATTRIBUTE_DEF *attr KX_GameObject* self = static_cast(self_v); int state_i = PyLong_AsLong(value); unsigned int state = 0; - + if (state_i == -1 && PyErr_Occurred()) { PyErr_SetString(PyExc_TypeError, "gameOb.state = int: KX_GameObject, expected an int bit field"); return PY_SET_ATTR_FAIL; } - + state |= state_i; if ((state & ((1<<30)-1)) == 0) { PyErr_SetString(PyExc_AttributeError, "gameOb.state = int: KX_GameObject, state bitfield was not between 0 and 30 (1<<0 and 1<<29)"); @@ -3032,13 +3032,13 @@ PyObject *KX_GameObject::pyattr_get_meshes(void *self_v, const KX_PYATTRIBUTE_DE KX_GameObject* self = static_cast(self_v); PyObject *meshes= PyList_New(self->m_meshes.size()); int i; - + for (i=0; i < (int)self->m_meshes.size(); i++) { KX_MeshProxy* meshproxy = new KX_MeshProxy(self->m_meshes[i]); PyList_SET_ITEM(meshes, i, meshproxy->NewProxy(true)); } - + return meshes; } @@ -3160,10 +3160,10 @@ PyObject *KX_GameObject::pyattr_get_children_recursive(void *self_v, const KX_PY PyObject *KX_GameObject::pyattr_get_attrDict(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) { KX_GameObject* self = static_cast(self_v); - + if (self->m_attr_dict==NULL) self->m_attr_dict= PyDict_New(); - + Py_INCREF(self->m_attr_dict); return self->m_attr_dict; } @@ -3292,7 +3292,7 @@ PyObject *KX_GameObject::PySetLinearVelocity(PyObject *args) { int local = 0; PyObject *pyvect; - + if (PyArg_ParseTuple(args,"O|i:setLinearVelocity",&pyvect,&local)) { MT_Vector3 velocity; if (PyVecTo(pyvect, velocity)) { @@ -3321,7 +3321,7 @@ PyObject *KX_GameObject::PySetAngularVelocity(PyObject *args) { int local = 0; PyObject *pyvect; - + if (PyArg_ParseTuple(args,"O|i:setAngularVelocity",&pyvect,&local)) { MT_Vector3 velocity; if (PyVecTo(pyvect, velocity)) { @@ -3349,11 +3349,11 @@ PyObject *KX_GameObject::PySetVisible(PyObject *args) int visible, recursive = 0; if (!PyArg_ParseTuple(args,"i|i:setVisible",&visible, &recursive)) return NULL; - + SetVisible(visible ? true:false, recursive ? true:false); UpdateBuckets(recursive ? true:false); Py_RETURN_NONE; - + } PyObject *KX_GameObject::PySetOcclusion(PyObject *args) @@ -3361,7 +3361,7 @@ PyObject *KX_GameObject::PySetOcclusion(PyObject *args) int occlusion, recursive = 0; if (!PyArg_ParseTuple(args,"i|i:setOcclusion",&occlusion, &recursive)) return NULL; - + SetOccluder(occlusion ? true:false, recursive ? true:false); Py_RETURN_NONE; } @@ -3371,7 +3371,7 @@ PyObject *KX_GameObject::PyGetVelocity(PyObject *args) // only can get the velocity if we have a physics object connected to us... MT_Point3 point(0.0f,0.0f,0.0f); PyObject *pypos = NULL; - + if (!PyArg_ParseTuple(args, "|O:getVelocity", &pypos) || (pypos && !PyVecTo(pypos, point))) return NULL; @@ -3381,16 +3381,16 @@ PyObject *KX_GameObject::PyGetVelocity(PyObject *args) PyObject *KX_GameObject::PyGetReactionForce() { // only can get the velocity if we have a physics object connected to us... - + // XXX - Currently not working with bullet intergration, see KX_BulletPhysicsController.cpp's getReactionForce #if 0 if (GetPhysicsController1()) return PyObjectFrom(GetPhysicsController1()->getReactionForce()); return PyObjectFrom(dummy_point); #endif - + return Py_BuildValue("fff", 0.0f, 0.0f, 0.0f); - + } @@ -3421,7 +3421,7 @@ PyObject *KX_GameObject::PySetParent(PyObject *args) PyObject *pyobj; KX_GameObject *obj; int addToCompound=1, ghost=1; - + if (!PyArg_ParseTuple(args,"O|ii:setParent", &pyobj, &addToCompound, &ghost)) { return NULL; // Python sets a simple error } @@ -3435,7 +3435,7 @@ PyObject *KX_GameObject::PySetParent(PyObject *args) PyObject *KX_GameObject::PyRemoveParent() { KX_Scene *scene = KX_GetActiveScene(); - + this->RemoveParent(scene); Py_RETURN_NONE; } @@ -3444,12 +3444,12 @@ PyObject *KX_GameObject::PyRemoveParent() PyObject *KX_GameObject::PySetCollisionMargin(PyObject *value) { float collisionMargin = PyFloat_AsDouble(value); - + if (collisionMargin==-1 && PyErr_Occurred()) { PyErr_SetString(PyExc_TypeError, "expected a float"); return NULL; } - + if (m_pPhysicsController) { m_pPhysicsController->SetMargin(collisionMargin); @@ -3466,12 +3466,12 @@ PyObject *KX_GameObject::PyApplyImpulse(PyObject *args) PyObject *pyattach; PyObject *pyimpulse; int local = 0; - + if (!m_pPhysicsController) { PyErr_SetString(PyExc_RuntimeError, "This object has no physics controller"); return NULL; } - + if (PyArg_ParseTuple(args, "OO|i:applyImpulse", &pyattach, &pyimpulse, &local)) { MT_Point3 attach; @@ -3483,7 +3483,7 @@ PyObject *KX_GameObject::PyApplyImpulse(PyObject *args) } } - + return NULL; } @@ -3518,7 +3518,7 @@ PyObject *KX_GameObject::PyAlignAxisToVect(PyObject *args) PyObject *pyvect; int axis = 2; //z axis is the default float fac = 1.0f; - + if (PyArg_ParseTuple(args,"O|if:alignAxisToVect",&pyvect,&axis, &fac)) { MT_Vector3 vect; @@ -3560,7 +3560,7 @@ PyObject *KX_GameObject::PyGetPhysicsId() PyObject *KX_GameObject::PyGetPropertyNames() { PyObject *list= ConvertKeysToPython(); - + if (m_attr_dict) { PyObject *key, *value; Py_ssize_t pos = 0; @@ -3588,7 +3588,7 @@ KX_PYMETHODDEF_DOC_O(KX_GameObject, getDistanceTo, { return PyFloat_FromDouble(NodeGetWorldPosition().distance(other->NodeGetWorldPosition())); } - + return NULL; } @@ -3606,7 +3606,7 @@ KX_PYMETHODDEF_DOC_O(KX_GameObject, getVectTo, if (!PyVecTo(value, toPoint)) { PyErr_Clear(); - + KX_GameObject *other; if (ConvertPythonToGameObject(logicmgr, value, &other, false, "")) /* error will be overwritten */ { @@ -3631,7 +3631,7 @@ KX_PYMETHODDEF_DOC_O(KX_GameObject, getVectTo, toDir.normalize(); locToDir = toDir * NodeGetWorldOrientation(); } - + returnValue = PyTuple_New(3); if (returnValue) { // very unlikely to fail, python sets a memory error here. PyTuple_SET_ITEM(returnValue, 0, PyFloat_FromDouble(distance)); @@ -3663,7 +3663,7 @@ bool KX_GameObject::RayHit(KX_ClientObjectInfo *client, KX_RayCast *result, RayC // if X-ray option is selected, the unwnted objects were not tested, so get here only with true hit // if not, all objects were tested and the front one may not be the correct one. - if ((rayData->m_xray || rayData->m_prop.Length() == 0 || hitKXObj->GetProperty(rayData->m_prop) != NULL) && + if ((rayData->m_xray || rayData->m_prop.Length() == 0 || hitKXObj->GetProperty(rayData->m_prop) != NULL) && hitKXObj->GetUserCollisionGroup() & rayData->m_mask) { rayData->m_hitObject = hitKXObj; @@ -3688,10 +3688,10 @@ bool KX_GameObject::NeedRayCast(KX_ClientObjectInfo *client, RayCastData *rayDat printf("Invalid client type %d found in ray casting\n", client->m_type); return false; } - + // if X-Ray option is selected, skip object that don't match the criteria as we see through them // if not, test all objects because we don't know yet which one will be on front - if ((!rayData->m_xray || rayData->m_prop.Length() == 0 || hitKXObj->GetProperty(rayData->m_prop) != NULL) && + if ((!rayData->m_xray || rayData->m_prop.Length() == 0 || hitKXObj->GetProperty(rayData->m_prop) != NULL) && hitKXObj->GetUserCollisionGroup() & rayData->m_mask) { return true; @@ -3720,7 +3720,7 @@ KX_PYMETHODDEF_DOC(KX_GameObject, rayCastTo, { KX_GameObject *other; PyErr_Clear(); - + if (ConvertPythonToGameObject(logicmgr, pyarg, &other, false, "")) /* error will be overwritten */ { toPoint = other->NodeGetWorldPosition(); @@ -3731,10 +3731,10 @@ KX_PYMETHODDEF_DOC(KX_GameObject, rayCastTo, } } MT_Point3 fromPoint = NodeGetWorldPosition(); - + if (dist != 0.0f) toPoint = fromPoint + dist * (toPoint-fromPoint).safe_normalized(); - + PHY_IPhysicsEnvironment* pe = GetScene()->GetPhysicsEnvironment(); PHY_IPhysicsController *spc = GetPhysicsController(); KX_GameObject *parent = GetParent(); @@ -3746,7 +3746,7 @@ KX_PYMETHODDEF_DOC(KX_GameObject, rayCastTo, if (KX_RayCast::RayTest(pe, fromPoint, toPoint, callback) && rayData.m_hitObject) { return rayData.m_hitObject->GetProxy(); } - + Py_RETURN_NONE; } @@ -3757,7 +3757,7 @@ static PyObject *none_tuple_3() PyTuple_SET_ITEM(ret, 0, Py_None); PyTuple_SET_ITEM(ret, 1, Py_None); PyTuple_SET_ITEM(ret, 2, Py_None); - + Py_INCREF(Py_None); Py_INCREF(Py_None); Py_INCREF(Py_None); @@ -3770,7 +3770,7 @@ static PyObject *none_tuple_4() PyTuple_SET_ITEM(ret, 1, Py_None); PyTuple_SET_ITEM(ret, 2, Py_None); PyTuple_SET_ITEM(ret, 3, Py_None); - + Py_INCREF(Py_None); Py_INCREF(Py_None); Py_INCREF(Py_None); @@ -3786,7 +3786,7 @@ static PyObject *none_tuple_5() PyTuple_SET_ITEM(ret, 2, Py_None); PyTuple_SET_ITEM(ret, 3, Py_None); PyTuple_SET_ITEM(ret, 4, Py_None); - + Py_INCREF(Py_None); Py_INCREF(Py_None); Py_INCREF(Py_None); @@ -3836,7 +3836,7 @@ KX_PYMETHODDEF_DOC(KX_GameObject, rayCast, if (!PyVecTo(pyto, toPoint)) { PyErr_Clear(); - + if (ConvertPythonToGameObject(logicmgr, pyto, &other, false, "")) /* error will be overwritten */ { toPoint = other->NodeGetWorldPosition(); @@ -3853,7 +3853,7 @@ KX_PYMETHODDEF_DOC(KX_GameObject, rayCast, else if (!PyVecTo(pyfrom, fromPoint)) { PyErr_Clear(); - + if (ConvertPythonToGameObject(logicmgr, pyfrom, &other, false, "")) /* error will be overwritten */ { fromPoint = other->NodeGetWorldPosition(); @@ -3881,7 +3881,7 @@ KX_PYMETHODDEF_DOC(KX_GameObject, rayCast, //return Py_BuildValue("OOO", Py_None, Py_None, Py_None); return none_tuple_3(); } - + PHY_IPhysicsEnvironment* pe = GetScene()->GetPhysicsEnvironment(); PHY_IPhysicsController *spc = GetPhysicsController(); KX_GameObject *parent = GetParent(); @@ -3939,7 +3939,7 @@ KX_PYMETHODDEF_DOC(KX_GameObject, rayCast, return none_tuple_3(); } -KX_PYMETHODDEF_DOC_VARARGS(KX_GameObject, sendMessage, +KX_PYMETHODDEF_DOC_VARARGS(KX_GameObject, sendMessage, "sendMessage(subject, [body, to])\n" "sends a message in same manner as a message actuator" "subject = Subject of the message (string)" @@ -3954,7 +3954,7 @@ KX_PYMETHODDEF_DOC_VARARGS(KX_GameObject, sendMessage, if (!PyArg_ParseTuple(args, "s|ss:sendMessage", &subject, &body, &to)) return NULL; - + scene->GetNetworkScene()->SendMessage(to, from, subject, body); Py_RETURN_NONE; } @@ -4121,8 +4121,8 @@ PyObject *KX_GameObject::Pyget(PyObject *args) if (!PyArg_ParseTuple(args, "O|O:get", &key, &def)) return NULL; - - + + if (PyUnicode_Check(key)) { CValue *item = GetProperty(_PyUnicode_AsString(key)); if (item) { @@ -4133,12 +4133,12 @@ PyObject *KX_GameObject::Pyget(PyObject *args) return item->GetProxy(); } } - + if (m_attr_dict && (ret=PyDict_GetItem(m_attr_dict, key))) { Py_INCREF(ret); return ret; } - + Py_INCREF(def); return def; } @@ -4150,10 +4150,10 @@ bool ConvertPythonToGameObject(SCA_LogicManager *manager, PyObject *value, KX_Ga *object = NULL; return false; } - + if (value==Py_None) { *object = NULL; - + if (py_none_ok) { return true; } else { @@ -4161,10 +4161,10 @@ bool ConvertPythonToGameObject(SCA_LogicManager *manager, PyObject *value, KX_Ga return false; } } - + if (PyUnicode_Check(value)) { *object = (KX_GameObject*)manager->GetGameObjectByName(STR_String( _PyUnicode_AsString(value) )); - + if (*object) { return true; } else { @@ -4172,7 +4172,7 @@ bool ConvertPythonToGameObject(SCA_LogicManager *manager, PyObject *value, KX_Ga return false; } } - + if (PyObject_TypeCheck(value, &KX_GameObject::Type) || PyObject_TypeCheck(value, &KX_LightObject::Type) || PyObject_TypeCheck(value, &KX_Camera::Type) || @@ -4180,24 +4180,24 @@ bool ConvertPythonToGameObject(SCA_LogicManager *manager, PyObject *value, KX_Ga PyObject_TypeCheck(value, &KX_NavMeshObject::Type)) { *object = static_castBGE_PROXY_REF(value); - + /* sets the error */ if (*object==NULL) { PyErr_Format(PyExc_SystemError, "%s, " BGE_PROXY_ERROR_MSG, error_prefix); return false; } - + return true; } - + *object = NULL; - + if (py_none_ok) { PyErr_Format(PyExc_TypeError, "%s, expect a KX_GameObject, a string or None", error_prefix); } else { PyErr_Format(PyExc_TypeError, "%s, expect a KX_GameObject or a string", error_prefix); } - + return false; } #endif // WITH_PYTHON diff --git a/source/gameengine/Ketsji/KX_GameObject.h b/source/gameengine/Ketsji/KX_GameObject.h index 9c582d3e27a..7a8243eb43d 100644 --- a/source/gameengine/Ketsji/KX_GameObject.h +++ b/source/gameengine/Ketsji/KX_GameObject.h @@ -36,7 +36,7 @@ #ifdef _MSC_VER /* get rid of this stupid "warning 'this' used in initialiser list", generated by VC when including Solid/Sumo */ # pragma warning (disable:4355) -#endif +#endif #include @@ -91,10 +91,10 @@ protected: std::vector m_lodmeshes; int m_currentLodLevel; short m_previousLodLevel; - SG_QList m_meshSlots; // head of mesh slots of this + SG_QList m_meshSlots; // head of mesh slots of this struct Object* m_pBlenderObject; struct Object* m_pBlenderGroupObject; - + bool m_bUseObjectColor; bool m_bIsNegativeScaling; MT_Vector4 m_objectColor; @@ -105,8 +105,8 @@ protected: // visible = user setting // culled = while rendering, depending on camera - bool m_bVisible; - bool m_bCulled; + bool m_bVisible; + bool m_bCulled; bool m_bOccluder; PHY_IPhysicsController* m_pPhysicsController; @@ -126,7 +126,7 @@ protected: BL_ActionManager* m_actionManager; BL_ActionManager* GetActionManager(); - + bool m_bRecordAnimation; public: @@ -135,7 +135,7 @@ public: /** * KX_GameObject custom infos for ray cast, it contains property name, * collision mask, xray flag and hited object. - * This structure is created during ray cast and passed as argument + * This structure is created during ray cast and passed as argument * "data" to functions KX_GameObject::NeedRayCast and KX_GameObject::RayHit. */ struct RayCastData; @@ -174,21 +174,21 @@ public: * Compute an OpenGl compatible 4x4 matrix. Has the * side effect of storing the result internally. The * memory for the matrix remains the property of this class. - */ + */ float * GetOpenGLMatrix( ); /** - * Return a pointer to a MT_CmMatrix4x4 storing the + * Return a pointer to a MT_CmMatrix4x4 storing the * opengl transformation for this object. This is updated - * by a call to GetOpenGLMatrix(). This class owns the + * by a call to GetOpenGLMatrix(). This class owns the * memory for the returned matrix. */ MT_CmMatrix4x4 * GetOpenGLMatrixPtr( - ) { + ) { return &m_OpenGL_4x4Matrix; }; @@ -209,11 +209,11 @@ public: std::vector GetConstraints(); void ClearConstraints(); - /** - * Get a pointer to the game object that is the parent of + /** + * Get a pointer to the game object that is the parent of * this object. Or NULL if there is no parent. The returned * object is part of a reference counting scheme. Calling - * this function ups the reference count on the returned + * this function ups the reference count on the returned * object. It is the responsibility of the caller to decrement * the reference count when you have finished with it. */ @@ -221,12 +221,12 @@ public: GetParent( ); - /** + /** * Sets the parent of this object to a game object */ void SetParent(KX_Scene *scene, KX_GameObject *obj, bool addToCompound=true, bool ghost=true); - /** + /** * Removes the parent of this object to a game object */ void RemoveParent(KX_Scene *scene); @@ -250,8 +250,8 @@ public: void AddInstanceObjects(KX_GameObject* ); - - void + + void RemoveDupliGroupObject( ); @@ -332,7 +332,7 @@ public: *********************************/ /** - * Construct a game object. This class also inherits the + * Construct a game object. This class also inherits the * default constructors - use those with care! */ @@ -341,13 +341,13 @@ public: SG_Callbacks callbacks ); - virtual + virtual ~KX_GameObject( ); - /** + /** * \section Stuff which is here due to poor design. - * Inherited from CValue and needs an implementation. + * Inherited from CValue and needs an implementation. * Do not expect these functions do to anything sensible. */ @@ -373,7 +373,7 @@ public: /** * Inherited from CValue -- does nothing! */ - const + const STR_String & GetText( ); @@ -387,7 +387,7 @@ public: /** * \section Inherited from CValue. These are the useful - * part of the CValue interface that this class implements. + * part of the CValue interface that this class implements. */ /** @@ -405,35 +405,35 @@ public: const char *name ); - /** + /** * Inherited from CValue -- return a new copy of this - * instance allocated on the heap. Ownership of the new + * instance allocated on the heap. Ownership of the new * object belongs with the caller. */ virtual CValue* GetReplica( ); - + /** - * Inherited from CValue -- Makes sure any internal + * Inherited from CValue -- Makes sure any internal * data owned by this class is deep copied. Called internally */ virtual void ProcessReplica(); - /** + /** * Return the linear velocity of the game object. */ - MT_Vector3 + MT_Vector3 GetLinearVelocity( bool local=false ); - /** + /** * Return the linear velocity of a given point in world coordinate * but relative to center of object ([0,0,0]=center of object) */ - MT_Vector3 + MT_Vector3 GetVelocity( const MT_Point3& position ); @@ -450,25 +450,25 @@ public: MT_Vector3 GetLocalInertia(); - /** + /** * Return the angular velocity of the game object. */ - MT_Vector3 + MT_Vector3 GetAngularVelocity( bool local=false ); - /** + /** * Align the object to a given normal. */ - void + void AlignAxisToVect( const MT_Vector3& vect, int axis = 2, float fac = 1.0 ); - /** + /** * Quick'n'dirty obcolor ipo stuff */ @@ -481,7 +481,7 @@ public: GetObjectColor(); - void + void ResolveCombinedVelocities( const MT_Vector3 & lin_vel, const MT_Vector3 & ang_vel, @@ -496,7 +496,7 @@ public: PHY_IPhysicsController* GetPhysicsController(); void SetPhysicsController(PHY_IPhysicsController* physicscontroller,bool isDynamic) - { + { m_bDyna = isDynamic; m_pPhysicsController = physicscontroller; } @@ -511,15 +511,15 @@ public: } /** - * \return a pointer to the graphic controller owner by this class + * \return a pointer to the graphic controller owner by this class */ PHY_IGraphicController* GetGraphicController() { return m_pGraphicController; } - void SetGraphicController(PHY_IGraphicController* graphiccontroller) - { + void SetGraphicController(PHY_IGraphicController* graphiccontroller) + { m_pGraphicController = graphiccontroller; } /* @@ -577,13 +577,13 @@ public: * \section scene graph node accessor functions. */ - SG_Node* GetSGNode( ) - { + SG_Node* GetSGNode( ) + { return m_pSGNode; } const SG_Node* GetSGNode( ) const - { + { return m_pSGNode; } @@ -610,9 +610,9 @@ public: { m_pBlenderGroupObject = obj; } - + bool IsDupliGroup() - { + { return (m_pBlenderObject && (m_pBlenderObject->transflag & OB_DUPLIGROUP) && m_pBlenderObject->dup_group != NULL) ? true : false; @@ -627,14 +627,14 @@ public: * node. */ void SetSGNode(SG_Node* node ) - { - m_pSGNode = node; + { + m_pSGNode = node; } - + //Is it a dynamic/physics object ? - bool IsDynamic() const - { - return m_bDyna; + bool IsDynamic() const + { + return m_bDyna; } bool IsDynamicsSuspended() const; @@ -670,7 +670,7 @@ public: /** * \section Physics accessors for this node. * - * All these calls get passed directly to the physics controller + * All these calls get passed directly to the physics controller * owned by this object. * This is real interface bloat. Why not just use the physics controller * directly? I think this is because the python interface is in the wrong @@ -743,7 +743,7 @@ public: /** * Function to set IPO option at start of IPO - */ + */ void InitIPO( bool ipo_as_force, @@ -753,16 +753,16 @@ public: /** * Odd function to update an ipo. ??? - */ + */ void UpdateIPO( float curframetime, bool recurse ); /** - * Updates Material Ipo data + * Updates Material Ipo data */ - void + void UpdateMaterialData( dword matname_hash, MT_Vector4 rgba, @@ -785,7 +785,7 @@ public: void AddMeshUser( ); - + /** * Update buckets with data about the mesh after * creating or duplicating the object, changing @@ -841,8 +841,8 @@ public: RAS_MeshObject* GetMesh( int num - ) const { - return m_meshes[num]; + ) const { + return m_meshes[num]; } /** @@ -851,10 +851,10 @@ public: */ int GetMeshCount( - ) const { - return m_meshes.size(); + ) const { + return m_meshes.size(); } - + /** * Set the debug color of the meshes associated with this * class. Does this still work? @@ -864,7 +864,7 @@ public: unsigned int bgra ); - /** + /** * Reset the debug color of meshes associated with this class. */ void @@ -904,7 +904,7 @@ public: SetCulled( bool c ) { m_bCulled = c; } - + /** * Is this object an occluder? */ @@ -921,7 +921,7 @@ public: bool v, bool recursive ); - + /** * Change the layer of the object (when it is added in another layer * than the original layer) @@ -938,7 +938,7 @@ public: GetLayer( void ); - + /** * Get the negative scaling state */ @@ -973,14 +973,14 @@ public: { m_pObstacleSimulation = NULL; } - + /** * add debug object to the debuglist. */ void SetUseDebugProperties(bool debug, bool recursive); KX_ClientObjectInfo* getClientInfo() { return m_pClient_info; } - + CListValue* GetChildren(); CListValue* GetChildrenRecursive(); @@ -1047,10 +1047,10 @@ public: KX_PYMETHOD_DOC(KX_GameObject, getActionName); KX_PYMETHOD_DOC(KX_GameObject, setActionFrame); KX_PYMETHOD_DOC(KX_GameObject, isPlayingAction); - + /* Dict access */ KX_PYMETHOD_VARARGS(KX_GameObject,get); - + /* attributes */ static PyObject* pyattr_get_name(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef); static PyObject* pyattr_get_parent(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); @@ -1130,7 +1130,7 @@ public: static PyObject* pyattr_get_sensors(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); static PyObject* pyattr_get_controllers(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); static PyObject* pyattr_get_actuators(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); - + /* getitem/setitem */ static PyMappingMethods Mapping; static PySequenceMethods Sequence; diff --git a/source/gameengine/Ketsji/KX_IInterpolator.h b/source/gameengine/Ketsji/KX_IInterpolator.h index 6c0bf2d85cc..66fc20fb8c8 100644 --- a/source/gameengine/Ketsji/KX_IInterpolator.h +++ b/source/gameengine/Ketsji/KX_IInterpolator.h @@ -41,8 +41,8 @@ class KX_IInterpolator { public: virtual ~KX_IInterpolator() {} - - virtual void Execute(float currentTime) const = 0; + + virtual void Execute(float currentTime) const = 0; #ifdef WITH_CXX_GUARDEDALLOC diff --git a/source/gameengine/Ketsji/KX_IPOTransform.h b/source/gameengine/Ketsji/KX_IPOTransform.h index a81c432b01e..bc52e1a27fd 100644 --- a/source/gameengine/Ketsji/KX_IPOTransform.h +++ b/source/gameengine/Ketsji/KX_IPOTransform.h @@ -59,16 +59,16 @@ public: const MT_Point3& GetPosition() const { return m_position; } const MT_Vector3& GetEulerAngles() const { return m_eulerAngles; } const MT_Vector3& GetScaling() const { return m_scaling; } - + MT_Vector3& GetDeltaPosition() { return m_deltaPosition; } MT_Vector3& GetDeltaEulerAngles() { return m_deltaEulerAngles; } MT_Vector3& GetDeltaScaling() { return m_deltaScaling; } - + void SetPosition(const MT_Point3& pos) { m_position = pos; } void SetEulerAngles(const MT_Vector3& eul) { m_eulerAngles = eul; } void SetScaling(const MT_Vector3& scaling) { m_scaling = scaling; } - - void ClearDeltaStuff() { + + void ClearDeltaStuff() { m_deltaPosition.setValue(0.0f, 0.0f, 0.0f); m_deltaEulerAngles.setValue(0.0f, 0.0f, 0.0f); m_deltaScaling.setValue(0.0f, 0.0f, 0.0f); diff --git a/source/gameengine/Ketsji/KX_IPO_SGController.cpp b/source/gameengine/Ketsji/KX_IPO_SGController.cpp index be1a4b4ef3a..2258572b563 100644 --- a/source/gameengine/Ketsji/KX_IPO_SGController.cpp +++ b/source/gameengine/Ketsji/KX_IPO_SGController.cpp @@ -50,7 +50,7 @@ typedef unsigned long uint_ptr; #include "DNA_ipo_types.h" #include "BLI_math.h" -// All objects should start on frame 1! Will we ever need an object to +// All objects should start on frame 1! Will we ever need an object to // start on another frame, the 1.0 should change. KX_IpoSGController::KX_IpoSGController() : m_ipo_as_force(false), @@ -145,7 +145,7 @@ bool KX_IpoSGController::Update(double currentTime) m_ipo_xform.GetPosition(); m_game_object->GetPhysicsController()->ApplyForce(vec, false); } - } + } else { // Local ipo should be defined with the object position at (0,0,0) // Local transform is applied to the object based on initial position @@ -231,8 +231,8 @@ bool KX_IpoSGController::Update(double currentTime) else if (m_ipo_channels_active[OB_ROT_X] || m_ipo_channels_active[OB_ROT_Y] || m_ipo_channels_active[OB_ROT_Z]) { if (m_ipo_euler_initialized) { // assume all channel absolute - // All 3 channels should be specified but if they are not, we will take - // the value at the start of the game to avoid angle sign reversal + // All 3 channels should be specified but if they are not, we will take + // the value at the start of the game to avoid angle sign reversal double yaw = m_ipo_start_euler[0], pitch = m_ipo_start_euler[1], roll = m_ipo_start_euler[2]; //RotX and dRotX @@ -250,7 +250,7 @@ bool KX_IpoSGController::Update(double currentTime) else if (m_ipo_channels_active[OB_DROT_Y]) { pitch += m_ipo_xform.GetDeltaEulerAngles()[1]; } - + //RotZ and dRotZ if (m_ipo_channels_active[OB_ROT_Z]) { roll = (m_ipo_channels_active[OB_DROT_Z] ? (m_ipo_xform.GetEulerAngles()[2] + m_ipo_xform.GetDeltaEulerAngles()[2]) : m_ipo_xform.GetEulerAngles()[2] ); @@ -308,7 +308,7 @@ bool KX_IpoSGController::Update(double currentTime) else if (m_ipo_channels_active[OB_DSIZE_Y] && m_ipo_start_initialized) { newScale[1] = (m_ipo_xform.GetDeltaScaling()[1] + ((!m_ipo_add)?m_ipo_start_scale[1] : 0.0f)); } - + //RotZ and dRotZ if (m_ipo_channels_active[OB_SIZE_Z]) { newScale[2] = (m_ipo_channels_active[OB_DSIZE_Z] ? (m_ipo_xform.GetScaling()[2] + m_ipo_xform.GetDeltaScaling()[2]) : m_ipo_xform.GetScaling()[2]); diff --git a/source/gameengine/Ketsji/KX_IPO_SGController.h b/source/gameengine/Ketsji/KX_IPO_SGController.h index 3318761bb88..67dd87468d3 100644 --- a/source/gameengine/Ketsji/KX_IPO_SGController.h +++ b/source/gameengine/Ketsji/KX_IPO_SGController.h @@ -56,7 +56,7 @@ class KX_IpoSGController : public SG_Controller /** Ipo must be applied in local coordinate rather than in global coordinates (used for force and Add mode)*/ bool m_ipo_local; - + /** Were settings altered since the last update? */ bool m_modified; diff --git a/source/gameengine/Ketsji/KX_IScalarInterpolator.h b/source/gameengine/Ketsji/KX_IScalarInterpolator.h index 1e822c49c6d..34d5bda3ec5 100644 --- a/source/gameengine/Ketsji/KX_IScalarInterpolator.h +++ b/source/gameengine/Ketsji/KX_IScalarInterpolator.h @@ -39,8 +39,8 @@ class KX_IScalarInterpolator { public: virtual ~KX_IScalarInterpolator() {} - - virtual float GetValue(float currentTime) const = 0; + + virtual float GetValue(float currentTime) const = 0; #ifdef WITH_CXX_GUARDEDALLOC diff --git a/source/gameengine/Ketsji/KX_ISceneConverter.h b/source/gameengine/Ketsji/KX_ISceneConverter.h index 1963fc7c48f..11f412ade05 100644 --- a/source/gameengine/Ketsji/KX_ISceneConverter.h +++ b/source/gameengine/Ketsji/KX_ISceneConverter.h @@ -41,7 +41,7 @@ struct Scene; -class KX_ISceneConverter +class KX_ISceneConverter { public: @@ -93,8 +93,8 @@ public: virtual bool GetCacheMaterials()=0; virtual struct Scene* GetBlenderSceneForName(const STR_String& name)=0; - - + + #ifdef WITH_CXX_GUARDEDALLOC MEM_CXX_CLASS_ALLOC_FUNCS("GE:KX_ISceneConverter") #endif diff --git a/source/gameengine/Ketsji/KX_ISystem.h b/source/gameengine/Ketsji/KX_ISystem.h index 4ba71f8d239..95e10db0197 100644 --- a/source/gameengine/Ketsji/KX_ISystem.h +++ b/source/gameengine/Ketsji/KX_ISystem.h @@ -50,7 +50,7 @@ class KX_ISystem public: KX_ISystem() {}; virtual ~KX_ISystem() {}; - + virtual double GetTimeInSeconds()=0; diff --git a/source/gameengine/Ketsji/KX_IpoConvert.cpp b/source/gameengine/Ketsji/KX_IpoConvert.cpp index 7b00760ee7b..8611c57c863 100644 --- a/source/gameengine/Ketsji/KX_IpoConvert.cpp +++ b/source/gameengine/Ketsji/KX_IpoConvert.cpp @@ -79,7 +79,7 @@ static BL_InterpolatorList *GetAdtList(struct bAction *for_act, KX_BlenderSceneC adtList = new BL_InterpolatorList(for_act); converter->RegisterInterpolatorList(adtList, for_act); } - + return adtList; } @@ -112,13 +112,13 @@ SG_Controller *BL_CreateIPO(struct bAction *action, KX_GameObject* gameobj, KX_B } BL_InterpolatorList *adtList= GetAdtList(action, converter); - + // For each active channel in the adtList add an // interpolator to the game object. - + KX_IInterpolator *interpolator; KX_IScalarInterpolator *interp; - + for (int i=0; i<3; i++) { if ((interp = adtList->GetScalarInterpolator("location", i))) { interpolator= new KX_ScalarInterpolator(&(ipocontr->GetIPOTransform().GetPosition()[i]), interp); @@ -161,7 +161,7 @@ SG_Controller *BL_CreateIPO(struct bAction *action, KX_GameObject* gameobj, KX_B ipocontr->SetIPOChannelActive(OB_DSIZE_X+i, true); } } - + return ipocontr; } @@ -203,10 +203,10 @@ SG_Controller *BL_CreateLampIPO(struct bAction *action, KX_GameObject* lightobj // For each active channel in the adtList add an // interpolator to the game object. - + KX_IInterpolator *interpolator; KX_IScalarInterpolator *interp; - + if ((interp= adtList->GetScalarInterpolator("energy", 0))) { interpolator= new KX_ScalarInterpolator(&ipocontr->m_energy, interp); ipocontr->AddInterpolator(interpolator); @@ -218,7 +218,7 @@ SG_Controller *BL_CreateLampIPO(struct bAction *action, KX_GameObject* lightobj ipocontr->AddInterpolator(interpolator); ipocontr->SetModifyDist(true); } - + for (int i=0; i<3; i++) { if ((interp = adtList->GetScalarInterpolator("color", i))) { interpolator= new KX_ScalarInterpolator(&ipocontr->m_col_rgb[i], interp); @@ -244,10 +244,10 @@ SG_Controller *BL_CreateCameraIPO(struct bAction *action, KX_GameObject* camera // For each active channel in the adtList add an // interpolator to the game object. - + KX_IInterpolator *interpolator; KX_IScalarInterpolator *interp; - + if ((interp = adtList->GetScalarInterpolator("lens", 0))) { interpolator= new KX_ScalarInterpolator(&ipocontr->m_lens, interp); ipocontr->AddInterpolator(interpolator); @@ -349,7 +349,7 @@ SG_Controller *BL_CreateMaterialIpo( struct bAction *action, Material* blendermaterial, dword matname_hash, - KX_GameObject* gameobj, + KX_GameObject* gameobj, KX_BlenderSceneConverter *converter ) { diff --git a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp index d82a0fd533b..355e63212ae 100644 --- a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp +++ b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp @@ -23,7 +23,7 @@ * Contributor(s): none yet. * * ***** END GPL LICENSE BLOCK ***** - * The engine ties all game modules together. + * The engine ties all game modules together. */ /** \file gameengine/Ketsji/KX_KetsjiEngine.cpp @@ -123,9 +123,9 @@ KX_KetsjiEngine::KX_KetsjiEngine(KX_ISystem* system) m_activecam(0), m_bFixedTime(false), m_useExternalClock(false), - + m_firstframe(true), - + m_frameTime(0.f), m_clockTime(0.f), m_previousClockTime(0.f), @@ -138,7 +138,7 @@ KX_KetsjiEngine::KX_KetsjiEngine(KX_ISystem* system) m_exitstring(""), m_cameraZoom(1.0f), - + m_overrideCam(false), m_overrideCamUseOrtho(false), m_overrideCamNear(0.0f), @@ -149,7 +149,7 @@ KX_KetsjiEngine::KX_KetsjiEngine(KX_ISystem* system) m_curreye(0), m_logger(NULL), - + // Set up timing info display variables m_show_framerate(false), m_show_profile(false), @@ -280,7 +280,7 @@ void KX_KetsjiEngine::InitDome(short res, short mode, short angle, float resbuf, void KX_KetsjiEngine::RenderDome() { const GLint *viewport = m_canvas->GetViewPort(); - + m_dome->SetViewPort(viewport); KX_Scene* firstscene = *m_scenes.begin(); @@ -327,17 +327,17 @@ void KX_KetsjiEngine::RenderDome() { if (scene->IsClearingZBuffer()) m_rasterizer->ClearDepthBuffer(); - + m_rasterizer->SetAuxilaryClientInfo(scene); - + // do the rendering m_dome->RenderDomeFrame(scene,cam, i); // render all the font objects for this scene scene->RenderFonts(); } - + list* cameras = scene->GetCameras(); - + // Draw the scene once for each camera with an enabled viewport list::iterator it = cameras->begin(); while (it != cameras->end()) { @@ -345,15 +345,15 @@ void KX_KetsjiEngine::RenderDome() { if (scene->IsClearingZBuffer()) m_rasterizer->ClearDepthBuffer(); - + m_rasterizer->SetAuxilaryClientInfo(scene); - + // do the rendering m_dome->RenderDomeFrame(scene, (*it),i); // render all the font objects for this scene scene->RenderFonts(); } - + it++; } // Part of PostRenderScene() @@ -427,7 +427,7 @@ void KX_KetsjiEngine::StartEngine(bool clearIpo) m_maxLogicFrame = 5; m_maxPhysicsFrame = 5; } - + if (m_animation_record) { m_sceneconverter->ResetPhysicsObjectsAnimationIpo(clearIpo); @@ -499,7 +499,7 @@ bool KX_KetsjiEngine::BeginFrame() return true; } - + return false; } @@ -542,7 +542,7 @@ void KX_KetsjiEngine::EndFrame() m_logger->StartLog(tc_latency, m_kxsystem->GetTimeInSeconds(), true); m_rasterizer->SwapBuffers(); m_logger->StartLog(tc_rasterizer, m_kxsystem->GetTimeInSeconds(), true); - + m_canvas->EndDraw(); } @@ -576,7 +576,7 @@ bool KX_KetsjiEngine::NextFrame() * will be executed before the next rendering phase (which will occur at "clockTime"). * The game time elapsing between two logic frames (called framestep) * depends on several variables: - * - ticrate + * - ticrate * - max_physic_frame * - max_logic_frame * XXX The logic over computation framestep is definitively not clear (and @@ -599,7 +599,7 @@ bool KX_KetsjiEngine::NextFrame() m_clockTime += dt * m_timescale; } } - + double deltatime = m_clockTime - m_frameTime; if (deltatime<0.0) { @@ -613,19 +613,19 @@ bool KX_KetsjiEngine::NextFrame() // if (frames>1) // printf("****************************************"); // printf("dt = %f, deltatime = %f, frames = %d\n",dt, deltatime,frames); - + // if (!frames) // PIL_sleep_ms(1); KX_SceneList::iterator sceneit; - + if (frames>m_maxPhysicsFrame) { - + // printf("framedOut: %d\n",frames); m_frameTime+=(frames-m_maxPhysicsFrame)*timestep; frames = m_maxPhysicsFrame; } - + bool doRender = frames>0; @@ -637,17 +637,17 @@ bool KX_KetsjiEngine::NextFrame() while (frames) { - + m_frameTime += framestep; - + m_sceneconverter->MergeAsyncLoads(); for (sceneit = m_scenes.begin();sceneit != m_scenes.end(); ++sceneit) // for each scene, call the proceed functions { KX_Scene* scene = *sceneit; - + /* Suspension holds the physics and logic processing for an * entire scene. Objects can be suspended individually, and * the settings for that precede the logic and physics @@ -657,7 +657,7 @@ bool KX_KetsjiEngine::NextFrame() m_sceneconverter->resetNoneDynamicObjectToIpo(); // this is for none dynamic objects with ipo scene->UpdateObjectActivity(); - + if (!scene->IsSuspended()) { // if the scene was suspended recalculate the delta tu "curtime" @@ -666,15 +666,15 @@ bool KX_KetsjiEngine::NextFrame() scene->setSuspendedDelta(scene->getSuspendedDelta()+m_clockTime-scene->getSuspendedTime()); m_suspendeddelta = scene->getSuspendedDelta(); - + m_logger->StartLog(tc_network, m_kxsystem->GetTimeInSeconds(), true); SG_SetActiveStage(SG_STAGE_NETWORK); scene->GetNetworkScene()->proceed(m_frameTime); - + //m_logger->StartLog(tc_scenegraph, m_kxsystem->GetTimeInSeconds(), true); //SG_SetActiveStage(SG_STAGE_NETWORK_UPDATE); //scene->UpdateParents(m_frameTime); - + m_logger->StartLog(tc_physics, m_kxsystem->GetTimeInSeconds(), true); SG_SetActiveStage(SG_STAGE_PHYSICS1); // set Python hooks for each scene @@ -682,35 +682,35 @@ bool KX_KetsjiEngine::NextFrame() PHY_SetActiveEnvironment(scene->GetPhysicsEnvironment()); #endif KX_SetActiveScene(scene); - + scene->GetPhysicsEnvironment()->EndFrame(); - + // Update scenegraph after physics step. This maps physics calculations // into node positions. //m_logger->StartLog(tc_scenegraph, m_kxsystem->GetTimeInSeconds(), true); //SG_SetActiveStage(SG_STAGE_PHYSICS1_UPDATE); //scene->UpdateParents(m_frameTime); - + // Process sensors, and controllers m_logger->StartLog(tc_logic, m_kxsystem->GetTimeInSeconds(), true); SG_SetActiveStage(SG_STAGE_CONTROLLER); scene->LogicBeginFrame(m_frameTime); - - // Scenegraph needs to be updated again, because Logic Controllers + + // Scenegraph needs to be updated again, because Logic Controllers // can affect the local matrices. m_logger->StartLog(tc_scenegraph, m_kxsystem->GetTimeInSeconds(), true); SG_SetActiveStage(SG_STAGE_CONTROLLER_UPDATE); scene->UpdateParents(m_frameTime); - + // Process actuators - + // Do some cleanup work for this logic frame m_logger->StartLog(tc_logic, m_kxsystem->GetTimeInSeconds(), true); SG_SetActiveStage(SG_STAGE_ACTUATOR); scene->LogicUpdateFrame(m_frameTime, true); - + scene->LogicEndFrame(); - + // Actuators can affect the scenegraph m_logger->StartLog(tc_scenegraph, m_kxsystem->GetTimeInSeconds(), true); SG_SetActiveStage(SG_STAGE_ACTUATOR_UPDATE); @@ -722,16 +722,16 @@ bool KX_KetsjiEngine::NextFrame() m_logger->StartLog(tc_physics, m_kxsystem->GetTimeInSeconds(), true); SG_SetActiveStage(SG_STAGE_PHYSICS2); scene->GetPhysicsEnvironment()->BeginFrame(); - - // Perform physics calculations on the scene. This can involve + + // Perform physics calculations on the scene. This can involve // many iterations of the physics solver. scene->GetPhysicsEnvironment()->ProceedDeltaTime(m_frameTime,timestep,framestep);//m_deltatimerealDeltaTime); m_logger->StartLog(tc_scenegraph, m_kxsystem->GetTimeInSeconds(), true); SG_SetActiveStage(SG_STAGE_PHYSICS2_UPDATE); scene->UpdateParents(m_frameTime); - - + + if (m_animation_record) { m_sceneconverter->WritePhysicsObjectToAnimationIpo(++m_currentFrame); @@ -742,7 +742,7 @@ bool KX_KetsjiEngine::NextFrame() else if (scene->getSuspendedTime()==0.0) scene->setSuspendedTime(m_clockTime); - + m_logger->StartLog(tc_services, m_kxsystem->GetTimeInSeconds(), true); // invalidates the shadow buffer from previous render/ImageRender because the scene has changed @@ -753,22 +753,22 @@ bool KX_KetsjiEngine::NextFrame() m_logger->StartLog(tc_logic, m_kxsystem->GetTimeInSeconds(), true); if (m_keyboarddevice) m_keyboarddevice->NextFrame(); - + if (m_mousedevice) m_mousedevice->NextFrame(); - + if (m_networkdevice) m_networkdevice->NextFrame(); // scene management ProcessScheduledScenes(); - + frames--; } // Start logging time spent outside main loop m_logger->StartLog(tc_outside, m_kxsystem->GetTimeInSeconds(), true); - + return doRender && m_doRender; } @@ -846,15 +846,15 @@ void KX_KetsjiEngine::Render() { if (scene->IsClearingZBuffer()) m_rasterizer->ClearDepthBuffer(); - + m_rasterizer->SetAuxilaryClientInfo(scene); - + // do the rendering RenderFrame(scene, cam); } - + list* cameras = scene->GetCameras(); - + // Draw the scene once for each camera with an enabled viewport list::iterator it = cameras->begin(); while (it != cameras->end()) { @@ -862,13 +862,13 @@ void KX_KetsjiEngine::Render() { if (scene->IsClearingZBuffer()) m_rasterizer->ClearDepthBuffer(); - + m_rasterizer->SetAuxilaryClientInfo(scene); - + // do the rendering RenderFrame(scene, (*it)); } - + it++; } PostRenderScene(scene); @@ -891,7 +891,7 @@ void KX_KetsjiEngine::Render() // pass the scene's worldsettings to the rasterizer scene->GetWorldInfo()->UpdateWorldSettings(); - + if (scene->IsClearingZBuffer()) m_rasterizer->ClearDepthBuffer(); @@ -903,7 +903,7 @@ void KX_KetsjiEngine::Render() RenderFrame(scene, cam); list* cameras = scene->GetCameras(); - + // Draw the scene once for each camera with an enabled viewport list::iterator it = cameras->begin(); while (it != cameras->end()) { @@ -911,13 +911,13 @@ void KX_KetsjiEngine::Render() { if (scene->IsClearingZBuffer()) m_rasterizer->ClearDepthBuffer(); - + m_rasterizer->SetAuxilaryClientInfo(scene); - + // do the rendering RenderFrame(scene, (*it)); } - + it++; } PostRenderScene(scene); @@ -951,7 +951,7 @@ int KX_KetsjiEngine::GetExitCode() if (m_scenes.begin() == m_scenes.end()) m_exitcode = KX_EXIT_REQUEST_NO_SCENES_LEFT; } - + // check if the window has been closed. if (!m_exitcode) { @@ -1022,7 +1022,7 @@ void KX_KetsjiEngine::GetSceneViewport(KX_Scene *scene, KX_Camera* cam, RAS_Rect if (cam->GetViewport()) { RAS_Rect userviewport; - userviewport.SetLeft(cam->GetViewportLeft()); + userviewport.SetLeft(cam->GetViewportLeft()); userviewport.SetBottom(cam->GetViewportBottom()); userviewport.SetRight(cam->GetViewportRight()); userviewport.SetTop(cam->GetViewportTop()); @@ -1049,7 +1049,7 @@ void KX_KetsjiEngine::GetSceneViewport(KX_Scene *scene, KX_Camera* cam, RAS_Rect area = m_canvas->GetDisplayArea(); } else { - viewport.SetLeft(0); + viewport.SetLeft(0); viewport.SetBottom(0); viewport.SetRight(int(m_canvas->GetWidth())); viewport.SetTop(int(m_canvas->GetHeight())); @@ -1134,7 +1134,7 @@ void KX_KetsjiEngine::RenderShadowBuffers(KX_Scene *scene) /* remember that we have a valid shadow buffer for that scene */ scene->SetShadowDone(true); } - + // update graphics void KX_KetsjiEngine::RenderFrame(KX_Scene* scene, KX_Camera* cam) { @@ -1142,7 +1142,7 @@ void KX_KetsjiEngine::RenderFrame(KX_Scene* scene, KX_Camera* cam) RAS_Rect viewport, area; float nearfrust, farfrust, focallength; // KX_Camera* cam = scene->GetActiveCamera(); - + if (!cam) return; @@ -1160,7 +1160,7 @@ void KX_KetsjiEngine::RenderFrame(KX_Scene* scene, KX_Camera* cam) // set the viewport for this frame and scene m_canvas->SetViewPort(viewport.GetLeft(), viewport.GetBottom(), viewport.GetRight(), viewport.GetTop()); - + // see KX_BlenderMaterial::Activate //m_rasterizer->SetAmbient(); m_rasterizer->DisplayFog(); @@ -1243,7 +1243,7 @@ void KX_KetsjiEngine::RenderFrame(KX_Scene* scene, KX_Camera* cam) frustum.x1, frustum.x2, frustum.y1, frustum.y2, frustum.camnear, frustum.camfar, focallength); } cam->SetProjectionMatrix(projmat); - + // Otherwise the projection matrix for each eye will be the same... if (!orthographic && m_rasterizer->Stereo()) cam->InvalidateProjectionMatrix(); @@ -1251,7 +1251,7 @@ void KX_KetsjiEngine::RenderFrame(KX_Scene* scene, KX_Camera* cam) MT_Transform camtrans(cam->GetWorldToCamera()); MT_Matrix4x4 viewmat(camtrans); - + m_rasterizer->SetViewMatrix(viewmat, cam->NodeGetWorldOrientation(), cam->NodeGetWorldPosition(), cam->NodeGetLocalScaling(), cam->GetCameraData()->m_perspective); cam->SetModelviewMatrix(viewmat); @@ -1296,7 +1296,7 @@ void KX_KetsjiEngine::PostRenderScene(KX_Scene* scene) // We need to first make sure our viewport is correct (enabling multiple viewports can mess this up) m_canvas->SetViewPort(0, 0, m_canvas->GetWidth(), m_canvas->GetHeight()); - + m_rasterizer->FlushDebugShapes(scene); scene->Render2DFilters(m_canvas); @@ -1337,7 +1337,7 @@ void KX_KetsjiEngine::StopEngine() // Scene Management is able to switch between scenes // and have several scenes running in parallel void KX_KetsjiEngine::AddScene(KX_Scene* scene) -{ +{ m_scenes.push_back(scene); PostProcessScene(scene); } @@ -1362,19 +1362,19 @@ void KX_KetsjiEngine::PostProcessScene(KX_Scene* scene) camdata.m_lens = m_overrideCamLens; camdata.m_clipstart = m_overrideCamNear; camdata.m_clipend = m_overrideCamFar; - + camdata.m_perspective= !m_overrideCamUseOrtho; } activecam = new KX_Camera(scene,KX_Scene::m_callbacks,camdata); activecam->SetName("__default__cam__"); - + // set transformation if (override_camera) { const MT_CmMatrix4x4& cammatdata = m_overrideCamViewMat; MT_Transform trans = MT_Transform(cammatdata.getPointer()); MT_Transform camtrans; camtrans.invert(trans); - + activecam->NodeSetLocalPosition(camtrans.getOrigin()); activecam->NodeSetLocalOrientation(camtrans.getBasis()); activecam->NodeUpdateGS(0); @@ -1391,7 +1391,7 @@ void KX_KetsjiEngine::PostProcessScene(KX_Scene* scene) // done with activecam activecam->Release(); } - + scene->UpdateParents(0.0); } @@ -1409,7 +1409,7 @@ void KX_KetsjiEngine::RenderDebugProperties() int xcoord = 12; // mmmm, these constants were taken from blender source int ycoord = 17; // to 'mimic' behavior - + int profile_indent = 72; float tottime = m_logger->GetAverage(); @@ -1420,7 +1420,7 @@ void KX_KetsjiEngine::RenderDebugProperties() // Set viewport to entire canvas RAS_Rect viewport; m_canvas->SetViewPort(0, 0, int(m_canvas->GetWidth()), int(m_canvas->GetHeight())); - + if (m_show_framerate || m_show_profile) { /* Title for profiling("Profile") */ m_rasterizer->RenderText2D(RAS_IRasterizer::RAS_TEXT_PADDED, @@ -1444,7 +1444,7 @@ void KX_KetsjiEngine::RenderDebugProperties() ycoord, m_canvas->GetWidth() /* RdV, TODO ?? */, m_canvas->GetHeight() /* RdV, TODO ?? */); - + debugtxt.Format("%5.1fms (%.1ffps)", tottime * 1000.0f, 1.0f/tottime); m_rasterizer->RenderText2D(RAS_IRasterizer::RAS_TEXT_PADDED, debugtxt.ReadPtr(), @@ -1507,7 +1507,7 @@ void KX_KetsjiEngine::RenderDebugProperties() KX_Scene* scene = *sceneit; /* the 'normal' debug props */ vector& debugproplist = scene->GetDebugProperties(); - + for (unsigned i=0; i < debugproplist.size() && propsAct < propsMax; i++) { CValue *propobj = debugproplist[i]->m_obj; @@ -1571,8 +1571,8 @@ KX_Scene* KX_KetsjiEngine::FindScene(const STR_String& scenename) { KX_SceneList::iterator sceneit = m_scenes.begin(); - // bit risky :) better to split the second clause - while ( (sceneit != m_scenes.end()) + // bit risky :) better to split the second clause + while ( (sceneit != m_scenes.end()) && ((*sceneit)->GetName() != scenename)) { sceneit++; @@ -1688,7 +1688,7 @@ void KX_KetsjiEngine::AddScheduledScenes() } m_addingOverlayScenes.clear(); } - + if (m_addingBackgroundScenes.size()) { for (scenenameit = m_addingBackgroundScenes.begin(); @@ -1734,7 +1734,7 @@ void KX_KetsjiEngine::ReplaceScheduledScenes() if (m_replace_scenes.size()) { vector >::iterator scenenameit; - + for (scenenameit = m_replace_scenes.begin(); scenenameit != m_replace_scenes.end(); scenenameit++) diff --git a/source/gameengine/Ketsji/KX_KetsjiEngine.h b/source/gameengine/Ketsji/KX_KetsjiEngine.h index 1756214b6dd..ab3a3d013b4 100644 --- a/source/gameengine/Ketsji/KX_KetsjiEngine.h +++ b/source/gameengine/Ketsji/KX_KetsjiEngine.h @@ -104,8 +104,8 @@ private: int m_activecam; bool m_bFixedTime; bool m_useExternalClock; - - + + bool m_firstframe; int m_currentFrame; @@ -135,10 +135,10 @@ private: STR_String m_exitstring; float m_cameraZoom; - + bool m_overrideCam; STR_String m_overrideSceneName; - + bool m_overrideCamUseOrtho; MT_CmMatrix4x4 m_overrideCamProjMat; MT_CmMatrix4x4 m_overrideCamViewMat; @@ -169,7 +169,7 @@ private: /** Time logger. */ KX_TimeCategoryLogger* m_logger; - + /** Labels for profiling display. */ static const char m_profileLabels[tc_numCategories][15]; /** Last estimated framerate */ @@ -244,7 +244,7 @@ public: TaskScheduler* GetTaskScheduler() { return m_taskscheduler; } /// Dome functions - void InitDome(short res, short mode, short angle, float resbuf, short tilt, struct Text* text); + void InitDome(short res, short mode, short angle, float resbuf, short tilt, struct Text* text); void EndDome(); void RenderDome(); bool m_usedome; @@ -253,7 +253,7 @@ public: bool NextFrame(); void Render(); void RenderShadowBuffers(KX_Scene *scene); - + void StartEngine(bool clearIpo); void StopEngine(); void Export(const STR_String& filename); @@ -277,9 +277,9 @@ public: /// Sets zoom for camera objects, useful only with extend and scale framing mode. void SetCameraZoom(float camzoom); - + void EnableCameraOverride(const STR_String& forscene); - + void SetCameraOverrideUseOrtho(bool useOrtho); void SetCameraOverrideProjectionMatrix(const MT_CmMatrix4x4& mat); void SetCameraOverrideViewMatrix(const MT_CmMatrix4x4& mat); @@ -290,17 +290,17 @@ public: // Update animations for object in this scene void UpdateAnimations(KX_Scene *scene); - + /** * Sets display of all frames. * \param bUseFixedTime New setting for display all frames. - */ + */ void SetUseFixedTime(bool bUseFixedTime); /** * Returns display of all frames. * \return Current setting for display all frames. - */ + */ bool GetUseFixedTime(void) const; /** @@ -391,7 +391,7 @@ public: static double GetAverageFrameRate(); /** - * Gets the time scale multiplier + * Gets the time scale multiplier */ double GetTimeScale() const; @@ -459,7 +459,7 @@ public: * \param frameRate Display for frame rate on or off. * \param profile Display for individual components on or off. * \param properties Display of scene object debug properties on or off. - */ + */ void SetTimingDisplay(bool frameRate, bool profile, bool properties); /** @@ -467,33 +467,33 @@ public: * \param frameRate Display for frame rate on or off. * \param profile Display for individual components on or off. * \param properties Display of scene object debug properties on or off. - */ + */ void GetTimingDisplay(bool& frameRate, bool& profile, bool& properties) const; - /** + /** * Sets cursor hiding on every frame. * \param hideCursor Turns hiding on or off. */ void SetHideCursor(bool hideCursor); - /** + /** * Returns the current setting for cursor hiding. * \return The current setting for cursor hiding. */ bool GetHideCursor(void) const; - /** + /** * Enables/disables the use of the framing bar color of the Blender file's scenes. * \param overrideFrameColor The new setting. */ void SetUseOverrideFrameColor(bool overrideFrameColor); - /** + /** * Check if the frame color is being overridden. */ - bool GetUseOverrideFrameColor(void) const; + bool GetUseOverrideFrameColor(void) const; - /** + /** * Set the color used for framing bar color instead of the one in the Blender file's scenes. * \param r Red component of the override color. * \param g Green component of the override color. @@ -501,7 +501,7 @@ public: */ void SetOverrideFrameColor(float r, float g, float b, float a); - /** + /** * Returns the color used for framing bar color instead of the one in the Blender file's scenes. * \param r Red component of the override color. * \param g Green component of the override color. @@ -539,12 +539,12 @@ protected: void AddScheduledScenes(void); void ReplaceScheduledScenes(void); void PostProcessScene(class KX_Scene* scene); - + bool BeginFrame(); void ClearFrame(); void EndFrame(); - - + + #ifdef WITH_CXX_GUARDEDALLOC MEM_CXX_CLASS_ALLOC_FUNCS("GE:KX_KetsjiEngine") #endif diff --git a/source/gameengine/Ketsji/KX_Light.cpp b/source/gameengine/Ketsji/KX_Light.cpp index 5f490747c2b..cdef0f458d7 100644 --- a/source/gameengine/Ketsji/KX_Light.cpp +++ b/source/gameengine/Ketsji/KX_Light.cpp @@ -89,7 +89,7 @@ CValue* KX_LightObject::GetReplica() KX_LightObject* replica = new KX_LightObject(*this); replica->ProcessReplica(); - + replica->m_lightobj = m_lightobj->Clone(); replica->m_lightobj->m_light = replica; m_rasterizer->AddLight(replica->m_lightobj); @@ -470,7 +470,7 @@ int KX_LightObject::pyattr_set_type(void* self_v, const KX_PYATTRIBUTE_DEF *attr PyErr_SetString(PyExc_ValueError, "light.type= val: KX_LightObject, expected an int between 0 and 2"); return PY_SET_ATTR_FAIL; } - + switch (val) { case 0: self->m_lightobj->m_type = self->m_lightobj->LIGHT_SPOT; diff --git a/source/gameengine/Ketsji/KX_Light.h b/source/gameengine/Ketsji/KX_Light.h index b446acd6e63..21c68cb9317 100644 --- a/source/gameengine/Ketsji/KX_Light.h +++ b/source/gameengine/Ketsji/KX_Light.h @@ -58,7 +58,7 @@ public: virtual ~KX_LightObject(); virtual CValue* GetReplica(); RAS_ILightObject* GetLightData() { return m_lightobj;} - + void UpdateScene(class KX_Scene *kxscene); virtual void SetLayer(int layer); diff --git a/source/gameengine/Ketsji/KX_LightIpoSGController.cpp b/source/gameengine/Ketsji/KX_LightIpoSGController.cpp index 6b641f7a63f..70efa9b50c1 100644 --- a/source/gameengine/Ketsji/KX_LightIpoSGController.cpp +++ b/source/gameengine/Ketsji/KX_LightIpoSGController.cpp @@ -49,13 +49,13 @@ bool KX_LightIpoSGController::Update(double currentTime) for (i = m_interpolators.begin(); !(i == m_interpolators.end()); ++i) { (*i)->Execute(m_ipotime);//currentTime); } - + RAS_ILightObject *lightobj; SG_Spatial* ob = (SG_Spatial*)m_pObject; KX_LightObject* kxlight = (KX_LightObject*) ob->GetSGClientObject(); lightobj = kxlight->GetLightData(); - //lightobj = (KX_Light*) + //lightobj = (KX_Light*) if (m_modify_energy) { lightobj->m_energy = m_energy; @@ -107,7 +107,7 @@ SG_Controller* KX_LightIpoSGController::GetReplica(class SG_Node* destnode) MT_Scalar* blaptr = (MT_Scalar*) newaddrbase; copyipo->SetNewTarget((MT_Scalar*)blaptr); } - + return iporeplica; } @@ -118,5 +118,5 @@ KX_LightIpoSGController::~KX_LightIpoSGController() for (i = m_interpolators.begin(); !(i == m_interpolators.end()); ++i) { delete (*i); } - + } diff --git a/source/gameengine/Ketsji/KX_LightIpoSGController.h b/source/gameengine/Ketsji/KX_LightIpoSGController.h index 151ced6b8f8..151dfcd5abd 100644 --- a/source/gameengine/Ketsji/KX_LightIpoSGController.h +++ b/source/gameengine/Ketsji/KX_LightIpoSGController.h @@ -55,7 +55,7 @@ private: double m_ipotime; public: - KX_LightIpoSGController() : + KX_LightIpoSGController() : m_modify_energy(false), m_modify_color(false), m_modify_dist(false), @@ -68,7 +68,7 @@ public: virtual SG_Controller* GetReplica(class SG_Node* destnode); virtual bool Update(double time); - + virtual void SetSimulatedTime(double time) { m_ipotime = time; m_modified = true; @@ -95,8 +95,8 @@ public: }; void AddInterpolator(KX_IInterpolator* interp); - - + + #ifdef WITH_CXX_GUARDEDALLOC MEM_CXX_CLASS_ALLOC_FUNCS("GE:KX_LightIpoSGController") #endif diff --git a/source/gameengine/Ketsji/KX_MaterialIpoController.cpp b/source/gameengine/Ketsji/KX_MaterialIpoController.cpp index 1faf8f17d54..0581ffdb1cc 100644 --- a/source/gameengine/Ketsji/KX_MaterialIpoController.cpp +++ b/source/gameengine/Ketsji/KX_MaterialIpoController.cpp @@ -36,19 +36,19 @@ bool KX_MaterialIpoController::Update(double currentTime) for (i = m_interpolators.begin(); !(i == m_interpolators.end()); ++i) { (*i)->Execute(m_ipotime); } - + SG_Spatial* ob = (SG_Spatial*)m_pObject; KX_GameObject* kxgameobj= (KX_GameObject*) ob->GetSGClientObject(); //kxgameobj->SetObjectColor(m_rgba); - kxgameobj->UpdateMaterialData( + kxgameobj->UpdateMaterialData( m_matname_hash, - m_rgba, - m_specrgb, - m_hard, - m_spec, - m_ref, + m_rgba, + m_specrgb, + m_hard, + m_spec, + m_ref, m_emit, m_alpha ); @@ -89,7 +89,7 @@ SG_Controller* KX_MaterialIpoController::GetReplica(class SG_Node* destnode) MT_Scalar* blaptr = (MT_Scalar*) newaddrbase; copyipo->SetNewTarget((MT_Scalar*)blaptr); } - + return iporeplica; } @@ -100,6 +100,6 @@ KX_MaterialIpoController::~KX_MaterialIpoController() for (i = m_interpolators.begin(); !(i == m_interpolators.end()); ++i) { delete (*i); } - + } diff --git a/source/gameengine/Ketsji/KX_MaterialIpoController.h b/source/gameengine/Ketsji/KX_MaterialIpoController.h index a7e9c2cc1c5..ca5d1040da2 100644 --- a/source/gameengine/Ketsji/KX_MaterialIpoController.h +++ b/source/gameengine/Ketsji/KX_MaterialIpoController.h @@ -32,7 +32,7 @@ private: double m_ipotime; dword m_matname_hash; public: - KX_MaterialIpoController(dword matname_hash) : + KX_MaterialIpoController(dword matname_hash) : m_modified(true), m_ipotime(0.0), m_matname_hash(matname_hash) @@ -44,7 +44,7 @@ public: m_ipotime = time; m_modified = true; } - + void SetOption( int option, diff --git a/source/gameengine/Ketsji/KX_MeshProxy.cpp b/source/gameengine/Ketsji/KX_MeshProxy.cpp index 8da3542b4d6..ceec7fbb07a 100644 --- a/source/gameengine/Ketsji/KX_MeshProxy.cpp +++ b/source/gameengine/Ketsji/KX_MeshProxy.cpp @@ -45,7 +45,7 @@ #include "SCA_LogicManager.h" -#include "EXP_PyObjectPlus.h" +#include "EXP_PyObjectPlus.h" PyTypeObject KX_MeshProxy::Type = { PyVarObject_HEAD_INIT(NULL, 0) @@ -150,7 +150,7 @@ PyObject *KX_MeshProxy::PyGetTextureName(PyObject *args, PyObject *kwds) } return PyUnicode_From_STR_String(matname); - + } PyObject *KX_MeshProxy::PyGetVertexArrayLength(PyObject *args, PyObject *kwds) @@ -158,20 +158,20 @@ PyObject *KX_MeshProxy::PyGetVertexArrayLength(PyObject *args, PyObject *kwds) int matid= 0; int length = 0; - + if (!PyArg_ParseTuple(args,"i:getVertexArrayLength",&matid)) return NULL; - + RAS_MeshMaterial *mmat = m_meshobj->GetMeshMaterial(matid); /* can be NULL*/ - + if (mmat) { RAS_IPolyMaterial* mat = mmat->m_bucket->GetPolyMaterial(); if (mat) length = m_meshobj->NumVertices(mat); } - + return PyLong_FromLong(length); } @@ -183,14 +183,14 @@ PyObject *KX_MeshProxy::PyGetVertex(PyObject *args, PyObject *kwds) if (!PyArg_ParseTuple(args,"ii:getVertex",&matindex,&vertexindex)) return NULL; - + RAS_TexVert* vertex = m_meshobj->GetVertex(matindex,vertexindex); - + if (vertex==NULL) { PyErr_SetString(PyExc_ValueError, "mesh.getVertex(mat_idx, vert_idx): KX_MeshProxy, could not get a vertex at the given indices"); return NULL; } - + return (new KX_VertexProxy(this, vertex))->NewProxy(true); } @@ -201,13 +201,13 @@ PyObject *KX_MeshProxy::PyGetPolygon(PyObject *args, PyObject *kwds) if (!PyArg_ParseTuple(args,"i:getPolygon",&polyindex)) return NULL; - + if (polyindex<0 || polyindex >= m_meshobj->NumPolygons()) { PyErr_SetString(PyExc_AttributeError, "mesh.getPolygon(int): KX_MeshProxy, invalid polygon index"); return NULL; } - + RAS_Polygon* polygon = m_meshobj->GetPolygon(polyindex); if (polygon) @@ -377,15 +377,15 @@ PyObject *KX_MeshProxy::PyTransformUV(PyObject *args, PyObject *kwds) PyObject *KX_MeshProxy::pyattr_get_materials(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) { KX_MeshProxy* self = static_cast(self_v); - + int tot= self->m_meshobj->NumMaterials(); int i; - + PyObject *materials = PyList_New( tot ); - + list::iterator mit= self->m_meshobj->GetFirstMaterial(); - - + + for (i=0; im_bucket->GetPolyMaterial(); KX_BlenderMaterial *mat = static_cast(polymat); @@ -414,10 +414,10 @@ bool ConvertPythonToMesh(SCA_LogicManager *logicmgr, PyObject *value, RAS_MeshOb *object = NULL; return false; } - + if (value==Py_None) { *object = NULL; - + if (py_none_ok) { return true; } else { @@ -425,10 +425,10 @@ bool ConvertPythonToMesh(SCA_LogicManager *logicmgr, PyObject *value, RAS_MeshOb return false; } } - + if (PyUnicode_Check(value)) { *object = (RAS_MeshObject*)logicmgr->GetMeshByName(STR_String( _PyUnicode_AsString(value) )); - + if (*object) { return true; } else { @@ -436,28 +436,28 @@ bool ConvertPythonToMesh(SCA_LogicManager *logicmgr, PyObject *value, RAS_MeshOb return false; } } - + if (PyObject_TypeCheck(value, &KX_MeshProxy::Type)) { KX_MeshProxy *kx_mesh = static_castBGE_PROXY_REF(value); - + /* sets the error */ if (kx_mesh==NULL) { PyErr_Format(PyExc_SystemError, "%s, " BGE_PROXY_ERROR_MSG, error_prefix); return false; } - + *object = kx_mesh->GetMesh(); return true; } - + *object = NULL; - + if (py_none_ok) { PyErr_Format(PyExc_TypeError, "%s, expect a KX_MeshProxy, a string or None", error_prefix); } else { PyErr_Format(PyExc_TypeError, "%s, expect a KX_MeshProxy or a string", error_prefix); } - + return false; } diff --git a/source/gameengine/Ketsji/KX_MeshProxy.h b/source/gameengine/Ketsji/KX_MeshProxy.h index dbd7987f785..f634834a2b6 100644 --- a/source/gameengine/Ketsji/KX_MeshProxy.h +++ b/source/gameengine/Ketsji/KX_MeshProxy.h @@ -67,14 +67,14 @@ public: KX_PYMETHOD(KX_MeshProxy,GetMaterialName); KX_PYMETHOD(KX_MeshProxy,GetTextureName); KX_PYMETHOD_NOARGS(KX_MeshProxy,GetNumPolygons); // Deprecated - + // both take materialid (int) KX_PYMETHOD(KX_MeshProxy,GetVertexArrayLength); KX_PYMETHOD(KX_MeshProxy,GetVertex); KX_PYMETHOD(KX_MeshProxy,GetPolygon); KX_PYMETHOD(KX_MeshProxy,Transform); KX_PYMETHOD(KX_MeshProxy,TransformUV); - + static PyObject *pyattr_get_materials(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); static PyObject *pyattr_get_numMaterials(void *self, const KX_PYATTRIBUTE_DEF * attrdef); static PyObject *pyattr_get_numPolygons(void *self, const KX_PYATTRIBUTE_DEF * attrdef); diff --git a/source/gameengine/Ketsji/KX_MotionState.cpp b/source/gameengine/Ketsji/KX_MotionState.cpp index 4728f71a6ea..38c10c1ed83 100644 --- a/source/gameengine/Ketsji/KX_MotionState.cpp +++ b/source/gameengine/Ketsji/KX_MotionState.cpp @@ -65,18 +65,18 @@ void KX_MotionState::GetWorldOrientation(float& quatIma0,float& quatIma1,float& quatIma2 = orn[2]; quatReal = orn[3]; } - + void KX_MotionState::GetWorldOrientation(float* ori) { const MT_Matrix3x3& mat = m_node->GetWorldOrientation(); mat.getValue(ori); } - + void KX_MotionState::SetWorldOrientation(const float* ori) { m_node->SetLocalOrientation(ori); } - + void KX_MotionState::SetWorldPosition(float posX,float posY,float posZ) { m_node->SetLocalPosition(MT_Point3(posX,posY,posZ)); @@ -103,4 +103,4 @@ void KX_MotionState::CalculateWorldTransformations() //m_node->ComputeWorldTransforms(NULL, parentUpdated); } - + diff --git a/source/gameengine/Ketsji/KX_MouseFocusSensor.cpp b/source/gameengine/Ketsji/KX_MouseFocusSensor.cpp index 451078d4a36..ff7ed3bd647 100644 --- a/source/gameengine/Ketsji/KX_MouseFocusSensor.cpp +++ b/source/gameengine/Ketsji/KX_MouseFocusSensor.cpp @@ -60,7 +60,7 @@ /* Native functions */ /* ------------------------------------------------------------------------- */ -KX_MouseFocusSensor::KX_MouseFocusSensor(SCA_MouseManager* eventmgr, +KX_MouseFocusSensor::KX_MouseFocusSensor(SCA_MouseManager* eventmgr, int startx, int starty, short int mousemode, @@ -91,7 +91,7 @@ void KX_MouseFocusSensor::Init() m_hitObject = 0; m_hitObject_Last = NULL; m_reset = true; - + m_hitPosition.setValue(0,0,0); m_prevTargetPoint.setValue(0,0,0); m_prevSourcePoint.setValue(0,0,0); @@ -110,12 +110,12 @@ bool KX_MouseFocusSensor::Evaluate() /* Focus behavior required. Test mouse-on. The rest is * equivalent to handling a key. */ obHasFocus = ParentObjectHasFocus(); - + if (!obHasFocus) { m_positive_event = false; if (m_mouse_over_in_previous_frame) { result = true; - } + } } else { m_positive_event = true; if (!m_mouse_over_in_previous_frame) { @@ -124,7 +124,7 @@ bool KX_MouseFocusSensor::Evaluate() else if (m_bTouchPulse && (m_hitObject != m_hitObject_Last)) { result = true; } - } + } if (reset) { // force an event result = true; @@ -140,14 +140,14 @@ bool KX_MouseFocusSensor::Evaluate() m_mouse_over_in_previous_frame = obHasFocus; m_hitObject_Last = (void *)m_hitObject; - + return result; } bool KX_MouseFocusSensor::RayHit(KX_ClientObjectInfo *client_info, KX_RayCast *result, void *UNUSED(data)) { KX_GameObject* hitKXObj = client_info->m_gameobject; - + /* Is this me? In the ray test, there are a lot of extra checks * for aliasing artifacts from self-hits. That doesn't happen * here, so a simple test suffices. Or does the camera also get @@ -188,9 +188,9 @@ bool KX_MouseFocusSensor::RayHit(KX_ClientObjectInfo *client_info, KX_RayCast *r m_hitNormal = result->m_hitNormal; m_hitUV = result->m_hitUV; return true; - } + } } - + return true; // object must be visible to trigger //return false; // occluded objects can trigger } @@ -238,7 +238,7 @@ bool KX_MouseFocusSensor::ParentObjectHasFocusCamera(KX_Camera *cam) { /* All screen handling in the gameengine is done by GL, * specifically the model/view and projection parts. The viewport - * part is in the creator. + * part is in the creator. * * The theory is this: * WCS - world coordinates @@ -262,13 +262,13 @@ bool KX_MouseFocusSensor::ParentObjectHasFocusCamera(KX_Camera *cam) * Inverting (blender y is flipped!): * * xn = 2(xwin - x_lb)/width - 1.0 - * yn = 2(ywin - y_lb)/height - 1.0 + * yn = 2(ywin - y_lb)/height - 1.0 * = 2(height - y_blender - y_lb)/height - 1.0 * = 1.0 - 2(y_blender - y_lb)/height * * */ - - + + /* Because we don't want to worry about resize events, camera * changes and all that crap, we just determine this over and * over. Stop whining. We have lots of other calculations to do @@ -276,12 +276,12 @@ bool KX_MouseFocusSensor::ParentObjectHasFocusCamera(KX_Camera *cam) * canvas, the test is irrelevant. The 1.0 makes sure the * calculations don't bomb. Maybe we should explicitly guard for * division by 0.0...*/ - + RAS_Rect area, viewport; short m_y_inv = m_kxengine->GetCanvas()->GetHeight()-m_y; - + m_kxengine->GetSceneViewport(m_kxscene, cam, area, viewport); - + /* Check if the mouse is in the viewport */ if (( m_x < viewport.m_x2 && // less than right m_x > viewport.m_x1 && // more than then left @@ -293,37 +293,37 @@ bool KX_MouseFocusSensor::ParentObjectHasFocusCamera(KX_Camera *cam) float height = float(viewport.m_y2 - viewport.m_y1 + 1); float width = float(viewport.m_x2 - viewport.m_x1 + 1); - + float x_lb = float(viewport.m_x1); float y_lb = float(viewport.m_y1); MT_Vector4 frompoint; MT_Vector4 topoint; - + /* m_y_inv - inverting for a bounds check is only part of it, now make relative to view bounds */ m_y_inv = (viewport.m_y2 - m_y_inv) + viewport.m_y1; - - + + /* There's some strangeness I don't fully get here... These values * _should_ be wrong! - see from point Z values */ - - - /* build the from and to point in normalized device coordinates + + + /* build the from and to point in normalized device coordinates * Normalized device coordinates are [-1,1] in x, y, z * - * The actual z coordinates used don't have to be exact just infront and + * The actual z coordinates used don't have to be exact just infront and * behind of the near and far clip planes. - */ + */ frompoint.setValue( (2 * (m_x-x_lb) / width) - 1.0f, 1.0f - (2 * (m_y_inv - y_lb) / height), -1.0f, 1.0f ); - + topoint.setValue( (2 * (m_x-x_lb) / width) - 1.0f, 1.0f - (2 * (m_y_inv-y_lb) / height), 1.0f, 1.0f ); - + /* camera to world */ MT_Matrix4x4 camcs_wcs_matrix = MT_Matrix4x4(cam->GetCameraToWorld()); @@ -339,16 +339,16 @@ bool KX_MouseFocusSensor::ParentObjectHasFocusCamera(KX_Camera *cam) * clipend = - (topoint[2] / topoint[3]) */ frompoint = camcs_wcs_matrix * frompoint; topoint = camcs_wcs_matrix * topoint; - + /* from hom wcs to 3d wcs: */ m_prevSourcePoint.setValue( frompoint[0]/frompoint[3], frompoint[1]/frompoint[3], - frompoint[2]/frompoint[3]); - + frompoint[2]/frompoint[3]); + m_prevTargetPoint.setValue( topoint[0]/topoint[3], topoint[1]/topoint[3], - topoint[2]/topoint[3]); - + topoint[2]/topoint[3]); + /* 2. Get the object from PhysicsEnvironment */ /* Shoot! Beware that the first argument here is an * ignore-object. We don't ignore anything... */ @@ -357,12 +357,12 @@ bool KX_MouseFocusSensor::ParentObjectHasFocusCamera(KX_Camera *cam) // get UV mapping KX_RayCast::Callback callback(this,physics_controller,NULL,false,true); - + KX_RayCast::RayTest(physics_environment, m_prevSourcePoint, m_prevTargetPoint, callback); - + if (m_hitObject) return true; - + return false; } @@ -371,23 +371,23 @@ bool KX_MouseFocusSensor::ParentObjectHasFocus() m_hitObject = 0; m_hitPosition.setValue(0,0,0); m_hitNormal.setValue(1,0,0); - + KX_Camera *cam= m_kxscene->GetActiveCamera(); - + if (ParentObjectHasFocusCamera(cam)) return true; list* cameras = m_kxscene->GetCameras(); list::iterator it = cameras->begin(); - + while (it != cameras->end()) { if (((*it) != cam) && (*it)->GetViewport()) if (ParentObjectHasFocusCamera(*it)) return true; - + it++; } - + return false; } @@ -489,10 +489,10 @@ PyObject *KX_MouseFocusSensor::pyattr_get_ray_direction(void *self_v, const KX_P PyObject *KX_MouseFocusSensor::pyattr_get_hit_object(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) { KX_MouseFocusSensor* self = static_cast(self_v); - + if (self->m_hitObject) return self->m_hitObject->GetProxy(); - + Py_RETURN_NONE; } diff --git a/source/gameengine/Ketsji/KX_MouseFocusSensor.h b/source/gameengine/Ketsji/KX_MouseFocusSensor.h index dd9295b2ff4..9437a0f3432 100644 --- a/source/gameengine/Ketsji/KX_MouseFocusSensor.h +++ b/source/gameengine/Ketsji/KX_MouseFocusSensor.h @@ -50,9 +50,9 @@ class KX_MouseFocusSensor : public SCA_MouseSensor { Py_Header - + public: - + KX_MouseFocusSensor(class SCA_MouseManager* eventmgr, int startx, int starty, @@ -81,7 +81,7 @@ class KX_MouseFocusSensor : public SCA_MouseSensor /** - * \attention Overrides default evaluate. + * \attention Overrides default evaluate. */ virtual bool Evaluate(); virtual void Init(); @@ -96,13 +96,13 @@ class KX_MouseFocusSensor : public SCA_MouseSensor bool RayHit(KX_ClientObjectInfo *client, KX_RayCast *result, void *UNUSED(data)); /// \see KX_RayCast bool NeedRayCast(KX_ClientObjectInfo *client, void *UNUSED(data)); - + const MT_Point3& RaySource() const; const MT_Point3& RayTarget() const; const MT_Point3& HitPosition() const; const MT_Vector3& HitNormal() const; const MT_Vector2& HitUV() const; - + #ifdef WITH_PYTHON /* --------------------------------------------------------------------- */ @@ -117,7 +117,7 @@ class KX_MouseFocusSensor : public SCA_MouseSensor static PyObject* pyattr_get_hit_position(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef); static PyObject* pyattr_get_hit_normal(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef); static PyObject* pyattr_get_hit_uv(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef); - + #endif /* WITH_PYTHON */ /* --------------------------------------------------------------------- */ @@ -139,7 +139,7 @@ class KX_MouseFocusSensor : public SCA_MouseSensor * Flags whether changes in hit object should trigger a pulse */ bool m_bTouchPulse; - + /** * Flags get through other objects */ @@ -164,7 +164,7 @@ class KX_MouseFocusSensor : public SCA_MouseSensor * Tests whether the object is in mouse focus for this camera */ bool ParentObjectHasFocusCamera(KX_Camera *cam); - + /** * Tests whether the object is in mouse focus in this scene. */ diff --git a/source/gameengine/Ketsji/KX_NavMeshObject.cpp b/source/gameengine/Ketsji/KX_NavMeshObject.cpp index 5beda2e038a..a5feb95b00b 100644 --- a/source/gameengine/Ketsji/KX_NavMeshObject.cpp +++ b/source/gameengine/Ketsji/KX_NavMeshObject.cpp @@ -78,7 +78,7 @@ KX_NavMeshObject::KX_NavMeshObject(void* sgReplicationInfo, SG_Callbacks callbac : KX_GameObject(sgReplicationInfo, callbacks) , m_navMesh(NULL) { - + } KX_NavMeshObject::~KX_NavMeshObject() @@ -110,7 +110,7 @@ void KX_NavMeshObject::ProcessReplica() bool KX_NavMeshObject::BuildVertIndArrays(float *&vertices, int& nverts, unsigned short* &polys, int& npolys, unsigned short *&dmeshes, - float *&dvertices, int &ndvertsuniq, unsigned short *&dtris, + float *&dvertices, int &ndvertsuniq, unsigned short *&dtris, int& ndtris, int &vertsPerPoly) { DerivedMesh* dm = mesh_create_derived_no_virtual(GetScene()->GetBlenderScene(), GetBlenderObject(), @@ -278,7 +278,7 @@ bool KX_NavMeshObject::BuildVertIndArrays(float *&vertices, int& nverts, ndtris = npolys; } dm->release(dm); - + return true; } @@ -301,8 +301,8 @@ bool KX_NavMeshObject::BuildNavMesh() unsigned short *polys = NULL, *dtris = NULL, *dmeshes = NULL; int nverts = 0, npolys = 0, ndvertsuniq = 0, ndtris = 0; int vertsPerPoly = 0; - if (!BuildVertIndArrays(vertices, nverts, polys, npolys, - dmeshes, dvertices, ndvertsuniq, dtris, ndtris, vertsPerPoly ) + if (!BuildVertIndArrays(vertices, nverts, polys, npolys, + dmeshes, dvertices, ndvertsuniq, dtris, ndtris, vertsPerPoly ) || vertsPerPoly<3) { printf("Can't build navigation mesh data for object:%s\n", m_name.ReadPtr()); @@ -314,7 +314,7 @@ bool KX_NavMeshObject::BuildNavMesh() } return false; } - + MT_Point3 pos; if (dmeshes==NULL) { @@ -333,7 +333,7 @@ bool KX_NavMeshObject::BuildNavMesh() delete[] vertices; return false; } - + float cs = 0.2f; if (!nverts || !npolys) @@ -424,8 +424,8 @@ bool KX_NavMeshObject::BuildNavMesh() header->nnodes = createBVTree(vertsi, nverts, polys, npolys, vertsPerPoly, cs, cs, npolys*2, navNodes); - - + + if (dmeshes==NULL) { //create fake detail meshes @@ -496,18 +496,18 @@ void KX_NavMeshObject::DrawNavMesh(NavMeshRenderMode renderMode) if (!m_navMesh) return; MT_Vector3 color(0.f, 0.f, 0.f); - + switch (renderMode) { case RM_POLYS : - case RM_WALLS : + case RM_WALLS : for (int pi=0; pigetPolyCount(); pi++) { const dtStatPoly* poly = m_navMesh->getPoly(pi); for (int i = 0, j = (int)poly->nv-1; i < (int)poly->nv; j = i++) { - if (poly->n[j] && renderMode==RM_WALLS) + if (poly->n[j] && renderMode==RM_WALLS) continue; const float* vif = m_navMesh->getVertex(poly->v[i]); const float* vjf = m_navMesh->getVertex(poly->v[j]); @@ -519,7 +519,7 @@ void KX_NavMeshObject::DrawNavMesh(NavMeshRenderMode renderMode) } } break; - case RM_TRIS : + case RM_TRIS : for (int i = 0; i < m_navMesh->getPolyDetailCount(); ++i) { const dtStatPoly* p = m_navMesh->getPoly(i); @@ -561,7 +561,7 @@ MT_Point3 KX_NavMeshObject::TransformToLocalCoords(const MT_Point3& wpos) MT_Matrix3x3 orientation = NodeGetWorldOrientation(); const MT_Vector3& scaling = NodeGetWorldScaling(); orientation.scale(scaling[0], scaling[1], scaling[2]); - MT_Transform worldtr(NodeGetWorldPosition(), orientation); + MT_Transform worldtr(NodeGetWorldPosition(), orientation); MT_Transform invworldtr; invworldtr.invert(worldtr); MT_Point3 lpos = invworldtr(wpos); @@ -573,7 +573,7 @@ MT_Point3 KX_NavMeshObject::TransformToWorldCoords(const MT_Point3& lpos) MT_Matrix3x3 orientation = NodeGetWorldOrientation(); const MT_Vector3& scaling = NodeGetWorldScaling(); orientation.scale(scaling[0], scaling[1], scaling[2]); - MT_Transform worldtr(NodeGetWorldPosition(), orientation); + MT_Transform worldtr(NodeGetWorldPosition(), orientation); MT_Point3 wpos = worldtr(lpos); return wpos; } @@ -694,7 +694,7 @@ KX_PYMETHODDEF_DOC(KX_NavMeshObject, findPath, MT_Point3 from, to; if (!PyVecTo(ob_from, from) || !PyVecTo(ob_to, to)) return NULL; - + float path[MAX_PATH_LEN*3]; int pathLen = FindPath(from, to, path, MAX_PATH_LEN); PyObject *pathList = PyList_New( pathLen ); diff --git a/source/gameengine/Ketsji/KX_NavMeshObject.h b/source/gameengine/Ketsji/KX_NavMeshObject.h index af178f9aaee..0f0bf8008d0 100644 --- a/source/gameengine/Ketsji/KX_NavMeshObject.h +++ b/source/gameengine/Ketsji/KX_NavMeshObject.h @@ -40,12 +40,12 @@ class KX_NavMeshObject: public KX_GameObject protected: dtStatNavMesh* m_navMesh; - + bool BuildVertIndArrays(float *&vertices, int& nverts, - unsigned short* &polys, int& npolys, unsigned short *&dmeshes, - float *&dvertices, int &ndvertsuniq, unsigned short* &dtris, + unsigned short* &polys, int& npolys, unsigned short *&dmeshes, + float *&dvertices, int &ndvertsuniq, unsigned short* &dtris, int& ndtris, int &vertsPerPoly); - + public: KX_NavMeshObject(void* sgReplicationInfo, SG_Callbacks callbacks); ~KX_NavMeshObject(); diff --git a/source/gameengine/Ketsji/KX_NearSensor.cpp b/source/gameengine/Ketsji/KX_NearSensor.cpp index 92ab8f412d9..c436c77c32b 100644 --- a/source/gameengine/Ketsji/KX_NearSensor.cpp +++ b/source/gameengine/Ketsji/KX_NearSensor.cpp @@ -62,7 +62,7 @@ KX_NearSensor::KX_NearSensor(SCA_EventManager* eventmgr, gameobj->getClientInfo()->m_sensors.remove(this); m_client_info = new KX_ClientObjectInfo(gameobj, KX_ClientObjectInfo::SENSOR); m_client_info->m_sensors.push_back(this); - + //DT_ShapeHandle shape = (DT_ShapeHandle) vshape; m_physCtrl = ctrl; if (m_physCtrl) @@ -75,7 +75,7 @@ KX_NearSensor::KX_NearSensor(SCA_EventManager* eventmgr, void KX_NearSensor::SynchronizeTransform() { - // The near and radar sensors are using a different physical object which is + // The near and radar sensors are using a different physical object which is // not linked to the parent object, must synchronize it. if (m_physCtrl) { @@ -100,9 +100,9 @@ CValue* KX_NearSensor::GetReplica() void KX_NearSensor::ProcessReplica() { KX_TouchSensor::ProcessReplica(); - + m_client_info = new KX_ClientObjectInfo(m_client_info->m_gameobject, KX_ClientObjectInfo::SENSOR); - + if (m_physCtrl) { m_physCtrl = m_physCtrl->GetReplicaForSensors(); @@ -112,14 +112,14 @@ void KX_NearSensor::ProcessReplica() m_physCtrl->SetMargin(m_Margin); m_physCtrl->SetNewClientInfo(m_client_info); } - + } } void KX_NearSensor::ReParent(SCA_IObject* parent) { SCA_ISensor::ReParent(parent); - m_client_info->m_gameobject = static_cast(parent); + m_client_info->m_gameobject = static_cast(parent); m_client_info->m_sensors.push_back(this); //Synchronize here with the actual parent. SynchronizeTransform(); @@ -137,8 +137,8 @@ KX_NearSensor::~KX_NearSensor() delete m_physCtrl; m_physCtrl = NULL; } - - + + if (m_client_info) delete m_client_info; } @@ -168,9 +168,9 @@ bool KX_NearSensor::Evaluate() if (m_bTriggered != m_bLastTriggered) { m_bLastTriggered = m_bTriggered; - + SetPhysCtrlRadius(); - + result = true; } @@ -183,21 +183,21 @@ bool KX_NearSensor::Evaluate() bool KX_NearSensor::BroadPhaseFilterCollision(void*obj1,void*obj2) { KX_GameObject* parent = static_cast(GetParent()); - + // need the mapping from PHY_IPhysicsController to gameobjects now assert(obj1==m_physCtrl && obj2); KX_ClientObjectInfo *client_info = static_cast((static_cast(obj2))->GetNewClientInfo()); - KX_GameObject* gameobj = ( client_info ? + KX_GameObject* gameobj = ( client_info ? client_info->m_gameobject : NULL); - + if (gameobj && (gameobj != parent)) { // only take valid colliders if (client_info->m_type == KX_ClientObjectInfo::ACTOR) { - if ((m_touchedpropname.Length() == 0) || + if ((m_touchedpropname.Length() == 0) || (gameobj->GetProperty(m_touchedpropname))) { return true; @@ -212,18 +212,18 @@ bool KX_NearSensor::NewHandleCollision(void *obj1, void *obj2, const PHY_CollDat { // KX_TouchEventManager* toucheventmgr = static_cast(m_eventmgr); // KX_GameObject* parent = static_cast(GetParent()); - + // need the mapping from PHY_IPhysicsController to gameobjects now - + KX_ClientObjectInfo *client_info = static_cast (obj1 == m_physCtrl? ((PHY_IPhysicsController*)obj2)->GetNewClientInfo() : ((PHY_IPhysicsController*)obj1)->GetNewClientInfo()); - KX_GameObject* gameobj = ( client_info ? + KX_GameObject* gameobj = ( client_info ? client_info->m_gameobject : NULL); - - // Add the same check as in SCA_ISensor::Activate(), + + // Add the same check as in SCA_ISensor::Activate(), // we don't want to record collision when the sensor is not active. if (m_links && !m_suspended && gameobj /* done in BroadPhaseFilterCollision() && (gameobj != parent)*/) @@ -234,7 +234,7 @@ bool KX_NearSensor::NewHandleCollision(void *obj1, void *obj2, const PHY_CollDat // These checks are done already in BroadPhaseFilterCollision() //if (client_info->m_type == KX_ClientObjectInfo::ACTOR) //{ - // if ((m_touchedpropname.Length() == 0) || + // if ((m_touchedpropname.Length() == 0) || // (gameobj->GetProperty(m_touchedpropname))) // { m_bTriggered = true; @@ -242,7 +242,7 @@ bool KX_NearSensor::NewHandleCollision(void *obj1, void *obj2, const PHY_CollDat // } //} } - + return false; // was DT_CONTINUE; but this was defined in Sumo as false } diff --git a/source/gameengine/Ketsji/KX_NearSensor.h b/source/gameengine/Ketsji/KX_NearSensor.h index ef6e15f602f..e323357434a 100644 --- a/source/gameengine/Ketsji/KX_NearSensor.h +++ b/source/gameengine/Ketsji/KX_NearSensor.h @@ -65,7 +65,7 @@ public: const STR_String& touchedpropname, class KX_Scene* scene); #endif - virtual ~KX_NearSensor(); + virtual ~KX_NearSensor(); virtual void SynchronizeTransform(); virtual CValue* GetReplica(); virtual void ProcessReplica(); @@ -96,7 +96,7 @@ public: sensor->m_ResetMargin = sensor->m_Margin; sensor->SetPhysCtrlRadius(); - + return 0; } diff --git a/source/gameengine/Ketsji/KX_ObColorIpoSGController.cpp b/source/gameengine/Ketsji/KX_ObColorIpoSGController.cpp index 7f81f221c07..6777afd03c9 100644 --- a/source/gameengine/Ketsji/KX_ObColorIpoSGController.cpp +++ b/source/gameengine/Ketsji/KX_ObColorIpoSGController.cpp @@ -54,10 +54,10 @@ bool KX_ObColorIpoSGController::Update(double currentTime) for (i = m_interpolators.begin(); !(i == m_interpolators.end()); ++i) { (*i)->Execute(m_ipotime); } - + kxgameobj->SetObjectColor(m_rgba); - + m_modified=false; } @@ -95,7 +95,7 @@ SG_Controller* KX_ObColorIpoSGController::GetReplica(class SG_Node* destnode) MT_Scalar* blaptr = (MT_Scalar*) newaddrbase; copyipo->SetNewTarget((MT_Scalar*)blaptr); } - + return iporeplica; } @@ -106,5 +106,5 @@ KX_ObColorIpoSGController::~KX_ObColorIpoSGController() for (i = m_interpolators.begin(); !(i == m_interpolators.end()); ++i) { delete (*i); } - + } diff --git a/source/gameengine/Ketsji/KX_ObColorIpoSGController.h b/source/gameengine/Ketsji/KX_ObColorIpoSGController.h index a7b0b2c4ffc..e482e66fad3 100644 --- a/source/gameengine/Ketsji/KX_ObColorIpoSGController.h +++ b/source/gameengine/Ketsji/KX_ObColorIpoSGController.h @@ -40,7 +40,7 @@ class KX_ObColorIpoSGController : public SG_Controller { public: MT_Vector4 m_rgba; - + private: T_InterpolatorList m_interpolators; @@ -48,7 +48,7 @@ private: double m_ipotime; public: - KX_ObColorIpoSGController() : + KX_ObColorIpoSGController() : m_modified(true), m_ipotime(0.0) {} @@ -59,7 +59,7 @@ public: m_ipotime = time; m_modified = true; } - + void SetOption( int option, @@ -70,8 +70,8 @@ public: void AddInterpolator(KX_IInterpolator* interp); - - + + #ifdef WITH_CXX_GUARDEDALLOC MEM_CXX_CLASS_ALLOC_FUNCS("GE:KX_ObColorIpoSGController") #endif diff --git a/source/gameengine/Ketsji/KX_ObjectActuator.cpp b/source/gameengine/Ketsji/KX_ObjectActuator.cpp index 8c1dee7940f..d957fe8f31a 100644 --- a/source/gameengine/Ketsji/KX_ObjectActuator.cpp +++ b/source/gameengine/Ketsji/KX_ObjectActuator.cpp @@ -57,7 +57,7 @@ KX_ObjectActuator( const MT_Vector3& angV, const short damping, const KX_LocalFlags& flag -) : +) : SCA_IActuator(gameobj, KX_ACT_OBJECT), m_force(force), m_torque(torque), @@ -109,17 +109,17 @@ KX_ObjectActuator::~KX_ObjectActuator() bool KX_ObjectActuator::Update() { - + bool bNegativeEvent = IsNegativeEvent(); RemoveAllEvents(); - - KX_GameObject *parent = static_cast(GetParent()); + + KX_GameObject *parent = static_cast(GetParent()); PHY_ICharacter *character = parent->GetScene()->GetPhysicsEnvironment()->GetCharacterController(parent); if (bNegativeEvent) { // If we previously set the linear velocity we now have to inform // the physics controller that we no longer wish to apply it and that - // it should reconcile the externally set velocity with it's + // it should reconcile the externally set velocity with it's // own velocity. if (m_active_combined_velocity) { if (parent) @@ -142,14 +142,14 @@ bool KX_ObjectActuator::Update() m_error_accumulator.setValue(0.0f,0.0f,0.0f); m_previous_error.setValue(0.0f,0.0f,0.0f); m_jumping = false; - return false; + return false; } else if (parent) { - if (m_bitLocalFlag.ServoControl) + if (m_bitLocalFlag.ServoControl) { // In this mode, we try to reach a target speed using force - // As we don't know the friction, we must implement a generic + // As we don't know the friction, we must implement a generic // servo control to achieve the speed in a configurable // v = current velocity // V = target velocity @@ -182,7 +182,7 @@ bool KX_ObjectActuator::Update() m_force = m_pid.x()*e+m_pid.y()*I+m_pid.z()*dv; // to automatically adapt the PID coefficient to mass; m_force *= mass; - if (m_bitLocalFlag.Torque) + if (m_bitLocalFlag.Torque) { if (m_force[0] > m_dloc[0]) { @@ -194,7 +194,7 @@ bool KX_ObjectActuator::Update() I[0] = m_error_accumulator[0]; } } - if (m_bitLocalFlag.DLoc) + if (m_bitLocalFlag.DLoc) { if (m_force[1] > m_dloc[1]) { @@ -206,7 +206,7 @@ bool KX_ObjectActuator::Update() I[1] = m_error_accumulator[1]; } } - if (m_bitLocalFlag.DRot) + if (m_bitLocalFlag.DRot) { if (m_force[2] > m_dloc[2]) { @@ -325,7 +325,7 @@ bool KX_ObjectActuator::Update() } } } - + } return true; } @@ -573,7 +573,7 @@ PyObject *KX_ObjectActuator::pyattr_get_forceLimitX(void *self_v, const KX_PYATT PyList_SET_ITEM(retVal, 0, PyFloat_FromDouble(self->m_drot[0])); PyList_SET_ITEM(retVal, 1, PyFloat_FromDouble(self->m_dloc[0])); PyList_SET_ITEM(retVal, 2, PyBool_FromLong(self->m_bitLocalFlag.Torque)); - + return retVal; } @@ -609,7 +609,7 @@ PyObject *KX_ObjectActuator::pyattr_get_forceLimitY(void *self_v, const KX_PYATT PyList_SET_ITEM(retVal, 0, PyFloat_FromDouble(self->m_drot[1])); PyList_SET_ITEM(retVal, 1, PyFloat_FromDouble(self->m_dloc[1])); PyList_SET_ITEM(retVal, 2, PyBool_FromLong(self->m_bitLocalFlag.DLoc)); - + return retVal; } @@ -645,7 +645,7 @@ PyObject *KX_ObjectActuator::pyattr_get_forceLimitZ(void *self_v, const KX_PYATT PyList_SET_ITEM(retVal, 0, PyFloat_FromDouble(self->m_drot[2])); PyList_SET_ITEM(retVal, 1, PyFloat_FromDouble(self->m_dloc[2])); PyList_SET_ITEM(retVal, 2, PyBool_FromLong(self->m_bitLocalFlag.DRot)); - + return retVal; } @@ -678,7 +678,7 @@ PyObject *KX_ObjectActuator::pyattr_get_reference(void *self, const struct KX_PY KX_ObjectActuator* actuator = static_cast(self); if (!actuator->m_reference) Py_RETURN_NONE; - + return actuator->m_reference->GetProxy(); } @@ -686,13 +686,13 @@ int KX_ObjectActuator::pyattr_set_reference(void *self, const struct KX_PYATTRIB { KX_ObjectActuator* actuator = static_cast(self); KX_GameObject *refOb; - + if (!ConvertPythonToGameObject(actuator->GetLogicManager(), value, &refOb, true, "actu.reference = value: KX_ObjectActuator")) return PY_SET_ATTR_FAIL; - + if (actuator->m_reference) actuator->m_reference->UnregisterActuator(actuator); - + if (refOb==NULL) { actuator->m_reference= NULL; } @@ -700,7 +700,7 @@ int KX_ObjectActuator::pyattr_set_reference(void *self, const struct KX_PYATTRIB actuator->m_reference = refOb; actuator->m_reference->RegisterActuator(actuator); } - + return PY_SET_ATTR_SUCCESS; } diff --git a/source/gameengine/Ketsji/KX_ObjectActuator.h b/source/gameengine/Ketsji/KX_ObjectActuator.h index 919c6acf03b..7b34c0cbec2 100644 --- a/source/gameengine/Ketsji/KX_ObjectActuator.h +++ b/source/gameengine/Ketsji/KX_ObjectActuator.h @@ -109,8 +109,8 @@ class KX_ObjectActuator : public SCA_IActuator KX_LocalFlags m_bitLocalFlag; KX_GameObject* m_reference; // A hack bool -- oh no sorry everyone - // This bool is used to check if we have informed - // the physics object that we are no longer + // This bool is used to check if we have informed + // the physics object that we are no longer // setting linear velocity. bool m_active_combined_velocity; @@ -129,9 +129,9 @@ public: KX_OBJECT_ACT_ANGULAR_VELOCITY, KX_OBJECT_ACT_MAX }; - + /** - * Check whether this is a valid vector mode + * Check whether this is a valid vector mode */ bool isValid(KX_OBJECT_ACT_VEC_TYPE type); @@ -155,7 +155,7 @@ public: void SetForceLoc(const double force[3]) { /*m_force=force;*/ } void UpdateFuzzyFlags() - { + { m_bitLocalFlag.ZeroForce = MT_fuzzyZero(m_force); m_bitLocalFlag.ZeroTorque = MT_fuzzyZero(m_torque); m_bitLocalFlag.ZeroDLoc = MT_fuzzyZero(m_dloc); diff --git a/source/gameengine/Ketsji/KX_ObstacleSimulation.cpp b/source/gameengine/Ketsji/KX_ObstacleSimulation.cpp index c84b2474c90..20d4a517552 100644 --- a/source/gameengine/Ketsji/KX_ObstacleSimulation.cpp +++ b/source/gameengine/Ketsji/KX_ObstacleSimulation.cpp @@ -230,7 +230,7 @@ void KX_ObstacleSimulation::AddObstaclesForNavMesh(KX_NavMeshObject* navmeshobj) if (poly->n[j]) continue; const float* vj = navmesh->getVertex(poly->v[j]); const float* vi = navmesh->getVertex(poly->v[i]); - + KX_Obstacle* obstacle = CreateObstacle(navmeshobj); obstacle->m_type = KX_OBSTACLE_NAV_MESH; obstacle->m_shape = KX_OBSTACLE_SEGMENT; @@ -292,7 +292,7 @@ KX_Obstacle* KX_ObstacleSimulation::GetObstacle(KX_GameObject* gameobj) return NULL; } -void KX_ObstacleSimulation::AdjustObstacleVelocity(KX_Obstacle* activeObst, KX_NavMeshObject* activeNavMeshObj, +void KX_ObstacleSimulation::AdjustObstacleVelocity(KX_Obstacle* activeObst, KX_NavMeshObject* activeNavMeshObj, MT_Vector3& velocity, MT_Scalar maxDeltaSpeed,MT_Scalar maxDeltaAngle) { } @@ -383,7 +383,7 @@ KX_ObstacleSimulationTOI::KX_ObstacleSimulationTOI(MT_Scalar levelHeight, bool e } -void KX_ObstacleSimulationTOI::AdjustObstacleVelocity(KX_Obstacle* activeObst, KX_NavMeshObject* activeNavMeshObj, +void KX_ObstacleSimulationTOI::AdjustObstacleVelocity(KX_Obstacle* activeObst, KX_NavMeshObject* activeNavMeshObj, MT_Vector3& velocity, MT_Scalar maxDeltaSpeed, MT_Scalar maxDeltaAngle) { int nobs = m_obstacles.size(); @@ -433,7 +433,7 @@ KX_ObstacleSimulationTOI_rays::KX_ObstacleSimulationTOI_rays(MT_Scalar levelHeig } -void KX_ObstacleSimulationTOI_rays::sampleRVO(KX_Obstacle* activeObst, KX_NavMeshObject* activeNavMeshObj, +void KX_ObstacleSimulationTOI_rays::sampleRVO(KX_Obstacle* activeObst, KX_NavMeshObject* activeNavMeshObj, const float maxDeltaAngle) { MT_Vector2 vel(activeObst->dvel[0], activeObst->dvel[1]); @@ -580,7 +580,7 @@ void KX_ObstacleSimulationTOI_rays::sampleRVO(KX_Obstacle* activeObst, KX_NavMes ///////////********* TOI_cells**********///////////////// -static void processSamples(KX_Obstacle* activeObst, KX_NavMeshObject* activeNavMeshObj, +static void processSamples(KX_Obstacle* activeObst, KX_NavMeshObject* activeNavMeshObj, KX_Obstacles& obstacles, float levelHeight, const float vmax, const float* spos, const float cs, const int nspos, float* res, float maxToi, float velWeight, float curVelWeight, float sideWeight, @@ -596,7 +596,7 @@ static void processSamples(KX_Obstacle* activeObst, KX_NavMeshObject* activeNavM } float activeObstPos[2]; - vset(activeObstPos, activeObst->m_pos.x(), activeObst->m_pos.y()); + vset(activeObstPos, activeObst->m_pos.x(), activeObst->m_pos.y()); /* adist = vdot(adir, activeObstPos); */ float minPenalty = FLT_MAX; @@ -630,7 +630,7 @@ static void processSamples(KX_Obstacle* activeObst, KX_NavMeshObject* activeNavM // Side // NOTE: dp, and dv are constant over the whole calculation, - // they can be precomputed per object. + // they can be precomputed per object. const float* pa = activeObstPos; float pb[2]; vset(pb, ob->m_pos.x(), ob->m_pos.y()); @@ -739,7 +739,7 @@ static void processSamples(KX_Obstacle* activeObst, KX_NavMeshObject* activeNavM } } -void KX_ObstacleSimulationTOI_cells::sampleRVO(KX_Obstacle* activeObst, KX_NavMeshObject* activeNavMeshObj, +void KX_ObstacleSimulationTOI_cells::sampleRVO(KX_Obstacle* activeObst, KX_NavMeshObject* activeNavMeshObj, const float maxDeltaAngle) { vset(activeObst->nvel, 0.f, 0.f); @@ -771,7 +771,7 @@ void KX_ObstacleSimulationTOI_cells::sampleRVO(KX_Obstacle* activeObst, KX_NavMe } } } - processSamples(activeObst, activeNavMeshObj, m_obstacles, m_levelHeight, vmax, spos, cs/2, + processSamples(activeObst, activeNavMeshObj, m_obstacles, m_levelHeight, vmax, spos, cs/2, nspos, activeObst->nvel, m_maxToi, m_velWeight, m_curVelWeight, m_collisionWeight, m_toiWeight); } else diff --git a/source/gameengine/Ketsji/KX_ObstacleSimulation.h b/source/gameengine/Ketsji/KX_ObstacleSimulation.h index 50589b5bc69..a49911e9fb8 100644 --- a/source/gameengine/Ketsji/KX_ObstacleSimulation.h +++ b/source/gameengine/Ketsji/KX_ObstacleSimulation.h @@ -1,5 +1,5 @@ /* - * Simulation for obstacle avoidance behavior + * Simulation for obstacle avoidance behavior * (based on Cane Project - http://code.google.com/p/cane by Mikko Mononen (c) 2009) * * ***** BEGIN GPL LICENSE BLOCK ***** @@ -35,13 +35,13 @@ class KX_NavMeshObject; enum KX_OBSTACLE_TYPE { - KX_OBSTACLE_OBJ, + KX_OBSTACLE_OBJ, KX_OBSTACLE_NAV_MESH, }; enum KX_OBSTACLE_SHAPE { - KX_OBSTACLE_CIRCLE, + KX_OBSTACLE_CIRCLE, KX_OBSTACLE_SEGMENT, }; @@ -53,7 +53,7 @@ struct KX_Obstacle MT_Point3 m_pos; MT_Point3 m_pos2; MT_Scalar m_rad; - + float vel[2]; float pvel[2]; float dvel[2]; @@ -61,7 +61,7 @@ struct KX_Obstacle float hvel[VEL_HIST_SIZE*2]; int hhead; - + KX_GameObject* m_gameObj; }; typedef std::vector KX_Obstacles; @@ -87,7 +87,7 @@ public: void AddObstaclesForNavMesh(KX_NavMeshObject* navmesh); KX_Obstacle* GetObstacle(KX_GameObject* gameobj); void UpdateObstacles(); - virtual void AdjustObstacleVelocity(KX_Obstacle* activeObst, KX_NavMeshObject* activeNavMeshObj, + virtual void AdjustObstacleVelocity(KX_Obstacle* activeObst, KX_NavMeshObject* activeNavMeshObj, MT_Vector3& velocity, MT_Scalar maxDeltaSpeed,MT_Scalar maxDeltaAngle); }; @@ -102,18 +102,18 @@ protected: float m_toiWeight; // Sample selection TOI weight float m_collisionWeight; // Sample selection collision weight - virtual void sampleRVO(KX_Obstacle* activeObst, KX_NavMeshObject* activeNavMeshObj, + virtual void sampleRVO(KX_Obstacle* activeObst, KX_NavMeshObject* activeNavMeshObj, const float maxDeltaAngle) = 0; public: KX_ObstacleSimulationTOI(MT_Scalar levelHeight, bool enableVisualization); - virtual void AdjustObstacleVelocity(KX_Obstacle* activeObst, KX_NavMeshObject* activeNavMeshObj, + virtual void AdjustObstacleVelocity(KX_Obstacle* activeObst, KX_NavMeshObject* activeNavMeshObj, MT_Vector3& velocity, MT_Scalar maxDeltaSpeed,MT_Scalar maxDeltaAngle); }; class KX_ObstacleSimulationTOI_rays: public KX_ObstacleSimulationTOI { protected: - virtual void sampleRVO(KX_Obstacle* activeObst, KX_NavMeshObject* activeNavMeshObj, + virtual void sampleRVO(KX_Obstacle* activeObst, KX_NavMeshObject* activeNavMeshObj, const float maxDeltaAngle); public: KX_ObstacleSimulationTOI_rays(MT_Scalar levelHeight, bool enableVisualization); @@ -125,7 +125,7 @@ protected: float m_bias; bool m_adaptive; int m_sampleRadius; - virtual void sampleRVO(KX_Obstacle* activeObst, KX_NavMeshObject* activeNavMeshObj, + virtual void sampleRVO(KX_Obstacle* activeObst, KX_NavMeshObject* activeNavMeshObj, const float maxDeltaAngle); public: KX_ObstacleSimulationTOI_cells(MT_Scalar levelHeight, bool enableVisualization); diff --git a/source/gameengine/Ketsji/KX_OrientationInterpolator.cpp b/source/gameengine/Ketsji/KX_OrientationInterpolator.cpp index bcaa1e60e92..16a9441acc7 100644 --- a/source/gameengine/Ketsji/KX_OrientationInterpolator.cpp +++ b/source/gameengine/Ketsji/KX_OrientationInterpolator.cpp @@ -45,9 +45,9 @@ void KX_OrientationInterpolator::Execute(float currentTime) const MT_Scalar si = sinf(eul[0]); MT_Scalar sj = sinf(eul[1]); MT_Scalar sh = sinf(eul[2]); - MT_Scalar cc = ci*ch; - MT_Scalar cs = ci*sh; - MT_Scalar sc = si*ch; + MT_Scalar cc = ci*ch; + MT_Scalar cs = ci*sh; + MT_Scalar sc = si*ch; MT_Scalar ss = si*sh; m_target.setValue(cj*ch, sj*sc-cs, sj*cc+ss, diff --git a/source/gameengine/Ketsji/KX_OrientationInterpolator.h b/source/gameengine/Ketsji/KX_OrientationInterpolator.h index 59014b70174..195b414a72c 100644 --- a/source/gameengine/Ketsji/KX_OrientationInterpolator.h +++ b/source/gameengine/Ketsji/KX_OrientationInterpolator.h @@ -47,7 +47,7 @@ public: m_ipos[1] = ipos[1]; m_ipos[2] = ipos[2]; } - + virtual void Execute(float currentTime) const; private: diff --git a/source/gameengine/Ketsji/KX_ParentActuator.cpp b/source/gameengine/Ketsji/KX_ParentActuator.cpp index 0b133400920..fd4ef89aa85 100644 --- a/source/gameengine/Ketsji/KX_ParentActuator.cpp +++ b/source/gameengine/Ketsji/KX_ParentActuator.cpp @@ -37,13 +37,13 @@ #include "KX_GameObject.h" #include "KX_PythonInit.h" -#include "EXP_PyObjectPlus.h" +#include "EXP_PyObjectPlus.h" /* ------------------------------------------------------------------------- */ /* Native functions */ /* ------------------------------------------------------------------------- */ -KX_ParentActuator::KX_ParentActuator(SCA_IObject *gameobj, +KX_ParentActuator::KX_ParentActuator(SCA_IObject *gameobj, int mode, bool addToCompound, bool ghost, @@ -56,7 +56,7 @@ KX_ParentActuator::KX_ParentActuator(SCA_IObject *gameobj, { if (m_ob) m_ob->RegisterActuator(this); -} +} @@ -64,7 +64,7 @@ KX_ParentActuator::~KX_ParentActuator() { if (m_ob) m_ob->UnregisterActuator(this); -} +} @@ -127,7 +127,7 @@ bool KX_ParentActuator::Update() obj->RemoveParent(scene); break; }; - + return false; } @@ -185,18 +185,18 @@ int KX_ParentActuator::pyattr_set_object(void *self, const struct KX_PYATTRIBUTE { KX_ParentActuator* actuator = static_cast(self); KX_GameObject *gameobj; - + if (!ConvertPythonToGameObject(actuator->GetLogicManager(), value, &gameobj, true, "actuator.object = value: KX_ParentActuator")) return PY_SET_ATTR_FAIL; // ConvertPythonToGameObject sets the error - + if (actuator->m_ob != NULL) actuator->m_ob->UnregisterActuator(actuator); actuator->m_ob = (SCA_IObject*) gameobj; - + if (actuator->m_ob) actuator->m_ob->RegisterActuator(actuator); - + return PY_SET_ATTR_SUCCESS; } diff --git a/source/gameengine/Ketsji/KX_ParentActuator.h b/source/gameengine/Ketsji/KX_ParentActuator.h index 40baac6b2b2..ebb7ab59460 100644 --- a/source/gameengine/Ketsji/KX_ParentActuator.h +++ b/source/gameengine/Ketsji/KX_ParentActuator.h @@ -39,17 +39,17 @@ class KX_ParentActuator : public SCA_IActuator { Py_Header - + /** Mode */ int m_mode; - + /** option */ bool m_addToCompound; bool m_ghost; /** Object to set as parent */ SCA_IObject *m_ob; - - + + public: enum KX_PARENTACT_MODE @@ -68,12 +68,12 @@ public: SCA_IObject *ob); virtual ~KX_ParentActuator(); virtual bool Update(); - + virtual CValue* GetReplica(); virtual void ProcessReplica(); virtual void Relink(CTR_Map *obj_map); virtual bool UnlinkObject(SCA_IObject* clientobj); - + #ifdef WITH_PYTHON /* --------------------------------------------------------------------- */ @@ -83,7 +83,7 @@ public: /* These are used to get and set m_ob */ static PyObject *pyattr_get_object(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef); static int pyattr_set_object(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); - + #endif /* WITH_PYTHON */ }; /* end of class KX_ParentActuator : public SCA_PropertyActuator */ diff --git a/source/gameengine/Ketsji/KX_PositionInterpolator.h b/source/gameengine/Ketsji/KX_PositionInterpolator.h index b5ab053bb0e..f576a8c25ad 100644 --- a/source/gameengine/Ketsji/KX_PositionInterpolator.h +++ b/source/gameengine/Ketsji/KX_PositionInterpolator.h @@ -39,12 +39,12 @@ class KX_IScalarInterpolator; class KX_PositionInterpolator : public KX_IInterpolator { public: - KX_PositionInterpolator(MT_Point3& target, + KX_PositionInterpolator(MT_Point3& target, KX_IScalarInterpolator *ipos[]) : - m_target(target) + m_target(target) { - m_ipos[0] = ipos[0]; - m_ipos[1] = ipos[1]; + m_ipos[0] = ipos[0]; + m_ipos[1] = ipos[1]; m_ipos[2] = ipos[2]; } diff --git a/source/gameengine/Ketsji/KX_PyConstraintBinding.cpp b/source/gameengine/Ketsji/KX_PyConstraintBinding.cpp index 81fe3be1fcf..25ffa3fe8b0 100644 --- a/source/gameengine/Ketsji/KX_PyConstraintBinding.cpp +++ b/source/gameengine/Ketsji/KX_PyConstraintBinding.cpp @@ -42,7 +42,7 @@ #include "KX_GameObject.h" // ConvertPythonToGameObject() #include "KX_PythonInit.h" -#include "EXP_PyObjectPlus.h" +#include "EXP_PyObjectPlus.h" #ifdef WITH_BULLET # include "LinearMath/btIDebugDraw.h" @@ -163,7 +163,7 @@ static PyObject *gPySetGravity(PyObject *self, else { return NULL; } - + Py_RETURN_NONE; } @@ -177,14 +177,14 @@ static PyObject *gPySetDebugMode(PyObject *self, if (PHY_GetActiveEnvironment()) { PHY_GetActiveEnvironment()->SetDebugMode(mode); - + } - + } else { return NULL; } - + Py_RETURN_NONE; } @@ -446,7 +446,7 @@ static PyObject *gPyGetVehicleConstraint(PyObject *self, { if (PHY_GetActiveEnvironment()) { - + PHY_IVehicle* vehicle = PHY_GetActiveEnvironment()->GetVehicleConstraint(constraintid); if (vehicle) { @@ -478,7 +478,7 @@ static PyObject* gPyGetCharacter(PyObject* self, if (PHY_GetActiveEnvironment()) { - + PHY_ICharacter* character= PHY_GetActiveEnvironment()->GetCharacterController(ob); if (character) { @@ -590,7 +590,7 @@ static PyObject *gPyRemoveConstraint(PyObject *self, else { return NULL; } - + Py_RETURN_NONE; } diff --git a/source/gameengine/Ketsji/KX_PyMath.cpp b/source/gameengine/Ketsji/KX_PyMath.cpp index ee05fd442ab..2620eed4287 100644 --- a/source/gameengine/Ketsji/KX_PyMath.cpp +++ b/source/gameengine/Ketsji/KX_PyMath.cpp @@ -50,7 +50,7 @@ bool PyOrientationTo(PyObject *pyval, MT_Matrix3x3 &rot, const char *error_prefix) { int size= PySequence_Size(pyval); - + if (size == 4) { MT_Quaternion qrot; @@ -69,13 +69,13 @@ bool PyOrientationTo(PyObject *pyval, MT_Matrix3x3 &rot, const char *error_prefi return true; } PyErr_Clear(); - + if (PyMatTo(pyval, rot)) { return true; } } - + PyErr_Format(PyExc_TypeError, "%s, could not set the orientation from a 3x3 matrix, quaternion or euler sequence", error_prefix); return false; } @@ -105,7 +105,7 @@ PyObject *PyObjectFrom(const MT_Matrix4x4 &mat) PyObject *collist = PyList_New(4); PyObject *col; int i; - + for (i=0; i < 4; i++) { col = PyList_New(4); PyList_SET_ITEM(col, 0, PyFloat_FromDouble(mat[0][i])); @@ -114,7 +114,7 @@ PyObject *PyObjectFrom(const MT_Matrix4x4 &mat) PyList_SET_ITEM(col, 3, PyFloat_FromDouble(mat[3][i])); PyList_SET_ITEM(collist, i, col); } - + return collist; #endif } @@ -129,7 +129,7 @@ PyObject *PyObjectFrom(const MT_Matrix3x3 &mat) PyObject *collist = PyList_New(3); PyObject *col; int i; - + for (i=0; i < 3; i++) { col = PyList_New(3); PyList_SET_ITEM(col, 0, PyFloat_FromDouble(mat[0][i])); @@ -137,7 +137,7 @@ PyObject *PyObjectFrom(const MT_Matrix3x3 &mat) PyList_SET_ITEM(col, 2, PyFloat_FromDouble(mat[2][i])); PyList_SET_ITEM(collist, i, col); } - + return collist; #endif } diff --git a/source/gameengine/Ketsji/KX_PyMath.h b/source/gameengine/Ketsji/KX_PyMath.h index 917fd0fcda6..c9059da8913 100644 --- a/source/gameengine/Ketsji/KX_PyMath.h +++ b/source/gameengine/Ketsji/KX_PyMath.h @@ -97,7 +97,7 @@ bool PyMatTo(PyObject *pymat, T& mat) unsigned int rows = PySequence_Size(pymat); if (rows != Size(mat)) return false; - + for (unsigned int row = 0; noerror && row < rows; row++) { PyObject *pyrow = PySequence_GetItem(pymat, row); /* new ref */ @@ -120,12 +120,12 @@ bool PyMatTo(PyObject *pymat, T& mat) } Py_DECREF(pyrow); } - } else + } else noerror = false; - + if (noerror==false) PyErr_SetString(PyExc_TypeError, "could not be converted to a matrix (sequence of sequences)"); - + return noerror; } @@ -137,7 +137,7 @@ bool PyVecTo(PyObject *pyval, T& vec) { #ifdef USE_MATHUTILS /* no need for BaseMath_ReadCallback() here, reading the sequences will do this */ - + if (VectorObject_Check(pyval)) { VectorObject *pyvec= (VectorObject *)pyval; if (BaseMath_ReadCallback(pyvec) == -1) { @@ -183,15 +183,15 @@ bool PyVecTo(PyObject *pyval, T& vec) PyErr_Format(PyExc_AttributeError, "error setting vector, %d args, should be %d", numitems, Size(vec)); return false; } - + for (unsigned int x = 0; x < numitems; x++) vec[x] = PyFloat_AsDouble(PyTuple_GET_ITEM(pyval, x)); /* borrow ref */ - + if (PyErr_Occurred()) { PyErr_SetString(PyExc_AttributeError, "one or more of the items in the sequence was not a float"); return false; } - + return true; } else if (PyObject_TypeCheck(pyval, (PyTypeObject *)&PyObjectPlus::Type)) { @@ -200,7 +200,7 @@ bool PyVecTo(PyObject *pyval, T& vec) * the parent list each time only to discover its not a sequence. * GameObjects are often used as an alternative to vectors so this is a common case * better to do a quick check for it, likely the error below will be ignored. - * + * * This is not 'correct' since we have proxy type CListValues's which could * contain floats/ints but there no cases of CValueLists being this way */ @@ -213,24 +213,24 @@ bool PyVecTo(PyObject *pyval, T& vec) PyErr_Format(PyExc_AttributeError, "error setting vector, %d args, should be %d", numitems, Size(vec)); return false; } - + for (unsigned int x = 0; x < numitems; x++) { PyObject *item = PySequence_GetItem(pyval, x); /* new ref */ vec[x] = PyFloat_AsDouble(item); Py_DECREF(item); } - + if (PyErr_Occurred()) { PyErr_SetString(PyExc_AttributeError, "one or more of the items in the sequence was not a float"); return false; } - + return true; } else { PyErr_Format(PyExc_AttributeError, "not a sequence type, expected a sequence of numbers size %d", Size(vec)); } - + return false; } diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp index 8870224da83..35adbc2d720 100644 --- a/source/gameengine/Ketsji/KX_PythonInit.cpp +++ b/source/gameengine/Ketsji/KX_PythonInit.cpp @@ -117,7 +117,7 @@ extern "C" { #include "EXP_PyObjectPlus.h" -#include "KX_PythonInitTypes.h" +#include "KX_PythonInitTypes.h" /* we only need this to get a list of libraries from the main struct */ #include "DNA_ID.h" @@ -240,7 +240,7 @@ static PyObject *gPySetGravity(PyObject *, PyObject *value) if (gp_KetsjiScene) gp_KetsjiScene->SetGravity(vec); - + Py_RETURN_NONE; } @@ -257,7 +257,7 @@ static PyObject *gPyExpandPath(PyObject *, PyObject *args) { char expanded[FILE_MAX]; char* filename; - + if (!PyArg_ParseTuple(args,"s:ExpandPath",&filename)) return NULL; @@ -441,7 +441,7 @@ static PyObject *gPySetLogicTicRate(PyObject *, PyObject *args) float ticrate; if (!PyArg_ParseTuple(args, "f:setLogicTicRate", &ticrate)) return NULL; - + KX_KetsjiEngine::SetTicRate(ticrate); Py_RETURN_NONE; } @@ -485,7 +485,7 @@ static PyObject *gPySetMaxLogicFrame(PyObject *, PyObject *args) int frame; if (!PyArg_ParseTuple(args, "i:setMaxLogicFrame", &frame)) return NULL; - + KX_KetsjiEngine::SetMaxLogicFrame(frame); Py_RETURN_NONE; } @@ -500,7 +500,7 @@ static PyObject *gPySetMaxPhysicsFrame(PyObject *, PyObject *args) int frame; if (!PyArg_ParseTuple(args, "i:setMaxPhysicsFrame", &frame)) return NULL; - + KX_KetsjiEngine::SetMaxPhysicsFrame(frame); Py_RETURN_NONE; } @@ -515,7 +515,7 @@ static PyObject *gPySetPhysicsTicRate(PyObject *, PyObject *args) float ticrate; if (!PyArg_ParseTuple(args, "f:setPhysicsTicRate", &ticrate)) return NULL; - + PHY_GetActiveEnvironment()->SetFixedTimeStep(true,ticrate); Py_RETURN_NONE; } @@ -525,7 +525,7 @@ static PyObject *gPySetPhysicsDebug(PyObject *, PyObject *args) int debugMode; if (!PyArg_ParseTuple(args, "i:setPhysicsDebug", &debugMode)) return NULL; - + PHY_GetActiveEnvironment()->setDebugMode(debugMode); Py_RETURN_NONE; } @@ -634,7 +634,7 @@ static PyObject *gPyGetBlendFileList(PyObject *, PyObject *args) return NULL; list = PyList_New(0); - + if (searchpath) { BLI_strncpy(cpath, searchpath, FILE_MAX); BLI_path_abs(cpath, gp_GamePythonPath); @@ -648,7 +648,7 @@ static PyObject *gPyGetBlendFileList(PyObject *, PyObject *args) fprintf(stderr, "Could not read directory (%s) failed, code %d (%s)\n", cpath, errno, strerror(errno)); return list; } - + while ((dirp = readdir(dp)) != NULL) { if (BLI_path_extension_check(dirp->d_name, ".blend")) { value = PyC_UnicodeFromByte(dirp->d_name); @@ -656,7 +656,7 @@ static PyObject *gPyGetBlendFileList(PyObject *, PyObject *args) Py_DECREF(value); } } - + closedir(dp); return list; } @@ -671,10 +671,10 @@ static PyObject *gPyAddScene(PyObject *, PyObject *args) { char* name; int overlay = 1; - + if (!PyArg_ParseTuple(args, "s|i:addScene", &name , &overlay)) return NULL; - + gp_KetsjiEngine->ConvertAndAddScene(name, (overlay != 0)); Py_RETURN_NONE; @@ -700,9 +700,9 @@ static PyObject *gPyGetSceneList(PyObject *self) KX_SceneList* scenes = m_engine->CurrentScenes(); int numScenes = scenes->size(); int i; - + list = PyList_New(numScenes); - + for (i=0;iat(i); @@ -742,7 +742,7 @@ static PyObject *gLibLoad(PyObject *, PyObject *args, PyObject *kwds) int load_actions=0, verbose=0, load_scripts=1, async=0; static const char *kwlist[] = {"path", "group", "buffer", "load_actions", "verbose", "load_scripts", "async", NULL}; - + if (!PyArg_ParseTupleAndKeywords(args, kwds, "ss|y*iiIi:LibLoad", const_cast(kwlist), &path, &group, &py_buffer, &load_actions, &verbose, &load_scripts, &async)) return NULL; @@ -778,12 +778,12 @@ static PyObject *gLibLoad(PyObject *, PyObject *args, PyObject *kwds) PyBuffer_Release(&py_buffer); } - + if (err_str) { PyErr_SetString(PyExc_ValueError, err_str); return NULL; } - + Py_RETURN_FALSE; } @@ -798,23 +798,23 @@ static PyObject *gLibNew(PyObject *, PyObject *args) if (!PyArg_ParseTuple(args,"ssO!:LibNew",&path, &group, &PyList_Type, &names)) return NULL; - + if (kx_scene->GetSceneConverter()->GetMainDynamicPath(path)) { PyErr_SetString(PyExc_KeyError, "the name of the path given exists"); return NULL; } - + idcode= BKE_idcode_from_name(group); if (idcode==0) { PyErr_Format(PyExc_ValueError, "invalid group given \"%s\"", group); return NULL; } - + Main *maggie=BKE_main_new(); kx_scene->GetSceneConverter()->GetMainDynamic().push_back(maggie); strncpy(maggie->name, path, sizeof(maggie->name)-1); - + /* Copy the object into main */ if (idcode==ID_ME) { PyObject *ret= PyList_New(0); @@ -834,14 +834,14 @@ static PyObject *gLibNew(PyObject *, PyObject *args) PyErr_Clear(); /* wasnt a string, ignore for now */ } } - + return ret; } else { PyErr_Format(PyExc_ValueError, "only \"Mesh\" group currently supported"); return NULL; } - + Py_RETURN_NONE; } @@ -867,12 +867,12 @@ static PyObject *gLibList(PyObject *, PyObject *args) vector &dynMaggie = gp_KetsjiScene->GetSceneConverter()->GetMainDynamic(); int i= 0; PyObject *list= PyList_New(dynMaggie.size()); - + for (vector::iterator it=dynMaggie.begin(); !(it==dynMaggie.end()); it++) { PyList_SET_ITEM(list, i++, PyUnicode_FromString( (*it)->name) ); } - + return list; } @@ -883,7 +883,7 @@ static PyObject *gPyNextFrame(PyObject *) if (pynextframestate.state == NULL) Py_RETURN_NONE; //should never happen; raise exception instead? if (pynextframestate.func(pynextframestate.state)) //nonzero = stop - { + { Py_RETURN_TRUE; } else // 0 = go on @@ -945,7 +945,7 @@ static struct PyMethodDef game_methods[] = { {"LibNew", (PyCFunction)gLibNew, METH_VARARGS, (const char *)""}, {"LibFree", (PyCFunction)gLibFree, METH_VARARGS, (const char *)""}, {"LibList", (PyCFunction)gLibList, METH_VARARGS, (const char *)""}, - + {NULL, (PyCFunction) NULL, 0, NULL } }; @@ -971,7 +971,7 @@ static PyObject *gPyEnableVisibility(PyObject *, PyObject *args) int visible; if (!PyArg_ParseTuple(args,"i:enableVisibility",&visible)) return NULL; - + gUseVisibilityTemp = (visible != 0); Py_RETURN_NONE; } @@ -983,7 +983,7 @@ static PyObject *gPyShowMouse(PyObject *, PyObject *args) int visible; if (!PyArg_ParseTuple(args,"i:showMouse",&visible)) return NULL; - + if (visible) { if (gp_Canvas) @@ -993,7 +993,7 @@ static PyObject *gPyShowMouse(PyObject *, PyObject *args) if (gp_Canvas) gp_Canvas->SetMouseState(RAS_ICanvas::MOUSE_INVISIBLE); } - + Py_RETURN_NONE; } @@ -1004,10 +1004,10 @@ static PyObject *gPySetMousePosition(PyObject *, PyObject *args) int x,y; if (!PyArg_ParseTuple(args,"ii:setMousePosition",&x,&y)) return NULL; - + if (gp_Canvas) gp_Canvas->SetMousePosition(x,y); - + Py_RETURN_NONE; } @@ -1021,9 +1021,9 @@ static PyObject *gPySetEyeSeparation(PyObject *, PyObject *args) PyErr_SetString(PyExc_RuntimeError, "Rasterizer.setEyeSeparation(float), Rasterizer not available"); return NULL; } - + gp_Rasterizer->SetEyeSeparation(sep); - + Py_RETURN_NONE; } @@ -1033,7 +1033,7 @@ static PyObject *gPyGetEyeSeparation(PyObject *) PyErr_SetString(PyExc_RuntimeError, "Rasterizer.getEyeSeparation(), Rasterizer not available"); return NULL; } - + return PyFloat_FromDouble(gp_Rasterizer->GetEyeSeparation()); } @@ -1042,14 +1042,14 @@ static PyObject *gPySetFocalLength(PyObject *, PyObject *args) float focus; if (!PyArg_ParseTuple(args, "f:setFocalLength", &focus)) return NULL; - + if (!gp_Rasterizer) { PyErr_SetString(PyExc_RuntimeError, "Rasterizer.setFocalLength(float), Rasterizer not available"); return NULL; } gp_Rasterizer->SetFocalLength(focus); - + Py_RETURN_NONE; } @@ -1059,9 +1059,9 @@ static PyObject *gPyGetFocalLength(PyObject *, PyObject *, PyObject *) PyErr_SetString(PyExc_RuntimeError, "Rasterizer.getFocalLength(), Rasterizer not available"); return NULL; } - + return PyFloat_FromDouble(gp_Rasterizer->GetFocalLength()); - + Py_RETURN_NONE; } @@ -1103,12 +1103,12 @@ static PyObject *gPyMakeScreenshot(PyObject *, PyObject *args) char* filename; if (!PyArg_ParseTuple(args,"s:makeScreenshot",&filename)) return NULL; - + if (gp_Canvas) { gp_Canvas->MakeScreenShot(filename); } - + Py_RETURN_NONE; } @@ -1117,14 +1117,14 @@ static PyObject *gPyEnableMotionBlur(PyObject *, PyObject *args) float motionblurvalue; if (!PyArg_ParseTuple(args,"f:enableMotionBlur",&motionblurvalue)) return NULL; - + if (!gp_Rasterizer) { PyErr_SetString(PyExc_RuntimeError, "Rasterizer.enableMotionBlur(float), Rasterizer not available"); return NULL; } - + gp_Rasterizer->EnableMotionBlur(motionblurvalue); - + Py_RETURN_NONE; } @@ -1134,9 +1134,9 @@ static PyObject *gPyDisableMotionBlur(PyObject *) PyErr_SetString(PyExc_RuntimeError, "Rasterizer.disableMotionBlur(), Rasterizer not available"); return NULL; } - + gp_Rasterizer->DisableMotionBlur(); - + Py_RETURN_NONE; } @@ -1168,16 +1168,16 @@ static PyObject *gPySetGLSLMaterialSetting(PyObject *, if (!PyArg_ParseTuple(args,"si:setGLSLMaterialSetting",&setting,&enable)) return NULL; - + flag = getGLSLSettingFlag(setting); - + if (flag == -1) { PyErr_SetString(PyExc_ValueError, "Rasterizer.setGLSLMaterialSetting(string): glsl setting is not known"); return NULL; } sceneflag= gs->glslflag; - + if (enable) gs->glslflag &= ~flag; else @@ -1214,9 +1214,9 @@ static PyObject *gPyGetGLSLMaterialSetting(PyObject *, if (!PyArg_ParseTuple(args,"s:getGLSLMaterialSetting",&setting)) return NULL; - + flag = getGLSLSettingFlag(setting); - + if (flag == -1) { PyErr_SetString(PyExc_ValueError, "Rasterizer.getGLSLMaterialSetting(string): glsl setting is not known"); return NULL; @@ -1260,7 +1260,7 @@ static PyObject *gPyGetMaterialType(PyObject *) flag = KX_BLENDER_GLSL_MATERIAL; else flag = KX_BLENDER_MULTITEX_MATERIAL; - + return PyLong_FromLong(flag); } @@ -1311,7 +1311,7 @@ static PyObject *gPyDrawLine(PyObject *, PyObject *args) return NULL; gp_Rasterizer->DrawDebugLine(gp_KetsjiScene, from, to, color); - + Py_RETURN_NONE; } @@ -1714,10 +1714,10 @@ PyMODINIT_FUNC initGameLogicPythonBinding() // Add some symbolic constants to the module d = PyModule_GetDict(m); - + // can be overwritten later for gameEngine instances that can load new blend files and re-initialize this module // for now its safe to make sure it exists for other areas such as the web plugin - + PyDict_SetItemString(d, "globalDict", item=PyDict_New()); Py_DECREF(item); // Add keyboard and mouse attributes to this module @@ -1753,7 +1753,7 @@ PyMODINIT_FUNC initGameLogicPythonBinding() ErrorObject = PyUnicode_FromString("GameLogic.error"); PyDict_SetItemString(d, "error", ErrorObject); Py_DECREF(ErrorObject); - + // XXXX Add constants here /* To use logic bricks, we need some sort of constants. Here, we associate */ /* constants and sumbolic names. Add them to dictionary d. */ @@ -1827,7 +1827,7 @@ PyMODINIT_FUNC initGameLogicPythonBinding() KX_MACRO_addTypesToDict(d, KX_ACTIONACT_LOOPSTOP, ACT_ACTION_LOOP_STOP); KX_MACRO_addTypesToDict(d, KX_ACTIONACT_LOOPEND, ACT_ACTION_LOOP_END); KX_MACRO_addTypesToDict(d, KX_ACTIONACT_PROPERTY, ACT_ACTION_FROM_PROP); - + /* 7. GL_BlendFunc */ KX_MACRO_addTypesToDict(d, BL_ZERO, GL_ZERO); KX_MACRO_addTypesToDict(d, BL_ONE, GL_ONE); @@ -1890,13 +1890,13 @@ PyMODINIT_FUNC initGameLogicPythonBinding() KX_MACRO_addTypesToDict(d, KX_STATE28, (1<<27)); KX_MACRO_addTypesToDict(d, KX_STATE29, (1<<28)); KX_MACRO_addTypesToDict(d, KX_STATE30, (1<<29)); - + /* All Sensors */ KX_MACRO_addTypesToDict(d, KX_SENSOR_JUST_ACTIVATED, SCA_ISensor::KX_SENSOR_JUST_ACTIVATED); KX_MACRO_addTypesToDict(d, KX_SENSOR_ACTIVE, SCA_ISensor::KX_SENSOR_ACTIVE); KX_MACRO_addTypesToDict(d, KX_SENSOR_JUST_DEACTIVATED, SCA_ISensor::KX_SENSOR_JUST_DEACTIVATED); KX_MACRO_addTypesToDict(d, KX_SENSOR_INACTIVE, SCA_ISensor::KX_SENSOR_INACTIVE); - + /* Radar Sensor */ KX_MACRO_addTypesToDict(d, KX_RADAR_AXIS_POS_X, KX_RadarSensor::KX_RADAR_AXIS_POS_X); KX_MACRO_addTypesToDict(d, KX_RADAR_AXIS_POS_Y, KX_RadarSensor::KX_RADAR_AXIS_POS_Y); @@ -1936,7 +1936,7 @@ PyMODINIT_FUNC initGameLogicPythonBinding() KX_MACRO_addTypesToDict(d, KX_INPUT_JUST_ACTIVATED, SCA_InputEvent::KX_JUSTACTIVATED); KX_MACRO_addTypesToDict(d, KX_INPUT_ACTIVE, SCA_InputEvent::KX_ACTIVE); KX_MACRO_addTypesToDict(d, KX_INPUT_JUST_RELEASED, SCA_InputEvent::KX_JUSTRELEASED); - + KX_MACRO_addTypesToDict(d, KX_MOUSE_BUT_LEFT, SCA_IInputDevice::KX_LEFTMOUSE); KX_MACRO_addTypesToDict(d, KX_MOUSE_BUT_MIDDLE, SCA_IInputDevice::KX_MIDDLEMOUSE); KX_MACRO_addTypesToDict(d, KX_MOUSE_BUT_RIGHT, SCA_IInputDevice::KX_RIGHTMOUSE); @@ -2079,16 +2079,16 @@ PyMODINIT_FUNC initGameLogicPythonBinding() /** * Explanation of - * + * * - backupPySysObjects() : stores sys.path in #gp_sys_backup * - initPySysObjects(main) : initializes the blendfile and library paths * - restorePySysObjects() : restores sys.path from #gp_sys_backup - * + * * These exist so the current blend dir "//" can always be used to import modules from. * the reason we need a few functions for this is that python is not only used by the game engine * so we cant just add to sys.path all the time, it would leave pythons state in a mess. * It would also be incorrect since loading blend files for new levels etc would always add to sys.path - * + * * To play nice with blenders python, the sys.path is backed up and the current blendfile along * with all its lib paths are added to the sys path. * When loading a new blendfile, the original sys.path is restored and the new paths are added over the top. @@ -2102,11 +2102,11 @@ static void backupPySysObjects(void) PyObject *sys_path = PySys_GetObject("path"); PyObject *sys_meta_path = PySys_GetObject("meta_path"); PyObject *sys_mods = PySys_GetObject("modules"); - + /* paths */ Py_XDECREF(gp_sys_backup.path); /* just in case its set */ gp_sys_backup.path = PyList_GetSlice(sys_path, 0, INT_MAX); /* copy the list */ - + /* meta_paths */ Py_XDECREF(gp_sys_backup.meta_path); /* just in case its set */ gp_sys_backup.meta_path = PyList_GetSlice(sys_meta_path, 0, INT_MAX); /* copy the list */ @@ -2114,7 +2114,7 @@ static void backupPySysObjects(void) /* modules */ Py_XDECREF(gp_sys_backup.modules); /* just in case its set */ gp_sys_backup.modules = PyDict_Copy(sys_mods); /* copy the dict */ - + } /* for initPySysObjects only, @@ -2126,26 +2126,26 @@ static void initPySysObjects__append(PyObject *sys_path, const char *filename) { PyObject *item; char expanded[FILE_MAX]; - + BLI_split_dir_part(filename, expanded, sizeof(expanded)); /* get the dir part of filename only */ BLI_path_abs(expanded, gp_GamePythonPath); /* filename from lib->filename is (always?) absolute, so this may not be needed but it wont hurt */ BLI_cleanup_file(gp_GamePythonPath, expanded); /* Don't use BLI_cleanup_dir because it adds a slash - BREAKS WIN32 ONLY */ item = PyC_UnicodeFromByte(expanded); - + // printf("SysPath - '%s', '%s', '%s'\n", expanded, filename, gp_GamePythonPath); - + if (PySequence_Index(sys_path, item) == -1) { PyErr_Clear(); /* PySequence_Index sets a ValueError */ PyList_Insert(sys_path, 0, item); } - + Py_DECREF(item); } static void initPySysObjects(Main *maggie) { PyObject *sys_path = PySys_GetObject("path"); PyObject *sys_meta_path = PySys_GetObject("meta_path"); - + if (gp_sys_backup.path == NULL) { /* backup */ backupPySysObjects(); @@ -2155,18 +2155,18 @@ static void initPySysObjects(Main *maggie) PyList_SetSlice(sys_path, 0, INT_MAX, gp_sys_backup.path); PyList_SetSlice(sys_meta_path, 0, INT_MAX, gp_sys_backup.meta_path); } - + Library *lib= (Library *)maggie->library.first; - + while (lib) { /* lib->name wont work in some cases (on win32), * even when expanding with gp_GamePythonPath, using lib->filename is less trouble */ initPySysObjects__append(sys_path, lib->filepath); lib= (Library *)lib->id.next; } - + initPySysObjects__append(sys_path, gp_GamePythonPath); - + // fprintf(stderr, "\nNew Path: %d ", PyList_GET_SIZE(sys_path)); // PyObject_Print(sys_path, stderr, 0); } @@ -2191,14 +2191,14 @@ static void restorePySysObjects(void) PyList_SetSlice(sys_meta_path, 0, INT_MAX, gp_sys_backup.meta_path); Py_DECREF(gp_sys_backup.meta_path); gp_sys_backup.meta_path = NULL; - + /* modules */ PyDict_Clear(sys_mods); PyDict_Update(sys_mods, gp_sys_backup.modules); Py_DECREF(gp_sys_backup.modules); gp_sys_backup.modules = NULL; - - + + // fprintf(stderr, "\nRestore Path: %d ", PyList_GET_SIZE(sys_path)); // PyObject_Print(sys_path, stderr, 0); } @@ -2331,7 +2331,7 @@ PyObject *initGamePlayerPythonScripting(Main *maggie, int argc, char** argv) PyC_SetHomePath(py_path_bundle); Py_Initialize(); - + if (argv && first_time) { /* browser plugins don't currently set this */ // Until python support ascii again, we use our own. // PySys_SetArgv(argc, argv); @@ -2371,7 +2371,7 @@ PyObject *initGamePlayerPythonScripting(Main *maggie, int argc, char** argv) PyDict_SetItemString(PyImport_GetModuleDict(), "bge", initBGE()); first_time = false; - + PyObjectPlus::ClearDeprecationWarning(); return PyC_DefaultNameSpace(NULL); @@ -2395,7 +2395,7 @@ void exitGamePlayerPythonScripting() /* since python restarts we cant let the python backup of the sys.path hang around in a global pointer */ restorePySysObjects(); /* get back the original sys.path and clear the backup */ - + Py_Finalize(); bpy_import_main_set(NULL); PyObjectPlus::ClearDeprecationWarning(); @@ -2560,25 +2560,25 @@ static PyObject *gPyEventToString(PyObject *, PyObject *value) { PyObject *mod, *dict, *key, *val, *ret = NULL; Py_ssize_t pos = 0; - + mod = PyImport_ImportModule( "GameKeys" ); if (!mod) return NULL; - + dict = PyModule_GetDict(mod); - + while (PyDict_Next(dict, &pos, &key, &val)) { if (PyObject_RichCompareBool(value, val, Py_EQ)) { ret = key; break; } } - + PyErr_Clear(); // in case there was an error clearing Py_DECREF(mod); if (!ret) PyErr_SetString(PyExc_ValueError, "GameKeys.EventToString(int): expected a valid int keyboard event"); else Py_INCREF(ret); - + return ret; } @@ -2593,7 +2593,7 @@ static PyObject *gPyEventToCharacter(PyObject *, PyObject *args) int event, shift; if (!PyArg_ParseTuple(args,"ii:EventToCharacter", &event, &shift)) return NULL; - + if (IsPrintable(event)) { char ch[2] = {'\0', '\0'}; ch[0] = ToCharacter(event, (bool)shift); @@ -2662,7 +2662,7 @@ PyMODINIT_FUNC initGameKeysPythonBinding() KX_MACRO_addTypesToDict(d, XKEY, SCA_IInputDevice::KX_XKEY); KX_MACRO_addTypesToDict(d, YKEY, SCA_IInputDevice::KX_YKEY); KX_MACRO_addTypesToDict(d, ZKEY, SCA_IInputDevice::KX_ZKEY); - + KX_MACRO_addTypesToDict(d, ZEROKEY, SCA_IInputDevice::KX_ZEROKEY); KX_MACRO_addTypesToDict(d, ONEKEY, SCA_IInputDevice::KX_ONEKEY); KX_MACRO_addTypesToDict(d, TWOKEY, SCA_IInputDevice::KX_TWOKEY); @@ -2673,16 +2673,16 @@ PyMODINIT_FUNC initGameKeysPythonBinding() KX_MACRO_addTypesToDict(d, SEVENKEY, SCA_IInputDevice::KX_SEVENKEY); KX_MACRO_addTypesToDict(d, EIGHTKEY, SCA_IInputDevice::KX_EIGHTKEY); KX_MACRO_addTypesToDict(d, NINEKEY, SCA_IInputDevice::KX_NINEKEY); - + KX_MACRO_addTypesToDict(d, CAPSLOCKKEY, SCA_IInputDevice::KX_CAPSLOCKKEY); - + KX_MACRO_addTypesToDict(d, LEFTCTRLKEY, SCA_IInputDevice::KX_LEFTCTRLKEY); KX_MACRO_addTypesToDict(d, LEFTALTKEY, SCA_IInputDevice::KX_LEFTALTKEY); KX_MACRO_addTypesToDict(d, RIGHTALTKEY, SCA_IInputDevice::KX_RIGHTALTKEY); KX_MACRO_addTypesToDict(d, RIGHTCTRLKEY, SCA_IInputDevice::KX_RIGHTCTRLKEY); KX_MACRO_addTypesToDict(d, RIGHTSHIFTKEY, SCA_IInputDevice::KX_RIGHTSHIFTKEY); KX_MACRO_addTypesToDict(d, LEFTSHIFTKEY, SCA_IInputDevice::KX_LEFTSHIFTKEY); - + KX_MACRO_addTypesToDict(d, ESCKEY, SCA_IInputDevice::KX_ESCKEY); KX_MACRO_addTypesToDict(d, TABKEY, SCA_IInputDevice::KX_TABKEY); KX_MACRO_addTypesToDict(d, RETKEY, SCA_IInputDevice::KX_RETKEY); @@ -2702,34 +2702,34 @@ PyMODINIT_FUNC initGameKeysPythonBinding() KX_MACRO_addTypesToDict(d, EQUALKEY, SCA_IInputDevice::KX_EQUALKEY); KX_MACRO_addTypesToDict(d, LEFTBRACKETKEY, SCA_IInputDevice::KX_LEFTBRACKETKEY); KX_MACRO_addTypesToDict(d, RIGHTBRACKETKEY, SCA_IInputDevice::KX_RIGHTBRACKETKEY); - + KX_MACRO_addTypesToDict(d, LEFTARROWKEY, SCA_IInputDevice::KX_LEFTARROWKEY); KX_MACRO_addTypesToDict(d, DOWNARROWKEY, SCA_IInputDevice::KX_DOWNARROWKEY); KX_MACRO_addTypesToDict(d, RIGHTARROWKEY, SCA_IInputDevice::KX_RIGHTARROWKEY); KX_MACRO_addTypesToDict(d, UPARROWKEY, SCA_IInputDevice::KX_UPARROWKEY); - + KX_MACRO_addTypesToDict(d, PAD2 , SCA_IInputDevice::KX_PAD2); KX_MACRO_addTypesToDict(d, PAD4 , SCA_IInputDevice::KX_PAD4); KX_MACRO_addTypesToDict(d, PAD6 , SCA_IInputDevice::KX_PAD6); KX_MACRO_addTypesToDict(d, PAD8 , SCA_IInputDevice::KX_PAD8); - + KX_MACRO_addTypesToDict(d, PAD1 , SCA_IInputDevice::KX_PAD1); KX_MACRO_addTypesToDict(d, PAD3 , SCA_IInputDevice::KX_PAD3); KX_MACRO_addTypesToDict(d, PAD5 , SCA_IInputDevice::KX_PAD5); KX_MACRO_addTypesToDict(d, PAD7 , SCA_IInputDevice::KX_PAD7); KX_MACRO_addTypesToDict(d, PAD9 , SCA_IInputDevice::KX_PAD9); - + KX_MACRO_addTypesToDict(d, PADPERIOD, SCA_IInputDevice::KX_PADPERIOD); KX_MACRO_addTypesToDict(d, PADSLASHKEY, SCA_IInputDevice::KX_PADSLASHKEY); KX_MACRO_addTypesToDict(d, PADASTERKEY, SCA_IInputDevice::KX_PADASTERKEY); - - + + KX_MACRO_addTypesToDict(d, PAD0, SCA_IInputDevice::KX_PAD0); KX_MACRO_addTypesToDict(d, PADMINUS, SCA_IInputDevice::KX_PADMINUS); KX_MACRO_addTypesToDict(d, PADENTER, SCA_IInputDevice::KX_PADENTER); KX_MACRO_addTypesToDict(d, PADPLUSKEY, SCA_IInputDevice::KX_PADPLUSKEY); - - + + KX_MACRO_addTypesToDict(d, F1KEY, SCA_IInputDevice::KX_F1KEY); KX_MACRO_addTypesToDict(d, F2KEY, SCA_IInputDevice::KX_F2KEY); KX_MACRO_addTypesToDict(d, F3KEY, SCA_IInputDevice::KX_F3KEY); @@ -2751,7 +2751,7 @@ PyMODINIT_FUNC initGameKeysPythonBinding() KX_MACRO_addTypesToDict(d, F19KEY, SCA_IInputDevice::KX_F19KEY); KX_MACRO_addTypesToDict(d, OSKEY, SCA_IInputDevice::KX_OSKEY); - + KX_MACRO_addTypesToDict(d, PAUSEKEY, SCA_IInputDevice::KX_PAUSEKEY); KX_MACRO_addTypesToDict(d, INSERTKEY, SCA_IInputDevice::KX_INSERTKEY); KX_MACRO_addTypesToDict(d, HOMEKEY, SCA_IInputDevice::KX_HOMEKEY); @@ -2805,7 +2805,7 @@ PyMODINIT_FUNC initApplicationPythonBinding() PyObject *d; m = PyModule_Create(&Application_module_def); - + // Add some symbolic constants to the module d = PyModule_GetDict(m); @@ -2865,7 +2865,7 @@ int saveGamePythonConfig( char **marshal_buffer) // for testing only // PyObject_Print(pyGlobalDictMarshal, stderr, 0); char *marshal_cstring; - + marshal_cstring = PyBytes_AsString(pyGlobalDictMarshal); // py3 uses byte arrays marshal_length= PyBytes_Size(pyGlobalDictMarshal); *marshal_buffer = new char[marshal_length + 1]; @@ -2922,7 +2922,7 @@ int loadGamePythonConfig(char *marshal_buffer, int marshal_length) void pathGamePythonConfig(char *path) { int len = strlen(gp_GamePythonPathOrig); // Always use the first loaded blend filename - + BLI_strncpy(path, gp_GamePythonPathOrig, sizeof(gp_GamePythonPathOrig)); /* replace extension */ @@ -2937,7 +2937,7 @@ void setGamePythonPath(const char *path) { BLI_strncpy(gp_GamePythonPath, path, sizeof(gp_GamePythonPath)); BLI_cleanup_file(NULL, gp_GamePythonPath); /* not absolutely needed but makes resolving path problems less confusing later */ - + if (gp_GamePythonPathOrig[0] == '\0') BLI_strncpy(gp_GamePythonPathOrig, path, sizeof(gp_GamePythonPathOrig)); } diff --git a/source/gameengine/Ketsji/KX_PythonInitTypes.cpp b/source/gameengine/Ketsji/KX_PythonInitTypes.cpp index 4a999e37f2b..a9c90b33cda 100644 --- a/source/gameengine/Ketsji/KX_PythonInitTypes.cpp +++ b/source/gameengine/Ketsji/KX_PythonInitTypes.cpp @@ -156,7 +156,7 @@ static void PyType_Ready_ADD(PyObject *dict, PyTypeObject *tp, PyAttributeDef *a PyType_Ready(tp); PyDict_SetItemString(dict, tp->tp_name, reinterpret_cast(tp)); } - + } diff --git a/source/gameengine/Ketsji/KX_RadarSensor.cpp b/source/gameengine/Ketsji/KX_RadarSensor.cpp index 861e3f70296..4f7a0e33011 100644 --- a/source/gameengine/Ketsji/KX_RadarSensor.cpp +++ b/source/gameengine/Ketsji/KX_RadarSensor.cpp @@ -70,10 +70,10 @@ KX_RadarSensor::KX_RadarSensor(SCA_EventManager* eventmgr, //m_client_info->m_auxilary_info = NULL; //sumoObj->setClientObject(&m_client_info); } - + KX_RadarSensor::~KX_RadarSensor() { - + } CValue* KX_RadarSensor::GetReplica() @@ -96,7 +96,7 @@ void KX_RadarSensor::SynchronizeTransform() // is the geometry correctly converted? // a collision cone is oriented - // center the cone correctly + // center the cone correctly // depends on the radar 'axis' switch (m_axis) { @@ -146,7 +146,7 @@ void KX_RadarSensor::SynchronizeTransform() { } } - + //Using a temp variable to translate MT_Point3 to float[3]. //float[3] works better for the Python interface. MT_Point3 temp = trans.getOrigin(); @@ -224,7 +224,7 @@ PyObject *KX_RadarSensor::pyattr_get_angle(void *self_v, const KX_PYATTRIBUTE_DE // The original angle from the gui was converted, so we recalculate the value here to maintain // consistency between Python and the gui return PyFloat_FromDouble(MT_degrees(atan(self->m_coneradius / self->m_coneheight)) * 2); - + } #endif // WITH_PYTHON diff --git a/source/gameengine/Ketsji/KX_RadarSensor.h b/source/gameengine/Ketsji/KX_RadarSensor.h index 6a2d50ffa3a..c0cb7bc65d5 100644 --- a/source/gameengine/Ketsji/KX_RadarSensor.h +++ b/source/gameengine/Ketsji/KX_RadarSensor.h @@ -42,7 +42,7 @@ class KX_RadarSensor : public KX_NearSensor { protected: Py_Header - + float m_coneradius; /** @@ -60,7 +60,7 @@ class KX_RadarSensor : public KX_NearSensor * The previous direction of the cone (origin to bottom plane). */ float m_cone_target[3]; - + public: KX_RadarSensor(SCA_EventManager* eventmgr, diff --git a/source/gameengine/Ketsji/KX_RayCast.cpp b/source/gameengine/Ketsji/KX_RayCast.cpp index 478019c6304..5d3c943b842 100644 --- a/source/gameengine/Ketsji/KX_RayCast.cpp +++ b/source/gameengine/Ketsji/KX_RayCast.cpp @@ -61,18 +61,18 @@ void KX_RayCast::reportHit(PHY_RayCastResult* result) bool KX_RayCast::RayTest(PHY_IPhysicsEnvironment* physics_environment, const MT_Point3& _frompoint, const MT_Point3& topoint, KX_RayCast& callback) { if (physics_environment==NULL) return false; /* prevents crashing in some cases */ - + // Loops over all physics objects between frompoint and topoint, // calling callback.RayHit for each one. // // callback.RayHit should return true to stop looking, or false to continue. // // returns true if an object was found, false if not. - + MT_Point3 frompoint(_frompoint); const MT_Vector3 todir( (topoint - frompoint).safe_normalized() ); MT_Point3 prevpoint(_frompoint+todir*(-1.f)); - + PHY_IPhysicsController* hit_controller; while ((hit_controller = physics_environment->RayTest(callback, @@ -80,14 +80,14 @@ bool KX_RayCast::RayTest(PHY_IPhysicsEnvironment* physics_environment, const MT_ topoint.x(),topoint.y(),topoint.z())) != NULL) { KX_ClientObjectInfo *info = static_cast(hit_controller->GetNewClientInfo()); - + if (!info) { printf("no info!\n"); MT_assert(info && "Physics controller with no client object info"); break; } - + // The biggest danger to endless loop, prevent this by checking that the // hit point always progresses along the ray direction.. prevpoint -= callback.m_hitPoint; @@ -99,7 +99,7 @@ bool KX_RayCast::RayTest(PHY_IPhysicsEnvironment* physics_environment, const MT_ return callback.m_hitFound; // Skip past the object and keep tracing. - // Note that retrieving in a single shot multiple hit points would be possible + // Note that retrieving in a single shot multiple hit points would be possible // but it would require some change in Bullet. prevpoint = callback.m_hitPoint; /* We add 0.001 of fudge, so that if the margin && radius == 0.0, we don't endless loop. */ @@ -110,7 +110,7 @@ bool KX_RayCast::RayTest(PHY_IPhysicsEnvironment* physics_environment, const MT_ if (h <= 0.01f) // the normal is almost orthogonal to the ray direction, cannot compute the other side break; - marg /= h; + marg /= h; frompoint = callback.m_hitPoint + marg * todir; // verify that we are not passed the to point if ((topoint - frompoint).dot(todir) < 0.f) diff --git a/source/gameengine/Ketsji/KX_RayCast.h b/source/gameengine/Ketsji/KX_RayCast.h index c977fb8f385..32531735de3 100644 --- a/source/gameengine/Ketsji/KX_RayCast.h +++ b/source/gameengine/Ketsji/KX_RayCast.h @@ -38,7 +38,7 @@ #include "MT_Point3.h" #include "MT_Vector3.h" -class RAS_MeshObject; +class RAS_MeshObject; struct KX_ClientObjectInfo; /** @@ -80,23 +80,23 @@ public: */ virtual bool RayHit(KX_ClientObjectInfo* client) = 0; - /** + /** * Callback wrapper. * * Construct with KX_RayCast::Callback(this, data) * and pass to KX_RayCast::RayTest */ template class Callback; - + /// Public interface. /// Implement bool RayHit in your class to receive ray callbacks. static bool RayTest( - PHY_IPhysicsEnvironment* physics_environment, - const MT_Point3& frompoint, - const MT_Point3& topoint, + PHY_IPhysicsEnvironment* physics_environment, + const MT_Point3& frompoint, + const MT_Point3& topoint, KX_RayCast& callback); - - + + #ifdef WITH_CXX_GUARDEDALLOC MEM_CXX_CLASS_ALLOC_FUNCS("GE:KX_RayCast") #endif @@ -119,7 +119,7 @@ public: data(_data) { } - + ~Callback() {} virtual bool RayHit(KX_ClientObjectInfo* client) @@ -130,7 +130,7 @@ public: virtual bool needBroadphaseRayCast(PHY_IPhysicsController* controller) { KX_ClientObjectInfo* info = static_cast(controller->GetNewClientInfo()); - + if (!info) { MT_assert(info && "Physics controller with no client object info"); @@ -138,12 +138,12 @@ public: } return self->NeedRayCast(info, data); } - - + + #ifdef WITH_CXX_GUARDEDALLOC MEM_CXX_CLASS_ALLOC_FUNCS("GE:KX_RayCast::Callback") #endif }; - + #endif diff --git a/source/gameengine/Ketsji/KX_RaySensor.cpp b/source/gameengine/Ketsji/KX_RaySensor.cpp index 4ffb5f332db..5e22bc9661f 100644 --- a/source/gameengine/Ketsji/KX_RaySensor.cpp +++ b/source/gameengine/Ketsji/KX_RaySensor.cpp @@ -79,7 +79,7 @@ void KX_RaySensor::Init() m_reset = true; } -KX_RaySensor::~KX_RaySensor() +KX_RaySensor::~KX_RaySensor() { /* Nothing to be done here. */ } @@ -103,7 +103,7 @@ bool KX_RaySensor::IsPositiveTrigger() if (m_invert) result = !result; - + return result; } @@ -148,7 +148,7 @@ bool KX_RaySensor::RayHit(KX_ClientObjectInfo *client, KX_RayCast *result, void m_hitNormal[0] = result->m_hitNormal[0]; m_hitNormal[1] = result->m_hitNormal[1]; m_hitNormal[2] = result->m_hitNormal[2]; - + m_hitMaterial = hitMaterial; } // no multi-hit search yet @@ -196,7 +196,7 @@ bool KX_RaySensor::Evaluate() { bool result = false; bool reset = m_reset && m_level; - m_rayHit = false; + m_rayHit = false; m_hitObject = NULL; m_hitPosition[0] = 0; m_hitPosition[1] = 0; @@ -205,12 +205,12 @@ bool KX_RaySensor::Evaluate() m_hitNormal[0] = 1; m_hitNormal[1] = 0; m_hitNormal[2] = 0; - + KX_GameObject* obj = (KX_GameObject*)GetParent(); MT_Point3 frompoint = obj->NodeGetWorldPosition(); MT_Matrix3x3 matje = obj->NodeGetWorldOrientation(); MT_Matrix3x3 invmat = matje.inverse(); - + MT_Vector3 todir; m_reset = false; switch (m_axis) @@ -271,16 +271,16 @@ bool KX_RaySensor::Evaluate() std::cout << "WARNING: Ray sensor " << GetName() << ": There is no physics environment!" << std::endl; std::cout << " Check universe for malfunction." << std::endl; return false; - } + } PHY_IPhysicsController *spc = obj->GetPhysicsController(); KX_GameObject *parent = obj->GetParent(); if (!spc && parent) spc = parent->GetPhysicsController(); - + PHY_IPhysicsEnvironment* physics_environment = this->m_scene->GetPhysicsEnvironment(); - + KX_RayCast::Callback callback(this, spc); KX_RayCast::RayTest(physics_environment, frompoint, topoint, callback); diff --git a/source/gameengine/Ketsji/KX_RaySensor.h b/source/gameengine/Ketsji/KX_RaySensor.h index 1901bb04f86..e84f29f38ac 100644 --- a/source/gameengine/Ketsji/KX_RaySensor.h +++ b/source/gameengine/Ketsji/KX_RaySensor.h @@ -81,9 +81,9 @@ public: /// \see KX_RayCast bool NeedRayCast(KX_ClientObjectInfo *client, void *UNUSED(data)); - virtual void Replace_IScene(SCA_IScene *val) - { - m_scene= static_cast(val); + virtual void Replace_IScene(SCA_IScene *val) + { + m_scene= static_cast(val); } //Python Interface @@ -96,12 +96,12 @@ public: KX_RAY_AXIS_NEG_Y = 4, KX_RAY_AXIS_NEG_Z = 5, }; - + #ifdef WITH_PYTHON /* Attributes */ static PyObject *pyattr_get_hitobject(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); - + #endif /* WITH_PYTHON */ }; diff --git a/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp b/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp index bb38d8269b7..9a94dccdd4e 100644 --- a/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp +++ b/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp @@ -38,7 +38,7 @@ #include "KX_SCA_AddObjectActuator.h" #include "SCA_IScene.h" #include "KX_GameObject.h" -#include "EXP_PyObjectPlus.h" +#include "EXP_PyObjectPlus.h" /* ------------------------------------------------------------------------- */ /* Native functions */ @@ -52,11 +52,11 @@ KX_SCA_AddObjectActuator::KX_SCA_AddObjectActuator(SCA_IObject *gameobj, bool linv_local, const float *angvel, bool angv_local) - : + : SCA_IActuator(gameobj, KX_ACT_ADD_OBJECT), m_OriginalObject(original), m_scene(scene), - + m_localLinvFlag(linv_local), m_localAngvFlag(angv_local) { @@ -72,17 +72,17 @@ KX_SCA_AddObjectActuator::KX_SCA_AddObjectActuator(SCA_IObject *gameobj, m_lastCreatedObject = NULL; m_timeProp = time; -} +} KX_SCA_AddObjectActuator::~KX_SCA_AddObjectActuator() -{ +{ if (m_OriginalObject) m_OriginalObject->UnregisterActuator(this); if (m_lastCreatedObject) m_lastCreatedObject->UnregisterActuator(this); -} +} @@ -91,26 +91,26 @@ bool KX_SCA_AddObjectActuator::Update() //bool result = false; /*unused*/ bool bNegativeEvent = IsNegativeEvent(); RemoveAllEvents(); - + if (bNegativeEvent) return false; // do nothing on negative events InstantAddObject(); - + return false; } -SCA_IObject* KX_SCA_AddObjectActuator::GetLastCreatedObject() const +SCA_IObject* KX_SCA_AddObjectActuator::GetLastCreatedObject() const { return m_lastCreatedObject; } -CValue* KX_SCA_AddObjectActuator::GetReplica() +CValue* KX_SCA_AddObjectActuator::GetReplica() { KX_SCA_AddObjectActuator* replica = new KX_SCA_AddObjectActuator(*this); @@ -215,18 +215,18 @@ int KX_SCA_AddObjectActuator::pyattr_set_object(void *self, const struct KX_PYAT { KX_SCA_AddObjectActuator* actuator = static_cast(self); KX_GameObject *gameobj; - + if (!ConvertPythonToGameObject(actuator->GetLogicManager(), value, &gameobj, true, "actuator.object = value: KX_SCA_AddObjectActuator")) return PY_SET_ATTR_FAIL; // ConvertPythonToGameObject sets the error - + if (actuator->m_OriginalObject != NULL) actuator->m_OriginalObject->UnregisterActuator(actuator); actuator->m_OriginalObject = (SCA_IObject*)gameobj; - + if (actuator->m_OriginalObject) actuator->m_OriginalObject->RegisterActuator(actuator); - + return PY_SET_ATTR_SUCCESS; } @@ -272,7 +272,7 @@ void KX_SCA_AddObjectActuator::InstantAddObject() m_lastCreatedObject->UnregisterActuator(this); m_lastCreatedObject = NULL; } - + m_lastCreatedObject = replica; // no reference //m_lastCreatedObject->AddRef(); diff --git a/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.h b/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.h index 976f3c58d68..8ab245b5df3 100644 --- a/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.h +++ b/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.h @@ -56,24 +56,24 @@ class KX_SCA_AddObjectActuator : public SCA_IActuator /// Object will be added to the following scene SCA_IScene* m_scene; - /// Linear velocity upon creation of the object. + /// Linear velocity upon creation of the object. float m_linear_velocity[3]; - /// Apply the velocity locally + /// Apply the velocity locally bool m_localLinvFlag; - - /// Angular velocity upon creation of the object. + + /// Angular velocity upon creation of the object. float m_angular_velocity[3]; - /// Apply the velocity locally - bool m_localAngvFlag; - - - - + /// Apply the velocity locally + bool m_localAngvFlag; + + + + SCA_IObject* m_lastCreatedObject; - + public: - /** + /** * This class also has the default constructors * available. Use with care! */ @@ -91,11 +91,11 @@ public: ~KX_SCA_AddObjectActuator(void); - CValue* + CValue* GetReplica( ); - virtual void + virtual void ProcessReplica(); virtual void Replace_IScene(SCA_IScene *val) @@ -103,13 +103,13 @@ public: m_scene= val; }; - virtual bool + virtual bool UnlinkObject(SCA_IObject* clientobj); - virtual void + virtual void Relink(CTR_Map *obj_map); - virtual bool + virtual bool Update(); SCA_IObject * @@ -125,7 +125,7 @@ public: static PyObject *pyattr_get_object(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef); static int pyattr_set_object(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); static PyObject *pyattr_get_objectLastCreated(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef); - + #endif /* WITH_PYTHON */ }; /* end of class KX_SCA_AddObjectActuator : public KX_EditObjectActuator */ diff --git a/source/gameengine/Ketsji/KX_SCA_DynamicActuator.cpp b/source/gameengine/Ketsji/KX_SCA_DynamicActuator.cpp index a4220424c6f..5593b16cc33 100644 --- a/source/gameengine/Ketsji/KX_SCA_DynamicActuator.cpp +++ b/source/gameengine/Ketsji/KX_SCA_DynamicActuator.cpp @@ -95,7 +95,7 @@ KX_SCA_DynamicActuator::KX_SCA_DynamicActuator(SCA_IObject *gameobj, KX_SCA_DynamicActuator::~KX_SCA_DynamicActuator() -{ +{ // there's nothing to be done here, really.... } /* end of destructor */ @@ -111,7 +111,7 @@ bool KX_SCA_DynamicActuator::Update() if (bNegativeEvent) return false; // do nothing on negative events - + if (!obj) return false; // object not accessible, shouldnt happen controller = obj->GetPhysicsController(); @@ -146,7 +146,7 @@ bool KX_SCA_DynamicActuator::Update() CValue* KX_SCA_DynamicActuator::GetReplica() { - KX_SCA_DynamicActuator* replica = + KX_SCA_DynamicActuator* replica = new KX_SCA_DynamicActuator(*this); if (replica == NULL) diff --git a/source/gameengine/Ketsji/KX_SCA_DynamicActuator.h b/source/gameengine/Ketsji/KX_SCA_DynamicActuator.h index 4eb337c54f5..6118ebd3559 100644 --- a/source/gameengine/Ketsji/KX_SCA_DynamicActuator.h +++ b/source/gameengine/Ketsji/KX_SCA_DynamicActuator.h @@ -56,11 +56,11 @@ class KX_SCA_DynamicActuator : public SCA_IActuator ~KX_SCA_DynamicActuator( ); - CValue* + CValue* GetReplica( ); - virtual bool + virtual bool Update(); //Python Interface @@ -71,6 +71,6 @@ class KX_SCA_DynamicActuator : public SCA_IActuator KX_DYN_DISABLE_RIGID_BODY, KX_DYN_SET_MASS, }; -}; +}; #endif diff --git a/source/gameengine/Ketsji/KX_SCA_EndObjectActuator.cpp b/source/gameengine/Ketsji/KX_SCA_EndObjectActuator.cpp index 81c9dc91603..34d45101a06 100644 --- a/source/gameengine/Ketsji/KX_SCA_EndObjectActuator.cpp +++ b/source/gameengine/Ketsji/KX_SCA_EndObjectActuator.cpp @@ -53,7 +53,7 @@ KX_SCA_EndObjectActuator::KX_SCA_EndObjectActuator(SCA_IObject *gameobj, KX_SCA_EndObjectActuator::~KX_SCA_EndObjectActuator() -{ +{ // there's nothing to be done here, really.... } /* end of destructor */ @@ -68,7 +68,7 @@ bool KX_SCA_EndObjectActuator::Update() if (bNegativeEvent) return false; // do nothing on negative events m_scene->DelayedRemoveObject(GetParent()); - + return false; } @@ -76,7 +76,7 @@ bool KX_SCA_EndObjectActuator::Update() CValue* KX_SCA_EndObjectActuator::GetReplica() { - KX_SCA_EndObjectActuator* replica = + KX_SCA_EndObjectActuator* replica = new KX_SCA_EndObjectActuator(*this); if (replica == NULL) return NULL; diff --git a/source/gameengine/Ketsji/KX_SCA_EndObjectActuator.h b/source/gameengine/Ketsji/KX_SCA_EndObjectActuator.h index 3399ed90667..aac4fa092f6 100644 --- a/source/gameengine/Ketsji/KX_SCA_EndObjectActuator.h +++ b/source/gameengine/Ketsji/KX_SCA_EndObjectActuator.h @@ -52,11 +52,11 @@ class KX_SCA_EndObjectActuator : public SCA_IActuator ~KX_SCA_EndObjectActuator(); - CValue* + CValue* GetReplica( ); - virtual bool + virtual bool Update(); virtual void Replace_IScene(SCA_IScene *val) @@ -67,7 +67,7 @@ class KX_SCA_EndObjectActuator : public SCA_IActuator /* --------------------------------------------------------------------- */ /* Python interface ---------------------------------------------------- */ /* --------------------------------------------------------------------- */ - + }; /* end of class KX_EditObjectActuator : public SCA_PropertyActuator */ #endif diff --git a/source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.cpp b/source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.cpp index 1bf76de0b40..2a071c221e4 100644 --- a/source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.cpp +++ b/source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.cpp @@ -43,7 +43,7 @@ #include "KX_SCA_ReplaceMeshActuator.h" #include "KX_MeshProxy.h" -#include "EXP_PyObjectPlus.h" +#include "EXP_PyObjectPlus.h" #ifdef WITH_PYTHON @@ -100,10 +100,10 @@ int KX_SCA_ReplaceMeshActuator::pyattr_set_mesh(void *self, const struct KX_PYAT { KX_SCA_ReplaceMeshActuator* actuator = static_cast(self); RAS_MeshObject* new_mesh; - + if (!ConvertPythonToMesh(actuator->GetLogicManager(), value, &new_mesh, true, "actuator.mesh = value: KX_SCA_ReplaceMeshActuator")) return PY_SET_ATTR_FAIL; - + actuator->m_mesh = new_mesh; return PY_SET_ATTR_SUCCESS; } @@ -138,7 +138,7 @@ KX_SCA_ReplaceMeshActuator::KX_SCA_ReplaceMeshActuator(SCA_IObject *gameobj, KX_SCA_ReplaceMeshActuator::~KX_SCA_ReplaceMeshActuator() -{ +{ // there's nothing to be done here, really.... } /* end of destructor */ @@ -163,7 +163,7 @@ bool KX_SCA_ReplaceMeshActuator::Update() CValue* KX_SCA_ReplaceMeshActuator::GetReplica() { - KX_SCA_ReplaceMeshActuator* replica = + KX_SCA_ReplaceMeshActuator* replica = new KX_SCA_ReplaceMeshActuator(*this); if (replica == NULL) diff --git a/source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.h b/source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.h index 4370b5d4a4f..52884d692c6 100644 --- a/source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.h +++ b/source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.h @@ -49,13 +49,13 @@ class KX_SCA_ReplaceMeshActuator : public SCA_IActuator // mesh reference (mesh to replace) RAS_MeshObject* m_mesh; SCA_IScene* m_scene; - bool m_use_gfx; + bool m_use_gfx; bool m_use_phys; public: KX_SCA_ReplaceMeshActuator( - SCA_IObject* gameobj, - RAS_MeshObject *mesh, + SCA_IObject* gameobj, + RAS_MeshObject *mesh, SCA_IScene* scene, bool use_gfx, bool use_phys @@ -64,11 +64,11 @@ class KX_SCA_ReplaceMeshActuator : public SCA_IActuator ~KX_SCA_ReplaceMeshActuator( ); - CValue* + CValue* GetReplica( ); - virtual bool + virtual bool Update(); void InstantReplaceMesh(); @@ -91,6 +91,6 @@ class KX_SCA_ReplaceMeshActuator : public SCA_IActuator #endif /* WITH_PYTHON */ -}; +}; #endif /* __KX_SCA_REPLACEMESHACTUATOR_H__ */ diff --git a/source/gameengine/Ketsji/KX_SG_BoneParentNodeRelationship.cpp b/source/gameengine/Ketsji/KX_SG_BoneParentNodeRelationship.cpp index 5a13cf5440d..038de1ead10 100644 --- a/source/gameengine/Ketsji/KX_SG_BoneParentNodeRelationship.cpp +++ b/source/gameengine/Ketsji/KX_SG_BoneParentNodeRelationship.cpp @@ -31,7 +31,7 @@ #include - + #include "KX_SG_BoneParentNodeRelationship.h" #include "MT_Matrix4x4.h" @@ -42,7 +42,7 @@ * Implementation of classes defined in KX_SG_BoneParentNodeRelationship.h */ -/** +/** * first of all KX_SG_BoneParentRelation */ @@ -61,7 +61,7 @@ UpdateChildCoordinates( bool& parentUpdated ) { MT_assert(child != NULL); - + // This way of accessing child coordinates is a bit cumbersome // be nice to have non constant reference access to these values. @@ -72,13 +72,13 @@ UpdateChildCoordinates( parentUpdated = true; // the childs world locations which we will update. - + MT_Vector3 child_w_scale; MT_Point3 child_w_pos; MT_Matrix3x3 child_w_rotation; - + bool valid_parent_transform = false; - + if (parent) { BL_ArmatureObject *armature = (BL_ArmatureObject*)(parent->GetSGClientObject()); @@ -88,34 +88,34 @@ UpdateChildCoordinates( if (armature->GetBoneMatrix(m_bone, parent_matrix)) { // Get the child's transform, and the bone matrix. - MT_Matrix4x4 child_transform ( - MT_Transform(child_pos + MT_Vector3(0.0f, armature->GetBoneLength(m_bone), 0.0f), + MT_Matrix4x4 child_transform ( + MT_Transform(child_pos + MT_Vector3(0.0f, armature->GetBoneLength(m_bone), 0.0f), child_rotation.scaled( - child_scale[0], - child_scale[1], + child_scale[0], + child_scale[1], child_scale[2]))); - + // The child's world transform is parent * child parent_matrix = parent->GetWorldTransform() * parent_matrix; child_transform = parent_matrix * child_transform; - + // Recompute the child transform components from the transform. - child_w_scale.setValue( + child_w_scale.setValue( MT_Vector3(child_transform[0][0], child_transform[0][1], child_transform[0][2]).length(), MT_Vector3(child_transform[1][0], child_transform[1][1], child_transform[1][2]).length(), MT_Vector3(child_transform[2][0], child_transform[2][1], child_transform[2][2]).length()); - child_w_rotation.setValue(child_transform[0][0], child_transform[0][1], child_transform[0][2], - child_transform[1][0], child_transform[1][1], child_transform[1][2], + child_w_rotation.setValue(child_transform[0][0], child_transform[0][1], child_transform[0][2], + child_transform[1][0], child_transform[1][1], child_transform[1][2], child_transform[2][0], child_transform[2][1], child_transform[2][2]); child_w_rotation.scale(1.0f/child_w_scale[0], 1.0f/child_w_scale[1], 1.0f/child_w_scale[2]); - + child_w_pos = MT_Point3(child_transform[0][3], child_transform[1][3], child_transform[2][3]); - + valid_parent_transform = true; } } - } - + } + if (valid_parent_transform) { child->SetWorldScale(child_w_scale); diff --git a/source/gameengine/Ketsji/KX_SG_BoneParentNodeRelationship.h b/source/gameengine/Ketsji/KX_SG_BoneParentNodeRelationship.h index 6f4fd482198..957d514246b 100644 --- a/source/gameengine/Ketsji/KX_SG_BoneParentNodeRelationship.h +++ b/source/gameengine/Ketsji/KX_SG_BoneParentNodeRelationship.h @@ -23,7 +23,7 @@ * Contributor(s): none yet. * * ***** END GPL LICENSE BLOCK ***** - * + * */ /** \file KX_SG_BoneParentNodeRelationship.h @@ -32,14 +32,14 @@ #ifndef __KX_SG_BONEPARENTNODERELATIONSHIP_H__ #define __KX_SG_BONEPARENTNODERELATIONSHIP_H__ - + #include "SG_Spatial.h" #include "SG_ParentRelation.h" struct Bone; /** - * Bone parent relationship parents a child SG_Spatial frame to a + * Bone parent relationship parents a child SG_Spatial frame to a * bone in an armature object. */ class KX_BoneParentRelation : public SG_ParentRelation @@ -54,7 +54,7 @@ public : * to a Blender struct Bone - this should be fixed if */ - static + static KX_BoneParentRelation * New(Bone* bone ); diff --git a/source/gameengine/Ketsji/KX_SG_NodeRelationships.cpp b/source/gameengine/Ketsji/KX_SG_NodeRelationships.cpp index e80de76861e..ea1c755b88e 100644 --- a/source/gameengine/Ketsji/KX_SG_NodeRelationships.cpp +++ b/source/gameengine/Ketsji/KX_SG_NodeRelationships.cpp @@ -36,7 +36,7 @@ * Implementation of classes defined in KX_SG_NodeRelationships.h */ -/** +/** * first of all KX_NormalParentRelation */ @@ -100,7 +100,7 @@ KX_NormalParentRelation( // nothing to do } -/** +/** * Next KX_VertexParentRelation */ @@ -111,8 +111,8 @@ New( ) { return new KX_VertexParentRelation(); } - -/** + +/** * Method inherited from KX_ParentRelation */ @@ -130,18 +130,18 @@ UpdateChildCoordinates( return false; child->SetWorldScale(child->GetLocalScale()); - + if (parent) child->SetWorldPosition(child->GetLocalPosition()+parent->GetWorldPosition()); else child->SetWorldPosition(child->GetLocalPosition()); - + child->SetWorldOrientation(child->GetLocalOrientation()); child->ClearModified(); return true; //parent != NULL; } -/** +/** * Method inherited from KX_ParentRelation */ @@ -178,7 +178,7 @@ New( return new KX_SlowParentRelation(relaxation); } -/** +/** * Method inherited from KX_ParentRelation */ @@ -199,11 +199,11 @@ UpdateChildCoordinates( const MT_Matrix3x3 & child_rotation = child->GetLocalOrientation(); // the childs world locations which we will update. - + MT_Vector3 child_w_scale; MT_Point3 child_w_pos; MT_Matrix3x3 child_w_rotation; - + if (parent) { // This is a slow parent relation @@ -220,7 +220,7 @@ UpdateChildCoordinates( child_n_scale = p_world_scale * child_scale; child_n_rotation = p_world_rotation * child_rotation; - child_n_pos = p_world_pos + p_world_scale * + child_n_pos = p_world_pos + p_world_scale * (p_world_rotation * child_pos); @@ -232,7 +232,7 @@ UpdateChildCoordinates( child_w_pos = child->GetWorldPosition(); child_w_rotation = child->GetWorldOrientation(); - // now 'interpolate' the normal coordinates with the last + // now 'interpolate' the normal coordinates with the last // world coordinates to get the new world coordinates. MT_Scalar weight = MT_Scalar(1)/(m_relax + 1); @@ -248,7 +248,7 @@ UpdateChildCoordinates( child_w_rotation = child_n_rotation; m_initialized = true; } - + } else { child_w_scale = child_scale; @@ -262,11 +262,11 @@ UpdateChildCoordinates( child->ClearModified(); // this node must always be updated, so reschedule it for next time child->ActivateRecheduleUpdateCallback(); - + return true; //parent != NULL; } -/** +/** * Method inherited from KX_ParentRelation */ diff --git a/source/gameengine/Ketsji/KX_SG_NodeRelationships.h b/source/gameengine/Ketsji/KX_SG_NodeRelationships.h index 5d777f5028f..3b2fdf0272b 100644 --- a/source/gameengine/Ketsji/KX_SG_NodeRelationships.h +++ b/source/gameengine/Ketsji/KX_SG_NodeRelationships.h @@ -23,20 +23,20 @@ * Contributor(s): none yet. * * ***** END GPL LICENSE BLOCK ***** - * + * */ - + /** \file KX_SG_NodeRelationships.h * \ingroup ketsji - * \section KX_SG_NodeRelationships - * This file provides common concrete implementations of + * \section KX_SG_NodeRelationships + * This file provides common concrete implementations of * SG_ParentRelation used by the game engine. These are * KX_SlowParentRelation a slow parent relationship. - * KX_NormalParentRelation a normal parent relationship where + * KX_NormalParentRelation a normal parent relationship where * orientation and position are inherited from the parent by * the child. - * KX_VertexParentRelation only location information is - * inherited by the child. + * KX_VertexParentRelation only location information is + * inherited by the child. */ #ifndef __KX_SG_NODERELATIONSHIPS_H__ @@ -54,12 +54,12 @@ public : * on the heap. */ - static + static KX_NormalParentRelation * New( ); - /** + /** * Method inherited from KX_ParentRelation */ @@ -70,10 +70,10 @@ public : bool& parentUpdated ); - /** + /** * Method inherited from KX_ParentRelation */ - + SG_ParentRelation * NewCopy( ); @@ -103,12 +103,12 @@ public : * on the heap. */ - static + static KX_VertexParentRelation * New( ); - /** + /** * Method inherited from KX_ParentRelation */ @@ -119,10 +119,10 @@ public : bool& parentUpdated ); - /** + /** * Method inherited from KX_ParentRelation */ - + SG_ParentRelation * NewCopy( ); @@ -132,7 +132,7 @@ public : bool IsVertexRelation( - ) { + ) { return true; } @@ -158,13 +158,13 @@ public : * on the heap. */ - static + static KX_SlowParentRelation * New( MT_Scalar relaxation ); - /** + /** * Method inherited from KX_ParentRelation */ @@ -175,10 +175,10 @@ public : bool& parentUpdated ); - /** + /** * Method inherited from KX_ParentRelation */ - + SG_ParentRelation * NewCopy( ); @@ -186,7 +186,7 @@ public : MT_Scalar GetTimeOffset( ) { return m_relax; } - + void SetTimeOffset( MT_Scalar relaxation @@ -194,10 +194,10 @@ public : ~KX_SlowParentRelation( ); - + bool IsSlowRelation( - ) { + ) { return true; } @@ -217,7 +217,7 @@ private : * time we update spatial data of the child. This is done * by just doing a normal parent relation the first time * UpdateChildCoordinates is called and then doing the - * slow parent relation + * slow parent relation */ bool m_initialized; diff --git a/source/gameengine/Ketsji/KX_ScalarInterpolator.h b/source/gameengine/Ketsji/KX_ScalarInterpolator.h index 5d8c3163376..ddb1eb68867 100644 --- a/source/gameengine/Ketsji/KX_ScalarInterpolator.h +++ b/source/gameengine/Ketsji/KX_ScalarInterpolator.h @@ -39,12 +39,12 @@ class KX_IScalarInterpolator; class KX_ScalarInterpolator : public KX_IInterpolator { public: - KX_ScalarInterpolator(MT_Scalar* target, + KX_ScalarInterpolator(MT_Scalar* target, KX_IScalarInterpolator *ipo) : m_target(target), m_ipo(ipo) {} - + virtual ~KX_ScalarInterpolator() {} virtual void Execute(float currentTime) const; void SetNewTarget(MT_Scalar* newtarget) diff --git a/source/gameengine/Ketsji/KX_ScalingInterpolator.h b/source/gameengine/Ketsji/KX_ScalingInterpolator.h index 52b6d0cf8cc..55dfb55f500 100644 --- a/source/gameengine/Ketsji/KX_ScalingInterpolator.h +++ b/source/gameengine/Ketsji/KX_ScalingInterpolator.h @@ -43,11 +43,11 @@ public: KX_IScalarInterpolator *ipos[]) : m_target(target) { - m_ipos[0] = ipos[0]; - m_ipos[1] = ipos[1]; + m_ipos[0] = ipos[0]; + m_ipos[1] = ipos[1]; m_ipos[2] = ipos[2]; } - + virtual void Execute(float currentTime) const; private: diff --git a/source/gameengine/Ketsji/KX_Scene.cpp b/source/gameengine/Ketsji/KX_Scene.cpp index b3061087344..ef5d1580181 100644 --- a/source/gameengine/Ketsji/KX_Scene.cpp +++ b/source/gameengine/Ketsji/KX_Scene.cpp @@ -150,7 +150,7 @@ KX_Scene::KX_Scene(class SCA_IInputDevice* keyboarddevice, class NG_NetworkDeviceInterface *ndi, const STR_String& sceneName, Scene *scene, - class RAS_ICanvas* canvas): + class RAS_ICanvas* canvas): PyObjectPlus(), m_keyboardmgr(NULL), m_mousemgr(NULL), @@ -182,11 +182,11 @@ KX_Scene::KX_Scene(class SCA_IInputDevice* keyboarddevice, m_animatedlist = new CListValue(); m_logicmgr = new SCA_LogicManager(); - + m_timemgr = new SCA_TimeEventManager(m_logicmgr); m_keyboardmgr = new SCA_KeyboardManager(m_logicmgr,keyboarddevice); m_mousemgr = new SCA_MouseManager(m_logicmgr,mousedevice, canvas); - + //SCA_AlwaysEventManager* alwaysmgr = new SCA_AlwaysEventManager(m_logicmgr); //SCA_PropertyEventManager* propmgr = new SCA_PropertyEventManager(m_logicmgr); SCA_ActuatorEventManager* actmgr = new SCA_ActuatorEventManager(m_logicmgr); @@ -195,8 +195,8 @@ KX_Scene::KX_Scene(class SCA_IInputDevice* keyboarddevice, //KX_RayEventManager* raymgr = new KX_RayEventManager(m_logicmgr); KX_NetworkEventManager* netmgr = new KX_NetworkEventManager(m_logicmgr, ndi); - - + + //m_logicmgr->RegisterEventManager(alwaysmgr); //m_logicmgr->RegisterEventManager(propmgr); @@ -220,11 +220,11 @@ KX_Scene::KX_Scene(class SCA_IInputDevice* keyboarddevice, MT_assert (m_networkDeviceInterface != NULL); m_networkScene = new NG_NetworkScene(m_networkDeviceInterface); - + m_rootnode = NULL; m_bucketmanager=new RAS_BucketManager(); - + bool showObstacleSimulation = (scene->gm.flag & GAME_SHOW_OBSTACLE_SIMULATION) != 0; switch (scene->gm.obstacleSimulation) { @@ -237,7 +237,7 @@ KX_Scene::KX_Scene(class SCA_IInputDevice* keyboarddevice, default: m_obstacleSimulation = NULL; } - + #ifdef WITH_PYTHON m_attr_dict = NULL; m_draw_call_pre = NULL; @@ -255,7 +255,7 @@ KX_Scene::~KX_Scene() // reference might be hanging and causing late release of objects RemoveAllDebugProperties(); - while (GetRootParentList()->GetCount() > 0) + while (GetRootParentList()->GetCount() > 0) { KX_GameObject* parentobj = (KX_GameObject*) GetRootParentList()->GetValue(0); this->RemoveObject(parentobj); @@ -269,13 +269,13 @@ KX_Scene::~KX_Scene() if (m_parentlist) m_parentlist->Release(); - + if (m_inactivelist) m_inactivelist->Release(); if (m_lightlist) m_lightlist->Release(); - + if (m_tempObjectList) m_tempObjectList->Release(); @@ -293,7 +293,7 @@ KX_Scene::~KX_Scene() if (m_networkScene) delete m_networkScene; - + if (m_bucketmanager) { delete m_bucketmanager; @@ -358,7 +358,7 @@ SCA_TimeEventManager* KX_Scene::GetTimeEventManager() - + list* KX_Scene::GetCameras() { return &m_cameras; @@ -370,12 +370,12 @@ void KX_Scene::SetFramingType(RAS_FrameSettings & frame_settings) }; /** - * Return a const reference to the framing + * Return a const reference to the framing * type set by the above call. * The contents are not guaranteed to be sensible * if you don't call the above function. */ -const RAS_FrameSettings& KX_Scene::GetFramingType() const +const RAS_FrameSettings& KX_Scene::GetFramingType() const { return m_frame_settings; }; @@ -383,7 +383,7 @@ const RAS_FrameSettings& KX_Scene::GetFramingType() const /** - * Store the current scene's viewport on the + * Store the current scene's viewport on the * game engine canvas. */ void KX_Scene::SetSceneViewport(const RAS_Rect &viewport) @@ -393,7 +393,7 @@ void KX_Scene::SetSceneViewport(const RAS_Rect &viewport) -const RAS_Rect& KX_Scene::GetSceneViewport() const +const RAS_Rect& KX_Scene::GetSceneViewport() const { return m_viewport; } @@ -458,7 +458,7 @@ void KX_Scene::AddObjectDebugProperties(class KX_GameObject* gameobj) if (prop->flag & PROP_DEBUG) AddDebugProperty(gameobj,STR_String(prop->name)); prop = prop->next; - } + } if (blenderobject->scaflag & OB_DEBUGSTATE) AddDebugProperty(gameobj,STR_String("__state__")); @@ -490,10 +490,10 @@ void KX_Scene::RemoveNodeDestructObject(class SG_IObject* node,class CValue* gam KX_GameObject* KX_Scene::AddNodeReplicaObject(class SG_IObject* node, class CValue* gameobj) { // for group duplication, limit the duplication of the hierarchy to the - // objects that are part of the group. + // objects that are part of the group. if (!IsObjectInGroup(gameobj)) return NULL; - + KX_GameObject* orgobj = (KX_GameObject*)gameobj; KX_GameObject* newobj = (KX_GameObject*)orgobj->GetReplica(); m_map_gameobject_to_replica.insert(orgobj, newobj); @@ -516,7 +516,7 @@ KX_GameObject* KX_Scene::AddNodeReplicaObject(class SG_IObject* node, class CVal else { m_rootnode = new SG_Node(newobj,this,KX_Scene::m_callbacks); - + // this fixes part of the scaling-added object bug SG_Node* orgnode = orgobj->GetSGNode(); m_rootnode->SetLocalScale(orgnode->GetLocalScale()); @@ -524,13 +524,13 @@ KX_GameObject* KX_Scene::AddNodeReplicaObject(class SG_IObject* node, class CVal m_rootnode->SetLocalOrientation(orgnode->GetLocalOrientation()); // define the relationship between this node and it's parent. - KX_NormalParentRelation * parent_relation = + KX_NormalParentRelation * parent_relation = KX_NormalParentRelation::New(); m_rootnode->SetParentRelation(parent_relation); newobj->SetSGNode(m_rootnode); } - + SG_IObject* replicanode = newobj->GetSGNode(); // SG_Node* rootnode = (replicanode == m_rootnode ? NULL : m_rootnode); @@ -551,7 +551,7 @@ KX_GameObject* KX_Scene::AddNodeReplicaObject(class SG_IObject* node, class CVal replicanode->RemoveAllControllers(); SGControllerList::iterator cit; //int numcont = scenegraphcontrollers.size(); - + for (cit = scenegraphcontrollers.begin();!(cit==scenegraphcontrollers.end());++cit) { // controller replication is quite complicated @@ -603,8 +603,8 @@ KX_GameObject* KX_Scene::AddNodeReplicaObject(class SG_IObject* node, class CVal // ! // It is VERY important that the order of sensors and actuators in // the replicated object is preserved: it is used to reconnect the logic. -// This method is more robust then using the bricks name in case of complex -// group replication. The replication of logic bricks is done in +// This method is more robust then using the bricks name in case of complex +// group replication. The replication of logic bricks is done in // SCA_IObject::ReParentLogic(), make sure it preserves the order of the bricks. void KX_Scene::ReplicateLogic(KX_GameObject* newobj) { @@ -628,14 +628,14 @@ void KX_Scene::ReplicateLogic(KX_GameObject* newobj) // do it directly on the list at this controller is not connected to anything at this stage cont->GetLinkedSensors().clear(); cont->GetLinkedActuators().clear(); - + // now relink each sensor for (vector::iterator its = linkedsensors.begin();!(its==linkedsensors.end());its++) { SCA_ISensor* oldsensor = (*its); SCA_IObject* oldsensorobj = oldsensor->GetParent(); SCA_IObject* newsensorobj = NULL; - + // the original owner of the sensor has been replicated? void **h_obj = m_map_gameobject_to_replica[oldsensorobj]; if (h_obj) @@ -657,7 +657,7 @@ void KX_Scene::ReplicateLogic(KX_GameObject* newobj) for (sensorpos=0, sit=sensorlist.begin(); sit!=sensorlist.end(); sit++, sensorpos++) { - if ((*sit) == oldsensor) + if ((*sit) == oldsensor) { newsensor = newsensorobj->GetSensors().at(sensorpos); break; @@ -667,7 +667,7 @@ void KX_Scene::ReplicateLogic(KX_GameObject* newobj) m_logicmgr->RegisterToSensor(cont,newsensor); } } - + // now relink each actuator for (vector::iterator ita = linkedactuators.begin();!(ita==linkedactuators.end());ita++) { @@ -697,7 +697,7 @@ void KX_Scene::ReplicateLogic(KX_GameObject* newobj) for (actuatorpos=0, ait=actuatorlist.begin(); ait!=actuatorlist.end(); ait++, actuatorpos++) { - if ((*ait) == oldactuator) + if ((*ait) == oldactuator) { newactuator = newactuatorobj->GetActuators().at(actuatorpos); break; @@ -732,13 +732,13 @@ void KX_Scene::DupliGroupRecurse(CValue* obj, int level) m_logicHierarchicalGameObjects.clear(); m_map_gameobject_to_replica.clear(); m_ueberExecutionPriority++; - // for groups will do something special: + // for groups will do something special: // we will force the creation of objects to those in the group only // Again, this is match what Blender is doing (it doesn't care of parent relationship) m_groupGameObjects.clear(); group = blgroupobj->dup_group; - for (go=(GroupObject*)group->gobject.first; go; go=(GroupObject*)go->next) + for (go=(GroupObject*)group->gobject.first; go; go=(GroupObject*)go->next) { Object* blenderobj = go->ob; if (blgroupobj == blenderobj) @@ -746,10 +746,10 @@ void KX_Scene::DupliGroupRecurse(CValue* obj, int level) continue; gameobj = (KX_GameObject*)m_logicmgr->FindGameObjByBlendObj(blenderobj); - if (gameobj == NULL) + if (gameobj == NULL) { // this object has not been converted!!! - // Should not happen as dupli group are created automatically + // Should not happen as dupli group are created automatically continue; } @@ -794,8 +794,8 @@ void KX_Scene::DupliGroupRecurse(CValue* obj, int level) } // don't replicate logic now: we assume that the objects in the group can have // logic relationship, even outside parent relationship - // In order to match 3D view, the position of groupobj is used as a - // transformation matrix instead of the new position. This means that + // In order to match 3D view, the position of groupobj is used as a + // transformation matrix instead of the new position. This means that // the group reference point is 0,0,0 // get the rootnode's scale @@ -804,7 +804,7 @@ void KX_Scene::DupliGroupRecurse(CValue* obj, int level) replica->NodeSetRelativeScale(newscale); MT_Point3 offset(group->dupli_ofs); - MT_Point3 newpos = groupobj->NodeGetWorldPosition() + + MT_Point3 newpos = groupobj->NodeGetWorldPosition() + newscale*(groupobj->NodeGetWorldOrientation() * (gameobj->NodeGetWorldPosition()-offset)); replica->NodeSetLocalPosition(newpos); // set the orientation after position for softbody! @@ -828,7 +828,7 @@ void KX_Scene::DupliGroupRecurse(CValue* obj, int level) { (*git)->ReParentLogic(); } - + // relink any pointers as necessary, sort of a temporary solution for (git = m_logicHierarchicalGameObjects.begin();!(git==m_logicHierarchicalGameObjects.end());++git) { @@ -843,7 +843,7 @@ void KX_Scene::DupliGroupRecurse(CValue* obj, int level) { ReplicateLogic((*git)); } - + // now look if object in the hierarchy have dupli group and recurse for (git = m_logicHierarchicalGameObjects.begin();!(git==m_logicHierarchicalGameObjects.end());++git) { @@ -947,7 +947,7 @@ SCA_IObject* KX_Scene::AddReplicaObject(class CValue* originalobject, { (*git)->ReParentLogic(); } - + // relink any pointers as necessary, sort of a temporary solution for (git = m_logicHierarchicalGameObjects.begin();!(git==m_logicHierarchicalGameObjects.end());++git) { @@ -968,7 +968,7 @@ SCA_IObject* KX_Scene::AddReplicaObject(class CValue* originalobject, { ReplicateLogic((*git)); } - + // check if there are objects with dupligroup in the hierarchy vector duplilist; for (git = m_logicHierarchicalGameObjects.begin();!(git==m_logicHierarchicalGameObjects.end());++git) @@ -1003,7 +1003,7 @@ void KX_Scene::RemoveObject(class CValue* gameobj) // recursively destruct node->Destruct(); } - //no need to do that: the object is destroyed and memory released + //no need to do that: the object is destroyed and memory released //newobj->SetSGNode(0); } @@ -1039,7 +1039,7 @@ int KX_Scene::NewRemoveObject(class CValue* gameobj) /* Invalidate the python reference, since the object may exist in script lists * its possible that it wont be automatically invalidated, so do it manually here, - * + * * if for some reason the object is added back into the scene python can always get a new Proxy */ newobj->InvalidateProxy(); @@ -1054,7 +1054,7 @@ int KX_Scene::NewRemoveObject(class CValue* gameobj) //GetPhysicsEnvironment()->RemovePhysicsController(gameobj->getPhysicsController()); // remove all sensors/controllers/actuators from logicsystem... - + SCA_SensorList& sensors = newobj->GetSensors(); for (SCA_SensorList::iterator its = sensors.begin(); !(its==sensors.end());its++) @@ -1103,7 +1103,7 @@ int KX_Scene::NewRemoveObject(class CValue* gameobj) KX_GameObject* group = newobj->GetDupliGroupObject(); if (group) group->RemoveInstanceObject(newobj); - + newobj->RemoveMeshes(); switch (newobj->GetGameObjectType()) { @@ -1146,9 +1146,9 @@ int KX_Scene::NewRemoveObject(class CValue* gameobj) if (m_sceneConverter) m_sceneConverter->UnregisterGameObject(newobj); #endif - + // return value will be 0 if the object is actually deleted (all reference gone) - + return ret; } @@ -1168,18 +1168,18 @@ void KX_Scene::ReplaceMesh(class CValue* obj,void* meshobj, bool use_gfx, bool u { gameobj->RemoveMeshes(); gameobj->AddMesh(mesh); - + if (gameobj->m_isDeformable) { BL_DeformableGameObject* newobj = static_cast( gameobj ); - + if (newobj->GetDeformer()) { delete newobj->GetDeformer(); newobj->SetDeformer(NULL); } - if (mesh->GetMesh()) + if (mesh->GetMesh()) { // we must create a new deformer but which one? KX_GameObject* parentobj = newobj->GetParent(); @@ -1192,7 +1192,7 @@ void KX_Scene::ReplaceMesh(class CValue* obj,void* meshobj, bool use_gfx, bool u bool bHasModifier = BL_ModifierDeformer::HasCompatibleDeformer(blendobj); bool bHasShapeKey = blendmesh->key != NULL && blendmesh->key->type==KEY_RELATIVE; bool bHasDvert = blendmesh->dvert != NULL; - bool bHasArmature = + bool bHasArmature = BL_ModifierDeformer::HasArmatureDeformer(blendobj) && parentobj && // current parent is armature parentobj->GetGameObjectType() == SCA_IObject::OBJ_ARMATURE && @@ -1203,14 +1203,14 @@ void KX_Scene::ReplaceMesh(class CValue* obj,void* meshobj, bool use_gfx, bool u #ifdef WITH_BULLET bool bHasSoftBody = (!parentobj && (blendobj->gameflag & OB_SOFT_BODY)); #endif - + if (oldblendobj==NULL) { if (bHasModifier || bHasShapeKey || bHasDvert || bHasArmature) { std::cout << "warning: ReplaceMesh() new mesh is not used in an object from the current scene, you will get incorrect behavior" << std::endl; bHasShapeKey= bHasDvert= bHasArmature=bHasModifier= false; } } - + if (bHasModifier) { BL_ModifierDeformer* modifierDeformer; @@ -1241,7 +1241,7 @@ void KX_Scene::ReplaceMesh(class CValue* obj,void* meshobj, bool use_gfx, bool u } else if (bHasShapeKey) { BL_ShapeDeformer* shapeDeformer; - if (bHasArmature) + if (bHasArmature) { shapeDeformer = new BL_ShapeDeformer( newobj, @@ -1266,7 +1266,7 @@ void KX_Scene::ReplaceMesh(class CValue* obj,void* meshobj, bool use_gfx, bool u } newobj->SetDeformer( shapeDeformer); } - else if (bHasArmature) + else if (bHasArmature) { BL_SkinDeformer* skinDeformer = new BL_SkinDeformer( newobj, @@ -1368,7 +1368,7 @@ void KX_Scene::SetActiveCamera(KX_Camera* cam) if (!FindCamera(cam)) { AddCamera(cam); if (cam) std::cout << "Added cam " << cam->GetName() << std::endl; - } + } m_active_camera = cam; } @@ -1397,9 +1397,9 @@ void KX_Scene::MarkVisible(SG_Tree *node, RAS_IRasterizer* rasty, KX_Camera* cam { MT_Scalar radius = node->Radius(); MT_Point3 center = node->Center(); - - intersect = cam->SphereInsideFrustum(center, radius); - + + intersect = cam->SphereInsideFrustum(center, radius); + if (intersect == KX_Camera::INTERSECT) { MT_Point3 box[8]; @@ -1437,7 +1437,7 @@ void KX_Scene::MarkSubTreeVisible(SG_Tree *node, RAS_IRasterizer* rasty, bool vi if (visible) { int nummeshes = gameobj->GetMeshCount(); - + // this adds the vertices to the display list for (int m=0;mGetMesh(m))->SchedulePolygons(rasty->GetDrawingMode()); @@ -1458,7 +1458,7 @@ void KX_Scene::MarkVisible(RAS_IRasterizer* rasty, KX_GameObject* gameobj,KX_Cam // User (Python/Actuator) has forced object invisible... if (!gameobj->GetSGNode() || !gameobj->GetVisible()) return; - + // Shadow lamp layers if (layer && !(gameobj->GetLayer() & layer)) { gameobj->SetCulled(true); @@ -1468,13 +1468,13 @@ void KX_Scene::MarkVisible(RAS_IRasterizer* rasty, KX_GameObject* gameobj,KX_Cam // If Frustum culling is off, the object is always visible. bool vis = !cam->GetFrustumCulling(); - + // If the camera is inside this node, then the object is visible. if (!vis) { vis = gameobj->GetSGNode()->inside( cam->GetCameraLocation() ); } - + // Test the object's bound sphere against the view frustum. if (!vis) { @@ -1491,16 +1491,16 @@ void KX_Scene::MarkVisible(RAS_IRasterizer* rasty, KX_GameObject* gameobj,KX_Cam case KX_Camera::INTERSECT: // Test the object's bound box against the view frustum. MT_Point3 box[8]; - gameobj->GetSGNode()->getBBox(box); + gameobj->GetSGNode()->getBBox(box); vis = cam->BoxInsideFrustum(box) != KX_Camera::OUTSIDE; break; } } - + if (vis) { int nummeshes = gameobj->GetMeshCount(); - + for (int m=0;mGetCount() - 1; - + for (int i = lastobj; i >= 0; i--) { CValue* objval = m_tempObjectList->GetValue(i); CFloatValue* propval = (CFloatValue*) objval->GetProperty("::timebomb"); - + if (propval) { float timeleft = (float)(propval->GetNumber() - 1.0/KX_KetsjiEngine::GetTicRate()); - + if (timeleft > 0) { propval->SetFloat(timeleft); @@ -1811,23 +1811,23 @@ int KX_Scene::GetLodHysteresisValue(void) return m_lodHysteresisValue; } -void KX_Scene::UpdateObjectActivity(void) +void KX_Scene::UpdateObjectActivity(void) { if (m_activity_culling) { /* determine the activity criterium and set objects accordingly */ int i=0; - + MT_Point3 camloc = GetActiveCamera()->NodeGetWorldPosition(); //GetCameraLocation(); - + for (i=0;iGetCount();i++) { KX_GameObject* ob = (KX_GameObject*) GetObjectList()->GetValue(i); - + if (!ob->GetIgnoreActivityCulling()) { /* Simple test: more than 10 away from the camera, count * Manhattan distance. */ MT_Point3 obpos = ob->NodeGetWorldPosition(); - + if ((fabsf(camloc[0] - obpos[0]) > m_activity_box_radius) || (fabsf(camloc[1] - obpos[1]) > m_activity_box_radius) || (fabsf(camloc[2] - obpos[2]) > m_activity_box_radius) ) @@ -1848,7 +1848,7 @@ void KX_Scene::SetActivityCullingRadius(float f) f = 0.5f; m_activity_box_radius = f; } - + NG_NetworkDeviceInterface* KX_Scene::GetNetworkDeviceInterface() { return m_networkDeviceInterface; @@ -1897,7 +1897,7 @@ void KX_Scene::SetPhysicsEnvironment(class PHY_IPhysicsEnvironment* physEnv) m_logicmgr->RegisterEventManager(touchmgr); } } - + void KX_Scene::setSuspendedTime(double suspendedtime) { m_suspendedtime = suspendedtime; @@ -2147,7 +2147,7 @@ bool KX_Scene::MergeScene(KX_Scene *other) for (unsigned int i= 0; i < times.size(); i++) { timemgr->AddTimeProperty(times[i]); } - + } return true; } @@ -2209,10 +2209,10 @@ PyMethodDef KX_Scene::Methods[] = { KX_PYMETHODTABLE(KX_Scene, resume), KX_PYMETHODTABLE(KX_Scene, drawObstacleSimulation), - + /* dict style access */ KX_PYMETHODTABLE(KX_Scene, get), - + {NULL,NULL} //Sentinel }; static PyObject *Map_GetItem(PyObject *self_v, PyObject *item) @@ -2220,7 +2220,7 @@ static PyObject *Map_GetItem(PyObject *self_v, PyObject *item) KX_Scene* self = static_castBGE_PROXY_REF(self_v); const char *attr_str= _PyUnicode_AsString(item); PyObject *pyconvert; - + if (self == NULL) { PyErr_SetString(PyExc_SystemError, "val = scene[key]: KX_Scene, " BGE_PROXY_ERROR_MSG); return NULL; @@ -2228,9 +2228,9 @@ static PyObject *Map_GetItem(PyObject *self_v, PyObject *item) if (!self->m_attr_dict) self->m_attr_dict = PyDict_New(); - + if (self->m_attr_dict && (pyconvert=PyDict_GetItem(self->m_attr_dict, item))) { - + if (attr_str) PyErr_Clear(); Py_INCREF(pyconvert); @@ -2241,7 +2241,7 @@ static PyObject *Map_GetItem(PyObject *self_v, PyObject *item) else PyErr_SetString(PyExc_KeyError, "value = scene[key]: KX_Scene, key does not exist"); return NULL; } - + } static int Map_SetItem(PyObject *self_v, PyObject *key, PyObject *val) @@ -2250,7 +2250,7 @@ static int Map_SetItem(PyObject *self_v, PyObject *key, PyObject *val) const char *attr_str= _PyUnicode_AsString(key); if (attr_str==NULL) PyErr_Clear(); - + if (self == NULL) { PyErr_SetString(PyExc_SystemError, "scene[key] = value: KX_Scene, " BGE_PROXY_ERROR_MSG); return -1; @@ -2261,10 +2261,10 @@ static int Map_SetItem(PyObject *self_v, PyObject *key, PyObject *val) if (val==NULL) { /* del ob["key"] */ int del= 0; - + if (self->m_attr_dict) del |= (PyDict_DelItem(self->m_attr_dict, key)==0) ? 1:0; - + if (del==0) { if (attr_str) PyErr_Format(PyExc_KeyError, "scene[key] = value: KX_Scene, key \"%s\" could not be set", attr_str); else PyErr_SetString(PyExc_KeyError, "del scene[key]: KX_Scene, key could not be deleted"); @@ -2279,25 +2279,25 @@ static int Map_SetItem(PyObject *self_v, PyObject *key, PyObject *val) if (self->m_attr_dict==NULL) /* lazy init */ self->m_attr_dict= PyDict_New(); - - + + if (PyDict_SetItem(self->m_attr_dict, key, val)==0) set= 1; else PyErr_SetString(PyExc_KeyError, "scene[key] = value: KX_Scene, key not be added to internal dictionary"); - + if (set==0) return -1; /* pythons error value */ - + } - + return 0; /* success */ } static int Seq_Contains(PyObject *self_v, PyObject *value) { KX_Scene* self = static_castBGE_PROXY_REF(self_v); - + if (self == NULL) { PyErr_SetString(PyExc_SystemError, "val in scene: KX_Scene, " BGE_PROXY_ERROR_MSG); return -1; @@ -2308,7 +2308,7 @@ static int Seq_Contains(PyObject *self_v, PyObject *value) if (self->m_attr_dict && PyDict_GetItem(self->m_attr_dict, value)) return 1; - + return 0; } @@ -2374,18 +2374,18 @@ PyObject *KX_Scene::pyattr_get_cameras(void *self_v, const KX_PYATTRIBUTE_DEF *a * the new CListValue is owned by python, so its possible python holds onto it longer then the BGE * however this is the same with "scene.objects + []", when you make a copy by adding lists. */ - + KX_Scene* self = static_cast(self_v); CListValue* clist = new CListValue(); - + /* return self->GetCameras()->GetProxy(); */ - + list::iterator it = self->GetCameras()->begin(); while (it != self->GetCameras()->end()) { clist->Add((*it)->AddRef()); it++; } - + return clist->NewProxy(true); } @@ -2404,10 +2404,10 @@ int KX_Scene::pyattr_set_active_camera(void *self_v, const KX_PYATTRIBUTE_DEF *a { KX_Scene* self = static_cast(self_v); KX_Camera *camOb; - + if (!ConvertPythonToCamera(value, &camOb, false, "scene.active_camera = value: KX_Scene")) return PY_SET_ATTR_FAIL; - + self->SetActiveCamera(camOb); return PY_SET_ATTR_SUCCESS; } @@ -2552,7 +2552,7 @@ KX_PYMETHODDEF_DOC(KX_Scene, addObject, return NULL; } SCA_IObject *replica = AddReplicaObject((SCA_IObject*)ob, reference, time); - + // release here because AddReplicaObject AddRef's // the object is added to the scene so we don't want python to own a reference replica->Release(); @@ -2563,9 +2563,9 @@ KX_PYMETHODDEF_DOC(KX_Scene, end, "end()\n" "Removes this scene from the game.\n") { - + KX_GetActiveEngine()->RemoveScene(m_sceneName); - + Py_RETURN_NONE; } @@ -2574,7 +2574,7 @@ KX_PYMETHODDEF_DOC(KX_Scene, restart, "Restarts this scene.\n") { KX_GetActiveEngine()->ReplaceScene(m_sceneName, m_sceneName); - + Py_RETURN_NONE; } @@ -2584,13 +2584,13 @@ KX_PYMETHODDEF_DOC(KX_Scene, replace, "Return True if the new scene exists and scheduled for replacement, False otherwise.\n") { char* name; - + if (!PyArg_ParseTuple(args, "s:replace", &name)) return NULL; - + if (KX_GetActiveEngine()->ReplaceScene(m_sceneName, name)) Py_RETURN_TRUE; - + Py_RETURN_FALSE; } @@ -2599,7 +2599,7 @@ KX_PYMETHODDEF_DOC(KX_Scene, suspend, "Suspends this scene.\n") { Suspend(); - + Py_RETURN_NONE; } @@ -2608,7 +2608,7 @@ KX_PYMETHODDEF_DOC(KX_Scene, resume, "Resumes this scene.\n") { Resume(); - + Py_RETURN_NONE; } @@ -2631,12 +2631,12 @@ KX_PYMETHODDEF_DOC(KX_Scene, get, "") if (!PyArg_ParseTuple(args, "O|O:get", &key, &def)) return NULL; - + if (m_attr_dict && (ret=PyDict_GetItem(m_attr_dict, key))) { Py_INCREF(ret); return ret; } - + Py_INCREF(def); return def; } diff --git a/source/gameengine/Ketsji/KX_Scene.h b/source/gameengine/Ketsji/KX_Scene.h index 6d8ae8a321b..d548d1e4892 100644 --- a/source/gameengine/Ketsji/KX_Scene.h +++ b/source/gameengine/Ketsji/KX_Scene.h @@ -121,7 +121,7 @@ protected: /** * The list of objects which have been removed during the - * course of one frame. They are actually destroyed in + * course of one frame. They are actually destroyed in * LogicEndFrame() via a call to RemoveObject(). */ CListValue* m_euthanasyobjects; @@ -131,7 +131,7 @@ protected: CListValue* m_lightlist; CListValue* m_inactivelist; // all objects that are not in the active layer CListValue* m_animatedlist; // all animated objects - + SG_QList m_sghead; // list of nodes that needs scenegraph update // the Dlist is not object that must be updated // the Qlist is for objects that needs to be rescheduled @@ -180,7 +180,7 @@ protected: * The name of the scene */ STR_String m_sceneName; - + /** * stores the world-settings for a scene */ @@ -217,23 +217,23 @@ protected: /** * Another temporary variable outstaying its welcome - * used in AddReplicaObject to keep a record of all added - * objects. Logic can only be updated when all objects + * used in AddReplicaObject to keep a record of all added + * objects. Logic can only be updated when all objects * have been updated. This stores a list of the new objects. */ std::vector m_logicHierarchicalGameObjects; - + /** - * This temporary variable will contain the list of + * This temporary variable will contain the list of * object that can be added during group instantiation. - * objects outside this list will not be added (can + * objects outside this list will not be added (can * happen with children that are outside the group). * Used in AddReplicaObject. If the list is empty, it * means don't care. */ std::set m_groupGameObjects; - - /** + + /** * Pointer to system variable passed in in constructor * only used in constructor so we do not need to keep it * around in this class. @@ -261,15 +261,15 @@ protected: * Toggle to enable or disable activity culling. */ bool m_activity_culling; - + /** * Toggle to enable or disable culling via DBVT broadphase of Bullet. */ bool m_dbvt_culling; - + /** * Occlusion culling resolution - */ + */ int m_dbvt_occlusion_res; /** @@ -278,12 +278,12 @@ protected: RAS_FrameSettings m_frame_settings; - /** + /** * This scenes viewport into the game engine * canvas.Maintained externally, initially [0,0] -> [0,0] */ RAS_Rect m_viewport; - + /** * Visibility testing functions. */ @@ -331,8 +331,8 @@ public: void UpdateParents(double curtime); void DupliGroupRecurse(CValue* gameobj, int level); bool IsObjectInGroup(CValue* gameobj) - { - return (m_groupGameObjects.empty() || + { + return (m_groupGameObjects.empty() || m_groupGameObjects.find(gameobj) != m_groupGameObjects.end()); } void AddObjectDebugProperties(class KX_GameObject* gameobj); @@ -346,7 +346,7 @@ public: void RemoveObject(CValue* gameobj); void RemoveDupliGroup(CValue *gameobj); void DelayedRemoveObject(CValue* gameobj); - + int NewRemoveObject(CValue* gameobj); void ReplaceMesh(CValue* gameobj, void* meshob, bool use_gfx, bool use_phys); @@ -396,13 +396,13 @@ public: /** Font Routines */ /** Find a font in the scene by pointer. */ - KX_FontObject* + KX_FontObject* FindFont( KX_FontObject* ); /** Add a camera to this scene. */ - void + void AddFont( KX_FontObject* ); @@ -417,22 +417,22 @@ public: std::list* GetCameras( ); - + /** Find a camera in the scene by pointer. */ - KX_Camera* + KX_Camera* FindCamera( KX_Camera* ); /** Find a scene in the scene by name. */ - KX_Camera* + KX_Camera* FindCamera( STR_String& ); /** Add a camera to this scene. */ - void + void AddCamera( KX_Camera* ); @@ -442,7 +442,7 @@ public: GetActiveCamera( ); - /** + /** * Set this camera to be the active camera in the scene. If the * camera is not present in the camera list, it will be added */ @@ -505,7 +505,7 @@ public: ); /** - * Return a const reference to the framing + * Return a const reference to the framing * type set by the above call. * The contents are not guaranteed to be sensible * if you don't call the above function. @@ -517,18 +517,18 @@ public: ) const; /** - * Store the current scene's viewport on the + * Store the current scene's viewport on the * game engine canvas. */ void SetSceneViewport(const RAS_Rect &viewport); /** * Get the current scene's viewport on the - * game engine canvas. This maintained + * game engine canvas. This maintained * externally in KX_GameEngine */ const RAS_Rect& GetSceneViewport() const; - + /** * \section Accessors to different scenes of this scene */ @@ -550,7 +550,7 @@ public: static SG_Callbacks m_callbacks; const STR_String& GetName(); - + // Suspend the entire scene. void Suspend(); @@ -565,7 +565,7 @@ public: bool IsActivedLodHysteresis(); void SetLodHysteresisValue(int hysteresisvalue); int GetLodHysteresisValue(); - + // Update the activity box settings for objects in this scene, if needed. void UpdateObjectActivity(void); @@ -584,7 +584,7 @@ public: bool GetDbvtCulling() { return m_dbvt_culling; } void SetDbvtOcclusionRes(int i) { m_dbvt_occlusion_res = i; } int GetDbvtOcclusionRes() { return m_dbvt_occlusion_res; } - + void SetSceneConverter(class KX_BlenderSceneConverter* sceneConverter); class PHY_IPhysicsEnvironment* GetPhysicsEnvironment() @@ -598,7 +598,7 @@ public: MT_Vector3 GetGravity(); short GetAnimationFPS(); - + /** * Sets the node tree for this scene. */ @@ -646,7 +646,7 @@ public: static int pyattr_set_gravity(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); virtual PyObject *py_repr(void) { return PyUnicode_From_STR_String(GetName()); } - + /* getitem/setitem */ static PyMappingMethods Mapping; static PySequenceMethods Sequence; @@ -655,7 +655,7 @@ public: * Run the registered python drawing functions. */ void RunDrawingCallbacks(PyObject *cb_list); - + PyObject *GetPreDrawCB() { return m_draw_call_pre; } PyObject *GetPostDrawCB() { return m_draw_call_post; } PyObject *GetPreDrawSetupCB() { return m_draw_setup_call_pre; } @@ -663,16 +663,16 @@ public: /** * Sets the time the scene was suspended - */ + */ void setSuspendedTime(double suspendedtime); /** * Returns the "curtime" the scene was suspended - */ + */ double getSuspendedTime(); /** * Sets the difference between the local time of the scene (when it * was running and not suspended) and the "curtime" - */ + */ void setSuspendedDelta(double suspendeddelta); /** * Returns the difference between the local time of the scene (when it diff --git a/source/gameengine/Ketsji/KX_SceneActuator.cpp b/source/gameengine/Ketsji/KX_SceneActuator.cpp index 6fe33fd2f63..2bef9237bb4 100644 --- a/source/gameengine/Ketsji/KX_SceneActuator.cpp +++ b/source/gameengine/Ketsji/KX_SceneActuator.cpp @@ -44,7 +44,7 @@ /* Native functions */ /* ------------------------------------------------------------------------- */ -KX_SceneActuator::KX_SceneActuator(SCA_IObject *gameobj, +KX_SceneActuator::KX_SceneActuator(SCA_IObject *gameobj, int mode, KX_Scene *scene, KX_KetsjiEngine* ketsjiEngine, @@ -64,7 +64,7 @@ KX_SceneActuator::KX_SceneActuator(SCA_IObject *gameobj, KX_SceneActuator::~KX_SceneActuator() -{ +{ if (m_camera) m_camera->UnregisterActuator(this); } /* end of destructor */ @@ -142,10 +142,10 @@ bool KX_SceneActuator::Update() default: break; } - + if (!m_nextSceneName.Length()) return false; - + switch (m_mode) { case KX_SCENE_SET_SCENE: @@ -183,7 +183,7 @@ bool KX_SceneActuator::Update() default: ; /* do nothing? this is an internal error !!! */ } - + return false; } @@ -261,7 +261,7 @@ PyObject *KX_SceneActuator::pyattr_get_camera(void *self, const struct KX_PYATTR KX_SceneActuator* actuator = static_cast(self); if (!actuator->m_camera) Py_RETURN_NONE; - + return actuator->m_camera->GetProxy(); } @@ -269,13 +269,13 @@ int KX_SceneActuator::pyattr_set_camera(void *self, const struct KX_PYATTRIBUTE_ { KX_SceneActuator* actuator = static_cast(self); KX_Camera *camOb; - + if (!ConvertPythonToCamera(value, &camOb, true, "actu.camera = value: KX_SceneActuator")) return PY_SET_ATTR_FAIL; - + if (actuator->m_camera) actuator->m_camera->UnregisterActuator(actuator); - + if (camOb==NULL) { actuator->m_camera= NULL; } @@ -283,7 +283,7 @@ int KX_SceneActuator::pyattr_set_camera(void *self, const struct KX_PYATTRIBUTE_ actuator->m_camera = camOb; actuator->m_camera->RegisterActuator(actuator); } - + return PY_SET_ATTR_SUCCESS; } diff --git a/source/gameengine/Ketsji/KX_SceneActuator.h b/source/gameengine/Ketsji/KX_SceneActuator.h index 389e9208ef3..c83a0a3a11c 100644 --- a/source/gameengine/Ketsji/KX_SceneActuator.h +++ b/source/gameengine/Ketsji/KX_SceneActuator.h @@ -39,7 +39,7 @@ class KX_SceneActuator : public SCA_IActuator { Py_Header - + int m_mode; // (restart) has become a toggle internally... not in the interface though bool m_restart; @@ -49,7 +49,7 @@ class KX_SceneActuator : public SCA_IActuator class KX_KetsjiEngine* m_KetsjiEngine; /** The scene to switch to. */ STR_String m_nextSceneName; - + // (Set Camera) Object class KX_Camera* m_camera; @@ -57,7 +57,7 @@ class KX_SceneActuator : public SCA_IActuator class KX_Scene* FindScene(const char* sceneName); /** Is this a valid camera? */ class KX_Camera* FindCamera(const char* cameraName); - + public: enum SCA_SceneActuatorMode { @@ -72,7 +72,7 @@ class KX_SceneActuator : public SCA_IActuator KX_SCENE_RESUME, KX_SCENE_MAX }; - + KX_SceneActuator(SCA_IObject* gameobj, int mode, KX_Scene* scene, @@ -87,7 +87,7 @@ class KX_SceneActuator : public SCA_IActuator virtual void Relink(CTR_Map *obj_map); virtual bool Update(); - + #ifdef WITH_PYTHON virtual void Replace_IScene(SCA_IScene *val) @@ -98,7 +98,7 @@ class KX_SceneActuator : public SCA_IActuator /* --------------------------------------------------------------------- */ /* Python interface ---------------------------------------------------- */ /* --------------------------------------------------------------------- */ - + static PyObject *pyattr_get_camera(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef); static int pyattr_set_camera(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); diff --git a/source/gameengine/Ketsji/KX_SoundActuator.cpp b/source/gameengine/Ketsji/KX_SoundActuator.cpp index 64aab31ba22..13549148993 100644 --- a/source/gameengine/Ketsji/KX_SoundActuator.cpp +++ b/source/gameengine/Ketsji/KX_SoundActuator.cpp @@ -172,7 +172,7 @@ bool KX_SoundActuator::Update(double curtime, bool frame) // do nothing on negative events, otherwise sounds are played twice! bool bNegativeEvent = IsNegativeEvent(); bool bPositiveEvent = m_posevent; - + RemoveAllEvents(); if (!m_sound) @@ -221,10 +221,10 @@ bool KX_SoundActuator::Update(double curtime, bool frame) // remember that we tried to stop the actuator m_isplaying = false; } - + #if 1 // Warning: when de-activating the actuator, after a single negative event this runs again with... - // m_posevent==false && m_posevent==false, in this case IsNegativeEvent() returns false + // m_posevent==false && m_posevent==false, in this case IsNegativeEvent() returns false // and assumes this is a positive event. // check that we actually have a positive event so as not to play sounds when being disabled. else if (bPositiveEvent) /* <- added since 2.49 */ @@ -506,7 +506,7 @@ int KX_SoundActuator::pyattr_set_3d_property(void *self, const struct KX_PYATTRI } else { return PY_SET_ATTR_FAIL; } - + return PY_SET_ATTR_SUCCESS; } diff --git a/source/gameengine/Ketsji/KX_StateActuator.cpp b/source/gameengine/Ketsji/KX_StateActuator.cpp index d918f87c4bf..870540669c9 100644 --- a/source/gameengine/Ketsji/KX_StateActuator.cpp +++ b/source/gameengine/Ketsji/KX_StateActuator.cpp @@ -38,7 +38,7 @@ KX_StateActuator::KX_StateActuator( SCA_IObject* gameobj, int operation, unsigned int mask - ) + ) : SCA_IActuator(gameobj, KX_ACT_STATE), m_operation(operation), m_mask(mask) @@ -79,9 +79,9 @@ KX_StateActuator::Update() if (bNegativeEvent) return false; KX_GameObject *obj = (KX_GameObject*) GetParent(); - + objMask = obj->GetState(); - switch (m_operation) + switch (m_operation) { case OP_CPY: objMask = m_mask; diff --git a/source/gameengine/Ketsji/KX_StateActuator.h b/source/gameengine/Ketsji/KX_StateActuator.h index 5ed065d3604..e62127cab62 100644 --- a/source/gameengine/Ketsji/KX_StateActuator.h +++ b/source/gameengine/Ketsji/KX_StateActuator.h @@ -39,7 +39,7 @@ /* * Use of SG_DList : element of actuator being deactivated * Head: SCA_LogicManager::m_removedActuators - * Use of SG_QList : element of global activated state actuator list + * Use of SG_QList : element of global activated state actuator list * Head: KX_StateActuator::m_stateActuatorHead */ class KX_StateActuator : public SCA_IActuator @@ -64,7 +64,7 @@ class KX_StateActuator : public SCA_IActuator int m_mask; public: - + KX_StateActuator( SCA_IObject* gameobj, int operation, diff --git a/source/gameengine/Ketsji/KX_SteeringActuator.cpp b/source/gameengine/Ketsji/KX_SteeringActuator.cpp index d3a7b665e61..a57b7e9c5f0 100644 --- a/source/gameengine/Ketsji/KX_SteeringActuator.cpp +++ b/source/gameengine/Ketsji/KX_SteeringActuator.cpp @@ -82,7 +82,7 @@ KX_SteeringActuator::KX_SteeringActuator(SCA_IObject *gameobj, m_navmesh->RegisterActuator(this); if (m_target) m_target->RegisterActuator(this); - + if (m_simulation) m_obstacle = m_simulation->GetObstacle((KX_GameObject*)gameobj); KX_GameObject* parent = ((KX_GameObject*)gameobj)->GetParent(); @@ -92,7 +92,7 @@ KX_SteeringActuator::KX_SteeringActuator(SCA_IObject *gameobj, } else m_parentlocalmat.setIdentity(); -} +} KX_SteeringActuator::~KX_SteeringActuator() { @@ -100,7 +100,7 @@ KX_SteeringActuator::~KX_SteeringActuator() m_navmesh->UnregisterActuator(this); if (m_target) m_target->UnregisterActuator(this); -} +} CValue* KX_SteeringActuator::GetReplica() { @@ -166,7 +166,7 @@ bool KX_SteeringActuator::Update(double curtime, bool frame) { double delta = curtime - m_updateTime; m_updateTime = curtime; - + if (m_posevent && !m_isActive) { delta = 0.0; @@ -222,7 +222,7 @@ bool KX_SteeringActuator::Update(double curtime, bool frame) static const MT_Scalar WAYPOINT_RADIUS(0.25f); - if (m_pathUpdateTime<0 || (m_pathUpdatePeriod>=0 && + if (m_pathUpdateTime<0 || (m_pathUpdatePeriod>=0 && curtime - m_pathUpdateTime>((double)m_pathUpdatePeriod/1000.0))) { m_pathUpdateTime = curtime; @@ -248,7 +248,7 @@ bool KX_SteeringActuator::Update(double curtime, bool frame) m_steerVec = waypoint - mypos; apply_steerforce = true; - + if (m_enableVisualization) { //debug draw @@ -256,7 +256,7 @@ bool KX_SteeringActuator::Update(double curtime, bool frame) m_navmesh->DrawPath(m_path, m_pathLen, PATH_COLOR); } } - + } break; } @@ -308,7 +308,7 @@ bool KX_SteeringActuator::Update(double curtime, bool frame) m_obstacle->dvel[0] = 0.f; m_obstacle->dvel[1] = 0.f; } - + } if (terminate && m_isSelfTerminated) @@ -428,7 +428,7 @@ void KX_SteeringActuator::HandleActorFace(MT_Vector3& velocity) MT_Vector3 up(0,0,1); MT_Vector3 left; MT_Matrix3x3 mat; - + if (m_navmesh && m_normalUp) { dtStatNavMesh* navmesh = m_navmesh->GetNavMesh(); @@ -489,16 +489,16 @@ void KX_SteeringActuator::HandleActorFace(MT_Vector3& velocity) } mat.setValue ( - left[0], dir[0],up[0], + left[0], dir[0],up[0], left[1], dir[1],up[1], left[2], dir[2],up[2] ); - - + + KX_GameObject* parentObject = curobj->GetParent(); if (parentObject) - { + { MT_Point3 localpos; localpos = curobj->GetSGNode()->GetLocalPosition(); MT_Matrix3x3 parentmatinv; diff --git a/source/gameengine/Ketsji/KX_SteeringActuator.h b/source/gameengine/Ketsji/KX_SteeringActuator.h index 3273471c166..4cdf5777da9 100644 --- a/source/gameengine/Ketsji/KX_SteeringActuator.h +++ b/source/gameengine/Ketsji/KX_SteeringActuator.h @@ -50,7 +50,7 @@ class KX_SteeringActuator : public SCA_IActuator float m_acceleration; float m_turnspeed; KX_ObstacleSimulation* m_simulation; - + double m_updateTime; KX_Obstacle* m_obstacle; bool m_isActive; @@ -79,10 +79,10 @@ public: KX_SteeringActuator(class SCA_IObject* gameobj, int mode, - KX_GameObject *target, + KX_GameObject *target, KX_GameObject *navmesh, float distance, - float velocity, + float velocity, float acceleration, float turnspeed, bool isSelfTerminated, @@ -114,7 +114,7 @@ public: static PyObject *pyattr_get_navmesh(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef); static int pyattr_set_navmesh(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); static PyObject *pyattr_get_steeringVec(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef); - + #endif /* WITH_PYTHON */ diff --git a/source/gameengine/Ketsji/KX_TimeCategoryLogger.h b/source/gameengine/Ketsji/KX_TimeCategoryLogger.h index e097454fca7..d27cd42c255 100644 --- a/source/gameengine/Ketsji/KX_TimeCategoryLogger.h +++ b/source/gameengine/Ketsji/KX_TimeCategoryLogger.h @@ -116,9 +116,9 @@ public: virtual double GetAverage(void); protected: - /** + /** * Disposes loggers. - */ + */ virtual void DisposeLoggers(void); /** Storage for the loggers. */ diff --git a/source/gameengine/Ketsji/KX_TimeLogger.cpp b/source/gameengine/Ketsji/KX_TimeLogger.cpp index 12106245c4d..9693a4a3de0 100644 --- a/source/gameengine/Ketsji/KX_TimeLogger.cpp +++ b/source/gameengine/Ketsji/KX_TimeLogger.cpp @@ -32,8 +32,8 @@ #include "KX_TimeLogger.h" -KX_TimeLogger::KX_TimeLogger(unsigned int maxNumMeasurements) : - m_maxNumMeasurements(maxNumMeasurements), +KX_TimeLogger::KX_TimeLogger(unsigned int maxNumMeasurements) : + m_maxNumMeasurements(maxNumMeasurements), m_logStart(0), m_logging(false) { diff --git a/source/gameengine/Ketsji/KX_TouchEventManager.cpp b/source/gameengine/Ketsji/KX_TouchEventManager.cpp index 7f167652464..ecaceb9c0ed 100644 --- a/source/gameengine/Ketsji/KX_TouchEventManager.cpp +++ b/source/gameengine/Ketsji/KX_TouchEventManager.cpp @@ -59,14 +59,14 @@ bool KX_TouchEventManager::NewHandleCollision(void* object1, void* object2, cons PHY_IPhysicsController* obj1 = static_cast(object1); PHY_IPhysicsController* obj2 = static_cast(object2); - + m_newCollisions.insert(NewCollision(obj1, obj2, coll_data)); - + return false; } -bool KX_TouchEventManager::newCollisionResponse(void *client_data, +bool KX_TouchEventManager::newCollisionResponse(void *client_data, void *object1, void *object2, const PHY_CollData *coll_data) @@ -76,7 +76,7 @@ bool KX_TouchEventManager::newCollisionResponse(void *client_data, return false; } -bool KX_TouchEventManager::newBroadphaseResponse(void *client_data, +bool KX_TouchEventManager::newBroadphaseResponse(void *client_data, void *object1, void *object2, const PHY_CollData *coll_data) @@ -118,13 +118,13 @@ bool KX_TouchEventManager::newBroadphaseResponse(void *client_data, break; case KX_ClientObjectInfo::OBSENSOR: case KX_ClientObjectInfo::OBACTORSENSOR: - // this object may have multiple collision sensors, + // this object may have multiple collision sensors, // check is any of them is interested in this object for (std::list::iterator it = info1->m_sensors.begin(); it != info1->m_sensors.end(); ++it) { - if ((*it)->GetSensorType() == SCA_ISensor::ST_TOUCH) + if ((*it)->GetSensorType() == SCA_ISensor::ST_TOUCH) { KX_TouchSensor* touchsensor = static_cast(*it); if (touchsensor->BroadPhaseSensorFilterCollision(object1, object2)) @@ -178,7 +178,7 @@ void KX_TouchEventManager::NextFrame() SG_DList::iterator it(m_sensors); for (it.begin();!it.end();++it) (*it)->SynchronizeTransform(); - + for (std::set::iterator cit = m_newCollisions.begin(); cit != m_newCollisions.end(); ++cit) { // Controllers @@ -215,9 +215,9 @@ void KX_TouchEventManager::NextFrame() delete cit->colldata; } - + m_newCollisions.clear(); - + for (it.begin();!it.end();++it) (*it)->Activate(m_logicmgr); } diff --git a/source/gameengine/Ketsji/KX_TouchEventManager.h b/source/gameengine/Ketsji/KX_TouchEventManager.h index d9c6fdad307..916a55ba3c9 100644 --- a/source/gameengine/Ketsji/KX_TouchEventManager.h +++ b/source/gameengine/Ketsji/KX_TouchEventManager.h @@ -69,29 +69,29 @@ class KX_TouchEventManager : public SCA_EventManager }; PHY_IPhysicsEnvironment* m_physEnv; - + std::set m_newCollisions; - - - static bool newCollisionResponse(void *client_data, + + + static bool newCollisionResponse(void *client_data, void *object1, void *object2, const PHY_CollData *coll_data); - static bool newBroadphaseResponse(void *client_data, + static bool newBroadphaseResponse(void *client_data, void *object1, void *object2, const PHY_CollData *coll_data); virtual bool NewHandleCollision(void* obj1,void* obj2, - const PHY_CollData * coll_data); + const PHY_CollData * coll_data); public: - KX_TouchEventManager(class SCA_LogicManager* logicmgr, + KX_TouchEventManager(class SCA_LogicManager* logicmgr, PHY_IPhysicsEnvironment* physEnv); virtual void NextFrame(); virtual void EndFrame(); @@ -100,7 +100,7 @@ public: SCA_LogicManager* GetLogicManager() { return m_logicmgr;} PHY_IPhysicsEnvironment *GetPhysicsEnvironment() { return m_physEnv; } - + #ifdef WITH_CXX_GUARDEDALLOC MEM_CXX_CLASS_ALLOC_FUNCS("GE:KX_TouchEventManager") #endif diff --git a/source/gameengine/Ketsji/KX_TouchSensor.cpp b/source/gameengine/Ketsji/KX_TouchSensor.cpp index 593d3e844e8..d5598164eb0 100644 --- a/source/gameengine/Ketsji/KX_TouchSensor.cpp +++ b/source/gameengine/Ketsji/KX_TouchSensor.cpp @@ -87,10 +87,10 @@ bool KX_TouchSensor::Evaluate() if (reset) // force an event result = true; - + if (m_bTouchPulse) { /* pulse on changes to the colliders */ int count = m_colliders->GetCount(); - + if (m_bLastCount!=count || m_bColliderHash!=m_bLastColliderHash) { m_bLastCount = count; m_bLastColliderHash= m_bColliderHash; @@ -110,16 +110,16 @@ m_hitMaterial("") { // KX_TouchEventManager* touchmgr = (KX_TouchEventManager*) eventmgr; // m_resptable = touchmgr->GetResponseTable(); - + // m_solidHandle = m_sumoObj->getObjectHandle(); m_colliders = new CListValue(); - + KX_ClientObjectInfo *client_info = gameobj->getClientInfo(); //client_info->m_gameobject = gameobj; //client_info->m_auxilary_info = NULL; client_info->m_sensors.push_back(this); - + m_physCtrl = gameobj->GetPhysicsController(); MT_assert( !gameobj->GetPhysicsController() || m_physCtrl ); Init(); @@ -142,7 +142,7 @@ KX_TouchSensor::~KX_TouchSensor() m_colliders->Release(); } -CValue* KX_TouchSensor::GetReplica() +CValue* KX_TouchSensor::GetReplica() { KX_TouchSensor* replica = new KX_TouchSensor(*this); replica->ProcessReplica(); @@ -162,12 +162,12 @@ void KX_TouchSensor::ReParent(SCA_IObject* parent) PHY_IPhysicsController *sphy = ((KX_GameObject*)parent)->GetPhysicsController(); if (sphy) m_physCtrl = sphy; - + // m_solidHandle = m_sumoObj->getObjectHandle(); KX_ClientObjectInfo *client_info = gameobj->getClientInfo(); //client_info->m_gameobject = gameobj; //client_info->m_auxilary_info = NULL; - + client_info->m_sensors.push_back(this); SCA_ISensor::ReParent(parent); } @@ -217,7 +217,7 @@ bool KX_TouchSensor::BroadPhaseSensorFilterCollision(void*obj1,void*obj2) (my_client_info->m_type == KX_ClientObjectInfo::OBACTORSENSOR && client_info->m_type != KX_ClientObjectInfo::ACTOR)) // only with actor objects return false; - + bool found = m_touchedpropname.IsEmpty(); if (!found) { @@ -244,21 +244,21 @@ bool KX_TouchSensor::NewHandleCollision(void*object1,void*object2,const PHY_Coll KX_GameObject* parent = (KX_GameObject*)GetParent(); // need the mapping from PHY_IPhysicsController to gameobjects now - - KX_ClientObjectInfo *client_info = static_cast (object1 == m_physCtrl? + + KX_ClientObjectInfo *client_info = static_cast (object1 == m_physCtrl? ((PHY_IPhysicsController*)object2)->GetNewClientInfo(): ((PHY_IPhysicsController*)object1)->GetNewClientInfo()); - KX_GameObject* gameobj = ( client_info ? - client_info->m_gameobject : + KX_GameObject* gameobj = ( client_info ? + client_info->m_gameobject : NULL); - - // add the same check as in SCA_ISensor::Activate(), + + // add the same check as in SCA_ISensor::Activate(), // we don't want to record collision when the sensor is not active. if (m_links && !m_suspended && gameobj && (gameobj != parent) && client_info->isActor()) { - + bool found = m_touchedpropname.IsEmpty(); bool hitMaterial = false; if (!found) @@ -283,7 +283,7 @@ bool KX_TouchSensor::NewHandleCollision(void*object1,void*object2,const PHY_Coll { if (!m_colliders->SearchValue(gameobj)) { m_colliders->Add(gameobj->AddRef()); - + if (m_bTouchPulse) m_bColliderHash += (uint_ptr)(static_cast(&gameobj)); } @@ -292,8 +292,8 @@ bool KX_TouchSensor::NewHandleCollision(void*object1,void*object2,const PHY_Coll m_hitMaterial = hitMaterial; //printf("KX_TouchSensor::HandleCollision\n"); } - - } + + } return false; // was DT_CONTINUE but this was defined in sumo as false. } @@ -344,7 +344,7 @@ PyAttributeDef KX_TouchSensor::Attributes[] = { PyObject *KX_TouchSensor::pyattr_get_object_hit(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) { KX_TouchSensor* self = static_cast(self_v); - + if (self->m_hitObject) return self->m_hitObject->GetProxy(); else diff --git a/source/gameengine/Ketsji/KX_TouchSensor.h b/source/gameengine/Ketsji/KX_TouchSensor.h index e1b5725a32b..68ac6ffcc6d 100644 --- a/source/gameengine/Ketsji/KX_TouchSensor.h +++ b/source/gameengine/Ketsji/KX_TouchSensor.h @@ -59,7 +59,7 @@ protected: STR_String m_touchedpropname; bool m_bFindMaterial; bool m_bTouchPulse; /* changes in the colliding objects trigger pulses */ - + class PHY_IPhysicsController* m_physCtrl; bool m_bCollision; @@ -74,7 +74,7 @@ protected: SCA_IObject* m_hitObject; class CListValue* m_colliders; STR_String m_hitMaterial; - + public: KX_TouchSensor(class SCA_EventManager* eventmgr, class KX_GameObject* gameobj, @@ -89,7 +89,7 @@ public: virtual bool Evaluate(); virtual void Init(); virtual void ReParent(SCA_IObject* parent); - + virtual void RegisterSumo(KX_TouchEventManager* touchman); virtual void UnregisterSumo(KX_TouchEventManager* touchman); virtual void UnregisterToManager(); @@ -107,14 +107,14 @@ public: virtual bool BroadPhaseFilterCollision(void*obj1,void*obj2) { return true; } virtual bool BroadPhaseSensorFilterCollision(void*obj1,void*obj2); virtual sensortype GetSensorType() { return ST_TOUCH; } - + virtual bool IsPositiveTrigger() { bool result = m_bTriggered; if (m_invert) result = !result; return result; } - + virtual void EndFrame(); class PHY_IPhysicsController* GetPhysicsController() { return m_physCtrl; } @@ -127,12 +127,12 @@ public: /* --------------------------------------------------------------------- */ /* Python interface ---------------------------------------------------- */ /* --------------------------------------------------------------------- */ - + static PyObject* pyattr_get_object_hit(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); static PyObject* pyattr_get_object_hit_list(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); #endif - + }; #endif /* __KX_TOUCHSENSOR_H__ */ diff --git a/source/gameengine/Ketsji/KX_TrackToActuator.cpp b/source/gameengine/Ketsji/KX_TrackToActuator.cpp index a8fa9b0815d..e720af06acb 100644 --- a/source/gameengine/Ketsji/KX_TrackToActuator.cpp +++ b/source/gameengine/Ketsji/KX_TrackToActuator.cpp @@ -50,7 +50,7 @@ /* Native functions */ /* ------------------------------------------------------------------------- */ -KX_TrackToActuator::KX_TrackToActuator(SCA_IObject *gameobj, +KX_TrackToActuator::KX_TrackToActuator(SCA_IObject *gameobj, SCA_IObject *ob, int time, bool allow3D, @@ -64,15 +64,15 @@ KX_TrackToActuator::KX_TrackToActuator(SCA_IObject *gameobj, m_trackflag = trackflag; m_upflag = upflag; m_parentobj = 0; - + if (m_object) m_object->RegisterActuator(this); { // if the object is vertex parented, don't check parent orientation as the link is broken if (!((KX_GameObject*)gameobj)->IsVertexParent()) { - m_parentobj = ((KX_GameObject*)gameobj)->GetParent(); // check if the object is parented - if (m_parentobj) { + m_parentobj = ((KX_GameObject*)gameobj)->GetParent(); // check if the object is parented + if (m_parentobj) { // if so, store the initial local rotation // this is needed to revert the effect of the parent inverse node (TBC) m_parentlocalmat = m_parentobj->GetSGNode()->GetLocalOrientation(); @@ -91,26 +91,26 @@ static MT_Matrix3x3 EulToMat3(float eul[3]) { MT_Matrix3x3 mat; float ci, cj, ch, si, sj, sh, cc, cs, sc, ss; - + ci = cosf(eul[0]); cj = cosf(eul[1]); ch = cosf(eul[2]); si = sinf(eul[0]); sj = sinf(eul[1]); sh = sinf(eul[2]); - cc = ci*ch; - cs = ci*sh; - sc = si*ch; + cc = ci*ch; + cs = ci*sh; + sc = si*ch; ss = si*sh; - mat[0][0] = cj*ch; - mat[1][0] = sj*sc-cs; + mat[0][0] = cj*ch; + mat[1][0] = sj*sc-cs; mat[2][0] = sj*cc+ss; - mat[0][1] = cj*sh; - mat[1][1] = sj*ss+cc; + mat[0][1] = cj*sh; + mat[1][1] = sj*ss+cc; mat[2][1] = sj*cs-sc; - mat[0][2] = -sj; - mat[1][2] = cj*si; + mat[0][2] = -sj; + mat[1][2] = cj*si; mat[2][2] = cj*ci; return mat; @@ -141,7 +141,7 @@ static void Mat3ToEulOld(MT_Matrix3x3 mat, float eul[3]) static void compatible_eulFast(float *eul, float *oldrot) { float dx, dy, dz; - + /* angular difference of 360 degrees */ dx = eul[0] - oldrot[0]; @@ -168,11 +168,11 @@ static MT_Matrix3x3 matrix3x3_interpol(MT_Matrix3x3 oldmat, MT_Matrix3x3 mat, in Mat3ToEulOld(oldmat, oldeul); Mat3ToEulOld(mat, eul); compatible_eulFast(eul, oldeul); - + 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); } @@ -322,13 +322,13 @@ bool KX_TrackToActuator::Update(double curtime, bool frame) mat = vectomat(dir, m_trackflag, m_upflag, m_allow3D); oldmat = curobj->NodeGetWorldOrientation(); - + /* erwin should rewrite this! */ mat = matrix3x3_interpol(oldmat, mat, m_time); - + /* check if the model is parented and calculate the child transform */ if (m_parentobj) { - + MT_Point3 localpos; localpos = curobj->GetSGNode()->GetLocalPosition(); // Get the inverse of the parent matrix @@ -410,18 +410,18 @@ int KX_TrackToActuator::pyattr_set_object(void *self, const struct KX_PYATTRIBUT { KX_TrackToActuator* actuator = static_cast(self); KX_GameObject *gameobj; - + if (!ConvertPythonToGameObject(actuator->GetLogicManager(), value, &gameobj, true, "actuator.object = value: KX_TrackToActuator")) return PY_SET_ATTR_FAIL; // ConvertPythonToGameObject sets the error - + if (actuator->m_object != NULL) actuator->m_object->UnregisterActuator(actuator); actuator->m_object = (SCA_IObject*) gameobj; - + if (actuator->m_object) actuator->m_object->RegisterActuator(actuator); - + return PY_SET_ATTR_SUCCESS; } diff --git a/source/gameengine/Ketsji/KX_TrackToActuator.h b/source/gameengine/Ketsji/KX_TrackToActuator.h index 124014eede2..697785c4f59 100644 --- a/source/gameengine/Ketsji/KX_TrackToActuator.h +++ b/source/gameengine/Ketsji/KX_TrackToActuator.h @@ -49,7 +49,7 @@ class KX_TrackToActuator : public SCA_IActuator int m_time; int m_trackflag; int m_upflag; - + MT_Matrix3x3 m_parentlocalmat; KX_GameObject* m_parentobj; @@ -90,7 +90,7 @@ class KX_TrackToActuator : public SCA_IActuator /* These are used to get and set m_ob */ static PyObject *pyattr_get_object(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef); static int pyattr_set_object(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); - + #endif /* WITH_PYTHON */ }; /* end of class KX_TrackToActuator : public KX_EditObjectActuator */ diff --git a/source/gameengine/Ketsji/KX_VehicleWrapper.cpp b/source/gameengine/Ketsji/KX_VehicleWrapper.cpp index ddae645802c..27ad8c6f685 100644 --- a/source/gameengine/Ketsji/KX_VehicleWrapper.cpp +++ b/source/gameengine/Ketsji/KX_VehicleWrapper.cpp @@ -73,13 +73,13 @@ static bool raise_exc_wheel(PHY_IVehicle *vehicle, int i, const char *method) PyObject *KX_VehicleWrapper::PyAddWheel(PyObject *args) { - + PyObject *pylistPos,*pylistDir,*pylistAxleDir; PyObject *wheelGameObject; float suspensionRestLength,wheelRadius; int hasSteering; - + if (PyArg_ParseTuple(args,"OOOOffi:addWheel",&wheelGameObject,&pylistPos,&pylistDir,&pylistAxleDir,&suspensionRestLength,&wheelRadius,&hasSteering)) { KX_GameObject *gameOb; @@ -107,7 +107,7 @@ PyObject *KX_VehicleWrapper::PyAddWheel(PyObject *args) //someone reverse some conventions inside Bullet (axle winding) attachAxle = -attachAxle; - + if (wheelRadius <= 0) { PyErr_SetString(PyExc_AttributeError, "addWheel(...) Unable to add wheel. wheelRadius must be positive."); @@ -117,7 +117,7 @@ PyObject *KX_VehicleWrapper::PyAddWheel(PyObject *args) PHY_IMotionState *motionState = new KX_MotionState(gameOb->GetSGNode()); m_vehicle->AddWheel(motionState,attachPos,attachDir,attachAxle,suspensionRestLength,wheelRadius,hasSteering); } - + } else { return NULL; } @@ -127,7 +127,7 @@ PyObject *KX_VehicleWrapper::PyAddWheel(PyObject *args) PyObject *KX_VehicleWrapper::PyGetWheelPosition(PyObject *args) { - + int wheelIndex; if (PyArg_ParseTuple(args,"i:getWheelPosition",&wheelIndex)) diff --git a/source/gameengine/Ketsji/KX_VehicleWrapper.h b/source/gameengine/Ketsji/KX_VehicleWrapper.h index 22b9591f48b..259ca7cc1ba 100644 --- a/source/gameengine/Ketsji/KX_VehicleWrapper.h +++ b/source/gameengine/Ketsji/KX_VehicleWrapper.h @@ -23,16 +23,16 @@ public: KX_VehicleWrapper(PHY_IVehicle* vehicle,class PHY_IPhysicsEnvironment* physenv); virtual ~KX_VehicleWrapper (); int getConstraintId(); - + #ifdef WITH_PYTHON - + KX_PYMETHOD_VARARGS(KX_VehicleWrapper,AddWheel); KX_PYMETHOD_VARARGS(KX_VehicleWrapper,GetNumWheels); KX_PYMETHOD_VARARGS(KX_VehicleWrapper,GetWheelOrientationQuaternion); KX_PYMETHOD_VARARGS(KX_VehicleWrapper,GetWheelRotation); - + KX_PYMETHOD_VARARGS(KX_VehicleWrapper,GetWheelPosition); - + KX_PYMETHOD_VARARGS(KX_VehicleWrapper,GetConstraintId); KX_PYMETHOD_VARARGS(KX_VehicleWrapper,GetConstraintType); @@ -45,11 +45,11 @@ public: KX_PYMETHOD_VARARGS(KX_VehicleWrapper,SetTyreFriction); KX_PYMETHOD_VARARGS(KX_VehicleWrapper,SetSuspensionStiffness); - + KX_PYMETHOD_VARARGS(KX_VehicleWrapper,SetSuspensionDamping); - + KX_PYMETHOD_VARARGS(KX_VehicleWrapper,SetSuspensionCompression); - + KX_PYMETHOD_VARARGS(KX_VehicleWrapper,SetRollInfluence); #endif /* WITH_PYTHON */ diff --git a/source/gameengine/Ketsji/KX_VertexProxy.cpp b/source/gameengine/Ketsji/KX_VertexProxy.cpp index 40f4c462801..2733f774663 100644 --- a/source/gameengine/Ketsji/KX_VertexProxy.cpp +++ b/source/gameengine/Ketsji/KX_VertexProxy.cpp @@ -183,7 +183,7 @@ PyObject *KX_VertexProxy::pyattr_get_UV(void *self_v, const KX_PYATTRIBUTE_DEF * PyObject *KX_VertexProxy::pyattr_get_uvs(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) { KX_VertexProxy* self= static_cast(self_v); - + PyObject* uvlist = PyList_New(RAS_TexVert::MAX_UNIT); for (int i=0; im_mesh->SetMeshModified(true); return PY_SET_ATTR_SUCCESS; } diff --git a/source/gameengine/Ketsji/KX_VertexProxy.h b/source/gameengine/Ketsji/KX_VertexProxy.h index 8070825ad11..ce4cb1f8343 100644 --- a/source/gameengine/Ketsji/KX_VertexProxy.h +++ b/source/gameengine/Ketsji/KX_VertexProxy.h @@ -96,7 +96,7 @@ public: KX_PYMETHOD_O(KX_VertexProxy,SetXYZ); KX_PYMETHOD_NOARGS(KX_VertexProxy,GetUV1); KX_PYMETHOD_O(KX_VertexProxy,SetUV1); - + KX_PYMETHOD_NOARGS(KX_VertexProxy,GetUV2); KX_PYMETHOD_VARARGS(KX_VertexProxy,SetUV2); diff --git a/source/gameengine/Ketsji/KX_VisibilityActuator.cpp b/source/gameengine/Ketsji/KX_VisibilityActuator.cpp index 6f689e228b9..1136dea041b 100644 --- a/source/gameengine/Ketsji/KX_VisibilityActuator.cpp +++ b/source/gameengine/Ketsji/KX_VisibilityActuator.cpp @@ -39,7 +39,7 @@ KX_VisibilityActuator::KX_VisibilityActuator( bool visible, bool occlusion, bool recursive - ) + ) : SCA_IActuator(gameobj, KX_ACT_VISIBILITY), m_visible(visible), m_occlusion(occlusion), @@ -69,12 +69,12 @@ bool KX_VisibilityActuator::Update() { bool bNegativeEvent = IsNegativeEvent(); - + RemoveAllEvents(); if (bNegativeEvent) return false; KX_GameObject *obj = (KX_GameObject*) GetParent(); - + obj->SetVisible(m_visible, m_recursive); obj->SetOccluder(m_occlusion, m_recursive); obj->UpdateBuckets(m_recursive); diff --git a/source/gameengine/Ketsji/KX_VisibilityActuator.h b/source/gameengine/Ketsji/KX_VisibilityActuator.h index a207844db74..8368ab2555d 100644 --- a/source/gameengine/Ketsji/KX_VisibilityActuator.h +++ b/source/gameengine/Ketsji/KX_VisibilityActuator.h @@ -45,7 +45,7 @@ class KX_VisibilityActuator : public SCA_IActuator bool m_recursive; public: - + KX_VisibilityActuator( SCA_IObject* gameobj, bool visible, diff --git a/source/gameengine/Ketsji/KX_WorldInfo.cpp b/source/gameengine/Ketsji/KX_WorldInfo.cpp index be8b1ce92fc..d8b9dabe5f3 100644 --- a/source/gameengine/Ketsji/KX_WorldInfo.cpp +++ b/source/gameengine/Ketsji/KX_WorldInfo.cpp @@ -264,7 +264,7 @@ static int mathutils_world_generic_check(BaseMathObject *bmo) KX_WorldInfo *self = static_castBGE_PROXY_REF(bmo->cb_user); if (self == NULL) return -1; - + return 0; } @@ -399,10 +399,10 @@ PyObject *KX_WorldInfo::pyattr_get_mist_typeconst(void *self_v, const KX_PYATTRI if (!strcmp(type, "KX_MIST_QUADRATIC")) { retvalue = PyLong_FromLong(KX_MIST_QUADRATIC); - } + } else if (!strcmp(type, "KX_MIST_LINEAR")) { retvalue = PyLong_FromLong(KX_MIST_LINEAR); - } + } else if (!strcmp(type, "KX_MIST_INV_QUADRATIC")) { retvalue = PyLong_FromLong(KX_MIST_INV_QUADRATIC); } diff --git a/source/gameengine/Ketsji/KX_WorldIpoController.cpp b/source/gameengine/Ketsji/KX_WorldIpoController.cpp index 1123e07ebcc..ea7e78455d3 100644 --- a/source/gameengine/Ketsji/KX_WorldIpoController.cpp +++ b/source/gameengine/Ketsji/KX_WorldIpoController.cpp @@ -110,7 +110,7 @@ SG_Controller* KX_WorldIpoController::GetReplica(class SG_Node* destnode) MT_Scalar* blaptr = (MT_Scalar*) newaddrbase; copyipo->SetNewTarget((MT_Scalar*)blaptr); } - + return iporeplica; } @@ -121,5 +121,5 @@ KX_WorldIpoController::~KX_WorldIpoController() for (i = m_interpolators.begin(); !(i == m_interpolators.end()); ++i) { delete (*i); } - + } diff --git a/source/gameengine/Ketsji/KX_WorldIpoController.h b/source/gameengine/Ketsji/KX_WorldIpoController.h index 704f421573e..0e4b408323d 100644 --- a/source/gameengine/Ketsji/KX_WorldIpoController.h +++ b/source/gameengine/Ketsji/KX_WorldIpoController.h @@ -57,7 +57,7 @@ private: double m_ipotime; public: - KX_WorldIpoController() : + KX_WorldIpoController() : m_modify_mist_start(false), m_modify_mist_dist(false), m_modify_mist_intensity(false), @@ -72,7 +72,7 @@ public: virtual SG_Controller* GetReplica(class SG_Node* destnode); virtual bool Update(double time); - + virtual void SetSimulatedTime(double time) { m_ipotime = time; m_modified = true; @@ -107,8 +107,8 @@ public: }; void AddInterpolator(KX_IInterpolator* interp); - - + + #ifdef WITH_CXX_GUARDEDALLOC MEM_CXX_CLASS_ALLOC_FUNCS("GE:KX_WorldIpoController") #endif diff --git a/source/gameengine/Network/LoopBackNetwork/NG_LoopBackNetworkDeviceInterface.cpp b/source/gameengine/Network/LoopBackNetwork/NG_LoopBackNetworkDeviceInterface.cpp index c57bd304ca2..8d8548b7524 100644 --- a/source/gameengine/Network/LoopBackNetwork/NG_LoopBackNetworkDeviceInterface.cpp +++ b/source/gameengine/Network/LoopBackNetwork/NG_LoopBackNetworkDeviceInterface.cpp @@ -87,7 +87,7 @@ void NG_LoopBackNetworkDeviceInterface::SendNetworkMessage(NG_NetworkMessage* nw vector NG_LoopBackNetworkDeviceInterface::RetrieveNetworkMessages() { vector messages; - + std::deque::iterator mesit=m_messages[m_currentQueue].begin(); for (; !(mesit == m_messages[m_currentQueue].end()); ++mesit) { diff --git a/source/gameengine/Network/NG_NetworkDeviceInterface.h b/source/gameengine/Network/NG_NetworkDeviceInterface.h index 7fcf799db31..95450db3d46 100644 --- a/source/gameengine/Network/NG_NetworkDeviceInterface.h +++ b/source/gameengine/Network/NG_NetworkDeviceInterface.h @@ -70,10 +70,10 @@ public: * read NG_NetworkMessage from library buffer, may be * irrelevant for loopbackdevices */ - + virtual std::vector RetrieveNetworkMessages()=0; - - + + #ifdef WITH_CXX_GUARDEDALLOC MEM_CXX_CLASS_ALLOC_FUNCS("GE:NG_NetworkDeviceInterface") #endif diff --git a/source/gameengine/Network/NG_NetworkMessage.h b/source/gameengine/Network/NG_NetworkMessage.h index 6ed266557fc..6c96dbd8f1c 100644 --- a/source/gameengine/Network/NG_NetworkMessage.h +++ b/source/gameengine/Network/NG_NetworkMessage.h @@ -128,8 +128,8 @@ public: int GetMessageID() { return m_uniqueMessageID; } - - + + #ifdef WITH_CXX_GUARDEDALLOC MEM_CXX_CLASS_ALLOC_FUNCS("GE:NG_NetworkMessage") #endif diff --git a/source/gameengine/Network/NG_NetworkScene.cpp b/source/gameengine/Network/NG_NetworkScene.cpp index 3dbfb53d03d..fc6292dac7e 100644 --- a/source/gameengine/Network/NG_NetworkScene.cpp +++ b/source/gameengine/Network/NG_NetworkScene.cpp @@ -95,7 +95,7 @@ void NG_NetworkScene::proceed(double curtime) message->AddRef(); tmplist->push_back(message); tmplist = NULL; - + tmplistptr = m_messagesBySubject[message->GetSubject()]; // if there is already a vector of messages, append, else create // a new vector and insert into map @@ -167,7 +167,7 @@ bool NG_NetworkScene::ConstraintsAreValid( vector* fromlist = (fromlistptr ? *fromlistptr : NULL); vector* subjectlist = (subjectlistptr ? *subjectlistptr : NULL); - + return ( ( from.IsEmpty() || (!fromlist ? false : (!(std::find(fromlist->begin(), fromlist->end(), message) == fromlist->end()))) ) && @@ -209,7 +209,7 @@ vector NG_NetworkScene::FindMessages( message->AddRef(); foundmessages.push_back(message); } - } + } } // TODO find intersection of messages (that are in other 2 maps) if (spamallowed) { @@ -223,11 +223,11 @@ vector NG_NetworkScene::FindMessages( message->AddRef(); foundmessages.push_back(message); } - } + } } } } - } + } return foundmessages; } diff --git a/source/gameengine/Physics/Bullet/CcdGraphicController.cpp b/source/gameengine/Physics/Bullet/CcdGraphicController.cpp index 470a5431843..8ddd4cbdada 100644 --- a/source/gameengine/Physics/Bullet/CcdGraphicController.cpp +++ b/source/gameengine/Physics/Bullet/CcdGraphicController.cpp @@ -7,8 +7,8 @@ Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. @@ -95,8 +95,8 @@ void CcdGraphicController::GetAabb(btVector3& aabbMin, btVector3& aabbMax) btVector3 localHalfExtents = btScalar(0.5f)*(localAabbMax-localAabbMin); btVector3 localCenter = btScalar(0.5f)*(localAabbMax+localAabbMin); - - btMatrix3x3 abs_b = rot.absolute(); + + btMatrix3x3 abs_b = rot.absolute(); btVector3 center = rot*localCenter + pos; btVector3 extent = abs_b*localHalfExtents; aabbMin = center - extent; @@ -105,7 +105,7 @@ void CcdGraphicController::GetAabb(btVector3& aabbMin, btVector3& aabbMax) bool CcdGraphicController::SetGraphicTransform() { - if (!m_handle) + if (!m_handle) return false; btVector3 aabbMin; btVector3 aabbMax; @@ -121,7 +121,7 @@ PHY_IGraphicController* CcdGraphicController::GetReplica(class PHY_IMotionState* replica->m_motionState = motionState; replica->m_newClientInfo = NULL; replica->m_handle = NULL; - // don't add the graphic controller now: work around a bug in Bullet with rescaling, + // don't add the graphic controller now: work around a bug in Bullet with rescaling, // (the scale of the controller is not yet defined). //m_phyEnv->addCcdGraphicController(replica); return replica; diff --git a/source/gameengine/Physics/Bullet/CcdGraphicController.h b/source/gameengine/Physics/Bullet/CcdGraphicController.h index e76ad86301e..d1ce61ca672 100644 --- a/source/gameengine/Physics/Bullet/CcdGraphicController.h +++ b/source/gameengine/Physics/Bullet/CcdGraphicController.h @@ -4,8 +4,8 @@ Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. @@ -70,7 +70,7 @@ public: virtual void* GetNewClientInfo() { return m_newClientInfo; } virtual void SetNewClientInfo(void* clientinfo) { m_newClientInfo = clientinfo; } virtual PHY_IGraphicController* GetReplica(class PHY_IMotionState* motionstate); - + private: // unscaled aabb corner btVector3 m_localAabbMin; diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp index c79e1c23ef6..74a99b3c668 100644 --- a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp +++ b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp @@ -7,8 +7,8 @@ Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. @@ -105,7 +105,7 @@ void BlenderBulletCharacterController::jump() { if (!canJump()) return; - + m_verticalVelocity = m_jumpSpeed; m_wasJumping = true; m_jumps++; @@ -151,7 +151,7 @@ CcdPhysicsController::CcdPhysicsController (const CcdConstructionInfo& ci) m_shapeInfo->AddRef(); m_bulletChildShape = NULL; - + m_bulletMotionState = 0; m_characterController = 0; m_savedCollisionFlags = 0; @@ -160,7 +160,7 @@ CcdPhysicsController::CcdPhysicsController (const CcdConstructionInfo& ci) m_savedMass = 0.0f; m_savedDyna = false; m_suspended = false; - + CreateRigidbody(); } @@ -279,7 +279,7 @@ bool CcdPhysicsController::CreateSoftbody() rbci.m_angularDamping = m_cci.m_angularDamping; rbci.m_friction = m_cci.m_friction; rbci.m_restitution = m_cci.m_restitution; - + btVector3 p(0.0f,0.0f,0.0f);// = getOrigin(); //btSoftBody* psb=btSoftBodyHelpers::CreateRope(worldInfo, btVector3(-10,0,i*0.25),btVector3(10,0,i*0.25), 16,1+2); btSoftBody* psb = 0; @@ -296,7 +296,7 @@ bool CcdPhysicsController::CreateSoftbody() HullLibrary hlib; /*??*/ hdsc.mMaxVertices=nvertices; hlib.CreateConvexHull(hdsc,hres); - + psb = new btSoftBody(&worldInfo, (int)hres.mNumOutputVertices, &hres.m_OutputVertices[0], 0); for (int i = 0; i < (int)hres.mNumFaces; ++i) { @@ -356,7 +356,7 @@ bool CcdPhysicsController::CreateSoftbody() int indexstride; PHY_ScalarType indexType; trimeshshape->getMeshInterface()->getLockedVertexIndexBase(&vertexBase,numverts,vertexType,vertexstride,&indexbase,indexstride,numtris,indexType); - + psb = btSoftBodyHelpers::CreateFromTriMesh(worldInfo,(const btScalar*)vertexBase,(const int*)indexbase,numtris,false); } } @@ -376,7 +376,7 @@ bool CcdPhysicsController::CreateSoftbody() psb->updateBounds(); } m_object = psb; - + //btSoftBody::Material* pm=psb->appendMaterial(); btSoftBody::Material* pm=psb->m_materials[0]; pm->m_kLST = m_cci.m_soft_linStiff; @@ -440,7 +440,7 @@ bool CcdPhysicsController::CreateSoftbody() { psb->setPose(true,false); } - + psb->randomizeConstraints(); if (m_cci.m_soft_collisionflags & (CCD_BSB_COL_CL_RS+CCD_BSB_COL_CL_SS)) @@ -449,7 +449,7 @@ bool CcdPhysicsController::CreateSoftbody() } psb->setTotalMass(m_cci.m_mass); - + psb->setCollisionFlags(0); ///create a mapping between graphics mesh vertices and soft body vertices @@ -473,7 +473,7 @@ bool CcdPhysicsController::CreateSoftbody() for (slot->begin(it); !slot->end(it); slot->next(it)) { int index = 0; - for (i=it.startvertex; isetSoftBodyIndex(n); } } @@ -520,7 +520,7 @@ bool CcdPhysicsController::CreateCharacterController() { if (!m_cci.m_bCharacter) return false; - + m_object = new btPairCachingGhostObject(); m_object->setCollisionShape(m_collisionShape); m_object->setCollisionFlags(btCollisionObject::CF_CHARACTER_OBJECT); @@ -556,11 +556,11 @@ void CcdPhysicsController::CreateRigidbody() rbci.m_friction = m_cci.m_friction; rbci.m_restitution = m_cci.m_restitution; m_object = new btRigidBody(rbci); - + // // init the rigidbody properly // - + //setMassProps this also sets collisionFlags //convert collision flags! //special case: a near/radar sensor controller should not be defined static or it will @@ -594,7 +594,7 @@ void CcdPhysicsController::CreateRigidbody() { m_object->setAnisotropicFriction(m_cci.m_anisotropicFriction); } - + } static void DeleteBulletShape(btCollisionShape* shape, bool free) @@ -738,7 +738,7 @@ bool CcdPhysicsController::SynchronizeMotionStates(float time) btSoftBody* sb = GetSoftBody(); if (sb) { - if (sb->m_pose.m_bframe) + if (sb->m_pose.m_bframe) { btVector3 worldPos = sb->m_pose.m_com; btQuaternion worldquat; @@ -747,7 +747,7 @@ bool CcdPhysicsController::SynchronizeMotionStates(float time) m_MotionState->SetWorldPosition(worldPos[0],worldPos[1],worldPos[2]); m_MotionState->SetWorldOrientation(worldquat[0],worldquat[1],worldquat[2],worldquat[3]); } - else + else { btVector3 aabbMin,aabbMax; sb->getAabb(aabbMin,aabbMax); @@ -784,10 +784,10 @@ bool CcdPhysicsController::SynchronizeMotionStates(float time) m_MotionState->getWorldOrientation(worldquat[0],worldquat[1],worldquat[2],worldquat[3]); btTransform oldTrans = m_body->getCenterOfMassTransform(); btTransform newTrans(worldquat,worldPos); - + SetCenterOfMassTransform(newTrans); //need to keep track of previous position for friction effects... - + m_MotionState->calculateWorldTransformations(); */ float scale[3]; @@ -802,7 +802,7 @@ bool CcdPhysicsController::SynchronizeMotionStates(float time) /** * WriteMotionStateToDynamics synchronizes dynas, kinematic and deformable entities (and do 'late binding') */ - + void CcdPhysicsController::WriteMotionStateToDynamics(bool nondynaonly) { btTransform& xform = CcdPhysicsController::GetTransformFromMotionState(m_MotionState); @@ -835,13 +835,13 @@ void CcdPhysicsController::PostProcessReplica(class PHY_IMotionState* motionsta // new shape has no scaling, apply initial scaling //m_collisionShape->setMargin(m_cci.m_margin); m_collisionShape->setLocalScaling(m_cci.m_scaling); - + if (m_cci.m_mass) m_collisionShape->calculateLocalInertia(m_cci.m_mass, m_cci.m_localInertiaTensor); } } - // load some characterists that are not + // load some characterists that are not btRigidBody* oldbody = GetRigidBody(); m_object = 0; CreateRigidbody(); @@ -873,7 +873,7 @@ void CcdPhysicsController::SetPhysicsEnvironment(class PHY_IPhysicsEnvironment * // can safely assume CCD environment CcdPhysicsEnvironment *physicsEnv = static_cast(env); - if (m_cci.m_physicsEnv != physicsEnv) + if (m_cci.m_physicsEnv != physicsEnv) { // since the environment is changing, we must also move the controler to the // new environment. Note that we don't handle sensor explicitly: this @@ -934,7 +934,7 @@ void CcdPhysicsController::RelativeTranslate(const MT_Vector3& dlocin,bool loca btVector3 dloc(dlocin.x(), dlocin.y(), dlocin.z()); btTransform xform = m_object->getWorldTransform(); - + if (local) dloc = xform.getBasis()*dloc; @@ -966,8 +966,8 @@ void CcdPhysicsController::RelativeRotate(const MT_Matrix3x3& rotval,bool local GetWorldOrientation(currentOrn); btTransform xform = m_object->getWorldTransform(); - - xform.setBasis(xform.getBasis()*(local ? + + xform.setBasis(xform.getBasis()*(local ? drotmat : (currentOrn.inverse() * drotmat * currentOrn))); SetCenterOfMassTransform(xform); @@ -1141,15 +1141,15 @@ void CcdPhysicsController::SetScaling(const MT_Vector3& scale) { m_object->activate(true); // without this, sleeping objects scale wont be applied in bullet if python changes the scale - Campbell. m_object->getCollisionShape()->setLocalScaling(m_cci.m_scaling); - + //printf("no inertia recalc for fixed objects with mass=0\n"); btRigidBody* body = GetRigidBody(); if (body && m_cci.m_mass) { body->getCollisionShape()->calculateLocalInertia(m_cci.m_mass, m_cci.m_localInertiaTensor); body->setMassProps(m_cci.m_mass, m_cci.m_localInertiaTensor * m_cci.m_inertiaFactor); - } - + } + } } } @@ -1202,13 +1202,13 @@ void CcdPhysicsController::SetMass(MT_Scalar newmass) handle->m_collisionFilterMask); } } - + // physics methods void CcdPhysicsController::ApplyTorque(const MT_Vector3& torquein,bool local) { btVector3 torque(torquein.x(),torquein.y(),torquein.z()); btTransform xform = m_object->getWorldTransform(); - + if (m_object && torque.length2() > (SIMD_EPSILON*SIMD_EPSILON)) { @@ -1239,15 +1239,15 @@ void CcdPhysicsController::ApplyTorque(const MT_Vector3& torquein,bool local) body->setAngularFactor(tmpFac); body->applyTorque(torque); body->setAngularFactor(angFac); - } - } + } + } } } void CcdPhysicsController::ApplyForce(const MT_Vector3& forcein,bool local) { btVector3 force(forcein.x(),forcein.y(),forcein.z()); - + if (m_object && force.length2() > (SIMD_EPSILON*SIMD_EPSILON)) { @@ -1259,7 +1259,7 @@ void CcdPhysicsController::ApplyForce(const MT_Vector3& forcein,bool local) return; } btTransform xform = m_object->getWorldTransform(); - + if (local) { force = xform.getBasis()*force; @@ -1324,7 +1324,7 @@ void CcdPhysicsController::SetLinearVelocity(const MT_Vector3& lin_vel,bool loc m_object->setCollisionFlags(m_object->getCollisionFlags() | btCollisionObject::CF_KINEMATIC_OBJECT); return; } - + btSoftBody* soft = GetSoftBody(); if (soft) { @@ -1360,7 +1360,7 @@ void CcdPhysicsController::ApplyImpulse(const MT_Point3& attach, const MT_Vecto m_object->setCollisionFlags(m_object->getCollisionFlags() | btCollisionObject::CF_KINEMATIC_OBJECT); return; } - + btTransform xform = m_object->getWorldTransform(); if (local) @@ -1377,7 +1377,7 @@ void CcdPhysicsController::ApplyImpulse(const MT_Point3& attach, const MT_Vecto btRigidBody* body = GetRigidBody(); if (body) body->applyImpulse(impulse,pos); - + } } @@ -1479,7 +1479,7 @@ MT_Vector3 CcdPhysicsController::GetLocalInertia() return inertia; } - // dyna's that are rigidbody are free in orientation, dyna's with non-rigidbody are restricted + // dyna's that are rigidbody are free in orientation, dyna's with non-rigidbody are restricted void CcdPhysicsController::SetRigidBody(bool rigid) { btRigidBody* body = GetRigidBody(); @@ -1677,7 +1677,7 @@ PHY_IPhysicsController* CcdPhysicsController::GetReplicaForSensors() { // This situation does not normally happen cinfo.m_collisionShape = m_shapeInfo->CreateBulletShape(m_cci.m_margin, m_cci.m_bGimpact, !m_cci.m_bSoft); - } + } else if (m_collisionShape) { switch (m_collisionShape->getShapeType()) @@ -1741,7 +1741,7 @@ void CcdPhysicsController::ReplicateConstraints(KX_GameObject *replica, std::vec { if (replica->GetConstraints().size() == 0 || !replica->GetPhysicsController()) return; - + PHY_IPhysicsEnvironment *physEnv = GetPhysicsEnvironment(); vector constraints = replica->GetConstraints(); @@ -1751,7 +1751,7 @@ void CcdPhysicsController::ReplicateConstraints(KX_GameObject *replica, std::vec for (consit = constraints.begin(); consit != constraints.end(); ++consit) { /* Try to find the constraint targets in the list of group objects. */ bRigidBodyJointConstraint *dat = (*consit); - vector::iterator memit; + vector::iterator memit; for (memit = constobj.begin(); memit != constobj.end(); ++memit) { KX_GameObject *member = (*memit); /* If the group member is the actual target for the constraint. */ @@ -1801,7 +1801,7 @@ void DefaultMotionState::GetWorldOrientation(float& quatIma0,float& quatIma1,flo quatIma2 = quat.z(); quatReal = quat[3]; } - + void DefaultMotionState::GetWorldOrientation(float* ori) { m_worldTransform.getBasis().getOpenGLSubMatrix(ori); @@ -1822,7 +1822,7 @@ void DefaultMotionState::SetWorldOrientation(float quatIma0,float quatIma1,float btQuaternion orn(quatIma0,quatIma1,quatIma2,quatReal); m_worldTransform.setRotation( orn ); } - + void DefaultMotionState::CalculateWorldTransformations() { @@ -2505,7 +2505,7 @@ btCollisionShape* CcdShapeConstructionInfo::CreateBulletShape(btScalar margin, b if (m_shapeType == PHY_SHAPE_PROXY && m_shapeProxy != NULL) return m_shapeProxy->CreateBulletShape(margin, useGimpact, useBvh); - switch (m_shapeType) + switch (m_shapeType) { default: break; @@ -2541,10 +2541,10 @@ btCollisionShape* CcdShapeConstructionInfo::CreateBulletShape(btScalar margin, b break; case PHY_SHAPE_MESH: - // Let's use the latest btScaledBvhTriangleMeshShape: it allows true sharing of - // triangle mesh information between duplicates => drastic performance increase when - // duplicating complex mesh objects. - // BUT it causes a small performance decrease when sharing is not required: + // Let's use the latest btScaledBvhTriangleMeshShape: it allows true sharing of + // triangle mesh information between duplicates => drastic performance increase when + // duplicating complex mesh objects. + // BUT it causes a small performance decrease when sharing is not required: // 9 multiplications/additions and one function call for each triangle that passes the mid phase filtering // One possible optimization is to use directly the btBvhTriangleMeshShape when the scale is 1,1,1 // and btScaledBvhTriangleMeshShape otherwise. @@ -2648,7 +2648,7 @@ CcdShapeConstructionInfo::~CcdShapeConstructionInfo() if (m_triangleIndexVertexArray) delete m_triangleIndexVertexArray; m_vertexArray.clear(); - if (m_shapeType == PHY_SHAPE_MESH && m_meshObject != NULL) + if (m_shapeType == PHY_SHAPE_MESH && m_meshObject != NULL) { std::map::iterator mit = m_meshShapeMap.find(m_meshObject); if (mit != m_meshShapeMap.end() && mit->second == this) diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsController.h b/source/gameengine/Physics/Bullet/CcdPhysicsController.h index 831e7346df7..d69feda38e5 100644 --- a/source/gameengine/Physics/Bullet/CcdPhysicsController.h +++ b/source/gameengine/Physics/Bullet/CcdPhysicsController.h @@ -4,8 +4,8 @@ Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. @@ -63,11 +63,11 @@ class btCollisionShape; class CcdShapeConstructionInfo { public: - struct UVco + struct UVco { float uv[2]; }; - + static CcdShapeConstructionInfo* FindMesh(class RAS_MeshObject* mesh, struct DerivedMesh* dm, bool polytope); CcdShapeConstructionInfo() : @@ -90,7 +90,7 @@ public: ~CcdShapeConstructionInfo(); CcdShapeConstructionInfo* AddRef() - { + { m_refCount++; return this; } @@ -131,7 +131,7 @@ public: CcdShapeConstructionInfo* childInfo = m_shapeArray.at(i); if ((userData == NULL || userData == childInfo->m_userData) && (childInfo == shapeInfo || - (childInfo->m_shapeType == PHY_SHAPE_PROXY && + (childInfo->m_shapeType == PHY_SHAPE_PROXY && childInfo->m_shapeProxy == shapeInfo))) return i; } @@ -177,10 +177,10 @@ public: btAlignedObjectArray m_vertexArray; // Contains both vertex array for polytope shape and // triangle array for concave mesh shape. Each vertex is 3 consecutive values // In this case a triangle is made of 3 consecutive points - std::vector m_polygonIndexArray; // Contains the array of polygon index in the + std::vector m_polygonIndexArray; // Contains the array of polygon index in the // original mesh that correspond to shape triangles. // only set for concave mesh shape. - + std::vector m_triFaceArray; // Contains an array of triplets of face indices // quads turn into 2 tris @@ -194,8 +194,8 @@ public: protected: static std::map m_meshShapeMap; int m_refCount; // this class is shared between replicas - // keep track of users so that we can release it - RAS_MeshObject* m_meshObject; // Keep a pointer to the original mesh + // keep track of users so that we can release it + RAS_MeshObject* m_meshObject; // Keep a pointer to the original mesh // The list of vertexes and indexes for the triangle mesh, shared between Bullet shape. btTriangleIndexVertexArray *m_triangleIndexVertexArray; std::vector m_shapeArray; // for compound shapes @@ -302,8 +302,8 @@ struct CcdConstructionInfo btVector3 m_linearFactor; btVector3 m_angularFactor; btScalar m_mass; - btScalar m_clamp_vel_min; - btScalar m_clamp_vel_max; + btScalar m_clamp_vel_min; + btScalar m_clamp_vel_max; btScalar m_clamp_angvel_min; // Minimum angular velocity, in radians/sec. btScalar m_clamp_angvel_max; // Maximum angular velocity, in radians/sec. btScalar m_restitution; @@ -377,7 +377,7 @@ struct CcdConstructionInfo class btCollisionShape* m_collisionShape; class PHY_IMotionState* m_MotionState; class CcdShapeConstructionInfo* m_shapeInfo; - + CcdPhysicsEnvironment* m_physicsEnv; //needed for self-replication float m_inertiaFactor;//tweak the inertia (hooked up to Blender 'formfactor' bool m_do_anisotropic; @@ -387,10 +387,10 @@ struct CcdConstructionInfo bool m_do_rot_fh; ///< Should the object have an angular Fh spring? btScalar m_fh_spring; ///< Spring constant (both linear and angular) btScalar m_fh_damping; ///< Damping factor (linear and angular) in range [0, 1] - btScalar m_fh_distance; ///< The range above the surface where Fh is active. + btScalar m_fh_distance; ///< The range above the surface where Fh is active. bool m_fh_normal; ///< Should the object slide off slopes? float m_radius;//for fh backwards compatibility - + ///m_contactProcessingThreshold allows to process contact points with positive distance ///normally only contacts with negative distance (penetration) are solved ///however, rigid body stacking is more stable when positive contacts are still passed into the constraint solver @@ -476,7 +476,7 @@ class CcdPhysicsController : public PHY_IPhysicsController protected: btCollisionObject* m_object; BlenderBulletCharacterController* m_characterController; - + class PHY_IMotionState* m_MotionState; btMotionState* m_bulletMotionState; @@ -514,7 +514,7 @@ protected: bool CreateSoftbody(); bool CreateCharacterController(); - bool Register() { + bool Register() { return (m_registerCount++ == 0) ? true : false; } bool Unregister() { @@ -535,9 +535,9 @@ protected: void ForceWorldTransform(const btMatrix3x3& mat, const btVector3& pos); public: - + int m_collisionDelay; - + CcdPhysicsController (const CcdConstructionInfo& ci); @@ -572,7 +572,7 @@ protected: CcdShapeConstructionInfo* GetShapeInfo() { return m_shapeInfo; } - btCollisionShape* GetCollisionShape() { + btCollisionShape* GetCollisionShape() { return m_object->getCollisionShape(); } //////////////////////////////////// @@ -594,7 +594,7 @@ protected: /** * WriteMotionStateToDynamics ynchronizes dynas, kinematic and deformable entities (and do 'late binding') */ - + virtual void WriteMotionStateToDynamics(bool nondynaonly); virtual void WriteDynamicsToMotionState(); @@ -614,7 +614,7 @@ protected: virtual MT_Scalar GetMass(); virtual void SetMass(MT_Scalar newmass); - + // physics methods virtual void ApplyImpulse(const MT_Point3& attach, const MT_Vector3& impulsein, bool local); virtual void ApplyTorque(const MT_Vector3& torque,bool local); @@ -636,10 +636,10 @@ protected: virtual MT_Vector3 GetVelocity(const MT_Point3& posin); virtual MT_Vector3 GetLocalInertia(); - // dyna's that are rigidbody are free in orientation, dyna's with non-rigidbody are restricted + // dyna's that are rigidbody are free in orientation, dyna's with non-rigidbody are restricted virtual void SetRigidBody(bool rigid); - + virtual void ResolveCombinedVelocities(float linvelX,float linvelY,float linvelZ,float angVelX,float angVelY,float angVelZ); virtual void RefreshCollisions(); virtual void SuspendDynamics(bool ghost); @@ -654,7 +654,7 @@ protected: virtual void SetNewClientInfo(void* clientinfo); virtual PHY_IPhysicsController* GetReplica(); virtual PHY_IPhysicsController* GetReplicaForSensors(); - + ///There should be no 'SetCollisionFilterGroup' method, as changing this during run-time is will result in errors short int GetCollisionFilterGroup() const { @@ -667,7 +667,7 @@ protected: } virtual void CalcXform() {} - virtual void SetMargin(float margin) + virtual void SetMargin(float margin) { if (m_collisionShape) { m_collisionShape->setMargin(margin); @@ -676,16 +676,16 @@ protected: ((btScaledBvhTriangleMeshShape *)m_collisionShape)->getChildShape()->setMargin(margin); } } - virtual float GetMargin() const + virtual float GetMargin() const { return (m_collisionShape) ? m_collisionShape->getMargin() : 0.f; } - virtual float GetRadius() const - { + virtual float GetRadius() const + { // this is not the actual shape radius, it's only used for Fh support return m_cci.m_radius; } - virtual void SetRadius(float margin) + virtual void SetRadius(float margin) { if (m_collisionShape && m_collisionShape->getShapeType() == SPHERE_SHAPE_PROXYTYPE) { @@ -694,21 +694,21 @@ protected: } m_cci.m_radius = margin; } - + // velocity clamping - virtual void SetLinVelocityMin(float val) + virtual void SetLinVelocityMin(float val) { m_cci.m_clamp_vel_min= val; } - virtual float GetLinVelocityMin() const + virtual float GetLinVelocityMin() const { return m_cci.m_clamp_vel_min; } - virtual void SetLinVelocityMax(float val) + virtual void SetLinVelocityMax(float val) { m_cci.m_clamp_vel_max= val; } - virtual float GetLinVelocityMax() const + virtual float GetLinVelocityMax() const { return m_cci.m_clamp_vel_max; } @@ -811,18 +811,18 @@ class DefaultMotionState : public PHY_IMotionState virtual void GetWorldPosition(float& posX,float& posY,float& posZ); virtual void GetWorldScaling(float& scaleX,float& scaleY,float& scaleZ); virtual void GetWorldOrientation(float& quatIma0,float& quatIma1,float& quatIma2,float& quatReal); - + virtual void SetWorldPosition(float posX,float posY,float posZ); virtual void SetWorldOrientation(float quatIma0,float quatIma1,float quatIma2,float quatReal); virtual void GetWorldOrientation(float* ori); virtual void SetWorldOrientation(const float* ori); - + virtual void CalculateWorldTransformations(); - + btTransform m_worldTransform; btVector3 m_localScaling; - - + + #ifdef WITH_CXX_GUARDEDALLOC MEM_CXX_CLASS_ALLOC_FUNCS("GE:DefaultMotionState") #endif diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp index 78d2d88cc65..910b3a7dc84 100644 --- a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp +++ b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp @@ -7,8 +7,8 @@ Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. @@ -347,7 +347,7 @@ class CcdOverlapFilterCallBack : public btOverlapFilterCallback private: class CcdPhysicsEnvironment* m_physEnv; public: - CcdOverlapFilterCallBack(CcdPhysicsEnvironment* env) : + CcdOverlapFilterCallBack(CcdPhysicsEnvironment* env) : m_physEnv(env) { } @@ -769,7 +769,7 @@ public: m_owner(owner), m_parent(parent) { - + } virtual bool needsCollision(btBroadphaseProxy* proxy0) const @@ -791,7 +791,7 @@ void CcdPhysicsEnvironment::ProcessFhSprings(double curTime,float interval) std::set::iterator it; // Add epsilon to the tick rate for numerical stability int numIter = (int)(interval*(KX_KetsjiEngine::GetTicRate() + 0.001f)); - + for (it=m_controllers.begin(); it!=m_controllers.end(); it++) { CcdPhysicsController* ctrl = (*it); @@ -817,7 +817,7 @@ void CcdPhysicsEnvironment::ProcessFhSprings(double curTime,float interval) //btVector3 rayToWorld = rayFromWorld + body->getCenterOfMassTransform().getBasis() * rayDirLocal; //ray always points down the z axis in world space... btVector3 rayToWorld = rayFromWorld + rayDirLocal; - + ClosestRayResultCallbackNotMe resultCallback(rayFromWorld,rayToWorld,body,parentBody); m_dynamicsWorld->rayTest(rayFromWorld,rayToWorld,resultCallback); @@ -840,8 +840,8 @@ void CcdPhysicsEnvironment::ProcessFhSprings(double curTime,float interval) float distance = resultCallback.m_closestHitFraction*rayDirLocal.length()-ctrl->GetConstructionInfo().m_radius; if (distance >= hitObjShapeProps.m_fh_distance) continue; - - + + //btVector3 ray_dir = cl_object->getCenterOfMassTransform().getBasis()* rayDirLocal.normalized(); btVector3 ray_dir = rayDirLocal.normalized(); @@ -856,7 +856,7 @@ void CcdPhysicsEnvironment::ProcessFhSprings(double curTime,float interval) rayDirLocal * resultCallback.m_closestHitFraction; - + lspot -= hit_object->getCenterOfMassPosition(); btVector3 rel_vel = cl_object->getLinearVelocity() - hit_object->getVelocityInLocalPoint(lspot); @@ -865,16 +865,16 @@ void CcdPhysicsEnvironment::ProcessFhSprings(double curTime,float interval) btScalar i_spring = spring_extent * hitObjShapeProps.m_fh_spring; btScalar i_damp = rel_vel_ray * hitObjShapeProps.m_fh_damping; - - cl_object->setLinearVelocity(cl_object->getLinearVelocity() + (-(i_spring + i_damp) * ray_dir)); - if (hitObjShapeProps.m_fh_normal) + + cl_object->setLinearVelocity(cl_object->getLinearVelocity() + (-(i_spring + i_damp) * ray_dir)); + if (hitObjShapeProps.m_fh_normal) { cl_object->setLinearVelocity(cl_object->getLinearVelocity()+(i_spring + i_damp) *(normal - normal.dot(ray_dir) * ray_dir)); } - + btVector3 lateral = rel_vel - rel_vel_ray * ray_dir; - - + + if (ctrl->GetConstructionInfo().m_do_anisotropic) { //Bullet basis contains no scaling/shear etc. const btMatrix3x3& lcs = cl_object->getCenterOfMassTransform().getBasis(); @@ -885,34 +885,34 @@ void CcdPhysicsEnvironment::ProcessFhSprings(double curTime,float interval) } btScalar rel_vel_lateral = lateral.length(); - + if (rel_vel_lateral > SIMD_EPSILON) { btScalar friction_factor = hit_object->getFriction();//cl_object->getFriction(); btScalar max_friction = friction_factor * btMax(btScalar(0.0f), i_spring); - + btScalar rel_mom_lateral = rel_vel_lateral / cl_object->getInvMass(); - + btVector3 friction = (rel_mom_lateral > max_friction) ? -lateral * (max_friction / rel_vel_lateral) : -lateral; - + cl_object->applyCentralImpulse(friction); } } - + if (ctrl->GetConstructionInfo().m_do_rot_fh) { btVector3 up2 = cl_object->getWorldTransform().getBasis().getColumn(2); btVector3 t_spring = up2.cross(normal) * hitObjShapeProps.m_fh_spring; btVector3 ang_vel = cl_object->getAngularVelocity(); - + // only rotations that tilt relative to the normal are damped ang_vel -= ang_vel.dot(normal) * normal; - - btVector3 t_damp = ang_vel * hitObjShapeProps.m_fh_damping; - + + btVector3 t_damp = ang_vel * hitObjShapeProps.m_fh_damping; + cl_object->setAngularVelocity(cl_object->getAngularVelocity() + (t_spring - t_damp)); } } @@ -1014,8 +1014,8 @@ void CcdPhysicsEnvironment::SetSolverType(int solverType) { m_solver = new btSequentialImpulseConstraintSolver(); - - + + break; } } @@ -1073,18 +1073,18 @@ int CcdPhysicsEnvironment::CreateUniversalD6Constraint( //we could either add some logic to recognize ball-socket and hinge, or let that up to the user //perhaps some warning or hint that hinge/ball-socket is more efficient? - - + + btGeneric6DofConstraint* genericConstraint = 0; CcdPhysicsController* ctrl0 = (CcdPhysicsController*) ctrlRef; CcdPhysicsController* ctrl1 = (CcdPhysicsController*) ctrlOther; - + btRigidBody* rb0 = ctrl0->GetRigidBody(); btRigidBody* rb1 = ctrl1->GetRigidBody(); if (rb1) { - + bool useReferenceFrameA = true; genericConstraint = new btGeneric6DofSpringConstraint( @@ -1100,7 +1100,7 @@ int CcdPhysicsEnvironment::CreateUniversalD6Constraint( //No, we can use a fixed rigidbody in above code, rather than unnecessary duplation of code } - + if (genericConstraint) { // m_constraints.push_back(genericConstraint); @@ -1182,7 +1182,7 @@ struct FilterClosestRayResultCallback : public btCollisionWorld::ClosestRayResul { m_hitTriangleShape = rayResult.m_collisionObject->getCollisionShape(); m_hitTriangleIndex = rayResult.m_localShapeInfo->m_triangleIndex; - } else + } else { m_hitTriangleShape = NULL; m_hitTriangleIndex = 0; @@ -1194,7 +1194,7 @@ struct FilterClosestRayResultCallback : public btCollisionWorld::ClosestRayResul static bool GetHitTriangle(btCollisionShape* shape, CcdShapeConstructionInfo* shapeInfo, int hitTriangleIndex, btVector3 triangle[]) { - // this code is copied from Bullet + // this code is copied from Bullet const unsigned char *vertexbase; int numverts; PHY_ScalarType type; @@ -1284,7 +1284,7 @@ PHY_IPhysicsController* CcdPhysicsEnvironment::RayTest(PHY_IRayCastFilterCallbac break; } } - if (shape == rayCallback.m_hitTriangleShape && + if (shape == rayCallback.m_hitTriangleShape && rayCallback.m_hitTriangleIndex < shapeInfo->m_polygonIndexArray.size()) { // save original collision shape triangle for soft body @@ -1319,7 +1319,7 @@ PHY_IPhysicsController* CcdPhysicsEnvironment::RayTest(PHY_IRayCastFilterCallbac v1 = softBody->m_faces[hitTriangleIndex].m_n[0]->m_x; v2 = softBody->m_faces[hitTriangleIndex].m_n[1]->m_x; v3 = softBody->m_faces[hitTriangleIndex].m_n[2]->m_x; - } else + } else { // for rigid body we must apply the world transform triangleOK = GetHitTriangle(shape, shapeInfo, hitTriangleIndex, triangle); @@ -1355,12 +1355,12 @@ PHY_IPhysicsController* CcdPhysicsEnvironment::RayTest(PHY_IRayCastFilterCallbac result.m_hitUV[1] = baryCo.getX()*uvCo[0].uv[1] + baryCo.getY()*uvCo[1].uv[1] + baryCo.getZ()*uvCo[2].uv[1]; result.m_hitUVOK = 1; } - + // Bullet returns the normal from "outside". // If the user requests the real normal, compute it now if (filterCallback.m_faceNormal) { - if (shape->isSoftBody()) + if (shape->isSoftBody()) { // we can get the real normal directly from the body const btSoftBody* softBody = static_cast(rayCallback.m_collisionObject); @@ -1371,7 +1371,7 @@ PHY_IPhysicsController* CcdPhysicsEnvironment::RayTest(PHY_IRayCastFilterCallbac triangleOK = GetHitTriangle(shape, shapeInfo, hitTriangleIndex, triangle); if (triangleOK) { - btVector3 triangleNormal; + btVector3 triangleNormal; triangleNormal = (triangle[1]-triangle[0]).cross(triangle[2]-triangle[0]); rayCallback.m_hitNormalWorld = rayCallback.m_collisionObject->getWorldTransform().getBasis()*triangleNormal; } @@ -1399,7 +1399,7 @@ PHY_IPhysicsController* CcdPhysicsEnvironment::RayTest(PHY_IRayCastFilterCallbac return result.m_controller; } -// Handles occlusion culling. +// Handles occlusion culling. // The implementation is based on the CDTestFramework struct OcclusionBuffer { @@ -1438,7 +1438,7 @@ struct OcclusionBuffer btScalar m_offsets[2]; btScalar m_wtc[16]; // world to clip transform btScalar m_mtc[16]; // model to clip transform - // constructor: size=largest dimension of the buffer. + // constructor: size=largest dimension of the buffer. // Buffer size depends on aspect ratio OcclusionBuffer() { @@ -1488,7 +1488,7 @@ struct OcclusionBuffer m_offsets[0] = m_scales[0] + 0.5f; m_offsets[1] = m_scales[1] + 0.5f; // prepare matrix - // at this time of the rendering, the modelview matrix is the + // at this time of the rendering, the modelview matrix is the // world to camera transformation and the projection matrix is // camera to clip transformation. combine both so that CMmat4mul(m_wtc, projection, modelview); @@ -1508,7 +1508,7 @@ struct OcclusionBuffer if (!m_buffer) { m_buffer = (btScalar *)calloc(1, newsize); m_bufferSize = newsize; - } + } else { // buffer exists already, just clears it memset(m_buffer, 0, newsize); @@ -1687,7 +1687,7 @@ struct OcclusionBuffer else if (width == 1) { // Degenerated in at least 2 vertical lines // The algorithm below doesn't work when face has a single pixel width - // We cannot use general formulas because the plane is degenerated. + // We cannot use general formulas because the plane is degenerated. // We have to interpolate along the 3 edges that overlaps and process each pixel. // sort the y coord to make formula simpler int ytmp; @@ -1752,7 +1752,7 @@ struct OcclusionBuffer else if (height == 1) { // Degenerated in at least 2 horizontal lines // The algorithm below doesn't work when face has a single pixel width - // We cannot use general formulas because the plane is degenerated. + // We cannot use general formulas because the plane is degenerated. // We have to interpolate along the 3 edges that overlaps and process each pixel. int xtmp; btScalar ztmp; @@ -1846,7 +1846,7 @@ struct OcclusionBuffer } return false; } - // clip than write or check a polygon + // clip than write or check a polygon template inline bool clipDraw(const btVector4 *p, const float face, @@ -1864,7 +1864,7 @@ struct OcclusionBuffer return earlyexit; } // add a triangle (in model coordinate) - // face = 0.f if face is double side, + // face = 0.f if face is double side, // = 1.f if face is single sided and scale is positive // = -1.f if face is single sided and scale is negative void appendOccluderM(const float *a, @@ -2054,12 +2054,12 @@ void CcdPhysicsEnvironment::GetContactPoint(int i,float& hitX,float& hitY,float& btBroadphaseInterface* CcdPhysicsEnvironment::GetBroadphase() -{ - return m_dynamicsWorld->getBroadphase(); +{ + return m_dynamicsWorld->getBroadphase(); } btDispatcher* CcdPhysicsEnvironment::GetDispatcher() -{ +{ return m_dynamicsWorld->getDispatcher(); } @@ -2096,7 +2096,7 @@ CcdPhysicsEnvironment::~CcdPhysicsEnvironment() //first delete scene, then dispatcher, because pairs have to release manifolds on the dispatcher //delete m_dispatcher; delete m_dynamicsWorld; - + if (NULL != m_ownPairCache) delete m_ownPairCache; @@ -2141,10 +2141,10 @@ float CcdPhysicsEnvironment::GetConstraintParam(int constraintId,int param) { case PHY_GENERIC_6DOF_CONSTRAINT: { - + switch (param) { - case 0: case 1: case 2: + case 0: case 1: case 2: { //param = 0..2 are linear constraint values btGeneric6DofConstraint* genCons = (btGeneric6DofConstraint*)typedConstraint; @@ -2183,7 +2183,7 @@ void CcdPhysicsEnvironment::SetConstraintParam(int constraintId,int param,float { case PHY_GENERIC_6DOF_CONSTRAINT: { - + switch (param) { case 0: case 1: case 2: case 3: case 4: case 5: @@ -2473,7 +2473,7 @@ bool CcdOverlapFilterCallBack::needBroadphaseCollision(btBroadphaseProxy* proxy0 // additional check for sensor object if (proxy0->m_collisionFilterGroup & btBroadphaseProxy::SensorTrigger) { - // this is a sensor object, the other one can't be a sensor object because + // this is a sensor object, the other one can't be a sensor object because // they exclude each other in the above test assert(!(proxy1->m_collisionFilterGroup & btBroadphaseProxy::SensorTrigger)); colObj0 = (btCollisionObject*)proxy0->m_clientObject; @@ -2530,7 +2530,7 @@ PHY_ICharacter* CcdPhysicsEnvironment::GetCharacterController(KX_GameObject *ob) PHY_IPhysicsController* CcdPhysicsEnvironment::CreateSphereController(float radius,const MT_Vector3& position) { - + CcdConstructionInfo cinfo; memset(&cinfo, 0, sizeof(cinfo)); /* avoid uninitialized values */ cinfo.m_collisionShape = new btSphereShape(radius); // memory leak! The shape is not deleted by Bullet and we cannot add it to the KX_Scene.m_shapes list @@ -2550,7 +2550,7 @@ PHY_IPhysicsController* CcdPhysicsEnvironment::CreateSphereController(float radi motionState->m_worldTransform.setOrigin(btVector3(position[0],position[1],position[2])); CcdPhysicsController* sphereController = new CcdPhysicsController(cinfo); - + return sphereController; } @@ -2592,7 +2592,7 @@ int CcdPhysicsEnvironment::CreateConstraint(class PHY_IPhysicsController* ctrl btRigidBody* rb0 = c0 ? c0->GetRigidBody() : 0; btRigidBody* rb1 = c1 ? c1->GetRigidBody() : 0; - + bool rb0static = rb0 ? rb0->isStaticOrKinematicObject() : true; @@ -2606,7 +2606,7 @@ int CcdPhysicsEnvironment::CreateConstraint(class PHY_IPhysicsController* ctrl btVector3 pivotInA(pivotX,pivotY,pivotZ); - + //it might be a soft body, let's try btSoftBody* sb0 = c0 ? c0->GetSoftBody() : 0; @@ -2658,7 +2658,7 @@ int CcdPhysicsEnvironment::CreateConstraint(class PHY_IPhysicsController* ctrl } default: { - + } }; */ @@ -2674,7 +2674,7 @@ int CcdPhysicsEnvironment::CreateConstraint(class PHY_IPhysicsController* ctrl } } - + } return 0;//can't remove soft body anchors yet } @@ -2719,7 +2719,7 @@ int CcdPhysicsEnvironment::CreateConstraint(class PHY_IPhysicsController* ctrl } default: { - + } };*/ @@ -2735,7 +2735,7 @@ int CcdPhysicsEnvironment::CreateConstraint(class PHY_IPhysicsController* ctrl sb1->setMass(node,0.f); } } - + } return 0;//can't remove soft body anchors yet @@ -2743,15 +2743,15 @@ int CcdPhysicsEnvironment::CreateConstraint(class PHY_IPhysicsController* ctrl if (rb0static && rb1static) { - + return 0; } - + if (!rb0) return 0; - btVector3 pivotInB = rb1 ? rb1->getCenterOfMassTransform().inverse()(rb0->getCenterOfMassTransform()(pivotInA)) : + btVector3 pivotInB = rb1 ? rb1->getCenterOfMassTransform().inverse()(rb0->getCenterOfMassTransform()(pivotInA)) : rb0->getCenterOfMassTransform() * pivotInA; btVector3 axisInA(axisX,axisY,axisZ); @@ -2801,13 +2801,13 @@ int CcdPhysicsEnvironment::CreateConstraint(class PHY_IPhysicsController* ctrl { btTransform frameInA; btTransform frameInB; - + btVector3 axis1(axis1X,axis1Y,axis1Z), axis2(axis2X,axis2Y,axis2Z); if (axis1.length() == 0.0f) { btPlaneSpace1( axisInA, axis1, axis2 ); } - + frameInA.getBasis().setValue( axisInA.x(), axis1.x(), axis2.x(), axisInA.y(), axis1.y(), axis2.y(), axisInA.z(), axis1.z(), axis2.z() ); @@ -2816,7 +2816,7 @@ int CcdPhysicsEnvironment::CreateConstraint(class PHY_IPhysicsController* ctrl btTransform inv = rb1->getCenterOfMassTransform().inverse(); btTransform globalFrameA = rb0->getCenterOfMassTransform() * frameInA; - + frameInB = inv * globalFrameA; bool useReferenceFrameA = true; @@ -2830,7 +2830,7 @@ int CcdPhysicsEnvironment::CreateConstraint(class PHY_IPhysicsController* ctrl static btRigidBody s_fixedObject2( 0,0,0); btTransform frameInA; btTransform frameInB; - + btVector3 axis1, axis2; btPlaneSpace1( axisInA, axis1, axis2 ); @@ -2859,7 +2859,7 @@ int CcdPhysicsEnvironment::CreateConstraint(class PHY_IPhysicsController* ctrl genericConstraint->setUserConstraintType(type); //64 bit systems can't cast pointer to int. could use size_t instead. return genericConstraint->getUserConstraintId(); - } + } break; } @@ -2870,18 +2870,18 @@ int CcdPhysicsEnvironment::CreateConstraint(class PHY_IPhysicsController* ctrl btConeTwistConstraint* coneTwistContraint = 0; - + if (rb1) { btTransform frameInA; btTransform frameInB; - + btVector3 axis1(axis1X,axis1Y,axis1Z), axis2(axis2X,axis2Y,axis2Z); if (axis1.length() == 0.0f) { btPlaneSpace1( axisInA, axis1, axis2 ); } - + frameInA.getBasis().setValue( axisInA.x(), axis1.x(), axis2.x(), axisInA.y(), axis1.y(), axis2.y(), axisInA.z(), axis1.z(), axis2.z() ); @@ -2890,9 +2890,9 @@ int CcdPhysicsEnvironment::CreateConstraint(class PHY_IPhysicsController* ctrl btTransform inv = rb1->getCenterOfMassTransform().inverse(); btTransform globalFrameA = rb0->getCenterOfMassTransform() * frameInA; - + frameInB = inv * globalFrameA; - + coneTwistContraint = new btConeTwistConstraint( *rb0,*rb1, frameInA,frameInB); @@ -2902,7 +2902,7 @@ int CcdPhysicsEnvironment::CreateConstraint(class PHY_IPhysicsController* ctrl static btRigidBody s_fixedObject2( 0,0,0); btTransform frameInA; btTransform frameInB; - + btVector3 axis1, axis2; btPlaneSpace1( axisInA, axis1, axis2 ); @@ -2930,7 +2930,7 @@ int CcdPhysicsEnvironment::CreateConstraint(class PHY_IPhysicsController* ctrl coneTwistContraint->setUserConstraintType(type); //64 bit systems can't cast pointer to int. could use size_t instead. return coneTwistContraint->getUserConstraintId(); - } + } @@ -2953,26 +2953,26 @@ int CcdPhysicsEnvironment::CreateConstraint(class PHY_IPhysicsController* ctrl // having btHingeConstraint fill in the blanks any way it wants to. btTransform frameInA; btTransform frameInB; - + btVector3 axis1(axis1X,axis1Y,axis1Z), axis2(axis2X,axis2Y,axis2Z); if (axis1.length() == 0.0f) { btPlaneSpace1( axisInA, axis1, axis2 ); } - + // Internally btHingeConstraint's hinge-axis is z frameInA.getBasis().setValue( axis1.x(), axis2.x(), axisInA.x(), axis1.y(), axis2.y(), axisInA.y(), axis1.z(), axis2.z(), axisInA.z() ); - + frameInA.setOrigin( pivotInA ); btTransform inv = rb1->getCenterOfMassTransform().inverse(); btTransform globalFrameA = rb0->getCenterOfMassTransform() * frameInA; - + frameInB = inv * globalFrameA; - + hinge = new btHingeConstraint(*rb0,*rb1,frameInA,frameInB); @@ -2982,7 +2982,7 @@ int CcdPhysicsEnvironment::CreateConstraint(class PHY_IPhysicsController* ctrl btTransform frameInA; btTransform frameInB; - + btVector3 axis1(axis1X,axis1Y,axis1Z), axis2(axis2X,axis2Y,axis2Z); if (axis1.length() == 0.0f) { @@ -3055,7 +3055,7 @@ PHY_IPhysicsController* CcdPhysicsEnvironment::CreateConeController(float conera cinfo.m_collisionFlags |= btCollisionObject::CF_NO_CONTACT_RESPONSE | btCollisionObject::CF_STATIC_OBJECT; DefaultMotionState* motionState = new DefaultMotionState(); cinfo.m_MotionState = motionState; - + // we will add later the possibility to select the filter from option cinfo.m_collisionFilterMask = CcdConstructionInfo::AllFilter ^ CcdConstructionInfo::SensorFilter; cinfo.m_collisionFilterGroup = CcdConstructionInfo::SensorFilter; @@ -3068,7 +3068,7 @@ PHY_IPhysicsController* CcdPhysicsEnvironment::CreateConeController(float conera return sphereController; } - + float CcdPhysicsEnvironment::getAppliedImpulse(int constraintid) { // For soft body constraints @@ -3092,8 +3092,8 @@ float CcdPhysicsEnvironment::getAppliedImpulse(int constraintid) void CcdPhysicsEnvironment::ExportFile(const char* filename) { btDefaultSerializer* serializer = new btDefaultSerializer(); - - + + for (int i=0;igetNumCollisionObjects();i++) { diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h index a64d2c8f15f..2c7b009a1f8 100644 --- a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h +++ b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h @@ -4,8 +4,8 @@ Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. @@ -72,7 +72,7 @@ class CcdPhysicsEnvironment : public PHY_IPhysicsEnvironment protected: btIDebugDraw* m_debugDrawer; - + class btDefaultCollisionConfiguration* m_collisionConfiguration; class btBroadphaseInterface* m_broadphase; // broadphase for dynamic world // for culling only @@ -81,7 +81,7 @@ protected: //solver iterations int m_numIterations; - + //timestep subdivisions int m_numTimeSubSteps; @@ -183,9 +183,9 @@ protected: const btVector3& angularMaxLimits,int flags ); - + virtual void SetConstraintParam(int constraintId,int param,float value,float value1); - + virtual float GetConstraintParam(int constraintId,int param); virtual void RemoveConstraintById(int constraintid); @@ -223,7 +223,7 @@ protected: //These two methods are used *solely* to create controllers for Near/Radar sensor! Don't use for anything else virtual PHY_IPhysicsController* CreateSphereController(float radius,const MT_Vector3& position); virtual PHY_IPhysicsController* CreateConeController(float coneradius,float coneheight); - + virtual int GetNumContactPoints(); @@ -232,7 +232,7 @@ protected: ////////////////////// //CcdPhysicsEnvironment interface //////////////////////// - + void AddCcdPhysicsController(CcdPhysicsController* ctrl); bool RemoveCcdPhysicsController(CcdPhysicsController* ctrl); @@ -247,7 +247,7 @@ protected: void RemoveCcdGraphicController(CcdGraphicController* ctrl); - /** + /** * Update all physics controllers shape which use the same shape construction info. * Call RecreateControllerShape on controllers which use the same shape * construction info that argument shapeInfo. @@ -259,7 +259,7 @@ protected: btDbvtBroadphase* GetCullingTree() { return m_cullingTree; } btDispatcher* GetDispatcher(); - + bool IsSatCollisionDetectionEnabled() const { @@ -271,17 +271,17 @@ protected: m_enableSatCollisionDetection = enableSat; } - + const btPersistentManifold* GetManifold(int index) const; - + void SyncMotionStates(float timeStep); class btSoftRigidDynamicsWorld* GetDynamicsWorld() { return m_dynamicsWorld; } - + class btConstraintSolver* GetConstraintSolver(); void MergeEnvironment(PHY_IPhysicsEnvironment *other_env); @@ -304,24 +304,24 @@ protected: bRigidBodyJointConstraint *dat); protected: - - + + std::set m_controllers; PHY_ResponseCallback m_triggerCallbacks[PHY_NUM_RESPONSE]; void* m_triggerCallbacksUserPtrs[PHY_NUM_RESPONSE]; - + std::vector m_wrapperVehicles; - //use explicit btSoftRigidDynamicsWorld/btDiscreteDynamicsWorld* so that we have access to - //btDiscreteDynamicsWorld::addRigidBody(body,filter,group) - //so that we can set the body collision filter/group at the time of creation + //use explicit btSoftRigidDynamicsWorld/btDiscreteDynamicsWorld* so that we have access to + //btDiscreteDynamicsWorld::addRigidBody(body,filter,group) + //so that we can set the body collision filter/group at the time of creation //and not afterwards (breaks the collision system for radar/near sensor) //Ideally we would like to have access to this function from the btDynamicsWorld interface //class btDynamicsWorld* m_dynamicsWorld; class btSoftRigidDynamicsWorld* m_dynamicsWorld; - + class btConstraintSolver* m_solver; class btOverlappingPairCache* m_ownPairCache; @@ -336,7 +336,7 @@ protected: virtual void ExportFile(const char* filename); - + #ifdef WITH_CXX_GUARDEDALLOC MEM_CXX_CLASS_ALLOC_FUNCS("GE:CcdPhysicsEnvironment") #endif diff --git a/source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.cpp b/source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.cpp index 99db56bfcef..578818d2b6d 100644 --- a/source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.cpp +++ b/source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.cpp @@ -62,8 +62,8 @@ void DummyPhysicsEnvironment::EndFrame() bool DummyPhysicsEnvironment::ProceedDeltaTime(double curTime,float timeStep,float interval) { //step physics simulation, typically perform - - //collision detection + + //collision detection //solve constraints //integrate solution // return true if an update was done. @@ -72,7 +72,7 @@ bool DummyPhysicsEnvironment::ProceedDeltaTime(double curTime,float timeStep,f void DummyPhysicsEnvironment::SetFixedTimeStep(bool useFixedTimeStep,float fixedTimeStep) { } - + float DummyPhysicsEnvironment::GetFixedTimeStep() { return 0.f; @@ -100,7 +100,7 @@ int DummyPhysicsEnvironment::CreateConstraint(class PHY_IPhysicsController* ct float axis2X,float axis2Y,float axis2Z,int flag ) { - + int constraintid = 0; return constraintid; diff --git a/source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.h b/source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.h index 3e9379dd60d..dd6f7f44803 100644 --- a/source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.h +++ b/source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.h @@ -125,7 +125,7 @@ public: // All we need to do is handle the motionstate (we're supposed to own it) delete motionstate; } - + #ifdef WITH_CXX_GUARDEDALLOC MEM_CXX_CLASS_ALLOC_FUNCS("GE:DummyPhysicsEnvironment") #endif diff --git a/source/gameengine/Physics/common/PHY_DynamicTypes.h b/source/gameengine/Physics/common/PHY_DynamicTypes.h index d10f48ad7a4..a92a950b26f 100644 --- a/source/gameengine/Physics/common/PHY_DynamicTypes.h +++ b/source/gameengine/Physics/common/PHY_DynamicTypes.h @@ -4,8 +4,8 @@ Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. @@ -32,7 +32,7 @@ enum PHY_OBJECT_RESPONSE, /* Object Dynamic Geometry Response */ PHY_STATIC_RESPONSE, /* Static Geometry Response */ PHY_BROADPH_RESPONSE, /* broadphase Response */ - + PHY_NUM_RESPONSE }; @@ -58,7 +58,7 @@ typedef enum PHY_PhysicsType { PHY_CONCAVE_RIGIDBODY=16399, PHY_CONVEX_FIXEDBODY=16388,//'collision object' PHY_CONCAVE_FIXEDBODY=16401, - PHY_CONVEX_KINEMATICBODY=16387,// + PHY_CONVEX_KINEMATICBODY=16387,// PHY_CONCAVE_KINEMATICBODY=16400, PHY_CONVEX_PHANTOMBODY=16398, PHY_CONCAVE_PHANTOMBODY=16402 diff --git a/source/gameengine/Physics/common/PHY_ICharacter.h b/source/gameengine/Physics/common/PHY_ICharacter.h index 1a924904b7d..9c27e1fe2b8 100644 --- a/source/gameengine/Physics/common/PHY_ICharacter.h +++ b/source/gameengine/Physics/common/PHY_ICharacter.h @@ -14,7 +14,7 @@ class PHY_ICharacter { -public: +public: virtual ~PHY_ICharacter() {}; virtual void Jump()= 0; @@ -22,7 +22,7 @@ public: virtual float GetGravity()= 0; virtual void SetGravity(float gravity)= 0; - + virtual unsigned char GetMaxJumps() = 0; virtual void SetMaxJumps(unsigned char maxJumps) = 0; diff --git a/source/gameengine/Physics/common/PHY_IController.h b/source/gameengine/Physics/common/PHY_IController.h index 741fae8d2ad..23974959618 100644 --- a/source/gameengine/Physics/common/PHY_IController.h +++ b/source/gameengine/Physics/common/PHY_IController.h @@ -54,7 +54,7 @@ class PHY_IController virtual void SetNewClientInfo(void* clientinfo)=0; virtual void SetPhysicsEnvironment(class PHY_IPhysicsEnvironment *env)=0; - + #ifdef WITH_CXX_GUARDEDALLOC MEM_CXX_CLASS_ALLOC_FUNCS("GE:PHY_IController") #endif diff --git a/source/gameengine/Physics/common/PHY_IMotionState.h b/source/gameengine/Physics/common/PHY_IMotionState.h index e803d658713..0474d9abc72 100644 --- a/source/gameengine/Physics/common/PHY_IMotionState.h +++ b/source/gameengine/Physics/common/PHY_IMotionState.h @@ -52,14 +52,14 @@ class PHY_IMotionState // ori = array 12 floats, [0..3] = first column + 0, [4..7] = second column, [8..11] = third column virtual void GetWorldOrientation(float* ori)=0; virtual void SetWorldOrientation(const float* ori)=0; - + virtual void SetWorldPosition(float posX,float posY,float posZ)=0; virtual void SetWorldOrientation(float quatIma0,float quatIma1,float quatIma2,float quatReal)=0; virtual void CalculateWorldTransformations()=0; - - + + #ifdef WITH_CXX_GUARDEDALLOC MEM_CXX_CLASS_ALLOC_FUNCS("GE:PHY_IMotionState") #endif diff --git a/source/gameengine/Physics/common/PHY_IPhysicsController.h b/source/gameengine/Physics/common/PHY_IPhysicsController.h index 4c6e8c71ef7..195f4ccee4b 100644 --- a/source/gameengine/Physics/common/PHY_IPhysicsController.h +++ b/source/gameengine/Physics/common/PHY_IPhysicsController.h @@ -61,7 +61,7 @@ class PHY_IPhysicsController : public PHY_IController /** * WriteMotionStateToDynamics ynchronizes dynas, kinematic and deformable entities (and do 'late binding') */ - + virtual void WriteMotionStateToDynamics(bool nondynaonly)=0; virtual void WriteDynamicsToMotionState()=0; virtual class PHY_IMotionState* GetMotionState() = 0; @@ -108,7 +108,7 @@ class PHY_IPhysicsController : public PHY_IController virtual MT_Vector3 GetVelocity(const MT_Point3& pos)=0; virtual MT_Vector3 GetLocalInertia()=0; - // dyna's that are rigidbody are free in orientation, dyna's with non-rigidbody are restricted + // dyna's that are rigidbody are free in orientation, dyna's with non-rigidbody are restricted virtual void SetRigidBody(bool rigid)=0; virtual PHY_IPhysicsController* GetReplica() {return 0;} @@ -124,7 +124,7 @@ class PHY_IPhysicsController : public PHY_IController virtual void SetLinVelocityMin(float val) = 0; virtual float GetLinVelocityMax() const=0; virtual void SetLinVelocityMax(float val) = 0; - + virtual void SetAngularVelocityMin(float val) = 0; virtual float GetAngularVelocityMin() const = 0; virtual void SetAngularVelocityMax(float val) = 0; diff --git a/source/gameengine/Physics/common/PHY_IPhysicsEnvironment.h b/source/gameengine/Physics/common/PHY_IPhysicsEnvironment.h index 72ec7b1edd0..59612b10b57 100644 --- a/source/gameengine/Physics/common/PHY_IPhysicsEnvironment.h +++ b/source/gameengine/Physics/common/PHY_IPhysicsEnvironment.h @@ -65,7 +65,7 @@ struct PHY_RayCastResult PHY_IPhysicsController* m_controller; MT_Vector3 m_hitPoint; MT_Vector3 m_hitNormal; - const RAS_MeshObject* m_meshObject; // !=NULL for mesh object (only for Bullet controllers) + const RAS_MeshObject* m_meshObject; // !=NULL for mesh object (only for Bullet controllers) int m_polygon; // index of the polygon hit by the ray, // only if m_meshObject != NULL int m_hitUVOK; // !=0 if UV coordinate in m_hitUV is valid @@ -73,8 +73,8 @@ struct PHY_RayCastResult }; /** - * This class replaces the ignoreController parameter of rayTest function. - * It allows more sophisticated filtering on the physics controller before computing the ray intersection to save CPU. + * This class replaces the ignoreController parameter of rayTest function. + * It allows more sophisticated filtering on the physics controller before computing the ray intersection to save CPU. * It is only used to its full extend by the Ccd physics environment (Bullet). */ class PHY_IRayCastFilterCallback @@ -95,7 +95,7 @@ public: virtual void reportHit(PHY_RayCastResult* result) = 0; - PHY_IRayCastFilterCallback(PHY_IPhysicsController* ignoreController, bool faceNormal=false, bool faceUV=false) + PHY_IRayCastFilterCallback(PHY_IPhysicsController* ignoreController, bool faceNormal=false, bool faceUV=false) :m_ignoreController(ignoreController), m_faceNormal(faceNormal), m_faceUV(faceUV) @@ -195,10 +195,10 @@ class PHY_IPhysicsEnvironment //These two methods are *solely* used to create controllers for sensor! Don't use for anything else virtual PHY_IPhysicsController* CreateSphereController(float radius,const MT_Vector3& position) =0; virtual PHY_IPhysicsController* CreateConeController(float coneradius,float coneheight)=0; - + virtual void SetConstraintParam(int constraintId,int param,float value,float value1) = 0; virtual float GetConstraintParam(int constraintId,int param) = 0; - + virtual void ExportFile(const char* filename) {}; virtual void MergeEnvironment(PHY_IPhysicsEnvironment *other_env) = 0; diff --git a/source/gameengine/Physics/common/PHY_IVehicle.h b/source/gameengine/Physics/common/PHY_IVehicle.h index 7e4a49e923e..94676807be9 100644 --- a/source/gameengine/Physics/common/PHY_IVehicle.h +++ b/source/gameengine/Physics/common/PHY_IVehicle.h @@ -19,7 +19,7 @@ class PHY_IVehicle { public: virtual ~PHY_IVehicle() {}; - + virtual void AddWheel( PHY_IMotionState* motionState, MT_Vector3 connectionPoint, @@ -32,7 +32,7 @@ public: virtual int GetNumWheels() const = 0; - + virtual void GetWheelPosition(int wheelIndex,float& posX,float& posY,float& posZ) const = 0; virtual void GetWheelOrientationQuaternion(int wheelIndex,float& quatX,float& quatY,float& quatZ,float& quatW) const = 0; virtual float GetWheelRotation(int wheelIndex) const = 0; @@ -49,13 +49,13 @@ public: virtual void ApplyBraking(float braking,int wheelIndex) = 0; virtual void SetWheelFriction(float friction,int wheelIndex) = 0; - + virtual void SetSuspensionStiffness(float suspensionStiffness,int wheelIndex) = 0; - + virtual void SetSuspensionDamping(float suspensionStiffness,int wheelIndex) = 0; - + virtual void SetSuspensionCompression(float suspensionStiffness,int wheelIndex) = 0; - + virtual void SetRollInfluence(float rollInfluence,int wheelIndex) = 0; virtual void SetCoordinateSystem(int rightIndex,int upIndex,int forwardIndex) =0; diff --git a/source/gameengine/Physics/common/PHY_Pro.h b/source/gameengine/Physics/common/PHY_Pro.h index bfe574e73cb..632cd9bb9fb 100644 --- a/source/gameengine/Physics/common/PHY_Pro.h +++ b/source/gameengine/Physics/common/PHY_Pro.h @@ -37,15 +37,15 @@ // Properties of dynamic objects struct PHY_ShapeProps { MT_Scalar m_mass; // Total mass - MT_Scalar m_inertia; // Inertia, should be a tensor some time + MT_Scalar m_inertia; // Inertia, should be a tensor some time MT_Scalar m_lin_drag; // Linear drag (air, water) 0 = concrete, 1 = vacuum, inverted and called dampening in blenders UI MT_Scalar m_ang_drag; // Angular drag, inverted and called dampening in blenders UI - MT_Scalar m_friction_scaling[3]; // Scaling for anisotropic friction. Component in range [0, 1] + MT_Scalar m_friction_scaling[3]; // Scaling for anisotropic friction. Component in range [0, 1] MT_Scalar m_clamp_vel_min; // Clamp the minimum velocity, this ensures an object moves at a minimum speed unless its stationary MT_Scalar m_clamp_vel_max; // Clamp max velocity MT_Scalar m_clamp_angvel_min; // Clamp the minimum angular velocity. MT_Scalar m_clamp_angvel_max; // Clamp the maximum angular velocity. - bool m_do_anisotropic; // Should I do anisotropic friction? + bool m_do_anisotropic; // Should I do anisotropic friction? bool m_do_fh; // Should the object have a linear Fh spring? bool m_do_rot_fh; // Should the object have an angular Fh spring? MT_Scalar m_step_height; // Max height of climbable steps (Character) @@ -61,7 +61,7 @@ struct PHY_MaterialProps { MT_Scalar m_friction; // Coulomb friction (= ratio between the normal en maximum friction force) MT_Scalar m_fh_spring; // Spring constant (both linear and angular) MT_Scalar m_fh_damping; // Damping factor (linear and angular) in range [0, 1] - MT_Scalar m_fh_distance; // The range above the surface where Fh is active. + MT_Scalar m_fh_distance; // The range above the surface where Fh is active. bool m_fh_normal; // Should the object slide off slopes? }; diff --git a/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp b/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp index f379e2eb486..2749752bc6c 100644 --- a/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp +++ b/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp @@ -92,7 +92,7 @@ void RAS_2DFilterManager::PrintShaderErrors(unsigned int shader, const char *tas if (errorprinted) return; - + errorprinted= true; glGetInfoLogARB(shader, sizeof(log), &length, log); @@ -130,7 +130,7 @@ unsigned int RAS_2DFilterManager::CreateShaderProgram(const char* shadersource) PrintShaderErrors(fShader, "compile", shadersource); goto fail; } - + program = glCreateProgramObjectARB(); glAttachObjectARB(program, fShader); @@ -141,7 +141,7 @@ unsigned int RAS_2DFilterManager::CreateShaderProgram(const char* shadersource) PrintShaderErrors(fShader, "link", shadersource); goto fail; } - + glValidateProgramARB(program); glGetObjectParameterivARB(program, GL_VALIDATE_STATUS, &success); if (!success) { @@ -255,7 +255,7 @@ void RAS_2DFilterManager::StartShaderProgram(int passindex) glUniform1iARB(uniformLoc, 2); } } - + uniformLoc = glGetUniformLocationARB(m_filters[passindex], "bgl_TextureCoordinateOffset"); if (uniformLoc != -1) { @@ -316,7 +316,7 @@ void RAS_2DFilterManager::FreeTextures() void RAS_2DFilterManager::SetupTextures(bool depth, bool luminance) { FreeTextures(); - + glGenTextures(1, (GLuint*)&texname[0]); glBindTexture(GL_TEXTURE_2D, texname[0]); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, texturewidth, textureheight, 0, GL_RGBA, @@ -374,7 +374,7 @@ void RAS_2DFilterManager::UpdateOffsetMatrix(RAS_ICanvas* canvas) GLfloat xInc = 1.0f / (GLfloat)texturewidth; GLfloat yInc = 1.0f / (GLfloat)textureheight; - + for (i = 0; i < 3; i++) { for (j = 0; j < 3; j++) @@ -395,7 +395,7 @@ void RAS_2DFilterManager::UpdateCanvasTextureCoord(const int viewport[4]) */ canvascoord[0] = (GLfloat) viewport[0] / -viewport[2]; canvascoord[1] = (GLfloat) (texturewidth - viewport[0]) / viewport[2]; - + canvascoord[2] = (GLfloat) viewport[1] / -viewport[3]; canvascoord[3] = (GLfloat)(textureheight - viewport[1]) / viewport[3]; } @@ -435,7 +435,7 @@ void RAS_2DFilterManager::RenderFilters(RAS_ICanvas* canvas) UpdateCanvasTextureCoord(viewport); need_tex_update = true; } - + if (need_tex_update) { SetupTextures(need_depth, need_luminance); @@ -447,7 +447,7 @@ void RAS_2DFilterManager::RenderFilters(RAS_ICanvas* canvas) glBindTexture(GL_TEXTURE_2D, texname[1]); glCopyTexImage2D(GL_TEXTURE_2D,0,GL_DEPTH_COMPONENT, viewport[0], viewport[1], viewport[2], viewport[3], 0); } - + if (need_luminance) { glActiveTextureARB(GL_TEXTURE2); glBindTexture(GL_TEXTURE_2D, texname[2]); @@ -458,7 +458,7 @@ void RAS_2DFilterManager::RenderFilters(RAS_ICanvas* canvas) glActiveTextureARB(GL_TEXTURE0); // We do this to make side-by-side stereo rendering work correctly with 2D filters. It would probably be nicer to just set the viewport, - // but it can be easier for writing shaders to have the coordinates for the whole screen instead of just part of the screen. + // but it can be easier for writing shaders to have the coordinates for the whole screen instead of just part of the screen. RAS_Rect scissor_rect = canvas->GetDisplayArea(); glScissor(scissor_rect.GetLeft() + viewport[0], @@ -470,7 +470,7 @@ void RAS_2DFilterManager::RenderFilters(RAS_ICanvas* canvas) // in case the previous material was wire glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); // if the last rendered face had alpha add it would messes with the color of the plane we apply 2DFilter to - glDisable(GL_BLEND); + glDisable(GL_BLEND); // fix for [#34523] alpha buffer is now available for all OSs glDisable(GL_ALPHA_TEST); @@ -540,7 +540,7 @@ void RAS_2DFilterManager::EnableFilter(vector& propNames, void* game texflag[pass] = 0; return; } - + if (mode == RAS_2DFILTER_CUSTOMFILTER) { if (m_filters[pass]) diff --git a/source/gameengine/Rasterizer/RAS_2DFilterManager.h b/source/gameengine/Rasterizer/RAS_2DFilterManager.h index bb727fe3b29..a57acc633c9 100644 --- a/source/gameengine/Rasterizer/RAS_2DFilterManager.h +++ b/source/gameengine/Rasterizer/RAS_2DFilterManager.h @@ -55,12 +55,12 @@ private: void UpdateOffsetMatrix(RAS_ICanvas* canvas); void UpdateCanvasTextureCoord(const int viewport[4]); - + float canvascoord[4]; float textureoffsets[18]; /* float view[4]; */ /* UNUSED */ /* texname[0] contains render to texture, texname[1] contains depth texture, texname[2] contains luminance texture*/ - unsigned int texname[3]; + unsigned int texname[3]; int texturewidth; int textureheight; /* int numberoffilters; */ /* UNUSED */ diff --git a/source/gameengine/Rasterizer/RAS_BucketManager.cpp b/source/gameengine/Rasterizer/RAS_BucketManager.cpp index deca7cbed9f..547c6ec7097 100644 --- a/source/gameengine/Rasterizer/RAS_BucketManager.cpp +++ b/source/gameengine/Rasterizer/RAS_BucketManager.cpp @@ -97,7 +97,7 @@ RAS_BucketManager::~RAS_BucketManager() for (it = m_AlphaBuckets.begin(); it != m_AlphaBuckets.end(); it++) delete(*it); - + m_SolidBuckets.clear(); m_AlphaBuckets.clear(); } @@ -130,7 +130,7 @@ void RAS_BucketManager::OrderBuckets(const MT_Transform& cameratrans, BucketList slots[i++].set(ms, bucket, pnorm); } } - + if (alpha) sort(slots.begin(), slots.end(), backtofront()); else @@ -149,7 +149,7 @@ void RAS_BucketManager::RenderAlphaBuckets(const MT_Transform& cameratrans, RAS_ rasty->SetDepthMask(RAS_IRasterizer::KX_DEPTHMASK_DISABLED); OrderBuckets(cameratrans, m_AlphaBuckets, slots, true); - + for (sit=slots.begin(); sit!=slots.end(); ++sit) { rasty->SetClientObject(sit->m_ms->m_clientObj); @@ -201,7 +201,7 @@ void RAS_BucketManager::RenderSolidBuckets(const MT_Transform& cameratrans, RAS_ } #endif } - + /* this code draws meshes order front-to-back instead to reduce overdraw. * it turned out slower due to much material state switching, a more clever * algorithm might do better. */ @@ -248,7 +248,7 @@ void RAS_BucketManager::Renderbuckets(const MT_Transform& cameratrans, RAS_IRast } } } - + rasty->SetClientObject(NULL); } @@ -262,11 +262,11 @@ RAS_MaterialBucket *RAS_BucketManager::FindBucket(RAS_IPolyMaterial *material, b for (it = m_SolidBuckets.begin(); it != m_SolidBuckets.end(); it++) if (*(*it)->GetPolyMaterial() == *material) return *it; - + for (it = m_AlphaBuckets.begin(); it != m_AlphaBuckets.end(); it++) if (*(*it)->GetPolyMaterial() == *material) return *it; - + RAS_MaterialBucket *bucket = new RAS_MaterialBucket(material); bucketCreated = true; @@ -274,14 +274,14 @@ RAS_MaterialBucket *RAS_BucketManager::FindBucket(RAS_IPolyMaterial *material, b m_AlphaBuckets.push_back(bucket); else m_SolidBuckets.push_back(bucket); - + return bucket; } void RAS_BucketManager::OptimizeBuckets(MT_Scalar distance) { BucketList::iterator bit; - + distance = 10.0f; for (bit = m_SolidBuckets.begin(); bit != m_SolidBuckets.end(); ++bit) @@ -305,7 +305,7 @@ void RAS_BucketManager::ReleaseDisplayLists(RAS_IPolyMaterial *mat) } } } - + for (bit = m_AlphaBuckets.begin(); bit != m_AlphaBuckets.end(); ++bit) { if (mat == NULL || (mat == (*bit)->GetPolyMaterial())) { for (mit = (*bit)->msBegin(); mit != (*bit)->msEnd(); ++mit) { @@ -328,7 +328,7 @@ void RAS_BucketManager::ReleaseMaterials(RAS_IPolyMaterial * mat) (*bit)->GetPolyMaterial()->ReleaseMaterial(); } } - + for (bit = m_AlphaBuckets.begin(); bit != m_AlphaBuckets.end(); ++bit) { if (mat == NULL || (mat == (*bit)->GetPolyMaterial())) { (*bit)->GetPolyMaterial()->ReleaseMaterial(); diff --git a/source/gameengine/Rasterizer/RAS_BucketManager.h b/source/gameengine/Rasterizer/RAS_BucketManager.h index 5ed212ebee0..dead4c619bd 100644 --- a/source/gameengine/Rasterizer/RAS_BucketManager.h +++ b/source/gameengine/Rasterizer/RAS_BucketManager.h @@ -44,7 +44,7 @@ public: private: BucketList m_SolidBuckets; BucketList m_AlphaBuckets; - + struct sortedmeshslot; struct backtofront; struct fronttoback; @@ -57,7 +57,7 @@ public: RAS_MaterialBucket* FindBucket(RAS_IPolyMaterial *material, bool &bucketCreated); void OptimizeBuckets(MT_Scalar distance); - + void ReleaseDisplayLists(RAS_IPolyMaterial *material = NULL); void ReleaseMaterials(RAS_IPolyMaterial *material = NULL); diff --git a/source/gameengine/Rasterizer/RAS_FramingManager.cpp b/source/gameengine/Rasterizer/RAS_FramingManager.cpp index 8b0ec22fde3..6e7c5f1b326 100644 --- a/source/gameengine/Rasterizer/RAS_FramingManager.cpp +++ b/source/gameengine/Rasterizer/RAS_FramingManager.cpp @@ -149,18 +149,18 @@ ComputeBestFitViewRect( const float design_aspect_ratio, RAS_Rect &viewport ) { - // try and honour the aspect ratio when setting the + // try and honour the aspect ratio when setting the // drawable area. If we don't do this we are liable // to get a lot of distortion in the rendered image. - + int width = availableViewport.GetWidth(); int height = availableViewport.GetHeight(); float window_aspect = float(width)/float(height); if (window_aspect < design_aspect_ratio) { - int v_height = (int)(width / design_aspect_ratio); - int left_over = (height - v_height) / 2; - + int v_height = (int)(width / design_aspect_ratio); + int left_over = (height - v_height) / 2; + viewport.SetLeft(availableViewport.GetLeft()); viewport.SetBottom(availableViewport.GetBottom() + left_over); viewport.SetRight(availableViewport.GetLeft() + width); @@ -168,7 +168,7 @@ ComputeBestFitViewRect( } else { int v_width = (int)(height * design_aspect_ratio); - int left_over = (width - v_width) / 2; + int left_over = (width - v_width) / 2; viewport.SetLeft(availableViewport.GetLeft() + left_over); viewport.SetBottom(availableViewport.GetBottom()); @@ -195,7 +195,7 @@ ComputeViewport( float design_aspect_ratio = float(1); if (design_height == float(0)) { - // well this is ill defined + // well this is ill defined // lets just scale the thing type = RAS_FrameSettings::e_frame_scale; @@ -223,7 +223,7 @@ ComputeViewport( design_aspect_ratio, viewport ); - + break; } default : @@ -254,14 +254,14 @@ ComputeFrustum( float design_aspect_ratio = float(1); if (design_height == float(0)) { - // well this is ill defined + // well this is ill defined // lets just scale the thing type = RAS_FrameSettings::e_frame_scale; } else { design_aspect_ratio = design_width/design_height; } - + ComputeDefaultFrustum( camnear, camfar, @@ -317,7 +317,7 @@ ComputeFrustum( frustum.x2 *= x_scale; frustum.y1 *= y_scale; frustum.y2 *= y_scale; - + break; } case RAS_FrameSettings::e_frame_scale : @@ -350,14 +350,14 @@ RAS_FramingManager:: float design_aspect_ratio = float(1); if (design_height == float(0)) { - // well this is ill defined + // well this is ill defined // lets just scale the thing type = RAS_FrameSettings::e_frame_scale; } else { design_aspect_ratio = design_width/design_height; } - + ComputeDefaultOrtho( camnear, camfar, @@ -411,7 +411,7 @@ RAS_FramingManager:: frustum.x2 *= x_scale; frustum.y1 *= y_scale; frustum.y2 *= y_scale; - + break; } case RAS_FrameSettings::e_frame_scale : @@ -419,7 +419,7 @@ RAS_FramingManager:: default : break; } - + } diff --git a/source/gameengine/Rasterizer/RAS_FramingManager.h b/source/gameengine/Rasterizer/RAS_FramingManager.h index cb86a7a4484..3fb488a5af6 100644 --- a/source/gameengine/Rasterizer/RAS_FramingManager.h +++ b/source/gameengine/Rasterizer/RAS_FramingManager.h @@ -43,27 +43,27 @@ class RAS_Rect; * This is a value type describing the framing used * by a particular scene in the game engine. * Each KX_Scene contains a RAS_FrameSetting describing - * how the frustum and viewport are to be modified + * how the frustum and viewport are to be modified * depending on the canvas size. * * e_frame_scale means that the viewport is set to the current - * canvas size. If the view frustum aspect ratio is different + * canvas size. If the view frustum aspect ratio is different * to the canvas aspect this will lead to stretching. * - * e_frame_extend means that the best fit viewport will be + * e_frame_extend means that the best fit viewport will be * computed based upon the design aspect ratio - * and the view frustum will be adjusted so that + * and the view frustum will be adjusted so that * more of the scene is visible. * * e_frame_bars means that the best fit viewport will be * be computed based upon the design aspect ratio. */ -class RAS_FrameSettings +class RAS_FrameSettings { public : /** - * enum defining the policy to use + * enum defining the policy to use * in each axis. */ enum RAS_FrameType { @@ -71,7 +71,7 @@ public : e_frame_extend, e_frame_bars }; - + /** * Constructor */ @@ -82,7 +82,7 @@ public : float bar_g, float bar_b, unsigned int design_aspect_width, - unsigned int design_aspect_height + unsigned int design_aspect_height ): m_frame_type(frame_type), m_bar_r(bar_r), @@ -121,13 +121,13 @@ public : ) { m_frame_type = type; }; - + float BarRed( ) const { return m_bar_r; }; - + float BarGreen( ) const { @@ -165,7 +165,7 @@ private : #ifdef WITH_CXX_GUARDEDALLOC MEM_CXX_CLASS_ALLOC_FUNCS("GE:RAS_FrameSettings") #endif -}; +}; struct RAS_FrameFrustum { @@ -193,8 +193,8 @@ enum RAS_SensorFit /** * \section RAS_FramingManager * This class helps to compute a view frustum - * and a viewport rectangle given the - * above settings and a description of the + * and a viewport rectangle given the + * above settings and a description of the * current canvas dimensions. * * You do not have to instantiate this class @@ -219,10 +219,10 @@ public : RAS_Rect &viewport ); - + /** * compute a frustum given a valid viewport, - * RAS_FrameSettings, canvas description + * RAS_FrameSettings, canvas description * and camera description */ diff --git a/source/gameengine/Rasterizer/RAS_ICanvas.h b/source/gameengine/Rasterizer/RAS_ICanvas.h index 91cc13c8f85..2c67f454df1 100644 --- a/source/gameengine/Rasterizer/RAS_ICanvas.h +++ b/source/gameengine/Rasterizer/RAS_ICanvas.h @@ -62,18 +62,18 @@ public: RAS_ICanvas(); virtual ~RAS_ICanvas(); - virtual - void + virtual + void Init( ) = 0; - virtual - void + virtual + void BeginFrame( )=0; - virtual - void + virtual + void EndFrame( )=0; @@ -86,8 +86,8 @@ public: * */ - virtual - bool + virtual + bool BeginDraw( )=0; @@ -95,18 +95,18 @@ public: * Unitializes the canvas for drawing. */ - virtual - void + virtual + void EndDraw( )=0; /// probably needs some arguments for PS2 in future - virtual - void + virtual + void SwapBuffers( )=0; - + virtual void SetSwapInterval( @@ -118,15 +118,15 @@ public: GetSwapInterval( int& intervalOut )=0; - - virtual - void + + virtual + void ClearBuffer( int type )=0; - virtual - void + virtual + void ClearColor( float r, float g, @@ -134,13 +134,13 @@ public: float a )=0; - virtual - int + virtual + int GetWidth( ) const = 0; - virtual - int + virtual + int GetHeight( ) const = 0; @@ -183,7 +183,7 @@ public: ) = 0; /** - * Set the visible view-port + * Set the visible view-port */ virtual @@ -212,14 +212,14 @@ public: const int* GetViewPort() = 0; - virtual - void + virtual + void SetMouseState( RAS_MouseState mousestate )=0; - virtual - void + virtual + void SetMousePosition( int x, int y @@ -232,8 +232,8 @@ public: return m_mousestate; } - virtual - void + virtual + void MakeScreenShot( const char* filename )=0; @@ -241,7 +241,7 @@ public: virtual void GetDisplayDimensions(int &width, int &height) = 0; virtual - void + void ResizeWindow( int width, int height @@ -257,8 +257,8 @@ public: bool GetFullScreen()=0; - - + + protected: RAS_MouseState m_mousestate; int m_frame; /// frame number for screenshots. diff --git a/source/gameengine/Rasterizer/RAS_ILightObject.h b/source/gameengine/Rasterizer/RAS_ILightObject.h index a3d55c925d6..2ff4ec7da01 100644 --- a/source/gameengine/Rasterizer/RAS_ILightObject.h +++ b/source/gameengine/Rasterizer/RAS_ILightObject.h @@ -54,7 +54,7 @@ public: int m_layer; void *m_scene; void *m_light; - + float m_energy; float m_distance; float m_shadowclipstart; @@ -74,7 +74,7 @@ public: float m_spotblend; LightType m_type; - + bool m_nodiffuse; bool m_nospecular; bool m_glsl; diff --git a/source/gameengine/Rasterizer/RAS_IPolygonMaterial.cpp b/source/gameengine/Rasterizer/RAS_IPolygonMaterial.cpp index 2a736aa7deb..cfe239a2e09 100644 --- a/source/gameengine/Rasterizer/RAS_IPolygonMaterial.cpp +++ b/source/gameengine/Rasterizer/RAS_IPolygonMaterial.cpp @@ -35,7 +35,7 @@ #include "DNA_material_types.h" -void RAS_IPolyMaterial::Initialize( +void RAS_IPolyMaterial::Initialize( const STR_String& texname, const STR_String& matname, int materialindex, @@ -69,7 +69,7 @@ void RAS_IPolyMaterial::Initialize( m_drawingmode = ConvertFaceMode(game, image); } -RAS_IPolyMaterial::RAS_IPolyMaterial() +RAS_IPolyMaterial::RAS_IPolyMaterial() : m_texturename("__Dummy_Texture_Name__"), m_materialname("__Dummy_Material_Name__"), m_tile(0), @@ -180,7 +180,7 @@ bool RAS_IPolyMaterial::Less(const RAS_IPolyMaterial& rhs) const { if (Equals(rhs)) return false; - + return m_polymatid < rhs.m_polymatid; } @@ -205,7 +205,7 @@ int RAS_IPolyMaterial::GetDrawingMode() const } const STR_String& RAS_IPolyMaterial::GetMaterialName() const -{ +{ return m_materialname; } @@ -273,7 +273,7 @@ bool RAS_IPolyMaterial::UsesLighting(RAS_IRasterizer *rasty) const else { dolights = m_light; } - + return dolights; } diff --git a/source/gameengine/Rasterizer/RAS_IPolygonMaterial.h b/source/gameengine/Rasterizer/RAS_IPolygonMaterial.h index a34f7a9b390..70d48fce48c 100644 --- a/source/gameengine/Rasterizer/RAS_IPolygonMaterial.h +++ b/source/gameengine/Rasterizer/RAS_IPolygonMaterial.h @@ -74,7 +74,7 @@ class RAS_IPolyMaterial //todo: remove these variables from this interface/protocol class protected: STR_HashedString m_texturename; - STR_HashedString m_materialname; //also needed for touchsensor + STR_HashedString m_materialname; //also needed for touchsensor int m_tile; int m_tilexrep,m_tileyrep; int m_drawingmode; @@ -83,7 +83,7 @@ protected: bool m_zsort; bool m_light; int m_materialindex; - + unsigned int m_polymatid; static unsigned int m_newpolymatid; @@ -95,7 +95,7 @@ public: float m_shininess; MT_Vector3 m_specular; float m_specularity; - + /** Used to store caching information for materials. */ typedef void* TCachingInfo; @@ -131,7 +131,7 @@ public: struct GameSettings* game); virtual ~RAS_IPolyMaterial() {} - + /** * Returns the caching information for this material, * This can be used to speed up the rasterizing process. @@ -146,9 +146,9 @@ public: * \param rasty The rasterizer in which the material should be active. * \param cachingInfo The information about the material used to speed up rasterizing. */ - virtual bool Activate(RAS_IRasterizer* rasty, TCachingInfo& cachingInfo) const - { - return false; + virtual bool Activate(RAS_IRasterizer* rasty, TCachingInfo& cachingInfo) const + { + return false; } virtual void ActivateMeshSlot(const class RAS_MeshSlot & ms, RAS_IRasterizer* rasty) const {} diff --git a/source/gameengine/Rasterizer/RAS_IRasterizer.h b/source/gameengine/Rasterizer/RAS_IRasterizer.h index dc92408915b..783c216e3c5 100644 --- a/source/gameengine/Rasterizer/RAS_IRasterizer.h +++ b/source/gameengine/Rasterizer/RAS_IRasterizer.h @@ -64,7 +64,7 @@ typedef vector vecVertexArray; typedef vector vecIndexArrays; /** - * 3D rendering device context interface. + * 3D rendering device context interface. */ class RAS_IRasterizer { @@ -275,7 +275,7 @@ public: * SwapBuffers swaps the back buffer with the front buffer. */ virtual void SwapBuffers() = 0; - + // Drawing Functions /** * IndexPrimitives: Renders primitives from mesh slot. @@ -286,7 +286,7 @@ public: * IndexPrimitives_3DText will render text into the polygons. */ virtual void IndexPrimitives_3DText(class RAS_MeshSlot &ms, class RAS_IPolyMaterial *polymat) = 0; - + virtual void SetProjectionMatrix(MT_CmMatrix4x4 &mat) = 0; /* This one should become our final version, methinks. */ @@ -316,7 +316,7 @@ public: virtual void EnableFog(bool enable) = 0; virtual void SetBackColor(float color[3]) = 0; - + /** * \param drawingmode = KX_BOUNDINGBOX, KX_WIREFRAME, KX_SOLID, KX_SHADED or KX_TEXTURED. */ @@ -374,7 +374,7 @@ public: * Sets the specular color component of the lighting equation. */ virtual void SetSpecularity(float specX, float specY, float specZ, float specval) = 0; - + /** * Sets the specular exponent component of the lighting equation. */ @@ -387,9 +387,9 @@ public: /** * Sets the emissive color component of the lighting equation. - */ + */ virtual void SetEmissive(float eX, float eY, float eZ, float e) = 0; - + virtual void SetAmbientColor(float color[3]) = 0; virtual void SetAmbient(float factor) = 0; @@ -397,12 +397,12 @@ public: * Sets a polygon offset. z depth will be: z1 = mult*z0 + add */ virtual void SetPolygonOffset(float mult, float add) = 0; - + virtual void DrawDebugLine(SCA_IScene *scene, const MT_Vector3 &from, const MT_Vector3 &to, const MT_Vector3& color) = 0; virtual void DrawDebugCircle(SCA_IScene *scene, const MT_Vector3 ¢er, const MT_Scalar radius, const MT_Vector3 &color, const MT_Vector3 &normal, int nsector) = 0; virtual void FlushDebugShapes(SCA_IScene *scene) = 0; - + virtual void SetTexCoordNum(int num) = 0; virtual void SetAttribNum(int num) = 0; virtual void SetTexCoord(TexCoGen coords, int unit) = 0; @@ -413,10 +413,10 @@ public: virtual bool QueryLists() { return false; } virtual bool QueryArrays() { return false; } - + virtual void EnableMotionBlur(float motionblurvalue) = 0; virtual void DisableMotionBlur() = 0; - + virtual float GetMotionBlurValue() = 0; virtual int GetMotionBlurState() = 0; virtual void SetMotionBlurState(int newstate) = 0; diff --git a/source/gameengine/Rasterizer/RAS_MaterialBucket.cpp b/source/gameengine/Rasterizer/RAS_MaterialBucket.cpp index 9cd8f77adfd..0de9af50872 100644 --- a/source/gameengine/Rasterizer/RAS_MaterialBucket.cpp +++ b/source/gameengine/Rasterizer/RAS_MaterialBucket.cpp @@ -117,7 +117,7 @@ RAS_MeshSlot::RAS_MeshSlot(const RAS_MeshSlot& slot) : SG_QList() m_endindex = slot.m_endindex; for (it=m_displayArrays.begin(); it!=m_displayArrays.end(); it++) { - // don't copy display arrays for now because it breaks python + // don't copy display arrays for now because it breaks python // access to vertices, but we'll need a solution if we want to // join display arrays for reducing draw calls. //*it = new RAS_DisplayArray(**it); @@ -215,7 +215,7 @@ void RAS_MeshSlot::SetDisplayArray(int numverts) { RAS_DisplayArrayList::iterator it; RAS_DisplayArray *darray = NULL; - + for (it=m_displayArrays.begin(); it!=m_displayArrays.end(); it++) { darray = *it; @@ -247,7 +247,7 @@ void RAS_MeshSlot::SetDisplayArray(int numverts) darray->m_type = RAS_DisplayArray::TRIANGLE; else if (numverts == 4) darray->m_type = RAS_DisplayArray::QUAD; - + m_endarray = m_displayArrays.size()-1; m_endvertex = 0; m_endindex = 0; @@ -265,7 +265,7 @@ int RAS_MeshSlot::AddVertex(const RAS_TexVert& tv) { RAS_DisplayArray *darray; int offset; - + darray = m_currentArray; darray->m_vertex.push_back(tv); offset = darray->m_vertex.size()-1; @@ -366,7 +366,7 @@ bool RAS_MeshSlot::Equals(RAS_MeshSlot *target) return false; if (m_bObjectColor && !(m_RGBAcolor == target->m_RGBAcolor)) return false; - + return true; } @@ -382,7 +382,7 @@ bool RAS_MeshSlot::Join(RAS_MeshSlot *target, MT_Scalar distance) if (!Equals(target)) return false; - + MT_Vector3 co(&m_OpenGLMatrix[12]); MT_Vector3 targetco(&target->m_OpenGLMatrix[12]); @@ -394,7 +394,7 @@ bool RAS_MeshSlot::Join(RAS_MeshSlot *target, MT_Scalar distance) targetmat.invert(); MT_Matrix4x4 transform = targetmat*mat; - + // m_mesh, clientobj m_joinSlot = target; m_joinInvTransform = transform; @@ -407,7 +407,7 @@ bool RAS_MeshSlot::Join(RAS_MeshSlot *target, MT_Scalar distance) for (begin(mit); !end(mit); next(mit)) for (i=mit.startvertex; im_displayArrays.reserve(target->m_displayArrays.size() + m_displayArrays.size()); @@ -426,7 +426,7 @@ bool RAS_MeshSlot::Join(RAS_MeshSlot *target, MT_Scalar distance) target->m_DisplayList->Release(); target->m_DisplayList = NULL; } - + return true; #if 0 return false; @@ -517,9 +517,9 @@ bool RAS_MeshSlot::IsCulled() struct RAS_MaterialBucket::less { - bool operator()(const RAS_MaterialBucket* x, const RAS_MaterialBucket* y) const - { - return *x->GetPolyMaterial() < *y->GetPolyMaterial(); + bool operator()(const RAS_MaterialBucket* x, const RAS_MaterialBucket* y) const + { + return *x->GetPolyMaterial() < *y->GetPolyMaterial(); } }; @@ -535,7 +535,7 @@ RAS_MaterialBucket::~RAS_MaterialBucket() } RAS_IPolyMaterial* RAS_MaterialBucket::GetPolyMaterial() const -{ +{ return m_material; } @@ -554,7 +554,7 @@ RAS_MeshSlot* RAS_MaterialBucket::AddMesh(int numverts) RAS_MeshSlot *ms; m_meshSlots.push_back(RAS_MeshSlot()); - + ms = &m_meshSlots.back(); ms->init(this, numverts); @@ -564,7 +564,7 @@ RAS_MeshSlot* RAS_MaterialBucket::AddMesh(int numverts) RAS_MeshSlot* RAS_MaterialBucket::CopyMesh(RAS_MeshSlot *ms) { m_meshSlots.push_back(RAS_MeshSlot(*ms)); - + return &m_meshSlots.back(); } @@ -593,7 +593,7 @@ list::iterator RAS_MaterialBucket::msEnd() bool RAS_MaterialBucket::ActivateMaterial(const MT_Transform& cameratrans, RAS_IRasterizer* rasty) { bool uselights; - + if (rasty->GetDrawingMode() == RAS_IRasterizer::KX_SHADOW && !m_material->CastsShadows()) return false; @@ -602,10 +602,10 @@ bool RAS_MaterialBucket::ActivateMaterial(const MT_Transform& cameratrans, RAS_I if (!rasty->SetMaterial(*m_material)) return false; - + uselights= m_material->UsesLighting(rasty); rasty->ProcessLighting(uselights, cameratrans); - + return true; } @@ -619,7 +619,7 @@ void RAS_MaterialBucket::RenderMeshSlot(const MT_Transform& cameratrans, RAS_IRa ms.m_mesh->SetMeshModified(true); // KX_ReInstanceShapeFromMesh(ms.m_mesh); // Recompute the physics mesh. (Can't call KX_* from RAS_) } - + if (IsZSort() && rasty->GetDrawingMode() >= RAS_IRasterizer::KX_SOLID) ms.m_mesh->SortPolygons(ms, cameratrans*MT_Transform(ms.m_OpenGLMatrix)); @@ -665,7 +665,7 @@ void RAS_MaterialBucket::Optimize(MT_Scalar distance) /* TODO: still have to check before this works correct: * - lightlayer, frontface, text, billboard * - make it work with physics */ - + #if 0 list::iterator it; list::iterator jt; diff --git a/source/gameengine/Rasterizer/RAS_MaterialBucket.h b/source/gameengine/Rasterizer/RAS_MaterialBucket.h index 75cc382c78c..8ea80d883cf 100644 --- a/source/gameengine/Rasterizer/RAS_MaterialBucket.h +++ b/source/gameengine/Rasterizer/RAS_MaterialBucket.h @@ -62,7 +62,7 @@ protected: public: KX_ListSlot() { m_refcount = 1; } virtual ~KX_ListSlot() {} - virtual int Release() { + virtual int Release() { if (--m_refcount > 0) return m_refcount; delete this; @@ -92,7 +92,7 @@ public: /* LINE currently isn't used */ enum { LINE = 2, TRIANGLE = 3, QUAD = 4 } m_type; //RAS_MeshSlot *m_origSlot; - + /* Number of RAS_MeshSlot using this array */ int m_users; @@ -146,7 +146,7 @@ public: RAS_MeshSlot(); RAS_MeshSlot(const RAS_MeshSlot& slot); virtual ~RAS_MeshSlot(); - + void init(RAS_MaterialBucket *bucket, int numverts); struct iterator { @@ -218,7 +218,7 @@ class RAS_MaterialBucket public: RAS_MaterialBucket(RAS_IPolyMaterial* mat); virtual ~RAS_MaterialBucket(); - + /* Bucket Sorting */ struct less; typedef set Set; @@ -227,11 +227,11 @@ public: RAS_IPolyMaterial* GetPolyMaterial() const; bool IsAlpha() const; bool IsZSort() const; - + /* Rendering */ bool ActivateMaterial(const MT_Transform& cameratrans, RAS_IRasterizer* rasty); void RenderMeshSlot(const MT_Transform& cameratrans, RAS_IRasterizer* rasty, RAS_MeshSlot &ms); - + /* Mesh Slot Access */ list::iterator msBegin(); list::iterator msEnd(); @@ -257,7 +257,7 @@ private: list m_meshSlots; // all the mesh slots RAS_IPolyMaterial* m_material; SG_DList m_activeMeshSlotsHead; // only those which must be rendered - + #ifdef WITH_CXX_GUARDEDALLOC MEM_CXX_CLASS_ALLOC_FUNCS("GE:RAS_MaterialBucket") diff --git a/source/gameengine/Rasterizer/RAS_MeshObject.cpp b/source/gameengine/Rasterizer/RAS_MeshObject.cpp index 4360464ed32..f39af70cf71 100644 --- a/source/gameengine/Rasterizer/RAS_MeshObject.cpp +++ b/source/gameengine/Rasterizer/RAS_MeshObject.cpp @@ -49,7 +49,7 @@ struct RAS_MeshObject::polygonSlot { float m_z; int m_index[4]; - + polygonSlot() {} /* pnorm is the normal from the plane equation that the distance from is @@ -79,7 +79,7 @@ struct RAS_MeshObject::polygonSlot indexarray[offset+i] = m_index[i]; } }; - + struct RAS_MeshObject::backtofront { bool operator()(const polygonSlot &a, const polygonSlot &b) const @@ -147,12 +147,12 @@ int RAS_MeshObject::NumMaterials() } const STR_String& RAS_MeshObject::GetMaterialName(unsigned int matid) -{ +{ RAS_MeshMaterial* mmat = GetMeshMaterial(matid); if (mmat) return mmat->m_bucket->GetPolyMaterial()->GetMaterialName(); - + return s_emptyname; } @@ -182,8 +182,8 @@ RAS_Polygon* RAS_MeshObject::GetPolygon(int num) const return m_Polygons[num]; } - - + + list::iterator GetFirstMaterial(); list::iterator GetLastMaterial(); @@ -216,9 +216,9 @@ STR_String& RAS_MeshObject::GetName() const STR_String& RAS_MeshObject::GetTextureName(unsigned int matid) -{ +{ RAS_MeshMaterial* mmat = GetMeshMaterial(matid); - + if (mmat) return mmat->m_bucket->GetPolyMaterial()->GetTextureName(); @@ -321,7 +321,7 @@ void RAS_MeshObject::AddVertex(RAS_Polygon *poly, int i, RAS_DisplayArray *darray; RAS_MeshSlot *slot; int offset; - + mmat = GetMeshMaterial(poly->GetMaterial()->GetPolyMaterial()); slot = mmat->m_baseslot; darray = slot->CurrentDisplayArray(); @@ -373,7 +373,7 @@ int RAS_MeshObject::NumVertices(RAS_IPolyMaterial* mat) slot = mmat->m_baseslot; for (slot->begin(it); !slot->end(it); slot->next(it)) len += it.endvertex - it.startvertex; - + return len; } @@ -390,7 +390,7 @@ RAS_TexVert* RAS_MeshObject::GetVertex(unsigned int matid, if (!mmat) return NULL; - + slot = mmat->m_baseslot; len = 0; for (slot->begin(it); !slot->end(it); slot->next(it)) { @@ -399,7 +399,7 @@ RAS_TexVert* RAS_MeshObject::GetVertex(unsigned int matid, else return &it.vertex[index - len]; } - + return NULL; } @@ -416,22 +416,22 @@ void RAS_MeshObject::AddMeshUser(void *clientobj, SG_QList *head, RAS_Deformer* list::iterator mit; for (it = m_materials.begin();it!=m_materials.end();++it) { - /* always copy from the base slot, which is never removed + /* always copy from the base slot, which is never removed * since new objects can be created with the same mesh data */ if (deformer && !deformer->UseVertexArray()) { - // HACK! + // HACK! // this deformer doesn't use vertex array => derive mesh // we must keep only the mesh slots that have unique material id // this is to match the derived mesh drawing function // Need a better solution in the future: scan the derive mesh and create vertex array RAS_IPolyMaterial* curmat = it->m_bucket->GetPolyMaterial(); - if (curmat->GetFlag() & RAS_BLENDERGLSL) + if (curmat->GetFlag() & RAS_BLENDERGLSL) { for (mit = m_materials.begin(); mit != it; ++mit) { RAS_IPolyMaterial* mat = mit->m_bucket->GetPolyMaterial(); - if ((mat->GetFlag() & RAS_BLENDERGLSL) && + if ((mat->GetFlag() & RAS_BLENDERGLSL) && mat->GetMaterialIndex() == curmat->GetMaterialIndex()) // no need to convert current mesh slot break; @@ -451,7 +451,7 @@ void RAS_MeshObject::AddMeshUser(void *clientobj, SG_QList *head, RAS_Deformer* void RAS_MeshObject::RemoveFromBuckets(void *clientobj) { list::iterator it; - + for (it = m_materials.begin();it!=m_materials.end();++it) { RAS_MeshSlot **msp = it->m_slots[clientobj]; @@ -485,7 +485,7 @@ void RAS_MeshObject::EndConversion() //void RAS_MeshObject::Transform(const MT_Transform& trans) //{ //m_trans.translate(MT_Vector3(0,0,1));//.operator *=(trans); - + // for (int i=0;iTransform(trans); @@ -508,7 +508,7 @@ void RAS_MeshObject::SortPolygons(RAS_MeshSlot& ms, const MT_Transform &transfor // Limitations: sorting is quite simple, and handles many // cases wrong, partially due to polygons being sorted per // bucket. - // + // // a) mixed triangles/quads are sorted wrong // b) mixed materials are sorted wrong // c) more than 65k faces are sorted wrong @@ -569,5 +569,5 @@ void RAS_MeshObject::SchedulePolygons(int drawingmode) { m_bModified = false; m_bMeshModified = true; - } + } } diff --git a/source/gameengine/Rasterizer/RAS_MeshObject.h b/source/gameengine/Rasterizer/RAS_MeshObject.h index a6f1a1cafc6..ac643f52f06 100644 --- a/source/gameengine/Rasterizer/RAS_MeshObject.h +++ b/source/gameengine/Rasterizer/RAS_MeshObject.h @@ -107,7 +107,7 @@ public: Mesh* GetMesh() { return m_mesh; } /* mesh construction */ - + virtual RAS_Polygon* AddPolygon(RAS_MaterialBucket *bucket, int numverts); virtual void AddVertex(RAS_Polygon *poly, int i, const MT_Point3& xyz, @@ -127,7 +127,7 @@ public: int NumPolygons(); RAS_Polygon* GetPolygon(int num) const; - + /* buckets */ virtual void AddMeshUser(void *clientobj, SG_QList *head, RAS_Deformer* deformer); @@ -137,7 +137,7 @@ public: /* colors */ void DebugColor(unsigned int abgr); void SetVertexColor(RAS_IPolyMaterial* mat,MT_Vector4 rgba); - + /* polygon sorting by Z for alpha */ void SortPolygons(RAS_MeshSlot& ms, const MT_Transform &transform); diff --git a/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_GrayScale2DFilter.h b/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_GrayScale2DFilter.h index 932d5b16fed..b2ac1008de1 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_GrayScale2DFilter.h +++ b/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_GrayScale2DFilter.h @@ -37,7 +37,7 @@ uniform sampler2D bgl_RenderedTexture; void main(void) { - vec4 texcolor = texture2D(bgl_RenderedTexture, gl_TexCoord[0].st); + vec4 texcolor = texture2D(bgl_RenderedTexture, gl_TexCoord[0].st); float gray = dot(texcolor.rgb, vec3(0.299, 0.587, 0.114)); gl_FragColor = vec4(gray, gray, gray, texcolor.a); } diff --git a/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Sepia2DFilter.h b/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Sepia2DFilter.h index 16b4e71dfdb..1aad0ddea6b 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Sepia2DFilter.h +++ b/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Sepia2DFilter.h @@ -37,7 +37,7 @@ uniform sampler2D bgl_RenderedTexture; void main(void) { - vec4 texcolor = texture2D(bgl_RenderedTexture, gl_TexCoord[0].st); + vec4 texcolor = texture2D(bgl_RenderedTexture, gl_TexCoord[0].st); float gray = dot(texcolor.rgb, vec3(0.299, 0.587, 0.114)); gl_FragColor = vec4(gray * vec3(1.2, 1.0, 0.8), texcolor.a); } diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.cpp index 71c8cfe745f..3afb94413bc 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.cpp +++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.cpp @@ -89,7 +89,7 @@ void RAS_ListSlot::DrawList() } if (m_list != 0) glNewList((GLuint)m_list, GL_COMPILE); - + m_flag |= LIST_BEGIN; return; } @@ -127,7 +127,7 @@ RAS_ListRasterizer::RAS_ListRasterizer(RAS_ICanvas* canvas, bool lock, RAS_STORA { } -RAS_ListRasterizer::~RAS_ListRasterizer() +RAS_ListRasterizer::~RAS_ListRasterizer() { ReleaseAlloc(); } diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLLight.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLLight.cpp index 69e859f06d9..ff0e7516fc8 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLLight.cpp +++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLLight.cpp @@ -180,7 +180,7 @@ bool RAS_OpenGLLight::HasShadowBuffer() int RAS_OpenGLLight::GetShadowBindCode() { GPULamp *lamp; - + if ((lamp = GetGPULamp())) return GPU_lamp_shadow_bind_code(lamp); return -1; diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp index 5eed9b3b8f8..fa24395a74e 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp +++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp @@ -29,10 +29,10 @@ * \ingroup bgerastogl */ - + #include #include - + #include "RAS_OpenGLRasterizer.h" #include "GPU_glew.h" @@ -116,7 +116,7 @@ RAS_OpenGLRasterizer::RAS_OpenGLRasterizer(RAS_ICanvas* canvas, RAS_STORAGE_TYPE { m_viewmatrix.setIdentity(); m_viewinvmatrix.setIdentity(); - + for (int i = 0; i < 32; i++) { left_eye_vinterlace_mask[i] = 0x55555555; @@ -256,13 +256,13 @@ void RAS_OpenGLRasterizer::Exit() glDepthMask (GL_TRUE); glDepthFunc(GL_LEQUAL); glBlendFunc(GL_ONE, GL_ZERO); - + glDisable(GL_POLYGON_STIPPLE); - + glDisable(GL_LIGHTING); if (GLEW_EXT_separate_specular_color || GLEW_VERSION_1_2) glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL, GL_SINGLE_COLOR); - + EndFrame(); } @@ -302,7 +302,7 @@ bool RAS_OpenGLRasterizer::BeginFrame(double time) m_lastauxinfo = NULL; m_lastlighting = true; /* force disable in DisableOpenGLLights() */ DisableOpenGLLights(); - + return true; } @@ -441,7 +441,7 @@ void RAS_OpenGLRasterizer::SetRenderArea() area.SetLeft(0); area.SetBottom(m_2DCanvas->GetHeight() - int(m_2DCanvas->GetHeight() - m_noOfScanlines) / 2); - + area.SetRight(int(m_2DCanvas->GetWidth())); area.SetTop(int(m_2DCanvas->GetHeight())); m_2DCanvas->SetDisplayArea(&area); @@ -463,7 +463,7 @@ void RAS_OpenGLRasterizer::SetRenderArea() area.SetLeft(0); area.SetBottom(m_2DCanvas->GetHeight() - m_2DCanvas->GetHeight() / 2); - + area.SetRight(m_2DCanvas->GetWidth()); area.SetTop(m_2DCanvas->GetHeight()); m_2DCanvas->SetDisplayArea(&area); @@ -509,7 +509,7 @@ void RAS_OpenGLRasterizer::SetRenderArea() break; } } - + void RAS_OpenGLRasterizer::SetStereoMode(const StereoMode stereomode) { m_stereomode = stereomode; @@ -646,7 +646,7 @@ const MT_Matrix4x4& RAS_OpenGLRasterizer::GetViewInvMatrix() const void RAS_OpenGLRasterizer::IndexPrimitives_3DText(RAS_MeshSlot& ms, class RAS_IPolyMaterial* polymat) -{ +{ bool obcolor = ms.m_bObjectColor; MT_Vector4& rgba = ms.m_RGBAcolor; RAS_MeshSlot::iterator it; @@ -664,7 +664,7 @@ void RAS_OpenGLRasterizer::IndexPrimitives_3DText(RAS_MeshSlot& ms, for (ms.begin(it); !ms.end(it); ms.next(it)) { RAS_TexVert *vertex; size_t i, j, numvert; - + numvert = it.array->m_type; if (it.array->m_type == RAS_DisplayArray::LINE) { @@ -875,7 +875,7 @@ MT_Matrix4x4 RAS_OpenGLRasterizer::GetFrustumMatrix( float frustnear, float frustfar, float focallength, - bool + bool ) { MT_Matrix4x4 result; float mat[16]; @@ -912,11 +912,11 @@ MT_Matrix4x4 RAS_OpenGLRasterizer::GetFrustumMatrix( top *= 2.0f; } } - + glMatrixMode(GL_PROJECTION); glLoadIdentity(); glFrustum(left, right, bottom, top, frustnear, frustfar); - + glGetFloatv(GL_PROJECTION_MATRIX, mat); result.setValue(mat); @@ -938,7 +938,7 @@ MT_Matrix4x4 RAS_OpenGLRasterizer::GetOrthoMatrix( glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(left, right, bottom, top, frustnear, frustfar); - + glGetFloatv(GL_PROJECTION_MATRIX, mat); result.setValue(mat); @@ -947,7 +947,7 @@ MT_Matrix4x4 RAS_OpenGLRasterizer::GetOrthoMatrix( // next arguments probably contain redundant info, for later... -void RAS_OpenGLRasterizer::SetViewMatrix(const MT_Matrix4x4 &mat, +void RAS_OpenGLRasterizer::SetViewMatrix(const MT_Matrix4x4 &mat, const MT_Matrix3x3 & camOrientMat3x3, const MT_Point3 & pos, const MT_Vector3 &scale, @@ -1131,7 +1131,7 @@ void RAS_OpenGLRasterizer::SetAlphaBlend(int alphablend) glAlphaFunc(GL_GREATER, 0.0f); } else if (alphablend == GPU_BLEND_CLIP) { - glDisable(GL_BLEND); + glDisable(GL_BLEND); glEnable(GL_ALPHA_TEST); glAlphaFunc(GL_GREATER, 0.5f); } @@ -1152,7 +1152,7 @@ void RAS_OpenGLRasterizer::SetFrontFace(bool ccw) glFrontFace(GL_CCW); else glFrontFace(GL_CW); - + m_last_frontface = ccw; } diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h index 9561e207dba..b288c3c5d8f 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h +++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h @@ -79,7 +79,7 @@ struct OglDebugShape class RAS_OpenGLRasterizer : public RAS_IRasterizer { RAS_ICanvas *m_2DCanvas; - + /* fogging vars */ bool m_fogenabled; @@ -87,7 +87,7 @@ class RAS_OpenGLRasterizer : public RAS_IRasterizer float m_greenback; float m_blueback; float m_alphaback; - + float m_ambr; float m_ambg; float m_ambb; @@ -200,7 +200,7 @@ public: virtual const MT_Point3& GetCameraPosition(); virtual bool GetCameraOrtho(); - + virtual void SetFog(short type, float start, float dist, float intensity, float color[3]); virtual void EnableFog(bool enable); virtual void DisplayFog(); @@ -215,7 +215,7 @@ public: virtual MT_Matrix4x4 GetFrustumMatrix( float left, float right, float bottom, float top, - float frustnear, float frustfar, + float frustnear, float frustfar, float focallength, bool perspective); virtual MT_Matrix4x4 GetOrthoMatrix( float left, float right, float bottom, float top, @@ -268,7 +268,7 @@ public: const MT_Matrix4x4 &GetViewMatrix() const; const MT_Matrix4x4 &GetViewInvMatrix() const; - + virtual void EnableMotionBlur(float motionblurvalue); virtual void DisableMotionBlur(); virtual float GetMotionBlurValue() { return m_motionblurvalue; } @@ -279,13 +279,13 @@ public: m_motionblur = 0; else if (newstate > 2) m_motionblur = 2; - else + else m_motionblur = newstate; } virtual void SetAlphaBlend(int alphablend); virtual void SetFrontFace(bool ccw); - + virtual void SetAnisotropicFiltering(short level); virtual short GetAnisotropicFiltering(); diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageVA.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageVA.cpp index f980116f5f8..b8900121d69 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageVA.cpp +++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageVA.cpp @@ -111,7 +111,7 @@ void RAS_StorageVA::IndexPrimitives(class RAS_MeshSlot& ms) // here the actual drawing takes places glDrawElements(drawmode, it.totindex, GL_UNSIGNED_SHORT, it.index); } - + glDisableClientState(GL_VERTEX_ARRAY); glDisableClientState(GL_NORMAL_ARRAY); if (!wireframe) { @@ -192,7 +192,7 @@ void RAS_StorageVA::EnableTextures(bool enable) texco_num = *m_texco_num; attrib = m_attrib; attrib_num = *m_attrib_num; - + memcpy(m_last_texco, m_texco, sizeof(RAS_IRasterizer::TexCoGen)*(*m_texco_num)); m_last_texco_num = *m_texco_num; memcpy(m_last_attrib, m_attrib, sizeof(RAS_IRasterizer::TexCoGen)*(*m_attrib_num)); diff --git a/source/gameengine/Rasterizer/RAS_Polygon.cpp b/source/gameengine/Rasterizer/RAS_Polygon.cpp index 3274ded4406..4ed9b20f325 100644 --- a/source/gameengine/Rasterizer/RAS_Polygon.cpp +++ b/source/gameengine/Rasterizer/RAS_Polygon.cpp @@ -78,7 +78,7 @@ void RAS_Polygon::SetEdgeCode(int edgecode) m_edgecode = edgecode; }*/ - + bool RAS_Polygon::IsVisible() { return (m_polyflags & VISIBLE) != 0; diff --git a/source/gameengine/Rasterizer/RAS_Polygon.h b/source/gameengine/Rasterizer/RAS_Polygon.h index 597e80ffdfb..8606eb34081 100644 --- a/source/gameengine/Rasterizer/RAS_Polygon.h +++ b/source/gameengine/Rasterizer/RAS_Polygon.h @@ -57,7 +57,7 @@ class RAS_Polygon unsigned char m_edgecode; unsigned char m_polyflags; #endif - + public: enum { VISIBLE = 1, @@ -67,7 +67,7 @@ public: RAS_Polygon(RAS_MaterialBucket* bucket, RAS_DisplayArray* darray, int numvert); virtual ~RAS_Polygon() {}; - + int VertexCount(); RAS_TexVert* GetVertex(int i); @@ -78,7 +78,7 @@ public: // - Not used yet! /* int GetEdgeCode(); void SetEdgeCode(int edgecode); */ - + bool IsVisible(); void SetVisible(bool visible); diff --git a/source/gameengine/Rasterizer/RAS_Rect.h b/source/gameengine/Rasterizer/RAS_Rect.h index fc99c9159db..cd68b336b2a 100644 --- a/source/gameengine/Rasterizer/RAS_Rect.h +++ b/source/gameengine/Rasterizer/RAS_Rect.h @@ -36,7 +36,7 @@ #include "MEM_guardedalloc.h" #endif -/** +/** * \section interface class. * RAS_Rect just encodes a simple rectangle. * \note Should be part of a generic library diff --git a/source/gameengine/Rasterizer/RAS_TexVert.cpp b/source/gameengine/Rasterizer/RAS_TexVert.cpp index 2e176360d61..6b178edde93 100644 --- a/source/gameengine/Rasterizer/RAS_TexVert.cpp +++ b/source/gameengine/Rasterizer/RAS_TexVert.cpp @@ -94,7 +94,7 @@ void RAS_TexVert::SetUV(int index, const float uv[2]) } void RAS_TexVert::SetRGBA(const unsigned int rgba) -{ +{ m_rgba = rgba; } diff --git a/source/gameengine/Rasterizer/RAS_TexVert.h b/source/gameengine/Rasterizer/RAS_TexVert.h index 8d08549d97e..6704f52fe69 100644 --- a/source/gameengine/Rasterizer/RAS_TexVert.h +++ b/source/gameengine/Rasterizer/RAS_TexVert.h @@ -46,7 +46,7 @@ static MT_Point2 g_pt2; class RAS_TexVert { - + float m_localxyz[3]; // 3*4 = 12 float m_uvs[8][2]; // 8*2*4=64 //8 = MAX_UNIT unsigned int m_rgba; // 4 @@ -69,7 +69,7 @@ public: short getFlag() const; unsigned int getUnit() const; - + RAS_TexVert()// :m_xyz(0,0,0),m_uv(0,0),m_rgba(0) {} RAS_TexVert(const MT_Point3& xyz, @@ -85,19 +85,19 @@ public: return m_uvs[unit]; }; - const float* getXYZ() const { + const float* getXYZ() const { return m_localxyz; }; - + const float* getNormal() const { return m_normal; } - + short int getSoftBodyIndex() const { return m_softBodyIndex; } - + void setSoftBodyIndex(short int sbIndex) { m_softBodyIndex = sbIndex; @@ -125,7 +125,7 @@ public: void SetTangent(const MT_Vector3& tangent); void SetFlag(const short flag); void SetUnit(const unsigned u); - + void SetRGBA(const MT_Vector4& rgba); const MT_Point3& xyz(); diff --git a/source/gameengine/Rasterizer/RAS_texmatrix.cpp b/source/gameengine/Rasterizer/RAS_texmatrix.cpp index d30a3d3a75d..acaec16851b 100644 --- a/source/gameengine/Rasterizer/RAS_texmatrix.cpp +++ b/source/gameengine/Rasterizer/RAS_texmatrix.cpp @@ -42,15 +42,15 @@ void RAS_CalcTexMatrix(RAS_TexVert p[3],MT_Point3& origin,MT_Vector3& udir,MT_Ve normal.normalize(); // determine which coordinate we drop, ie. max coordinate in the normal - + int ZCOORD = normal.closestAxis(); int XCOORD = (ZCOORD+1)%3; int YCOORD = (ZCOORD+2)%3; - + // ax+by+cz+d=0 MT_Scalar d = -p[0].xyz().dot(normal); - + MT_Matrix3x3 mat3( p[0].getUV(0)[0],p[0].getUV(0)[1], 1, p[1].getUV(0)[0],p[1].getUV(0)[1], 1, @@ -64,7 +64,7 @@ void RAS_CalcTexMatrix(RAS_TexVert p[3],MT_Point3& origin,MT_Vector3& udir,MT_Ve MT_Vector3 p123y(p[0].xyz()[YCOORD],p[1].xyz()[YCOORD],p[2].xyz()[YCOORD]); MT_Vector3 resulty = mat3inv*p123y; - // normal[ZCOORD] is not zero, because it's chosen to be maximal (absolute), and normal has length 1, + // normal[ZCOORD] is not zero, because it's chosen to be maximal (absolute), and normal has length 1, // so at least on of the coords is <> 0 //droppedvalue udir.dot(normal) =0 @@ -81,7 +81,7 @@ void RAS_CalcTexMatrix(RAS_TexVert p[3],MT_Point3& origin,MT_Vector3& udir,MT_Ve origin[XCOORD] = resultx.z(); origin[YCOORD] = resulty.z(); origin[ZCOORD] = droppedvalue; - + } @@ -103,7 +103,7 @@ int main() RAS_TexVert p1(pxyz1,puv1); RAS_TexVert p2(pxyz2,puv2); - RAS_TexVert vertices[3] = + RAS_TexVert vertices[3] = { p0, p1, diff --git a/source/gameengine/SceneGraph/SG_BBox.cpp b/source/gameengine/SceneGraph/SG_BBox.cpp index f9d83d37384..9eaba788435 100644 --- a/source/gameengine/SceneGraph/SG_BBox.cpp +++ b/source/gameengine/SceneGraph/SG_BBox.cpp @@ -32,10 +32,10 @@ #include - + #include "SG_BBox.h" #include "SG_Node.h" - + SG_BBox::SG_BBox() : m_min(0.0f, 0.0f, 0.0f), m_max(0.0f, 0.0f, 0.0f) @@ -81,12 +81,12 @@ SG_BBox& SG_BBox::operator +=(const MT_Point3 &point) m_min[1] = point[1]; else if (point[1] > m_max[1]) m_max[1] = point[1]; - + if (point[2] < m_min[2]) m_min[2] = point[2]; else if (point[2] > m_max[2]) m_max[2] = point[2]; - + return *this; } @@ -94,7 +94,7 @@ SG_BBox& SG_BBox::operator += (const SG_BBox &bbox) { *this += bbox.m_min; *this += bbox.m_max; - + return *this; } @@ -162,7 +162,7 @@ bool SG_BBox::outside(const SG_BBox& other) const SG_BBox::intersect SG_BBox::test(const SG_BBox& other) const { bool point1(inside(other.m_min)), point2(inside(other.m_max)); - + return point1?(point2?INSIDE:INTERSECT):(point2?INTERSECT:OUTSIDE); } @@ -211,7 +211,7 @@ void SG_BBox::split(SG_BBox &left, SG_BBox &right) const left.m_max[0] = m_max[0]; left.m_max[1] = m_min[1] + sizey/2.0f; left.m_max[2] = m_max[2]; - + right.m_min[0] = m_min[0]; right.m_min[1] = m_min[1] + sizey/2.0f; right.m_min[2] = m_min[2]; @@ -223,7 +223,7 @@ void SG_BBox::split(SG_BBox &left, SG_BBox &right) const left.m_max[0] = m_max[0]; left.m_max[1] = m_max[1]; left.m_max[2] = m_min[2] + sizez/2.0f; - + right.m_min[0] = m_min[0]; right.m_min[1] = m_min[1]; right.m_min[2] = m_min[2] + sizez/2.0f; @@ -237,7 +237,7 @@ void SG_BBox::split(SG_BBox &left, SG_BBox &right) const left.m_max[0] = m_min[0] + sizex/2.0f; left.m_max[1] = m_max[1]; left.m_max[2] = m_max[2]; - + right.m_min[0] = m_min[0] + sizex/2.0f; right.m_min[1] = m_min[1]; right.m_min[2] = m_min[2]; @@ -249,7 +249,7 @@ void SG_BBox::split(SG_BBox &left, SG_BBox &right) const left.m_max[0] = m_max[0]; left.m_max[1] = m_max[1]; left.m_max[2] = m_min[2] + sizez/2.0f; - + right.m_min[0] = m_min[0]; right.m_min[1] = m_min[1]; right.m_min[2] = m_min[2] + sizez/2.0f; @@ -257,6 +257,6 @@ void SG_BBox::split(SG_BBox &left, SG_BBox &right) const std::cout << "splitz" << std::endl; } } - + //std::cout << "Left: " << left.m_min << " -> " << left.m_max << " Right: " << right.m_min << " -> " << right.m_max << std::endl; } diff --git a/source/gameengine/SceneGraph/SG_BBox.h b/source/gameengine/SceneGraph/SG_BBox.h index 3c524dc7f18..65fa417d25a 100644 --- a/source/gameengine/SceneGraph/SG_BBox.h +++ b/source/gameengine/SceneGraph/SG_BBox.h @@ -29,16 +29,16 @@ * \ingroup bgesg * \brief Bounding Box */ - + #ifndef __SG_BBOX_H__ #define __SG_BBOX_H__ - + #include "MT_Scalar.h" #include "MT_Point3.h" #include "MT_Vector3.h" #include "MT_Transform.h" -#include +#include #ifdef WITH_CXX_GUARDEDALLOC #include "MEM_guardedalloc.h" @@ -71,7 +71,7 @@ public: * Enlarges the bounding box to contain the specified bound box. */ SG_BBox& operator +=(const SG_BBox &bbox); - + SG_BBox operator + (const SG_BBox &bbox2) const; #if 0 /** @@ -88,12 +88,12 @@ public: * Computes the volume of the bounding box. */ MT_Scalar volume() const; - + /** * Test if the given point is inside this bounding box. */ bool inside(const MT_Point3 &point) const; - + /** * Test if the given bounding box is inside this bounding box. */ @@ -103,17 +103,17 @@ public: * Test if the given bounding box is outside this bounding box. */ bool outside(const SG_BBox &other) const; - + /** * Test if the given bounding box intersects this bounding box. */ bool intersects(const SG_BBox &other) const; - + /** * Test the given bounding box with this bounding box. */ intersect test(const SG_BBox &other) const; - + /** * Get the eight points that define this bounding box. * @@ -127,11 +127,11 @@ public: * \param world a world transform to be applied. */ void getaa(MT_Point3 *box, const MT_Transform &world) const; - + void getmm(MT_Point3 *box, const MT_Transform &world) const; void split(SG_BBox &left, SG_BBox &right) const; - + friend class SG_Tree; diff --git a/source/gameengine/SceneGraph/SG_Controller.cpp b/source/gameengine/SceneGraph/SG_Controller.cpp index 264942415c9..1731b572fbd 100644 --- a/source/gameengine/SceneGraph/SG_Controller.cpp +++ b/source/gameengine/SceneGraph/SG_Controller.cpp @@ -31,7 +31,7 @@ #include "SG_Controller.h" - void + void SG_Controller:: SetObject(SG_IObject* obj) { diff --git a/source/gameengine/SceneGraph/SG_Controller.h b/source/gameengine/SceneGraph/SG_Controller.h index a173633e13c..000be4f871a 100644 --- a/source/gameengine/SceneGraph/SG_Controller.h +++ b/source/gameengine/SceneGraph/SG_Controller.h @@ -31,7 +31,7 @@ /** \file SG_Controller.h * \ingroup bgesg */ - + #ifndef __SG_CONTROLLER_H__ #define __SG_CONTROLLER_H__ @@ -40,7 +40,7 @@ /** * A scenegraph controller */ -class SG_Controller +class SG_Controller { public: SG_Controller( @@ -48,18 +48,18 @@ public: m_pObject(NULL) { } - virtual + virtual ~SG_Controller( ) {}; - virtual + virtual bool Update( double time )=0; - virtual - void + virtual + void SetObject ( SG_IObject* object ); @@ -68,7 +68,7 @@ public: ClearObject( ); - virtual + virtual void SetSimulatedTime( double time @@ -84,8 +84,8 @@ public: * Hacky way of passing options to specific controllers * \param option An integer identifying the option. * \param value The value of this option. - * \attention This has been placed here to give sca-elements - * \attention some control over the controllers. This is + * \attention This has been placed here to give sca-elements + * \attention some control over the controllers. This is * \attention necessary because the identity of the controller * \attention is lost on the way here. */ @@ -97,8 +97,8 @@ public: )=0; /** - * Option-identifiers: SG_CONTR__