#ifndef _PHYSICS_MODULE_H_ #define _PHYSICS_MODULE_H_ #include #include class JoltPhysicsWrapper; namespace JPH { class Shape; class CharacterBase; class BodyID; } namespace Ogre { class TerrainGroup; } namespace ECS { struct Physics { JoltPhysicsWrapper *physics; }; struct PhysicsNode { Ogre::SceneNode *node; }; struct PhysicsMeshName { Ogre::String meshName; }; struct PhysicsMeshPtr { Ogre::MeshPtr mesh; }; struct PhysicsBody { uint32_t motion; uint32_t layer; }; struct CharacterBody { std::shared_ptr ch; }; struct BoatBody { void *tmp; }; struct PhysicsHeightfieldData { const float *samples; Ogre::Vector3 offset; Ogre::Vector3 scale; int sampleCount; }; struct CharacterVelocity { Ogre::Vector3 gvelocity; Ogre::Vector3 velocity; }; struct CachedMass { float mass; }; struct PhysicsModule { PhysicsModule(flecs::world &ecs); static flecs::entity createTerrainChunkBody(Ogre::SceneNode *node, float *samples, const Ogre::Vector3 &offset, const Ogre::Vector3 &scale, int sampleCount); static void controlPhysics(flecs::entity e, bool enable); static bool raycastQuery(const Ogre::Vector3 &startPos, const Ogre::Vector3 &endPos, Ogre::Vector3 &position, JPH::BodyID &id); static void setDebugDraw(bool enable); }; } #endif