├── .gitignore ├── CMakeLists.txt ├── LICENSE ├── README ├── cmake └── FindPhysX3.cmake ├── physics ├── CMakeLists.txt ├── Callbacks.cpp ├── Callbacks.h ├── CharacterController.cpp ├── CharacterController.h ├── Engine.cpp ├── Engine.h ├── ParticleUpdater.cpp ├── ParticleUpdater.h ├── PhysicsUtil.cpp ├── PhysicsUtil.h ├── Vehicle.cpp ├── Vehicle.h ├── VehicleManager.cpp └── VehicleManager.h ├── tests ├── CMakeLists.txt ├── character_animation_test.cpp ├── character_controller_test.cpp ├── hello_physics_world_test.cpp ├── physics_heightfield_test.cpp ├── physics_vehicle_test.cpp ├── terrain_coords.h ├── x64 │ ├── dinput8.lib │ └── dxguid.lib └── x86 │ ├── dinput8.lib │ └── dxguid.lib └── utils ├── CMakeLists.txt ├── FollowNodeManipulator.cpp ├── FollowNodeManipulator.h ├── InputManager.cpp ├── InputManager.h ├── PlayerAnimation.cpp ├── PlayerAnimation.h ├── SceneUtil.cpp ├── SceneUtil.h ├── ois ├── OIS.h ├── OISConfig.h ├── OISEffect.cpp ├── OISEffect.h ├── OISEvents.h ├── OISException.cpp ├── OISException.h ├── OISFactoryCreator.h ├── OISForceFeedback.cpp ├── OISForceFeedback.h ├── OISInputManager.cpp ├── OISInputManager.h ├── OISInterface.h ├── OISJoyStick.cpp ├── OISJoyStick.h ├── OISKeyboard.cpp ├── OISKeyboard.h ├── OISMouse.h ├── OISMultiTouch.h ├── OISObject.cpp ├── OISObject.h ├── OISPrereqs.h ├── SDL │ ├── SDLInputManager.cpp │ ├── SDLInputManager.h │ ├── SDLJoyStick.cpp │ ├── SDLJoyStick.h │ ├── SDLKeyboard.cpp │ ├── SDLKeyboard.h │ ├── SDLMouse.cpp │ ├── SDLMouse.h │ └── SDLPrereqs.h ├── extras │ └── LIRC │ │ ├── OISLIRC.cpp │ │ ├── OISLIRC.h │ │ ├── OISLIRCFactoryCreator.cpp │ │ ├── OISLIRCFactoryCreator.h │ │ └── OISLIRCRingBuffer.h ├── iphone │ ├── iPhoneAccelerometer.h │ ├── iPhoneAccelerometer.mm │ ├── iPhoneHelpers.h │ ├── iPhoneInputManager.h │ ├── iPhoneInputManager.mm │ ├── iPhoneMultiTouch.h │ ├── iPhoneMultiTouch.mm │ └── iPhonePrereqs.h ├── linux │ ├── EventHelpers.cpp │ ├── EventHelpers.h │ ├── LinuxForceFeedback.cpp │ ├── LinuxForceFeedback.h │ ├── LinuxInputManager.cpp │ ├── LinuxInputManager.h │ ├── LinuxJoyStickEvents.cpp │ ├── LinuxJoyStickEvents.h │ ├── LinuxKeyboard.cpp │ ├── LinuxKeyboard.h │ ├── LinuxMouse.cpp │ ├── LinuxMouse.h │ └── LinuxPrereqs.h ├── mac │ ├── CocoaHelpers.h │ ├── CocoaInputManager.h │ ├── CocoaInputManager.mm │ ├── CocoaJoyStick.h │ ├── CocoaJoyStick.mm │ ├── CocoaKeyboard.h │ ├── CocoaKeyboard.mm │ ├── CocoaMouse.h │ ├── CocoaMouse.mm │ ├── MacHIDManager.cpp │ ├── MacHIDManager.h │ ├── MacHelpers.cpp │ ├── MacHelpers.h │ ├── MacInputManager.cpp │ ├── MacInputManager.h │ ├── MacJoyStick.cpp │ ├── MacJoyStick.h │ ├── MacKeyboard.cpp │ ├── MacKeyboard.h │ ├── MacMouse.cpp │ ├── MacMouse.h │ └── MacPrereqs.h └── win32 │ ├── Win32ForceFeedback.cpp │ ├── Win32ForceFeedback.h │ ├── Win32InputManager.cpp │ ├── Win32InputManager.h │ ├── Win32JoyStick.cpp │ ├── Win32JoyStick.h │ ├── Win32KeyBoard.cpp │ ├── Win32KeyBoard.h │ ├── Win32Mouse.cpp │ ├── Win32Mouse.h │ ├── Win32Prereqs.h │ └── extras │ └── WiiMote │ ├── OISWiiMote.cpp │ ├── OISWiiMote.h │ ├── OISWiiMoteFactoryCreator.cpp │ ├── OISWiiMoteFactoryCreator.h │ ├── OISWiiMoteForceFeedback.cpp │ ├── OISWiiMoteForceFeedback.h │ ├── OISWiiMoteRingBuffer.cpp │ ├── OISWiiMoteRingBuffer.h │ ├── hiddevice.cpp │ ├── hiddevice.h │ ├── main.cpp │ ├── wiimote.cpp │ └── wiimote.h └── ozz ├── animation ├── offline │ ├── additive_animation_builder.cc │ ├── additive_animation_builder.h │ ├── animation_builder.cc │ ├── animation_builder.h │ ├── animation_optimizer.cc │ ├── animation_optimizer.h │ ├── decimate.h │ ├── fbx │ │ ├── CMakeLists.txt │ │ ├── fbx.cc │ │ ├── fbx.h │ │ ├── fbx2ozz.cc │ │ ├── fbx2ozz.h │ │ ├── fbx2ozz_anim.cc │ │ ├── fbx2ozz_skel.cc │ │ ├── fbx_animation.cc │ │ ├── fbx_animation.h │ │ ├── fbx_skeleton.cc │ │ └── fbx_skeleton.h │ ├── gltf │ │ ├── CMakeLists.txt │ │ ├── extern │ │ │ ├── json.hpp │ │ │ └── tiny_gltf.h │ │ └── gltf2ozz.cc │ ├── raw_animation.cc │ ├── raw_animation.h │ ├── raw_animation_archive.cc │ ├── raw_animation_utils.cc │ ├── raw_animation_utils.h │ ├── raw_skeleton.cc │ ├── raw_skeleton.h │ ├── raw_skeleton_archive.cc │ ├── raw_track.cc │ ├── raw_track.h │ ├── skeleton_builder.cc │ ├── skeleton_builder.h │ ├── tools │ │ ├── CMakeLists.txt │ │ ├── dump2ozz.cc │ │ ├── import2ozz.cc │ │ ├── import2ozz.h │ │ ├── import2ozz_anim.cc │ │ ├── import2ozz_anim.h │ │ ├── import2ozz_config.cc │ │ ├── import2ozz_config.h │ │ ├── import2ozz_skel.cc │ │ ├── import2ozz_skel.h │ │ ├── import2ozz_track.cc │ │ ├── import2ozz_track.h │ │ └── reference.json │ ├── track_builder.cc │ ├── track_builder.h │ ├── track_optimizer.cc │ └── track_optimizer.h └── runtime │ ├── animation.cc │ ├── animation.h │ ├── animation_keyframe.h │ ├── animation_utils.cc │ ├── animation_utils.h │ ├── blending_job.cc │ ├── blending_job.h │ ├── ik_aim_job.cc │ ├── ik_aim_job.h │ ├── ik_two_bone_job.cc │ ├── ik_two_bone_job.h │ ├── local_to_model_job.cc │ ├── local_to_model_job.h │ ├── sampling_job.cc │ ├── sampling_job.h │ ├── skeleton.cc │ ├── skeleton.h │ ├── skeleton_utils.cc │ ├── skeleton_utils.h │ ├── track.cc │ ├── track.h │ ├── track_sampling_job.cc │ ├── track_sampling_job.h │ ├── track_triggering_job.cc │ ├── track_triggering_job.h │ └── track_triggering_job_trait.h ├── base ├── containers │ ├── deque.h │ ├── intrusive_list.h │ ├── list.h │ ├── map.h │ ├── queue.h │ ├── set.h │ ├── stack.h │ ├── std_allocator.h │ ├── string.h │ ├── string_archive.cc │ ├── string_archive.h │ ├── unordered_map.h │ ├── unordered_set.h │ ├── vector.h │ └── vector_archive.h ├── endianness.h ├── gtest_helper.h ├── io │ ├── archive.cc │ ├── archive.h │ ├── archive_traits.h │ ├── stream.cc │ └── stream.h ├── log.cc ├── log.h ├── maths │ ├── box.cc │ ├── box.h │ ├── gtest_math_helper.h │ ├── internal │ │ ├── simd_math_config.h │ │ ├── simd_math_ref-inl.h │ │ └── simd_math_sse-inl.h │ ├── math_archive.cc │ ├── math_archive.h │ ├── math_constant.h │ ├── math_ex.h │ ├── quaternion.h │ ├── rect.h │ ├── simd_math.cc │ ├── simd_math.h │ ├── simd_math_archive.cc │ ├── simd_math_archive.h │ ├── simd_quaternion.h │ ├── soa_float.h │ ├── soa_float4x4.h │ ├── soa_math_archive.cc │ ├── soa_math_archive.h │ ├── soa_quaternion.h │ ├── soa_transform.h │ ├── transform.h │ └── vec_float.h ├── memory │ ├── allocator.cc │ ├── allocator.h │ └── unique_ptr.h ├── platform.cc ├── platform.h └── span.h ├── geometry └── runtime │ ├── skinning_job.cc │ └── skinning_job.h ├── mesh.cc ├── mesh.h ├── options ├── options.cc └── options.h └── tools ├── data ├── exo_gray.fbx ├── exo_gray.mesh.ozz ├── exo_gray.mesh.ozz.mat ├── exo_gray.skeleton.ozz ├── exo_gray@be_hit.fbx ├── exo_gray@be_hit.ozz ├── exo_gray@crouch.fbx ├── exo_gray@crouch.ozz ├── exo_gray@dying.fbx ├── exo_gray@dying.ozz ├── exo_gray@dying_backwards.fbx ├── exo_gray@dying_backwards.ozz ├── exo_gray@idle.fbx ├── exo_gray@idle.ozz ├── exo_gray@jumping.fbx ├── exo_gray@jumping.ozz ├── exo_gray@pistol_aiming.fbx ├── exo_gray@pistol_aiming.ozz ├── exo_gray@running.fbx ├── exo_gray@running.ozz ├── exo_gray@say_hello.fbx ├── exo_gray@say_hello.ozz ├── exo_gray@shooting.fbx ├── exo_gray@shooting.ozz ├── exo_gray@tpose.ozz ├── exo_gray@walking.fbx └── exo_gray@walking.ozz ├── fbx2mesh.exe ├── fbx2ozz.exe └── gltf2ozz.exe /.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | /sdk 3 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 Rui Wang 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | osgPhysX 2 | ============= 3 | 4 | The osgPhysX project focuses on the integration of OpenSceneGraph and NVIDIA PhysX. The main purpose 5 | is to integrate and demonstrate physics-based rigid, soft bodies, clothes, particles and vehicles in 6 | 3D scene, all of which are well supported by the powerful PhysX engine. 7 | 8 | ------------ 9 | Installation 10 | ------------ 11 | 12 | 0. Dependencies 13 | * OpenSceneGraph (version 3.0 or later): http://www.openscenegraph.com 14 | * NVIDIA PhysX (version 3.3 or later): http://developer.nvidia.com/physx-downloads 15 | * DirectX SDK (for DirectInput to work, which is used by the internal OIS library for buffered inputs) 16 | 17 | 1. Use CMake (or cmake-gui) to build makefiles or solutions 18 | # cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX= 19 | 20 | 2. Run 'make' to build and install all recipes 21 | # make 22 | # make install 23 | 24 | 3. Have fun! 25 | 26 | ------------ 27 | Examples 28 | ------------ 29 | 30 | character_controller_test: 31 | Move a character on complex ground and environment, which is useful in FPS games and simulations. 32 | Press '2' to change to first-person mode first, and press Ctrl + mouse dragging to walk. 33 | 34 | physics_vehicle_test: 35 | Move a 4-wheel vehicle on complex ground and environment. Also shows how to create simple physics boxes 36 | and particles. Use arrow keys to move the vehicle and see how the racing engine works. 37 | 38 | ------------ 39 | Contributing 40 | ------------ 41 | 42 | Any suggestions and contributions are welcomed all the time. :-) 43 | -------------------------------------------------------------------------------- /cmake/FindPhysX3.cmake: -------------------------------------------------------------------------------- 1 | FIND_PATH(PHYSX_SDK_ROOT Include/PxPhysicsAPI.h 2 | PATHS 3 | $ENV{PATH} 4 | /usr/include/ 5 | /usr/local/include/ 6 | ) 7 | 8 | FIND_PATH(PHYSX_SHARED_INCLUDE_DIR foundation/Px.h PATHS ${PHYSX_SDK_ROOT}/../PxShared/include) 9 | FIND_PATH(PHYSX_INCLUDE_DIR PxPhysicsAPI.h PATHS ${PHYSX_SDK_ROOT}/Include) 10 | 11 | SET(PHYSX_LIBPATH_PREFIX vc15win64 CACHE STRING "Compiler prefix (e.g. vc15win64)") 12 | SET(PHYSX_LIBNAME_POSTFIX _x86) 13 | IF(CMAKE_CL_64) 14 | SET(PHYSX_LIBNAME_POSTFIX _x64) 15 | ENDIF(CMAKE_CL_64) 16 | 17 | MACRO(FIND_PHYSX_SHARED_LIBRARY VARNAME LIBNAME WITHPOSTFIX) 18 | 19 | SET(LIBPOSTFIX "") 20 | IF(${WITHPOSTFIX}) 21 | SET(LIBPOSTFIX ${PHYSX_LIBNAME_POSTFIX}) 22 | ENDIF(${WITHPOSTFIX}) 23 | FIND_LIBRARY(PHYSX_${VARNAME}_LIBRARY NAMES ${LIBNAME}${LIBPOSTFIX} 24 | PATHS ${PHYSX_SDK_ROOT}/../PxShared/lib/${PHYSX_LIBPATH_PREFIX}) 25 | FIND_LIBRARY(PHYSX_${VARNAME}_LIBRARY_DEBUG NAMES ${LIBNAME}DEBUG${LIBPOSTFIX} 26 | PATHS ${PHYSX_SDK_ROOT}/../PxShared/lib/${PHYSX_LIBPATH_PREFIX}) 27 | 28 | ENDMACRO(FIND_PHYSX_SHARED_LIBRARY VARNAME LIBNAME) 29 | 30 | MACRO(FIND_PHYSX_LIBRARY VARNAME LIBNAME WITHPOSTFIX) 31 | 32 | SET(LIBPOSTFIX "") 33 | IF(${WITHPOSTFIX}) 34 | SET(LIBPOSTFIX ${PHYSX_LIBNAME_POSTFIX}) 35 | ENDIF(${WITHPOSTFIX}) 36 | FIND_LIBRARY(PHYSX_${VARNAME}_LIBRARY NAMES ${LIBNAME}${LIBPOSTFIX} 37 | PATHS ${PHYSX_SDK_ROOT}/Lib/${PHYSX_LIBPATH_PREFIX}) 38 | FIND_LIBRARY(PHYSX_${VARNAME}_LIBRARY_DEBUG NAMES ${LIBNAME}DEBUG${LIBPOSTFIX} 39 | PATHS ${PHYSX_SDK_ROOT}/Lib/${PHYSX_LIBPATH_PREFIX}) 40 | 41 | ENDMACRO(FIND_PHYSX_LIBRARY VARNAME LIBNAME) 42 | 43 | FIND_PHYSX_LIBRARY(CORE PhysX3 1) 44 | FIND_PHYSX_LIBRARY(COMMON PhysX3Common 1) 45 | FIND_PHYSX_LIBRARY(COOKING PhysX3Cooking 1) 46 | FIND_PHYSX_LIBRARY(CHARACTER PhysX3CharacterKinematic 1) 47 | FIND_PHYSX_LIBRARY(EXTENSIONS PhysX3Extensions 0) 48 | FIND_PHYSX_LIBRARY(VEHICLE PhysX3Vehicle 0) 49 | FIND_PHYSX_SHARED_LIBRARY(FOUNDATION PxFoundation 1) 50 | FIND_PHYSX_SHARED_LIBRARY(TASK PxTask 1) 51 | FIND_PHYSX_SHARED_LIBRARY(DEBUGGER PxPvdSDK 1) 52 | 53 | SET(PHYSX_FOUND "NO") 54 | IF(PHYSX_INCLUDE_DIR AND PHYSX_CORE_LIBRARY) 55 | SET(PHYSX_FOUND "YES") 56 | SET(PHYSX_LIBRARIES 57 | debug ${PHYSX_CORE_LIBRARY_DEBUG} optimized ${PHYSX_CORE_LIBRARY} 58 | debug ${PHYSX_COMMON_LIBRARY_DEBUG} optimized ${PHYSX_COMMON_LIBRARY} 59 | debug ${PHYSX_COOKING_LIBRARY_DEBUG} optimized ${PHYSX_COOKING_LIBRARY} 60 | debug ${PHYSX_CHARACTER_LIBRARY_DEBUG} optimized ${PHYSX_CHARACTER_LIBRARY} 61 | debug ${PHYSX_EXTENSIONS_LIBRARY_DEBUG} optimized ${PHYSX_EXTENSIONS_LIBRARY} 62 | debug ${PHYSX_VEHICLE_LIBRARY_DEBUG} optimized ${PHYSX_VEHICLE_LIBRARY} 63 | debug ${PHYSX_FOUNDATION_LIBRARY_DEBUG} optimized ${PHYSX_FOUNDATION_LIBRARY} 64 | debug ${PHYSX_TASK_LIBRARY_DEBUG} optimized ${PHYSX_TASK_LIBRARY} 65 | debug ${PHYSX_DEBUGGER_LIBRARY_DEBUG} optimized ${PHYSX_DEBUGGER_LIBRARY} 66 | ) 67 | ENDIF(PHYSX_INCLUDE_DIR AND PHYSX_CORE_LIBRARY) 68 | -------------------------------------------------------------------------------- /physics/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | SET(LIBRARY_NAME osgPhysics) 2 | 3 | SET(HEADER_FILES 4 | Callbacks.h 5 | CharacterController.h 6 | Engine.h 7 | ParticleUpdater.h 8 | PhysicsUtil.h 9 | Vehicle.h 10 | VehicleManager.h 11 | ) 12 | 13 | SET(LIBRARY_FILES 14 | Callbacks.cpp 15 | CharacterController.cpp 16 | Engine.cpp 17 | ParticleUpdater.cpp 18 | PhysicsUtil.cpp 19 | Vehicle.cpp 20 | VehicleManager.cpp 21 | ${HEADER_FILES} 22 | ) 23 | 24 | START_LIBRARY(STATIC) 25 | -------------------------------------------------------------------------------- /physics/Engine.h: -------------------------------------------------------------------------------- 1 | #ifndef PHYSICS_ENGINE 2 | #define PHYSICS_ENGINE 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | #if PX_PHYSICS_VERSION_MAJOR==3 && PX_PHYSICS_VERSION_MINOR==4 11 | // 12 | #else 13 | # error "Unsupport PhysX version" 14 | #endif 15 | 16 | namespace osgPhysics 17 | { 18 | 19 | /** The engine instance to be used globally */ 20 | class Engine : public osg::Referenced 21 | { 22 | public: 23 | static Engine* instance(); 24 | static bool startWithPVD; 25 | 26 | physx::PxPhysics* getPhysicsSDK() { return _physicsSDK; } 27 | const physx::PxPhysics* getPhysicsSDK() const { return _physicsSDK; } 28 | 29 | physx::PxMaterial* getDefaultMaterial() { return _defaultMaterial; } 30 | const physx::PxMaterial* getDefaultMaterial() const { return _defaultMaterial; } 31 | 32 | /** Add scene to the engine */ 33 | bool addScene(const std::string& name, physx::PxScene* s); 34 | bool removeScene(const std::string& name, bool doRelease); 35 | 36 | physx::PxScene* getScene(const std::string& name); 37 | const physx::PxScene* getScene(const std::string& name) const; 38 | 39 | typedef std::map SceneMap; 40 | SceneMap& getSceneMap() { return _sceneMap; } 41 | const SceneMap& getSceneMap() const { return _sceneMap; } 42 | 43 | /** Add actor object to specified scene */ 44 | bool addActor(const std::string& scene, physx::PxActor* actor); 45 | bool addActor(const std::string& scene, physx::PxRigidActor* actor, const physx::PxFilterData& filter); 46 | bool addActor(const std::string& scene, physx::PxParticleBase* ps, const physx::PxFilterData& filter); 47 | bool removeActor(const std::string& scene, physx::PxActor* actor); 48 | 49 | typedef std::vector ActorList; 50 | typedef std::map ActorMap; 51 | ActorMap& getAllActors() { return _actorMap; } 52 | const ActorMap& getAllActors() const { return _actorMap; } 53 | 54 | /** Get or create a new cooking object */ 55 | physx::PxCooking* getOrCreateCooking(physx::PxCookingParams* params = 0, bool forceCreating = false); 56 | 57 | /** Get or create a new CUDA context manager */ 58 | physx::PxCudaContextManager* getOrCreateCudaContextManager( 59 | physx::PxCudaContextManagerDesc* desc = 0, bool forceCreating = false); 60 | 61 | /** Update the physics system every frame */ 62 | void update(double step); 63 | 64 | /** Clear all saved data */ 65 | void clear(); 66 | 67 | protected: 68 | Engine(); 69 | virtual ~Engine(); 70 | 71 | void releaseActors(physx::PxScene* scene); 72 | 73 | SceneMap _sceneMap; 74 | ActorMap _actorMap; 75 | physx::PxPhysics* _physicsSDK; 76 | physx::PxMaterial* _defaultMaterial; 77 | physx::PxCooking* _cooking; 78 | physx::PxCudaContextManager* _cudaManager; 79 | physx::PxPvdTransport* _pvdTransport; 80 | physx::PxPvd* _pvd; 81 | }; 82 | 83 | } 84 | 85 | #endif 86 | -------------------------------------------------------------------------------- /tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | LINK_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) 2 | IF(WIN32) 3 | IF(CMAKE_CL_64) 4 | LINK_DIRECTORIES(x64) 5 | ELSE(CMAKE_CL_64) 6 | LINK_DIRECTORIES(x86) 7 | ENDIF(CMAKE_CL_64) 8 | SET(THIRD_PARTY_LIBRARIES ${THIRD_PARTY_LIBRARIES} ws2_32 dinput8 dxguid) 9 | ENDIF(WIN32) 10 | 11 | # Basic rigid bodies 12 | SET(EXECUTABLE_NAME hello_physics_world) 13 | SET(EXECUTABLE_FILES hello_physics_world_test.cpp) 14 | SET(EXTERNAL_LIBRARIES osgPhysics osgPhysicsUtils ${THIRD_PARTY_LIBRARIES}) 15 | START_EXECUTABLE() 16 | 17 | # Height field with materials 18 | SET(EXECUTABLE_NAME physics_heightfield) 19 | SET(EXECUTABLE_FILES physics_heightfield_test.cpp) 20 | SET(EXTERNAL_LIBRARIES osgPhysics osgPhysicsUtils ${THIRD_PARTY_LIBRARIES}) 21 | START_EXECUTABLE() 22 | 23 | # Character control 24 | SET(EXECUTABLE_NAME character_controller) 25 | SET(EXECUTABLE_FILES character_controller_test.cpp) 26 | SET(EXTERNAL_LIBRARIES osgPhysics osgPhysicsUtils ${THIRD_PARTY_LIBRARIES}) 27 | START_EXECUTABLE() 28 | 29 | SET(EXECUTABLE_NAME character_animation) 30 | SET(EXECUTABLE_FILES character_animation_test.cpp) 31 | SET(EXTERNAL_LIBRARIES osgPhysics osgPhysicsUtils ${THIRD_PARTY_LIBRARIES}) 32 | START_EXECUTABLE() 33 | 34 | # Wheeled vehicle control 35 | SET(EXECUTABLE_NAME physics_vehicle) 36 | SET(EXECUTABLE_FILES physics_vehicle_test.cpp) 37 | SET(EXTERNAL_LIBRARIES osgPhysics osgPhysicsUtils ${THIRD_PARTY_LIBRARIES}) 38 | START_EXECUTABLE() 39 | -------------------------------------------------------------------------------- /tests/x64/dinput8.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xarray/osgPhysX/0996bc0bac46e46f4dc09990be0d6750ac369f55/tests/x64/dinput8.lib -------------------------------------------------------------------------------- /tests/x64/dxguid.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xarray/osgPhysX/0996bc0bac46e46f4dc09990be0d6750ac369f55/tests/x64/dxguid.lib -------------------------------------------------------------------------------- /tests/x86/dinput8.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xarray/osgPhysX/0996bc0bac46e46f4dc09990be0d6750ac369f55/tests/x86/dinput8.lib -------------------------------------------------------------------------------- /tests/x86/dxguid.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xarray/osgPhysX/0996bc0bac46e46f4dc09990be0d6750ac369f55/tests/x86/dxguid.lib -------------------------------------------------------------------------------- /utils/FollowNodeManipulator.cpp: -------------------------------------------------------------------------------- 1 | #include "FollowNodeManipulator.h" 2 | #include 3 | #include 4 | 5 | using namespace osgPhysicsUtils; 6 | 7 | FollowNodeManipulator::FollowNodeManipulator(int flags) 8 | : osgGA::FirstPersonManipulator(flags), _fixedRotation(false) 9 | { 10 | } 11 | 12 | void FollowNodeManipulator::yaw(double dx) 13 | { 14 | osg::CoordinateFrame coordinateFrame = getCoordinateFrame(_eye); 15 | osg::Vec3d localUp = getUpVector(coordinateFrame); 16 | rotateYawPitch(_rotation, dx, 0.0, localUp); 17 | } 18 | 19 | void FollowNodeManipulator::pitch(double dy) 20 | { 21 | osg::CoordinateFrame coordinateFrame = getCoordinateFrame(_eye); 22 | osg::Vec3d localUp = getUpVector(coordinateFrame); 23 | rotateYawPitch(_rotation, 0.0, dy, localUp); 24 | } 25 | 26 | bool FollowNodeManipulator::handleFrame(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa) 27 | { 28 | osg::Matrix matrix; 29 | if (_trackNode.valid()) 30 | { 31 | matrix = _trackNode->getWorldMatrices()[0]; 32 | } 33 | else if (_trackDrawable.valid()) 34 | { 35 | osg::Node* node = _trackDrawable->getNumParents() > 0 ? _trackDrawable->getParent(0) : NULL; 36 | matrix = osg::Matrix::translate(_trackDrawable->getBound().center()); 37 | if (node) matrix *= node->getWorldMatrices()[0]; 38 | } 39 | 40 | if (_fixedRotation) 41 | { 42 | osg::CoordinateFrame coordinateFrame = getCoordinateFrame(_eye); 43 | osg::Vec3d localUp = getUpVector(coordinateFrame); 44 | osg::Vec3d pos = _centerOffset * matrix; 45 | setTransformation(_offset * matrix, pos, localUp); 46 | } 47 | else 48 | _eye = _offset * matrix; 49 | return osgGA::FirstPersonManipulator::handleFrame(ea, aa); 50 | } 51 | 52 | bool FollowNodeManipulator::handleMouseMove(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa) 53 | { 54 | return osgGA::FirstPersonManipulator::handleMouseMove(ea, aa); 55 | } 56 | -------------------------------------------------------------------------------- /utils/FollowNodeManipulator.h: -------------------------------------------------------------------------------- 1 | #ifndef CORE_FOLLOWNODEMANIPULATOR 2 | #define CORE_FOLLOWNODEMANIPULATOR 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | namespace osgPhysicsUtils 10 | { 11 | 12 | /** The first-person manipulator to track a node and place the eye at the node center */ 13 | class FollowNodeManipulator : public osgGA::FirstPersonManipulator 14 | { 15 | public: 16 | FollowNodeManipulator(int flags = DEFAULT_SETTINGS); 17 | 18 | /** Set the offset of the eye */ 19 | void setLocalOffset(const osg::Vec3& o) { _offset = o; } 20 | const osg::Vec3& getLocalOffset() const { return _offset; } 21 | 22 | /** Set the offset of the tracker center */ 23 | void setLocalCenterOffset(const osg::Vec3& o) { _centerOffset = o; } 24 | const osg::Vec3& getLocalCenterOffset() const { return _centerOffset; } 25 | 26 | /** Set node to track */ 27 | void setTrackNode(osg::Node* node) { _trackNode = node; } 28 | osg::Node* getTrackNode() { return _trackNode.get(); } 29 | const osg::Node* getTrackNode() const { return _trackNode.get(); } 30 | 31 | /** Set drawable to track */ 32 | void setTrackDrawable(osg::Drawable* d) { _trackDrawable = d; } 33 | osg::Drawable* getTrackDrawable() { return _trackDrawable.get(); } 34 | const osg::Drawable* getTrackDrawable() const { return _trackDrawable.get(); } 35 | 36 | /** Set fixed rotation for driving simulation etc. */ 37 | void setFixedRotation(bool b) { _fixedRotation = b; } 38 | bool getFixedRotation() const { return _fixedRotation; } 39 | 40 | void yaw(double dx); 41 | void pitch(double dy); 42 | 43 | virtual bool handleFrame(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa); 44 | virtual bool handleMouseMove(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa); 45 | 46 | protected: 47 | osg::observer_ptr _trackNode; 48 | osg::observer_ptr _trackDrawable; 49 | osg::Vec3 _offset, _centerOffset; 50 | bool _fixedRotation; 51 | }; 52 | 53 | } 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /utils/InputManager.h: -------------------------------------------------------------------------------- 1 | #ifndef CORE_INPUTMANAGER 2 | #define CORE_INPUTMANAGER 3 | 4 | #include 5 | #include 6 | 7 | namespace OIS 8 | { 9 | 10 | class InputManager; 11 | class Keyboard; 12 | class Mouse; 13 | class JoyStick; 14 | 15 | } 16 | 17 | namespace osgPhysicsUtils 18 | { 19 | 20 | class InputManager : public osg::Referenced 21 | { 22 | public: 23 | InputManager(); 24 | virtual ~InputManager(); 25 | 26 | bool initialize(osg::GraphicsContext* gc, const std::vector& params); 27 | void frame(); 28 | void resize(int width, int height); 29 | void destroy(); 30 | 31 | unsigned int getNumKeyboards() const { return _keyboards.size(); } 32 | unsigned int getNumMouses() const { return _mouses.size(); } 33 | unsigned int getNumJoySticks() const { return _joysticks.size(); } 34 | 35 | bool isKeyDown(int key, unsigned int index = 0) const; 36 | bool isModKeyDown(int modkey, unsigned int index = 0) const; 37 | 38 | osg::Vec3 getMouseCoordinate(unsigned int index = 0) const; 39 | int getMouseButton(unsigned int index = 0) const; 40 | 41 | // TODO: joystick handlers 42 | 43 | protected: 44 | OIS::InputManager* _inputManager; 45 | std::vector _keyboards; 46 | std::vector _mouses; 47 | std::vector _joysticks; 48 | }; 49 | 50 | } 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /utils/PlayerAnimation.h: -------------------------------------------------------------------------------- 1 | #ifndef CORE_PLAYERANIMATION 2 | #define CORE_PLAYERANIMATION 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | namespace osgPhysicsUtils 9 | { 10 | 11 | /** The player animation support class */ 12 | class PlayerAnimation : public osg::Referenced 13 | { 14 | public: 15 | typedef float (*SetJointWeightFunc)(int, int, void*); 16 | PlayerAnimation(); 17 | 18 | bool initialize(const std::string& skeleton, const std::string& mesh); 19 | bool loadAnimation(const std::string& key, const std::string& animation); 20 | void unloadAnimation(const std::string& key); 21 | 22 | bool update(const osg::FrameStamp& fs, bool paused); 23 | bool applyMeshes(osg::Geode& meshDataRoot, bool withSkinning); 24 | 25 | struct JointIkData { int joint; float weight; osg::Vec3 localUp; osg::Vec3 localForward; }; 26 | bool updateAimIK(const osg::Vec3& target, const std::vector& chain, 27 | const osg::Vec3& aimOffset = osg::Vec3(), const osg::Vec3& pole = osg::Y_AXIS); 28 | bool updateTwoBoneIK(const osg::Vec3& target, int start, int mid, int end, bool& reached, 29 | float weight = 1.0f, float soften = 1.0f, float twist = 0.0f, 30 | const osg::Vec3& midAxis = osg::Z_AXIS, const osg::Vec3& pole = osg::Y_AXIS); 31 | 32 | typedef std::pair ThisAndParent; 33 | std::vector getSkeletonIndices(int from = -1) const; 34 | std::string getSkeletonJointName(int joint) const; 35 | int getSkeletonJointIndex(const std::string& joint) const; 36 | 37 | void setModelSpaceJointMatrix(int joint, const osg::Matrix& m); 38 | osg::Matrix getModelSpaceJointMatrix(int joint) const; 39 | 40 | osg::BoundingBox computeSkeletonBounds() const; 41 | float getAnimationStartTime(const std::string& key); 42 | float getTimeRatio(const std::string& key) const; 43 | float getDuration(const std::string& key) const; 44 | 45 | float getPlaybackSpeed(const std::string& key) const; 46 | void setPlaybackSpeed(const std::string& key, float s); 47 | 48 | void select(const std::string& key, float weight, bool looping); 49 | void selectPartial(const std::string& key, float weight, bool looping, 50 | SetJointWeightFunc func, void* userData); 51 | void seek(const std::string& key, float timeRatio); 52 | 53 | protected: 54 | struct TextureData { std::map channels; }; 55 | std::vector _meshTextureList; 56 | osg::ref_ptr _internal; 57 | float _blendingThreshold; 58 | }; 59 | 60 | } 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /utils/SceneUtil.h: -------------------------------------------------------------------------------- 1 | #ifndef CORE_SCENEUTIL 2 | #define CORE_SCENEUTIL 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | namespace osgPhysicsUtils 13 | { 14 | 15 | /** Create a polar sphere (r1 = r2 = r3) or ellipsoid */ 16 | extern osg::Geometry* createEllipsoid(const osg::Vec3& center, float radius1, float radius2, 17 | float radius3, int samples = 32); 18 | 19 | /** Create a prism (n > 3) or cylinder (n is large enough) */ 20 | extern osg::Geometry* createPrism(const osg::Vec3& centerBottom, float radiusBottom, float radiusTop, 21 | float height, int n = 4, bool capped = true); 22 | 23 | /** Create a pyramid (n > 3) or cone (n is large enough) */ 24 | extern osg::Geometry* createPyramid(const osg::Vec3& centerBottom, float radius, float height, 25 | int n = 4, bool capped = false); 26 | 27 | /** Create a geode for specified geometry, just for convenience */ 28 | extern osg::Geode* createGeode(osg::Drawable* drawable, bool transparent = false); 29 | 30 | /** Create a quad node */ 31 | extern osg::Geode* createQuad(const osg::Vec3& corner, float width = 1.0f, float height = 1.0f, 32 | const osg::Vec4& uvRange = osg::Vec4(0.0f, 0.0f, 1.0f, 1.0f)); 33 | 34 | /** Create a textured quad node */ 35 | extern osg::Geode* createTexturedQuad(osg::Texture* texture, const osg::Vec3& corner, 36 | float width = 1.0f, float height = 1.0f, 37 | const osg::Vec4& uvRange = osg::Vec4(0.0f, 0.0f, 1.0f, 1.0f)); 38 | 39 | /** Create a text object on XOY plane */ 40 | extern osgText::Text* createText(const osg::Vec3& pos, const std::string& content, float size); 41 | 42 | /** Create an HUD camera with specified matrices */ 43 | extern osg::Camera* createHUDCamera(const osg::Matrix& view, const osg::Matrix& proj, 44 | bool unlighted = true, bool asBackground = false); 45 | 46 | /** Create an HUD camera on XOY plane */ 47 | inline osg::Camera* createHUDCamera(double left, double right, double bottom, double top, 48 | bool unlighted = true, bool asBackground = false) 49 | { 50 | return createHUDCamera(osg::Matrix(), osg::Matrix::ortho2D(left, right, bottom, top), 51 | unlighted, asBackground); 52 | } 53 | 54 | } 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /utils/ois/OIS.h: -------------------------------------------------------------------------------- 1 | /* 2 | The zlib/libpng License 3 | 4 | Copyright (c) 2018 Arthur Brainville 5 | Copyright (c) 2015 Andrew Fenn 6 | Copyright (c) 2005-2010 Phillip Castaneda (pjcast -- www.wreckedgames.com) 7 | 8 | This software is provided 'as-is', without any express or implied warranty. In no 9 | event will the authors be held liable for any damages arising from the use of this 10 | software. 11 | 12 | Permission is granted to anyone to use this software for any purpose, including 13 | commercial applications, and to alter it and redistribute it freely, subject to the 14 | following restrictions: 15 | 16 | 1. The origin of this software must not be misrepresented; you must not claim that 17 | you wrote the original software. If you use this software in a product, 18 | an acknowledgment in the product documentation would be appreciated 19 | but is not required. 20 | 21 | 2. Altered source versions must be plainly marked as such, and must not be 22 | misrepresented as being the original software. 23 | 24 | 3. This notice may not be removed or altered from any source distribution. 25 | */ 26 | 27 | /**\mainpage Object-oriented Input System 28 | * 29 | * Welcome to the documentation of OIS. 30 | * 31 | * 32 | * This website contains the documentation of the public API exposed by OIS. 33 | * 34 | * As the name of the library suggest, this is 100% Object-oriented. 35 | * Every C++ classes from the library is located inside the OIS namespace. 36 | * 37 | * This project is licensed under the terms of the zlib/libpng licence 38 | * 39 | */ 40 | 41 | #ifndef OIS_OISALL_H 42 | #define OIS_OISALL_H 43 | 44 | #include "OISPrereqs.h" 45 | #include "OISObject.h" 46 | #include "OISMouse.h" 47 | #include "OISKeyboard.h" 48 | #include "OISJoyStick.h" 49 | #include "OISMultiTouch.h" 50 | #include "OISInputManager.h" 51 | #include "OISFactoryCreator.h" 52 | #include "OISException.h" 53 | #include "OISEvents.h" 54 | 55 | #include "OISEffect.h" 56 | #include "OISInterface.h" 57 | #include "OISForceFeedback.h" 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /utils/ois/OISConfig.h: -------------------------------------------------------------------------------- 1 | /* 2 | The zlib/libpng License 3 | 4 | Copyright (c) 2018 Arthur Brainville 5 | Copyright (c) 2015 Andrew Fenn 6 | Copyright (c) 2005-2010 Phillip Castaneda (pjcast -- www.wreckedgames.com) 7 | 8 | This software is provided 'as-is', without any express or implied warranty. In no 9 | event will the authors be held liable for any damages arising from the use of this 10 | software. 11 | 12 | Permission is granted to anyone to use this software for any purpose, including 13 | commercial applications, and to alter it and redistribute it freely, subject to the 14 | following restrictions: 15 | 16 | 1. The origin of this software must not be misrepresented; you must not claim that 17 | you wrote the original software. If you use this software in a product, 18 | an acknowledgment in the product documentation would be appreciated 19 | but is not required. 20 | 21 | 2. Altered source versions must be plainly marked as such, and must not be 22 | misrepresented as being the original software. 23 | 24 | 3. This notice may not be removed or altered from any source distribution. 25 | */ 26 | #ifndef OIS_CONFIG_HEADER 27 | #define OIS_CONFIG_HEADER 28 | 29 | //----------------------------------------------------------------------------// 30 | //* This file contains defines for building certain parts of this Lib 31 | //* This file is not meant for External inclusion. However, you can edit this 32 | //* file before a build to effect what features are used internally 33 | //----------------------------------------------------------------------------// 34 | 35 | /** 36 | @remarks 37 | These lines have no bearing on internal build of OIS. This is here for 38 | external build settings. Meaning, changing this does not require a 39 | rebuild of OIS. This just affects VC dll import settings, as the DLL 40 | build already defines this during its build for setting dll exports. 41 | The undefine here is here just incase you decide to only use 42 | DLL, and want to set it permently and recompile OIS too.. Avoid redefinition 43 | from DLL build of OIS. 44 | 45 | So, if wanting to link against DLL version, just uncomment these lines. 46 | */ 47 | //#ifdef OIS_DYNAMIC_LIB 48 | //# undef OIS_DYNAMIC_LIB 49 | //#endif 50 | //#define OIS_DYNAMIC_LIB 51 | 52 | /** 53 | @remarks 54 | Build in support for LIRC / WinLIRC - remote control support. 55 | Requires Boost::asio 56 | @notes 57 | Experimental - Supports connecting and enumerating. Control does not 58 | yet return state or events 59 | */ 60 | //#define OIS_LIRC_SUPPORT 61 | 62 | /** 63 | @remarks 64 | Build in support for PC Nintendo WiiMote Win32 HID interface. 65 | Requires Boost::threads 66 | @notes 67 | Useable, but not quite finished - supports rumble, all buttons, & main orientation axis. 68 | Still needs Nunchuck, IR, and LED/Battery support. 69 | */ 70 | //#define OIS_WIN32_WIIMOTE_SUPPORT 71 | 72 | /** 73 | @remarks 74 | Build in support for Win32 XInput (Xbox 360 Controller) 75 | */ 76 | //#define OIS_WIN32_XINPUT_SUPPORT 77 | 78 | #endif 79 | -------------------------------------------------------------------------------- /utils/ois/OISEvents.h: -------------------------------------------------------------------------------- 1 | /* 2 | The zlib/libpng License 3 | 4 | Copyright (c) 2018 Arthur Brainville 5 | Copyright (c) 2015 Andrew Fenn 6 | Copyright (c) 2005-2010 Phillip Castaneda (pjcast -- www.wreckedgames.com) 7 | 8 | This software is provided 'as-is', without any express or implied warranty. In no 9 | event will the authors be held liable for any damages arising from the use of this 10 | software. 11 | 12 | Permission is granted to anyone to use this software for any purpose, including 13 | commercial applications, and to alter it and redistribute it freely, subject to the 14 | following restrictions: 15 | 16 | 1. The origin of this software must not be misrepresented; you must not claim that 17 | you wrote the original software. If you use this software in a product, 18 | an acknowledgment in the product documentation would be appreciated 19 | but is not required. 20 | 21 | 2. Altered source versions must be plainly marked as such, and must not be 22 | misrepresented as being the original software. 23 | 24 | 3. This notice may not be removed or altered from any source distribution. 25 | */ 26 | #ifndef _OIS_EVENTHEADERS_ 27 | #define _OIS_EVENTHEADERS_ 28 | #include "OISPrereqs.h" 29 | 30 | namespace OIS 31 | { 32 | /** 33 | Base class of all events 34 | */ 35 | class _OISExport EventArg 36 | { 37 | public: 38 | explicit EventArg(Object* obj) : 39 | device(obj) { } 40 | virtual ~EventArg() { } 41 | 42 | //! Pointer to the Input Device 43 | const Object* device; 44 | }; 45 | } 46 | 47 | #endif //_OIS_EVENTHEADERS_ 48 | -------------------------------------------------------------------------------- /utils/ois/OISException.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | The zlib/libpng License 3 | 4 | Copyright (c) 2018 Arthur Brainville 5 | Copyright (c) 2015 Andrew Fenn 6 | Copyright (c) 2005-2010 Phillip Castaneda (pjcast -- www.wreckedgames.com) 7 | 8 | This software is provided 'as-is', without any express or implied warranty. In no 9 | event will the authors be held liable for any damages arising from the use of this 10 | software. 11 | 12 | Permission is granted to anyone to use this software for any purpose, including 13 | commercial applications, and to alter it and redistribute it freely, subject to the 14 | following restrictions: 15 | 16 | 1. The origin of this software must not be misrepresented; you must not claim that 17 | you wrote the original software. If you use this software in a product, 18 | an acknowledgment in the product documentation would be appreciated 19 | but is not required. 20 | 21 | 2. Altered source versions must be plainly marked as such, and must not be 22 | misrepresented as being the original software. 23 | 24 | 3. This notice may not be removed or altered from any source distribution. 25 | */ 26 | #include "OISException.h" 27 | 28 | using namespace OIS; 29 | 30 | //----------------------------------------------------------------------------// 31 | const char* Exception::what() const throw() 32 | { 33 | return eText; 34 | } 35 | -------------------------------------------------------------------------------- /utils/ois/OISFactoryCreator.h: -------------------------------------------------------------------------------- 1 | /* 2 | The zlib/libpng License 3 | 4 | Copyright (c) 2018 Arthur Brainville 5 | Copyright (c) 2015 Andrew Fenn 6 | Copyright (c) 2005-2010 Phillip Castaneda (pjcast -- www.wreckedgames.com) 7 | 8 | This software is provided 'as-is', without any express or implied warranty. In no 9 | event will the authors be held liable for any damages arising from the use of this 10 | software. 11 | 12 | Permission is granted to anyone to use this software for any purpose, including 13 | commercial applications, and to alter it and redistribute it freely, subject to the 14 | following restrictions: 15 | 16 | 1. The origin of this software must not be misrepresented; you must not claim that 17 | you wrote the original software. If you use this software in a product, 18 | an acknowledgment in the product documentation would be appreciated 19 | but is not required. 20 | 21 | 2. Altered source versions must be plainly marked as such, and must not be 22 | misrepresented as being the original software. 23 | 24 | 3. This notice may not be removed or altered from any source distribution. 25 | */ 26 | #ifndef OIS_FactoryCreator_H 27 | #define OIS_FactoryCreator_H 28 | 29 | #include "OISPrereqs.h" 30 | 31 | namespace OIS 32 | { 33 | /** 34 | Interface for creating devices - all devices ultimately get enumerated/created via a factory. 35 | A factory can create multiple types of objects. 36 | */ 37 | class _OISExport FactoryCreator 38 | { 39 | public: 40 | /** 41 | @remarks Virtual Destructor 42 | */ 43 | virtual ~FactoryCreator() {}; 44 | 45 | /** 46 | @remarks Return a list of all unused devices the factory maintains 47 | */ 48 | virtual DeviceList freeDeviceList() = 0; 49 | 50 | /** 51 | @remarks Number of total devices of requested type 52 | @param iType Type of devices to check 53 | */ 54 | virtual int totalDevices(Type iType) = 0; 55 | 56 | /** 57 | @remarks Number of free devices of requested type 58 | @param iType Type of devices to check 59 | */ 60 | virtual int freeDevices(Type iType) = 0; 61 | 62 | /** 63 | @remarks Does a Type exist with the given vendor name 64 | @param iType Type to check 65 | @param vendor Vendor name to test 66 | */ 67 | virtual bool vendorExist(Type iType, const std::string& vendor) = 0; 68 | 69 | /** 70 | @remarks Creates the object 71 | @param iType Type to create 72 | @param bufferMode True to setup for buffered events 73 | @param vendor Create a device with the vendor name, "" means vendor name is unimportant 74 | */ 75 | virtual Object* createObject(InputManager* creator, Type iType, bool bufferMode, const std::string& vendor = "") = 0; 76 | 77 | /** 78 | @remarks Destroys object 79 | @param obj Object to destroy 80 | */ 81 | virtual void destroyObject(Object* obj) = 0; 82 | }; 83 | } 84 | #endif //OIS_FactoryCreator_H 85 | -------------------------------------------------------------------------------- /utils/ois/OISForceFeedback.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | The zlib/libpng License 3 | 4 | Copyright (c) 2018 Arthur Brainville 5 | Copyright (c) 2015 Andrew Fenn 6 | Copyright (c) 2005-2010 Phillip Castaneda (pjcast -- www.wreckedgames.com) 7 | 8 | This software is provided 'as-is', without any express or implied warranty. In no 9 | event will the authors be held liable for any damages arising from the use of this 10 | software. 11 | 12 | Permission is granted to anyone to use this software for any purpose, including 13 | commercial applications, and to alter it and redistribute it freely, subject to the 14 | following restrictions: 15 | 16 | 1. The origin of this software must not be misrepresented; you must not claim that 17 | you wrote the original software. If you use this software in a product, 18 | an acknowledgment in the product documentation would be appreciated 19 | but is not required. 20 | 21 | 2. Altered source versions must be plainly marked as such, and must not be 22 | misrepresented as being the original software. 23 | 24 | 3. This notice may not be removed or altered from any source distribution. 25 | */ 26 | #include "OISForceFeedback.h" 27 | #include "OISException.h" 28 | 29 | using namespace OIS; 30 | 31 | //-------------------------------------------------------------// 32 | ForceFeedback::ForceFeedback() : 33 | mSetGainSupport(false), mSetAutoCenterSupport(false) 34 | { 35 | } 36 | 37 | //-------------------------------------------------------------// 38 | void ForceFeedback::_addEffectTypes(Effect::EForce force, Effect::EType type) 39 | { 40 | if(force <= Effect::UnknownForce || force >= Effect::_ForcesNumber 41 | || type <= Effect::Unknown || type >= Effect::_TypesNumber) 42 | OIS_EXCEPT(E_General, "Can't add unknown effect Force/Type to the supported list"); 43 | 44 | mSupportedEffects.insert(std::pair(force, type)); 45 | } 46 | 47 | //-------------------------------------------------------------// 48 | void ForceFeedback::_setGainSupport(bool on) 49 | { 50 | mSetGainSupport = on; 51 | } 52 | 53 | //-------------------------------------------------------------// 54 | void ForceFeedback::_setAutoCenterSupport(bool on) 55 | { 56 | mSetAutoCenterSupport = on; 57 | } 58 | 59 | //-------------------------------------------------------------// 60 | const ForceFeedback::SupportedEffectList& ForceFeedback::getSupportedEffects() const 61 | { 62 | return mSupportedEffects; 63 | } 64 | 65 | //-------------------------------------------------------------// 66 | bool ForceFeedback::supportsEffect(Effect::EForce force, Effect::EType type) const 67 | { 68 | const std::pair 69 | iterRange = mSupportedEffects.equal_range(force); 70 | SupportedEffectList::const_iterator iter; 71 | for(iter = iterRange.first; iter != iterRange.second; iter++) 72 | { 73 | if((*iter).second == type) 74 | return true; 75 | } 76 | 77 | return false; 78 | } 79 | -------------------------------------------------------------------------------- /utils/ois/OISInterface.h: -------------------------------------------------------------------------------- 1 | /* 2 | The zlib/libpng License 3 | 4 | Copyright (c) 2018 Arthur Brainville 5 | Copyright (c) 2015 Andrew Fenn 6 | Copyright (c) 2005-2010 Phillip Castaneda (pjcast -- www.wreckedgames.com) 7 | 8 | This software is provided 'as-is', without any express or implied warranty. In no 9 | event will the authors be held liable for any damages arising from the use of this 10 | software. 11 | 12 | Permission is granted to anyone to use this software for any purpose, including 13 | commercial applications, and to alter it and redistribute it freely, subject to the 14 | following restrictions: 15 | 16 | 1. The origin of this software must not be misrepresented; you must not claim that 17 | you wrote the original software. If you use this software in a product, 18 | an acknowledgment in the product documentation would be appreciated 19 | but is not required. 20 | 21 | 2. Altered source versions must be plainly marked as such, and must not be 22 | misrepresented as being the original software. 23 | 24 | 3. This notice may not be removed or altered from any source distribution. 25 | */ 26 | #ifndef OIS_Interface_H 27 | #define OIS_Interface_H 28 | 29 | #include "OISPrereqs.h" 30 | 31 | namespace OIS 32 | { 33 | /** 34 | An Object's interface is a way to gain write access to devices which support 35 | it. For example, force feedack. 36 | */ 37 | class _OISExport Interface 38 | { 39 | public: 40 | virtual ~Interface() {}; 41 | 42 | //! Type of Interface 43 | enum IType { 44 | ForceFeedback, 45 | Reserved 46 | }; 47 | }; 48 | } 49 | #endif //OIS_Interface_H 50 | -------------------------------------------------------------------------------- /utils/ois/OISJoyStick.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | The zlib/libpng License 3 | 4 | Copyright (c) 2018 Arthur Brainville 5 | Copyright (c) 2015 Andrew Fenn 6 | Copyright (c) 2005-2010 Phillip Castaneda (pjcast -- www.wreckedgames.com) 7 | 8 | This software is provided 'as-is', without any express or implied warranty. In no 9 | event will the authors be held liable for any damages arising from the use of this 10 | software. 11 | 12 | Permission is granted to anyone to use this software for any purpose, including 13 | commercial applications, and to alter it and redistribute it freely, subject to the 14 | following restrictions: 15 | 16 | 1. The origin of this software must not be misrepresented; you must not claim that 17 | you wrote the original software. If you use this software in a product, 18 | an acknowledgment in the product documentation would be appreciated 19 | but is not required. 20 | 21 | 2. Altered source versions must be plainly marked as such, and must not be 22 | misrepresented as being the original software. 23 | 24 | 3. This notice may not be removed or altered from any source distribution. 25 | */ 26 | #include "OISJoyStick.h" 27 | 28 | using namespace OIS; 29 | 30 | //----------------------------------------------------------------------------// 31 | JoyStick::JoyStick(const std::string& vendor, bool buffered, int devID, InputManager* creator) : 32 | Object(vendor, OISJoyStick, buffered, devID, creator), 33 | mSliders(0), 34 | mPOVs(0), 35 | mListener(nullptr), 36 | mVector3Sensitivity(OIS_JOYSTICK_VECTOR3_DEFAULT) 37 | { 38 | } 39 | 40 | //----------------------------------------------------------------------------// 41 | int JoyStick::getNumberOfComponents(ComponentType cType) const 42 | { 43 | switch(cType) 44 | { 45 | case OIS_Button: return int(mState.mButtons.size()); 46 | case OIS_Axis: return int(mState.mAxes.size()); 47 | case OIS_Slider: return mSliders; 48 | case OIS_POV: return mPOVs; 49 | case OIS_Vector3: return int(mState.mVectors.size()); 50 | default: return 0; 51 | } 52 | } 53 | 54 | //----------------------------------------------------------------------------// 55 | void JoyStick::setVector3Sensitivity(float degrees) 56 | { 57 | mVector3Sensitivity = degrees; 58 | } 59 | 60 | //----------------------------------------------------------------------------// 61 | float JoyStick::getVector3Sensitivity() const 62 | { 63 | return mVector3Sensitivity; 64 | } 65 | 66 | //----------------------------------------------------------------------------// 67 | void JoyStick::setEventCallback(JoyStickListener* joyListener) 68 | { 69 | mListener = joyListener; 70 | } 71 | 72 | //----------------------------------------------------------------------------// 73 | JoyStickListener* JoyStick::getEventCallback() const 74 | { 75 | return mListener; 76 | } 77 | -------------------------------------------------------------------------------- /utils/ois/OISKeyboard.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | The zlib/libpng License 3 | 4 | Copyright (c) 2018 Arthur Brainville 5 | Copyright (c) 2015 Andrew Fenn 6 | Copyright (c) 2005-2010 Phillip Castaneda (pjcast -- www.wreckedgames.com) 7 | 8 | This software is provided 'as-is', without any express or implied warranty. In no 9 | event will the authors be held liable for any damages arising from the use of this 10 | software. 11 | 12 | Permission is granted to anyone to use this software for any purpose, including 13 | commercial applications, and to alter it and redistribute it freely, subject to the 14 | following restrictions: 15 | 16 | 1. The origin of this software must not be misrepresented; you must not claim that 17 | you wrote the original software. If you use this software in a product, 18 | an acknowledgment in the product documentation would be appreciated 19 | but is not required. 20 | 21 | 2. Altered source versions must be plainly marked as such, and must not be 22 | misrepresented as being the original software. 23 | 24 | 3. This notice may not be removed or altered from any source distribution. 25 | */ 26 | #include "OISKeyboard.h" 27 | #include "OISException.h" 28 | 29 | using namespace OIS; 30 | 31 | //----------------------------------------------------------------------// 32 | void Keyboard::setTextTranslation(TextTranslationMode mode) 33 | { 34 | mTextMode = mode; 35 | } 36 | 37 | //----------------------------------------------------------------------// 38 | bool Keyboard::isModifierDown(Modifier mod) const 39 | { 40 | #if defined(OIS_MSVC_COMPILER) 41 | #pragma warning(push) 42 | #pragma warning(disable : 4800) 43 | #endif 44 | return (mModifiers & mod); 45 | #if defined(OIS_MSVC_COMPILER) 46 | #pragma warning(pop) 47 | #endif 48 | } 49 | 50 | //----------------------------------------------------------------------// 51 | unsigned int Keyboard::getModifiers() const 52 | { 53 | return mModifiers; 54 | } 55 | -------------------------------------------------------------------------------- /utils/ois/OISObject.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | The zlib/libpng License 3 | 4 | Copyright (c) 2018 Arthur Brainville 5 | Copyright (c) 2015 Andrew Fenn 6 | Copyright (c) 2005-2010 Phillip Castaneda (pjcast -- www.wreckedgames.com) 7 | 8 | This software is provided 'as-is', without any express or implied warranty. In no 9 | event will the authors be held liable for any damages arising from the use of this 10 | software. 11 | 12 | Permission is granted to anyone to use this software for any purpose, including 13 | commercial applications, and to alter it and redistribute it freely, subject to the 14 | following restrictions: 15 | 16 | 1. The origin of this software must not be misrepresented; you must not claim that 17 | you wrote the original software. If you use this software in a product, 18 | an acknowledgment in the product documentation would be appreciated 19 | but is not required. 20 | 21 | 2. Altered source versions must be plainly marked as such, and must not be 22 | misrepresented as being the original software. 23 | 24 | 3. This notice may not be removed or altered from any source distribution. 25 | */ 26 | //#include "OISObject.h" 27 | -------------------------------------------------------------------------------- /utils/ois/OISObject.h: -------------------------------------------------------------------------------- 1 | /* 2 | The zlib/libpng License 3 | 4 | Copyright (c) 2018 Arthur Brainville 5 | Copyright (c) 2015 Andrew Fenn 6 | Copyright (c) 2005-2010 Phillip Castaneda (pjcast -- www.wreckedgames.com) 7 | 8 | This software is provided 'as-is', without any express or implied warranty. In no 9 | event will the authors be held liable for any damages arising from the use of this 10 | software. 11 | 12 | Permission is granted to anyone to use this software for any purpose, including 13 | commercial applications, and to alter it and redistribute it freely, subject to the 14 | following restrictions: 15 | 16 | 1. The origin of this software must not be misrepresented; you must not claim that 17 | you wrote the original software. If you use this software in a product, 18 | an acknowledgment in the product documentation would be appreciated 19 | but is not required. 20 | 21 | 2. Altered source versions must be plainly marked as such, and must not be 22 | misrepresented as being the original software. 23 | 24 | 3. This notice may not be removed or altered from any source distribution. 25 | */ 26 | #ifndef OIS_Object_H 27 | #define OIS_Object_H 28 | 29 | #include "OISPrereqs.h" 30 | #include "OISInterface.h" 31 | 32 | namespace OIS 33 | { 34 | /** The base class of all input types. */ 35 | class _OISExport Object 36 | { 37 | public: 38 | virtual ~Object() { } 39 | 40 | /** @remarks Get the type of device */ 41 | Type type() const { return mType; } 42 | 43 | /** @remarks Get the vender string name */ 44 | const std::string& vendor() const { return mVendor; } 45 | 46 | /** @remarks Get buffered mode - true is buffered, false otherwise */ 47 | virtual bool buffered() const { return mBuffered; } 48 | 49 | /** @remarks Returns this input object's creator */ 50 | InputManager* getCreator() const { return mCreator; } 51 | 52 | /** @remarks Sets buffered mode */ 53 | virtual void setBuffered(bool buffered) = 0; 54 | 55 | /** @remarks Used for updating call once per frame before checking state or to update events */ 56 | virtual void capture() = 0; 57 | 58 | /** @remarks This may/may not) differentiate the different controllers based on (for instance) a port number (useful for console InputManagers) */ 59 | virtual int getID() const { return mDevID; } 60 | 61 | /** 62 | @remarks 63 | If available, get an interface to write to some devices. 64 | Examples include, turning on and off LEDs, ForceFeedback, etc 65 | @param type 66 | The type of interface you are looking for 67 | */ 68 | virtual Interface* queryInterface(Interface::IType type) = 0; 69 | 70 | /** @remarks Internal... Do not call this directly. */ 71 | virtual void _initialize() = 0; 72 | 73 | protected: 74 | Object(const std::string& vendor, Type iType, bool buffered, int devID, InputManager* creator) : 75 | mVendor(vendor), 76 | mType(iType), 77 | mBuffered(buffered), 78 | mDevID(devID), 79 | mCreator(creator) { } 80 | 81 | //! Vendor name if applicable/known 82 | std::string mVendor; 83 | 84 | //! Type of controller object 85 | Type mType; 86 | 87 | //! Buffered flag 88 | bool mBuffered; 89 | 90 | //! Not fully implemented yet 91 | int mDevID; 92 | 93 | //! The creator who created this object 94 | InputManager* mCreator; 95 | }; 96 | } 97 | #endif 98 | -------------------------------------------------------------------------------- /utils/ois/SDL/SDLInputManager.h: -------------------------------------------------------------------------------- 1 | /* 2 | The zlib/libpng License 3 | 4 | Copyright (c) 2018 Arthur Brainville 5 | Copyright (c) 2015 Andrew Fenn 6 | Copyright (c) 2005-2010 Phillip Castaneda (pjcast -- www.wreckedgames.com) 7 | 8 | This software is provided 'as-is', without any express or implied warranty. In no 9 | event will the authors be held liable for any damages arising from the use of this 10 | software. 11 | 12 | Permission is granted to anyone to use this software for any purpose, including 13 | commercial applications, and to alter it and redistribute it freely, subject to the 14 | following restrictions: 15 | 16 | 1. The origin of this software must not be misrepresented; you must not claim that 17 | you wrote the original software. If you use this software in a product, 18 | an acknowledgment in the product documentation would be appreciated 19 | but is not required. 20 | 21 | 2. Altered source versions must be plainly marked as such, and must not be 22 | misrepresented as being the original software. 23 | 24 | 3. This notice may not be removed or altered from any source distribution. 25 | */ 26 | #ifndef OIS_SDLInputManager_H 27 | #define OIS_SDLInputManager_H 28 | 29 | #include "OISInputManager.h" 30 | #include "SDL/SDLPrereqs.h" 31 | 32 | namespace OIS 33 | { 34 | /** 35 | SDL Input Manager wrapper 36 | */ 37 | class SDLInputManager : public InputManager 38 | { 39 | public: 40 | SDLInputManager(); 41 | virtual ~SDLInputManager(); 42 | 43 | /** @copydoc InputManager::inputSystemName */ 44 | virtual const std::string& inputSystemName() { return iName; } 45 | 46 | /** @copydoc InputManager::numJoysticks */ 47 | virtual int numJoySticks(); 48 | /** @copydoc InputManager::numMice */ 49 | virtual int numMice(); 50 | /** @copydoc InputManager::numKeyBoards */ 51 | virtual int numKeyboards(); 52 | 53 | /** @copydoc InputManager::createInputObject */ 54 | Object* createInputObject(Type iType, bool bufferMode); 55 | /** @copydoc InputManager::destroyInputObject */ 56 | void destroyInputObject(Object* obj); 57 | 58 | /** @copydoc InputManager::_initialize */ 59 | void _initialize(ParamList& paramList); 60 | 61 | //Utility methods to coordinate between mouse and keyboard grabbing 62 | bool _getGrabMode() { return mGrabbed; }; 63 | void _setGrabMode(bool grabbed) { mGrabbed = grabbed; } 64 | 65 | protected: 66 | //! internal class method for dealing with param list 67 | void _parseConfigSettings(ParamList& paramList); 68 | //! internal class method for finding attached devices 69 | void _enumerateDevices(); 70 | 71 | static const std::string iName; 72 | 73 | bool mGrabbed; 74 | }; 75 | } 76 | #endif 77 | -------------------------------------------------------------------------------- /utils/ois/SDL/SDLJoyStick.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xarray/osgPhysX/0996bc0bac46e46f4dc09990be0d6750ac369f55/utils/ois/SDL/SDLJoyStick.cpp -------------------------------------------------------------------------------- /utils/ois/SDL/SDLJoyStick.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xarray/osgPhysX/0996bc0bac46e46f4dc09990be0d6750ac369f55/utils/ois/SDL/SDLJoyStick.h -------------------------------------------------------------------------------- /utils/ois/SDL/SDLKeyboard.h: -------------------------------------------------------------------------------- 1 | /* 2 | The zlib/libpng License 3 | 4 | Copyright (c) 2018 Arthur Brainville 5 | Copyright (c) 2015 Andrew Fenn 6 | Copyright (c) 2005-2010 Phillip Castaneda (pjcast -- www.wreckedgames.com) 7 | 8 | This software is provided 'as-is', without any express or implied warranty. In no 9 | event will the authors be held liable for any damages arising from the use of this 10 | software. 11 | 12 | Permission is granted to anyone to use this software for any purpose, including 13 | commercial applications, and to alter it and redistribute it freely, subject to the 14 | following restrictions: 15 | 16 | 1. The origin of this software must not be misrepresented; you must not claim that 17 | you wrote the original software. If you use this software in a product, 18 | an acknowledgment in the product documentation would be appreciated 19 | but is not required. 20 | 21 | 2. Altered source versions must be plainly marked as such, and must not be 22 | misrepresented as being the original software. 23 | 24 | 3. This notice may not be removed or altered from any source distribution. 25 | */ 26 | #ifndef _OIS_SDLKEYBOARD_H 27 | #define _OIS_SDLKEYBOARD_H 28 | 29 | #include "OISKeyboard.h" 30 | #include "SDL/SDLPrereqs.h" 31 | 32 | namespace OIS 33 | { 34 | class SDLKeyboard : public Keyboard 35 | { 36 | public: 37 | /** 38 | @remarks 39 | Constructor 40 | @param buffered 41 | True for buffered input mode 42 | */ 43 | SDLKeyboard(bool buffered); 44 | virtual ~SDLKeyboard(); 45 | 46 | /** @copydoc Keyboard::isKeyDown */ 47 | virtual bool isKeyDown(KeyCode key); 48 | 49 | /** @copydoc Keyboard::getAsString */ 50 | virtual const std::string& getAsString(KeyCode kc); 51 | 52 | /** @copydoc Keyboard::copyKeyStates */ 53 | virtual void copyKeyStates(char keys[256]); 54 | 55 | /** @copydoc Object::setBuffered */ 56 | virtual void setBuffered(bool buffered); 57 | 58 | /** @copydoc Object::capture */ 59 | virtual void capture(); 60 | 61 | /** @copydoc Object::queryInterface */ 62 | virtual Interface* queryInterface(Interface::IType type) { return 0; } 63 | 64 | /** @copydoc Object::_initialize */ 65 | virtual void _initialize(); 66 | 67 | /** @copydoc Object::setTextTranslation */ 68 | virtual void setTextTranslation(TextTranslationMode mode); 69 | 70 | protected: 71 | SDLKeyboard() { } 72 | 73 | typedef std::map KeyMap; 74 | KeyMap mKeyMap; 75 | 76 | unsigned char KeyBuffer[256]; 77 | Uint8* mSDLBuff; 78 | 79 | std::string mGetString; 80 | }; 81 | } 82 | #endif 83 | -------------------------------------------------------------------------------- /utils/ois/SDL/SDLMouse.h: -------------------------------------------------------------------------------- 1 | /* 2 | The zlib/libpng License 3 | 4 | Copyright (c) 2018 Arthur Brainville 5 | Copyright (c) 2015 Andrew Fenn 6 | Copyright (c) 2005-2010 Phillip Castaneda (pjcast -- www.wreckedgames.com) 7 | 8 | This software is provided 'as-is', without any express or implied warranty. In no 9 | event will the authors be held liable for any damages arising from the use of this 10 | software. 11 | 12 | Permission is granted to anyone to use this software for any purpose, including 13 | commercial applications, and to alter it and redistribute it freely, subject to the 14 | following restrictions: 15 | 16 | 1. The origin of this software must not be misrepresented; you must not claim that 17 | you wrote the original software. If you use this software in a product, 18 | an acknowledgment in the product documentation would be appreciated 19 | but is not required. 20 | 21 | 2. Altered source versions must be plainly marked as such, and must not be 22 | misrepresented as being the original software. 23 | 24 | 3. This notice may not be removed or altered from any source distribution. 25 | */ 26 | #ifndef _OIS_SDLMOUSE_H 27 | #define _OIS_SDLMOUSE_H 28 | 29 | #include "OISMouse.h" 30 | #include "SDL/SDLPrereqs.h" 31 | 32 | namespace OIS 33 | { 34 | class SDLMouse : public Mouse 35 | { 36 | public: 37 | SDLMouse(bool buffered); 38 | virtual ~SDLMouse(); 39 | 40 | /** @copydoc Object::setBuffered */ 41 | virtual void setBuffered(bool buffered); 42 | 43 | /** @copydoc Object::capture */ 44 | virtual void capture(); 45 | 46 | /** @copydoc Object::queryInterface */ 47 | virtual Interface* queryInterface(Interface::IType type) { return 0; } 48 | 49 | /** @copydoc Object::_initialize */ 50 | virtual void _initialize(); 51 | 52 | void _setGrab(bool grabbed); 53 | void _setVisible(bool visible); 54 | 55 | protected: 56 | SDLMouse() { } 57 | 58 | bool mGrabbed; 59 | bool mRegainFocus; 60 | }; 61 | } 62 | #endif 63 | -------------------------------------------------------------------------------- /utils/ois/SDL/SDLPrereqs.h: -------------------------------------------------------------------------------- 1 | /* 2 | The zlib/libpng License 3 | 4 | Copyright (c) 2018 Arthur Brainville 5 | Copyright (c) 2015 Andrew Fenn 6 | Copyright (c) 2005-2010 Phillip Castaneda (pjcast -- www.wreckedgames.com) 7 | 8 | This software is provided 'as-is', without any express or implied warranty. In no 9 | event will the authors be held liable for any damages arising from the use of this 10 | software. 11 | 12 | Permission is granted to anyone to use this software for any purpose, including 13 | commercial applications, and to alter it and redistribute it freely, subject to the 14 | following restrictions: 15 | 16 | 1. The origin of this software must not be misrepresented; you must not claim that 17 | you wrote the original software. If you use this software in a product, 18 | an acknowledgment in the product documentation would be appreciated 19 | but is not required. 20 | 21 | 2. Altered source versions must be plainly marked as such, and must not be 22 | misrepresented as being the original software. 23 | 24 | 3. This notice may not be removed or altered from any source distribution. 25 | */ 26 | #ifndef OIS_SDLPrereqs_H 27 | #define OIS_SDLPrereqs_H 28 | 29 | #include "OISPrereqs.h" 30 | 31 | #ifdef OIS_APPLE_PLATFORM 32 | #include 33 | #else 34 | #include 35 | #endif 36 | 37 | #define OIS_SDL_KEY_BUFF 16 38 | #define OIS_SDL_MOUSE_BUFF 50 39 | #define OIS_SDL_JOY_BUFF 80 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /utils/ois/extras/LIRC/OISLIRC.h: -------------------------------------------------------------------------------- 1 | #include "OISConfig.h" 2 | #ifdef OIS_LIRC_SUPPORT 3 | /* 4 | The zlib/libpng License 5 | 6 | Copyright (c) 2018 Arthur Brainville 7 | Copyright (c) 2015 Andrew Fenn 8 | Copyright (c) 2005-2010 Phillip Castaneda (pjcast -- www.wreckedgames.com) 9 | 10 | This software is provided 'as-is', without any express or implied warranty. In no 11 | event will the authors be held liable for any damages arising from the use of this 12 | software. 13 | 14 | Permission is granted to anyone to use this software for any purpose, including 15 | commercial applications, and to alter it and redistribute it freely, subject to the 16 | following restrictions: 17 | 18 | 1. The origin of this software must not be misrepresented; you must not claim that 19 | you wrote the original software. If you use this software in a product, 20 | an acknowledgment in the product documentation would be appreciated 21 | but is not required. 22 | 23 | 2. Altered source versions must be plainly marked as such, and must not be 24 | misrepresented as being the original software. 25 | 26 | 3. This notice may not be removed or altered from any source distribution. 27 | */ 28 | #ifndef OIS_LIRC_H 29 | #define OIS_LIRC_H 30 | #include "OISJoyStick.h" 31 | #include "OISLIRCRingBuffer.h" 32 | 33 | namespace OIS 34 | { 35 | class LIRCFactoryCreator; 36 | 37 | struct RemoteInfo 38 | { 39 | RemoteInfo() : 40 | buttons(0) { } 41 | 42 | RemoteInfo(const RemoteInfo& other) 43 | { 44 | buttons = other.buttons; 45 | buttonMap = other.buttonMap; 46 | } 47 | 48 | int buttons; 49 | std::map buttonMap; 50 | }; 51 | 52 | //Number of ring buffer events. should be nice sized (the structure is not very big) 53 | //Will be rounded up to power of two automatically 54 | #define OIS_LIRC_EVENT_BUFFER 16 55 | 56 | /** Specialty joystick - Linux Infrared Remote Support */ 57 | class _OISExport LIRCControl : public JoyStick 58 | { 59 | friend class LIRCFactoryCreator; 60 | 61 | public: 62 | LIRCControl(InputManager* creator, int id, bool buffered, LIRCFactoryCreator* local_creator, RemoteInfo& info); 63 | ~LIRCControl(); 64 | 65 | //Overrides of Object 66 | /** copydoc Object::setBuffered */ 67 | void setBuffered(bool buffered); 68 | 69 | /** copydoc Object::capture */ 70 | void capture(); 71 | 72 | /** copydoc Object::queryInterface */ 73 | Interface* queryInterface(Interface::IType type); 74 | 75 | /** copydoc Object::_intialize */ 76 | void _initialize(); 77 | 78 | protected: 79 | //! Internal method used to add a button press to the queue (called from thread) 80 | void queueButtonPressed(const std::string& id); 81 | 82 | //! The creator who created us 83 | LIRCFactoryCreator* mLIRCCreator; 84 | 85 | //! Ringbuffer is used to store events from thread and be read from capture 86 | LIRCRingBuffer mRingBuffer; 87 | 88 | //! Information about remote 89 | RemoteInfo mInfo; 90 | }; 91 | } 92 | #endif //OIS_LIRC_H 93 | #endif 94 | -------------------------------------------------------------------------------- /utils/ois/extras/LIRC/OISLIRCFactoryCreator.h: -------------------------------------------------------------------------------- 1 | #include "OISConfig.h" 2 | #ifdef OIS_LIRC_SUPPORT 3 | /* 4 | The zlib/libpng License 5 | 6 | Copyright (c) 2018 Arthur Brainville 7 | Copyright (c) 2015 Andrew Fenn 8 | Copyright (c) 2005-2010 Phillip Castaneda (pjcast -- www.wreckedgames.com) 9 | 10 | This software is provided 'as-is', without any express or implied warranty. In no 11 | event will the authors be held liable for any damages arising from the use of this 12 | software. 13 | 14 | Permission is granted to anyone to use this software for any purpose, including 15 | commercial applications, and to alter it and redistribute it freely, subject to the 16 | following restrictions: 17 | 18 | 1. The origin of this software must not be misrepresented; you must not claim that 19 | you wrote the original software. If you use this software in a product, 20 | an acknowledgment in the product documentation would be appreciated 21 | but is not required. 22 | 23 | 2. Altered source versions must be plainly marked as such, and must not be 24 | misrepresented as being the original software. 25 | 26 | 3. This notice may not be removed or altered from any source distribution. 27 | */ 28 | #ifndef OIS_LIRCFactoryCreator_H 29 | #define OIS_LIRCFactoryCreator_H 30 | 31 | #include "OISPrereqs.h" 32 | #include "OISFactoryCreator.h" 33 | #include "OISLIRC.h" 34 | 35 | namespace OIS 36 | { 37 | //Forward declare local classes 38 | class LIRCControl; 39 | 40 | /** LIRC Factory Creator Class */ 41 | class _OISExport LIRCFactoryCreator : public FactoryCreator 42 | { 43 | public: 44 | LIRCFactoryCreator(); 45 | ~LIRCFactoryCreator(); 46 | 47 | //FactoryCreator Overrides 48 | /** @copydoc FactoryCreator::deviceList */ 49 | DeviceList freeDeviceList(); 50 | 51 | /** @copydoc FactoryCreator::totalDevices */ 52 | int totalDevices(Type iType); 53 | 54 | /** @copydoc FactoryCreator::freeDevices */ 55 | int freeDevices(Type iType); 56 | 57 | /** @copydoc FactoryCreator::vendorExist */ 58 | bool vendorExist(Type iType, const std::string& vendor); 59 | 60 | /** @copydoc FactoryCreator::createObject */ 61 | Object* createObject(InputManager* creator, Type iType, bool bufferMode, const std::string& vendor = ""); 62 | 63 | /** @copydoc FactoryCreator::destroyObject */ 64 | void destroyObject(Object* obj); 65 | 66 | protected: 67 | //! Gets a list of all remotes available 68 | void discoverRemotes(); 69 | 70 | //! Connects to LIRC server 71 | void enableConnection(bool enable, bool blocking = true); 72 | 73 | //! Creates/destroys threaded read 74 | void enableConnectionThread(bool enable); 75 | 76 | void threadUpdate(); 77 | 78 | std::string mIP; 79 | std::string mPort; 80 | bool mConnected; 81 | volatile bool mThreadRunning; 82 | std::map mUpdateRemotes; 83 | 84 | //! List of vendor named remotes that are not used yet 85 | std::vector mUnusedRemotes; 86 | 87 | //! Information about enumerated remotes 88 | std::map mJoyStickInformation; 89 | 90 | //! Number of total found remotes 91 | int mCount; 92 | 93 | //! Get the slow boost header includes from this header by using a proxy wrapper 94 | class BoostWrapper; 95 | 96 | //! Wrapped objects 97 | BoostWrapper* mWrapped; 98 | }; 99 | } 100 | #endif //OIS_LIRCFactoryCreator_H 101 | #endif 102 | -------------------------------------------------------------------------------- /utils/ois/iphone/iPhoneAccelerometer.h: -------------------------------------------------------------------------------- 1 | /* 2 | The zlib/libpng License 3 | 4 | Copyright (c) 2018 Arthur Brainville 5 | Copyright (c) 2015 Andrew Fenn 6 | Copyright (c) 2005-2010 Phillip Castaneda (pjcast -- www.wreckedgames.com) 7 | 8 | This software is provided 'as-is', without any express or implied warranty. In no 9 | event will the authors be held liable for any damages arising from the use of this 10 | software. 11 | 12 | Permission is granted to anyone to use this software for any purpose, including 13 | commercial applications, and to alter it and redistribute it freely, subject to the 14 | following restrictions: 15 | 16 | 1. The origin of this software must not be misrepresented; you must not claim that 17 | you wrote the original software. If you use this software in a product, 18 | an acknowledgment in the product documentation would be appreciated 19 | but is not required. 20 | 21 | 2. Altered source versions must be plainly marked as such, and must not be 22 | misrepresented as being the original software. 23 | 24 | 3. This notice may not be removed or altered from any source distribution. 25 | */ 26 | #ifndef OIS_iPhoneAccelerometer_H 27 | #define OIS_iPhoneAccelerometer_H 28 | 29 | #include "OISJoystick.h" 30 | #include "iphone/iPhonePrereqs.h" 31 | 32 | #import 33 | @class iPhoneAccelerometerDelegate; 34 | 35 | class JoyStickState; 36 | 37 | namespace OIS 38 | { 39 | class iPhoneAccelerometer : public JoyStick 40 | { 41 | public: 42 | iPhoneAccelerometer(InputManager* creator, bool buffered); 43 | virtual ~iPhoneAccelerometer(); 44 | 45 | /** @copydoc Object::setBuffered */ 46 | virtual void setBuffered(bool buffered); 47 | 48 | void setUpdateInterval(float interval) 49 | { 50 | mUpdateInterval = interval; 51 | [[UIAccelerometer sharedAccelerometer] setUpdateInterval:(1.0f / mUpdateInterval)]; 52 | } 53 | 54 | Vector3 getAccelerometerVector3(void) { return mState.mVectors[0]; } 55 | /** @copydoc Object::capture */ 56 | virtual void capture(); 57 | 58 | /** @copydoc Object::queryInterface */ 59 | virtual Interface* queryInterface(Interface::IType type) { return 0; } 60 | 61 | /** @copydoc Object::_initialize */ 62 | virtual void _initialize(); 63 | 64 | void didAccelerate(UIAcceleration* acceleration); 65 | 66 | protected: 67 | iPhoneAccelerometerDelegate* accelerometerDelegate; 68 | 69 | /** The update frequency of the accelerometer. Represented in times per second. */ 70 | float mUpdateInterval; 71 | Vector3 mTempState; 72 | }; 73 | } 74 | 75 | #endif // OIS_iPhoneAccelerometer_H 76 | -------------------------------------------------------------------------------- /utils/ois/iphone/iPhoneAccelerometer.mm: -------------------------------------------------------------------------------- 1 | /* 2 | The zlib/libpng License 3 | 4 | Copyright (c) 2018 Arthur Brainville 5 | Copyright (c) 2015 Andrew Fenn 6 | Copyright (c) 2005-2010 Phillip Castaneda (pjcast -- www.wreckedgames.com) 7 | 8 | This software is provided 'as-is', without any express or implied warranty. In no 9 | event will the authors be held liable for any damages arising from the use of this 10 | software. 11 | 12 | Permission is granted to anyone to use this software for any purpose, including 13 | commercial applications, and to alter it and redistribute it freely, subject to the 14 | following restrictions: 15 | 16 | 1. The origin of this software must not be misrepresented; you must not claim that 17 | you wrote the original software. If you use this software in a product, 18 | an acknowledgment in the product documentation would be appreciated 19 | but is not required. 20 | 21 | 2. Altered source versions must be plainly marked as such, and must not be 22 | misrepresented as being the original software. 23 | 24 | 3. This notice may not be removed or altered from any source distribution. 25 | */ 26 | #include "iphone/iPhoneAccelerometer.h" 27 | #include "iphone/iPhoneInputManager.h" 28 | 29 | using namespace OIS; 30 | 31 | //-------------------------------------------------------------------// 32 | iPhoneAccelerometer::iPhoneAccelerometer(InputManager* creator, bool buffered) : 33 | JoyStick(creator->inputSystemName(), buffered, 0, creator) 34 | { 35 | iPhoneInputManager* man = static_cast(mCreator); 36 | 37 | man->_setAccelerometerUsed(true); 38 | [man->_getDelegate() setAccelerometerObject:this]; 39 | [[UIAccelerometer sharedAccelerometer] setDelegate:man->_getDelegate()]; 40 | mUpdateInterval = 60.0f; 41 | } 42 | 43 | iPhoneAccelerometer::~iPhoneAccelerometer() 44 | { 45 | iPhoneInputManager* man = static_cast(mCreator); 46 | 47 | man->_setAccelerometerUsed(false); 48 | [man->_getDelegate() setAccelerometerObject:nil]; 49 | } 50 | 51 | void iPhoneAccelerometer::_initialize() 52 | { 53 | // Clear old joy state 54 | mState.mVectors.resize(1); 55 | mState.clear(); 56 | mTempState.clear(); 57 | 58 | // Set the update interval 59 | [[UIAccelerometer sharedAccelerometer] setUpdateInterval:(1.0 / mUpdateInterval)]; 60 | } 61 | 62 | void iPhoneAccelerometer::setBuffered(bool buffered) 63 | { 64 | mBuffered = buffered; 65 | } 66 | 67 | void iPhoneAccelerometer::didAccelerate(UIAcceleration* acceleration) 68 | { 69 | mTempState.clear(); 70 | 71 | mTempState.x = acceleration.x; 72 | mTempState.y = acceleration.y; 73 | mTempState.z = acceleration.z; 74 | } 75 | 76 | void iPhoneAccelerometer::capture() 77 | { 78 | mState.clear(); 79 | mState.mVectors[0] = mTempState; 80 | 81 | if(mListener && mBuffered) 82 | mListener->axisMoved(JoyStickEvent(this, mState), 0); 83 | } 84 | -------------------------------------------------------------------------------- /utils/ois/iphone/iPhoneHelpers.h: -------------------------------------------------------------------------------- 1 | /* 2 | The zlib/libpng License 3 | 4 | Copyright (c) 2018 Arthur Brainville 5 | Copyright (c) 2015 Andrew Fenn 6 | Copyright (c) 2005-2010 Phillip Castaneda (pjcast -- www.wreckedgames.com) 7 | 8 | This software is provided 'as-is', without any express or implied warranty. In no 9 | event will the authors be held liable for any damages arising from the use of this 10 | software. 11 | 12 | Permission is granted to anyone to use this software for any purpose, including 13 | commercial applications, and to alter it and redistribute it freely, subject to the 14 | following restrictions: 15 | 16 | 1. The origin of this software must not be misrepresented; you must not claim that 17 | you wrote the original software. If you use this software in a product, 18 | an acknowledgment in the product documentation would be appreciated 19 | but is not required. 20 | 21 | 2. Altered source versions must be plainly marked as such, and must not be 22 | misrepresented as being the original software. 23 | 24 | 3. This notice may not be removed or altered from any source distribution. 25 | */ 26 | #ifndef OIS_iPhoneHelpers_H 27 | #define OIS_iPhoneHelpers_H 28 | 29 | #include "iphone/iPhonePrereqs.h" 30 | #include "OISMultiTouch.h" 31 | 32 | // This is needed for keeping an event stack for keyboard and mouse 33 | namespace OIS 34 | { 35 | // used in the eventStack to store the type 36 | enum iPhone_EventType { iPhone_KEYUP = 0, 37 | iPhone_KEYDOWN = 1, 38 | iPhone_KEYREPEAT, 39 | iPhone_MOUSEDOWN, 40 | iPhone_MOUSEUP, 41 | iPhone_MOUSEMOVED, 42 | iPhone_MOUSESCROLL }; 43 | typedef enum iPhone_EventType iPhoneEventType; 44 | 45 | // only used by iPhoneMultiTouch 46 | typedef class iPhoneMultiTouchStackEvent 47 | { 48 | friend class iPhoneMultiTouch; 49 | 50 | private: 51 | iPhoneMultiTouchStackEvent(MultiTouchEvent event, iPhoneEventType type) : 52 | Event(event), Type(type) { } 53 | 54 | iPhoneEventType Type; 55 | MultiTouchEvent Event; 56 | 57 | } iPhoneMultiTouchStackEvent; 58 | } 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /utils/ois/iphone/iPhoneMultiTouch.h: -------------------------------------------------------------------------------- 1 | /* 2 | The zlib/libpng License 3 | 4 | Copyright (c) 2018 Arthur Brainville 5 | Copyright (c) 2015 Andrew Fenn 6 | Copyright (c) 2005-2010 Phillip Castaneda (pjcast -- www.wreckedgames.com) 7 | 8 | This software is provided 'as-is', without any express or implied warranty. In no 9 | event will the authors be held liable for any damages arising from the use of this 10 | software. 11 | 12 | Permission is granted to anyone to use this software for any purpose, including 13 | commercial applications, and to alter it and redistribute it freely, subject to the 14 | following restrictions: 15 | 16 | 1. The origin of this software must not be misrepresented; you must not claim that 17 | you wrote the original software. If you use this software in a product, 18 | an acknowledgment in the product documentation would be appreciated 19 | but is not required. 20 | 21 | 2. Altered source versions must be plainly marked as such, and must not be 22 | misrepresented as being the original software. 23 | 24 | 3. This notice may not be removed or altered from any source distribution. 25 | */ 26 | #ifndef OIS_iPhoneMultiTouch_H 27 | #define OIS_iPhoneMultiTouch_H 28 | 29 | #include "OISMultiTouch.h" 30 | #include "iphone/iPhonePrereqs.h" 31 | 32 | #import 33 | 34 | struct CGPoint; 35 | 36 | namespace OIS 37 | { 38 | class iPhoneMultiTouch : public MultiTouch 39 | { 40 | public: 41 | iPhoneMultiTouch(InputManager* creator, bool buffered); 42 | virtual ~iPhoneMultiTouch(); 43 | 44 | /** @copydoc Object::setBuffered */ 45 | virtual void setBuffered(bool buffered); 46 | 47 | /** @copydoc Object::capture */ 48 | virtual void capture(); 49 | 50 | /** @copydoc Object::queryInterface */ 51 | virtual Interface* queryInterface(Interface::IType type) { return 0; } 52 | 53 | /** @copydoc Object::_initialize */ 54 | virtual void _initialize(); 55 | 56 | void _touchBegan(UITouch* touch); 57 | void _touchEnded(UITouch* touch); 58 | void _touchMoved(UITouch* touch); 59 | void _touchCancelled(UITouch* touch); 60 | 61 | protected: 62 | MultiTouchState mTempState; 63 | }; 64 | } 65 | 66 | #endif // OIS_iPhoneTouch_H 67 | -------------------------------------------------------------------------------- /utils/ois/iphone/iPhonePrereqs.h: -------------------------------------------------------------------------------- 1 | /* 2 | The zlib/libpng License 3 | 4 | Copyright (c) 2018 Arthur Brainville 5 | Copyright (c) 2015 Andrew Fenn 6 | Copyright (c) 2005-2010 Phillip Castaneda (pjcast -- www.wreckedgames.com) 7 | 8 | This software is provided 'as-is', without any express or implied warranty. In no 9 | event will the authors be held liable for any damages arising from the use of this 10 | software. 11 | 12 | Permission is granted to anyone to use this software for any purpose, including 13 | commercial applications, and to alter it and redistribute it freely, subject to the 14 | following restrictions: 15 | 16 | 1. The origin of this software must not be misrepresented; you must not claim that 17 | you wrote the original software. If you use this software in a product, 18 | an acknowledgment in the product documentation would be appreciated 19 | but is not required. 20 | 21 | 2. Altered source versions must be plainly marked as such, and must not be 22 | misrepresented as being the original software. 23 | 24 | 3. This notice may not be removed or altered from any source distribution. 25 | */ 26 | #ifndef OIS_iPhonePrereqs_H 27 | #define OIS_iPhonePrereqs_H 28 | 29 | #include 30 | #include 31 | #include 32 | 33 | namespace OIS 34 | { 35 | class iPhoneInputManager; 36 | class iPhoneAccelerometer; 37 | class iPhoneMouse; 38 | 39 | /** 40 | Simple wrapper class for CFString which will create a valid CFString and retain ownership until class instance is outof scope 41 | To Access the CFStringRef instance, simply cast to void*, pass into a function expecting a void* CFStringRef object, or access via cf_str() method 42 | */ 43 | class OIS_CFString 44 | { 45 | public: 46 | OIS_CFString() { m_StringRef = CFStringCreateWithCString(NULL, "", kCFStringEncodingUTF8); } 47 | OIS_CFString(const char* c_str) { m_StringRef = CFStringCreateWithCString(NULL, c_str, kCFStringEncodingUTF8); } 48 | OIS_CFString(const std::string& s_str) { m_StringRef = CFStringCreateWithCString(NULL, s_str.c_str(), kCFStringEncodingUTF8); } 49 | ~OIS_CFString() { CFRelease(m_StringRef); } 50 | 51 | //Allow this class to be autoconverted to base class of StringRef (void*) 52 | operator void*() { return (void*)m_StringRef; } 53 | CFStringRef cf_str() { return m_StringRef; } 54 | 55 | private: 56 | CFStringRef m_StringRef; 57 | }; 58 | } 59 | #endif 60 | -------------------------------------------------------------------------------- /utils/ois/linux/EventHelpers.h: -------------------------------------------------------------------------------- 1 | /* 2 | The zlib/libpng License 3 | 4 | Copyright (c) 2018 Arthur Brainville 5 | Copyright (c) 2015 Andrew Fenn 6 | Copyright (c) 2005-2010 Phillip Castaneda (pjcast -- www.wreckedgames.com) 7 | 8 | This software is provided 'as-is', without any express or implied warranty. In no 9 | event will the authors be held liable for any damages arising from the use of this 10 | software. 11 | 12 | Permission is granted to anyone to use this software for any purpose, including 13 | commercial applications, and to alter it and redistribute it freely, subject to the 14 | following restrictions: 15 | 16 | 1. The origin of this software must not be misrepresented; you must not claim that 17 | you wrote the original software. If you use this software in a product, 18 | an acknowledgment in the product documentation would be appreciated 19 | but is not required. 20 | 21 | 2. Altered source versions must be plainly marked as such, and must not be 22 | misrepresented as being the original software. 23 | 24 | 3. This notice may not be removed or altered from any source distribution. 25 | */ 26 | #ifndef _LINUX_OISEVENT_HEADER_ 27 | #define _LINUX_OISEVENT_HEADER_ 28 | 29 | #include "linux/LinuxPrereqs.h" 30 | 31 | #define OIS_MAX_DEVICES 32 32 | #define OIS_DEVICE_NAME 128 33 | 34 | namespace OIS 35 | { 36 | class EventUtils 37 | { 38 | public: 39 | static bool isJoyStick(int deviceID, JoyStickInfo& js); 40 | static bool isMouse(int) { return false; } 41 | static bool isKeyboard(int) { return false; } 42 | 43 | //Double pointer is so that we can set the value of the sent pointer 44 | static void enumerateForceFeedback(int deviceID, LinuxForceFeedback** ff); 45 | static void removeForceFeedback(LinuxForceFeedback** ff); 46 | 47 | static std::string getName(int deviceID); 48 | static std::string getUniqueId(int deviceID); 49 | static std::string getPhysicalLocation(int deviceID); 50 | }; 51 | } 52 | #endif 53 | -------------------------------------------------------------------------------- /utils/ois/linux/LinuxForceFeedback.h: -------------------------------------------------------------------------------- 1 | /* 2 | The zlib/libpng License 3 | 4 | Copyright (c) 2018 Arthur Brainville 5 | Copyright (c) 2015 Andrew Fenn 6 | Copyright (c) 2005-2010 Phillip Castaneda (pjcast -- www.wreckedgames.com) 7 | 8 | This software is provided 'as-is', without any express or implied warranty. In no 9 | event will the authors be held liable for any damages arising from the use of this 10 | software. 11 | 12 | Permission is granted to anyone to use this software for any purpose, including 13 | commercial applications, and to alter it and redistribute it freely, subject to the 14 | following restrictions: 15 | 16 | 1. The origin of this software must not be misrepresented; you must not claim that 17 | you wrote the original software. If you use this software in a product, 18 | an acknowledgment in the product documentation would be appreciated 19 | but is not required. 20 | 21 | 2. Altered source versions must be plainly marked as such, and must not be 22 | misrepresented as being the original software. 23 | 24 | 3. This notice may not be removed or altered from any source distribution. 25 | */ 26 | #ifndef OIS_LinuxForceFeedBack_H 27 | #define OIS_LinuxForceFeedBack_H 28 | 29 | #include "linux/LinuxPrereqs.h" 30 | #include "OISForceFeedback.h" 31 | #include 32 | 33 | namespace OIS 34 | { 35 | class LinuxForceFeedback : public ForceFeedback 36 | { 37 | public: 38 | LinuxForceFeedback(int deviceID); 39 | ~LinuxForceFeedback(); 40 | 41 | /** @copydoc ForceFeedback::setMasterGain */ 42 | void setMasterGain(float); 43 | 44 | /** @copydoc ForceFeedback::setAutoCenterMode */ 45 | void setAutoCenterMode(bool); 46 | 47 | /** @copydoc ForceFeedback::upload */ 48 | void upload(const Effect* effect); 49 | 50 | /** @copydoc ForceFeedback::modify */ 51 | void modify(const Effect* effect); 52 | 53 | /** @copydoc ForceFeedback::remove */ 54 | void remove(const Effect* effect); 55 | 56 | /** FF is not yet implemented fully on Linux.. just return -1 for now. todo, xxx */ 57 | short int getFFAxesNumber() { return -1; } 58 | 59 | /** @copydoc ForceFeedback::getFFMemoryLoad */ 60 | unsigned short getFFMemoryLoad(); 61 | 62 | protected: 63 | //Sets the common properties to all effects 64 | void _setCommonProperties(struct ff_effect* event, struct ff_envelope* ffenvelope, const Effect* effect, const Envelope* envelope); 65 | 66 | //Specific Effect Settings 67 | void _updateConstantEffect(const Effect* effect); 68 | void _updateRampEffect(const Effect* effect); 69 | void _updatePeriodicEffect(const Effect* effect); 70 | void _updateConditionalEffect(const Effect* effect); 71 | //void _updateCustomEffect( const Effect* effect ); 72 | 73 | void _upload(struct ff_effect* ffeffect, const Effect* effect); 74 | void _stop(int handle); 75 | void _start(int handle); 76 | void _unload(int handle); 77 | 78 | // Map of currently uploaded effects (handle => effect) 79 | typedef std::map EffectList; 80 | EffectList mEffectList; 81 | 82 | // Joystick device (file) descriptor. 83 | int mJoyStick; 84 | }; 85 | } 86 | #endif //OIS_LinuxForceFeedBack_H 87 | -------------------------------------------------------------------------------- /utils/ois/linux/LinuxJoyStickEvents.h: -------------------------------------------------------------------------------- 1 | /* 2 | The zlib/libpng License 3 | 4 | Copyright (c) 2018 Arthur Brainville 5 | Copyright (c) 2015 Andrew Fenn 6 | Copyright (c) 2005-2010 Phillip Castaneda (pjcast -- www.wreckedgames.com) 7 | 8 | This software is provided 'as-is', without any express or implied warranty. In no 9 | event will the authors be held liable for any damages arising from the use of this 10 | software. 11 | 12 | Permission is granted to anyone to use this software for any purpose, including 13 | commercial applications, and to alter it and redistribute it freely, subject to the 14 | following restrictions: 15 | 16 | 1. The origin of this software must not be misrepresented; you must not claim that 17 | you wrote the original software. If you use this software in a product, 18 | an acknowledgment in the product documentation would be appreciated 19 | but is not required. 20 | 21 | 2. Altered source versions must be plainly marked as such, and must not be 22 | misrepresented as being the original software. 23 | 24 | 3. This notice may not be removed or altered from any source distribution. 25 | */ 26 | #ifndef _LINUX_JOYSTICK_H_EADER_ 27 | #define _LINUX_JOYSTICK_H_EADER_ 28 | 29 | #include "linux/LinuxPrereqs.h" 30 | #include "OISJoyStick.h" 31 | 32 | namespace OIS 33 | { 34 | /** 35 | Linux specialization of JoyStick class.. This version is favored over the other.. and has the 36 | *possibility* of Force Feedback.. notice I say possibility, i make no gaurantees under linux, 37 | as FF support is sketchy at best AFAIK. 38 | */ 39 | class LinuxJoyStick : public JoyStick 40 | { 41 | public: 42 | LinuxJoyStick(InputManager* creator, bool buffered, const JoyStickInfo& js); 43 | virtual ~LinuxJoyStick(); 44 | 45 | /** @copydoc Object::setBuffered */ 46 | virtual void setBuffered(bool buffered); 47 | 48 | /** @copydoc Object::capture */ 49 | virtual void capture(); 50 | 51 | /** @copydoc Object::queryInterface */ 52 | virtual Interface* queryInterface(Interface::IType type); 53 | 54 | /** @copydoc Object::_initialize */ 55 | virtual void _initialize(); 56 | 57 | /** 58 | @remarks 59 | For internal use only... Returns a structure to the manager, to make the device 60 | availiable for use again 61 | */ 62 | JoyStickInfo _getJoyInfo(); 63 | 64 | static JoyStickInfoList _scanJoys(); 65 | static void _clearJoys(JoyStickInfoList& joys); 66 | 67 | protected: 68 | int mJoyStick; 69 | LinuxForceFeedback* ff_effect; 70 | std::map mButtonMap; 71 | std::map mAxisMap; 72 | std::map mRanges; 73 | }; 74 | } 75 | #endif //_LINUX_JOYSTICK_H_EADER_ 76 | -------------------------------------------------------------------------------- /utils/ois/linux/LinuxMouse.h: -------------------------------------------------------------------------------- 1 | /* 2 | The zlib/libpng License 3 | 4 | Copyright (c) 2018 Arthur Brainville 5 | Copyright (c) 2015 Andrew Fenn 6 | Copyright (c) 2005-2010 Phillip Castaneda (pjcast -- www.wreckedgames.com) 7 | 8 | This software is provided 'as-is', without any express or implied warranty. In no 9 | event will the authors be held liable for any damages arising from the use of this 10 | software. 11 | 12 | Permission is granted to anyone to use this software for any purpose, including 13 | commercial applications, and to alter it and redistribute it freely, subject to the 14 | following restrictions: 15 | 16 | 1. The origin of this software must not be misrepresented; you must not claim that 17 | you wrote the original software. If you use this software in a product, 18 | an acknowledgment in the product documentation would be appreciated 19 | but is not required. 20 | 21 | 2. Altered source versions must be plainly marked as such, and must not be 22 | misrepresented as being the original software. 23 | 24 | 3. This notice may not be removed or altered from any source distribution. 25 | */ 26 | #ifndef _LINUX_MOUSE_H_EADER_ 27 | #define _LINUX_MOUSE_H_EADER_ 28 | 29 | #include "linux/LinuxPrereqs.h" 30 | #include "OISMouse.h" 31 | #include 32 | 33 | namespace OIS 34 | { 35 | class LinuxMouse : public Mouse 36 | { 37 | public: 38 | LinuxMouse(InputManager* creator, bool buffered, bool grab, bool hide); 39 | virtual ~LinuxMouse(); 40 | 41 | /** @copydoc Object::setBuffered */ 42 | virtual void setBuffered(bool buffered); 43 | 44 | /** 45 | @remarks 46 | Note: Calling this will also update the keyboard (X11 updates in a single 47 | event queue). Updates State and/or raises event for buffered mode.. 48 | */ 49 | virtual void capture(); 50 | 51 | /** @copydoc Object::queryInterface */ 52 | virtual Interface* queryInterface(Interface::IType) { return 0; } 53 | 54 | /** @copydoc Object::_initialize */ 55 | virtual void _initialize(); 56 | 57 | void grab(bool grab); 58 | void hide(bool hide); 59 | 60 | protected: 61 | void _processXEvents(); 62 | 63 | bool mMoved, mWarped; 64 | 65 | //Since X11 provides us with absolute values, we need to keep track of relative values 66 | long oldXMouseX, oldXMouseY, oldXMouseZ; 67 | 68 | Window window; //The X Window 69 | Display* display; //The X display 70 | Cursor cursor; //A blank cursor 71 | 72 | bool grabMouse; //Are we grabbing the mouse to the window? 73 | bool hideMouse; //Are we hiding OS mouse? 74 | bool mouseFocusLost; //Has the mouse just lost focus? 75 | }; 76 | } 77 | 78 | #endif //_LINUX_MOUSE_H_EADER_ 79 | -------------------------------------------------------------------------------- /utils/ois/linux/LinuxPrereqs.h: -------------------------------------------------------------------------------- 1 | /* 2 | The zlib/libpng License 3 | 4 | Copyright (c) 2018 Arthur Brainville 5 | Copyright (c) 2015 Andrew Fenn 6 | Copyright (c) 2005-2010 Phillip Castaneda (pjcast -- www.wreckedgames.com) 7 | 8 | This software is provided 'as-is', without any express or implied warranty. In no 9 | event will the authors be held liable for any damages arising from the use of this 10 | software. 11 | 12 | Permission is granted to anyone to use this software for any purpose, including 13 | commercial applications, and to alter it and redistribute it freely, subject to the 14 | following restrictions: 15 | 16 | 1. The origin of this software must not be misrepresented; you must not claim that 17 | you wrote the original software. If you use this software in a product, 18 | an acknowledgment in the product documentation would be appreciated 19 | but is not required. 20 | 21 | 2. Altered source versions must be plainly marked as such, and must not be 22 | misrepresented as being the original software. 23 | 24 | 3. This notice may not be removed or altered from any source distribution. 25 | */ 26 | #ifndef _LINUX_INPUTSYSTEM_PREREQS_H 27 | #define _LINUX_INPUTSYSTEM_PREREQS_H 28 | 29 | //Bring in any auto generated config files 30 | #ifdef HAVE_CONFIG_H 31 | #include "config.h" 32 | #endif 33 | 34 | #include "OISPrereqs.h" 35 | 36 | //! Max number of elements to collect from buffered input 37 | #define JOY_BUFFERSIZE 64 38 | 39 | namespace OIS 40 | { 41 | class LinuxInputManager; 42 | class LinuxKeyboard; 43 | class LinuxJoyStick; 44 | class LinuxMouse; 45 | 46 | class LinuxForceFeedback; 47 | 48 | class Range 49 | { 50 | public: 51 | Range() {}; 52 | Range(int _min, int _max) : 53 | min(_min), max(_max) {}; 54 | int min, max; 55 | }; 56 | 57 | class JoyStickInfo 58 | { 59 | public: 60 | JoyStickInfo() : 61 | devId(-1), joyFileD(-1), version(0), axes(0), buttons(0), hats(0) { } 62 | //! Device number (/dev/input/j#) or /dev/input/event# 63 | int devId; 64 | //! File descriptor 65 | int joyFileD; 66 | //! Driver version 67 | int version; 68 | //! Joy vendor 69 | std::string vendor; 70 | //! Number of axes 71 | unsigned char axes; 72 | //! Number of buttons 73 | unsigned char buttons; 74 | //! Number of hats 75 | unsigned char hats; 76 | //! Maps Linux button values to OIS buttons values 77 | std::map button_map; 78 | //! Maps Linux axis values to OIS axis 79 | std::map axis_map; 80 | //! Maps OIS axis values to it's range 81 | std::map axis_range; 82 | }; 83 | 84 | typedef std::vector JoyStickInfoList; 85 | } 86 | 87 | #endif //_LINUX_INPUTSYSTEM_PREREQS_H 88 | -------------------------------------------------------------------------------- /utils/ois/mac/CocoaHelpers.h: -------------------------------------------------------------------------------- 1 | /* 2 | The zlib/libpng License 3 | 4 | Copyright (c) 2018 Arthur Brainville 5 | Copyright (c) 2015 Andrew Fenn 6 | Copyright (c) 2005-2010 Phillip Castaneda (pjcast -- www.wreckedgames.com) 7 | 8 | This software is provided 'as-is', without any express or implied warranty. In no 9 | event will the authors be held liable for any damages arising from the use of this 10 | software. 11 | 12 | Permission is granted to anyone to use this software for any purpose, including 13 | commercial applications, and to alter it and redistribute it freely, subject to the 14 | following restrictions: 15 | 16 | 1. The origin of this software must not be misrepresented; you must not claim that 17 | you wrote the original software. If you use this software in a product, 18 | an acknowledgment in the product documentation would be appreciated 19 | but is not required. 20 | 21 | 2. Altered source versions must be plainly marked as such, and must not be 22 | misrepresented as being the original software. 23 | 24 | 3. This notice may not be removed or altered from any source distribution. 25 | */ 26 | 27 | #ifndef OIS_CocoaHelpers_H 28 | #define OIS_CocoaHelpers_H 29 | 30 | #include "OISEvents.h" 31 | #include "OISKeyboard.h" 32 | #include "OISMouse.h" 33 | 34 | // This is needed for keeping an event stack for keyboard and mouse 35 | namespace OIS 36 | { 37 | 38 | // used in the eventStack to store the type 39 | enum Mac_EventType { MAC_KEYUP = 0, 40 | MAC_KEYDOWN = 1, 41 | MAC_KEYREPEAT, 42 | MAC_MOUSEDOWN, 43 | MAC_MOUSEUP, 44 | MAC_MOUSEMOVED, 45 | MAC_MOUSESCROLL }; 46 | typedef enum Mac_EventType MacEventType; 47 | } 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /utils/ois/mac/CocoaInputManager.h: -------------------------------------------------------------------------------- 1 | /* 2 | The zlib/libpng License 3 | 4 | Copyright (c) 2018 Arthur Brainville 5 | Copyright (c) 2015 Andrew Fenn 6 | Copyright (c) 2005-2010 Phillip Castaneda (pjcast -- www.wreckedgames.com) 7 | 8 | This software is provided 'as-is', without any express or implied warranty. In no 9 | event will the authors be held liable for any damages arising from the use of this 10 | software. 11 | 12 | Permission is granted to anyone to use this software for any purpose, including 13 | commercial applications, and to alter it and redistribute it freely, subject to the 14 | following restrictions: 15 | 16 | 1. The origin of this software must not be misrepresented; you must not claim that 17 | you wrote the original software. If you use this software in a product, 18 | an acknowledgment in the product documentation would be appreciated 19 | but is not required. 20 | 21 | 2. Altered source versions must be plainly marked as such, and must not be 22 | misrepresented as being the original software. 23 | 24 | 3. This notice may not be removed or altered from any source distribution. 25 | */ 26 | 27 | #ifndef OIS_CocoaInputManager_H 28 | #define OIS_CocoaInputManager_H 29 | 30 | #include "OISInputManager.h" 31 | #include "OISFactoryCreator.h" 32 | #include 33 | 34 | namespace OIS 35 | { 36 | class MacHIDManager; 37 | 38 | class CocoaInputManager : public InputManager, public FactoryCreator 39 | { 40 | public: 41 | CocoaInputManager(); 42 | virtual ~CocoaInputManager(); 43 | 44 | //InputManager Overrides 45 | /** @copydoc InputManager::_initialize */ 46 | void _initialize(ParamList& paramList); 47 | 48 | //FactoryCreator Overrides 49 | /** @copydoc FactoryCreator::deviceList */ 50 | DeviceList freeDeviceList(); 51 | 52 | /** @copydoc FactoryCreator::totalDevices */ 53 | int totalDevices(Type iType); 54 | 55 | /** @copydoc FactoryCreator::freeDevices */ 56 | int freeDevices(Type iType); 57 | 58 | /** @copydoc FactoryCreator::vendorExist */ 59 | bool vendorExist(Type iType, const std::string& vendor); 60 | 61 | /** @copydoc FactoryCreator::createObject */ 62 | Object* createObject(InputManager* creator, Type iType, bool bufferMode, const std::string& vendor = ""); 63 | 64 | /** @copydoc FactoryCreator::destroyObject */ 65 | void destroyObject(Object* obj); 66 | 67 | //Internal Items 68 | //! Internal method, used for flaggin keyboard as available/unavailable for creation 69 | void _setKeyboardUsed(bool used) { keyboardUsed = used; } 70 | 71 | //! Internal method, used for flaggin mouse as available/unavailable for creation 72 | void _setMouseUsed(bool used) { mouseUsed = used; } 73 | 74 | //! method for getting window 75 | NSWindow* _getWindow() { return mWindow; } 76 | 77 | protected: 78 | void _parseConfigSettings(ParamList& paramList); 79 | 80 | void _enumerateDevices(); 81 | 82 | static const std::string iName; 83 | 84 | // Mac stuff 85 | NSWindow* mWindow; 86 | 87 | // settings 88 | bool mHideMouse; 89 | bool mUseRepeat; 90 | 91 | //! Used to know if we used up keyboard 92 | bool keyboardUsed; 93 | 94 | //! Used to know if we used up mouse 95 | bool mouseUsed; 96 | 97 | //! HID Manager class handling devices other than keyboard/mouse 98 | MacHIDManager* mHIDManager; 99 | }; 100 | } 101 | #endif 102 | -------------------------------------------------------------------------------- /utils/ois/mac/CocoaJoyStick.h: -------------------------------------------------------------------------------- 1 | /* 2 | The zlib/libpng License 3 | 4 | Copyright (c) 2018 Arthur Brainville 5 | Copyright (c) 2015 Andrew Fenn 6 | Copyright (c) 2005-2010 Phillip Castaneda (pjcast -- www.wreckedgames.com) 7 | 8 | This software is provided 'as-is', without any express or implied warranty. In no 9 | event will the authors be held liable for any damages arising from the use of this 10 | software. 11 | 12 | Permission is granted to anyone to use this software for any purpose, including 13 | commercial applications, and to alter it and redistribute it freely, subject to the 14 | following restrictions: 15 | 16 | 1. The origin of this software must not be misrepresented; you must not claim that 17 | you wrote the original software. If you use this software in a product, 18 | an acknowledgment in the product documentation would be appreciated 19 | but is not required. 20 | 21 | 2. Altered source versions must be plainly marked as such, and must not be 22 | misrepresented as being the original software. 23 | 24 | 3. This notice may not be removed or altered from any source distribution. 25 | */ 26 | #ifndef Cocoa_Joystick_H 27 | #define Cocoa_Joystick_H 28 | 29 | #include "OISJoyStick.h" 30 | #include "mac/MacHIDManager.h" 31 | 32 | namespace OIS 33 | { 34 | struct AxisInfo 35 | { 36 | int min; 37 | int max; 38 | 39 | AxisInfo(int min, int max) : 40 | min(min), max(max) { } 41 | }; 42 | 43 | typedef struct cookie_struct 44 | { 45 | std::map axisCookies; 46 | std::vector buttonCookies; 47 | } cookie_struct_t; 48 | 49 | //class HidDeviceInfo 50 | 51 | class CocoaJoyStick : public JoyStick 52 | { 53 | public: 54 | CocoaJoyStick(const std::string& vendor, bool buffered, HidInfo* info, InputManager* creator, int devID); 55 | 56 | virtual ~CocoaJoyStick(); 57 | 58 | /** @copydoc Object::setBuffered */ 59 | virtual void setBuffered(bool buffered); 60 | 61 | /** @copydoc Object::capture */ 62 | virtual void capture(); 63 | 64 | /** @copydoc Object::queryInterface */ 65 | virtual Interface* queryInterface(Interface::IType type); 66 | 67 | /** @copydoc Object::_initialize */ 68 | virtual void _initialize(); 69 | 70 | void _enumerateCookies(); 71 | 72 | IOHIDQueueInterface** _createQueue(unsigned int depth = 8); 73 | 74 | protected: 75 | HidInfo* mInfo; 76 | cookie_struct_t mCookies; 77 | IOHIDQueueInterface** mQueue; 78 | }; 79 | } 80 | #endif 81 | -------------------------------------------------------------------------------- /utils/ois/mac/CocoaMouse.h: -------------------------------------------------------------------------------- 1 | /* 2 | The zlib/libpng License 3 | 4 | Copyright (c) 2018 Arthur Brainville 5 | Copyright (c) 2015 Andrew Fenn 6 | Copyright (c) 2005-2010 Phillip Castaneda (pjcast -- www.wreckedgames.com) 7 | 8 | This software is provided 'as-is', without any express or implied warranty. In no 9 | event will the authors be held liable for any damages arising from the use of this 10 | software. 11 | 12 | Permission is granted to anyone to use this software for any purpose, including 13 | commercial applications, and to alter it and redistribute it freely, subject to the 14 | following restrictions: 15 | 16 | 1. The origin of this software must not be misrepresented; you must not claim that 17 | you wrote the original software. If you use this software in a product, 18 | an acknowledgment in the product documentation would be appreciated 19 | but is not required. 20 | 21 | 2. Altered source versions must be plainly marked as such, and must not be 22 | misrepresented as being the original software. 23 | 24 | 3. This notice may not be removed or altered from any source distribution. 25 | */ 26 | #ifndef OIS_CocoaMouse_H 27 | #define OIS_CocoaMouse_H 28 | 29 | #include "OISMouse.h" 30 | #include "mac/CocoaHelpers.h" 31 | 32 | #include 33 | 34 | @class CocoaMouseView; 35 | 36 | using namespace OIS; 37 | 38 | namespace OIS 39 | { 40 | class CocoaMouse : public Mouse 41 | { 42 | public: 43 | CocoaMouse(InputManager* creator, bool buffered); 44 | virtual ~CocoaMouse(); 45 | 46 | /** @copydoc Object::setBuffered */ 47 | virtual void setBuffered(bool buffered); 48 | 49 | /** @copydoc Object::capture */ 50 | virtual void capture(); 51 | 52 | /** @copydoc Object::queryInterface */ 53 | virtual Interface* queryInterface(Interface::IType type) { return 0; } 54 | 55 | /** @copydoc Object::_initialize */ 56 | virtual void _initialize(); 57 | 58 | MouseState* getMouseStatePtr() { return &(mState); } 59 | 60 | protected: 61 | CocoaMouseView* mResponder; 62 | }; 63 | } 64 | 65 | @interface CocoaMouseView : NSView { 66 | CocoaMouse* oisMouseObj; 67 | MouseState mTempState; 68 | bool mNeedsToRegainFocus; 69 | bool mMouseWarped; 70 | } 71 | 72 | - (void)setOISMouseObj:(CocoaMouse*)obj; 73 | - (void)capture; 74 | 75 | @end 76 | 77 | #endif // OIS_CocoaMouse_H 78 | -------------------------------------------------------------------------------- /utils/ois/mac/MacHelpers.h: -------------------------------------------------------------------------------- 1 | /* 2 | The zlib/libpng License 3 | 4 | Copyright (c) 2018 Arthur Brainville 5 | Copyright (c) 2015 Andrew Fenn 6 | Copyright (c) 2005-2010 Phillip Castaneda (pjcast -- www.wreckedgames.com) 7 | 8 | This software is provided 'as-is', without any express or implied warranty. In no 9 | event will the authors be held liable for any damages arising from the use of this 10 | software. 11 | 12 | Permission is granted to anyone to use this software for any purpose, including 13 | commercial applications, and to alter it and redistribute it freely, subject to the 14 | following restrictions: 15 | 16 | 1. The origin of this software must not be misrepresented; you must not claim that 17 | you wrote the original software. If you use this software in a product, 18 | an acknowledgment in the product documentation would be appreciated 19 | but is not required. 20 | 21 | 2. Altered source versions must be plainly marked as such, and must not be 22 | misrepresented as being the original software. 23 | 24 | 3. This notice may not be removed or altered from any source distribution. 25 | */ 26 | #ifndef OIS_MacHelpers_H 27 | #define OIS_MacHelpers_H 28 | 29 | #include "mac/MacPrereqs.h" 30 | #include "OISEvents.h" 31 | #include "OISKeyboard.h" 32 | #include "OISMouse.h" 33 | 34 | #include 35 | 36 | // This is a hack needed to get the event handler working. 37 | // The carbon lib expects a "OSStatus (*)(EventHandlerCallRef, EventRef, void*)", 38 | // so I cannot give it a class member function (unless it is static which is pointless) 39 | // Instead, I just pass the class* through the last paramter that gets passed to the 40 | // callback every time an event occurs. Then I dereference it and call the member function. 41 | OSStatus KeyDownWrapper(EventHandlerCallRef nextHandler, EventRef theEvent, void* callClass); 42 | 43 | OSStatus KeyUpWrapper(EventHandlerCallRef nextHandler, EventRef theEvent, void* callClass); 44 | 45 | OSStatus KeyModWrapper(EventHandlerCallRef nextHandler, EventRef theEvent, void* callClass); 46 | 47 | OSStatus MouseWrapper(EventHandlerCallRef nextHandler, EventRef theEvent, void* callClass); 48 | 49 | // This is needed for keeping an event stack for keyboard and mouse 50 | namespace OIS 51 | { 52 | 53 | // used in the eventStack to store the type 54 | enum Mac_EventType { MAC_KEYUP = 0, 55 | MAC_KEYDOWN = 1, 56 | MAC_KEYREPEAT, 57 | MAC_MOUSEDOWN, 58 | MAC_MOUSEUP, 59 | MAC_MOUSEMOVED, 60 | MAC_MOUSESCROLL }; 61 | typedef enum Mac_EventType MacEventType; 62 | 63 | // only used by MacKeyboard 64 | typedef class Mac_KeyStackEvent 65 | { 66 | friend class MacKeyboard; 67 | 68 | private: 69 | Mac_KeyStackEvent(KeyEvent event, MacEventType type) : 70 | Event(event), Type(type) { } 71 | 72 | MacEventType Type; 73 | KeyEvent Event; 74 | } MacKeyStackEvent; 75 | } 76 | 77 | #endif 78 | -------------------------------------------------------------------------------- /utils/ois/mac/MacJoyStick.h: -------------------------------------------------------------------------------- 1 | /* 2 | The zlib/libpng License 3 | 4 | Copyright (c) 2018 Arthur Brainville 5 | Copyright (c) 2015 Andrew Fenn 6 | Copyright (c) 2005-2010 Phillip Castaneda (pjcast -- www.wreckedgames.com) 7 | 8 | This software is provided 'as-is', without any express or implied warranty. In no 9 | event will the authors be held liable for any damages arising from the use of this 10 | software. 11 | 12 | Permission is granted to anyone to use this software for any purpose, including 13 | commercial applications, and to alter it and redistribute it freely, subject to the 14 | following restrictions: 15 | 16 | 1. The origin of this software must not be misrepresented; you must not claim that 17 | you wrote the original software. If you use this software in a product, 18 | an acknowledgment in the product documentation would be appreciated 19 | but is not required. 20 | 21 | 2. Altered source versions must be plainly marked as such, and must not be 22 | misrepresented as being the original software. 23 | 24 | 3. This notice may not be removed or altered from any source distribution. 25 | */ 26 | #ifndef MAC_Joystick_H 27 | #define MAC_Joystick_H 28 | #include "OISJoyStick.h" 29 | #include "mac/MacPrereqs.h" 30 | #include "mac/MacHIDManager.h" 31 | 32 | namespace OIS 33 | { 34 | struct AxisInfo 35 | { 36 | int min; 37 | int max; 38 | 39 | AxisInfo(int min, int max) : 40 | min(min), max(max) { } 41 | }; 42 | 43 | typedef struct cookie_struct 44 | { 45 | std::map axisCookies; 46 | std::vector buttonCookies; 47 | } cookie_struct_t; 48 | 49 | //class HidDeviceInfo 50 | 51 | class MacJoyStick : public JoyStick 52 | { 53 | public: 54 | MacJoyStick(const std::string& vendor, bool buffered, HidInfo* info, InputManager* creator, int devID); 55 | 56 | virtual ~MacJoyStick(); 57 | 58 | /** @copydoc Object::setBuffered */ 59 | virtual void setBuffered(bool buffered); 60 | 61 | /** @copydoc Object::capture */ 62 | virtual void capture(); 63 | 64 | /** @copydoc Object::queryInterface */ 65 | virtual Interface* queryInterface(Interface::IType type); 66 | 67 | /** @copydoc Object::_initialize */ 68 | virtual void _initialize(); 69 | 70 | void _enumerateCookies(); 71 | 72 | IOHIDQueueInterface** _createQueue(unsigned int depth = 8); 73 | 74 | protected: 75 | HidInfo* mInfo; 76 | cookie_struct_t mCookies; 77 | IOHIDQueueInterface** mQueue; 78 | }; 79 | } 80 | #endif 81 | -------------------------------------------------------------------------------- /utils/ois/mac/MacMouse.h: -------------------------------------------------------------------------------- 1 | /* 2 | The zlib/libpng License 3 | 4 | Copyright (c) 2018 Arthur Brainville 5 | Copyright (c) 2015 Andrew Fenn 6 | Copyright (c) 2005-2010 Phillip Castaneda (pjcast -- www.wreckedgames.com) 7 | 8 | This software is provided 'as-is', without any express or implied warranty. In no 9 | event will the authors be held liable for any damages arising from the use of this 10 | software. 11 | 12 | Permission is granted to anyone to use this software for any purpose, including 13 | commercial applications, and to alter it and redistribute it freely, subject to the 14 | following restrictions: 15 | 16 | 1. The origin of this software must not be misrepresented; you must not claim that 17 | you wrote the original software. If you use this software in a product, 18 | an acknowledgment in the product documentation would be appreciated 19 | but is not required. 20 | 21 | 2. Altered source versions must be plainly marked as such, and must not be 22 | misrepresented as being the original software. 23 | 24 | 3. This notice may not be removed or altered from any source distribution. 25 | */ 26 | 27 | #ifndef OIS_MacMouse_H 28 | #define OIS_MacMouse_H 29 | 30 | #include "OISMouse.h" 31 | #include "mac/MacHelpers.h" 32 | #include "mac/MacPrereqs.h" 33 | 34 | #include 35 | 36 | namespace OIS 37 | { 38 | class MacMouse : public Mouse 39 | { 40 | public: 41 | MacMouse(InputManager* creator, bool buffered); 42 | virtual ~MacMouse(); 43 | 44 | /** @copydoc Object::setBuffered */ 45 | virtual void setBuffered(bool buffered); 46 | 47 | /** @copydoc Object::capture */ 48 | virtual void capture(); 49 | 50 | /** @copydoc Object::queryInterface */ 51 | virtual Interface* queryInterface(Interface::IType type) { return 0; } 52 | 53 | /** @copydoc Object::_initialize */ 54 | virtual void _initialize(); 55 | 56 | public: 57 | void _mouseCallback(EventRef theEvent); 58 | 59 | protected: 60 | static OSStatus WindowFocusChanged(EventHandlerCallRef nextHandler, EventRef event, void* macMouse); 61 | 62 | // "universal procedure pointers" - required reference for callbacks 63 | EventHandlerUPP mouseUPP; 64 | EventHandlerRef mouseEventRef; 65 | 66 | EventHandlerUPP mWindowFocusListener; 67 | EventHandlerRef mWindowFocusHandler; 68 | 69 | bool mNeedsToRegainFocus; 70 | bool mMouseWarped; 71 | 72 | MouseState mTempState; 73 | }; 74 | } 75 | 76 | #endif // OIS_MacMouse_H 77 | -------------------------------------------------------------------------------- /utils/ois/mac/MacPrereqs.h: -------------------------------------------------------------------------------- 1 | /* 2 | The zlib/libpng License 3 | 4 | Copyright (c) 2018 Arthur Brainville 5 | Copyright (c) 2015 Andrew Fenn 6 | Copyright (c) 2005-2010 Phillip Castaneda (pjcast -- www.wreckedgames.com) 7 | 8 | This software is provided 'as-is', without any express or implied warranty. In no 9 | event will the authors be held liable for any damages arising from the use of this 10 | software. 11 | 12 | Permission is granted to anyone to use this software for any purpose, including 13 | commercial applications, and to alter it and redistribute it freely, subject to the 14 | following restrictions: 15 | 16 | 1. The origin of this software must not be misrepresented; you must not claim that 17 | you wrote the original software. If you use this software in a product, 18 | an acknowledgment in the product documentation would be appreciated 19 | but is not required. 20 | 21 | 2. Altered source versions must be plainly marked as such, and must not be 22 | misrepresented as being the original software. 23 | 24 | 3. This notice may not be removed or altered from any source distribution. 25 | */ 26 | #ifndef OIS_MacPrereqs_H 27 | #define OIS_MacPrereqs_H 28 | 29 | #include 30 | #include 31 | #include 32 | 33 | namespace OIS 34 | { 35 | class MacInputManager; 36 | class MacHIDManager; 37 | class MacMouse; 38 | class MacKeyboard; 39 | 40 | /** 41 | Simple wrapper class for CFString which will create a valid CFString and retain ownership until class instance is outof scope 42 | To Access the CFStringRef instance, simply cast to void*, pass into a function expecting a void* CFStringRef object, or access via cf_str() method 43 | */ 44 | class OIS_CFString 45 | { 46 | public: 47 | OIS_CFString() { m_StringRef = CFStringCreateWithCString(NULL, "", kCFStringEncodingUTF8); } 48 | OIS_CFString(const char* c_str) { m_StringRef = CFStringCreateWithCString(NULL, c_str, kCFStringEncodingUTF8); } 49 | OIS_CFString(const std::string& s_str) { m_StringRef = CFStringCreateWithCString(NULL, s_str.c_str(), kCFStringEncodingUTF8); } 50 | ~OIS_CFString() { CFRelease(m_StringRef); } 51 | 52 | //Allow this class to be autoconverted to base class of StringRef (void*) 53 | operator void*() { return (void*)m_StringRef; } 54 | CFStringRef cf_str() { return m_StringRef; } 55 | 56 | private: 57 | CFStringRef m_StringRef; 58 | }; 59 | } 60 | #endif 61 | -------------------------------------------------------------------------------- /utils/ois/win32/Win32JoyStick.h: -------------------------------------------------------------------------------- 1 | /* 2 | The zlib/libpng License 3 | 4 | Copyright (c) 2018 Arthur Brainville 5 | Copyright (c) 2015 Andrew Fenn 6 | Copyright (c) 2005-2010 Phillip Castaneda (pjcast -- www.wreckedgames.com) 7 | 8 | This software is provided 'as-is', without any express or implied warranty. In no 9 | event will the authors be held liable for any damages arising from the use of this 10 | software. 11 | 12 | Permission is granted to anyone to use this software for any purpose, including 13 | commercial applications, and to alter it and redistribute it freely, subject to the 14 | following restrictions: 15 | 16 | 1. The origin of this software must not be misrepresented; you must not claim that 17 | you wrote the original software. If you use this software in a product, 18 | an acknowledgment in the product documentation would be appreciated 19 | but is not required. 20 | 21 | 2. Altered source versions must be plainly marked as such, and must not be 22 | misrepresented as being the original software. 23 | 24 | 3. This notice may not be removed or altered from any source distribution. 25 | */ 26 | #ifndef _WIN32_JOYSTICK_H_EADER_ 27 | #define _WIN32_JOYSTICK_H_EADER_ 28 | 29 | #include "OISJoyStick.h" 30 | #include "win32/Win32Prereqs.h" 31 | 32 | namespace OIS 33 | { 34 | class Win32JoyStick : public JoyStick 35 | { 36 | public: 37 | Win32JoyStick(InputManager* creator, IDirectInput8* pDI, bool buffered, DWORD coopSettings, const JoyStickInfo& info); 38 | virtual ~Win32JoyStick(); 39 | 40 | /** @copydoc Object::setBuffered */ 41 | virtual void setBuffered(bool buffered); 42 | 43 | /** @copydoc Object::capture */ 44 | virtual void capture(); 45 | 46 | //! hanlde xinput 47 | void captureXInput(); 48 | 49 | /** @copydoc Object::queryInterface */ 50 | virtual Interface* queryInterface(Interface::IType type); 51 | 52 | /** @copydoc Object::_initialize */ 53 | virtual void _initialize(); 54 | 55 | #ifdef OIS_WIN32_XINPUT_SUPPORT 56 | /** 57 | @remarks 58 | Enum each PNP device using WMI and check each device ID to see if it contains 59 | "IG_" (ex. "VID_045E&PID_028E&IG_00"). If it does, then it's an XInput device 60 | Unfortunately this information can not be found by just using DirectInput 61 | */ 62 | static void CheckXInputDevices(JoyStickInfoList& joys); 63 | #endif 64 | 65 | protected: 66 | //! Enumerates all things 67 | void _enumerate(); 68 | //! Enumerate axis callback 69 | static BOOL CALLBACK DIEnumDeviceObjectsCallback(LPCDIDEVICEOBJECTINSTANCE lpddoi, LPVOID pvRef); 70 | //! Enumerate Force Feedback callback 71 | static BOOL CALLBACK DIEnumEffectsCallback(LPCDIEFFECTINFO pdei, LPVOID pvRef); 72 | 73 | bool _doButtonClick(int button, DIDEVICEOBJECTDATA& di); 74 | bool _changePOV(int pov, DIDEVICEOBJECTDATA& di); 75 | 76 | IDirectInput8* mDirectInput; 77 | IDirectInputDevice8* mJoyStick; 78 | DIDEVCAPS mDIJoyCaps; 79 | DWORD coopSetting; 80 | 81 | JoyStickInfo mJoyInfo; 82 | 83 | //! A force feedback device 84 | Win32ForceFeedback* mFfDevice; 85 | 86 | //! Mapping 87 | int _AxisNumber; 88 | }; 89 | } 90 | 91 | #endif //_WIN32_JOYSTICK_H_EADER_ 92 | -------------------------------------------------------------------------------- /utils/ois/win32/Win32KeyBoard.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xarray/osgPhysX/0996bc0bac46e46f4dc09990be0d6750ac369f55/utils/ois/win32/Win32KeyBoard.cpp -------------------------------------------------------------------------------- /utils/ois/win32/Win32KeyBoard.h: -------------------------------------------------------------------------------- 1 | /* 2 | The zlib/libpng License 3 | 4 | Copyright (c) 2018 Arthur Brainville 5 | Copyright (c) 2015 Andrew Fenn 6 | Copyright (c) 2005-2010 Phillip Castaneda (pjcast -- www.wreckedgames.com) 7 | 8 | This software is provided 'as-is', without any express or implied warranty. In no 9 | event will the authors be held liable for any damages arising from the use of this 10 | software. 11 | 12 | Permission is granted to anyone to use this software for any purpose, including 13 | commercial applications, and to alter it and redistribute it freely, subject to the 14 | following restrictions: 15 | 16 | 1. The origin of this software must not be misrepresented; you must not claim that 17 | you wrote the original software. If you use this software in a product, 18 | an acknowledgment in the product documentation would be appreciated 19 | but is not required. 20 | 21 | 2. Altered source versions must be plainly marked as such, and must not be 22 | misrepresented as being the original software. 23 | 24 | 3. This notice may not be removed or altered from any source distribution. 25 | */ 26 | #ifndef _WIN32_KEYBOARD_H_EADER_ 27 | #define _WIN32_KEYBOARD_H_EADER_ 28 | 29 | #include "OISKeyboard.h" 30 | #include "win32/Win32Prereqs.h" 31 | 32 | namespace OIS 33 | { 34 | class Win32Keyboard : public Keyboard 35 | { 36 | public: 37 | /** 38 | @remarks 39 | Constructor 40 | @param pDI 41 | Valid DirectInput8 Interface 42 | @param buffered 43 | True for buffered input mode 44 | @param coopSettings 45 | A combination of DI Flags (see DX Help for info on input device settings) 46 | */ 47 | Win32Keyboard(InputManager* creator, IDirectInput8* pDI, bool buffered, DWORD coopSettings); 48 | virtual ~Win32Keyboard(); 49 | 50 | /** @copydoc Keyboard::isKeyDown */ 51 | virtual bool isKeyDown(KeyCode key) const; 52 | 53 | /** @copydoc Keyboard::getAsString */ 54 | virtual const std::string& getAsString(KeyCode kc); 55 | 56 | /** @copydoc Keyboard::getAsKeyCode */ 57 | virtual KeyCode getAsKeyCode(std::string str) 58 | { /*TODO: Implement OS version*/ 59 | return KC_UNASSIGNED; 60 | } 61 | 62 | /** @copydoc Keyboard::copyKeyStates */ 63 | virtual void copyKeyStates(char keys[256]) const; 64 | 65 | /** @copydoc Object::setBuffered */ 66 | virtual void setBuffered(bool buffered); 67 | 68 | /** @copydoc Object::capture */ 69 | virtual void capture(); 70 | 71 | /** @copydoc Object::queryInterface */ 72 | virtual Interface* queryInterface(Interface::IType type) 73 | { 74 | OIS_UNUSED(type); 75 | return 0; 76 | } 77 | 78 | /** @copydoc Object::_initialize */ 79 | virtual void _initialize(); 80 | 81 | protected: 82 | void _readBuffered(); 83 | void _read(); 84 | 85 | IDirectInput8* mDirectInput; 86 | IDirectInputDevice8* mKeyboard; 87 | DWORD coopSetting; 88 | 89 | unsigned char KeyBuffer[256]; 90 | 91 | //! Internal method for translating KeyCodes to Text 92 | int _translateText(KeyCode kc); 93 | 94 | //! Stored dead key from last translation 95 | WCHAR deadKey; 96 | 97 | //! used for getAsString 98 | std::string mGetString; 99 | }; 100 | } 101 | #endif //_WIN32_KEYBOARD_H_EADER_ 102 | -------------------------------------------------------------------------------- /utils/ois/win32/Win32Mouse.h: -------------------------------------------------------------------------------- 1 | /* 2 | The zlib/libpng License 3 | 4 | Copyright (c) 2018 Arthur Brainville 5 | Copyright (c) 2015 Andrew Fenn 6 | Copyright (c) 2005-2010 Phillip Castaneda (pjcast -- www.wreckedgames.com) 7 | 8 | This software is provided 'as-is', without any express or implied warranty. In no 9 | event will the authors be held liable for any damages arising from the use of this 10 | software. 11 | 12 | Permission is granted to anyone to use this software for any purpose, including 13 | commercial applications, and to alter it and redistribute it freely, subject to the 14 | following restrictions: 15 | 16 | 1. The origin of this software must not be misrepresented; you must not claim that 17 | you wrote the original software. If you use this software in a product, 18 | an acknowledgment in the product documentation would be appreciated 19 | but is not required. 20 | 21 | 2. Altered source versions must be plainly marked as such, and must not be 22 | misrepresented as being the original software. 23 | 24 | 3. This notice may not be removed or altered from any source distribution. 25 | */ 26 | #ifndef _WIN32_MOUSE_H_EADER_ 27 | #define _WIN32_MOUSE_H_EADER_ 28 | 29 | #include "OISMouse.h" 30 | #include "win32/Win32Prereqs.h" 31 | 32 | namespace OIS 33 | { 34 | class Win32Mouse : public Mouse 35 | { 36 | public: 37 | Win32Mouse(InputManager* creator, IDirectInput8* pDI, bool buffered, DWORD coopSettings); 38 | virtual ~Win32Mouse(); 39 | 40 | /** @copydoc Object::setBuffered */ 41 | virtual void setBuffered(bool buffered); 42 | 43 | /** @copydoc Object::capture */ 44 | virtual void capture(); 45 | 46 | /** @copydoc Object::queryInterface */ 47 | virtual Interface* queryInterface(Interface::IType type) 48 | { 49 | OIS_UNUSED(type); 50 | return 0; 51 | } 52 | 53 | /** @copydoc Object::_initialize */ 54 | virtual void _initialize(); 55 | 56 | protected: 57 | bool _doMouseClick(int mouseButton, unsigned char di); 58 | 59 | IDirectInput8* mDirectInput; 60 | IDirectInputDevice8* mMouse; 61 | DWORD coopSetting; 62 | HWND mHwnd; 63 | }; 64 | } 65 | 66 | #endif //_WIN32_MOUSE_H_EADER_ 67 | -------------------------------------------------------------------------------- /utils/ois/win32/Win32Prereqs.h: -------------------------------------------------------------------------------- 1 | /* 2 | The zlib/libpng License 3 | 4 | Copyright (c) 2018 Arthur Brainville 5 | Copyright (c) 2015 Andrew Fenn 6 | Copyright (c) 2005-2010 Phillip Castaneda (pjcast -- www.wreckedgames.com) 7 | 8 | This software is provided 'as-is', without any express or implied warranty. In no 9 | event will the authors be held liable for any damages arising from the use of this 10 | software. 11 | 12 | Permission is granted to anyone to use this software for any purpose, including 13 | commercial applications, and to alter it and redistribute it freely, subject to the 14 | following restrictions: 15 | 16 | 1. The origin of this software must not be misrepresented; you must not claim that 17 | you wrote the original software. If you use this software in a product, 18 | an acknowledgment in the product documentation would be appreciated 19 | but is not required. 20 | 21 | 2. Altered source versions must be plainly marked as such, and must not be 22 | misrepresented as being the original software. 23 | 24 | 3. This notice may not be removed or altered from any source distribution. 25 | */ 26 | #ifndef _WIN32_INPUTSYSTEM_PREREQS_H 27 | #define _WIN32_INPUTSYSTEM_PREREQS_H 28 | 29 | #include 30 | #define WIN32_LEAN_AND_MEAN 31 | #define DIRECTINPUT_VERSION 0x0800 32 | #include 33 | #include 34 | 35 | #ifdef OIS_WIN32_XINPUT_SUPPORT 36 | #include 37 | #endif 38 | 39 | //Max number of elements to collect from buffered DirectInput 40 | #define KEYBOARD_DX_BUFFERSIZE 17 41 | #define MOUSE_DX_BUFFERSIZE 128 42 | #define JOYSTICK_DX_BUFFERSIZE 129 43 | 44 | //MinGW defines 45 | #if defined(OIS_MINGW_COMPILER) 46 | #undef FIELD_OFFSET 47 | #define FIELD_OFFSET offsetof 48 | #endif 49 | 50 | namespace OIS 51 | { 52 | //Local Forward declarations 53 | class Win32InputManager; 54 | class Win32Keyboard; 55 | class Win32JoyStick; 56 | class Win32Mouse; 57 | class Win32ForceFeedback; 58 | 59 | //Information needed to create DirectInput joysticks 60 | class JoyStickInfo 61 | { 62 | public: 63 | int devId; 64 | GUID deviceID; 65 | GUID productGuid; 66 | std::string vendor; 67 | bool isXInput; 68 | int xInputDev; 69 | }; 70 | 71 | typedef std::vector JoyStickInfoList; 72 | } 73 | 74 | #endif //_WIN32_INPUTSYSTEM_PREREQS_H 75 | -------------------------------------------------------------------------------- /utils/ois/win32/extras/WiiMote/OISWiiMote.h: -------------------------------------------------------------------------------- 1 | #include "OISConfig.h" 2 | #ifdef OIS_WIN32_WIIMOTE_SUPPORT 3 | /* 4 | The zlib/libpng License 5 | 6 | Copyright (c) 2018 Arthur Brainville 7 | Copyright (c) 2015 Andrew Fenn 8 | Copyright (c) 2005-2010 Phillip Castaneda (pjcast -- www.wreckedgames.com) 9 | 10 | This software is provided 'as-is', without any express or implied warranty. In no 11 | event will the authors be held liable for any damages arising from the use of this 12 | software. 13 | 14 | Permission is granted to anyone to use this software for any purpose, including 15 | commercial applications, and to alter it and redistribute it freely, subject to the 16 | following restrictions: 17 | 18 | 1. The origin of this software must not be misrepresented; you must not claim that 19 | you wrote the original software. If you use this software in a product, 20 | an acknowledgment in the product documentation would be appreciated 21 | but is not required. 22 | 23 | 2. Altered source versions must be plainly marked as such, and must not be 24 | misrepresented as being the original software. 25 | 26 | 3. This notice may not be removed or altered from any source distribution. 27 | */ 28 | #ifndef OIS_WiiMote_H 29 | #define OIS_WiiMote_H 30 | #include "OISJoyStick.h" 31 | #include "OISWiiMoteRingBuffer.h" 32 | #include "wiimote.h" 33 | 34 | namespace OIS 35 | { 36 | class WiiMoteFactoryCreator; 37 | class WiiMoteForceFeedback; 38 | 39 | //Number of ring buffer events. should be nice sized (the structure is not very big) 40 | //Will be rounded up to power of two automatically 41 | #define OIS_WII_EVENT_BUFFER 32 42 | 43 | /** Specialty joystick - WiiMote controller */ 44 | class _OISExport WiiMote : public JoyStick 45 | { 46 | public: 47 | WiiMote(InputManager* creator, int id, bool buffered, WiiMoteFactoryCreator* local_creator); 48 | ~WiiMote(); 49 | 50 | //Overrides of Object 51 | void setBuffered(bool buffered); 52 | 53 | void capture(); 54 | 55 | Interface* queryInterface(Interface::IType type); 56 | 57 | void _initialize(); 58 | 59 | void _threadUpdate(); 60 | 61 | protected: 62 | void _doButtonCheck(bool new_state, int ois_button, unsigned int& pushed, unsigned int& released); 63 | bool _doPOVCheck(const cWiiMote::tButtonStatus& bState, unsigned int& newPosition); 64 | 65 | //! The creator who created us 66 | WiiMoteFactoryCreator* mWiiCreator; 67 | 68 | //! Actual WiiMote HID device 69 | cWiiMote mWiiMote; 70 | 71 | //! Used to signal thread that remote is ready 72 | volatile bool mtInitialized; 73 | 74 | //! Ringbuffer is used to store events from thread and be read from capture 75 | WiiMoteRingBuffer mRingBuffer; 76 | 77 | //Following variables are used entirely within threaded context 78 | int mtLastButtonStates; 79 | unsigned int mtLastPOVState; 80 | float mtLastX, mtLastY, mtLastZ; 81 | float mtLastNunChuckX, mtLastNunChuckY, mtLastNunChuckZ; 82 | int mLastNunChuckXAxis, mLastNunChuckYAxis; 83 | 84 | //Small workaround for slow calibration of wiimote data 85 | int _mWiiMoteMotionDelay; 86 | 87 | //Simple rumble force 88 | WiiMoteForceFeedback* mRumble; 89 | }; 90 | } 91 | #endif //OIS_WiiMote_H 92 | #endif 93 | -------------------------------------------------------------------------------- /utils/ois/win32/extras/WiiMote/OISWiiMoteForceFeedback.cpp: -------------------------------------------------------------------------------- 1 | #include "OISConfig.h" 2 | #ifdef OIS_WIN32_WIIMOTE_SUPPORT 3 | /* 4 | The zlib/libpng License 5 | 6 | Copyright (c) 2018 Arthur Brainville 7 | Copyright (c) 2015 Andrew Fenn 8 | Copyright (c) 2005-2010 Phillip Castaneda (pjcast -- www.wreckedgames.com) 9 | 10 | This software is provided 'as-is', without any express or implied warranty. In no 11 | event will the authors be held liable for any damages arising from the use of this 12 | software. 13 | 14 | Permission is granted to anyone to use this software for any purpose, including 15 | commercial applications, and to alter it and redistribute it freely, subject to the 16 | following restrictions: 17 | 18 | 1. The origin of this software must not be misrepresented; you must not claim that 19 | you wrote the original software. If you use this software in a product, 20 | an acknowledgment in the product documentation would be appreciated 21 | but is not required. 22 | 23 | 2. Altered source versions must be plainly marked as such, and must not be 24 | misrepresented as being the original software. 25 | 26 | 3. This notice may not be removed or altered from any source distribution. 27 | */ 28 | #include "OISWiiMoteForceFeedback.h" 29 | #include "OISEffect.h" 30 | 31 | using namespace OIS; 32 | 33 | //-----------------------------------------------------------------------------------// 34 | WiiMoteForceFeedback::WiiMoteForceFeedback(cWiiMote& wiiMote) : 35 | mWiiMote(wiiMote), mHandle(-1) 36 | { 37 | //One and only supported effect 38 | _addEffectTypes(OIS::Effect::ConstantForce, OIS::Effect::Constant); 39 | } 40 | 41 | //-----------------------------------------------------------------------------------// 42 | WiiMoteForceFeedback::~WiiMoteForceFeedback() 43 | { 44 | mWiiMote.SetVibration(false); 45 | } 46 | 47 | //-----------------------------------------------------------------------------------// 48 | void WiiMoteForceFeedback::upload(const Effect* effect) 49 | { 50 | if(effect) 51 | { 52 | //Multiple effects are useless, just return 53 | if(mHandle != -1 || effect->_handle != -1) return; 54 | 55 | //Ok, so we are uploading a fresh effect 56 | effect->_handle = mHandle = 1; 57 | 58 | mWiiMote.SetVibration(true); 59 | } 60 | } 61 | 62 | //-----------------------------------------------------------------------------------// 63 | void WiiMoteForceFeedback::modify(const Effect* effect) 64 | { 65 | //Nothing to modify 66 | } 67 | 68 | //-----------------------------------------------------------------------------------// 69 | void WiiMoteForceFeedback::remove(const Effect* effect) 70 | { 71 | //We have no effects uploaded, so just return 72 | if(mHandle == -1 || effect == 0) return; 73 | 74 | if(mHandle == effect->_handle) 75 | { 76 | mWiiMote.SetVibration(false); 77 | mHandle = effect->_handle = -1; 78 | } 79 | } 80 | #endif 81 | -------------------------------------------------------------------------------- /utils/ois/win32/extras/WiiMote/OISWiiMoteForceFeedback.h: -------------------------------------------------------------------------------- 1 | #include "OISConfig.h" 2 | #ifdef OIS_WIN32_WIIMOTE_SUPPORT 3 | /* 4 | The zlib/libpng License 5 | 6 | Copyright (c) 2018 Arthur Brainville 7 | Copyright (c) 2015 Andrew Fenn 8 | Copyright (c) 2005-2010 Phillip Castaneda (pjcast -- www.wreckedgames.com) 9 | 10 | This software is provided 'as-is', without any express or implied warranty. In no 11 | event will the authors be held liable for any damages arising from the use of this 12 | software. 13 | 14 | Permission is granted to anyone to use this software for any purpose, including 15 | commercial applications, and to alter it and redistribute it freely, subject to the 16 | following restrictions: 17 | 18 | 1. The origin of this software must not be misrepresented; you must not claim that 19 | you wrote the original software. If you use this software in a product, 20 | an acknowledgment in the product documentation would be appreciated 21 | but is not required. 22 | 23 | 2. Altered source versions must be plainly marked as such, and must not be 24 | misrepresented as being the original software. 25 | 26 | 3. This notice may not be removed or altered from any source distribution. 27 | */ 28 | #ifndef OIS_WiiMoteForceFeedBack_H 29 | #define OIS_WiiMoteForceFeedBack_H 30 | 31 | #include "OISPrereqs.h" 32 | #include "OISForceFeedback.h" 33 | #include "wiimote.h" 34 | 35 | namespace OIS 36 | { 37 | class WiiMoteForceFeedback : public ForceFeedback 38 | { 39 | public: 40 | WiiMoteForceFeedback(cWiiMote& wiiMote); 41 | ~WiiMoteForceFeedback(); 42 | 43 | /** @copydoc ForceFeedback::upload */ 44 | void upload(const Effect* effect); 45 | 46 | /** @copydoc ForceFeedback::modify */ 47 | void modify(const Effect* effect); 48 | 49 | /** @copydoc ForceFeedback::remove */ 50 | void remove(const Effect* effect); 51 | 52 | /** @copydoc ForceFeedback::setMasterGain */ 53 | void setMasterGain(float level) { } 54 | 55 | /** @copydoc ForceFeedback::setAutoCenterMode */ 56 | void setAutoCenterMode(bool auto_on) { } 57 | 58 | /** @copydoc ForceFeedback::getFFAxesNumber */ 59 | short getFFAxesNumber() { return 1; } 60 | 61 | protected: 62 | //! The WiiMote associated with this effect interface 63 | cWiiMote& mWiiMote; 64 | 65 | //! The handle of the one and only allowed effect 66 | int mHandle; 67 | }; 68 | } 69 | #endif //OIS_WiiMoteForceFeedBack_H 70 | #endif 71 | -------------------------------------------------------------------------------- /utils/ois/win32/extras/WiiMote/OISWiiMoteRingBuffer.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xarray/osgPhysX/0996bc0bac46e46f4dc09990be0d6750ac369f55/utils/ois/win32/extras/WiiMote/OISWiiMoteRingBuffer.cpp -------------------------------------------------------------------------------- /utils/ois/win32/extras/WiiMote/hiddevice.h: -------------------------------------------------------------------------------- 1 | #include "OISConfig.h" 2 | #ifdef OIS_WIN32_WIIMOTE_SUPPORT 3 | //cWiimote 0.2 by Kevin Forbes (http://simulatedcomicproduct.com) 4 | //This code is public domain, and comes with no warranty. The user takes full responsibility for anything that happens as a result from using this code. 5 | 6 | #ifndef HIDDEVICE_H 7 | #define HIDDEVICE_H 8 | 9 | #include 10 | 11 | class cHIDDevice 12 | { 13 | public: 14 | cHIDDevice(); 15 | ~cHIDDevice(); 16 | bool Disconnect(); 17 | bool Connect(unsigned short device_id, unsigned short vendor_id, int index = 0); 18 | bool IsConnected() const { return mConnected; } 19 | 20 | bool WriteToDevice(unsigned const char* OutputReport, int num_bytes); 21 | bool ReadFromDevice(unsigned const char* buffer, int max_bytes, int& bytes_read, int timeout = 50); 22 | 23 | private: 24 | //bool OpenDevice(int index, unsigned short device_id, unsigned short vendor_id); 25 | bool OpenDevice(unsigned short device_id, unsigned short vendor_id, int index); 26 | //bool FindWiimote(); 27 | void GetCapabilities(); 28 | void PrepareForOverlappedTransfer(); 29 | 30 | HANDLE mHandle; 31 | HANDLE mEvent; 32 | HANDLE WriteHandle; 33 | HANDLE ReadHandle; 34 | OVERLAPPED mOverlapped; 35 | OVERLAPPED HIDOverlapped; 36 | // HIDP_CAPS Capabilities; 37 | bool mConnected; 38 | }; 39 | #endif 40 | #endif 41 | -------------------------------------------------------------------------------- /utils/ois/win32/extras/WiiMote/main.cpp: -------------------------------------------------------------------------------- 1 | //cWiimote 0.2 by Kevin Forbes (http://simulatedcomicproduct.com) 2 | //This code is public domain, and comes with no warranty. The user takes full responsibility for anything that happens as a result from using this code. 3 | 4 | //#include "wiimote.h" 5 | //#include 6 | 7 | //Features: 8 | // Read Accelerometer, button values from the wiimote 9 | // Read Accelerometer, stick, and button values from the nunchuck 10 | // Preliminary IR support 11 | 12 | //Known issues: 13 | // The IR support is spotty at best. It tends to kick out if you plug your 'chuck in and out too many times 14 | // Reading 'chuck calibration data doesn't seem to work, so the code just uses defaults 15 | // Multiple Wiimote support not yet tested 16 | // May only work with Bluesoleil stack? 17 | 18 | //Instructions: 19 | // See below for how to connect to a device and start the data stream. 20 | // It is up to the user to call heartbeat fast enough - if you're too slow, you will loose data. Ideally, this would be done in a separate thread 21 | // There are several public functions for getting the values from the wiimote. Look in cWiiMote::PrintStatus for examples. 22 | 23 | //Version History: 24 | //0.1 Preliminary Release 25 | //0.2 Added nunchuck, IR support 26 | 27 | /* 28 | int main(int nargs, const char * cargs) 29 | { 30 | cWiiMote wiimote; 31 | 32 | if (wiimote.ConnectToDevice() && 33 | wiimote.StartDataStream()) 34 | { 35 | for (;;) 36 | { 37 | wiimote.HeartBeat(); 38 | wiimote.PrintStatus(); 39 | } 40 | } 41 | return 0; 42 | } 43 | */ 44 | 45 | //#eof "$Id: main.cpp,v 1.1.2.1 2008/02/14 03:33:36 pjcast Exp $" 46 | -------------------------------------------------------------------------------- /utils/ozz/animation/offline/animation_builder.h: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------// 2 | // // 3 | // ozz-animation is hosted at http://github.com/guillaumeblanc/ozz-animation // 4 | // and distributed under the MIT License (MIT). // 5 | // // 6 | // Copyright (c) Guillaume Blanc // 7 | // // 8 | // Permission is hereby granted, free of charge, to any person obtaining a // 9 | // copy of this software and associated documentation files (the "Software"), // 10 | // to deal in the Software without restriction, including without limitation // 11 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, // 12 | // and/or sell copies of the Software, and to permit persons to whom the // 13 | // Software is furnished to do so, subject to the following conditions: // 14 | // // 15 | // The above copyright notice and this permission notice shall be included in // 16 | // all copies or substantial portions of the Software. // 17 | // // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL // 21 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING // 23 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // 24 | // DEALINGS IN THE SOFTWARE. // 25 | // // 26 | //----------------------------------------------------------------------------// 27 | 28 | #ifndef OZZ_OZZ_ANIMATION_OFFLINE_ANIMATION_BUILDER_H_ 29 | #define OZZ_OZZ_ANIMATION_OFFLINE_ANIMATION_BUILDER_H_ 30 | 31 | #include "ozz/base/memory/unique_ptr.h" 32 | 33 | namespace ozz { 34 | namespace animation { 35 | 36 | // Forward declares the runtime animation type. 37 | class Animation; 38 | 39 | namespace offline { 40 | 41 | // Forward declares the offline animation type. 42 | struct RawAnimation; 43 | 44 | // Defines the class responsible of building runtime animation instances from 45 | // offline raw animations. 46 | // No optimization at all is performed on the raw animation. 47 | class AnimationBuilder { 48 | public: 49 | // Creates an Animation based on _raw_animation and *this builder parameters. 50 | // Returns a valid Animation on success. 51 | // See RawAnimation::Validate() for more details about failure reasons. 52 | // The animation is returned as an unique_ptr as ownership is given back to 53 | // the caller. 54 | unique_ptr operator()(const RawAnimation& _raw_animation) const; 55 | }; 56 | } // namespace offline 57 | } // namespace animation 58 | } // namespace ozz 59 | #endif // OZZ_OZZ_ANIMATION_OFFLINE_ANIMATION_BUILDER_H_ 60 | -------------------------------------------------------------------------------- /utils/ozz/animation/offline/fbx/fbx2ozz.cc: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------// 2 | // // 3 | // ozz-animation is hosted at http://github.com/guillaumeblanc/ozz-animation // 4 | // and distributed under the MIT License (MIT). // 5 | // // 6 | // Copyright (c) Guillaume Blanc // 7 | // // 8 | // Permission is hereby granted, free of charge, to any person obtaining a // 9 | // copy of this software and associated documentation files (the "Software"), // 10 | // to deal in the Software without restriction, including without limitation // 11 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, // 12 | // and/or sell copies of the Software, and to permit persons to whom the // 13 | // Software is furnished to do so, subject to the following conditions: // 14 | // // 15 | // The above copyright notice and this permission notice shall be included in // 16 | // all copies or substantial portions of the Software. // 17 | // // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL // 21 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING // 23 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // 24 | // DEALINGS IN THE SOFTWARE. // 25 | // // 26 | //----------------------------------------------------------------------------// 27 | 28 | #include "animation/offline/fbx/fbx2ozz.h" 29 | 30 | #include "ozz/base/log.h" 31 | 32 | int main(int _argc, const char** _argv) { 33 | Fbx2OzzImporter converter; 34 | return converter(_argc, _argv); 35 | } 36 | 37 | Fbx2OzzImporter::Fbx2OzzImporter() 38 | : settings_(fbx_manager_), scene_loader_(nullptr) {} 39 | 40 | Fbx2OzzImporter::~Fbx2OzzImporter() { ozz::Delete(scene_loader_); } 41 | 42 | bool Fbx2OzzImporter::Load(const char* _filename) { 43 | ozz::Delete(scene_loader_); 44 | scene_loader_ = ozz::New( 45 | _filename, "", fbx_manager_, settings_); 46 | 47 | if (!scene_loader_->scene()) { 48 | ozz::log::Err() << "Failed to import file " << _filename << "." 49 | << std::endl; 50 | ozz::Delete(scene_loader_); 51 | scene_loader_ = nullptr; 52 | return false; 53 | } 54 | return true; 55 | } 56 | -------------------------------------------------------------------------------- /utils/ozz/animation/offline/fbx/fbx2ozz_skel.cc: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------// 2 | // // 3 | // ozz-animation is hosted at http://github.com/guillaumeblanc/ozz-animation // 4 | // and distributed under the MIT License (MIT). // 5 | // // 6 | // Copyright (c) Guillaume Blanc // 7 | // // 8 | // Permission is hereby granted, free of charge, to any person obtaining a // 9 | // copy of this software and associated documentation files (the "Software"), // 10 | // to deal in the Software without restriction, including without limitation // 11 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, // 12 | // and/or sell copies of the Software, and to permit persons to whom the // 13 | // Software is furnished to do so, subject to the following conditions: // 14 | // // 15 | // The above copyright notice and this permission notice shall be included in // 16 | // all copies or substantial portions of the Software. // 17 | // // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL // 21 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING // 23 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // 24 | // DEALINGS IN THE SOFTWARE. // 25 | // // 26 | //----------------------------------------------------------------------------// 27 | 28 | #include "animation/offline/fbx/fbx2ozz.h" 29 | 30 | #include "ozz/animation/offline/fbx/fbx.h" 31 | #include "ozz/animation/offline/fbx/fbx_skeleton.h" 32 | 33 | #include "ozz/animation/offline/raw_skeleton.h" 34 | 35 | #include "ozz/base/log.h" 36 | 37 | bool Fbx2OzzImporter::Import(ozz::animation::offline::RawSkeleton* _skeleton, 38 | const NodeType& _types) { 39 | if (!_skeleton) { 40 | return false; 41 | } 42 | 43 | // Reset skeleton. 44 | *_skeleton = ozz::animation::offline::RawSkeleton(); 45 | 46 | if (!scene_loader_) { 47 | return false; 48 | } 49 | 50 | if (!ozz::animation::offline::fbx::ExtractSkeleton(*scene_loader_, _types, 51 | _skeleton)) { 52 | ozz::log::Err() << "Fbx skeleton extraction failed." << std::endl; 53 | return false; 54 | } 55 | 56 | return true; 57 | } 58 | -------------------------------------------------------------------------------- /utils/ozz/animation/offline/fbx/fbx_skeleton.h: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------// 2 | // // 3 | // ozz-animation is hosted at http://github.com/guillaumeblanc/ozz-animation // 4 | // and distributed under the MIT License (MIT). // 5 | // // 6 | // Copyright (c) Guillaume Blanc // 7 | // // 8 | // Permission is hereby granted, free of charge, to any person obtaining a // 9 | // copy of this software and associated documentation files (the "Software"), // 10 | // to deal in the Software without restriction, including without limitation // 11 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, // 12 | // and/or sell copies of the Software, and to permit persons to whom the // 13 | // Software is furnished to do so, subject to the following conditions: // 14 | // // 15 | // The above copyright notice and this permission notice shall be included in // 16 | // all copies or substantial portions of the Software. // 17 | // // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL // 21 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING // 23 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // 24 | // DEALINGS IN THE SOFTWARE. // 25 | // // 26 | //----------------------------------------------------------------------------// 27 | 28 | #ifndef OZZ_OZZ_ANIMATION_OFFLINE_FBX_FBX_SKELETON_H_ 29 | #define OZZ_OZZ_ANIMATION_OFFLINE_FBX_FBX_SKELETON_H_ 30 | 31 | #include "ozz/animation/offline/fbx/fbx.h" 32 | #include "ozz/animation/offline/tools/import2ozz.h" 33 | 34 | namespace ozz { 35 | namespace animation { 36 | namespace offline { 37 | 38 | struct RawSkeleton; 39 | 40 | namespace fbx { 41 | 42 | bool ExtractSkeleton(FbxSceneLoader& _loader, 43 | const OzzImporter::NodeType& _types, 44 | RawSkeleton* _skeleton); 45 | 46 | } // namespace fbx 47 | } // namespace offline 48 | } // namespace animation 49 | } // namespace ozz 50 | #endif // OZZ_OZZ_ANIMATION_OFFLINE_FBX_FBX_SKELETON_H_ 51 | -------------------------------------------------------------------------------- /utils/ozz/animation/offline/gltf/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if(NOT ozz_build_gltf) 2 | return() 3 | endif() 4 | 5 | add_executable(gltf2ozz 6 | gltf2ozz.cc) 7 | 8 | target_link_libraries(gltf2ozz PRIVATE 9 | ozz_animation_tools) 10 | set_target_properties(gltf2ozz 11 | PROPERTIES FOLDER "ozz/tools") 12 | 13 | install(TARGETS gltf2ozz DESTINATION bin/tools) 14 | -------------------------------------------------------------------------------- /utils/ozz/animation/offline/raw_skeleton.cc: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------// 2 | // // 3 | // ozz-animation is hosted at http://github.com/guillaumeblanc/ozz-animation // 4 | // and distributed under the MIT License (MIT). // 5 | // // 6 | // Copyright (c) Guillaume Blanc // 7 | // // 8 | // Permission is hereby granted, free of charge, to any person obtaining a // 9 | // copy of this software and associated documentation files (the "Software"), // 10 | // to deal in the Software without restriction, including without limitation // 11 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, // 12 | // and/or sell copies of the Software, and to permit persons to whom the // 13 | // Software is furnished to do so, subject to the following conditions: // 14 | // // 15 | // The above copyright notice and this permission notice shall be included in // 16 | // all copies or substantial portions of the Software. // 17 | // // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL // 21 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING // 23 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // 24 | // DEALINGS IN THE SOFTWARE. // 25 | // // 26 | //----------------------------------------------------------------------------// 27 | 28 | #include "ozz/animation/offline/raw_skeleton.h" 29 | 30 | #include "ozz/animation/runtime/skeleton.h" 31 | 32 | namespace ozz { 33 | namespace animation { 34 | namespace offline { 35 | 36 | RawSkeleton::RawSkeleton() {} 37 | 38 | RawSkeleton::~RawSkeleton() {} 39 | 40 | bool RawSkeleton::Validate() const { 41 | if (num_joints() > Skeleton::kMaxJoints) { 42 | return false; 43 | } 44 | return true; 45 | } 46 | 47 | namespace { 48 | struct JointCounter { 49 | JointCounter() : num_joints(0) {} 50 | void operator()(const RawSkeleton::Joint&, const RawSkeleton::Joint*) { 51 | ++num_joints; 52 | } 53 | int num_joints; 54 | }; 55 | } // namespace 56 | 57 | // Iterates through all the root children and count them. 58 | int RawSkeleton::num_joints() const { 59 | return IterateJointsDF(*this, JointCounter()).num_joints; 60 | } 61 | } // namespace offline 62 | } // namespace animation 63 | } // namespace ozz 64 | -------------------------------------------------------------------------------- /utils/ozz/animation/offline/skeleton_builder.h: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------// 2 | // // 3 | // ozz-animation is hosted at http://github.com/guillaumeblanc/ozz-animation // 4 | // and distributed under the MIT License (MIT). // 5 | // // 6 | // Copyright (c) Guillaume Blanc // 7 | // // 8 | // Permission is hereby granted, free of charge, to any person obtaining a // 9 | // copy of this software and associated documentation files (the "Software"), // 10 | // to deal in the Software without restriction, including without limitation // 11 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, // 12 | // and/or sell copies of the Software, and to permit persons to whom the // 13 | // Software is furnished to do so, subject to the following conditions: // 14 | // // 15 | // The above copyright notice and this permission notice shall be included in // 16 | // all copies or substantial portions of the Software. // 17 | // // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL // 21 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING // 23 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // 24 | // DEALINGS IN THE SOFTWARE. // 25 | // // 26 | //----------------------------------------------------------------------------// 27 | 28 | #ifndef OZZ_OZZ_ANIMATION_OFFLINE_SKELETON_BUILDER_H_ 29 | #define OZZ_OZZ_ANIMATION_OFFLINE_SKELETON_BUILDER_H_ 30 | 31 | #include "ozz/base/maths/transform.h" 32 | #include "ozz/base/memory/unique_ptr.h" 33 | 34 | namespace ozz { 35 | namespace animation { 36 | 37 | // Forward declares the runtime skeleton type. 38 | class Skeleton; 39 | 40 | namespace offline { 41 | 42 | // Forward declares the offline skeleton type. 43 | struct RawSkeleton; 44 | 45 | // Defines the class responsible of building Skeleton instances. 46 | class SkeletonBuilder { 47 | public: 48 | // Creates a Skeleton based on _raw_skeleton and *this builder parameters. 49 | // Returns a Skeleton instance on success, an empty unique_ptr on failure. See 50 | // RawSkeleton::Validate() for more details about failure reasons. 51 | // The skeleton is returned as an unique_ptr as ownership is given back to the 52 | // caller. 53 | ozz::unique_ptr operator()( 54 | const RawSkeleton& _raw_skeleton) const; 55 | }; 56 | } // namespace offline 57 | } // namespace animation 58 | } // namespace ozz 59 | #endif // OZZ_OZZ_ANIMATION_OFFLINE_SKELETON_BUILDER_H_ 60 | -------------------------------------------------------------------------------- /utils/ozz/animation/offline/tools/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if(NOT ozz_build_tools) 2 | return() 3 | endif() 4 | 5 | add_subdirectory(${PROJECT_SOURCE_DIR}/extern/jsoncpp json) 6 | 7 | add_library(ozz_animation_tools STATIC 8 | ${PROJECT_SOURCE_DIR}/include/ozz/animation/offline/tools/import2ozz.h 9 | import2ozz.cc 10 | import2ozz_anim.h 11 | import2ozz_anim.cc 12 | import2ozz_config.h 13 | import2ozz_config.cc 14 | import2ozz_skel.h 15 | import2ozz_skel.cc 16 | import2ozz_track.h 17 | import2ozz_track.cc) 18 | target_link_libraries(ozz_animation_tools 19 | ozz_animation_offline 20 | ozz_options 21 | json) 22 | set_target_properties(ozz_animation_tools 23 | PROPERTIES FOLDER "ozz/tools") 24 | 25 | install(TARGETS ozz_animation_tools DESTINATION lib) 26 | 27 | fuse_target("ozz_animation_tools") 28 | 29 | if(NOT EMSCRIPTEN) 30 | add_executable(dump2ozz 31 | dump2ozz.cc) 32 | target_link_libraries(dump2ozz 33 | ozz_animation_tools 34 | ozz_options) 35 | 36 | # Uses a fake import file to dump reference and default configurations. 37 | add_custom_command(TARGET dump2ozz POST_BUILD 38 | COMMAND dump2ozz "--file=${CMAKE_CURRENT_SOURCE_DIR}/dump2ozz.cc" "--config={\"skeleton\": {\"import\":{\"enable\":false}},\"animations\":[]}" "--config_dump_reference=${CMAKE_CURRENT_SOURCE_DIR}/reference.json" VERBATIM) 39 | 40 | set_target_properties(dump2ozz 41 | PROPERTIES FOLDER "ozz/tools") 42 | endif() -------------------------------------------------------------------------------- /utils/ozz/animation/offline/tools/import2ozz_anim.h: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------// 2 | // // 3 | // ozz-animation is hosted at http://github.com/guillaumeblanc/ozz-animation // 4 | // and distributed under the MIT License (MIT). // 5 | // // 6 | // Copyright (c) Guillaume Blanc // 7 | // // 8 | // Permission is hereby granted, free of charge, to any person obtaining a // 9 | // copy of this software and associated documentation files (the "Software"), // 10 | // to deal in the Software without restriction, including without limitation // 11 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, // 12 | // and/or sell copies of the Software, and to permit persons to whom the // 13 | // Software is furnished to do so, subject to the following conditions: // 14 | // // 15 | // The above copyright notice and this permission notice shall be included in // 16 | // all copies or substantial portions of the Software. // 17 | // // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL // 21 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING // 23 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // 24 | // DEALINGS IN THE SOFTWARE. // 25 | // // 26 | //----------------------------------------------------------------------------// 27 | 28 | #ifndef OZZ_ANIMATION_OFFLINE_TOOLS_IMPORT2OZZ_ANIM_H_ 29 | #define OZZ_ANIMATION_OFFLINE_TOOLS_IMPORT2OZZ_ANIM_H_ 30 | 31 | #include "ozz/base/endianness.h" 32 | #include "ozz/base/platform.h" 33 | 34 | #include "animation/offline/tools/import2ozz_config.h" 35 | #include "ozz/animation/offline/tools/import2ozz.h" 36 | 37 | namespace Json { 38 | class Value; 39 | } 40 | 41 | namespace ozz { 42 | namespace animation { 43 | namespace offline { 44 | 45 | class OzzImporter; 46 | bool ImportAnimations(const Json::Value& _config, OzzImporter* _importer, 47 | const ozz::Endianness _endianness); 48 | 49 | // Additive reference enum to config string conversions. 50 | struct AdditiveReferenceEnum { 51 | enum Value { kAnimation, kSkeleton }; 52 | }; 53 | struct AdditiveReference 54 | : JsonEnum { 55 | static EnumNames GetNames(); 56 | }; 57 | } // namespace offline 58 | } // namespace animation 59 | } // namespace ozz 60 | #endif // OZZ_ANIMATION_OFFLINE_TOOLS_IMPORT2OZZ_ANIM_H_ 61 | -------------------------------------------------------------------------------- /utils/ozz/animation/offline/tools/import2ozz_skel.h: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------// 2 | // // 3 | // ozz-animation is hosted at http://github.com/guillaumeblanc/ozz-animation // 4 | // and distributed under the MIT License (MIT). // 5 | // // 6 | // Copyright (c) Guillaume Blanc // 7 | // // 8 | // Permission is hereby granted, free of charge, to any person obtaining a // 9 | // copy of this software and associated documentation files (the "Software"), // 10 | // to deal in the Software without restriction, including without limitation // 11 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, // 12 | // and/or sell copies of the Software, and to permit persons to whom the // 13 | // Software is furnished to do so, subject to the following conditions: // 14 | // // 15 | // The above copyright notice and this permission notice shall be included in // 16 | // all copies or substantial portions of the Software. // 17 | // // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL // 21 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING // 23 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // 24 | // DEALINGS IN THE SOFTWARE. // 25 | // // 26 | //----------------------------------------------------------------------------// 27 | 28 | #ifndef OZZ_ANIMATION_OFFLINE_TOOLS_IMPORT2OZZ_SKEL_H_ 29 | #define OZZ_ANIMATION_OFFLINE_TOOLS_IMPORT2OZZ_SKEL_H_ 30 | 31 | #include "ozz/base/endianness.h" 32 | #include "ozz/base/platform.h" 33 | 34 | namespace Json { 35 | class Value; 36 | } 37 | 38 | namespace ozz { 39 | namespace animation { 40 | namespace offline { 41 | 42 | class OzzImporter; 43 | 44 | bool ImportSkeleton(const Json::Value& _config, OzzImporter* _importer, 45 | const ozz::Endianness _endianness); 46 | 47 | } // namespace offline 48 | } // namespace animation 49 | } // namespace ozz 50 | #endif // OZZ_ANIMATION_OFFLINE_TOOLS_IMPORT2OZZ_SKEL_H_ 51 | -------------------------------------------------------------------------------- /utils/ozz/animation/offline/tools/import2ozz_track.h: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------// 2 | // // 3 | // ozz-animation is hosted at http://github.com/guillaumeblanc/ozz-animation // 4 | // and distributed under the MIT License (MIT). // 5 | // // 6 | // Copyright (c) Guillaume Blanc // 7 | // // 8 | // Permission is hereby granted, free of charge, to any person obtaining a // 9 | // copy of this software and associated documentation files (the "Software"), // 10 | // to deal in the Software without restriction, including without limitation // 11 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, // 12 | // and/or sell copies of the Software, and to permit persons to whom the // 13 | // Software is furnished to do so, subject to the following conditions: // 14 | // // 15 | // The above copyright notice and this permission notice shall be included in // 16 | // all copies or substantial portions of the Software. // 17 | // // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL // 21 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING // 23 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // 24 | // DEALINGS IN THE SOFTWARE. // 25 | // // 26 | //----------------------------------------------------------------------------// 27 | 28 | #ifndef OZZ_ANIMATION_OFFLINE_TOOLS_IMPORT2OZZ_TRACK_H_ 29 | #define OZZ_ANIMATION_OFFLINE_TOOLS_IMPORT2OZZ_TRACK_H_ 30 | 31 | #include "ozz/base/endianness.h" 32 | #include "ozz/base/platform.h" 33 | 34 | #include "animation/offline/tools/import2ozz_config.h" 35 | #include "ozz/animation/offline/tools/import2ozz.h" 36 | 37 | namespace Json { 38 | class Value; 39 | } 40 | 41 | namespace ozz { 42 | namespace animation { 43 | class Skeleton; 44 | namespace offline { 45 | 46 | class OzzImporter; 47 | bool ProcessTracks(OzzImporter& _importer, const char* _animation_name, 48 | const Skeleton& _skeleton, const Json::Value& _config, 49 | const ozz::Endianness _endianness); 50 | 51 | // Property type enum to config string conversions. 52 | struct PropertyTypeConfig 53 | : JsonEnum { 54 | static EnumNames GetNames(); 55 | }; 56 | } // namespace offline 57 | } // namespace animation 58 | } // namespace ozz 59 | #endif // OZZ_ANIMATION_OFFLINE_TOOLS_IMPORT2OZZ_TRACK_H_ 60 | -------------------------------------------------------------------------------- /utils/ozz/animation/runtime/animation_utils.cc: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------// 2 | // // 3 | // ozz-animation is hosted at http://github.com/guillaumeblanc/ozz-animation // 4 | // and distributed under the MIT License (MIT). // 5 | // // 6 | // Copyright (c) Guillaume Blanc // 7 | // // 8 | // Permission is hereby granted, free of charge, to any person obtaining a // 9 | // copy of this software and associated documentation files (the "Software"), // 10 | // to deal in the Software without restriction, including without limitation // 11 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, // 12 | // and/or sell copies of the Software, and to permit persons to whom the // 13 | // Software is furnished to do so, subject to the following conditions: // 14 | // // 15 | // The above copyright notice and this permission notice shall be included in // 16 | // all copies or substantial portions of the Software. // 17 | // // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL // 21 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING // 23 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // 24 | // DEALINGS IN THE SOFTWARE. // 25 | // // 26 | //----------------------------------------------------------------------------// 27 | 28 | #include "ozz/animation/runtime/animation_utils.h" 29 | 30 | // Internal include file 31 | #define OZZ_INCLUDE_PRIVATE_HEADER // Allows to include private headers. 32 | #include "animation/runtime/animation_keyframe.h" 33 | 34 | namespace ozz { 35 | namespace animation { 36 | 37 | template 38 | inline int CountKeyframesImpl(const span& _keys, int _track) { 39 | if (_track < 0) { 40 | return static_cast(_keys.size()); 41 | } 42 | 43 | int count = 0; 44 | for (const _Key& key : _keys) { 45 | if (key.track == _track) { 46 | ++count; 47 | } 48 | } 49 | return count; 50 | } 51 | 52 | int CountTranslationKeyframes(const Animation& _animation, int _track) { 53 | return CountKeyframesImpl(_animation.translations(), _track); 54 | } 55 | int CountRotationKeyframes(const Animation& _animation, int _track) { 56 | return CountKeyframesImpl(_animation.rotations(), _track); 57 | } 58 | int CountScaleKeyframes(const Animation& _animation, int _track) { 59 | return CountKeyframesImpl(_animation.scales(), _track); 60 | } 61 | } // namespace animation 62 | } // namespace ozz 63 | -------------------------------------------------------------------------------- /utils/ozz/animation/runtime/animation_utils.h: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------// 2 | // // 3 | // ozz-animation is hosted at http://github.com/guillaumeblanc/ozz-animation // 4 | // and distributed under the MIT License (MIT). // 5 | // // 6 | // Copyright (c) Guillaume Blanc // 7 | // // 8 | // Permission is hereby granted, free of charge, to any person obtaining a // 9 | // copy of this software and associated documentation files (the "Software"), // 10 | // to deal in the Software without restriction, including without limitation // 11 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, // 12 | // and/or sell copies of the Software, and to permit persons to whom the // 13 | // Software is furnished to do so, subject to the following conditions: // 14 | // // 15 | // The above copyright notice and this permission notice shall be included in // 16 | // all copies or substantial portions of the Software. // 17 | // // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL // 21 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING // 23 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // 24 | // DEALINGS IN THE SOFTWARE. // 25 | // // 26 | //----------------------------------------------------------------------------// 27 | 28 | #ifndef OZZ_OZZ_ANIMATION_RUNTIME_ANIMATION_UTILS_H_ 29 | #define OZZ_OZZ_ANIMATION_RUNTIME_ANIMATION_UTILS_H_ 30 | 31 | #include "ozz/animation/runtime/animation.h" 32 | 33 | namespace ozz { 34 | namespace animation { 35 | 36 | // Count translation, rotation or scale keyframes for a given track number. Use 37 | // a negative _track value to count all tracks. 38 | int CountTranslationKeyframes(const Animation& _animation, int _track = -1); 39 | int CountRotationKeyframes(const Animation& _animation, int _track = -1); 40 | int CountScaleKeyframes(const Animation& _animation, int _track = -1); 41 | } // namespace animation 42 | } // namespace ozz 43 | #endif // OZZ_OZZ_ANIMATION_RUNTIME_ANIMATION_UTILS_H_ 44 | -------------------------------------------------------------------------------- /utils/ozz/animation/runtime/track_triggering_job_trait.h: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------// 2 | // // 3 | // ozz-animation is hosted at http://github.com/guillaumeblanc/ozz-animation // 4 | // and distributed under the MIT License (MIT). // 5 | // // 6 | // Copyright (c) Guillaume Blanc // 7 | // // 8 | // Permission is hereby granted, free of charge, to any person obtaining a // 9 | // copy of this software and associated documentation files (the "Software"), // 10 | // to deal in the Software without restriction, including without limitation // 11 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, // 12 | // and/or sell copies of the Software, and to permit persons to whom the // 13 | // Software is furnished to do so, subject to the following conditions: // 14 | // // 15 | // The above copyright notice and this permission notice shall be included in // 16 | // all copies or substantial portions of the Software. // 17 | // // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL // 21 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING // 23 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // 24 | // DEALINGS IN THE SOFTWARE. // 25 | // // 26 | //----------------------------------------------------------------------------// 27 | 28 | #ifndef OZZ_OZZ_ANIMATION_RUNTIME_TRACK_TRIGGERING_JOB_TRAIT_H_ 29 | #define OZZ_OZZ_ANIMATION_RUNTIME_TRACK_TRIGGERING_JOB_TRAIT_H_ 30 | 31 | // Defines iterator traits required to use TrackTriggeringJob::Iterator 32 | // with stl algorithms. 33 | // This is a separate file from "track_triggering_job.h" to prevent everyone 34 | // from including stl file . 35 | 36 | #include "ozz/animation/runtime/track_triggering_job.h" 37 | 38 | #include 39 | 40 | // Specializes std::iterator_traits. 41 | namespace std { 42 | template <> 43 | struct iterator_traits { 44 | typedef ptrdiff_t difference_type; 45 | typedef ozz::animation::TrackTriggeringJob::Edge value_type; 46 | typedef const ozz::animation::TrackTriggeringJob::Edge* pointer; 47 | typedef const ozz::animation::TrackTriggeringJob::Edge& reference; 48 | typedef forward_iterator_tag iterator_category; 49 | }; 50 | } // namespace std 51 | #endif // OZZ_OZZ_ANIMATION_RUNTIME_TRACK_TRIGGERING_JOB_TRAIT_H_ 52 | -------------------------------------------------------------------------------- /utils/ozz/base/containers/deque.h: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------// 2 | // // 3 | // ozz-animation is hosted at http://github.com/guillaumeblanc/ozz-animation // 4 | // and distributed under the MIT License (MIT). // 5 | // // 6 | // Copyright (c) Guillaume Blanc // 7 | // // 8 | // Permission is hereby granted, free of charge, to any person obtaining a // 9 | // copy of this software and associated documentation files (the "Software"), // 10 | // to deal in the Software without restriction, including without limitation // 11 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, // 12 | // and/or sell copies of the Software, and to permit persons to whom the // 13 | // Software is furnished to do so, subject to the following conditions: // 14 | // // 15 | // The above copyright notice and this permission notice shall be included in // 16 | // all copies or substantial portions of the Software. // 17 | // // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL // 21 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING // 23 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // 24 | // DEALINGS IN THE SOFTWARE. // 25 | // // 26 | //----------------------------------------------------------------------------// 27 | 28 | #ifndef OZZ_OZZ_BASE_CONTAINERS_DEQUE_H_ 29 | #define OZZ_OZZ_BASE_CONTAINERS_DEQUE_H_ 30 | 31 | #include 32 | 33 | #include "ozz/base/containers/std_allocator.h" 34 | 35 | namespace ozz { 36 | // Redirects std::deque to ozz::deque in order to replace std default allocator 37 | // by ozz::StdAllocator. 38 | template > 39 | using deque = std::deque<_Ty, _Allocator>; 40 | } // namespace ozz 41 | #endif // OZZ_OZZ_BASE_CONTAINERS_DEQUE_H_ 42 | -------------------------------------------------------------------------------- /utils/ozz/base/containers/list.h: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------// 2 | // // 3 | // ozz-animation is hosted at http://github.com/guillaumeblanc/ozz-animation // 4 | // and distributed under the MIT License (MIT). // 5 | // // 6 | // Copyright (c) Guillaume Blanc // 7 | // // 8 | // Permission is hereby granted, free of charge, to any person obtaining a // 9 | // copy of this software and associated documentation files (the "Software"), // 10 | // to deal in the Software without restriction, including without limitation // 11 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, // 12 | // and/or sell copies of the Software, and to permit persons to whom the // 13 | // Software is furnished to do so, subject to the following conditions: // 14 | // // 15 | // The above copyright notice and this permission notice shall be included in // 16 | // all copies or substantial portions of the Software. // 17 | // // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL // 21 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING // 23 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // 24 | // DEALINGS IN THE SOFTWARE. // 25 | // // 26 | //----------------------------------------------------------------------------// 27 | 28 | #ifndef OZZ_OZZ_BASE_CONTAINERS_LIST_H_ 29 | #define OZZ_OZZ_BASE_CONTAINERS_LIST_H_ 30 | 31 | #ifdef _MSC_VER 32 | #pragma warning(push) 33 | // Removes constant conditional expression warning. 34 | #pragma warning(disable : 4127) 35 | #endif // _MSC_VER 36 | 37 | #include 38 | 39 | #ifdef _MSC_VER 40 | #pragma warning(pop) 41 | #endif // _MSC_VER 42 | 43 | #include "ozz/base/containers/std_allocator.h" 44 | 45 | namespace ozz { 46 | // Redirects std::list to ozz::list in order to replace std default allocator by 47 | // ozz::StdAllocator. 48 | template > 49 | using list = std::list<_Ty, _Allocator>; 50 | } // namespace ozz 51 | #endif // OZZ_OZZ_BASE_CONTAINERS_LIST_H_ 52 | -------------------------------------------------------------------------------- /utils/ozz/base/containers/queue.h: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------// 2 | // // 3 | // ozz-animation is hosted at http://github.com/guillaumeblanc/ozz-animation // 4 | // and distributed under the MIT License (MIT). // 5 | // // 6 | // Copyright (c) Guillaume Blanc // 7 | // // 8 | // Permission is hereby granted, free of charge, to any person obtaining a // 9 | // copy of this software and associated documentation files (the "Software"), // 10 | // to deal in the Software without restriction, including without limitation // 11 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, // 12 | // and/or sell copies of the Software, and to permit persons to whom the // 13 | // Software is furnished to do so, subject to the following conditions: // 14 | // // 15 | // The above copyright notice and this permission notice shall be included in // 16 | // all copies or substantial portions of the Software. // 17 | // // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL // 21 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING // 23 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // 24 | // DEALINGS IN THE SOFTWARE. // 25 | // // 26 | //----------------------------------------------------------------------------// 27 | 28 | #ifndef OZZ_OZZ_BASE_CONTAINERS_QUEUE_H_ 29 | #define OZZ_OZZ_BASE_CONTAINERS_QUEUE_H_ 30 | 31 | #include 32 | 33 | #include "deque.h" 34 | 35 | namespace ozz { 36 | // Redirects std::queue to ozz::queue in order to replace std default allocator 37 | // by ozz::StdAllocator. 38 | template > 39 | using queue = std::queue<_Ty, _Container>; 40 | 41 | // Redirects std::priority_queue to ozz::priority_queue in order to replace std 42 | // default allocator by ozz::StdAllocator. 43 | template , 44 | class _Pred = std::less> 45 | using priority_queue = std::priority_queue<_Ty, _Container, _Pred>; 46 | } // namespace ozz 47 | #endif // OZZ_OZZ_BASE_CONTAINERS_QUEUE_H_ 48 | -------------------------------------------------------------------------------- /utils/ozz/base/containers/set.h: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------// 2 | // // 3 | // ozz-animation is hosted at http://github.com/guillaumeblanc/ozz-animation // 4 | // and distributed under the MIT License (MIT). // 5 | // // 6 | // Copyright (c) Guillaume Blanc // 7 | // // 8 | // Permission is hereby granted, free of charge, to any person obtaining a // 9 | // copy of this software and associated documentation files (the "Software"), // 10 | // to deal in the Software without restriction, including without limitation // 11 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, // 12 | // and/or sell copies of the Software, and to permit persons to whom the // 13 | // Software is furnished to do so, subject to the following conditions: // 14 | // // 15 | // The above copyright notice and this permission notice shall be included in // 16 | // all copies or substantial portions of the Software. // 17 | // // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL // 21 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING // 23 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // 24 | // DEALINGS IN THE SOFTWARE. // 25 | // // 26 | //----------------------------------------------------------------------------// 27 | 28 | #ifndef OZZ_OZZ_BASE_CONTAINERS_SET_H_ 29 | #define OZZ_OZZ_BASE_CONTAINERS_SET_H_ 30 | 31 | #include 32 | 33 | #include "ozz/base/containers/std_allocator.h" 34 | 35 | namespace ozz { 36 | // Redirects std::set to ozz::set in order to replace std default allocator by 37 | // ozz::StdAllocator. 38 | template , 39 | class _Allocator = ozz::StdAllocator<_Key>> 40 | using set = std::set<_Key, _Pred, _Allocator>; 41 | 42 | // Redirects std::multiset to ozz::multiset in order to replace std default 43 | // allocator by ozz::StdAllocator. 44 | template , 45 | class _Allocator = ozz::StdAllocator<_Key>> 46 | using multiset = std::multiset<_Key, _Pred, _Allocator>; 47 | } // namespace ozz 48 | #endif // OZZ_OZZ_BASE_CONTAINERS_SET_H_ 49 | -------------------------------------------------------------------------------- /utils/ozz/base/containers/stack.h: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------// 2 | // // 3 | // ozz-animation is hosted at http://github.com/guillaumeblanc/ozz-animation // 4 | // and distributed under the MIT License (MIT). // 5 | // // 6 | // Copyright (c) Guillaume Blanc // 7 | // // 8 | // Permission is hereby granted, free of charge, to any person obtaining a // 9 | // copy of this software and associated documentation files (the "Software"), // 10 | // to deal in the Software without restriction, including without limitation // 11 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, // 12 | // and/or sell copies of the Software, and to permit persons to whom the // 13 | // Software is furnished to do so, subject to the following conditions: // 14 | // // 15 | // The above copyright notice and this permission notice shall be included in // 16 | // all copies or substantial portions of the Software. // 17 | // // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL // 21 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING // 23 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // 24 | // DEALINGS IN THE SOFTWARE. // 25 | // // 26 | //----------------------------------------------------------------------------// 27 | 28 | #ifndef OZZ_OZZ_BASE_CONTAINERS_STACK_H_ 29 | #define OZZ_OZZ_BASE_CONTAINERS_STACK_H_ 30 | 31 | #include 32 | 33 | #include "deque.h" 34 | 35 | namespace ozz { 36 | // Redirects std::stack to ozz::stack in order to replace std default allocator 37 | // by ozz::StdAllocator. 38 | template > 39 | using stack = std::stack<_Ty, _Container>; 40 | } // namespace ozz 41 | #endif // OZZ_OZZ_BASE_CONTAINERS_STACK_H_ 42 | -------------------------------------------------------------------------------- /utils/ozz/base/containers/string.h: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------// 2 | // // 3 | // ozz-animation is hosted at http://github.com/guillaumeblanc/ozz-animation // 4 | // and distributed under the MIT License (MIT). // 5 | // // 6 | // Copyright (c) Guillaume Blanc // 7 | // // 8 | // Permission is hereby granted, free of charge, to any person obtaining a // 9 | // copy of this software and associated documentation files (the "Software"), // 10 | // to deal in the Software without restriction, including without limitation // 11 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, // 12 | // and/or sell copies of the Software, and to permit persons to whom the // 13 | // Software is furnished to do so, subject to the following conditions: // 14 | // // 15 | // The above copyright notice and this permission notice shall be included in // 16 | // all copies or substantial portions of the Software. // 17 | // // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL // 21 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING // 23 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // 24 | // DEALINGS IN THE SOFTWARE. // 25 | // // 26 | //----------------------------------------------------------------------------// 27 | 28 | #ifndef OZZ_OZZ_BASE_CONTAINERS_STRING_H_ 29 | #define OZZ_OZZ_BASE_CONTAINERS_STRING_H_ 30 | 31 | #include 32 | 33 | #include "ozz/base/containers/std_allocator.h" 34 | 35 | namespace ozz { 36 | // Redirects std::basic_string to ozz::string in order to replace std default 37 | // allocator by ozz::StdAllocator. 38 | using string = 39 | std::basic_string, ozz::StdAllocator>; 40 | } // namespace ozz 41 | #endif // OZZ_OZZ_BASE_CONTAINERS_STRING_H_ 42 | -------------------------------------------------------------------------------- /utils/ozz/base/containers/string_archive.h: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------// 2 | // // 3 | // ozz-animation is hosted at http://github.com/guillaumeblanc/ozz-animation // 4 | // and distributed under the MIT License (MIT). // 5 | // // 6 | // Copyright (c) Guillaume Blanc // 7 | // // 8 | // Permission is hereby granted, free of charge, to any person obtaining a // 9 | // copy of this software and associated documentation files (the "Software"), // 10 | // to deal in the Software without restriction, including without limitation // 11 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, // 12 | // and/or sell copies of the Software, and to permit persons to whom the // 13 | // Software is furnished to do so, subject to the following conditions: // 14 | // // 15 | // The above copyright notice and this permission notice shall be included in // 16 | // all copies or substantial portions of the Software. // 17 | // // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL // 21 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING // 23 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // 24 | // DEALINGS IN THE SOFTWARE. // 25 | // // 26 | //----------------------------------------------------------------------------// 27 | 28 | #ifndef OZZ_OZZ_BASE_CONTAINERS_STRING_ARCHIVE_H_ 29 | #define OZZ_OZZ_BASE_CONTAINERS_STRING_ARCHIVE_H_ 30 | 31 | #include "ozz/base/containers/string.h" 32 | #include "ozz/base/io/archive_traits.h" 33 | #include "ozz/base/platform.h" 34 | 35 | namespace ozz { 36 | namespace io { 37 | 38 | OZZ_IO_TYPE_NOT_VERSIONABLE(ozz::string) 39 | 40 | template <> 41 | struct Extern { 42 | static void Save(OArchive& _archive, const ozz::string* _values, 43 | size_t _count); 44 | static void Load(IArchive& _archive, ozz::string* _values, size_t _count, 45 | uint32_t _version); 46 | }; 47 | } // namespace io 48 | } // namespace ozz 49 | #endif // OZZ_OZZ_BASE_CONTAINERS_STRING_ARCHIVE_H_ 50 | -------------------------------------------------------------------------------- /utils/ozz/base/containers/unordered_set.h: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------// 2 | // // 3 | // ozz-animation is hosted at http://github.com/guillaumeblanc/ozz-animation // 4 | // and distributed under the MIT License (MIT). // 5 | // // 6 | // Copyright (c) Guillaume Blanc // 7 | // // 8 | // Permission is hereby granted, free of charge, to any person obtaining a // 9 | // copy of this software and associated documentation files (the "Software"), // 10 | // to deal in the Software without restriction, including without limitation // 11 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, // 12 | // and/or sell copies of the Software, and to permit persons to whom the // 13 | // Software is furnished to do so, subject to the following conditions: // 14 | // // 15 | // The above copyright notice and this permission notice shall be included in // 16 | // all copies or substantial portions of the Software. // 17 | // // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL // 21 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING // 23 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // 24 | // DEALINGS IN THE SOFTWARE. // 25 | // // 26 | //----------------------------------------------------------------------------// 27 | 28 | #ifndef OZZ_OZZ_BASE_CONTAINERS_UNORDERED_SET_H_ 29 | #define OZZ_OZZ_BASE_CONTAINERS_UNORDERED_SET_H_ 30 | 31 | #include 32 | 33 | #include "ozz/base/containers/std_allocator.h" 34 | 35 | namespace ozz { 36 | // Redirects std::unordered_set to ozz::UnorderedSet in order to replace std 37 | // default allocator by ozz::StdAllocator. 38 | template , 39 | class _KeyEqual = std::equal_to<_Key>, 40 | class _Allocator = ozz::StdAllocator<_Key> > 41 | using unordered_set = 42 | std::unordered_set<_Key, _Hash, _KeyEqual, _Allocator>; 43 | 44 | // Redirects std::unordered_multiset to ozz::UnorderedMultiSet in order to 45 | // replace std default allocator by ozz::StdAllocator. 46 | template , 47 | class _KeyEqual = std::equal_to<_Key>, 48 | class _Allocator = ozz::StdAllocator<_Key> > 49 | using unordered_multiset = 50 | std::unordered_multiset<_Key, _Hash, _KeyEqual, _Allocator>; 51 | } // namespace ozz 52 | #endif // OZZ_OZZ_BASE_CONTAINERS_UNORDERED_SET_H_ 53 | -------------------------------------------------------------------------------- /utils/ozz/base/io/archive.cc: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------// 2 | // // 3 | // ozz-animation is hosted at http://github.com/guillaumeblanc/ozz-animation // 4 | // and distributed under the MIT License (MIT). // 5 | // // 6 | // Copyright (c) Guillaume Blanc // 7 | // // 8 | // Permission is hereby granted, free of charge, to any person obtaining a // 9 | // copy of this software and associated documentation files (the "Software"), // 10 | // to deal in the Software without restriction, including without limitation // 11 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, // 12 | // and/or sell copies of the Software, and to permit persons to whom the // 13 | // Software is furnished to do so, subject to the following conditions: // 14 | // // 15 | // The above copyright notice and this permission notice shall be included in // 16 | // all copies or substantial portions of the Software. // 17 | // // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL // 21 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING // 23 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // 24 | // DEALINGS IN THE SOFTWARE. // 25 | // // 26 | //----------------------------------------------------------------------------// 27 | 28 | #include "ozz/base/io/archive.h" 29 | 30 | #include 31 | 32 | namespace ozz { 33 | namespace io { 34 | 35 | // OArchive implementation. 36 | 37 | OArchive::OArchive(Stream* _stream, Endianness _endianness) 38 | : stream_(_stream), endian_swap_(_endianness != GetNativeEndianness()) { 39 | assert(stream_ && stream_->opened() && 40 | "_stream argument must point a valid opened stream."); 41 | // Save as a single byte as it does not need to be swapped. 42 | uint8_t endianness = static_cast(_endianness); 43 | *this << endianness; 44 | } 45 | 46 | // IArchive implementation. 47 | 48 | IArchive::IArchive(Stream* _stream) : stream_(_stream), endian_swap_(false) { 49 | assert(stream_ && stream_->opened() && 50 | "_stream argument must point a valid opened stream."); 51 | // Endianness was saved as a single byte, as it does not need to be swapped. 52 | uint8_t endianness; 53 | *this >> endianness; 54 | endian_swap_ = endianness != GetNativeEndianness(); 55 | } 56 | } // namespace io 57 | } // namespace ozz 58 | -------------------------------------------------------------------------------- /utils/ozz/base/maths/simd_math.cc: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------// 2 | // // 3 | // ozz-animation is hosted at http://github.com/guillaumeblanc/ozz-animation // 4 | // and distributed under the MIT License (MIT). // 5 | // // 6 | // Copyright (c) Guillaume Blanc // 7 | // // 8 | // Permission is hereby granted, free of charge, to any person obtaining a // 9 | // copy of this software and associated documentation files (the "Software"), // 10 | // to deal in the Software without restriction, including without limitation // 11 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, // 12 | // and/or sell copies of the Software, and to permit persons to whom the // 13 | // Software is furnished to do so, subject to the following conditions: // 14 | // // 15 | // The above copyright notice and this permission notice shall be included in // 16 | // all copies or substantial portions of the Software. // 17 | // // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL // 21 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING // 23 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // 24 | // DEALINGS IN THE SOFTWARE. // 25 | // // 26 | //----------------------------------------------------------------------------// 27 | 28 | #include "ozz/base/maths/simd_math.h" 29 | 30 | namespace ozz { 31 | namespace math { 32 | 33 | // Select compile time name of the simd implementation 34 | #if defined(OZZ_SIMD_AVX2) && defined(OZZ_SIMD_FMA) 35 | #define _OZZ_SIMD_IMPLEMENTATION "AVX2-FMA" 36 | #elif defined(OZZ_SIMD_AVX2) 37 | #define _OZZ_SIMD_IMPLEMENTATION "AVX2" 38 | #elif defined(OZZ_SIMD_AVX) 39 | #define _OZZ_SIMD_IMPLEMENTATION "AVX" 40 | #elif defined(OZZ_SIMD_SSE4_2) 41 | #define _OZZ_SIMD_IMPLEMENTATION "SSE4.2" 42 | #elif defined(OZZ_SIMD_SSE4_1) 43 | #define _OZZ_SIMD_IMPLEMENTATION "SSE4.1" 44 | #elif defined(OZZ_SIMD_SSSE3) 45 | #define _OZZ_SIMD_IMPLEMENTATION "SSSE3" 46 | #elif defined(OZZ_SIMD_SSE3) 47 | #define _OZZ_SIMD_IMPLEMENTATION "SSE3" 48 | #elif defined(OZZ_SIMD_SSEx) 49 | #define _OZZ_SIMD_IMPLEMENTATION "SSE2" 50 | #elif defined(OZZ_SIMD_REF) 51 | #define _OZZ_SIMD_IMPLEMENTATION "Reference" 52 | #else 53 | // Not defined 54 | #endif 55 | 56 | #pragma message("Ozz libraries were built with " _OZZ_SIMD_IMPLEMENTATION \ 57 | " SIMD math implementation") 58 | 59 | const char* SimdImplementationName() { return _OZZ_SIMD_IMPLEMENTATION; } 60 | } // namespace math 61 | } // namespace ozz 62 | -------------------------------------------------------------------------------- /utils/ozz/base/maths/soa_transform.h: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------// 2 | // // 3 | // ozz-animation is hosted at http://github.com/guillaumeblanc/ozz-animation // 4 | // and distributed under the MIT License (MIT). // 5 | // // 6 | // Copyright (c) Guillaume Blanc // 7 | // // 8 | // Permission is hereby granted, free of charge, to any person obtaining a // 9 | // copy of this software and associated documentation files (the "Software"), // 10 | // to deal in the Software without restriction, including without limitation // 11 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, // 12 | // and/or sell copies of the Software, and to permit persons to whom the // 13 | // Software is furnished to do so, subject to the following conditions: // 14 | // // 15 | // The above copyright notice and this permission notice shall be included in // 16 | // all copies or substantial portions of the Software. // 17 | // // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL // 21 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING // 23 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // 24 | // DEALINGS IN THE SOFTWARE. // 25 | // // 26 | //----------------------------------------------------------------------------// 27 | 28 | #ifndef OZZ_OZZ_BASE_MATHS_SOA_TRANSFORM_H_ 29 | #define OZZ_OZZ_BASE_MATHS_SOA_TRANSFORM_H_ 30 | 31 | #include "ozz/base/maths/soa_float.h" 32 | #include "ozz/base/maths/soa_quaternion.h" 33 | #include "ozz/base/platform.h" 34 | 35 | namespace ozz { 36 | namespace math { 37 | 38 | // Stores an affine transformation with separate translation, rotation and scale 39 | // attributes. 40 | struct SoaTransform { 41 | SoaFloat3 translation; 42 | SoaQuaternion rotation; 43 | SoaFloat3 scale; 44 | 45 | static OZZ_INLINE SoaTransform identity() { 46 | const SoaTransform ret = {SoaFloat3::zero(), SoaQuaternion::identity(), 47 | SoaFloat3::one()}; 48 | return ret; 49 | } 50 | }; 51 | } // namespace math 52 | } // namespace ozz 53 | #endif // OZZ_OZZ_BASE_MATHS_SOA_TRANSFORM_H_ 54 | -------------------------------------------------------------------------------- /utils/ozz/base/maths/transform.h: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------// 2 | // // 3 | // ozz-animation is hosted at http://github.com/guillaumeblanc/ozz-animation // 4 | // and distributed under the MIT License (MIT). // 5 | // // 6 | // Copyright (c) Guillaume Blanc // 7 | // // 8 | // Permission is hereby granted, free of charge, to any person obtaining a // 9 | // copy of this software and associated documentation files (the "Software"), // 10 | // to deal in the Software without restriction, including without limitation // 11 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, // 12 | // and/or sell copies of the Software, and to permit persons to whom the // 13 | // Software is furnished to do so, subject to the following conditions: // 14 | // // 15 | // The above copyright notice and this permission notice shall be included in // 16 | // all copies or substantial portions of the Software. // 17 | // // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL // 21 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING // 23 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // 24 | // DEALINGS IN THE SOFTWARE. // 25 | // // 26 | //----------------------------------------------------------------------------// 27 | 28 | #ifndef OZZ_OZZ_BASE_MATHS_TRANSFORM_H_ 29 | #define OZZ_OZZ_BASE_MATHS_TRANSFORM_H_ 30 | 31 | #include "ozz/base/maths/quaternion.h" 32 | #include "ozz/base/maths/vec_float.h" 33 | #include "ozz/base/platform.h" 34 | 35 | namespace ozz { 36 | namespace math { 37 | 38 | // Stores an affine transformation with separate translation, rotation and scale 39 | // attributes. 40 | struct Transform { 41 | // Translation affine transformation component. 42 | Float3 translation; 43 | 44 | // Rotation affine transformation component. 45 | Quaternion rotation; 46 | 47 | // Scale affine transformation component. 48 | Float3 scale; 49 | 50 | // Builds an identity transform. 51 | static OZZ_INLINE Transform identity() { 52 | const Transform ret = {Float3::zero(), Quaternion::identity(), 53 | Float3::one()}; 54 | return ret; 55 | } 56 | }; 57 | } // namespace math 58 | } // namespace ozz 59 | #endif // OZZ_OZZ_BASE_MATHS_TRANSFORM_H_ 60 | -------------------------------------------------------------------------------- /utils/ozz/base/memory/unique_ptr.h: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------// 2 | // // 3 | // ozz-animation is hosted at http://github.com/guillaumeblanc/ozz-animation // 4 | // and distributed under the MIT License (MIT). // 5 | // // 6 | // Copyright (c) Guillaume Blanc // 7 | // // 8 | // Permission is hereby granted, free of charge, to any person obtaining a // 9 | // copy of this software and associated documentation files (the "Software"), // 10 | // to deal in the Software without restriction, including without limitation // 11 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, // 12 | // and/or sell copies of the Software, and to permit persons to whom the // 13 | // Software is furnished to do so, subject to the following conditions: // 14 | // // 15 | // The above copyright notice and this permission notice shall be included in // 16 | // all copies or substantial portions of the Software. // 17 | // // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL // 21 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING // 23 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // 24 | // DEALINGS IN THE SOFTWARE. // 25 | // // 26 | //----------------------------------------------------------------------------// 27 | 28 | #ifndef OZZ_OZZ_BASE_MEMORY_UNIQUE_PTR_H_ 29 | #define OZZ_OZZ_BASE_MEMORY_UNIQUE_PTR_H_ 30 | 31 | #include "ozz/base/memory/allocator.h" 32 | 33 | #include 34 | #include 35 | 36 | namespace ozz { 37 | 38 | // Defaut deleter for ozz unique_ptr, uses redirected memory allocator. 39 | template 40 | struct Deleter { 41 | Deleter() {} 42 | 43 | template 44 | Deleter(const Deleter<_Up>&, _Ty* = nullptr) {} 45 | 46 | void operator()(_Ty* _ptr) const { 47 | ozz::Delete(_ptr); 48 | } 49 | }; 50 | 51 | // Defines ozz::unique_ptr to use ozz default deleter. 52 | template > 53 | using unique_ptr = std::unique_ptr<_Ty, _Deleter>; 54 | 55 | // Implements make_unique to use ozz redirected memory allocator. 56 | template 57 | unique_ptr<_Ty> make_unique(_Args&&... _args) { 58 | return unique_ptr<_Ty>(New<_Ty>(std::forward<_Args>(_args)...)); 59 | } 60 | } // namespace ozz 61 | #endif // OZZ_OZZ_BASE_MEMORY_UNIQUE_PTR_H_ 62 | -------------------------------------------------------------------------------- /utils/ozz/base/platform.cc: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------// 2 | // // 3 | // ozz-animation is hosted at http://github.com/guillaumeblanc/ozz-animation // 4 | // and distributed under the MIT License (MIT). // 5 | // // 6 | // Copyright (c) Guillaume Blanc // 7 | // // 8 | // Permission is hereby granted, free of charge, to any person obtaining a // 9 | // copy of this software and associated documentation files (the "Software"), // 10 | // to deal in the Software without restriction, including without limitation // 11 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, // 12 | // and/or sell copies of the Software, and to permit persons to whom the // 13 | // Software is furnished to do so, subject to the following conditions: // 14 | // // 15 | // The above copyright notice and this permission notice shall be included in // 16 | // all copies or substantial portions of the Software. // 17 | // // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL // 21 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING // 23 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // 24 | // DEALINGS IN THE SOFTWARE. // 25 | // // 26 | //----------------------------------------------------------------------------// 27 | 28 | #include "ozz/base/platform.h" 29 | 30 | namespace ozz { 31 | 32 | bool strmatch(const char* _str, const char* _pattern) { 33 | for (; *_pattern; ++_str, ++_pattern) { 34 | if (*_pattern == '?') { 35 | if (!*_str) { 36 | return false; 37 | } 38 | } else if (*_pattern == '*') { 39 | if (strmatch(_str, _pattern + 1)) { 40 | return true; 41 | } 42 | if (*_str && strmatch(_str + 1, _pattern)) { 43 | return true; 44 | } 45 | return false; 46 | } else { 47 | if (*_str != *_pattern) { 48 | return false; 49 | } 50 | } 51 | } 52 | return !*_str && !*_pattern; 53 | } 54 | } // namespace ozz 55 | -------------------------------------------------------------------------------- /utils/ozz/tools/data/exo_gray.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xarray/osgPhysX/0996bc0bac46e46f4dc09990be0d6750ac369f55/utils/ozz/tools/data/exo_gray.fbx -------------------------------------------------------------------------------- /utils/ozz/tools/data/exo_gray.mesh.ozz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xarray/osgPhysX/0996bc0bac46e46f4dc09990be0d6750ac369f55/utils/ozz/tools/data/exo_gray.mesh.ozz -------------------------------------------------------------------------------- /utils/ozz/tools/data/exo_gray.mesh.ozz.mat: -------------------------------------------------------------------------------- 1 | 0, DiffuseColor, exo_gray.fbm\BODY_diffuse.png 2 | 1, DiffuseColor, exo_gray.fbm\BODY_diffuse.png 3 | 2, DiffuseColor, exo_gray.fbm\BODY_diffuse.png 4 | 2, SpecularColor, exo_gray.fbm\BODY_specular.png 5 | 2, NormalMap, exo_gray.fbm\BODY_normal.png 6 | 3, DiffuseColor, exo_gray.fbm\BODY_diffuse.png 7 | 3, SpecularColor, exo_gray.fbm\BODY_specular.png 8 | 3, NormalMap, exo_gray.fbm\BODY_normal.png 9 | 4, DiffuseColor, exo_gray.fbm\EXO_diffuse.png 10 | 4, SpecularColor, exo_gray.fbm\EXO_specular.png 11 | 4, NormalMap, exo_gray.fbm\EXO_normal.png 12 | 5, DiffuseColor, exo_gray.fbm\BODY_diffuse.png 13 | 5, SpecularColor, exo_gray.fbm\BODY_specular.png 14 | 5, NormalMap, exo_gray.fbm\BODY_normal.png 15 | 6, DiffuseColor, exo_gray.fbm\BODY_diffuse.png 16 | 6, SpecularColor, exo_gray.fbm\BODY_specular.png 17 | 6, NormalMap, exo_gray.fbm\BODY_normal.png 18 | 7, DiffuseColor, exo_gray.fbm\BODY_diffuse.png 19 | 7, SpecularColor, exo_gray.fbm\BODY_specular.png 20 | 7, NormalMap, exo_gray.fbm\BODY_normal.png 21 | -------------------------------------------------------------------------------- /utils/ozz/tools/data/exo_gray.skeleton.ozz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xarray/osgPhysX/0996bc0bac46e46f4dc09990be0d6750ac369f55/utils/ozz/tools/data/exo_gray.skeleton.ozz -------------------------------------------------------------------------------- /utils/ozz/tools/data/exo_gray@be_hit.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xarray/osgPhysX/0996bc0bac46e46f4dc09990be0d6750ac369f55/utils/ozz/tools/data/exo_gray@be_hit.fbx -------------------------------------------------------------------------------- /utils/ozz/tools/data/exo_gray@be_hit.ozz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xarray/osgPhysX/0996bc0bac46e46f4dc09990be0d6750ac369f55/utils/ozz/tools/data/exo_gray@be_hit.ozz -------------------------------------------------------------------------------- /utils/ozz/tools/data/exo_gray@crouch.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xarray/osgPhysX/0996bc0bac46e46f4dc09990be0d6750ac369f55/utils/ozz/tools/data/exo_gray@crouch.fbx -------------------------------------------------------------------------------- /utils/ozz/tools/data/exo_gray@crouch.ozz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xarray/osgPhysX/0996bc0bac46e46f4dc09990be0d6750ac369f55/utils/ozz/tools/data/exo_gray@crouch.ozz -------------------------------------------------------------------------------- /utils/ozz/tools/data/exo_gray@dying.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xarray/osgPhysX/0996bc0bac46e46f4dc09990be0d6750ac369f55/utils/ozz/tools/data/exo_gray@dying.fbx -------------------------------------------------------------------------------- /utils/ozz/tools/data/exo_gray@dying.ozz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xarray/osgPhysX/0996bc0bac46e46f4dc09990be0d6750ac369f55/utils/ozz/tools/data/exo_gray@dying.ozz -------------------------------------------------------------------------------- /utils/ozz/tools/data/exo_gray@dying_backwards.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xarray/osgPhysX/0996bc0bac46e46f4dc09990be0d6750ac369f55/utils/ozz/tools/data/exo_gray@dying_backwards.fbx -------------------------------------------------------------------------------- /utils/ozz/tools/data/exo_gray@dying_backwards.ozz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xarray/osgPhysX/0996bc0bac46e46f4dc09990be0d6750ac369f55/utils/ozz/tools/data/exo_gray@dying_backwards.ozz -------------------------------------------------------------------------------- /utils/ozz/tools/data/exo_gray@idle.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xarray/osgPhysX/0996bc0bac46e46f4dc09990be0d6750ac369f55/utils/ozz/tools/data/exo_gray@idle.fbx -------------------------------------------------------------------------------- /utils/ozz/tools/data/exo_gray@idle.ozz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xarray/osgPhysX/0996bc0bac46e46f4dc09990be0d6750ac369f55/utils/ozz/tools/data/exo_gray@idle.ozz -------------------------------------------------------------------------------- /utils/ozz/tools/data/exo_gray@jumping.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xarray/osgPhysX/0996bc0bac46e46f4dc09990be0d6750ac369f55/utils/ozz/tools/data/exo_gray@jumping.fbx -------------------------------------------------------------------------------- /utils/ozz/tools/data/exo_gray@jumping.ozz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xarray/osgPhysX/0996bc0bac46e46f4dc09990be0d6750ac369f55/utils/ozz/tools/data/exo_gray@jumping.ozz -------------------------------------------------------------------------------- /utils/ozz/tools/data/exo_gray@pistol_aiming.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xarray/osgPhysX/0996bc0bac46e46f4dc09990be0d6750ac369f55/utils/ozz/tools/data/exo_gray@pistol_aiming.fbx -------------------------------------------------------------------------------- /utils/ozz/tools/data/exo_gray@pistol_aiming.ozz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xarray/osgPhysX/0996bc0bac46e46f4dc09990be0d6750ac369f55/utils/ozz/tools/data/exo_gray@pistol_aiming.ozz -------------------------------------------------------------------------------- /utils/ozz/tools/data/exo_gray@running.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xarray/osgPhysX/0996bc0bac46e46f4dc09990be0d6750ac369f55/utils/ozz/tools/data/exo_gray@running.fbx -------------------------------------------------------------------------------- /utils/ozz/tools/data/exo_gray@running.ozz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xarray/osgPhysX/0996bc0bac46e46f4dc09990be0d6750ac369f55/utils/ozz/tools/data/exo_gray@running.ozz -------------------------------------------------------------------------------- /utils/ozz/tools/data/exo_gray@say_hello.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xarray/osgPhysX/0996bc0bac46e46f4dc09990be0d6750ac369f55/utils/ozz/tools/data/exo_gray@say_hello.fbx -------------------------------------------------------------------------------- /utils/ozz/tools/data/exo_gray@say_hello.ozz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xarray/osgPhysX/0996bc0bac46e46f4dc09990be0d6750ac369f55/utils/ozz/tools/data/exo_gray@say_hello.ozz -------------------------------------------------------------------------------- /utils/ozz/tools/data/exo_gray@shooting.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xarray/osgPhysX/0996bc0bac46e46f4dc09990be0d6750ac369f55/utils/ozz/tools/data/exo_gray@shooting.fbx -------------------------------------------------------------------------------- /utils/ozz/tools/data/exo_gray@shooting.ozz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xarray/osgPhysX/0996bc0bac46e46f4dc09990be0d6750ac369f55/utils/ozz/tools/data/exo_gray@shooting.ozz -------------------------------------------------------------------------------- /utils/ozz/tools/data/exo_gray@tpose.ozz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xarray/osgPhysX/0996bc0bac46e46f4dc09990be0d6750ac369f55/utils/ozz/tools/data/exo_gray@tpose.ozz -------------------------------------------------------------------------------- /utils/ozz/tools/data/exo_gray@walking.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xarray/osgPhysX/0996bc0bac46e46f4dc09990be0d6750ac369f55/utils/ozz/tools/data/exo_gray@walking.fbx -------------------------------------------------------------------------------- /utils/ozz/tools/data/exo_gray@walking.ozz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xarray/osgPhysX/0996bc0bac46e46f4dc09990be0d6750ac369f55/utils/ozz/tools/data/exo_gray@walking.ozz -------------------------------------------------------------------------------- /utils/ozz/tools/fbx2mesh.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xarray/osgPhysX/0996bc0bac46e46f4dc09990be0d6750ac369f55/utils/ozz/tools/fbx2mesh.exe -------------------------------------------------------------------------------- /utils/ozz/tools/fbx2ozz.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xarray/osgPhysX/0996bc0bac46e46f4dc09990be0d6750ac369f55/utils/ozz/tools/fbx2ozz.exe -------------------------------------------------------------------------------- /utils/ozz/tools/gltf2ozz.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xarray/osgPhysX/0996bc0bac46e46f4dc09990be0d6750ac369f55/utils/ozz/tools/gltf2ozz.exe --------------------------------------------------------------------------------