recopy fresh game engien from trunk
authorJoseph Eagar <joeedh@gmail.com>
Sat, 4 Sep 2010 19:06:15 +0000 (19:06 +0000)
committerJoseph Eagar <joeedh@gmail.com>
Sat, 4 Sep 2010 19:06:15 +0000 (19:06 +0000)
581 files changed:
source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp [new file with mode: 0644]
source/gameengine/BlenderRoutines/CMakeLists.txt [new file with mode: 0644]
source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp [new file with mode: 0644]
source/gameengine/BlenderRoutines/KX_BlenderCanvas.h [new file with mode: 0644]
source/gameengine/BlenderRoutines/KX_BlenderGL.cpp [new file with mode: 0644]
source/gameengine/BlenderRoutines/KX_BlenderGL.h [new file with mode: 0644]
source/gameengine/BlenderRoutines/KX_BlenderInputDevice.cpp [new file with mode: 0644]
source/gameengine/BlenderRoutines/KX_BlenderInputDevice.h [new file with mode: 0644]
source/gameengine/BlenderRoutines/KX_BlenderKeyboardDevice.cpp [new file with mode: 0644]
source/gameengine/BlenderRoutines/KX_BlenderKeyboardDevice.h [new file with mode: 0644]
source/gameengine/BlenderRoutines/KX_BlenderMouseDevice.cpp [new file with mode: 0644]
source/gameengine/BlenderRoutines/KX_BlenderMouseDevice.h [new file with mode: 0644]
source/gameengine/BlenderRoutines/KX_BlenderRenderTools.cpp [new file with mode: 0644]
source/gameengine/BlenderRoutines/KX_BlenderRenderTools.h [new file with mode: 0644]
source/gameengine/BlenderRoutines/KX_BlenderSystem.cpp [new file with mode: 0644]
source/gameengine/BlenderRoutines/KX_BlenderSystem.h [new file with mode: 0644]
source/gameengine/BlenderRoutines/Makefile [new file with mode: 0644]
source/gameengine/BlenderRoutines/SConscript [new file with mode: 0644]
source/gameengine/CMakeLists.txt [new file with mode: 0644]
source/gameengine/Converter/BL_ActionActuator.cpp [new file with mode: 0644]
source/gameengine/Converter/BL_ActionActuator.h [new file with mode: 0644]
source/gameengine/Converter/BL_ArmatureActuator.cpp [new file with mode: 0644]
source/gameengine/Converter/BL_ArmatureActuator.h [new file with mode: 0644]
source/gameengine/Converter/BL_ArmatureChannel.cpp [new file with mode: 0644]
source/gameengine/Converter/BL_ArmatureChannel.h [new file with mode: 0644]
source/gameengine/Converter/BL_ArmatureConstraint.cpp [new file with mode: 0644]
source/gameengine/Converter/BL_ArmatureConstraint.h [new file with mode: 0644]
source/gameengine/Converter/BL_ArmatureObject.cpp [new file with mode: 0644]
source/gameengine/Converter/BL_ArmatureObject.h [new file with mode: 0644]
source/gameengine/Converter/BL_BlenderDataConversion.cpp [new file with mode: 0644]
source/gameengine/Converter/BL_BlenderDataConversion.h [new file with mode: 0644]
source/gameengine/Converter/BL_DeformableGameObject.cpp [new file with mode: 0644]
source/gameengine/Converter/BL_DeformableGameObject.h [new file with mode: 0644]
source/gameengine/Converter/BL_MeshDeformer.cpp [new file with mode: 0644]
source/gameengine/Converter/BL_MeshDeformer.h [new file with mode: 0644]
source/gameengine/Converter/BL_ModifierDeformer.cpp [new file with mode: 0644]
source/gameengine/Converter/BL_ModifierDeformer.h [new file with mode: 0644]
source/gameengine/Converter/BL_ShapeActionActuator.cpp [new file with mode: 0644]
source/gameengine/Converter/BL_ShapeActionActuator.h [new file with mode: 0644]
source/gameengine/Converter/BL_ShapeDeformer.cpp [new file with mode: 0644]
source/gameengine/Converter/BL_ShapeDeformer.h [new file with mode: 0644]
source/gameengine/Converter/BL_SkinDeformer.cpp [new file with mode: 0644]
source/gameengine/Converter/BL_SkinDeformer.h [new file with mode: 0644]
source/gameengine/Converter/BlenderWorldInfo.cpp [new file with mode: 0644]
source/gameengine/Converter/BlenderWorldInfo.h [new file with mode: 0644]
source/gameengine/Converter/CMakeLists.txt [new file with mode: 0644]
source/gameengine/Converter/KX_BlenderScalarInterpolator.cpp [new file with mode: 0644]
source/gameengine/Converter/KX_BlenderScalarInterpolator.h [new file with mode: 0644]
source/gameengine/Converter/KX_BlenderSceneConverter.cpp [new file with mode: 0644]
source/gameengine/Converter/KX_BlenderSceneConverter.h [new file with mode: 0644]
source/gameengine/Converter/KX_ConvertActuators.cpp [new file with mode: 0644]
source/gameengine/Converter/KX_ConvertActuators.h [new file with mode: 0644]
source/gameengine/Converter/KX_ConvertControllers.cpp [new file with mode: 0644]
source/gameengine/Converter/KX_ConvertControllers.h [new file with mode: 0644]
source/gameengine/Converter/KX_ConvertProperties.cpp [new file with mode: 0644]
source/gameengine/Converter/KX_ConvertProperties.h [new file with mode: 0644]
source/gameengine/Converter/KX_ConvertSensors.cpp [new file with mode: 0644]
source/gameengine/Converter/KX_ConvertSensors.h [new file with mode: 0644]
source/gameengine/Converter/KX_IpoConvert.cpp [new file with mode: 0644]
source/gameengine/Converter/KX_IpoConvert.h [new file with mode: 0644]
source/gameengine/Converter/KX_SoftBodyDeformer.cpp [new file with mode: 0644]
source/gameengine/Converter/KX_SoftBodyDeformer.h [new file with mode: 0644]
source/gameengine/Converter/Makefile [new file with mode: 0644]
source/gameengine/Converter/SConscript [new file with mode: 0644]
source/gameengine/Expressions/BoolValue.cpp [new file with mode: 0644]
source/gameengine/Expressions/BoolValue.h [new file with mode: 0644]
source/gameengine/Expressions/CMakeLists.txt [new file with mode: 0644]
source/gameengine/Expressions/ConstExpr.cpp [new file with mode: 0644]
source/gameengine/Expressions/ConstExpr.h [new file with mode: 0644]
source/gameengine/Expressions/EXP_C-Api.cpp [new file with mode: 0644]
source/gameengine/Expressions/EXP_C-Api.h [new file with mode: 0644]
source/gameengine/Expressions/EmptyValue.cpp [new file with mode: 0644]
source/gameengine/Expressions/EmptyValue.h [new file with mode: 0644]
source/gameengine/Expressions/ErrorValue.cpp [new file with mode: 0644]
source/gameengine/Expressions/ErrorValue.h [new file with mode: 0644]
source/gameengine/Expressions/Expression.cpp [new file with mode: 0644]
source/gameengine/Expressions/Expression.h [new file with mode: 0644]
source/gameengine/Expressions/FloatValue.cpp [new file with mode: 0644]
source/gameengine/Expressions/FloatValue.h [new file with mode: 0644]
source/gameengine/Expressions/IdentifierExpr.cpp [new file with mode: 0644]
source/gameengine/Expressions/IdentifierExpr.h [new file with mode: 0644]
source/gameengine/Expressions/IfExpr.cpp [new file with mode: 0644]
source/gameengine/Expressions/IfExpr.h [new file with mode: 0644]
source/gameengine/Expressions/InputParser.cpp [new file with mode: 0644]
source/gameengine/Expressions/InputParser.h [new file with mode: 0644]
source/gameengine/Expressions/IntValue.cpp [new file with mode: 0644]
source/gameengine/Expressions/IntValue.h [new file with mode: 0644]
source/gameengine/Expressions/KX_HashedPtr.cpp [new file with mode: 0644]
source/gameengine/Expressions/KX_HashedPtr.h [new file with mode: 0644]
source/gameengine/Expressions/KX_Python.h [new file with mode: 0644]
source/gameengine/Expressions/ListValue.cpp [new file with mode: 0644]
source/gameengine/Expressions/ListValue.h [new file with mode: 0644]
source/gameengine/Expressions/Makefile [new file with mode: 0644]
source/gameengine/Expressions/Operator1Expr.cpp [new file with mode: 0644]
source/gameengine/Expressions/Operator1Expr.h [new file with mode: 0644]
source/gameengine/Expressions/Operator2Expr.cpp [new file with mode: 0644]
source/gameengine/Expressions/Operator2Expr.h [new file with mode: 0644]
source/gameengine/Expressions/PyObjectPlus.cpp [new file with mode: 0644]
source/gameengine/Expressions/PyObjectPlus.h [new file with mode: 0644]
source/gameengine/Expressions/SConscript [new file with mode: 0644]
source/gameengine/Expressions/StringValue.cpp [new file with mode: 0644]
source/gameengine/Expressions/StringValue.h [new file with mode: 0644]
source/gameengine/Expressions/Value.cpp [new file with mode: 0644]
source/gameengine/Expressions/Value.h [new file with mode: 0644]
source/gameengine/Expressions/VectorValue.cpp [new file with mode: 0644]
source/gameengine/Expressions/VectorValue.h [new file with mode: 0644]
source/gameengine/Expressions/VoidValue.h [new file with mode: 0644]
source/gameengine/GameLogic/CMakeLists.txt [new file with mode: 0644]
source/gameengine/GameLogic/Joystick/Makefile [new file with mode: 0644]
source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp [new file with mode: 0644]
source/gameengine/GameLogic/Joystick/SCA_Joystick.h [new file with mode: 0644]
source/gameengine/GameLogic/Joystick/SCA_JoystickDefines.h [new file with mode: 0644]
source/gameengine/GameLogic/Joystick/SCA_JoystickEvents.cpp [new file with mode: 0644]
source/gameengine/GameLogic/Joystick/SCA_JoystickPrivate.h [new file with mode: 0644]
source/gameengine/GameLogic/Makefile [new file with mode: 0644]
source/gameengine/GameLogic/SCA_2DFilterActuator.cpp [new file with mode: 0644]
source/gameengine/GameLogic/SCA_2DFilterActuator.h [new file with mode: 0644]
source/gameengine/GameLogic/SCA_ANDController.cpp [new file with mode: 0644]
source/gameengine/GameLogic/SCA_ANDController.h [new file with mode: 0644]
source/gameengine/GameLogic/SCA_ActuatorEventManager.cpp [new file with mode: 0644]
source/gameengine/GameLogic/SCA_ActuatorEventManager.h [new file with mode: 0644]
source/gameengine/GameLogic/SCA_ActuatorSensor.cpp [new file with mode: 0644]
source/gameengine/GameLogic/SCA_ActuatorSensor.h [new file with mode: 0644]
source/gameengine/GameLogic/SCA_AlwaysEventManager.cpp [new file with mode: 0644]
source/gameengine/GameLogic/SCA_AlwaysEventManager.h [new file with mode: 0644]
source/gameengine/GameLogic/SCA_AlwaysSensor.cpp [new file with mode: 0644]
source/gameengine/GameLogic/SCA_AlwaysSensor.h [new file with mode: 0644]
source/gameengine/GameLogic/SCA_BasicEventManager.cpp [new file with mode: 0644]
source/gameengine/GameLogic/SCA_BasicEventManager.h [new file with mode: 0644]
source/gameengine/GameLogic/SCA_DelaySensor.cpp [new file with mode: 0644]
source/gameengine/GameLogic/SCA_DelaySensor.h [new file with mode: 0644]
source/gameengine/GameLogic/SCA_EventManager.cpp [new file with mode: 0644]
source/gameengine/GameLogic/SCA_EventManager.h [new file with mode: 0644]
source/gameengine/GameLogic/SCA_ExpressionController.cpp [new file with mode: 0644]
source/gameengine/GameLogic/SCA_ExpressionController.h [new file with mode: 0644]
source/gameengine/GameLogic/SCA_IActuator.cpp [new file with mode: 0644]
source/gameengine/GameLogic/SCA_IActuator.h [new file with mode: 0644]
source/gameengine/GameLogic/SCA_IController.cpp [new file with mode: 0644]
source/gameengine/GameLogic/SCA_IController.h [new file with mode: 0644]
source/gameengine/GameLogic/SCA_IInputDevice.cpp [new file with mode: 0644]
source/gameengine/GameLogic/SCA_IInputDevice.h [new file with mode: 0644]
source/gameengine/GameLogic/SCA_ILogicBrick.cpp [new file with mode: 0644]
source/gameengine/GameLogic/SCA_ILogicBrick.h [new file with mode: 0644]
source/gameengine/GameLogic/SCA_IObject.cpp [new file with mode: 0644]
source/gameengine/GameLogic/SCA_IObject.h [new file with mode: 0644]
source/gameengine/GameLogic/SCA_IScene.cpp [new file with mode: 0644]
source/gameengine/GameLogic/SCA_IScene.h [new file with mode: 0644]
source/gameengine/GameLogic/SCA_ISensor.cpp [new file with mode: 0644]
source/gameengine/GameLogic/SCA_ISensor.h [new file with mode: 0644]
source/gameengine/GameLogic/SCA_JoystickManager.cpp [new file with mode: 0644]
source/gameengine/GameLogic/SCA_JoystickManager.h [new file with mode: 0644]
source/gameengine/GameLogic/SCA_JoystickSensor.cpp [new file with mode: 0644]
source/gameengine/GameLogic/SCA_JoystickSensor.h [new file with mode: 0644]
source/gameengine/GameLogic/SCA_KeyboardManager.cpp [new file with mode: 0644]
source/gameengine/GameLogic/SCA_KeyboardManager.h [new file with mode: 0644]
source/gameengine/GameLogic/SCA_KeyboardSensor.cpp [new file with mode: 0644]
source/gameengine/GameLogic/SCA_KeyboardSensor.h [new file with mode: 0644]
source/gameengine/GameLogic/SCA_LogicManager.cpp [new file with mode: 0644]
source/gameengine/GameLogic/SCA_LogicManager.h [new file with mode: 0644]
source/gameengine/GameLogic/SCA_MouseManager.cpp [new file with mode: 0644]
source/gameengine/GameLogic/SCA_MouseManager.h [new file with mode: 0644]
source/gameengine/GameLogic/SCA_MouseSensor.cpp [new file with mode: 0644]
source/gameengine/GameLogic/SCA_MouseSensor.h [new file with mode: 0644]
source/gameengine/GameLogic/SCA_NANDController.cpp [new file with mode: 0644]
source/gameengine/GameLogic/SCA_NANDController.h [new file with mode: 0644]
source/gameengine/GameLogic/SCA_NORController.cpp [new file with mode: 0644]
source/gameengine/GameLogic/SCA_NORController.h [new file with mode: 0644]
source/gameengine/GameLogic/SCA_ORController.cpp [new file with mode: 0644]
source/gameengine/GameLogic/SCA_ORController.h [new file with mode: 0644]
source/gameengine/GameLogic/SCA_PropertyActuator.cpp [new file with mode: 0644]
source/gameengine/GameLogic/SCA_PropertyActuator.h [new file with mode: 0644]
source/gameengine/GameLogic/SCA_PropertyEventManager.cpp [new file with mode: 0644]
source/gameengine/GameLogic/SCA_PropertyEventManager.h [new file with mode: 0644]
source/gameengine/GameLogic/SCA_PropertySensor.cpp [new file with mode: 0644]
source/gameengine/GameLogic/SCA_PropertySensor.h [new file with mode: 0644]
source/gameengine/GameLogic/SCA_PythonController.cpp [new file with mode: 0644]
source/gameengine/GameLogic/SCA_PythonController.h [new file with mode: 0644]
source/gameengine/GameLogic/SCA_PythonKeyboard.cpp [new file with mode: 0644]
source/gameengine/GameLogic/SCA_PythonKeyboard.h [new file with mode: 0644]
source/gameengine/GameLogic/SCA_PythonMouse.cpp [new file with mode: 0644]
source/gameengine/GameLogic/SCA_PythonMouse.h [new file with mode: 0644]
source/gameengine/GameLogic/SCA_RandomActuator.cpp [new file with mode: 0644]
source/gameengine/GameLogic/SCA_RandomActuator.h [new file with mode: 0644]
source/gameengine/GameLogic/SCA_RandomEventManager.cpp [new file with mode: 0644]
source/gameengine/GameLogic/SCA_RandomEventManager.h [new file with mode: 0644]
source/gameengine/GameLogic/SCA_RandomNumberGenerator.cpp [new file with mode: 0644]
source/gameengine/GameLogic/SCA_RandomNumberGenerator.h [new file with mode: 0644]
source/gameengine/GameLogic/SCA_RandomSensor.cpp [new file with mode: 0644]
source/gameengine/GameLogic/SCA_RandomSensor.h [new file with mode: 0644]
source/gameengine/GameLogic/SCA_TimeEventManager.cpp [new file with mode: 0644]
source/gameengine/GameLogic/SCA_TimeEventManager.h [new file with mode: 0644]
source/gameengine/GameLogic/SCA_XNORController.cpp [new file with mode: 0644]
source/gameengine/GameLogic/SCA_XNORController.h [new file with mode: 0644]
source/gameengine/GameLogic/SCA_XORController.cpp [new file with mode: 0644]
source/gameengine/GameLogic/SCA_XORController.h [new file with mode: 0644]
source/gameengine/GameLogic/SConscript [new file with mode: 0644]
source/gameengine/GamePlayer/CMakeLists.txt [new file with mode: 0644]
source/gameengine/GamePlayer/Makefile [new file with mode: 0644]
source/gameengine/GamePlayer/SConscript [new file with mode: 0644]
source/gameengine/GamePlayer/common/CMakeLists.txt [new file with mode: 0644]
source/gameengine/GamePlayer/common/GPC_Canvas.cpp [new file with mode: 0644]
source/gameengine/GamePlayer/common/GPC_Canvas.h [new file with mode: 0644]
source/gameengine/GamePlayer/common/GPC_Engine.cpp [new file with mode: 0644]
source/gameengine/GamePlayer/common/GPC_Engine.h [new file with mode: 0644]
source/gameengine/GamePlayer/common/GPC_KeyboardDevice.cpp [new file with mode: 0644]
source/gameengine/GamePlayer/common/GPC_KeyboardDevice.h [new file with mode: 0644]
source/gameengine/GamePlayer/common/GPC_MouseDevice.cpp [new file with mode: 0644]
source/gameengine/GamePlayer/common/GPC_MouseDevice.h [new file with mode: 0644]
source/gameengine/GamePlayer/common/GPC_RawImage.cpp [new file with mode: 0644]
source/gameengine/GamePlayer/common/GPC_RawImage.h [new file with mode: 0644]
source/gameengine/GamePlayer/common/GPC_RawLoadDotBlendArray.cpp [new file with mode: 0644]
source/gameengine/GamePlayer/common/GPC_RawLoadDotBlendArray.h [new file with mode: 0644]
source/gameengine/GamePlayer/common/GPC_RawLogoArrays.cpp [new file with mode: 0644]
source/gameengine/GamePlayer/common/GPC_RawLogoArrays.h [new file with mode: 0644]
source/gameengine/GamePlayer/common/GPC_RenderTools.cpp [new file with mode: 0644]
source/gameengine/GamePlayer/common/GPC_RenderTools.h [new file with mode: 0644]
source/gameengine/GamePlayer/common/GPC_System.cpp [new file with mode: 0644]
source/gameengine/GamePlayer/common/GPC_System.h [new file with mode: 0644]
source/gameengine/GamePlayer/common/Makefile [new file with mode: 0644]
source/gameengine/GamePlayer/common/SConscript [new file with mode: 0644]
source/gameengine/GamePlayer/common/bmfont.cpp [new file with mode: 0644]
source/gameengine/GamePlayer/common/load.blend [new file with mode: 0644]
source/gameengine/GamePlayer/common/logo_blender.raw [new file with mode: 0644]
source/gameengine/GamePlayer/common/logo_blender3d.raw [new file with mode: 0644]
source/gameengine/GamePlayer/common/logo_nan.raw [new file with mode: 0644]
source/gameengine/GamePlayer/common/unix/GPU_Canvas.cpp [new file with mode: 0644]
source/gameengine/GamePlayer/common/unix/GPU_Canvas.h [new file with mode: 0644]
source/gameengine/GamePlayer/common/unix/GPU_Engine.cpp [new file with mode: 0644]
source/gameengine/GamePlayer/common/unix/GPU_Engine.h [new file with mode: 0644]
source/gameengine/GamePlayer/common/unix/GPU_KeyboardDevice.cpp [new file with mode: 0644]
source/gameengine/GamePlayer/common/unix/GPU_KeyboardDevice.h [new file with mode: 0644]
source/gameengine/GamePlayer/common/unix/GPU_PolygonMaterial.h [new file with mode: 0644]
source/gameengine/GamePlayer/common/unix/GPU_System.cpp [new file with mode: 0644]
source/gameengine/GamePlayer/common/unix/GPU_System.h [new file with mode: 0644]
source/gameengine/GamePlayer/common/unix/Makefile [new file with mode: 0644]
source/gameengine/GamePlayer/common/windows/GPW_Canvas.cpp [new file with mode: 0644]
source/gameengine/GamePlayer/common/windows/GPW_Canvas.h [new file with mode: 0644]
source/gameengine/GamePlayer/common/windows/GPW_Engine.cpp [new file with mode: 0644]
source/gameengine/GamePlayer/common/windows/GPW_Engine.h [new file with mode: 0644]
source/gameengine/GamePlayer/common/windows/GPW_KeyboardDevice.cpp [new file with mode: 0644]
source/gameengine/GamePlayer/common/windows/GPW_KeyboardDevice.h [new file with mode: 0644]
source/gameengine/GamePlayer/common/windows/GPW_System.cpp [new file with mode: 0644]
source/gameengine/GamePlayer/common/windows/GPW_System.h [new file with mode: 0644]
source/gameengine/GamePlayer/common/windows/Makefile [new file with mode: 0644]
source/gameengine/GamePlayer/ghost/CMakeLists.txt [new file with mode: 0644]
source/gameengine/GamePlayer/ghost/GPG_Application.cpp [new file with mode: 0644]
source/gameengine/GamePlayer/ghost/GPG_Application.h [new file with mode: 0644]
source/gameengine/GamePlayer/ghost/GPG_Canvas.cpp [new file with mode: 0644]
source/gameengine/GamePlayer/ghost/GPG_Canvas.h [new file with mode: 0644]
source/gameengine/GamePlayer/ghost/GPG_KeyboardDevice.cpp [new file with mode: 0644]
source/gameengine/GamePlayer/ghost/GPG_KeyboardDevice.h [new file with mode: 0644]
source/gameengine/GamePlayer/ghost/GPG_System.cpp [new file with mode: 0644]
source/gameengine/GamePlayer/ghost/GPG_System.h [new file with mode: 0644]
source/gameengine/GamePlayer/ghost/GPG_ghost.cpp [new file with mode: 0644]
source/gameengine/GamePlayer/ghost/Makefile [new file with mode: 0644]
source/gameengine/GamePlayer/ghost/SConscript [new file with mode: 0644]
source/gameengine/Ketsji/BL_BlenderShader.cpp [new file with mode: 0644]
source/gameengine/Ketsji/BL_BlenderShader.h [new file with mode: 0644]
source/gameengine/Ketsji/BL_Material.cpp [new file with mode: 0644]
source/gameengine/Ketsji/BL_Material.h [new file with mode: 0644]
source/gameengine/Ketsji/BL_Shader.cpp [new file with mode: 0644]
source/gameengine/Ketsji/BL_Shader.h [new file with mode: 0644]
source/gameengine/Ketsji/BL_Texture.cpp [new file with mode: 0644]
source/gameengine/Ketsji/BL_Texture.h [new file with mode: 0644]
source/gameengine/Ketsji/CMakeLists.txt [new file with mode: 0644]
source/gameengine/Ketsji/KXNetwork/CMakeLists.txt [new file with mode: 0644]
source/gameengine/Ketsji/KXNetwork/KX_NetworkEventManager.cpp [new file with mode: 0644]
source/gameengine/Ketsji/KXNetwork/KX_NetworkEventManager.h [new file with mode: 0644]
source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageActuator.cpp [new file with mode: 0644]
source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageActuator.h [new file with mode: 0644]
source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.cpp [new file with mode: 0644]
source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.h [new file with mode: 0644]
source/gameengine/Ketsji/KXNetwork/KX_NetworkObjectActuator.cpp [new file with mode: 0644]
source/gameengine/Ketsji/KXNetwork/KX_NetworkObjectActuator.h [new file with mode: 0644]
source/gameengine/Ketsji/KXNetwork/KX_NetworkObjectSensor.cpp [new file with mode: 0644]
source/gameengine/Ketsji/KXNetwork/KX_NetworkObjectSensor.h [new file with mode: 0644]
source/gameengine/Ketsji/KXNetwork/Makefile [new file with mode: 0644]
source/gameengine/Ketsji/KXNetwork/SConscript [new file with mode: 0644]
source/gameengine/Ketsji/KX_ArmatureSensor.cpp [new file with mode: 0644]
source/gameengine/Ketsji/KX_ArmatureSensor.h [new file with mode: 0644]
source/gameengine/Ketsji/KX_BlenderMaterial.cpp [new file with mode: 0644]
source/gameengine/Ketsji/KX_BlenderMaterial.h [new file with mode: 0644]
source/gameengine/Ketsji/KX_BulletPhysicsController.cpp [new file with mode: 0644]
source/gameengine/Ketsji/KX_BulletPhysicsController.h [new file with mode: 0644]
source/gameengine/Ketsji/KX_Camera.cpp [new file with mode: 0644]
source/gameengine/Ketsji/KX_Camera.h [new file with mode: 0644]
source/gameengine/Ketsji/KX_CameraActuator.cpp [new file with mode: 0644]
source/gameengine/Ketsji/KX_CameraActuator.h [new file with mode: 0644]
source/gameengine/Ketsji/KX_CameraIpoSGController.cpp [new file with mode: 0644]
source/gameengine/Ketsji/KX_CameraIpoSGController.h [new file with mode: 0644]
source/gameengine/Ketsji/KX_ClientObjectInfo.h [new file with mode: 0644]
source/gameengine/Ketsji/KX_ConstraintActuator.cpp [new file with mode: 0644]
source/gameengine/Ketsji/KX_ConstraintActuator.h [new file with mode: 0644]
source/gameengine/Ketsji/KX_ConstraintWrapper.cpp [new file with mode: 0644]
source/gameengine/Ketsji/KX_ConstraintWrapper.h [new file with mode: 0644]
source/gameengine/Ketsji/KX_ConvertPhysicsObject.h [new file with mode: 0644]
source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp [new file with mode: 0644]
source/gameengine/Ketsji/KX_Dome.cpp [new file with mode: 0644]
source/gameengine/Ketsji/KX_Dome.h [new file with mode: 0644]
source/gameengine/Ketsji/KX_EmptyObject.cpp [new file with mode: 0644]
source/gameengine/Ketsji/KX_EmptyObject.h [new file with mode: 0644]
source/gameengine/Ketsji/KX_GameActuator.cpp [new file with mode: 0644]
source/gameengine/Ketsji/KX_GameActuator.h [new file with mode: 0644]
source/gameengine/Ketsji/KX_GameObject.cpp [new file with mode: 0644]
source/gameengine/Ketsji/KX_GameObject.h [new file with mode: 0644]
source/gameengine/Ketsji/KX_IInterpolator.h [new file with mode: 0644]
source/gameengine/Ketsji/KX_IPOTransform.h [new file with mode: 0644]
source/gameengine/Ketsji/KX_IPO_SGController.cpp [new file with mode: 0644]
source/gameengine/Ketsji/KX_IPO_SGController.h [new file with mode: 0644]
source/gameengine/Ketsji/KX_IPhysicsController.cpp [new file with mode: 0644]
source/gameengine/Ketsji/KX_IPhysicsController.h [new file with mode: 0644]
source/gameengine/Ketsji/KX_IScalarInterpolator.h [new file with mode: 0644]
source/gameengine/Ketsji/KX_ISceneConverter.h [new file with mode: 0644]
source/gameengine/Ketsji/KX_ISystem.h [new file with mode: 0644]
source/gameengine/Ketsji/KX_IpoActuator.cpp [new file with mode: 0644]
source/gameengine/Ketsji/KX_IpoActuator.h [new file with mode: 0644]
source/gameengine/Ketsji/KX_KetsjiEngine.cpp [new file with mode: 0644]
source/gameengine/Ketsji/KX_KetsjiEngine.h [new file with mode: 0644]
source/gameengine/Ketsji/KX_Light.cpp [new file with mode: 0644]
source/gameengine/Ketsji/KX_Light.h [new file with mode: 0644]
source/gameengine/Ketsji/KX_LightIpoSGController.cpp [new file with mode: 0644]
source/gameengine/Ketsji/KX_LightIpoSGController.h [new file with mode: 0644]
source/gameengine/Ketsji/KX_MaterialIpoController.cpp [new file with mode: 0644]
source/gameengine/Ketsji/KX_MaterialIpoController.h [new file with mode: 0644]
source/gameengine/Ketsji/KX_MeshProxy.cpp [new file with mode: 0644]
source/gameengine/Ketsji/KX_MeshProxy.h [new file with mode: 0644]
source/gameengine/Ketsji/KX_MotionState.cpp [new file with mode: 0644]
source/gameengine/Ketsji/KX_MotionState.h [new file with mode: 0644]
source/gameengine/Ketsji/KX_MouseFocusSensor.cpp [new file with mode: 0644]
source/gameengine/Ketsji/KX_MouseFocusSensor.h [new file with mode: 0644]
source/gameengine/Ketsji/KX_NearSensor.cpp [new file with mode: 0644]
source/gameengine/Ketsji/KX_NearSensor.h [new file with mode: 0644]
source/gameengine/Ketsji/KX_ObColorIpoSGController.cpp [new file with mode: 0644]
source/gameengine/Ketsji/KX_ObColorIpoSGController.h [new file with mode: 0644]
source/gameengine/Ketsji/KX_ObjectActuator.cpp [new file with mode: 0644]
source/gameengine/Ketsji/KX_ObjectActuator.h [new file with mode: 0644]
source/gameengine/Ketsji/KX_OrientationInterpolator.cpp [new file with mode: 0644]
source/gameengine/Ketsji/KX_OrientationInterpolator.h [new file with mode: 0644]
source/gameengine/Ketsji/KX_ParentActuator.cpp [new file with mode: 0644]
source/gameengine/Ketsji/KX_ParentActuator.h [new file with mode: 0644]
source/gameengine/Ketsji/KX_PhysicsEngineEnums.h [new file with mode: 0644]
source/gameengine/Ketsji/KX_PhysicsObjectWrapper.cpp [new file with mode: 0644]
source/gameengine/Ketsji/KX_PhysicsObjectWrapper.h [new file with mode: 0644]
source/gameengine/Ketsji/KX_PhysicsPropertiesobsolete.h [new file with mode: 0644]
source/gameengine/Ketsji/KX_PolyProxy.cpp [new file with mode: 0644]
source/gameengine/Ketsji/KX_PolyProxy.h [new file with mode: 0644]
source/gameengine/Ketsji/KX_PolygonMaterial.cpp [new file with mode: 0644]
source/gameengine/Ketsji/KX_PolygonMaterial.h [new file with mode: 0644]
source/gameengine/Ketsji/KX_PositionInterpolator.cpp [new file with mode: 0644]
source/gameengine/Ketsji/KX_PositionInterpolator.h [new file with mode: 0644]
source/gameengine/Ketsji/KX_PyConstraintBinding.cpp [new file with mode: 0644]
source/gameengine/Ketsji/KX_PyConstraintBinding.h [new file with mode: 0644]
source/gameengine/Ketsji/KX_PyMath.cpp [new file with mode: 0644]
source/gameengine/Ketsji/KX_PyMath.h [new file with mode: 0644]
source/gameengine/Ketsji/KX_PythonInit.cpp [new file with mode: 0644]
source/gameengine/Ketsji/KX_PythonInit.h [new file with mode: 0644]
source/gameengine/Ketsji/KX_PythonInitTypes.cpp [new file with mode: 0644]
source/gameengine/Ketsji/KX_PythonInitTypes.h [new file with mode: 0644]
source/gameengine/Ketsji/KX_PythonSeq.cpp [new file with mode: 0644]
source/gameengine/Ketsji/KX_PythonSeq.h [new file with mode: 0644]
source/gameengine/Ketsji/KX_RadarSensor.cpp [new file with mode: 0644]
source/gameengine/Ketsji/KX_RadarSensor.h [new file with mode: 0644]
source/gameengine/Ketsji/KX_RayCast.cpp [new file with mode: 0644]
source/gameengine/Ketsji/KX_RayCast.h [new file with mode: 0644]
source/gameengine/Ketsji/KX_RayEventManager.cpp [new file with mode: 0644]
source/gameengine/Ketsji/KX_RayEventManager.h [new file with mode: 0644]
source/gameengine/Ketsji/KX_RaySensor.cpp [new file with mode: 0644]
source/gameengine/Ketsji/KX_RaySensor.h [new file with mode: 0644]
source/gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp [new file with mode: 0644]
source/gameengine/Ketsji/KX_SCA_AddObjectActuator.h [new file with mode: 0644]
source/gameengine/Ketsji/KX_SCA_DynamicActuator.cpp [new file with mode: 0644]
source/gameengine/Ketsji/KX_SCA_DynamicActuator.h [new file with mode: 0644]
source/gameengine/Ketsji/KX_SCA_EndObjectActuator.cpp [new file with mode: 0644]
source/gameengine/Ketsji/KX_SCA_EndObjectActuator.h [new file with mode: 0644]
source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.cpp [new file with mode: 0644]
source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.h [new file with mode: 0644]
source/gameengine/Ketsji/KX_SG_BoneParentNodeRelationship.cpp [new file with mode: 0644]
source/gameengine/Ketsji/KX_SG_BoneParentNodeRelationship.h [new file with mode: 0644]
source/gameengine/Ketsji/KX_SG_NodeRelationships.cpp [new file with mode: 0644]
source/gameengine/Ketsji/KX_SG_NodeRelationships.h [new file with mode: 0644]
source/gameengine/Ketsji/KX_ScalarInterpolator.cpp [new file with mode: 0644]
source/gameengine/Ketsji/KX_ScalarInterpolator.h [new file with mode: 0644]
source/gameengine/Ketsji/KX_ScalingInterpolator.cpp [new file with mode: 0644]
source/gameengine/Ketsji/KX_ScalingInterpolator.h [new file with mode: 0644]
source/gameengine/Ketsji/KX_Scene.cpp [new file with mode: 0644]
source/gameengine/Ketsji/KX_Scene.h [new file with mode: 0644]
source/gameengine/Ketsji/KX_SceneActuator.cpp [new file with mode: 0644]
source/gameengine/Ketsji/KX_SceneActuator.h [new file with mode: 0644]
source/gameengine/Ketsji/KX_SoundActuator.cpp [new file with mode: 0644]
source/gameengine/Ketsji/KX_SoundActuator.h [new file with mode: 0644]
source/gameengine/Ketsji/KX_StateActuator.cpp [new file with mode: 0644]
source/gameengine/Ketsji/KX_StateActuator.h [new file with mode: 0644]
source/gameengine/Ketsji/KX_TimeCategoryLogger.cpp [new file with mode: 0644]
source/gameengine/Ketsji/KX_TimeCategoryLogger.h [new file with mode: 0644]
source/gameengine/Ketsji/KX_TimeLogger.cpp [new file with mode: 0644]
source/gameengine/Ketsji/KX_TimeLogger.h [new file with mode: 0644]
source/gameengine/Ketsji/KX_TouchEventManager.cpp [new file with mode: 0644]
source/gameengine/Ketsji/KX_TouchEventManager.h [new file with mode: 0644]
source/gameengine/Ketsji/KX_TouchSensor.cpp [new file with mode: 0644]
source/gameengine/Ketsji/KX_TouchSensor.h [new file with mode: 0644]
source/gameengine/Ketsji/KX_TrackToActuator.cpp [new file with mode: 0644]
source/gameengine/Ketsji/KX_TrackToActuator.h [new file with mode: 0644]
source/gameengine/Ketsji/KX_VehicleWrapper.cpp [new file with mode: 0644]
source/gameengine/Ketsji/KX_VehicleWrapper.h [new file with mode: 0644]
source/gameengine/Ketsji/KX_VertexProxy.cpp [new file with mode: 0644]
source/gameengine/Ketsji/KX_VertexProxy.h [new file with mode: 0644]
source/gameengine/Ketsji/KX_VisibilityActuator.cpp [new file with mode: 0644]
source/gameengine/Ketsji/KX_VisibilityActuator.h [new file with mode: 0644]
source/gameengine/Ketsji/KX_WorldInfo.cpp [new file with mode: 0644]
source/gameengine/Ketsji/KX_WorldInfo.h [new file with mode: 0644]
source/gameengine/Ketsji/KX_WorldIpoController.cpp [new file with mode: 0644]
source/gameengine/Ketsji/KX_WorldIpoController.h [new file with mode: 0644]
source/gameengine/Ketsji/Makefile [new file with mode: 0644]
source/gameengine/Ketsji/SConscript [new file with mode: 0644]
source/gameengine/Makefile [new file with mode: 0644]
source/gameengine/Network/CMakeLists.txt [new file with mode: 0644]
source/gameengine/Network/LoopBackNetwork/CMakeLists.txt [new file with mode: 0644]
source/gameengine/Network/LoopBackNetwork/Makefile [new file with mode: 0644]
source/gameengine/Network/LoopBackNetwork/NG_LoopBackNetworkDeviceInterface.cpp [new file with mode: 0644]
source/gameengine/Network/LoopBackNetwork/NG_LoopBackNetworkDeviceInterface.h [new file with mode: 0644]
source/gameengine/Network/LoopBackNetwork/SConscript [new file with mode: 0644]
source/gameengine/Network/Makefile [new file with mode: 0644]
source/gameengine/Network/NG_NetworkDeviceInterface.h [new file with mode: 0644]
source/gameengine/Network/NG_NetworkMessage.cpp [new file with mode: 0644]
source/gameengine/Network/NG_NetworkMessage.h [new file with mode: 0644]
source/gameengine/Network/NG_NetworkObject.cpp [new file with mode: 0644]
source/gameengine/Network/NG_NetworkObject.h [new file with mode: 0644]
source/gameengine/Network/NG_NetworkScene.cpp [new file with mode: 0644]
source/gameengine/Network/NG_NetworkScene.h [new file with mode: 0644]
source/gameengine/Network/SConscript [new file with mode: 0644]
source/gameengine/Network/TerraplayNetwork/Makefile [new file with mode: 0644]
source/gameengine/Network/TerraplayNetwork/NG_TerraplayNetworkDeviceInterface.cpp [new file with mode: 0644]
source/gameengine/Network/TerraplayNetwork/NG_TerraplayNetworkDeviceInterface.h [new file with mode: 0644]
source/gameengine/Physics/Bullet/CMakeLists.txt [new file with mode: 0644]
source/gameengine/Physics/Bullet/CcdGraphicController.cpp [new file with mode: 0644]
source/gameengine/Physics/Bullet/CcdGraphicController.h [new file with mode: 0644]
source/gameengine/Physics/Bullet/CcdPhysicsController.cpp [new file with mode: 0644]
source/gameengine/Physics/Bullet/CcdPhysicsController.h [new file with mode: 0644]
source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp [new file with mode: 0644]
source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h [new file with mode: 0644]
source/gameengine/Physics/Bullet/Makefile [new file with mode: 0644]
source/gameengine/Physics/Bullet/SConscript [new file with mode: 0644]
source/gameengine/Physics/Dummy/CMakeLists.txt [new file with mode: 0644]
source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.cpp [new file with mode: 0644]
source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.h [new file with mode: 0644]
source/gameengine/Physics/Dummy/Makefile [new file with mode: 0644]
source/gameengine/Physics/Dummy/SConscript [new file with mode: 0644]
source/gameengine/Physics/Makefile [new file with mode: 0644]
source/gameengine/Physics/common/CMakeLists.txt [new file with mode: 0644]
source/gameengine/Physics/common/Makefile [new file with mode: 0644]
source/gameengine/Physics/common/PHY_DynamicTypes.h [new file with mode: 0644]
source/gameengine/Physics/common/PHY_IController.cpp [new file with mode: 0644]
source/gameengine/Physics/common/PHY_IController.h [new file with mode: 0644]
source/gameengine/Physics/common/PHY_IGraphicController.cpp [new file with mode: 0644]
source/gameengine/Physics/common/PHY_IGraphicController.h [new file with mode: 0644]
source/gameengine/Physics/common/PHY_IMotionState.cpp [new file with mode: 0644]
source/gameengine/Physics/common/PHY_IMotionState.h [new file with mode: 0644]
source/gameengine/Physics/common/PHY_IPhysicsController.cpp [new file with mode: 0644]
source/gameengine/Physics/common/PHY_IPhysicsController.h [new file with mode: 0644]
source/gameengine/Physics/common/PHY_IPhysicsEnvironment.cpp [new file with mode: 0644]
source/gameengine/Physics/common/PHY_IPhysicsEnvironment.h [new file with mode: 0644]
source/gameengine/Physics/common/PHY_IVehicle.cpp [new file with mode: 0644]
source/gameengine/Physics/common/PHY_IVehicle.h [new file with mode: 0644]
source/gameengine/Physics/common/PHY_Pro.h [new file with mode: 0644]
source/gameengine/Physics/common/SConscript [new file with mode: 0644]
source/gameengine/PyDoc/API_intro.py [new file with mode: 0644]
source/gameengine/PyDoc/PhysicsConstraints.py [new file with mode: 0644]
source/gameengine/PyDoc/VideoTexture.py [new file with mode: 0644]
source/gameengine/PyDoc/bge.events.rst [new file with mode: 0644]
source/gameengine/PyDoc/bge.logic.rst [new file with mode: 0644]
source/gameengine/PyDoc/bge.render.rst [new file with mode: 0644]
source/gameengine/PyDoc/bge.types.rst [new file with mode: 0644]
source/gameengine/PyDoc/bge_api_validate_py.txt [new file with mode: 0644]
source/gameengine/PyDoc/epy_docgen.sh [new file with mode: 0755]
source/gameengine/PyDoc/how_to_build_win.txt [new file with mode: 0644]
source/gameengine/Rasterizer/CMakeLists.txt [new file with mode: 0644]
source/gameengine/Rasterizer/Makefile [new file with mode: 0644]
source/gameengine/Rasterizer/RAS_2DFilterManager.cpp [new file with mode: 0644]
source/gameengine/Rasterizer/RAS_2DFilterManager.h [new file with mode: 0644]
source/gameengine/Rasterizer/RAS_BucketManager.cpp [new file with mode: 0644]
source/gameengine/Rasterizer/RAS_BucketManager.h [new file with mode: 0644]
source/gameengine/Rasterizer/RAS_CameraData.h [new file with mode: 0644]
source/gameengine/Rasterizer/RAS_Deformer.h [new file with mode: 0644]
source/gameengine/Rasterizer/RAS_FramingManager.cpp [new file with mode: 0644]
source/gameengine/Rasterizer/RAS_FramingManager.h [new file with mode: 0644]
source/gameengine/Rasterizer/RAS_ICanvas.h [new file with mode: 0644]
source/gameengine/Rasterizer/RAS_IPolygonMaterial.cpp [new file with mode: 0644]
source/gameengine/Rasterizer/RAS_IPolygonMaterial.h [new file with mode: 0644]
source/gameengine/Rasterizer/RAS_IRasterizer.h [new file with mode: 0644]
source/gameengine/Rasterizer/RAS_IRenderTools.cpp [new file with mode: 0644]
source/gameengine/Rasterizer/RAS_IRenderTools.h [new file with mode: 0644]
source/gameengine/Rasterizer/RAS_LightObject.h [new file with mode: 0644]
source/gameengine/Rasterizer/RAS_MaterialBucket.cpp [new file with mode: 0644]
source/gameengine/Rasterizer/RAS_MaterialBucket.h [new file with mode: 0644]
source/gameengine/Rasterizer/RAS_MeshObject.cpp [new file with mode: 0644]
source/gameengine/Rasterizer/RAS_MeshObject.h [new file with mode: 0644]
source/gameengine/Rasterizer/RAS_ObjectColor.h [new file with mode: 0644]
source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Blur2DFilter.h [new file with mode: 0644]
source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Dilation2DFilter.h [new file with mode: 0644]
source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Erosion2DFilter.h [new file with mode: 0644]
source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_GrayScale2DFilter.h [new file with mode: 0644]
source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Invert2DFilter.h [new file with mode: 0644]
source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Laplacian2DFilter.h [new file with mode: 0644]
source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Prewitt2DFilter.h [new file with mode: 0644]
source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Sepia2DFilter.h [new file with mode: 0644]
source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Sharpen2DFilter.h [new file with mode: 0644]
source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Sobel2DFilter.h [new file with mode: 0644]
source/gameengine/Rasterizer/RAS_OpenGLRasterizer/CMakeLists.txt [new file with mode: 0644]
source/gameengine/Rasterizer/RAS_OpenGLRasterizer/Makefile [new file with mode: 0644]
source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_GLExtensionManager.cpp [new file with mode: 0644]
source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_GLExtensionManager.h [new file with mode: 0644]
source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.cpp [new file with mode: 0644]
source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.h [new file with mode: 0644]
source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp [new file with mode: 0644]
source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h [new file with mode: 0644]
source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_VAOpenGLRasterizer.cpp [new file with mode: 0644]
source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_VAOpenGLRasterizer.h [new file with mode: 0644]
source/gameengine/Rasterizer/RAS_OpenGLRasterizer/SConscript [new file with mode: 0644]
source/gameengine/Rasterizer/RAS_Polygon.cpp [new file with mode: 0644]
source/gameengine/Rasterizer/RAS_Polygon.h [new file with mode: 0644]
source/gameengine/Rasterizer/RAS_Rect.h [new file with mode: 0644]
source/gameengine/Rasterizer/RAS_TexMatrix.h [new file with mode: 0644]
source/gameengine/Rasterizer/RAS_TexVert.cpp [new file with mode: 0644]
source/gameengine/Rasterizer/RAS_TexVert.h [new file with mode: 0644]
source/gameengine/Rasterizer/RAS_texmatrix.cpp [new file with mode: 0644]
source/gameengine/Rasterizer/SConscript [new file with mode: 0644]
source/gameengine/SConscript [new file with mode: 0644]
source/gameengine/SceneGraph/CMakeLists.txt [new file with mode: 0644]
source/gameengine/SceneGraph/Makefile [new file with mode: 0644]
source/gameengine/SceneGraph/SConscript [new file with mode: 0644]
source/gameengine/SceneGraph/SG_BBox.cpp [new file with mode: 0644]
source/gameengine/SceneGraph/SG_BBox.h [new file with mode: 0644]
source/gameengine/SceneGraph/SG_Controller.cpp [new file with mode: 0644]
source/gameengine/SceneGraph/SG_Controller.h [new file with mode: 0644]
source/gameengine/SceneGraph/SG_DList.h [new file with mode: 0644]
source/gameengine/SceneGraph/SG_IObject.cpp [new file with mode: 0644]
source/gameengine/SceneGraph/SG_IObject.h [new file with mode: 0644]
source/gameengine/SceneGraph/SG_Node.cpp [new file with mode: 0644]
source/gameengine/SceneGraph/SG_Node.h [new file with mode: 0644]
source/gameengine/SceneGraph/SG_ParentRelation.h [new file with mode: 0644]
source/gameengine/SceneGraph/SG_QList.h [new file with mode: 0644]
source/gameengine/SceneGraph/SG_Spatial.cpp [new file with mode: 0644]
source/gameengine/SceneGraph/SG_Spatial.h [new file with mode: 0644]
source/gameengine/SceneGraph/SG_Tree.cpp [new file with mode: 0644]
source/gameengine/SceneGraph/SG_Tree.h [new file with mode: 0644]
source/gameengine/VideoTexture/BlendType.h [new file with mode: 0644]
source/gameengine/VideoTexture/CMakeLists.txt [new file with mode: 0644]
source/gameengine/VideoTexture/Common.h [new file with mode: 0644]
source/gameengine/VideoTexture/Exception.cpp [new file with mode: 0644]
source/gameengine/VideoTexture/Exception.h [new file with mode: 0644]
source/gameengine/VideoTexture/FilterBase.cpp [new file with mode: 0644]
source/gameengine/VideoTexture/FilterBase.h [new file with mode: 0644]
source/gameengine/VideoTexture/FilterBlueScreen.cpp [new file with mode: 0644]
source/gameengine/VideoTexture/FilterBlueScreen.h [new file with mode: 0644]
source/gameengine/VideoTexture/FilterColor.cpp [new file with mode: 0644]
source/gameengine/VideoTexture/FilterColor.h [new file with mode: 0644]
source/gameengine/VideoTexture/FilterNormal.cpp [new file with mode: 0644]
source/gameengine/VideoTexture/FilterNormal.h [new file with mode: 0644]
source/gameengine/VideoTexture/FilterSource.cpp [new file with mode: 0644]
source/gameengine/VideoTexture/FilterSource.h [new file with mode: 0644]
source/gameengine/VideoTexture/ImageBase.cpp [new file with mode: 0644]
source/gameengine/VideoTexture/ImageBase.h [new file with mode: 0644]
source/gameengine/VideoTexture/ImageBuff.cpp [new file with mode: 0644]
source/gameengine/VideoTexture/ImageBuff.h [new file with mode: 0644]
source/gameengine/VideoTexture/ImageMix.cpp [new file with mode: 0644]
source/gameengine/VideoTexture/ImageMix.h [new file with mode: 0644]
source/gameengine/VideoTexture/ImageRender.cpp [new file with mode: 0644]
source/gameengine/VideoTexture/ImageRender.h [new file with mode: 0644]
source/gameengine/VideoTexture/ImageViewport.cpp [new file with mode: 0644]
source/gameengine/VideoTexture/ImageViewport.h [new file with mode: 0644]
source/gameengine/VideoTexture/Makefile [new file with mode: 0644]
source/gameengine/VideoTexture/PyTypeList.cpp [new file with mode: 0644]
source/gameengine/VideoTexture/PyTypeList.h [new file with mode: 0644]
source/gameengine/VideoTexture/SConscript [new file with mode: 0644]
source/gameengine/VideoTexture/Texture.cpp [new file with mode: 0644]
source/gameengine/VideoTexture/Texture.h [new file with mode: 0644]
source/gameengine/VideoTexture/VideoBase.cpp [new file with mode: 0644]
source/gameengine/VideoTexture/VideoBase.h [new file with mode: 0644]
source/gameengine/VideoTexture/VideoFFmpeg.cpp [new file with mode: 0644]
source/gameengine/VideoTexture/VideoFFmpeg.h [new file with mode: 0644]
source/gameengine/VideoTexture/blendVideoTex.cpp [new file with mode: 0644]

