#ifndef CHARACTER_MODULE_H_ #define CHARACTER_MODULE_H_ #include namespace ECS { struct Camera; /* character */ struct Character {}; /* tag */ struct Player {}; /* tag */ struct CharacterBase { Ogre::String type; float mTimer; Ogre::SceneNode *mBodyNode; Ogre::Entity *mBodyEnt; Ogre::Skeleton *mSkeleton; Ogre::Node *mRootBone; Ogre::Vector3 mBoneMotion; Ogre::Vector3 mGoalDirection; // actual intended direction in world-space bool is_submerged; }; struct CharacterLocation { Ogre::Quaternion orientation; Ogre::Vector3 position; }; struct CharacterBody { btPairCachingGhostObject *mGhostObject; btCompoundShape *mCollisionShape; Ogre::Bullet::KinematicMotionSimple *mController; bool checkGround; bool checkGroundResult; }; struct CharacterVelocity { Ogre::Vector3 gvelocity; Ogre::Vector3 velocity; }; struct AnimationControl { enum AnimID { ANIM_IDLE = 0, ANIM_WALK, ANIM_RUN, ANIM_TREADING_WATER, ANIM_SWIMMING, NUM_ANIMS, ANIM_NONE = NUM_ANIMS }; AnimID currentAnim; AnimID nextAnim; bool reset; bool configured; Ogre::AnimationState *mAnims[NUM_ANIMS]; // master animation list Ogre::Animation *mSkelAnimations[NUM_ANIMS]; bool mFadingIn[NUM_ANIMS]; // which animations are fading in bool mFadingOut[NUM_ANIMS]; // which animations are fading out Ogre::NodeAnimationTrack *mHipsTracks[NUM_ANIMS]; Ogre::NodeAnimationTrack *mRootTracks[NUM_ANIMS]; }; struct CharacterModule { CharacterModule(flecs::world &ecs); void setAnimation(AnimationControl &anim); void fadeAnimations(AnimationControl &anim, Ogre::Real deltaTime); void updateCameraGoal(Camera &camera, Ogre::Real deltaYaw, Ogre::Real deltaPitch, Ogre::Real deltaZoom); }; } #endif