Almost moved character to flecs
This commit is contained in:
@@ -5,32 +5,94 @@
|
||||
namespace ECS
|
||||
{
|
||||
struct GameData {
|
||||
flecs::entity player;
|
||||
int tmp;
|
||||
};
|
||||
struct EngineData {
|
||||
Ogre::SceneManager *mScnMgr;
|
||||
Ogre::Bullet::DynamicsWorld *mWorld;
|
||||
};
|
||||
struct Vector3 {
|
||||
float x;
|
||||
float y;
|
||||
float z;
|
||||
bool zeroLength() const;
|
||||
};
|
||||
struct Vector2 {
|
||||
float x, y;
|
||||
};
|
||||
struct Input {
|
||||
uint32_t control;
|
||||
uint32_t control_prev;
|
||||
Vector3 motion;
|
||||
Vector2 mouse;
|
||||
float wheel_y;
|
||||
bool mouse_moved;
|
||||
bool wheel_moved;
|
||||
bool fast;
|
||||
Input()
|
||||
: motion({ 0, 0, 0 })
|
||||
: control(0)
|
||||
, control_prev(0)
|
||||
, motion({ 0, 0, 0 })
|
||||
, fast(false)
|
||||
{
|
||||
}
|
||||
};
|
||||
/* character */
|
||||
struct Character {}; /* tag */
|
||||
struct Player {}; /* tag */
|
||||
struct CharacterBase {
|
||||
Ogre::String type;
|
||||
Ogre::SceneNode *mBodyNode;
|
||||
Ogre::Entity *mBodyEnt;
|
||||
Ogre::Skeleton *mSkeleton;
|
||||
Ogre::Node *mRootBone;
|
||||
Ogre::Vector3 mBoneMotion;
|
||||
Ogre::Vector3 mGoalDirection; // actual intended direction in world-space
|
||||
};
|
||||
struct CharacterBody {
|
||||
btPairCachingGhostObject *mGhostObject;
|
||||
btCompoundShape *mCollisionShape;
|
||||
Ogre::Bullet::DynamicsWorld *mWorld;
|
||||
Ogre::Bullet::KinematicMotionSimple *mController;
|
||||
Ogre::Vector3 gvelocity;
|
||||
};
|
||||
struct Camera {
|
||||
Ogre::SceneNode *mCameraNode;
|
||||
Ogre::Camera *mCamera;
|
||||
bool configured;
|
||||
Ogre::SceneNode *mCameraPivot;
|
||||
Ogre::SceneNode *mCameraGoal;
|
||||
Ogre::Real mPivotPitch;
|
||||
};
|
||||
struct AnimationControl {
|
||||
enum AnimID {
|
||||
ANIM_IDLE = 0,
|
||||
ANIM_WALK,
|
||||
ANIM_RUN,
|
||||
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 {
|
||||
flecs::entity player;
|
||||
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);
|
||||
};
|
||||
void setup();
|
||||
void setup(Ogre::SceneManager *scnMgr, Ogre::Bullet::DynamicsWorld *world,
|
||||
Ogre::SceneNode *cameraNode, Ogre::Camera *camera);
|
||||
void update(float delta);
|
||||
flecs::world &get();
|
||||
flecs::world get();
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user