diff --git a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
new file mode 100644 (file)
index 0000000..01a9e62
--- /dev/null
@@ -0,0 +1,585 @@
+/**
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ * Blender's Ketsji startpoint
+ */
+
+#include <signal.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+#ifdef WIN32
+// don't show stl-warnings
+#pragma warning (disable:4786)
+#endif
+
+#include "GL/glew.h"
+
+#include "KX_BlenderGL.h"
+#include "KX_BlenderCanvas.h"
+#include "KX_BlenderKeyboardDevice.h"
+#include "KX_BlenderMouseDevice.h"
+#include "KX_BlenderRenderTools.h"
+#include "KX_BlenderSystem.h"
+#include "BL_Material.h"
+
+#include "KX_KetsjiEngine.h"
+#include "KX_BlenderSceneConverter.h"
+#include "KX_PythonInit.h"
+#include "KX_PyConstraintBinding.h"
+
+#include "RAS_GLExtensionManager.h"
+#include "RAS_OpenGLRasterizer.h"
+#include "RAS_VAOpenGLRasterizer.h"
+#include "RAS_ListRasterizer.h"
+
+#include "NG_LoopBackNetworkDeviceInterface.h"
+
+#include "SYS_System.h"
+
+#include "GPU_extensions.h"
+#include "Value.h"
+
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+       /***/
+#include "DNA_view3d_types.h"
+#include "DNA_screen_types.h"
+#include "DNA_userdef_types.h"
+#include "DNA_windowmanager_types.h"
+#include "BKE_global.h"
+#include "BKE_report.h"
+
+#include "BKE_utildefines.h"
+//XXX #include "BIF_screen.h"
+//XXX #include "BIF_scrarea.h"
+
+#include "BKE_main.h"
+#include "BLI_blenlib.h"
+#include "BLO_readfile.h"
+#include "DNA_scene_types.h"
+#include "BKE_ipo.h"
+       /***/
+
+#include "AUD_C-API.h"
+
+//XXX #include "BSE_headerbuttons.h"
+#include "BKE_context.h"
+#include "../../blender/windowmanager/WM_types.h"
+#include "../../blender/windowmanager/wm_window.h"
+#include "../../blender/windowmanager/wm_event_system.h"
+#ifdef __cplusplus
+}
+#endif
+
+
+static BlendFileData *load_game_data(char *filename)
+{
+       ReportList reports;
+       BlendFileData *bfd;
+       
+       BKE_reports_init(&reports, RPT_STORE);
+       bfd= BLO_read_from_file(filename, &reports);
+
+       if (!bfd) {
+               printf("Loading %s failed: ", filename);
+               BKE_reports_print(&reports, RPT_ERROR);
+       }
+
+       BKE_reports_clear(&reports);
+
+       return bfd;
+}
+
+extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *cam_frame, int always_use_expand_framing)
+{
+       /* context values */
+       struct wmWindow *win= CTX_wm_window(C);
+       struct Scene *startscene= CTX_data_scene(C);
+       struct Main* maggie1= CTX_data_main(C);
+
+
+       RAS_Rect area_rect;
+       area_rect.SetLeft(cam_frame->xmin);
+       area_rect.SetBottom(cam_frame->ymin);
+       area_rect.SetRight(cam_frame->xmax);
+       area_rect.SetTop(cam_frame->ymax);
+
+       int exitrequested = KX_EXIT_REQUEST_NO_REQUEST;
+       Main* blenderdata = maggie1;
+
+       char* startscenename = startscene->id.name+2;
+       char pathname[FILE_MAXDIR+FILE_MAXFILE], oldsce[FILE_MAXDIR+FILE_MAXFILE];
+       STR_String exitstring = "";
+       BlendFileData *bfd= NULL;
+
+       BLI_strncpy(pathname, blenderdata->name, sizeof(pathname));
+       BLI_strncpy(oldsce, G.sce, sizeof(oldsce));
+#ifndef DISABLE_PYTHON
+       resetGamePythonPath(); // need this so running a second time wont use an old blendfiles path
+       setGamePythonPath(G.sce);
+
+       // 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
+       
+       bgl::InitExtensions(true);
+
+       // VBO code for derived mesh is not compatible with BGE (couldn't find why), so disable
+       int disableVBO = (U.gameflags & USER_DISABLE_VBO);
+       U.gameflags |= USER_DISABLE_VBO;
+
+       do
+       {
+               View3D *v3d= CTX_wm_view3d(C);
+               RegionView3D *rv3d= CTX_wm_region_view3d(C);
+
+               // get some preferences
+               SYS_SystemHandle syshandle = SYS_GetSystem();
+               bool properties = (SYS_GetCommandLineInt(syshandle, "show_properties", 0) != 0);
+               bool usefixed = (SYS_GetCommandLineInt(syshandle, "fixedtime", 0) != 0);
+               bool profile = (SYS_GetCommandLineInt(syshandle, "show_profile", 0) != 0);
+               bool frameRate = (SYS_GetCommandLineInt(syshandle, "show_framerate", 0) != 0);
+               bool animation_record = (SYS_GetCommandLineInt(syshandle, "animation_record", 0) != 0);
+               bool displaylists = (SYS_GetCommandLineInt(syshandle, "displaylists", 0) != 0);
+#ifndef DISABLE_PYTHON
+               bool nodepwarnings = (SYS_GetCommandLineInt(syshandle, "ignore_deprecation_warnings", 0) != 0);
+#endif
+               bool novertexarrays = (SYS_GetCommandLineInt(syshandle, "novertexarrays", 0) != 0);
+               if(animation_record) usefixed= true; /* override since you's always want fixed time for sim recording */
+
+               // create the canvas, rasterizer and rendertools
+               RAS_ICanvas* canvas = new KX_BlenderCanvas(win, area_rect, ar);
+               canvas->SetMouseState(RAS_ICanvas::MOUSE_INVISIBLE);
+               RAS_IRenderTools* rendertools = new KX_BlenderRenderTools();
+               RAS_IRasterizer* rasterizer = NULL;
+               
+               if(displaylists) {
+                       if (GLEW_VERSION_1_1 && !novertexarrays)
+                               rasterizer = new RAS_ListRasterizer(canvas, true, true);
+                       else
+                               rasterizer = new RAS_ListRasterizer(canvas);
+               }
+               else if (GLEW_VERSION_1_1 && !novertexarrays)
+                       rasterizer = new RAS_VAOpenGLRasterizer(canvas, false);
+               else
+                       rasterizer = new RAS_OpenGLRasterizer(canvas);
+               
+               // create the inputdevices
+               KX_BlenderKeyboardDevice* keyboarddevice = new KX_BlenderKeyboardDevice();
+               KX_BlenderMouseDevice* mousedevice = new KX_BlenderMouseDevice();
+               
+               // create a networkdevice
+               NG_NetworkDeviceInterface* networkdevice = new
+                       NG_LoopBackNetworkDeviceInterface();
+
+               //
+               // 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);
+               ketsjiengine->SetNetworkDevice(networkdevice);
+               ketsjiengine->SetCanvas(canvas);
+               ketsjiengine->SetRenderTools(rendertools);
+               ketsjiengine->SetRasterizer(rasterizer);
+               ketsjiengine->SetNetworkDevice(networkdevice);
+               ketsjiengine->SetUseFixedTime(usefixed);
+               ketsjiengine->SetTimingDisplay(frameRate, profile, properties);
+
+#ifndef DISABLE_PYTHON
+               CValue::SetDeprecationWarnings(nodepwarnings);
+#endif
+
+               //lock frame and camera enabled - storing global values
+               int tmp_lay= startscene->lay;
+               Object *tmp_camera = startscene->camera;
+
+               if (v3d->scenelock==0){
+                       startscene->lay= v3d->lay;
+                       startscene->camera= v3d->camera;
+               }
+
+               // some blender stuff
+               MT_CmMatrix4x4 projmat;
+               MT_CmMatrix4x4 viewmat;
+               float camzoom;
+               int i;
+
+               for (i = 0; i < 16; i++)
+               {
+                       float *viewmat_linear= (float*) rv3d->viewmat;
+                       viewmat.setElem(i, viewmat_linear[i]);
+               }
+               for (i = 0; i < 16; i++)
+               {
+                       float *projmat_linear= (float*) rv3d->winmat;
+                       projmat.setElem(i, projmat_linear[i]);
+               }
+               
+               if(rv3d->persp==RV3D_CAMOB) {
+                       if(startscene->gm.framing.type == SCE_GAMEFRAMING_BARS) { /* Letterbox */
+                               camzoom = 1.0f;
+                       }
+                       else {
+                               camzoom = (1.41421 + (rv3d->camzoom / 50.0));
+                               camzoom *= camzoom;
+                               camzoom = 4.0 / camzoom;
+                       }
+               }
+               else {
+                       camzoom = 2.0;
+               }
+
+               
+
+               ketsjiengine->SetDrawType(v3d->drawtype);
+               ketsjiengine->SetCameraZoom(camzoom);
+               
+               // if we got an exitcode 3 (KX_EXIT_REQUEST_START_OTHER_GAME) load a different file
+               if (exitrequested == KX_EXIT_REQUEST_START_OTHER_GAME || exitrequested == KX_EXIT_REQUEST_RESTART_GAME)
+               {
+                       exitrequested = KX_EXIT_REQUEST_NO_REQUEST;
+                       if (bfd) BLO_blendfiledata_free(bfd);
+                       
+                       char basedpath[240];
+                       // base the actuator filename with respect
+                       // to the original file working directory
+
+                       if (exitstring != "")
+                               strcpy(basedpath, exitstring.Ptr());
+
+                       // load relative to the last loaded file, this used to be relative
+                       // to the first file but that makes no sense, relative paths in
+                       // blend files should be relative to that file, not some other file
+                       // 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[242];
+                               strcpy(temppath, "//");
+                               strcat(temppath, basedpath);
+                               
+                               BLI_path_abs(temppath, pathname);
+                               bfd = load_game_data(temppath);
+                       }
+                       
+                       // if we got a loaded blendfile, proceed
+                       if (bfd)
+                       {
+                               blenderdata = bfd->main;
+                               startscenename = bfd->curscene->id.name + 2;
+
+                               if(blenderdata) {
+                                       BLI_strncpy(G.sce, blenderdata->name, sizeof(G.sce));
+                                       BLI_strncpy(pathname, blenderdata->name, sizeof(pathname));
+#ifndef DISABLE_PYTHON
+                                       setGamePythonPath(G.sce);
+#endif
+                               }
+                       }
+                       // else forget it, we can't find it
+                       else
+                       {
+                               exitrequested = KX_EXIT_REQUEST_QUIT_GAME;
+                       }
+               }
+
+               Scene *scene= bfd ? bfd->curscene : (Scene *)BLI_findstring(&blenderdata->scene, startscenename, offsetof(ID, name) + 2);
+
+               if (scene)
+               {
+                       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)
+                                       rasterizer->SetStereoMode((RAS_IRasterizer::StereoMode) scene->gm.stereomode);
+
+                               rasterizer->SetEyeSeparation(scene->gm.eyeseparation);
+                       }
+
+                       rasterizer->SetBackColor(scene->gm.framing.col[0], scene->gm.framing.col[1], scene->gm.framing.col[2], 0.0f);
+               }
+               
+               if (exitrequested != KX_EXIT_REQUEST_QUIT_GAME)
+               {
+                       if (rv3d->persp != RV3D_CAMOB)
+                       {
+                               ketsjiengine->EnableCameraOverride(startscenename);
+                               ketsjiengine->SetCameraOverrideUseOrtho((rv3d->persp == RV3D_ORTHO));
+                               ketsjiengine->SetCameraOverrideProjectionMatrix(projmat);
+                               ketsjiengine->SetCameraOverrideViewMatrix(viewmat);
+                               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);
+                       sceneconverter->addInitFromFrame=false;
+                       if (always_use_expand_framing)
+                               sceneconverter->SetAlwaysUseExpandFraming(true);
+
+                       bool usemat = false, useglslmat = false;
+
+                       if(GLEW_ARB_multitexture && GLEW_VERSION_1_1)
+                               usemat = true;
+
+                       if(GPU_glsl_support())
+                               useglslmat = true;
+                       else if(scene->gm.matmode == GAME_MAT_GLSL)
+                               usemat = false;
+
+                       if(usemat && (scene->gm.matmode != GAME_MAT_TEXFACE))
+                               sceneconverter->SetMaterials(true);
+                       if(useglslmat && (scene->gm.matmode == GAME_MAT_GLSL))
+                               sceneconverter->SetGLSLMaterials(true);
+                                       
+                       KX_Scene* startscene = new KX_Scene(keyboarddevice,
+                               mousedevice,
+                               networkdevice,
+                               startscenename,
+                               scene,
+                               canvas);
+
+#ifndef DISABLE_PYTHON
+                       // some python things
+                       PyObject *gameLogic, *gameLogic_keys;
+                       setupGamePython(ketsjiengine, startscene, blenderdata, pyGlobalDict, &gameLogic, &gameLogic_keys, 0, NULL);
+#endif // DISABLE_PYTHON
+
+                       //initialize Dome Settings
+                       if(scene->gm.stereoflag == STEREO_DOME)
+                               ketsjiengine->InitDome(scene->gm.dome.res, scene->gm.dome.mode, scene->gm.dome.angle, scene->gm.dome.resbuf, scene->gm.dome.tilt, scene->gm.dome.warptext);
+
+                       // initialize 3D Audio Settings
+                       AUD_setSpeedOfSound(scene->audio.speed_of_sound);
+                       AUD_setDopplerFactor(scene->audio.doppler_factor);
+                       AUD_setDistanceModel(AUD_DistanceModel(scene->audio.distance_model));
+
+                       // from see blender.c:
+                       // FIXME: this version patching should really be part of the file-reading code,
+                       // but we still get too many unrelated data-corruption crashes otherwise...
+                       if (blenderdata->versionfile < 250)
+                               do_versions_ipos_to_animato(blenderdata);
+
+                       if (sceneconverter)
+                       {
+                               // convert and add scene
+                               sceneconverter->ConvertScene(
+                                       startscene,
+                                       rendertools,
+                                       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);
+                               
+                               // the mainloop
+                               printf("\nBlender Game Engine Started\n\n");
+                               while (!exitrequested)
+                               {
+                                       // first check if we want to exit
+                                       exitrequested = ketsjiengine->GetExitCode();
+                                       
+                                       // kick the engine
+                                       bool render = ketsjiengine->NextFrame(); // XXX 2.5 Bug, This is never true! FIXME-  Campbell
+                                       
+                                       if (render)
+                                       {
+                                               // render the frame
+                                               ketsjiengine->Render();
+                                       }
+                                       
+                                       wm_window_process_events_nosleep(C);
+                                       
+                                       // test for the ESC key
+                                       //XXX while (qtest())
+                                       while(wmEvent *event= (wmEvent *)win->queue.first)
+                                       {
+                                               short val = 0;
+                                               //unsigned short event = 0; //XXX extern_qread(&val);
+                                               
+                                               if (keyboarddevice->ConvertBlenderEvent(event->type,event->val))
+                                                       exitrequested = KX_EXIT_REQUEST_BLENDER_ESC;
+                                               
+                                                       /* Coordinate conversion... where
+                                                       * should this really be?
+                                               */
+                                               if (event->type==MOUSEMOVE) {
+                                                       /* Note, not nice! XXX 2.5 event hack */
+                                                       val = event->x - ar->winrct.xmin;
+                                                       mousedevice->ConvertBlenderEvent(MOUSEX, val);
+                                                       
+                                                       val = ar->winy - (event->y - ar->winrct.ymin) - 1;
+                                                       mousedevice->ConvertBlenderEvent(MOUSEY, val);
+                                               }
+                                               else {
+                                                       mousedevice->ConvertBlenderEvent(event->type,event->val);
+                                               }
+                                               
+                                               BLI_remlink(&win->queue, event);
+                                               wm_event_free(event);
+                                       }
+                                       
+                               }
+                               printf("\nBlender Game Engine Finished\n\n");
+                               exitstring = ketsjiengine->GetExitString();
+
+
+                               // when exiting the mainloop
+#ifndef DISABLE_PYTHON
+                               // Clears the dictionary by hand:
+                               // This prevents, extra references to global variables
+                               // 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
+                               int listIndex;
+                               PyObject *gameLogic_keys_new = PyDict_Keys(PyModule_GetDict(gameLogic));
+                               for (listIndex=0; listIndex < PyList_Size(gameLogic_keys_new); listIndex++)  {
+                                       PyObject* item = PyList_GET_ITEM(gameLogic_keys_new, listIndex);
+                                       if (!PySequence_Contains(gameLogic_keys, item)) {
+                                               PyDict_DelItem( PyModule_GetDict(gameLogic), item);
+                                       }
+                               }
+                               Py_DECREF(gameLogic_keys_new);
+                               gameLogic_keys_new = NULL;
+#endif
+                               ketsjiengine->StopEngine();
+#ifndef DISABLE_PYTHON
+                               exitGamePythonScripting();
+#endif
+                               networkdevice->Disconnect();
+                       }
+                       if (sceneconverter)
+                       {
+                               delete sceneconverter;
+                               sceneconverter = NULL;
+                       }
+
+#ifndef DISABLE_PYTHON
+                       Py_DECREF(gameLogic_keys);
+                       gameLogic_keys = NULL;
+#endif
+               }
+               //lock frame and camera enabled - restoring global values
+               if (v3d->scenelock==0){
+                       startscene->lay= tmp_lay;
+                       startscene->camera= tmp_camera;
+               }
+
+               // set the cursor back to normal
+               canvas->SetMouseState(RAS_ICanvas::MOUSE_NORMAL);
+               
+               // clean up some stuff
+               if (ketsjiengine)
+               {
+                       delete ketsjiengine;
+                       ketsjiengine = NULL;
+               }
+               if (kxsystem)
+               {
+                       delete kxsystem;
+                       kxsystem = NULL;
+               }
+               if (networkdevice)
+               {
+                       delete networkdevice;
+                       networkdevice = NULL;
+               }
+               if (keyboarddevice)
+               {
+                       delete keyboarddevice;
+                       keyboarddevice = NULL;
+               }
+               if (mousedevice)
+               {
+                       delete mousedevice;
+                       mousedevice = NULL;
+               }
+               if (rasterizer)
+               {
+                       delete rasterizer;
+                       rasterizer = NULL;
+               }
+               if (rendertools)
+               {
+                       delete rendertools;
+                       rendertools = NULL;
+               }
+               if (canvas)
+               {
+                       delete canvas;
+                       canvas = NULL;
+                }
+       
+       } while (exitrequested == KX_EXIT_REQUEST_RESTART_GAME || exitrequested == KX_EXIT_REQUEST_START_OTHER_GAME);
+       
+       if (!disableVBO)
+               U.gameflags &= ~USER_DISABLE_VBO;
+
+       if (bfd) BLO_blendfiledata_free(bfd);
+
+       BLI_strncpy(G.sce, oldsce, sizeof(G.sce));
+
+#ifndef DISABLE_PYTHON
+       Py_DECREF(pyGlobalDict);
+
+       // Release Python's GIL
+       PyGILState_Release(gilstate);
+#endif
+
+}
diff --git a/source/gameengine/BlenderRoutines/CMakeLists.txt b/source/gameengine/BlenderRoutines/CMakeLists.txt
new file mode 100644 (file)
index 0000000..57d2856
--- /dev/null
@@ -0,0 +1,52 @@
+
+FILE(GLOB SRC *.cpp)
+
+SET(INC
+       .
+       ../../../source/kernel/gen_system
+       ../../../intern/string
+       ../../../intern/guardedalloc
+       ../../../intern/audaspace/intern
+       ../../../source/gameengine/Rasterizer/RAS_OpenGLRasterizer 
+       ../../../source/gameengine/Converter
+       ../../../source/blender/imbuf
+       ../../../intern/ghost/include
+       ../../../intern/moto/include
+       ../../../source/gameengine/Ketsji 
+       ../../../source/blender/blenlib
+       ../../../source/blender/blenkernel 
+       ../../../source/blender/blenfont
+       ../../../source/blender/editors/include
+       ../../../source/blender/windowmanager
+       ../../../source/blender 
+       ../../../source/blender/include
+       ../../../source/blender/makesdna
+       ../../../source/blender/makesrna 
+       ../../../source/gameengine/Rasterizer 
+       ../../../source/gameengine/GameLogic
+       ../../../source/gameengine/Expressions 
+       ../../../source/gameengine/Network
+       ../../../source/gameengine/SceneGraph 
+       ../../../source/gameengine/Physics/common
+       ../../../source/gameengine/Physics/Bullet
+       ../../../source/gameengine/Network/LoopBackNetwork
+       ../../../source/blender/misc 
+       ../../../source/blender/blenloader
+       ../../../source/blender/gpu
+       ../../../extern/bullet2/src
+       ../../../extern/glew/include
+)
+
+ADD_DEFINITIONS(-DGLEW_STATIC)
+
+IF(WITH_FFMPEG)
+       ADD_DEFINITIONS(-DWITH_FFMPEG)
+ENDIF(WITH_FFMPEG)
+
+IF(WITH_PYTHON)
+       SET(INC ${INC} ${PYTHON_INC})
+ELSE(WITH_PYTHON)
+       ADD_DEFINITIONS(-DDISABLE_PYTHON)
+ENDIF(WITH_PYTHON)
+
+BLENDERLIB(bf_blroutines "${SRC}" "${INC}")
diff --git a/source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp b/source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp
new file mode 100644 (file)
index 0000000..b04e951
--- /dev/null
@@ -0,0 +1,207 @@
+/**
+ * $Id$
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include "KX_BlenderCanvas.h"
+#include "DNA_screen_types.h"
+#include "stdio.h"
+
+
+KX_BlenderCanvas::KX_BlenderCanvas(struct wmWindow *win, RAS_Rect &rect, struct ARegion *ar) :
+m_win(win),
+m_frame_rect(rect)
+{
+       // area boundaries needed for mouse coordinates in Letterbox framing mode
+       m_area_left = ar->winrct.xmin;
+       m_area_top = ar->winrct.ymax;
+}
+
+KX_BlenderCanvas::~KX_BlenderCanvas()
+{
+}
+
+void KX_BlenderCanvas::Init()
+{
+       glDepthFunc(GL_LEQUAL);
+}      
+
+
+void KX_BlenderCanvas::SwapBuffers()
+{
+       BL_SwapBuffers(m_win);
+}
+
+void KX_BlenderCanvas::BeginFrame()
+{
+       glEnable(GL_DEPTH_TEST);
+       glDepthFunc(GL_LEQUAL);
+
+}
+
+
+void KX_BlenderCanvas::EndFrame()
+{
+               // this is needed, else blender distorts a lot
+       glPopAttrib();
+       glPushAttrib(GL_ALL_ATTRIB_BITS);
+               
+       glDisable(GL_FOG);
+}
+
+
+
+void KX_BlenderCanvas::ClearColor(float r,float g,float b,float a)
+{
+       glClearColor(r,g,b,a);
+}
+
+
+
+void KX_BlenderCanvas::ClearBuffer(int type)
+{
+       int ogltype = 0;
+
+       if (type & RAS_ICanvas::COLOR_BUFFER )
+               ogltype |= GL_COLOR_BUFFER_BIT;
+
+       if (type & RAS_ICanvas::DEPTH_BUFFER )
+               ogltype |= GL_DEPTH_BUFFER_BIT;
+       glClear(ogltype);
+}
+
+int KX_BlenderCanvas::GetWidth(
+) const {
+       return m_frame_rect.GetWidth();
+}
+
+int KX_BlenderCanvas::GetHeight(
+) const {
+       return m_frame_rect.GetHeight();
+}
+
+int KX_BlenderCanvas::GetMouseX(int x)
+{
+       float left = GetWindowArea().GetLeft();
+       return float(x - (left - m_area_left));
+}
+
+int KX_BlenderCanvas::GetMouseY(int y)
+{
+       float top = GetWindowArea().GetTop();
+       return float(y - (m_area_top - top));
+}
+
+float KX_BlenderCanvas::GetMouseNormalizedX(int x)
+{
+       int can_x = GetMouseX(x);
+       return float(can_x)/this->GetWidth();
+}
+
+float KX_BlenderCanvas::GetMouseNormalizedY(int y)
+{
+       int can_y = GetMouseY(y);
+       return float(can_y)/this->GetHeight();
+}
+
+RAS_Rect &
+KX_BlenderCanvas::
+GetWindowArea(
+){
+       return m_area_rect;
+}      
+
+       void
+KX_BlenderCanvas::
+SetViewPort(
+       int x1, int y1,
+       int x2, int y2
+){
+       /*      x1 and y1 are the min pixel coordinate (e.g. 0)
+               x2 and y2 are the max pixel coordinate
+               the width,height is calculated including both pixels
+               therefore: max - min + 1
+       */
+       int vp_width = (x2 - x1) + 1;
+       int vp_height = (y2 - y1) + 1;
+       int minx = m_frame_rect.GetLeft();
+       int miny = m_frame_rect.GetBottom();
+
+       m_area_rect.SetLeft(minx + x1);
+       m_area_rect.SetBottom(miny + y1);
+       m_area_rect.SetRight(minx + x2);
+       m_area_rect.SetTop(miny + y2);
+
+       glViewport(minx + x1, miny + y1, vp_width, vp_height);
+       glScissor(minx + x1, miny + y1, vp_width, vp_height);
+}
+
+
+void KX_BlenderCanvas::SetMouseState(RAS_MouseState mousestate)
+{
+       m_mousestate = mousestate;
+
+       switch (mousestate)
+       {
+       case MOUSE_INVISIBLE:
+               {
+                       BL_HideMouse(m_win);
+                       break;
+               }
+       case MOUSE_WAIT:
+               {
+                       BL_WaitMouse(m_win);
+                       break;
+               }
+       case MOUSE_NORMAL:
+               {
+                       BL_NormalMouse(m_win);
+                       break;
+               }
+       default:
+               {
+               }
+       }
+}
+
+
+
+//     (0,0) is top left, (width,height) is bottom right
+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();
+       
+       BL_warp_pointer(m_win, winX + x, winY + (winH-y));
+}
+
+
+
+void KX_BlenderCanvas::MakeScreenShot(const char* filename)
+{
+//     BL_MakeScreenShot(m_ar, filename);
+}
diff --git a/source/gameengine/BlenderRoutines/KX_BlenderCanvas.h b/source/gameengine/BlenderRoutines/KX_BlenderCanvas.h
new file mode 100644 (file)
index 0000000..42f956c
--- /dev/null
@@ -0,0 +1,201 @@
+/**
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+#ifndef __KX_BLENDERCANVAS
+#define __KX_BLENDERCANVAS
+
+#ifdef WIN32
+#include <windows.h>
+#endif 
+
+#include "GL/glew.h"
+
+#include "RAS_ICanvas.h"
+#include "RAS_Rect.h"
+
+#include "KX_BlenderGL.h"
+
+#ifdef WITH_CXX_GUARDEDALLOC
+#include "MEM_guardedalloc.h"
+#endif
+
+struct ARegion;
+struct wmWindow;
+
+/**
+ * 2D Blender device context abstraction. 
+ * The connection from 3d rendercontext to 2d Blender surface embedding.
+ */
+
+class KX_BlenderCanvas : public RAS_ICanvas
+{
+private:
+       /** Rect that defines the area used for rendering,
+           relative to the context */
+       RAS_Rect m_displayarea;
+
+public:
+       /* Construct a new canvas.
+        * 
+        * @param area The Blender ARegion to run the game within.
+        */
+       KX_BlenderCanvas(struct wmWindow* win, class RAS_Rect &rect, struct ARegion* ar);
+       ~KX_BlenderCanvas();
+
+               void 
+       Init(
+       );
+       
+               void 
+       SwapBuffers(
+       );
+               void 
+       Resize(
+               int width,
+               int height
+       );
+
+               void
+       BeginFrame(
+       );
+
+               void 
+       EndFrame(
+       );
+
+               void 
+       ClearColor(
+               float r,
+               float g,
+               float b,
+               float a
+       );
+
+               void 
+       ClearBuffer(
+               int type
+       );
+
+               int 
+       GetWidth(
+       ) const ;
+
+               int 
+       GetHeight(
+       ) const ;
+
+               int
+       GetMouseX(int x
+       );
+
+               int
+       GetMouseY(int y
+       );
+
+               float
+       GetMouseNormalizedX(int x
+       );
+
+               float
+       GetMouseNormalizedY(int y
+       );
+
+       const
+               RAS_Rect &
+       GetDisplayArea(
+       ) const {
+               return m_displayarea;
+       };
+
+               void
+       SetDisplayArea(RAS_Rect *rect
+       ) {
+               m_displayarea= *rect;
+       };
+
+               RAS_Rect &
+       GetWindowArea(
+       );
+
+               void
+       SetViewPort(
+               int x1, int y1,
+               int x2, int y2
+       );
+
+               void 
+       SetMouseState(
+               RAS_MouseState mousestate
+       );
+
+               void 
+       SetMousePosition(
+               int x,
+               int y
+       );
+
+               void 
+       MakeScreenShot(
+               const char* filename
+       );
+       
+       /**
+        * Nothing needs be done for BlenderCanvas
+        * Begin/End Draw, as the game engine GL context
+        * is always current/active.
+        */
+
+               bool 
+       BeginDraw(
+       ) {
+                       return true;
+       };
+
+               void 
+       EndDraw(
+       ) {
+       };
+
+private:
+       /** Blender area the game engine is running within */
+       struct wmWindow* m_win;
+       RAS_Rect        m_frame_rect;
+       RAS_Rect        m_area_rect;
+       short           m_area_left;
+       short           m_area_top;
+
+
+#ifdef WITH_CXX_GUARDEDALLOC
+public:
+       void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_BlenderCanvas"); }
+       void operator delete( void *mem ) { MEM_freeN(mem); }
+#endif
+};
+
+#endif // __KX_BLENDERCANVAS
+
diff --git a/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp b/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp
new file mode 100644 (file)
index 0000000..55a687c
--- /dev/null
@@ -0,0 +1,223 @@
+/**
+ * $Id$
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include "KX_BlenderGL.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#include "BLF_api.h"
+#ifdef __cplusplus
+}
+#endif
+
+/* 
+ * This little block needed for linking to Blender... 
+ */
+#ifdef WIN32
+#include <vector>
+#include "BLI_winstuff.h"
+#endif
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "GL/glew.h"
+
+#include "BL_Material.h" // MAXTEX
+
+/* Data types encoding the game world: */
+#include "DNA_object_types.h"
+#include "DNA_scene_types.h"
+#include "DNA_screen_types.h"
+#include "DNA_camera_types.h"
+#include "DNA_world_types.h"
+#include "DNA_mesh_types.h"
+#include "DNA_meshdata_types.h"
+#include "DNA_image_types.h"
+#include "DNA_view3d_types.h"
+#include "DNA_material_types.h"
+#include "DNA_windowmanager_types.h"
+
+#include "BKE_global.h"
+#include "BKE_bmfont.h"
+#include "BKE_image.h"
+
+extern "C" {
+#include "WM_api.h"
+#include "WM_types.h"
+#include "wm_event_system.h"
+#include "wm_cursors.h"
+#include "wm_window.h"
+}
+
+/* end of blender block */
+
+/* was in drawmesh.c */
+void spack(unsigned int ucol)
+{
+       char *cp= (char *)&ucol;
+        
+       glColor3ub(cp[3], cp[2], cp[1]);
+}
+
+void BL_warp_pointer(wmWindow *win, int x,int y)
+{
+       WM_cursor_warp(win, x, y);
+}
+
+void BL_SwapBuffers(wmWindow *win)
+{
+       wm_window_swap_buffers(win);
+}
+
+void DisableForText()
+{
+       glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); /* needed for texture fonts otherwise they render as wireframe */
+
+       if(glIsEnabled(GL_BLEND)) glDisable(GL_BLEND);
+       if(glIsEnabled(GL_ALPHA_TEST)) glDisable(GL_ALPHA_TEST);
+
+       if(glIsEnabled(GL_LIGHTING)) {
+               glDisable(GL_LIGHTING);
+               glDisable(GL_COLOR_MATERIAL);
+       }
+
+       if(GLEW_ARB_multitexture) {
+               for(int i=0; i<MAXTEX; i++) {
+                       glActiveTextureARB(GL_TEXTURE0_ARB+i);
+
+                       if(GLEW_ARB_texture_cube_map)
+                               if(glIsEnabled(GL_TEXTURE_CUBE_MAP_ARB))
+                                       glDisable(GL_TEXTURE_CUBE_MAP_ARB);
+
+                       if(glIsEnabled(GL_TEXTURE_2D))
+                               glDisable(GL_TEXTURE_2D);
+               }
+
+               glActiveTextureARB(GL_TEXTURE0_ARB);
+       }
+       else {
+               if(GLEW_ARB_texture_cube_map)
+                       if(glIsEnabled(GL_TEXTURE_CUBE_MAP_ARB))
+                               glDisable(GL_TEXTURE_CUBE_MAP_ARB);
+
+               if(glIsEnabled(GL_TEXTURE_2D))
+                       glDisable(GL_TEXTURE_2D);
+       }
+}
+
+void BL_print_gamedebug_line(const char* text, int xco, int yco, int width, int height)
+{      
+       /* gl prepping */
+       DisableForText();
+
+       glMatrixMode(GL_PROJECTION);
+       glPushMatrix();
+       glLoadIdentity();
+
+       glOrtho(0, width, 0, height, -100, 100);
+
+       glMatrixMode(GL_MODELVIEW);
+       glPushMatrix();
+       glLoadIdentity();
+
+       /* the actual drawing */
+       glColor3ub(255, 255, 255);
+       BLF_draw_default(xco, height-yco, 0.0f, (char *)text);
+
+       glMatrixMode(GL_PROJECTION);
+       glPopMatrix();
+       glMatrixMode(GL_MODELVIEW);
+       glPopMatrix();
+       glEnable(GL_DEPTH_TEST);
+}
+
+void BL_print_gamedebug_line_padded(const char* text, int xco, int yco, int width, int height)
+{
+       /* This is a rather important line :( The gl-mode hasn't been left
+        * behind quite as neatly as we'd have wanted to. I don't know
+        * what cause it, though :/ .*/
+       DisableForText();
+
+       glMatrixMode(GL_PROJECTION);
+       glPushMatrix();
+       glLoadIdentity();
+       
+       glOrtho(0, width, 0, height, -100, 100);
+       
+       glMatrixMode(GL_MODELVIEW);
+       glPushMatrix();
+       glLoadIdentity();
+
+       /* draw in black first*/
+       glColor3ub(0, 0, 0);
+       BLF_draw_default(xco+2, height-yco-2, 0.0f, (char *)text);
+       glColor3ub(255, 255, 255);
+       BLF_draw_default(xco, height-yco, 0.0f, (char *)text);
+
+       glMatrixMode(GL_PROJECTION);
+       glPopMatrix();
+       glMatrixMode(GL_MODELVIEW);
+       glPopMatrix();
+       glEnable(GL_DEPTH_TEST);
+}
+
+void BL_HideMouse(wmWindow *win)
+{
+       WM_cursor_set(win, CURSOR_NONE);
+}
+
+
+void BL_WaitMouse(wmWindow *win)
+{
+       WM_cursor_set(win, CURSOR_WAIT);
+}
+
+
+void BL_NormalMouse(wmWindow *win)
+{
+       WM_cursor_set(win, CURSOR_STD);
+}
+#define MAX_FILE_LENGTH 512
+
+
+void BL_MakeScreenShot(struct ARegion *ar, const char* filename)
+{
+       char copyfilename[MAX_FILE_LENGTH];
+       strcpy(copyfilename,filename);
+
+       // filename read - only
+       
+         /* XXX will need to change at some point */
+       //XXX BIF_screendump(0);
+
+       // write+read filename
+       //XXX write_screendump((char*) copyfilename);
+}
+
diff --git a/source/gameengine/BlenderRoutines/KX_BlenderGL.h b/source/gameengine/BlenderRoutines/KX_BlenderGL.h
new file mode 100644 (file)
index 0000000..84d174c
--- /dev/null
@@ -0,0 +1,60 @@
+/**
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+#ifndef __BLENDERGL
+#define __BLENDERGL
+
+#ifdef __cplusplus
+extern "C" {
+#endif //__cplusplus
+
+struct wmWindow;
+struct ARegion;
+
+// special swapbuffers, that takes care of which area (viewport) needs to be swapped
+void   BL_SwapBuffers(struct wmWindow *win);
+
+void   BL_warp_pointer(struct wmWindow *win,int x,int y);
+
+void   BL_MakeScreenShot(struct ARegion *ar, const char* filename);
+
+void   BL_HideMouse(struct wmWindow *win);
+void   BL_NormalMouse(struct wmWindow *win);
+void   BL_WaitMouse(struct wmWindow *win);
+
+void BL_print_gamedebug_line(const char* text, int xco, int yco, int width, int height);
+void BL_print_gamedebug_line_padded(const char* text, int xco, int yco, int width, int height);
+
+
+
+#ifdef __cplusplus
+}
+#endif //__cplusplus
+
+#endif //__BLENDERGL
+
diff --git a/source/gameengine/BlenderRoutines/KX_BlenderInputDevice.cpp b/source/gameengine/BlenderRoutines/KX_BlenderInputDevice.cpp
new file mode 100644 (file)
index 0000000..697687d
--- /dev/null
@@ -0,0 +1,30 @@
+/**
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+#include "KX_BlenderInputDevice.h"
+
diff --git a/source/gameengine/BlenderRoutines/KX_BlenderInputDevice.h b/source/gameengine/BlenderRoutines/KX_BlenderInputDevice.h
new file mode 100644 (file)
index 0000000..5bdf0cc
--- /dev/null
@@ -0,0 +1,242 @@
+/**
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+#ifndef __KX_BLENDERINPUTDEVICE
+#define __KX_BLENDERINPUTDEVICE
+
+#ifdef WIN32
+#pragma warning(disable : 4786)  // shut off 255 char limit debug template warning
+#endif
+
+#include <map>
+
+#include "wm_event_types.h"
+#include "WM_types.h"
+#include "SCA_IInputDevice.h"
+
+#ifdef WITH_CXX_GUARDEDALLOC
+#include "MEM_guardedalloc.h"
+#endif
+
+/**
+ Base Class for Blender specific inputdevices. Blender specific inputdevices are used when the gameengine is running in embedded mode instead of standalone mode.
+*/
+class BL_BlenderInputDevice : public SCA_IInputDevice                                                               
+{
+       // this map is Blender specific: a conversion between blender and ketsji enums
+       std::map<int,KX_EnumInputs> m_reverseKeyTranslateTable;
+public:
+       BL_BlenderInputDevice()                                                                                    
+               {                                                                                                          
+                       
+                       /* The reverse table. In order to not confuse ourselves, we      */
+                       /* immediately convert all events that come in to KX codes.      */
+                       m_reverseKeyTranslateTable[LEFTMOUSE                    ] =     KX_LEFTMOUSE            ;
+                       m_reverseKeyTranslateTable[MIDDLEMOUSE                  ] =     KX_MIDDLEMOUSE          ;
+                       m_reverseKeyTranslateTable[RIGHTMOUSE                   ] =     KX_RIGHTMOUSE           ;
+                       m_reverseKeyTranslateTable[WHEELUPMOUSE                 ] =     KX_WHEELUPMOUSE         ;
+                       m_reverseKeyTranslateTable[WHEELDOWNMOUSE               ] =     KX_WHEELDOWNMOUSE       ;
+                       m_reverseKeyTranslateTable[MOUSEX                       ] =     KX_MOUSEX               ;
+                       m_reverseKeyTranslateTable[MOUSEY                       ] =     KX_MOUSEY               ;
+                                                                                                                   
+                       // TIMERS                                                                                                  
+
+                       m_reverseKeyTranslateTable[TIMER0                           ] = KX_TIMER0                  ;                  
+                       m_reverseKeyTranslateTable[TIMER1                           ] = KX_TIMER1                  ;                  
+                       m_reverseKeyTranslateTable[TIMER2                           ] = KX_TIMER2                  ;                  
+                                                                                                                   
+                       // SYSTEM 
+#if 0                  
+                       /* **** XXX **** */
+                       m_reverseKeyTranslateTable[KEYBD                            ] = KX_KEYBD                   ;                  
+                       m_reverseKeyTranslateTable[RAWKEYBD                         ] = KX_RAWKEYBD                ;                  
+                       m_reverseKeyTranslateTable[REDRAW                           ] = KX_REDRAW                  ;                  
+                       m_reverseKeyTranslateTable[INPUTCHANGE                      ] = KX_INPUTCHANGE             ;                  
+                       m_reverseKeyTranslateTable[QFULL                            ] = KX_QFULL                   ;                  
+                       m_reverseKeyTranslateTable[WINFREEZE                        ] = KX_WINFREEZE               ;                  
+                       m_reverseKeyTranslateTable[WINTHAW                          ] = KX_WINTHAW                 ;                  
+                       m_reverseKeyTranslateTable[WINCLOSE                         ] = KX_WINCLOSE                ;                  
+                       m_reverseKeyTranslateTable[WINQUIT                          ] = KX_WINQUIT                 ;                  
+                       m_reverseKeyTranslateTable[Q_FIRSTTIME                      ] = KX_Q_FIRSTTIME             ;                  
+                       /* **** XXX **** */
+#endif                                                                                                                   
+                       // standard keyboard                                                                                       
+                                                                                                                   
+                       m_reverseKeyTranslateTable[AKEY                             ] = KX_AKEY                    ;                  
+                       m_reverseKeyTranslateTable[BKEY                             ] = KX_BKEY                    ;                  
+                       m_reverseKeyTranslateTable[CKEY                             ] = KX_CKEY                    ;                  
+                       m_reverseKeyTranslateTable[DKEY                             ] = KX_DKEY                    ;                  
+                       m_reverseKeyTranslateTable[EKEY                             ] = KX_EKEY                    ;                  
+                       m_reverseKeyTranslateTable[FKEY                             ] = KX_FKEY                    ;                  
+                       m_reverseKeyTranslateTable[GKEY                             ] = KX_GKEY                    ;                  
+//XXX clean up
+#ifdef WIN32
+#define HKEY   'h'
+#endif
+                       m_reverseKeyTranslateTable[HKEY                             ] = KX_HKEY                    ;                  
+//XXX clean up
+#ifdef WIN32
+#undef HKEY
+#endif
+                       m_reverseKeyTranslateTable[IKEY                             ] = KX_IKEY                    ;                  
+                       m_reverseKeyTranslateTable[JKEY                             ] = KX_JKEY                    ;                  
+                       m_reverseKeyTranslateTable[KKEY                             ] = KX_KKEY                    ;                  
+                       m_reverseKeyTranslateTable[LKEY                             ] = KX_LKEY                    ;                  
+                       m_reverseKeyTranslateTable[MKEY                             ] = KX_MKEY                    ;                  
+                       m_reverseKeyTranslateTable[NKEY                             ] = KX_NKEY                    ;                  
+                       m_reverseKeyTranslateTable[OKEY                             ] = KX_OKEY                    ;                  
+                       m_reverseKeyTranslateTable[PKEY                             ] = KX_PKEY                    ;                  
+                       m_reverseKeyTranslateTable[QKEY                             ] = KX_QKEY                    ;                  
+                       m_reverseKeyTranslateTable[RKEY                             ] = KX_RKEY                    ;                  
+                       m_reverseKeyTranslateTable[SKEY                             ] = KX_SKEY                    ;                  
+                       m_reverseKeyTranslateTable[TKEY                             ] = KX_TKEY                    ;                  
+                       m_reverseKeyTranslateTable[UKEY                             ] = KX_UKEY                    ;                  
+                       m_reverseKeyTranslateTable[VKEY                             ] = KX_VKEY                    ;                  
+                       m_reverseKeyTranslateTable[WKEY                             ] = KX_WKEY                    ;                  
+                       m_reverseKeyTranslateTable[XKEY                             ] = KX_XKEY                    ;                  
+                       m_reverseKeyTranslateTable[YKEY                             ] = KX_YKEY                    ;                  
+                       m_reverseKeyTranslateTable[ZKEY                             ] = KX_ZKEY                    ;                  
+                                                                                                                   
+                       m_reverseKeyTranslateTable[ZEROKEY                              ] = KX_ZEROKEY                  ;                  
+                       m_reverseKeyTranslateTable[ONEKEY                               ] = KX_ONEKEY                   ;                  
+                       m_reverseKeyTranslateTable[TWOKEY                               ] = KX_TWOKEY                   ;                  
+                       m_reverseKeyTranslateTable[THREEKEY                     ] = KX_THREEKEY                ;                  
+                       m_reverseKeyTranslateTable[FOURKEY                              ] = KX_FOURKEY                  ;                  
+                       m_reverseKeyTranslateTable[FIVEKEY                              ] = KX_FIVEKEY                  ;                  
+                       m_reverseKeyTranslateTable[SIXKEY                               ] = KX_SIXKEY                   ;                  
+                       m_reverseKeyTranslateTable[SEVENKEY                         ] = KX_SEVENKEY                ;                  
+                       m_reverseKeyTranslateTable[EIGHTKEY                         ] = KX_EIGHTKEY                ;                  
+                       m_reverseKeyTranslateTable[NINEKEY                              ] = KX_NINEKEY                  ;                  
+                                                                                                                  
+                       m_reverseKeyTranslateTable[CAPSLOCKKEY                      ] = KX_CAPSLOCKKEY             ;                  
+                                                               
+                       m_reverseKeyTranslateTable[LEFTCTRLKEY                  ] = KX_LEFTCTRLKEY              ;                  
+                       m_reverseKeyTranslateTable[LEFTALTKEY                   ] = KX_LEFTALTKEY               ;                  
+                       m_reverseKeyTranslateTable[RIGHTALTKEY                  ] = KX_RIGHTALTKEY              ;                  
+                       m_reverseKeyTranslateTable[RIGHTCTRLKEY                         ] = KX_RIGHTCTRLKEY             ;                  
+                       m_reverseKeyTranslateTable[RIGHTSHIFTKEY                        ] = KX_RIGHTSHIFTKEY            ;                  
+                       m_reverseKeyTranslateTable[LEFTSHIFTKEY                     ] = KX_LEFTSHIFTKEY            ;                  
+                                                                                                                  
+                       m_reverseKeyTranslateTable[ESCKEY                           ] = KX_ESCKEY                  ;                  
+                       m_reverseKeyTranslateTable[TABKEY                           ] = KX_TABKEY                  ;                  
+                       m_reverseKeyTranslateTable[RETKEY                           ] = KX_RETKEY                  ;                  
+                       m_reverseKeyTranslateTable[SPACEKEY                         ] = KX_SPACEKEY                ;                  
+                       m_reverseKeyTranslateTable[LINEFEEDKEY                  ] = KX_LINEFEEDKEY              ;                  
+                       m_reverseKeyTranslateTable[BACKSPACEKEY                     ] = KX_BACKSPACEKEY            ;                  
+                       m_reverseKeyTranslateTable[DELKEY                           ] = KX_DELKEY                  ;                  
+                       m_reverseKeyTranslateTable[SEMICOLONKEY                     ] = KX_SEMICOLONKEY            ;                  
+                       m_reverseKeyTranslateTable[PERIODKEY                    ] = KX_PERIODKEY                ;                  
+                       m_reverseKeyTranslateTable[COMMAKEY                             ] = KX_COMMAKEY         ;                  
+                       m_reverseKeyTranslateTable[QUOTEKEY                             ] = KX_QUOTEKEY         ;                  
+                       m_reverseKeyTranslateTable[ACCENTGRAVEKEY                       ] = KX_ACCENTGRAVEKEY           ;                  
+                       m_reverseKeyTranslateTable[MINUSKEY                             ] = KX_MINUSKEY         ;                  
+                       m_reverseKeyTranslateTable[SLASHKEY                             ] = KX_SLASHKEY         ;                  
+                       m_reverseKeyTranslateTable[BACKSLASHKEY                     ] = KX_BACKSLASHKEY            ;                  
+                       m_reverseKeyTranslateTable[EQUALKEY                             ] = KX_EQUALKEY         ;                  
+                       m_reverseKeyTranslateTable[LEFTBRACKETKEY                       ] = KX_LEFTBRACKETKEY           ;                  
+                       m_reverseKeyTranslateTable[RIGHTBRACKETKEY                      ] = KX_RIGHTBRACKETKEY          ;                  
+                                                                                                                  
+                       m_reverseKeyTranslateTable[LEFTARROWKEY                     ] = KX_LEFTARROWKEY            ;                  
+                       m_reverseKeyTranslateTable[DOWNARROWKEY                     ] = KX_DOWNARROWKEY            ;                  
+                       m_reverseKeyTranslateTable[RIGHTARROWKEY                        ] = KX_RIGHTARROWKEY            ;                  
+                       m_reverseKeyTranslateTable[UPARROWKEY                   ] = KX_UPARROWKEY               ;                  
+                                                                                                                   
+                       m_reverseKeyTranslateTable[PAD2                         ] = KX_PAD2                     ;                  
+                       m_reverseKeyTranslateTable[PAD4                         ] = KX_PAD4                     ;                  
+                       m_reverseKeyTranslateTable[PAD6                         ] = KX_PAD6                     ;                  
+                       m_reverseKeyTranslateTable[PAD8                         ] = KX_PAD8                     ;                  
+                                                                                                                  
+                       m_reverseKeyTranslateTable[PAD1                         ] = KX_PAD1                     ;                  
+                       m_reverseKeyTranslateTable[PAD3                         ] = KX_PAD3                     ;                  
+                       m_reverseKeyTranslateTable[PAD5                         ] = KX_PAD5                     ;                  
+                       m_reverseKeyTranslateTable[PAD7                         ] = KX_PAD7                     ;                  
+                       m_reverseKeyTranslateTable[PAD9                         ] = KX_PAD9                     ;                  
+
+                       m_reverseKeyTranslateTable[PADPERIOD                        ] = KX_PADPERIOD               ;                  
+                       m_reverseKeyTranslateTable[PADSLASHKEY                    ] = KX_PADSLASHKEY           ;                  
+                       m_reverseKeyTranslateTable[PADASTERKEY                      ] = KX_PADASTERKEY             ;                  
+                                                                                                                  
+                                                                                                                  
+                       m_reverseKeyTranslateTable[PAD0                         ] = KX_PAD0                     ;                  
+                       m_reverseKeyTranslateTable[PADMINUS                         ] = KX_PADMINUS                ;                  
+                       m_reverseKeyTranslateTable[PADENTER                         ] = KX_PADENTER                ;                  
+                       m_reverseKeyTranslateTable[PADPLUSKEY                       ] = KX_PADPLUSKEY              ;                  
+                                                                                                                  
+                                                                                                                  
+                       m_reverseKeyTranslateTable[F1KEY                            ] = KX_F1KEY                   ;                  
+                       m_reverseKeyTranslateTable[F2KEY                            ] = KX_F2KEY                   ;                  
+                       m_reverseKeyTranslateTable[F3KEY                            ] = KX_F3KEY                   ;                  
+                       m_reverseKeyTranslateTable[F4KEY                            ] = KX_F4KEY                   ;                  
+                       m_reverseKeyTranslateTable[F5KEY                            ] = KX_F5KEY                   ;                  
+                       m_reverseKeyTranslateTable[F6KEY                            ] = KX_F6KEY                   ;                  
+                       m_reverseKeyTranslateTable[F7KEY                            ] = KX_F7KEY                   ;                  
+                       m_reverseKeyTranslateTable[F8KEY                            ] = KX_F8KEY                   ;                  
+                       m_reverseKeyTranslateTable[F9KEY                            ] = KX_F9KEY                   ;                  
+                       m_reverseKeyTranslateTable[F10KEY                           ] = KX_F10KEY                  ;                  
+                       m_reverseKeyTranslateTable[F11KEY      ] = KX_F11KEY                  ;                  
+                       m_reverseKeyTranslateTable[F12KEY      ] = KX_F12KEY                  ;
+                       m_reverseKeyTranslateTable[F13KEY      ] = KX_F13KEY                  ;
+                       m_reverseKeyTranslateTable[F14KEY      ] = KX_F14KEY                  ;
+                       m_reverseKeyTranslateTable[F15KEY      ] = KX_F15KEY                  ;
+                       m_reverseKeyTranslateTable[F16KEY      ] = KX_F16KEY                  ;
+                       m_reverseKeyTranslateTable[F17KEY      ] = KX_F17KEY                  ;
+                       m_reverseKeyTranslateTable[F18KEY      ] = KX_F18KEY                  ;
+                       m_reverseKeyTranslateTable[F19KEY      ] = KX_F19KEY                  ;
+                                                                                                                  
+                       m_reverseKeyTranslateTable[PAUSEKEY    ] = KX_PAUSEKEY                ;                  
+                       m_reverseKeyTranslateTable[INSERTKEY   ] = KX_INSERTKEY               ;                  
+                       m_reverseKeyTranslateTable[HOMEKEY     ] = KX_HOMEKEY                 ;                  
+                       m_reverseKeyTranslateTable[PAGEUPKEY   ] = KX_PAGEUPKEY               ;                  
+                       m_reverseKeyTranslateTable[PAGEDOWNKEY ] = KX_PAGEDOWNKEY             ;                  
+                       m_reverseKeyTranslateTable[ENDKEY      ] = KX_ENDKEY                  ;                  
+
+                                                                                                                  
+               }                                                                                                          
+
+       virtual ~BL_BlenderInputDevice()
+               {
+
+               }
+                                                                                                                   
+        KX_EnumInputs ToNative(unsigned short incode) {
+               return m_reverseKeyTranslateTable[incode];
+       }
+
+       virtual bool    IsPressed(SCA_IInputDevice::KX_EnumInputs inputcode)=0;
+//     virtual const SCA_InputEvent&   GetEventValue(SCA_IInputDevice::KX_EnumInputs inputcode)=0;
+       virtual bool    ConvertBlenderEvent(unsigned short incode,short val)=0;
+
+       
+#ifdef WITH_CXX_GUARDEDALLOC
+public:
+       void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:BL_BlenderInputDevice"); }
+       void operator delete(void *mem) { MEM_freeN(mem); }
+#endif
+};                                                                                                                 
+#endif //__KX_BLENDERINPUTDEVICE
+
diff --git a/source/gameengine/BlenderRoutines/KX_BlenderKeyboardDevice.cpp b/source/gameengine/BlenderRoutines/KX_BlenderKeyboardDevice.cpp
new file mode 100644 (file)
index 0000000..e8cb25a
--- /dev/null
@@ -0,0 +1,165 @@
+/**
+ * $Id$
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifdef WIN32
+// annoying warnings about truncated STL debug info
+#pragma warning (disable :4786)
+#endif 
+
+#include "KX_BlenderKeyboardDevice.h"
+
+KX_BlenderKeyboardDevice::KX_BlenderKeyboardDevice()
+       : m_hookesc(false)
+{
+
+}
+KX_BlenderKeyboardDevice::~KX_BlenderKeyboardDevice()
+{
+
+}
+
+/**
+       IsPressed gives boolean information about keyboard status, true if pressed, false if not
+*/
+
+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 || 
+               inevent.m_status == SCA_InputEvent::KX_ACTIVE);
+       return pressed;
+}
+/*const SCA_InputEvent&        KX_BlenderKeyboardDevice::GetEventValue(SCA_IInputDevice::KX_EnumInputs inputcode)
+{
+       return m_eventStatusTables[m_currentTable][inputcode];
+}
+*/
+/** 
+       NextFrame toggles currentTable with previousTable,
+       and copy relevant event information from previous to current
+       (pressed keys need to be remembered)
+*/
+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++)
+       {
+               SCA_InputEvent& oldevent = m_eventStatusTables[previousTable][keyevent];
+               if (oldevent.m_status == SCA_InputEvent::KX_JUSTACTIVATED ||
+                       oldevent.m_status == SCA_InputEvent::KX_ACTIVE  )
+               {
+                       m_eventStatusTables[m_currentTable][keyevent] = oldevent;
+                       m_eventStatusTables[m_currentTable][keyevent].m_status = SCA_InputEvent::KX_ACTIVE;
+               }
+       }
+}
+
+/** 
+       ConvertBlenderEvent translates blender keyboard events into ketsji kbd events
+       extra event information is stored, like ramp-mode (just released/pressed)
+*/
+
+
+bool   KX_BlenderKeyboardDevice::ConvertBlenderEvent(unsigned short incode,short val)
+{
+       bool result = false;
+       
+       // convert event
+       KX_EnumInputs kxevent = this->ToNative(incode);
+
+       // only process it, if it's a key
+       if (kxevent >= KX_BEGINKEY && kxevent <= KX_ENDKEY)
+       {
+               int previousTable = 1-m_currentTable;
+
+               if (val == KM_PRESS)
+               {
+                       if (kxevent == KX_ESCKEY && val != 0 && !m_hookesc)
+                               result = true;
+                       if (kxevent == KX_PAUSEKEY && val && (IsPressed(KX_LEFTCTRLKEY) || IsPressed(KX_RIGHTCTRLKEY)))
+                               result = true;
+
+                       // todo: convert val ??
+                       m_eventStatusTables[m_currentTable][kxevent].m_eventval = val ; //???
+
+                       switch (m_eventStatusTables[previousTable][kxevent].m_status)
+                       {
+                       case SCA_InputEvent::KX_JUSTACTIVATED:
+                               {
+                                       m_eventStatusTables[m_currentTable][kxevent].m_status = SCA_InputEvent::KX_ACTIVE;
+                                       break;
+                               }
+                       case SCA_InputEvent::KX_ACTIVE:
+                       
+                               {
+                                       m_eventStatusTables[m_currentTable][kxevent].m_status = SCA_InputEvent::KX_ACTIVE;
+                                       break;
+                               }
+                       case SCA_InputEvent::KX_NO_INPUTSTATUS:
+                               {
+                                               m_eventStatusTables[m_currentTable][kxevent].m_status = SCA_InputEvent::KX_JUSTACTIVATED;
+                                               break;
+                               }
+                       default:
+                               {
+                                       m_eventStatusTables[m_currentTable][kxevent].m_status = SCA_InputEvent::KX_JUSTACTIVATED;
+                               }
+                       }
+                       
+               } else if (val == KM_RELEASE)
+               {
+                       // blender eventval == 0
+                       switch (m_eventStatusTables[previousTable][kxevent].m_status)
+                       {
+                       case SCA_InputEvent::KX_JUSTACTIVATED:
+                               {
+                                       m_eventStatusTables[m_currentTable][kxevent].m_status = SCA_InputEvent::KX_JUSTRELEASED;
+                                       break;
+                               }
+                       case SCA_InputEvent::KX_ACTIVE:
+                               {
+                                       m_eventStatusTables[m_currentTable][kxevent].m_status = SCA_InputEvent::KX_JUSTRELEASED;
+                                       break;
+                               }
+                       default:
+                               {
+                                       m_eventStatusTables[m_currentTable][kxevent].m_status = SCA_InputEvent::KX_NO_INPUTSTATUS;
+                               }
+                       }
+               }
+       }
+       return result;
+}
+
+void KX_BlenderKeyboardDevice::HookEscape()
+{
+       m_hookesc = true;
+}
diff --git a/source/gameengine/BlenderRoutines/KX_BlenderKeyboardDevice.h b/source/gameengine/BlenderRoutines/KX_BlenderKeyboardDevice.h
new file mode 100644 (file)
index 0000000..eab0528
--- /dev/null
@@ -0,0 +1,60 @@
+/**
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+#ifndef __KX_BLENDERKEYBOARDDEVICE
+#define __KX_BLENDERKEYBOARDDEVICE
+
+#include "KX_BlenderInputDevice.h"
+
+#ifdef WITH_CXX_GUARDEDALLOC
+#include "MEM_guardedalloc.h"
+#endif
+
+class KX_BlenderKeyboardDevice : public BL_BlenderInputDevice
+{
+       bool    m_hookesc;
+public:
+       KX_BlenderKeyboardDevice();
+       virtual ~KX_BlenderKeyboardDevice();
+
+       virtual bool    IsPressed(SCA_IInputDevice::KX_EnumInputs inputcode);
+//     virtual const SCA_InputEvent&   GetEventValue(SCA_IInputDevice::KX_EnumInputs inputcode);
+       virtual bool    ConvertBlenderEvent(unsigned short incode,short val);
+       virtual void    NextFrame();
+       virtual void    HookEscape();
+
+
+#ifdef WITH_CXX_GUARDEDALLOC
+public:
+       void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_BlenderKeyboardDevice"); }
+       void operator delete(void *mem) { MEM_freeN(mem); }
+#endif
+};
+
+#endif //__KX_BLENDERKEYBOARDDEVICE
+
diff --git a/source/gameengine/BlenderRoutines/KX_BlenderMouseDevice.cpp b/source/gameengine/BlenderRoutines/KX_BlenderMouseDevice.cpp
new file mode 100644 (file)
index 0000000..c3e3935
--- /dev/null
@@ -0,0 +1,191 @@
+/**
+ * $Id$
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifdef WIN32
+// annoying warnings about truncated STL debug info
+#pragma warning (disable :4786)
+#endif 
+
+#include "KX_BlenderMouseDevice.h"
+
+KX_BlenderMouseDevice::KX_BlenderMouseDevice()
+{
+
+}
+KX_BlenderMouseDevice::~KX_BlenderMouseDevice()
+{
+
+}
+
+/**
+       IsPressed gives boolean information about mouse status, true if pressed, false if not
+*/
+
+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 || 
+               inevent.m_status == SCA_InputEvent::KX_ACTIVE);
+       return pressed;
+}
+/*const SCA_InputEvent&        KX_BlenderMouseDevice::GetEventValue(SCA_IInputDevice::KX_EnumInputs inputcode)
+{
+       return m_eventStatusTables[m_currentTable][inputcode];
+}
+*/
+
+/** 
+       NextFrame toggles currentTable with previousTable,
+       and copy relevant event information from previous to current
+       (pressed keys need to be remembered)
+*/
+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++)
+       {
+               SCA_InputEvent& oldevent = m_eventStatusTables[previousTable][mouseevent];
+               if (oldevent.m_status == SCA_InputEvent::KX_JUSTACTIVATED ||
+                       oldevent.m_status == SCA_InputEvent::KX_ACTIVE  )
+               {
+                       m_eventStatusTables[m_currentTable][mouseevent] = oldevent;
+                       m_eventStatusTables[m_currentTable][mouseevent].m_status = SCA_InputEvent::KX_ACTIVE;
+               }
+       }
+       for (int mousemove= KX_ENDMOUSEBUTTONS; mousemove< KX_ENDMOUSE;mousemove++)
+       {
+               SCA_InputEvent& oldevent = m_eventStatusTables[previousTable][mousemove];
+               m_eventStatusTables[m_currentTable][mousemove] = oldevent;
+               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 ;
+                       }
+               }
+       }
+}
+
+
+/** 
+       ConvertBlenderEvent translates blender mouse events into ketsji kbd events
+       extra event information is stored, like ramp-mode (just released/pressed)
+*/
+
+
+bool   KX_BlenderMouseDevice::ConvertBlenderEvent(unsigned short incode,short val)
+{
+       bool result = false;
+       
+       // convert event
+       KX_EnumInputs kxevent = this->ToNative(incode);
+       int previousTable = 1-m_currentTable;
+
+       // only process it, if it's a key
+       if (kxevent > KX_BEGINMOUSE && kxevent < KX_ENDMOUSEBUTTONS)
+       {
+               if (val == KM_PRESS)
+               {
+                       m_eventStatusTables[m_currentTable][kxevent].m_eventval = val ; //???
+
+                       switch (m_eventStatusTables[previousTable][kxevent].m_status)
+                       {
+                       
+                       case SCA_InputEvent::KX_ACTIVE:
+                       case SCA_InputEvent::KX_JUSTACTIVATED:
+                               {
+                                       m_eventStatusTables[m_currentTable][kxevent].m_status = SCA_InputEvent::KX_ACTIVE;
+                                       break;
+                               }
+                       case SCA_InputEvent::KX_JUSTRELEASED:
+                               {
+                                       m_eventStatusTables[m_currentTable][kxevent].m_status = SCA_InputEvent::KX_JUSTACTIVATED;
+                                       break;
+                               }
+                       default:
+                               {
+                                       m_eventStatusTables[m_currentTable][kxevent].m_status = SCA_InputEvent::KX_JUSTACTIVATED;
+                               }
+                       }
+                       
+               } else if (val == KM_RELEASE)
+               {
+                       // blender eventval == 0
+                       switch (m_eventStatusTables[previousTable][kxevent].m_status)
+                       {
+                       case SCA_InputEvent::KX_JUSTACTIVATED:
+                       case SCA_InputEvent::KX_ACTIVE:
+                               {
+                                       m_eventStatusTables[m_currentTable][kxevent].m_status = SCA_InputEvent::KX_JUSTRELEASED;
+                                       break;
+                               }
+                       default:
+                               {
+                                       m_eventStatusTables[m_currentTable][kxevent].m_status = SCA_InputEvent::KX_NO_INPUTSTATUS;
+                               }
+                       }
+               }
+       }
+
+       if (kxevent > KX_ENDMOUSEBUTTONS && kxevent < KX_ENDMOUSE)
+       {
+               m_eventStatusTables[m_currentTable][kxevent].m_eventval = val ; //remember mouse position
+
+               switch (m_eventStatusTables[previousTable][kxevent].m_status)
+               {
+                       
+               case SCA_InputEvent::KX_ACTIVE:
+               case SCA_InputEvent::KX_JUSTACTIVATED:
+                       {
+                               m_eventStatusTables[m_currentTable][kxevent].m_status = SCA_InputEvent::KX_ACTIVE;
+                               break;
+                       }
+               case SCA_InputEvent::KX_JUSTRELEASED:
+                       {
+                               m_eventStatusTables[m_currentTable][kxevent].m_status = SCA_InputEvent::KX_ACTIVE;
+                               break;
+                       }
+               default:
+                       {
+                               m_eventStatusTables[m_currentTable][kxevent].m_status = SCA_InputEvent::KX_JUSTACTIVATED;
+                       }
+               }
+       }
+
+
+       return result;
+}
diff --git a/source/gameengine/BlenderRoutines/KX_BlenderMouseDevice.h b/source/gameengine/BlenderRoutines/KX_BlenderMouseDevice.h
new file mode 100644 (file)
index 0000000..ce067ff
--- /dev/null
@@ -0,0 +1,58 @@
+/**
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+#ifndef __KX_BLENDERMOUSEDEVICE
+#define __KX_BLENDERMOUSEDEVICE
+
+#include "KX_BlenderInputDevice.h"
+
+#ifdef WITH_CXX_GUARDEDALLOC
+#include "MEM_guardedalloc.h"
+#endif
+
+class KX_BlenderMouseDevice : public BL_BlenderInputDevice
+{
+public:
+       KX_BlenderMouseDevice();
+       virtual ~KX_BlenderMouseDevice();
+
+       virtual bool    IsPressed(SCA_IInputDevice::KX_EnumInputs inputcode);
+//     virtual const SCA_InputEvent&   GetEventValue(SCA_IInputDevice::KX_EnumInputs inputcode);
+       virtual bool    ConvertBlenderEvent(unsigned short incode,short val);
+       virtual void    NextFrame();
+
+
+#ifdef WITH_CXX_GUARDEDALLOC
+public:
+       void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_BlenderMouseDevice"); }
+       void operator delete(void *mem) { MEM_freeN(mem); }
+#endif
+};
+
+#endif //__KX_BLENDERMOUSEDEVICE
+
diff --git a/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.cpp b/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.cpp
new file mode 100644 (file)
index 0000000..3d73655
--- /dev/null
@@ -0,0 +1,381 @@
+/**
+ * $Id$
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include "GL/glew.h"
+
+#include "RAS_IRenderTools.h"
+#include "RAS_IRasterizer.h"
+#include "RAS_LightObject.h"
+#include "RAS_ICanvas.h"
+#include "RAS_GLExtensionManager.h"
+
+#include "KX_GameObject.h"
+#include "KX_PolygonMaterial.h"
+#include "KX_BlenderMaterial.h"
+#include "KX_RayCast.h"
+#include "KX_IPhysicsController.h"
+#include "KX_Light.h"
+
+#include "PHY_IPhysicsEnvironment.h"
+
+#include "STR_String.h"
+
+#include "GPU_draw.h"
+
+#include "KX_BlenderGL.h" // for text printing
+#include "KX_BlenderRenderTools.h"
+
+unsigned int KX_BlenderRenderTools::m_numgllights;
+
+KX_BlenderRenderTools::KX_BlenderRenderTools()
+{
+       glGetIntegerv(GL_MAX_LIGHTS, (GLint*) &m_numgllights);
+       if (m_numgllights < 8)
+               m_numgllights = 8;
+}
+
+KX_BlenderRenderTools::~KX_BlenderRenderTools()
+{
+}
+
+void KX_BlenderRenderTools::BeginFrame(RAS_IRasterizer* rasty)
+{
+       m_clientobject = NULL;
+       m_lastlightlayer = -1;
+       m_lastauxinfo = NULL;
+       m_lastlighting = true; /* force disable in DisableOpenGLLights() */
+       DisableOpenGLLights();
+}
+
+void KX_BlenderRenderTools::EndFrame(RAS_IRasterizer* rasty)
+{
+}
+
+/* ProcessLighting performs lighting on objects. the layer is a bitfield that
+ * contains layer information. There are 20 'official' layers in blender. A
+ * light is applied on an object only when they are in the same layer. OpenGL
+ * has a maximum of 8 lights (simultaneous), so 20 * 8 lights are possible in
+ * a scene. */
+
+void KX_BlenderRenderTools::ProcessLighting(RAS_IRasterizer *rasty, bool uselights, const MT_Transform& viewmat)
+{
+       bool enable = false;
+       int layer= -1;
+
+       /* find the layer */
+       if(uselights) {
+               if(m_clientobject)
+                       layer = static_cast<KX_GameObject*>(m_clientobject)->GetLayer();
+       }
+
+       /* avoid state switching */
+       if(m_lastlightlayer == layer && m_lastauxinfo == m_auxilaryClientInfo)
+               return;
+
+       m_lastlightlayer = layer;
+       m_lastauxinfo = m_auxilaryClientInfo;
+
+       /* enable/disable lights as needed */
+       if(layer >= 0)
+               enable = applyLights(layer, viewmat);
+
+       if(enable)
+               EnableOpenGLLights(rasty);
+       else
+               DisableOpenGLLights();
+}
+
+void KX_BlenderRenderTools::EnableOpenGLLights(RAS_IRasterizer *rasty)
+{
+       if(m_lastlighting == true)
+               return;
+
+       glEnable(GL_LIGHTING);
+       glEnable(GL_COLOR_MATERIAL);
+
+       glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE);
+       glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE);
+       glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, (rasty->GetCameraOrtho())? GL_FALSE: GL_TRUE);
+       if (GLEW_EXT_separate_specular_color || GLEW_VERSION_1_2)
+               glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL, GL_SEPARATE_SPECULAR_COLOR);
+       
+       m_lastlighting = true;
+}
+
+void KX_BlenderRenderTools::DisableOpenGLLights()
+{
+       if(m_lastlighting == false)
+               return;
+
+       glDisable(GL_LIGHTING);
+       glDisable(GL_COLOR_MATERIAL);
+
+       m_lastlighting = false;
+}
+
+
+void KX_BlenderRenderTools::SetClientObject(RAS_IRasterizer *rasty, void* obj)
+{
+       if (m_clientobject != obj)
+       {
+               bool ccw = (obj == NULL || !((KX_GameObject*)obj)->IsNegativeScaling());
+               rasty->SetFrontFace(ccw);
+
+               m_clientobject = obj;
+       }
+}
+
+bool KX_BlenderRenderTools::RayHit(KX_ClientObjectInfo* client, KX_RayCast* result, void * const data)
+{
+       double* const oglmatrix = (double* const) data;
+       MT_Point3 resultpoint(result->m_hitPoint);
+       MT_Vector3 resultnormal(result->m_hitNormal);
+       MT_Vector3 left(oglmatrix[0],oglmatrix[1],oglmatrix[2]);
+       MT_Vector3 dir = -(left.cross(resultnormal)).safe_normalized();
+       left = (dir.cross(resultnormal)).safe_normalized();
+       // for the up vector, we take the 'resultnormal' returned by the physics
+       
+       double maat[16]={
+                       left[0],        left[1],        left[2], 0,
+                               dir[0],         dir[1],         dir[2], 0,
+               resultnormal[0],resultnormal[1],resultnormal[2], 0,
+                               0,              0,              0, 1};
+       glTranslated(resultpoint[0],resultpoint[1],resultpoint[2]);
+       //glMultMatrixd(oglmatrix);
+       glMultMatrixd(maat);
+       return true;
+}
+
+void KX_BlenderRenderTools::applyTransform(RAS_IRasterizer* rasty,double* oglmatrix,int objectdrawmode )
+{
+       /* FIXME:
+       blender: intern/moto/include/MT_Vector3.inl:42: MT_Vector3 operator/(const
+       MT_Vector3&, double): Assertion `!MT_fuzzyZero(s)' failed. 
+       
+       Program received signal SIGABRT, Aborted. 
+       [Switching to Thread 16384 (LWP 1519)] 
+       0x40477571 in kill () from /lib/libc.so.6 
+       (gdb) bt 
+       #7  0x08334368 in MT_Vector3::normalized() const () 
+       #8  0x0833e6ec in KX_BlenderRenderTools::applyTransform(RAS_IRasterizer*, double*, int) () 
+       */
+
+       if (objectdrawmode & RAS_IPolyMaterial::BILLBOARD_SCREENALIGNED ||
+               objectdrawmode & RAS_IPolyMaterial::BILLBOARD_AXISALIGNED)
+       {
+               // rotate the billboard/halo
+               //page 360/361 3D Game Engine Design, David Eberly for a discussion
+               // on screen aligned and axis aligned billboards
+               // assumed is that the preprocessor transformed all billboard polygons
+               // so that their normal points into the positive x direction (1.0 , 0.0 , 0.0)
+               // when new parenting for objects is done, this rotation
+               // will be moved into the object
+               
+               MT_Point3 objpos (oglmatrix[12],oglmatrix[13],oglmatrix[14]);
+               MT_Point3 campos = rasty->GetCameraPosition();
+               MT_Vector3 dir = (campos - objpos).safe_normalized();
+               MT_Vector3 up(0,0,1.0);
+
+               KX_GameObject* gameobj = (KX_GameObject*)m_clientobject;
+               // get scaling of halo object
+               MT_Vector3  size = gameobj->GetSGNode()->GetLocalScale();
+               
+               bool screenaligned = (objectdrawmode & RAS_IPolyMaterial::BILLBOARD_SCREENALIGNED)!=0;//false; //either screen or axisaligned
+               if (screenaligned)
+               {
+                       up = (up - up.dot(dir) * dir).safe_normalized();
+               } else
+               {
+                       dir = (dir - up.dot(dir)*up).safe_normalized();
+               }
+
+               MT_Vector3 left = dir.normalized();
+               dir = (left.cross(up)).normalized();
+
+               // we have calculated the row vectors, now we keep
+               // local scaling into account:
+
+               left *= size[0];
+               dir  *= size[1];
+               up   *= size[2];
+               double maat[16]={
+                       left[0], left[1],left[2], 0,
+                               dir[0], dir[1],dir[2],0,
+                               up[0],up[1],up[2],0,
+                               0,0,0,1};
+                       glTranslated(objpos[0],objpos[1],objpos[2]);
+                       glMultMatrixd(maat);
+                       
+       } else
+       {
+               if (objectdrawmode & RAS_IPolyMaterial::SHADOW)
+               {
+                       // shadow must be cast to the ground, physics system needed here!
+                       MT_Point3 frompoint(oglmatrix[12],oglmatrix[13],oglmatrix[14]);
+                       KX_GameObject *gameobj = (KX_GameObject*)m_clientobject;
+                       MT_Vector3 direction = MT_Vector3(0,0,-1);
+
+                       direction.normalize();
+                       direction *= 100000;
+
+                       MT_Point3 topoint = frompoint + direction;
+
+                       KX_Scene* kxscene = (KX_Scene*) m_auxilaryClientInfo;
+                       PHY_IPhysicsEnvironment* physics_environment = kxscene->GetPhysicsEnvironment();
+                       KX_IPhysicsController* physics_controller = gameobj->GetPhysicsController();
+                       
+                       KX_GameObject *parent = gameobj->GetParent();
+                       if (!physics_controller && parent)
+                               physics_controller = parent->GetPhysicsController();
+                       if (parent)
+                               parent->Release();
+                               
+                       KX_RayCast::Callback<KX_BlenderRenderTools> callback(this, physics_controller, oglmatrix);
+                       if (!KX_RayCast::RayTest(physics_environment, frompoint, topoint, callback))
+                       {
+                               // couldn't find something to cast the shadow on...
+                               glMultMatrixd(oglmatrix);
+                       }
+                       else
+                       { // we found the "ground", but the cast matrix doesn't take
+                         // scaling in consideration, so we must apply the object scale
+                               MT_Vector3  size = gameobj->GetSGNode()->GetLocalScale();
+                               glScalef(size[0], size[1], size[2]);
+                       }
+               } else
+               {
+
+                       // 'normal' object
+                       glMultMatrixd(oglmatrix);
+               }
+       }
+}
+
+
+void KX_BlenderRenderTools::RenderText2D(RAS_TEXT_RENDER_MODE mode,
+                                                                                const char* text,
+                                                                                int xco,
+                                                                                int yco,                                                                        
+                                                                                int width,
+                                                                                int height)
+{
+       if(mode == RAS_IRenderTools::RAS_TEXT_PADDED)
+               BL_print_gamedebug_line_padded(text, xco, yco, width, height);
+       else
+               BL_print_gamedebug_line(text, xco, yco, width, height);
+}
+
+/* Render Text renders text into a (series of) polygon, using a texture font,
+ * Each character consists of one polygon (one quad or two triangles) */
+
+void KX_BlenderRenderTools::RenderText(
+       int mode,
+       RAS_IPolyMaterial* polymat,
+       float v1[3], float v2[3], float v3[3], float v4[3], int glattrib)
+{
+       const STR_String& mytext = ((CValue*)m_clientobject)->GetPropertyText("Text");
+       
+       const unsigned int flag = polymat->GetFlag();
+       struct MTFace* tface = 0;
+       unsigned int *col = 0;
+
+       if(flag & RAS_BLENDERMAT) {
+               KX_BlenderMaterial *bl_mat = static_cast<KX_BlenderMaterial*>(polymat);
+               tface = bl_mat->GetMTFace();
+               col = bl_mat->GetMCol();
+       } else {
+               KX_PolygonMaterial* blenderpoly = static_cast<KX_PolygonMaterial*>(polymat);
+               tface = blenderpoly->GetMTFace();
+               col = blenderpoly->GetMCol();
+       }
+       
+       GPU_render_text(tface, mode, mytext, mytext.Length(), col, v1, v2, v3, v4, glattrib);
+}
+
+
+void KX_BlenderRenderTools::PushMatrix()
+{
+       glPushMatrix();
+}
+
+void KX_BlenderRenderTools::PopMatrix()
+{
+       glPopMatrix();
+}
+
+
+int KX_BlenderRenderTools::applyLights(int objectlayer, const MT_Transform& viewmat)
+{
+       // taken from blender source, incompatibility between Blender Object / GameObject       
+       KX_Scene* kxscene = (KX_Scene*)m_auxilaryClientInfo;
+       float glviewmat[16];
+       unsigned int count;
+       std::vector<struct      RAS_LightObject*>::iterator lit = m_lights.begin();
+
+       for(count=0; count<m_numgllights; count++)
+               glDisable((GLenum)(GL_LIGHT0+count));
+
+       viewmat.getValue(glviewmat);
+       
+       glPushMatrix();
+       glLoadMatrixf(glviewmat);
+       for (lit = m_lights.begin(), count = 0; !(lit==m_lights.end()) && count < m_numgllights; ++lit)
+       {
+               RAS_LightObject* lightdata = (*lit);
+               KX_LightObject *kxlight = (KX_LightObject*)lightdata->m_light;
+
+               if(kxlight->ApplyLight(kxscene, objectlayer, count))
+                       count++;
+       }
+       glPopMatrix();
+
+       return count;
+}
+
+void KX_BlenderRenderTools::MotionBlur(RAS_IRasterizer* rasterizer)
+{
+       int state = rasterizer->GetMotionBlurState();
+       float motionblurvalue;
+       if(state)
+       {
+               motionblurvalue = rasterizer->GetMotionBlurValue();
+               if(state==1)
+               {
+                       //bugfix:load color buffer into accum buffer for the first time(state=1)
+                       glAccum(GL_LOAD, 1.0);
+                       rasterizer->SetMotionBlurState(2);
+               }
+               else if(motionblurvalue>=0.0 && motionblurvalue<=1.0)
+               {
+                       glAccum(GL_MULT, motionblurvalue);
+                       glAccum(GL_ACCUM, 1-motionblurvalue);
+                       glAccum(GL_RETURN, 1.0);
+                       glFlush();
+               }
+       }
+}
diff --git a/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.h b/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.h
new file mode 100644 (file)
index 0000000..9a7d9c7
--- /dev/null
@@ -0,0 +1,110 @@
+/**
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef __KX_BLENDERRENDERTOOLS
+#define __KX_BLENDERRENDERTOOLS
+
+#ifdef WIN32
+// don't show stl-warnings
+#pragma warning (disable:4786)
+#endif
+
+#include "RAS_IRenderTools.h"
+
+#ifdef WITH_CXX_GUARDEDALLOC
+#include "MEM_guardedalloc.h"
+#endif
+
+struct KX_ClientObjectInfo;
+class KX_RayCast;
+
+/* BlenderRenderTools are a set of tools to apply 2D/3D graphics effects, which
+ * are not part of the (polygon) Rasterizer. Effects like 2D text, 3D (polygon)
+ * text, lighting.
+ *
+ * Most of this code is duplicated in GPC_RenderTools, so this should be
+ * moved to some common location to avoid duplication. */
+
+class KX_BlenderRenderTools  : public RAS_IRenderTools
+{
+       int             m_lastlightlayer;
+       bool    m_lastlighting;
+       void    *m_lastauxinfo;
+       static unsigned int m_numgllights;
+
+public:
+                                               KX_BlenderRenderTools();
+       virtual                         ~KX_BlenderRenderTools();       
+
+       void                            EndFrame(RAS_IRasterizer* rasty);
+       void                            BeginFrame(RAS_IRasterizer* rasty);
+
+       void                            EnableOpenGLLights(RAS_IRasterizer *rasty);
+       void                            DisableOpenGLLights();
+       void                            ProcessLighting(RAS_IRasterizer *rasty, bool uselights, const MT_Transform& viewmat);
+
+       void                        RenderText2D(RAS_TEXT_RENDER_MODE mode,
+                                                                        const char* text,
+                                                                        int xco,
+                                                                        int yco,
+                                                                        int width,
+                                                                        int height);
+       void                            RenderText(int mode,
+                                                                  class RAS_IPolyMaterial* polymat,
+                                                                  float v1[3],
+                                                                  float v2[3],
+                                                                  float v3[3],
+                                                                  float v4[3],
+                                                                  int glattrib);
+
+       void                            applyTransform(RAS_IRasterizer* rasty, double* oglmatrix, int objectdrawmode);
+       int                                     applyLights(int objectlayer, const MT_Transform& viewmat);
+
+       void                            PushMatrix();
+       void                            PopMatrix();
+
+       bool RayHit(KX_ClientObjectInfo* client, class KX_RayCast* result, void * const data);
+       bool NeedRayCast(KX_ClientObjectInfo*) { return true; }
+
+       virtual void MotionBlur(RAS_IRasterizer* rasterizer);
+
+       virtual void SetClientObject(RAS_IRasterizer *rasty, void* obj);
+       
+       
+#ifdef WITH_CXX_GUARDEDALLOC
+public:
+       void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_BlenderRenderTools"); }
+       void operator delete( void *mem ) { MEM_freeN(mem); }
+#endif
+};
+
+#endif //__KX_BLENDERRENDERTOOLS
+
+
+
diff --git a/source/gameengine/BlenderRoutines/KX_BlenderSystem.cpp b/source/gameengine/BlenderRoutines/KX_BlenderSystem.cpp
new file mode 100644 (file)
index 0000000..813869d
--- /dev/null
@@ -0,0 +1,52 @@
+/**
+ * $Id$
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include "KX_ISystem.h"
+
+#ifdef WIN32
+#pragma warning (disable :4786)
+#include <windows.h>
+#endif //WIN32
+
+#include <iostream>
+#include <stdio.h>
+#include "KX_BlenderInputDevice.h"
+#include "KX_BlenderSystem.h"
+
+#include "PIL_time.h"
+
+KX_BlenderSystem::KX_BlenderSystem()
+: KX_ISystem()
+{
+       m_starttime = PIL_check_seconds_timer();
+}
+
+double KX_BlenderSystem::GetTimeInSeconds()
+{
+       return PIL_check_seconds_timer() - m_starttime;
+}
diff --git a/source/gameengine/BlenderRoutines/KX_BlenderSystem.h b/source/gameengine/BlenderRoutines/KX_BlenderSystem.h
new file mode 100644 (file)
index 0000000..fb40ded
--- /dev/null
@@ -0,0 +1,60 @@
+/**
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+#ifndef __KX_BLENDERSYSTEM
+#define __KX_BLENDERSYSTEM
+
+/**
+ * Blender System embedding. Needed when gameengine runs embedded within Blender.
+ */
+#include "KX_ISystem.h"
+
+#ifdef WITH_CXX_GUARDEDALLOC
+#include "MEM_guardedalloc.h"
+#endif
+
+class KX_BlenderSystem : public KX_ISystem
+{
+       double  m_starttime;
+
+public:
+       KX_BlenderSystem();
+       virtual ~KX_BlenderSystem() {};
+       virtual double GetTimeInSeconds();
+
+
+
+#ifdef WITH_CXX_GUARDEDALLOC
+public:
+       void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_BlenderSystem"); }
+       void operator delete( void *mem ) { MEM_freeN(mem); }
+#endif
+};
+
+#endif //__KX_BLENDERSYSTEM
+
diff --git a/source/gameengine/BlenderRoutines/Makefile b/source/gameengine/BlenderRoutines/Makefile
new file mode 100644 (file)
index 0000000..3d0f534
--- /dev/null
@@ -0,0 +1,78 @@
+#
+# $Id$
+#
+# ***** BEGIN GPL LICENSE BLOCK *****
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+# All rights reserved.
+#
+# The Original Code is: all of this file.
+#
+# Contributor(s): none yet.
+#
+# ***** END GPL LICENSE BLOCK *****
+#
+#
+
+LIBNAME = bloutines
+DIR = $(OCGDIR)/gameengine/$(LIBNAME)
+
+include nan_compile.mk
+
+CCFLAGS += $(LEVEL_1_CPP_WARNINGS)
+
+CPPFLAGS += -I$(NAN_GLEW)/include
+CPPFLAGS += -I$(NAN_STRING)/include    
+CPPFLAGS += -I$(NAN_MOTO)/include
+CPPFLAGS += -I$(NAN_GLEW)/include
+CPPFLAGS += -I$(OPENGL_HEADERS)
+CPPFLAGS += -I$(NAN_AUDASPACE)/include
+# because of kernel dependency on makesdna
+CPPFLAGS += -I../../blender/makesdna
+CPPFLAGS += -I../../blender/editors/include
+# because of kernel dependency on imbuf
+CPPFLAGS += -I../../blender/windowmanager
+CPPFLAGS += -I../../blender/imbuf
+CPPFLAGS += -I../../blender/blenlib
+CPPFLAGS += -I../../blender/blenkernel
+CPPFLAGS += -I../../blender/render/extern/include
+CPPFLAGS += -I../../blender/blenloader
+CPPFLAGS += -I../../blender/blenfont
+CPPFLAGS += -I../../blender/gpu
+CPPFLAGS += -I../../blender/makesrna
+CPPFLAGS += -I../Converter
+CPPFLAGS += -I../Expressions
+CPPFLAGS += -I../GameLogic
+CPPFLAGS += -I../Ketsji
+CPPFLAGS += -I../Rasterizer
+CPPFLAGS += -I../Rasterizer/RAS_OpenGLRasterizer
+CPPFLAGS += -I../SceneGraph
+CPPFLAGS += -I../../kernel/gen_system
+CPPFLAGS += -I../Network
+CPPFLAGS += -I../Network/LoopBackNetwork
+CPPFLAGS += -I../Physics/common
+CPPFLAGS += -I.
+
+ifeq ($(OS),windows)
+    CPPFLAGS += -I../../blender
+endif
+
+CPPFLAGS += -I$(NAN_PYTHON)/include/python$(NAN_PYTHON_VERSION)
+
+ifeq ($(WITH_FFMPEG), true)
+   CPPFLAGS += -DWITH_FFMPEG
+endif
diff --git a/source/gameengine/BlenderRoutines/SConscript b/source/gameengine/BlenderRoutines/SConscript
new file mode 100644 (file)
index 0000000..f53fc50
--- /dev/null
@@ -0,0 +1,36 @@
+#!/usr/bin/python
+Import ('env')
+
+sources = env.Glob('*.cpp')
+defs = [ 'GLEW_STATIC' ]
+
+incs = '. #source/kernel/gen_system #intern/string #intern/guardedalloc'
+incs += ' #source/gameengine/Rasterizer/RAS_OpenGLRasterizer'
+incs += ' #source/gameengine/Converter #source/blender/imbuf'
+incs += ' #intern/ghost/include'
+incs += ' #intern/audaspace/intern'
+incs += ' #intern/moto/include #source/gameengine/Ketsji #source/blender/blenlib'
+incs += ' #source/blender/blenkernel #source/blender'
+incs += ' #source/blender/blenfont #source/blender/editors/include'
+incs += ' #source/blender/makesdna #source/blender/makesrna'
+incs += ' #source/gameengine/Rasterizer #source/gameengine/GameLogic'
+incs += ' #source/gameengine/Expressions #source/gameengine/Network'
+incs += ' #source/gameengine/SceneGraph #source/gameengine/Physics/common'
+incs += ' #source/gameengine/Physics/Bullet'
+incs += ' #source/gameengine/Network/LoopBackNetwork'
+incs += ' #source/blender/misc #source/blender/blenloader'
+incs += ' #extern/glew/include #source/blender/gpu'
+incs += ' #source/blender/windowmanager'
+
+if env['WITH_BF_FFMPEG']:
+    defs.append('WITH_FFMPEG')
+
+if env['WITH_BF_PYTHON']:
+    incs += ' ' + env['BF_PYTHON_INC']
+else:
+    defs.append('DISABLE_PYTHON')
+
+incs += ' ' + env['BF_BULLET_INC']
+incs += ' ' + env['BF_OPENGL_INC']
+
+env.BlenderLib ( 'bf_bloutines', sources, Split(incs), defs, libtype=['core','player'], priority=[300,35] , cxx_compileflags=env['BGE_CXXFLAGS'])
diff --git a/source/gameengine/CMakeLists.txt b/source/gameengine/CMakeLists.txt
new file mode 100644 (file)
index 0000000..7b58a2a
--- /dev/null
@@ -0,0 +1,48 @@
+# $Id$
+# ***** BEGIN GPL LICENSE BLOCK *****
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# The Original Code is Copyright (C) 2006, Blender Foundation
+# All rights reserved.
+#
+# The Original Code is: all of this file.
+#
+# Contributor(s): Jacques Beaurain.
+#
+# ***** END GPL LICENSE BLOCK *****
+
+ADD_SUBDIRECTORY(BlenderRoutines)
+ADD_SUBDIRECTORY(Converter)
+ADD_SUBDIRECTORY(Expressions)
+ADD_SUBDIRECTORY(GameLogic)
+ADD_SUBDIRECTORY(Ketsji)
+ADD_SUBDIRECTORY(Ketsji/KXNetwork)
+ADD_SUBDIRECTORY(Network)
+ADD_SUBDIRECTORY(Network/LoopBackNetwork)
+ADD_SUBDIRECTORY(Physics/common)
+ADD_SUBDIRECTORY(Physics/Dummy)
+ADD_SUBDIRECTORY(Rasterizer)
+ADD_SUBDIRECTORY(Rasterizer/RAS_OpenGLRasterizer)
+ADD_SUBDIRECTORY(SceneGraph)
+ADD_SUBDIRECTORY(Physics/Bullet)
+
+IF(WITH_PYTHON)
+       ADD_SUBDIRECTORY(VideoTexture)
+ENDIF(WITH_PYTHON)
+
+IF(WITH_PLAYER)
+       ADD_SUBDIRECTORY(GamePlayer)
+ENDIF(WITH_PLAYER)
diff --git a/source/gameengine/Converter/BL_ActionActuator.cpp b/source/gameengine/Converter/BL_ActionActuator.cpp
new file mode 100644 (file)
index 0000000..b8d4c4e
--- /dev/null
@@ -0,0 +1,677 @@
+/**
+* $Id$
+*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+*/
+
+#if defined (__sgi)
+#include <math.h>
+#else
+#include <cmath>
+#endif
+
+#include "SCA_LogicManager.h"
+#include "BL_ActionActuator.h"
+#include "BL_ArmatureObject.h"
+#include "BL_SkinDeformer.h"
+#include "KX_GameObject.h"
+#include "STR_HashedString.h"
+#include "DNA_nla_types.h"
+#include "BKE_action.h"
+#include "DNA_action_types.h"
+#include "DNA_armature_types.h"
+#include "DNA_scene_types.h"
+#include "MEM_guardedalloc.h"
+#include "BLI_blenlib.h"
+#include "BLI_math.h"
+#include "MT_Matrix4x4.h"
+#include "BKE_utildefines.h"
+#include "FloatValue.h"
+#include "PyObjectPlus.h"
+#include "KX_PyMath.h"
+
+extern "C" {
+#include "BKE_animsys.h"
+#include "BKE_action.h"
+#include "RNA_access.h"
+#include "RNA_define.h"
+}
+
+BL_ActionActuator::~BL_ActionActuator()
+{
+       if (m_pose)
+               game_free_pose(m_pose);
+       if (m_userpose)
+               game_free_pose(m_userpose);
+       if (m_blendpose)
+               game_free_pose(m_blendpose);
+}
+
+void BL_ActionActuator::ProcessReplica()
+{
+       SCA_IActuator::ProcessReplica();
+       
+       m_pose = NULL;
+       m_blendpose = NULL;
+       m_localtime=m_startframe;
+       m_lastUpdate=-1;
+       
+}
+
+void BL_ActionActuator::SetBlendTime (float newtime){
+       m_blendframe = newtime;
+}
+
+CValue* BL_ActionActuator::GetReplica() {
+       BL_ActionActuator* replica = new BL_ActionActuator(*this);//m_float,GetName());
+       replica->ProcessReplica();
+       return replica;
+}
+
+bool BL_ActionActuator::ClampLocalTime()
+{
+       if (m_startframe < m_endframe)
+       {
+               if (m_localtime < m_startframe)
+               {
+                       m_localtime = m_startframe;
+                       return true;
+               } 
+               else if (m_localtime > m_endframe)
+               {
+                       m_localtime = m_endframe;
+                       return true;
+               }
+       } else {
+               if (m_localtime > m_startframe)
+               {
+                       m_localtime = m_startframe;
+                       return true;
+               }
+               else if (m_localtime < m_endframe)
+               {
+                       m_localtime = m_endframe;
+                       return true;
+               }
+       }
+       return false;
+}
+
+void BL_ActionActuator::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
+               m_starttime = curtime - direction*(m_endframe - m_localtime)/KX_KetsjiEngine::GetAnimFrameRate();
+}
+
+void BL_ActionActuator::SetLocalTime(float curtime)
+{
+       float delta_time = (curtime - m_starttime)*KX_KetsjiEngine::GetAnimFrameRate();
+       
+       if (m_endframe < m_startframe)
+               delta_time = -delta_time;
+
+       if (!(m_flag & ACT_FLAG_REVERSE))
+               m_localtime = m_startframe + delta_time;
+       else
+               m_localtime = m_endframe - delta_time;
+}
+
+
+bool BL_ActionActuator::Update(double curtime, bool frame)
+{
+       bool bNegativeEvent = false;
+       bool bPositiveEvent = false;
+       bool keepgoing = true;
+       bool wrap = false;
+       bool apply=true;
+       int     priority;
+       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)
+       {
+               bNegativeEvent = m_negevent;
+               bPositiveEvent = m_posevent;
+               RemoveAllEvents();
+               
+               if (bPositiveEvent)
+                       m_flag |= ACT_FLAG_ACTIVE;
+               
+               if (bNegativeEvent)
+               {
+                       // dont continue where we left off when restarting
+                       if (m_end_reset) {
+                               m_flag &= ~ACT_FLAG_LOCKINPUT;
+                       }
+                       
+                       if (!(m_flag & ACT_FLAG_ACTIVE))
+                               return false;
+                       m_flag &= ~ACT_FLAG_ACTIVE;
+               }
+       }
+       
+       /*      We know that action actuators have been discarded from all non armature objects:
+       if we're being called, we're attached to a BL_ArmatureObject */
+       BL_ArmatureObject *obj = (BL_ArmatureObject*)GetParent();
+       float length = m_endframe - m_startframe;
+       
+       priority = m_priority;
+       
+       /* Determine pre-incrementation behaviour and set appropriate flags */
+       switch (m_playtype){
+       case ACT_ACTION_MOTION:
+               if (bNegativeEvent){
+                       keepgoing=false;
+                       apply=false;
+               };
+               break;
+       case ACT_ACTION_FROM_PROP:
+               if (bNegativeEvent){
+                       apply=false;
+                       keepgoing=false;
+               }
+               break;
+       case ACT_ACTION_LOOP_END:
+               if (bPositiveEvent){
+                       if (!(m_flag & ACT_FLAG_LOCKINPUT)){
+                               m_flag &= ~ACT_FLAG_KEYUP;
+                               m_flag &= ~ACT_FLAG_REVERSE;
+                               m_flag |= ACT_FLAG_LOCKINPUT;
+                               m_localtime = m_startframe;
+                               m_starttime = curtime;
+                       }
+               }
+               if (bNegativeEvent){
+                       m_flag |= ACT_FLAG_KEYUP;
+               }
+               break;
+       case ACT_ACTION_LOOP_STOP:
+               if (bPositiveEvent){
+                       if (!(m_flag & ACT_FLAG_LOCKINPUT)){
+                               m_flag &= ~ACT_FLAG_REVERSE;
+                               m_flag &= ~ACT_FLAG_KEYUP;
+                               m_flag |= ACT_FLAG_LOCKINPUT;
+                               SetStartTime(curtime);
+                       }
+               }
+               if (bNegativeEvent){
+                       m_flag |= ACT_FLAG_KEYUP;
+                       m_flag &= ~ACT_FLAG_LOCKINPUT;
+                       keepgoing=false;
+                       apply=false;
+               }
+               break;
+       case ACT_ACTION_FLIPPER:
+               if (bPositiveEvent){
+                       if (!(m_flag & ACT_FLAG_LOCKINPUT)){
+                               m_flag &= ~ACT_FLAG_REVERSE;
+                               m_flag |= ACT_FLAG_LOCKINPUT;
+                               SetStartTime(curtime);
+                       }
+               }
+               else if (bNegativeEvent){
+                       m_flag |= ACT_FLAG_REVERSE;
+                       m_flag &= ~ACT_FLAG_LOCKINPUT;
+                       SetStartTime(curtime);
+               }
+               break;
+       case ACT_ACTION_PLAY:
+               if (bPositiveEvent){
+                       if (!(m_flag & ACT_FLAG_LOCKINPUT)){
+                               m_flag &= ~ACT_FLAG_REVERSE;
+                               m_localtime = m_starttime;
+                               m_starttime = curtime;
+                               m_flag |= ACT_FLAG_LOCKINPUT;
+                       }
+               }
+               break;
+       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();
+                       m_lastpos = newpos;
+               }
+               else{
+                       SetLocalTime(curtime);
+               }
+       }
+       
+       /* Check if a wrapping response is needed */
+       if (length){
+               if (m_localtime < m_startframe || m_localtime > m_endframe)
+               {
+                       m_localtime = m_startframe + fmod(m_localtime, length);
+                       wrap = true;
+               }
+       }
+       else
+               m_localtime = m_startframe;
+       
+       /* Perform post-increment tasks */
+       switch (m_playtype){
+       case ACT_ACTION_FROM_PROP:
+               {
+                       CValue* propval = GetParent()->GetProperty(m_propname);
+                       if (propval)
+                               m_localtime = propval->GetNumber();
+                       
+                       if (bNegativeEvent){
+                               keepgoing=false;
+                       }
+               }
+               break;
+       case ACT_ACTION_MOTION:
+               break;
+       case ACT_ACTION_LOOP_STOP:
+               break;
+       case ACT_ACTION_FLIPPER:
+               if (wrap){
+                       if (!(m_flag & ACT_FLAG_REVERSE)){
+                               m_localtime=m_endframe;
+                               //keepgoing = false;
+                       }
+                       else {
+                               m_localtime=m_startframe;
+                               keepgoing = false;
+                       }
+               }
+               break;
+       case ACT_ACTION_LOOP_END:
+               if (wrap){
+                       if (m_flag & ACT_FLAG_KEYUP){
+                               keepgoing = false;
+                               m_localtime = m_endframe;
+                               m_flag &= ~ACT_FLAG_LOCKINPUT;
+                       }
+                       SetStartTime(curtime);
+               }
+               break;
+       case ACT_ACTION_PLAY:
+               if (wrap){
+                       m_localtime = m_endframe;
+                       keepgoing = false;
+                       m_flag &= ~ACT_FLAG_LOCKINPUT;
+               }
+               break;
+       default:
+               keepgoing = false;
+               break;
+       }
+       
+       /* Set the property if its defined */
+       if (m_framepropname[0] != '\0') {
+               CValue* propowner = GetParent();
+               CValue* oldprop = propowner->GetProperty(m_framepropname);
+               CValue* newval = new CFloatValue(m_localtime);
+               if (oldprop) {
+                       oldprop->SetValue(newval);
+               } else {
+                       propowner->SetProperty(m_framepropname, newval);
+               }
+               newval->Release();
+       }
+       
+       if (bNegativeEvent)
+               m_blendframe=0.0;
+       
+       /* Apply the pose if necessary*/
+       if (apply){
+
+               /* Priority test */
+               if (obj->SetActiveAction(this, priority, curtime)){
+                       
+                       /* Get the underlying pose from the armature */
+                       obj->GetPose(&m_pose);
+
+// 2.4x function, 
+                       /* Override the necessary channels with ones from the action */
+                       // XXX extract_pose_from_action(m_pose, m_action, m_localtime);
+                       
+                       
+// 2.5x - replacement for extract_pose_from_action(...) above.
+                       {
+                               struct PointerRNA id_ptr;
+                               Object *arm= obj->GetArmatureObject();
+                               bPose *pose_back= arm->pose;
+                               
+                               arm->pose= m_pose;
+                               RNA_id_pointer_create((ID *)arm, &id_ptr);
+                               animsys_evaluate_action(&id_ptr, m_action, NULL, m_localtime);
+                               
+                               arm->pose= pose_back;
+                       
+// 2.5x - could also do this but looks too high level, constraints use this, it works ok.
+//                             Object workob; /* evaluate using workob */
+//                             what_does_obaction((Scene *)obj->GetScene(), obj->GetArmatureObject(), &workob, m_pose, m_action, NULL, m_localtime);
+                       }
+
+                       // done getting the pose from the action
+                       
+                       /* Perform the user override (if any) */
+                       if (m_userpose){
+                               extract_pose_from_pose(m_pose, m_userpose);
+                               game_free_pose(m_userpose); //cant use MEM_freeN(m_userpose) because the channels need freeing too.
+                               m_userpose = NULL;
+                       }
+#if 1
+                       /* Handle blending */
+                       if (m_blendin && (m_blendframe<m_blendin)){
+                               /* If this is the start of a blending sequence... */
+                               if ((m_blendframe==0.0) || (!m_blendpose)){
+                                       obj->GetMRDPose(&m_blendpose);
+                                       m_blendstart = curtime;
+                               }
+                               
+                               /* Find percentages */
+                               newweight = (m_blendframe/(float)m_blendin);
+                               game_blend_poses(m_pose, m_blendpose, 1.0 - newweight);
+
+                               /* Increment current blending percentage */
+                               m_blendframe = (curtime - m_blendstart)*KX_KetsjiEngine::GetAnimFrameRate();
+                               if (m_blendframe>m_blendin)
+                                       m_blendframe = m_blendin;
+                               
+                       }
+#endif
+                       m_lastUpdate = m_localtime;
+                       obj->SetPose (m_pose);
+               }
+               else{
+                       m_blendframe = 0.0;
+               }
+       }
+       
+       if (!keepgoing){
+               m_blendframe = 0.0;
+       }
+       return keepgoing;
+};
+
+#ifndef DISABLE_PYTHON
+
+/* ------------------------------------------------------------------------- */
+/* Python functions                                                          */
+/* ------------------------------------------------------------------------- */
+
+PyObject* BL_ActionActuator::PyGetChannel(PyObject* value) {
+       char *string= _PyUnicode_AsString(value);
+       
+       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 */
+       }
+       
+       // get_pose_channel accounts for NULL pose, run on both incase one exists but
+       // the channel doesnt
+       if(             !(pchan=get_pose_channel(m_userpose, string)) &&
+                       !(pchan=get_pose_channel(m_pose, string))  )
+       {
+               PyErr_SetString(PyExc_ValueError, "channel doesnt exist");
+               return NULL;
+       }
+
+       PyObject *ret = PyTuple_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]));
+       PyList_SET_ITEM(list, 2, PyFloat_FromDouble(pchan->quat[2]));
+       PyList_SET_ITEM(list, 3, PyFloat_FromDouble(pchan->quat[3]));
+       PyTuple_SET_ITEM(ret, 2, list);
+
+       return ret;
+/*
+       return Py_BuildValue("([fff][fff][ffff])",
+               pchan->loc[0], pchan->loc[1], pchan->loc[2],
+               pchan->size[0], pchan->size[1], pchan->size[2],
+               pchan->quat[0], pchan->quat[1], pchan->quat[2], pchan->quat[3] );
+*/
+}
+
+/*     setChannel                                                         */
+KX_PYMETHODDEF_DOC(BL_ActionActuator, setChannel,
+"setChannel(channel, matrix)\n"
+"\t - channel   : A string specifying the name of the bone channel.\n"
+"\t - matrix    : A 4x4 matrix specifying the overriding transformation\n"
+"\t               as an offset from the bone's rest position.\n")
+{
+       BL_ArmatureObject *obj = (BL_ArmatureObject*)GetParent();
+       char *string;
+       PyObject *pymat= NULL;
+       PyObject *pyloc= NULL, *pysize= NULL, *pyquat= NULL;
+       bPoseChannel *pchan;
+       
+       if(PyTuple_Size(args)==2) {
+               if (!PyArg_ParseTuple(args,"sO:setChannel", &string, &pymat)) // matrix
+                       return NULL;
+       }
+       else if(PyTuple_Size(args)==4) {
+               if (!PyArg_ParseTuple(args,"sOOO:setChannel", &string, &pyloc, &pysize, &pyquat)) // loc/size/quat
+                       return NULL;
+       }
+       else {
+               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 */
+                       game_copy_pose(&m_userpose, m_pose, 0);
+               }
+               // pchan= verify_pose_channel(m_userpose, string); // adds the channel if its not there.
+               pchan= get_pose_channel(m_userpose, string); // adds the channel if its not there.
+               
+               if(pchan) {
+                       VECCOPY (pchan->loc, matrix[3]);
+                       mat4_to_size( pchan->size,matrix);
+                       mat4_to_quat( pchan->quat,matrix);
+               }
+       }
+       else {
+               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)
+                               obj->GetPose(&m_pose); /* Get the underlying pose from the armature */
+                       game_copy_pose(&m_userpose, m_pose, 0);
+               }
+               // pchan= verify_pose_channel(m_userpose, string);
+               pchan= get_pose_channel(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];
+                       pchan->size[0]= size[0]; pchan->size[1]= size[1]; pchan->size[2]= size[2];
+                       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;
+}
+
+/* ------------------------------------------------------------------------- */
+/* Python Integration Hooks                                                                     */
+/* ------------------------------------------------------------------------- */
+
+PyTypeObject BL_ActionActuator::Type = {
+       PyVarObject_HEAD_INIT(NULL, 0)
+       "BL_ActionActuator",
+       sizeof(PyObjectPlus_Proxy),
+       0,
+       py_base_dealloc,
+       0,
+       0,
+       0,
+       0,
+       py_base_repr,
+       0,0,0,0,0,0,0,0,0,
+       Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+       0,0,0,0,0,0,0,
+       Methods,
+       0,
+       0,
+       &SCA_IActuator::Type,
+       0,0,0,0,0,0,
+       py_base_new
+};
+
+PyMethodDef BL_ActionActuator::Methods[] = {
+       {"getChannel", (PyCFunction) BL_ActionActuator::sPyGetChannel, METH_O},
+       KX_PYMETHODTABLE(BL_ActionActuator, setChannel),
+       {NULL,NULL} //Sentinel
+};
+
+PyAttributeDef BL_ActionActuator::Attributes[] = {
+       KX_PYATTRIBUTE_FLOAT_RW("frameStart", 0, MAXFRAMEF, BL_ActionActuator, m_startframe),
+       KX_PYATTRIBUTE_FLOAT_RW("frameEnd", 0, MAXFRAMEF, BL_ActionActuator, m_endframe),
+       KX_PYATTRIBUTE_FLOAT_RW("blendIn", 0, MAXFRAMEF, BL_ActionActuator, m_blendin),
+       KX_PYATTRIBUTE_RW_FUNCTION("action", BL_ActionActuator, pyattr_get_action, pyattr_set_action),
+       KX_PYATTRIBUTE_RO_FUNCTION("channelNames", BL_ActionActuator, pyattr_get_channel_names),
+       KX_PYATTRIBUTE_SHORT_RW("priority", 0, 100, false, BL_ActionActuator, m_priority),
+       KX_PYATTRIBUTE_FLOAT_RW_CHECK("frame", 0, MAXFRAMEF, BL_ActionActuator, m_localtime, CheckFrame),
+       KX_PYATTRIBUTE_STRING_RW("propName", 0, 31, false, BL_ActionActuator, m_propname),
+       KX_PYATTRIBUTE_STRING_RW("framePropName", 0, 31, false, BL_ActionActuator, m_framepropname),
+       KX_PYATTRIBUTE_BOOL_RW("useContinue", BL_ActionActuator, m_end_reset),
+       KX_PYATTRIBUTE_FLOAT_RW_CHECK("blendTime", 0, MAXFRAMEF, BL_ActionActuator, m_blendframe, CheckBlendTime),
+       KX_PYATTRIBUTE_SHORT_RW_CHECK("mode",0,100,false,BL_ActionActuator,m_playtype,CheckType),
+       { NULL }        //Sentinel
+};
+
+PyObject* BL_ActionActuator::pyattr_get_action(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
+{
+       BL_ActionActuator* self= static_cast<BL_ActionActuator*>(self_v);
+       return PyUnicode_FromString(self->GetAction() ? self->GetAction()->id.name+2 : "");
+}
+
+int BL_ActionActuator::pyattr_set_action(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
+{
+       BL_ActionActuator* self= static_cast<BL_ActionActuator*>(self_v);
+       
+       if (!PyUnicode_Check(value))
+       {
+               PyErr_SetString(PyExc_ValueError, "actuator.action = val: Action Actuator, expected the string name of the action");
+               return PY_SET_ATTR_FAIL;
+       }
+
+       bAction *action= NULL;
+       STR_String val = _PyUnicode_AsString(value);
+       
+       if (val != "")
+       {
+               action= (bAction*)SCA_ILogicBrick::m_sCurrentLogicManager->GetActionByName(val);
+               if (!action)
+               {
+                       PyErr_SetString(PyExc_ValueError, "actuator.action = val: Action Actuator, action not found!");
+                       return PY_SET_ATTR_FAIL;
+               }
+       }
+       
+       self->SetAction(action);
+       return PY_SET_ATTR_SUCCESS;
+
+}
+
+PyObject* BL_ActionActuator::pyattr_get_channel_names(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
+{
+       BL_ActionActuator* self= static_cast<BL_ActionActuator*>(self_v);
+       PyObject *ret= PyList_New(0);
+       PyObject *item;
+       
+       bPose *pose= ((BL_ArmatureObject*)self->GetParent())->GetOrigPose();
+       
+       if(pose) {
+               bPoseChannel *pchan;
+               for(pchan= (bPoseChannel *)pose->chanbase.first; pchan; pchan= (bPoseChannel *)pchan->next) {
+                       item= PyUnicode_FromString(pchan->name);
+                       PyList_Append(ret, item);
+                       Py_DECREF(item);
+               }
+       }
+       
+       return ret;
+}
+
+#endif // DISABLE_PYTHON
diff --git a/source/gameengine/Converter/BL_ActionActuator.h b/source/gameengine/Converter/BL_ActionActuator.h
new file mode 100644 (file)
index 0000000..10ce1fa
--- /dev/null
@@ -0,0 +1,177 @@
+/**
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef BL_ACTIONACTUATOR
+#define BL_ACTIONACTUATOR
+
+#include "GEN_HashedPtr.h"
+#include "SCA_IActuator.h"
+#include "DNA_actuator_types.h"
+#include "MT_Point3.h"
+
+class BL_ActionActuator : public SCA_IActuator  
+{
+public:
+       Py_Header;
+       BL_ActionActuator(SCA_IObject* gameobj,
+                                               const STR_String& propname,
+                                               const STR_String& framepropname,
+                                               float starttime,
+                                               float endtime,
+                                               struct bAction *action,
+                                               short   playtype,
+                                               short   blendin,
+                                               short   priority,
+                                               short   end_reset,
+                                               float   stride) 
+               : SCA_IActuator(gameobj, KX_ACT_ACTION),
+               
+               m_lastpos(0, 0, 0),
+               m_blendframe(0),
+               m_flag(0),
+               m_startframe (starttime),
+               m_endframe(endtime) ,
+               m_starttime(0),
+               m_localtime(starttime),
+               m_lastUpdate(-1),
+               m_blendin(blendin),
+               m_blendstart(0),
+               m_stridelength(stride),
+               m_playtype(playtype),
+               m_priority(priority),
+               m_end_reset(end_reset),
+               m_pose(NULL),
+               m_blendpose(NULL),
+               m_userpose(NULL),
+               m_action(action),
+               m_propname(propname),
+               m_framepropname(framepropname)          
+       {
+       };
+       virtual ~BL_ActionActuator();
+       virtual bool Update(double curtime, bool frame);
+       virtual CValue* GetReplica();
+       virtual void ProcessReplica();
+       
+       void SetBlendTime (float newtime);
+       
+       bAction*        GetAction() { return m_action; }
+       void            SetAction(bAction* act) { m_action= act; }
+
+#ifndef DISABLE_PYTHON
+
+       KX_PYMETHOD_O(BL_ActionActuator,GetChannel);
+       KX_PYMETHOD_DOC(BL_ActionActuator,setChannel);
+
+       static PyObject*        pyattr_get_action(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
+       static int                      pyattr_set_action(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
+       static PyObject*        pyattr_get_channel_names(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
+       /* attribute check */
+       static int CheckFrame(void *self, const PyAttributeDef*)
+       {
+               BL_ActionActuator* act = reinterpret_cast<BL_ActionActuator*>(self);
+
+               if (act->m_localtime < act->m_startframe)
+                       act->m_localtime = act->m_startframe;
+               else if (act->m_localtime > act->m_endframe)
+                       act->m_localtime = act->m_endframe;
+
+               return 0;
+       }
+
+       static int CheckBlendTime(void *self, const PyAttributeDef*)
+       {
+               BL_ActionActuator* act = reinterpret_cast<BL_ActionActuator*>(self);
+
+               if (act->m_blendframe > act->m_blendin)
+                       act->m_blendframe = act->m_blendin;
+
+               return 0;
+       }
+
+       static int CheckType(void *self, const PyAttributeDef*)
+       {
+               BL_ActionActuator* act = reinterpret_cast<BL_ActionActuator*>(self);
+
+               switch (act->m_playtype) {
+                       case ACT_ACTION_PLAY:
+                       case ACT_ACTION_FLIPPER:
+                       case ACT_ACTION_LOOP_STOP:
+                       case ACT_ACTION_LOOP_END:
+                       case ACT_ACTION_FROM_PROP:
+                               return 0;
+                       default:
+                               PyErr_SetString(PyExc_ValueError, "Action Actuator, invalid play type supplied");
+                               return 1;
+               }
+       }
+#endif // DISABLE_PYTHON
+       
+protected:
+
+       void SetStartTime(float curtime);
+       void SetLocalTime(float curtime);
+       bool ClampLocalTime();
+
+       MT_Point3       m_lastpos;
+       float   m_blendframe;
+       int             m_flag;
+       /** The frame this action starts */
+       float   m_startframe;
+       /** The frame this action ends */
+       float   m_endframe;
+       /** The time this action started */
+       float   m_starttime;
+       /** The current time of the action */
+       float   m_localtime;
+       
+       float   m_lastUpdate;
+       float   m_blendin;
+       float   m_blendstart;
+       float   m_stridelength;
+       short   m_playtype;
+       short   m_priority;
+       bool    m_end_reset;
+       struct bPose* m_pose;
+       struct bPose* m_blendpose;
+       struct bPose* m_userpose;
+       struct bAction *m_action;
+       STR_String      m_propname;
+       STR_String      m_framepropname;
+};
+
+enum {
+       ACT_FLAG_REVERSE        = 0x00000001,
+       ACT_FLAG_LOCKINPUT      = 0x00000002,
+       ACT_FLAG_KEYUP          = 0x00000004,
+       ACT_FLAG_ACTIVE         = 0x00000008
+};
+
+#endif
+
diff --git a/source/gameengine/Converter/BL_ArmatureActuator.cpp b/source/gameengine/Converter/BL_ArmatureActuator.cpp
new file mode 100644 (file)
index 0000000..82b8307
--- /dev/null
@@ -0,0 +1,261 @@
+/**
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include "DNA_action_types.h"
+#include "DNA_constraint_types.h"
+#include "DNA_actuator_types.h"
+#include "BKE_constraint.h"
+#include "BL_ArmatureActuator.h"
+#include "BL_ArmatureObject.h"
+#include "BLI_math.h"
+
+/**
+ * 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. 
+ * It also allows to activate/deactivate constraints during the game.
+ * Later it will also be possible to create constraint on the fly
+ */
+
+BL_ArmatureActuator::BL_ArmatureActuator(SCA_IObject* obj,
+                                               int type,
+                                               const char *posechannel,
+                                               const char *constraintname,
+                                               KX_GameObject* targetobj,
+                                               KX_GameObject* subtargetobj,
+                                               float weight) :
+       SCA_IActuator(obj, KX_ACT_ARMATURE),
+       m_constraint(NULL),
+       m_gametarget(targetobj),
+       m_gamesubtarget(subtargetobj),
+       m_posechannel(posechannel),
+       m_constraintname(constraintname),
+       m_weight(weight),
+       m_type(type)
+{
+       if (m_gametarget)
+               m_gametarget->RegisterActuator(this);
+       if (m_gamesubtarget)
+               m_gamesubtarget->RegisterActuator(this);
+       FindConstraint();
+}
+
+BL_ArmatureActuator::~BL_ArmatureActuator()
+{
+       if (m_gametarget)
+               m_gametarget->UnregisterActuator(this);
+       if (m_gamesubtarget)
+               m_gamesubtarget->UnregisterActuator(this);
+}
+
+void BL_ArmatureActuator::ProcessReplica()
+{
+       // the replica is tracking the same object => register it (this may be changed in Relnk())
+       if (m_gametarget)
+               m_gametarget->RegisterActuator(this);
+       if (m_gamesubtarget)
+               m_gamesubtarget->UnregisterActuator(this);
+       SCA_IActuator::ProcessReplica();
+}
+
+void BL_ArmatureActuator::ReParent(SCA_IObject* parent)
+{
+       SCA_IActuator::ReParent(parent);
+       // must remap the constraint
+       FindConstraint();
+}
+
+bool BL_ArmatureActuator::UnlinkObject(SCA_IObject* clientobj)
+{
+       bool res=false;
+       if (clientobj == m_gametarget)
+       {
+               // this object is being deleted, we cannot continue to track it.
+               m_gametarget = NULL;
+               res = true;
+       }
+       if (clientobj == m_gamesubtarget)
+       {
+               // this object is being deleted, we cannot continue to track it.
+               m_gamesubtarget = NULL;
+               res = true;
+       }
+       return res;
+}
+
+void BL_ArmatureActuator::Relink(GEN_Map<GEN_HashedPtr, void*> *obj_map)
+{
+       void **h_obj = (*obj_map)[m_gametarget];
+       if (h_obj) {
+               if (m_gametarget)
+                       m_gametarget->UnregisterActuator(this);
+               m_gametarget = (KX_GameObject*)(*h_obj);
+               m_gametarget->RegisterActuator(this);
+       }
+       h_obj = (*obj_map)[m_gamesubtarget];
+       if (h_obj) {
+               if (m_gamesubtarget)
+                       m_gamesubtarget->UnregisterActuator(this);
+               m_gamesubtarget = (KX_GameObject*)(*h_obj);
+               m_gamesubtarget->RegisterActuator(this);
+       }
+}
+
+void BL_ArmatureActuator::FindConstraint()
+{
+       m_constraint = NULL;
+
+       if (m_gameobj->GetGameObjectType() == SCA_IObject::OBJ_ARMATURE) {
+               BL_ArmatureObject* armobj = (BL_ArmatureObject*)m_gameobj;
+               m_constraint = armobj->GetConstraint(m_posechannel, m_constraintname);
+       }
+}
+
+bool BL_ArmatureActuator::Update(double curtime, bool frame)
+{
+       // the only role of this actuator is to ensure that the armature pose will be evaluated
+       bool result = false;    
+       bool bNegativeEvent = IsNegativeEvent();
+       RemoveAllEvents();
+
+       if (!bNegativeEvent) {
+               BL_ArmatureObject *obj = (BL_ArmatureObject*)GetParent();
+               switch (m_type) {
+               case ACT_ARM_RUN:
+                       result = true;
+                       obj->SetActiveAction(NULL, 0, curtime);
+                       break;
+               case ACT_ARM_ENABLE:
+                       if (m_constraint)
+                               m_constraint->ClrConstraintFlag(CONSTRAINT_OFF);
+                       break;
+               case ACT_ARM_DISABLE:
+                       if (m_constraint)
+                               m_constraint->SetConstraintFlag(CONSTRAINT_OFF);
+                       break;
+               case ACT_ARM_SETTARGET:
+                       if (m_constraint) {
+                               m_constraint->SetTarget(m_gametarget);
+                               m_constraint->SetSubtarget(m_gamesubtarget);
+                       }
+                       break;
+               case ACT_ARM_SETWEIGHT:
+                       if (m_constraint)
+                               m_constraint->SetWeight(m_weight);
+                       break;
+               }
+       }
+       return result;
+}
+
+#ifndef DISABLE_PYTHON
+
+/* ------------------------------------------------------------------------- */
+/* Python Integration Hooks                                                                     */
+/* ------------------------------------------------------------------------- */
+
+PyTypeObject BL_ArmatureActuator::Type = {
+       PyVarObject_HEAD_INIT(NULL, 0)
+               "BL_ArmatureActuator",
+               sizeof(PyObjectPlus_Proxy),
+               0,
+               py_base_dealloc,
+               0,
+               0,
+               0,
+               0,
+               py_base_repr,
+               0,0,0,0,0,0,0,0,0,
+               Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+               0,0,0,0,0,0,0,
+               Methods,
+               0,
+               0,
+               &SCA_IActuator::Type,
+               0,0,0,0,0,0,
+               py_base_new
+};
+
+
+PyMethodDef BL_ArmatureActuator::Methods[] = {
+       {NULL,NULL} //Sentinel
+};
+
+PyAttributeDef BL_ArmatureActuator::Attributes[] = {
+       KX_PYATTRIBUTE_RO_FUNCTION("constraint", BL_ArmatureActuator, pyattr_get_constraint),
+       KX_PYATTRIBUTE_RW_FUNCTION("target", BL_ArmatureActuator, pyattr_get_object, pyattr_set_object),
+       KX_PYATTRIBUTE_RW_FUNCTION("subtarget", BL_ArmatureActuator, pyattr_get_object, pyattr_set_object),
+       KX_PYATTRIBUTE_FLOAT_RW("weight",0.0f,1.0f,BL_ArmatureActuator,m_weight),
+       KX_PYATTRIBUTE_INT_RW("type",0,ACT_ARM_MAXTYPE,false,BL_ArmatureActuator,m_type),
+       { NULL }        //Sentinel
+};
+
+PyObject* BL_ArmatureActuator::pyattr_get_object(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef)
+{
+       BL_ArmatureActuator* actuator = static_cast<BL_ArmatureActuator*>(self);
+       KX_GameObject *target = (!strcmp(attrdef->m_name, "target")) ? actuator->m_gametarget : actuator->m_gamesubtarget;
+       if (!target)    
+               Py_RETURN_NONE;
+       else
+               return target->GetProxy();
+}
+
+int BL_ArmatureActuator::pyattr_set_object(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
+{
+       BL_ArmatureActuator* actuator = static_cast<BL_ArmatureActuator*>(self);
+       KX_GameObject* &target = (!strcmp(attrdef->m_name, "target")) ? actuator->m_gametarget : actuator->m_gamesubtarget;
+       KX_GameObject *gameobj;
+               
+       if (!ConvertPythonToGameObject(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;
+}
+
+PyObject* BL_ArmatureActuator::pyattr_get_constraint(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef)
+{
+       BL_ArmatureActuator* actuator = static_cast<BL_ArmatureActuator*>(self);
+       BL_ArmatureConstraint* constraint = actuator->m_constraint;
+       if (!constraint)        
+               Py_RETURN_NONE;
+       else
+               return constraint->GetProxy();
+}
+
+#endif // DISABLE_PYTHON
+
diff --git a/source/gameengine/Converter/BL_ArmatureActuator.h b/source/gameengine/Converter/BL_ArmatureActuator.h
new file mode 100644 (file)
index 0000000..72e2e96
--- /dev/null
@@ -0,0 +1,93 @@
+/**
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+#ifndef BL_ARMATUREACTUATOR
+#define BL_ARMATUREACTUATOR
+
+#include "SCA_IActuator.h"
+#include "BL_ArmatureConstraint.h"
+
+/**
+ * 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. 
+ * It also allows to activate/deactivate constraints during the game.
+ * Later it will also be possible to create constraint on the fly
+ */
+
+class  BL_ArmatureActuator : public SCA_IActuator
+{
+       Py_Header;
+public:
+       BL_ArmatureActuator(SCA_IObject* gameobj,
+                                               int type,
+                                               const char *posechannel,
+                                               const char *constraintname,
+                                               KX_GameObject* targetobj,
+                                               KX_GameObject* subtargetobj,
+                                               float weight);
+
+       virtual ~BL_ArmatureActuator();
+
+       virtual CValue* GetReplica() {
+               BL_ArmatureActuator* replica = new BL_ArmatureActuator(*this);
+               replica->ProcessReplica();
+               return replica;
+       };
+       virtual void ProcessReplica();
+       virtual bool UnlinkObject(SCA_IObject* clientobj);
+       virtual void Relink(GEN_Map<GEN_HashedPtr, void*> *obj_map);
+       virtual bool Update(double curtime, bool frame);
+       virtual void ReParent(SCA_IObject* parent);
+       
+#ifndef DISABLE_PYTHON
+
+       /* These are used to get and set m_target */
+       static PyObject* pyattr_get_constraint(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef);
+       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 // DISABLE_PYTHON
+
+private:
+       // identify the constraint that this actuator controls
+       void FindConstraint();
+
+       BL_ArmatureConstraint*  m_constraint;
+       KX_GameObject*  m_gametarget;
+       KX_GameObject*  m_gamesubtarget;
+       STR_String              m_posechannel;
+       STR_String              m_constraintname;
+       float                   m_weight;
+       int                             m_type;
+};
+
+#endif //BL_ARMATUREACTUATOR
+
+
diff --git a/source/gameengine/Converter/BL_ArmatureChannel.cpp b/source/gameengine/Converter/BL_ArmatureChannel.cpp
new file mode 100644 (file)
index 0000000..8f5ec23
--- /dev/null
@@ -0,0 +1,464 @@
+/**
+ * $Id$
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include "DNA_armature_types.h"
+#include "BL_ArmatureChannel.h"
+#include "BL_ArmatureObject.h"
+#include "BL_ArmatureConstraint.h"
+#include "BLI_math.h"
+#include "BLI_string.h"
+
+#ifndef DISABLE_PYTHON
+
+PyTypeObject BL_ArmatureChannel::Type = {
+       PyVarObject_HEAD_INIT(NULL, 0)
+       "BL_ArmatureChannel",
+       sizeof(PyObjectPlus_Proxy),
+       0,
+       py_base_dealloc,
+       0,
+       0,
+       0,
+       0,
+       py_base_repr,
+       0,0,0,0,0,0,0,0,0,
+       Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+       0,0,0,0,0,0,0,
+       Methods,
+       0,
+       0,
+       &CValue::Type,
+       0,0,0,0,0,0,
+       py_base_new
+};
+
+PyObject* BL_ArmatureChannel::py_repr(void)
+{
+       return PyUnicode_FromString(m_posechannel->name);
+}
+
+PyObject *BL_ArmatureChannel::GetProxy()
+{
+       return GetProxyPlus_Ext(this, &Type, m_posechannel);
+}
+
+PyObject *BL_ArmatureChannel::NewProxy(bool py_owns)
+{
+       return NewProxyPlus_Ext(this, &Type, m_posechannel, py_owns);
+}
+
+#endif // DISABLE_PYTHON
+
+BL_ArmatureChannel::BL_ArmatureChannel(
+       BL_ArmatureObject *armature, 
+       bPoseChannel *posechannel)
+       : PyObjectPlus(), m_posechannel(posechannel), m_armature(armature)
+{
+}
+
+BL_ArmatureChannel::~BL_ArmatureChannel()
+{
+}
+
+#ifndef DISABLE_PYTHON
+
+// PYTHON
+
+PyMethodDef BL_ArmatureChannel::Methods[] = {
+  {NULL,NULL} //Sentinel
+};
+
+// order of definition of attributes, must match Attributes[] array
+#define BCA_BONE               0
+#define BCA_PARENT             1
+
+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
+};
+
+/* attributes directly taken from bPoseChannel */
+PyAttributeDef BL_ArmatureChannel::AttributesPtr[] = {
+       KX_PYATTRIBUTE_CHAR_RO("name",bPoseChannel,name),
+       KX_PYATTRIBUTE_FLAG_RO("has_ik",bPoseChannel,flag, POSE_CHAIN),
+       KX_PYATTRIBUTE_FLAG_NEGATIVE_RO("ik_dof_x",bPoseChannel,ikflag, BONE_IK_NO_XDOF),
+       KX_PYATTRIBUTE_FLAG_NEGATIVE_RO("ik_dof_y",bPoseChannel,ikflag, BONE_IK_NO_YDOF),
+       KX_PYATTRIBUTE_FLAG_NEGATIVE_RO("ik_dof_z",bPoseChannel,ikflag, BONE_IK_NO_ZDOF),
+       KX_PYATTRIBUTE_FLAG_RO("ik_limit_x",bPoseChannel,ikflag, BONE_IK_XLIMIT),
+       KX_PYATTRIBUTE_FLAG_RO("ik_limit_y",bPoseChannel,ikflag, BONE_IK_YLIMIT),
+       KX_PYATTRIBUTE_FLAG_RO("ik_limit_z",bPoseChannel,ikflag, BONE_IK_ZLIMIT),
+       KX_PYATTRIBUTE_FLAG_RO("ik_rot_control",bPoseChannel,ikflag, BONE_IK_ROTCTL),
+       KX_PYATTRIBUTE_FLAG_RO("ik_lin_control",bPoseChannel,ikflag, BONE_IK_LINCTL),
+       KX_PYATTRIBUTE_FLOAT_VECTOR_RW("location",-FLT_MAX,FLT_MAX,bPoseChannel,loc,3),
+       KX_PYATTRIBUTE_FLOAT_VECTOR_RW("scale",-FLT_MAX,FLT_MAX,bPoseChannel,size,3),
+       KX_PYATTRIBUTE_FLOAT_VECTOR_RW("rotation_quaternion",-1.0f,1.0f,bPoseChannel,quat,4),
+       KX_PYATTRIBUTE_FLOAT_VECTOR_RW("rotation_euler",-10.f,10.f,bPoseChannel,eul,3),
+       KX_PYATTRIBUTE_SHORT_RW("rotation_mode",0,ROT_MODE_MAX-1,false,bPoseChannel,rotmode),
+       KX_PYATTRIBUTE_FLOAT_MATRIX_RO("channel_matrix",bPoseChannel,chan_mat,4),
+       KX_PYATTRIBUTE_FLOAT_MATRIX_RO("pose_matrix",bPoseChannel,pose_mat,4),
+       KX_PYATTRIBUTE_FLOAT_VECTOR_RO("pose_head",bPoseChannel,pose_head,3),
+       KX_PYATTRIBUTE_FLOAT_VECTOR_RO("pose_tail",bPoseChannel,pose_tail,3),
+       KX_PYATTRIBUTE_FLOAT_RO("ik_min_x",bPoseChannel,limitmin[0]),
+       KX_PYATTRIBUTE_FLOAT_RO("ik_max_x",bPoseChannel,limitmax[0]),
+       KX_PYATTRIBUTE_FLOAT_RO("ik_min_y",bPoseChannel,limitmin[1]),
+       KX_PYATTRIBUTE_FLOAT_RO("ik_max_y",bPoseChannel,limitmax[1]),
+       KX_PYATTRIBUTE_FLOAT_RO("ik_min_z",bPoseChannel,limitmin[2]),
+       KX_PYATTRIBUTE_FLOAT_RO("ik_max_z",bPoseChannel,limitmax[2]),
+       KX_PYATTRIBUTE_FLOAT_RO("ik_stiffness_x",bPoseChannel,stiffness[0]),
+       KX_PYATTRIBUTE_FLOAT_RO("ik_stiffness_y",bPoseChannel,stiffness[1]),
+       KX_PYATTRIBUTE_FLOAT_RO("ik_stiffness_z",bPoseChannel,stiffness[2]),
+       KX_PYATTRIBUTE_FLOAT_RO("ik_stretch",bPoseChannel,ikstretch),
+       KX_PYATTRIBUTE_FLOAT_RW("ik_rot_weight",0,1.0f,bPoseChannel,ikrotweight),
+       KX_PYATTRIBUTE_FLOAT_RW("ik_lin_weight",0,1.0f,bPoseChannel,iklinweight),
+       KX_PYATTRIBUTE_RW_FUNCTION("joint_rotation",BL_ArmatureChannel,py_attr_get_joint_rotation,py_attr_set_joint_rotation),
+       { NULL }        //Sentinel
+};
+
+PyObject* BL_ArmatureChannel::py_attr_getattr(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef)
+{
+       BL_ArmatureChannel* self= static_cast<BL_ArmatureChannel*>(self_v);
+       bPoseChannel* channel = self->m_posechannel;
+       int attr_order = attrdef-Attributes;
+
+       if (!channel) {
+               PyErr_SetString(PyExc_AttributeError, "channel is NULL");
+               return NULL;
+       }
+
+       switch (attr_order) {
+       case BCA_BONE:
+               // bones are standalone proxy
+               return NewProxyPlus_Ext(NULL,&BL_ArmatureBone::Type,channel->bone,false);
+       case BCA_PARENT:
+               {
+                       BL_ArmatureChannel* parent = self->m_armature->GetChannel(channel->parent);
+                       if (parent)
+                               return parent->GetProxy();
+                       else
+                               Py_RETURN_NONE;
+               }
+       }
+       PyErr_SetString(PyExc_AttributeError, "channel unknown attribute");
+       return NULL;
+}
+
+int BL_ArmatureChannel::py_attr_setattr(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
+{
+       BL_ArmatureChannel* self= static_cast<BL_ArmatureChannel*>(self_v);
+       bPoseChannel* channel = self->m_posechannel;
+       int attr_order = attrdef-Attributes;
+
+//     int ival;
+//     double dval;
+//     char* sval;
+//     KX_GameObject *oval;
+
+       if (!channel) {
+               PyErr_SetString(PyExc_AttributeError, "channel is NULL");
+               return PY_SET_ATTR_FAIL;
+       }
+       
+       switch (attr_order) {
+       default:
+               break;
+       }
+
+       PyErr_SetString(PyExc_AttributeError, "channel unknown attribute");
+       return PY_SET_ATTR_FAIL;
+}
+
+PyObject* BL_ArmatureChannel::py_attr_get_joint_rotation(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef)
+{
+       bPoseChannel* pchan = static_cast<bPoseChannel*>(self_v);
+       // decompose the pose matrix in euler rotation
+       float rest_mat[3][3];
+       float pose_mat[3][3];
+       float joint_mat[3][3];
+       float joints[3];
+       float norm;
+       double sa, ca;
+       // get rotation in armature space
+       copy_m3_m4(pose_mat, pchan->pose_mat);
+       normalize_m3(pose_mat);
+       if (pchan->parent) {
+               // bone has a parent, compute the rest pose of the bone taking actual pose of parent
+               mul_m3_m3m4(rest_mat, pchan->bone->bone_mat, pchan->parent->pose_mat);
+               normalize_m3(rest_mat);
+       } else {
+               // otherwise, the bone matrix in armature space is the rest pose
+               copy_m3_m4(rest_mat, pchan->bone->arm_mat);
+       }
+       // remove the rest pose to get the joint movement
+       transpose_m3(rest_mat);
+       mul_m3_m3m3(joint_mat, rest_mat, pose_mat);             
+       joints[0] = joints[1] = joints[2] = 0.f;
+       // returns a 3 element list that gives corresponding joint
+       int flag = 0;
+       if (!(pchan->ikflag & BONE_IK_NO_XDOF))
+               flag |= 1;
+       if (!(pchan->ikflag & BONE_IK_NO_YDOF))
+               flag |= 2;
+       if (!(pchan->ikflag & BONE_IK_NO_ZDOF))
+               flag |= 4;
+       switch (flag) {
+       case 0: // fixed joint
+               break;
+       case 1: // X only
+               mat3_to_eulO( joints, EULER_ORDER_XYZ,joint_mat);
+               joints[1] = joints[2] = 0.f;
+               break;
+       case 2: // Y only
+               mat3_to_eulO( joints, EULER_ORDER_XYZ,joint_mat);
+               joints[0] = joints[2] = 0.f;
+               break;
+       case 3: // X+Y
+               mat3_to_eulO( joints, EULER_ORDER_ZYX,joint_mat);
+               joints[2] = 0.f;
+               break;
+       case 4: // Z only
+               mat3_to_eulO( joints, EULER_ORDER_XYZ,joint_mat);
+               joints[0] = joints[1] = 0.f;
+               break;
+       case 5: // X+Z
+               // decompose this as an equivalent rotation vector in X/Z plane
+               joints[0] = joint_mat[1][2];
+               joints[2] = -joint_mat[1][0];
+               norm = normalize_v3(joints);
+               if (norm < FLT_EPSILON) {
+                       norm = (joint_mat[1][1] < 0.f) ? M_PI : 0.f;
+               } else {
+                       norm = acos(joint_mat[1][1]);
+               }
+               mul_v3_fl(joints, norm);
+               break;
+       case 6: // Y+Z
+               mat3_to_eulO( joints, EULER_ORDER_XYZ,joint_mat);
+               joints[0] = 0.f;
+               break;
+       case 7: // X+Y+Z
+               // equivalent axis
+               joints[0] = (joint_mat[1][2]-joint_mat[2][1])*0.5f;
+               joints[1] = (joint_mat[2][0]-joint_mat[0][2])*0.5f;
+               joints[2] = (joint_mat[0][1]-joint_mat[1][0])*0.5f;
+               sa = len_v3(joints);
+               ca = (joint_mat[0][0]+joint_mat[1][1]+joint_mat[1][1]-1.0f)*0.5f;
+               if (sa > FLT_EPSILON) {
+                       norm = atan2(sa,ca)/sa;
+               } else {
+                  if (ca < 0.0) {
+                          norm = M_PI;
+                          mul_v3_fl(joints,0.f);
+                          if (joint_mat[0][0] > 0.f) {
+                                  joints[0] = 1.0f;
+                          } else if (joint_mat[1][1] > 0.f) {
+                                  joints[1] = 1.0f;
+                          } else {
+                                  joints[2] = 1.0f;
+                          }
+                  } else {
+                          norm = 0.0;
+                  }
+               }
+               mul_v3_fl(joints,norm);
+               break;
+       }
+       return newVectorObject(joints, 3, Py_NEW, NULL);
+}
+
+int BL_ArmatureChannel::py_attr_set_joint_rotation(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
+{
+       BL_ArmatureChannel* self= static_cast<BL_ArmatureChannel*>(self_v);
+       bPoseChannel* pchan = self->m_posechannel;
+       PyObject *item;
+       float joints[3];
+       float quat[4];
+
+       if (!PySequence_Check(value) || PySequence_Size(value) != 3) {
+               PyErr_SetString(PyExc_AttributeError, "expected a sequence of [3] floats");
+               return PY_SET_ATTR_FAIL;
+       }
+       for (int i=0; i<3; i++) {
+               item = PySequence_GetItem(value, i); /* new ref */
+               joints[i] = PyFloat_AsDouble(item);
+               Py_DECREF(item);
+               if (joints[i] == -1.0f && PyErr_Occurred()) {
+                       PyErr_SetString(PyExc_AttributeError, "expected a sequence of [3] floats");
+                       return PY_SET_ATTR_FAIL;
+               }
+       }
+
+       int flag = 0;
+       if (!(pchan->ikflag & BONE_IK_NO_XDOF))
+               flag |= 1;
+       if (!(pchan->ikflag & BONE_IK_NO_YDOF))
+               flag |= 2;
+       if (!(pchan->ikflag & BONE_IK_NO_ZDOF))
+               flag |= 4;
+       unit_qt(quat);
+       switch (flag) {
+       case 0: // fixed joint
+               break;
+       case 1: // X only
+               joints[1] = joints[2] = 0.f;
+               eulO_to_quat( quat,joints, EULER_ORDER_XYZ);
+               break;
+       case 2: // Y only
+               joints[0] = joints[2] = 0.f;
+               eulO_to_quat( quat,joints, EULER_ORDER_XYZ);
+               break;
+       case 3: // X+Y
+               joints[2] = 0.f;
+               eulO_to_quat( quat,joints, EULER_ORDER_ZYX);
+               break;
+       case 4: // Z only
+               joints[0] = joints[1] = 0.f;
+               eulO_to_quat( quat,joints, EULER_ORDER_XYZ);
+               break;
+       case 5: // X+Z
+               // X and Z are components of an equivalent rotation axis
+               joints[1] = 0;
+               axis_angle_to_quat( quat,joints, len_v3(joints));
+               break;
+       case 6: // Y+Z
+               joints[0] = 0.f;
+               eulO_to_quat( quat,joints, EULER_ORDER_XYZ);
+               break;
+       case 7: // X+Y+Z
+               // equivalent axis
+               axis_angle_to_quat( quat,joints, len_v3(joints));
+               break;
+       }
+       if (pchan->rotmode > 0) {
+               quat_to_eulO( joints, pchan->rotmode,quat);
+               copy_v3_v3(pchan->eul, joints);
+       } else
+               copy_qt_qt(pchan->quat, quat);
+       return PY_SET_ATTR_SUCCESS;
+}
+
+// *************************
+// BL_ArmatureBone
+//
+// Access to Bone structure
+PyTypeObject BL_ArmatureBone::Type = {
+       PyVarObject_HEAD_INIT(NULL, 0)
+       "BL_ArmatureBone",
+       sizeof(PyObjectPlus_Proxy),
+       0,
+       py_base_dealloc,
+       0,
+       0,
+       0,
+       0,
+       py_bone_repr,
+       0,0,0,0,0,0,0,0,0,
+       Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+       0,0,0,0,0,0,0,
+       Methods,
+       0,
+       0,
+       &CValue::Type,
+       0,0,0,0,0,0,
+       py_base_new
+};
+
+// not used since this class is never instantiated
+PyObject *BL_ArmatureBone::GetProxy() 
+{ 
+       return NULL; 
+}
+PyObject *BL_ArmatureBone::NewProxy(bool py_owns) 
+{ 
+       return NULL; 
+}
+
+PyObject *BL_ArmatureBone::py_bone_repr(PyObject *self)
+{
+       Bone* bone = static_cast<Bone*>BGE_PROXY_PTR(self);
+       return PyUnicode_FromString(bone->name);
+}
+
+PyMethodDef BL_ArmatureBone::Methods[] = {
+       {NULL,NULL} //Sentinel
+};
+
+/* no attributes on C++ class since it is never instantiated */
+PyAttributeDef BL_ArmatureBone::Attributes[] = {
+       { NULL }        //Sentinel
+};
+
+// attributes that work on proxy ptr (points to a Bone structure)
+PyAttributeDef BL_ArmatureBone::AttributesPtr[] = {
+       KX_PYATTRIBUTE_CHAR_RO("name",Bone,name),
+       KX_PYATTRIBUTE_FLAG_RO("connected",Bone,flag, BONE_CONNECTED),
+       KX_PYATTRIBUTE_FLAG_RO("hinge",Bone,flag, BONE_HINGE),
+       KX_PYATTRIBUTE_FLAG_NEGATIVE_RO("inherit_scale",Bone,flag, BONE_NO_SCALE),
+       KX_PYATTRIBUTE_SHORT_RO("bbone_segments",Bone,segments),
+       KX_PYATTRIBUTE_FLOAT_RO("roll",Bone,roll),
+       KX_PYATTRIBUTE_FLOAT_VECTOR_RO("head",Bone,head,3),
+       KX_PYATTRIBUTE_FLOAT_VECTOR_RO("tail",Bone,tail,3),
+       KX_PYATTRIBUTE_FLOAT_RO("length",Bone,length),
+       KX_PYATTRIBUTE_FLOAT_VECTOR_RO("arm_head",Bone,arm_head,3),
+       KX_PYATTRIBUTE_FLOAT_VECTOR_RO("arm_tail",Bone,arm_tail,3),
+       KX_PYATTRIBUTE_FLOAT_MATRIX_RO("arm_mat",Bone,arm_mat,4),
+       KX_PYATTRIBUTE_FLOAT_MATRIX_RO("bone_mat",Bone,bone_mat,4),
+       KX_PYATTRIBUTE_RO_FUNCTION("parent",BL_ArmatureBone,py_bone_get_parent),
+       KX_PYATTRIBUTE_RO_FUNCTION("children",BL_ArmatureBone,py_bone_get_children),
+       { NULL }        //Sentinel
+};
+
+PyObject *BL_ArmatureBone::py_bone_get_parent(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef)
+{
+       Bone* bone = reinterpret_cast<Bone*>(self);
+       if (bone->parent) {
+               // create a proxy unconnected to any GE object
+               return NewProxyPlus_Ext(NULL,&Type,bone->parent,false);
+       }
+       Py_RETURN_NONE;
+}
+
+PyObject *BL_ArmatureBone::py_bone_get_children(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef)
+{
+       Bone* bone = reinterpret_cast<Bone*>(self);
+       Bone* child;
+       int count = 0;
+       for (child=(Bone*)bone->childbase.first; child; child=(Bone*)child->next)
+               count++;
+
+       PyObject* childrenlist = PyList_New(count);
+
+       for (count = 0, child=(Bone*)bone->childbase.first; child; child=(Bone*)child->next, ++count)
+               PyList_SET_ITEM(childrenlist,count,NewProxyPlus_Ext(NULL,&Type,child,false));
+
+       return childrenlist;
+}
+
+#endif // DISABLE_PYTHON
diff --git a/source/gameengine/Converter/BL_ArmatureChannel.h b/source/gameengine/Converter/BL_ArmatureChannel.h
new file mode 100644 (file)
index 0000000..79f0cc8
--- /dev/null
@@ -0,0 +1,95 @@
+/**
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+#ifndef __BL_ARMATURECHANNEL
+#define __BL_ARMATURECHANNEL
+
+#include "DNA_action_types.h"
+#include "GEN_HashedPtr.h"
+#include "GEN_Map.h"
+#include "PyObjectPlus.h"
+
+class SCA_IObject;
+class KX_GameObject;
+class BL_ArmatureObject;
+struct bConstraint;
+struct bPoseChannel;
+struct Object;
+struct bPose;
+
+class BL_ArmatureChannel : public PyObjectPlus
+{
+       // use Py_HeaderPtr since we use generic pointer in proxy
+       Py_HeaderPtr;
+
+private:
+       friend class BL_ArmatureObject;
+       struct bPoseChannel* m_posechannel;
+       BL_ArmatureObject* m_armature;
+
+public:
+       BL_ArmatureChannel(class BL_ArmatureObject *armature, 
+                                               struct bPoseChannel *posechannel);
+       virtual ~BL_ArmatureChannel();
+
+#ifndef DISABLE_PYTHON
+       // Python access
+       virtual PyObject* py_repr(void);
+
+       static PyObject* py_attr_getattr(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef);
+       static int py_attr_setattr(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
+       static PyObject* py_attr_get_joint_rotation(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef);
+       static int py_attr_set_joint_rotation(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
+#endif // DISABLE_PYTHON
+};
+
+/* this is a factory class to access bBone data field in the GE.
+   It's not supposed to be instantiated, we only need it for the Attributes and Method array.
+   The actual proxy object will be manually created using NewProxyPtr */
+class BL_ArmatureBone : public PyObjectPlus
+{
+       // use Py_HeaderPtr since we use generic pointer in proxy
+       Py_HeaderPtr;
+private:
+       // make constructor private to make sure no one tries to instantiate this class
+       BL_ArmatureBone() {}
+       virtual ~BL_ArmatureBone() {}
+
+public:
+
+#ifndef DISABLE_PYTHON
+       static PyObject *py_bone_repr(PyObject *self);
+       static PyObject *py_bone_get_parent(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef);
+       static PyObject *py_bone_get_children(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef);
+#endif
+
+};
+
+
+#endif //__BL_ARMATURECHANNEL
+
diff --git a/source/gameengine/Converter/BL_ArmatureConstraint.cpp b/source/gameengine/Converter/BL_ArmatureConstraint.cpp
new file mode 100644 (file)
index 0000000..0b7ab04
--- /dev/null
@@ -0,0 +1,450 @@
+/**
+ * $Id$
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include "DNA_constraint_types.h"
+#include "DNA_action_types.h"
+#include "BL_ArmatureConstraint.h"
+#include "BL_ArmatureObject.h"
+#include "BLI_math.h"
+#include "BLI_string.h"
+
+#ifndef DISABLE_PYTHON
+
+PyTypeObject BL_ArmatureConstraint::Type = {
+       PyVarObject_HEAD_INIT(NULL, 0)
+       "BL_ArmatureConstraint",
+       sizeof(PyObjectPlus_Proxy),
+       0,
+       py_base_dealloc,
+       0,
+       0,
+       0,
+       0,
+       py_base_repr,
+       0,0,0,0,0,0,0,0,0,
+       Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+       0,0,0,0,0,0,0,
+       Methods,
+       0,
+       0,
+       &CValue::Type,
+       0,0,0,0,0,0,
+       py_base_new
+};
+
+PyObject* BL_ArmatureConstraint::py_repr(void)
+{<