/*! \file camera.h \brief Viewpoint controlling class definitions */ #ifndef CAMERA_H #define CAMERA_H #include "stdincl.h" class WorldEntity; class World; class CameraTarget; //! Camera /** This class controls the viewpoint from which the World is rendered. To use the Camera it has to be bound to a WorldEntity which serves as the reference focus point. The Camera itself calls the WorldEntity::get_lookat() and World::calc_camera_pos() functions to calculate the position it currently should be in. */ enum CAMERA_MODE {NORMAL, SMOTH_FOLLOW, STICKY, ELLIPTICAL}; class Camera { private: WorldEntity* bound; //!< the WorldEntity the Camera is bound to Placement actual_place; //!< the Camera's current position Placement desired_place; //!< where the Camera should be according to calculations World* world; CameraTarget* target; /* physical system - not needed yet */ float mass; //!< mass Vector *acceleration; //!< acceleration Vector *velocity; //!< velocity /* elliptical camera mode variables */ Placement plLastBPlace; float cameraOffset; float cameraOffsetZ; float deltaTime; float t; Vector r; float rAbs; float ka; float a0; Quaternion *from; Quaternion *to; Quaternion *res; CAMERA_MODE cameraMode; //!< saves the camera mode: how the camera follows the entity void update_desired_place (); public: Coordinate* coord; Camera (World* world); ~Camera (); void time_slice (Uint32 deltaT); void apply (); void bind (WorldEntity* entity); void jump (Placement* plc); void setWorld(World* world); }; //! A Class to handle the Target of a Camera. class CameraTarget { private: WorldEntity* lookAt; public: Coordinate* coord; CameraTarget (); CameraTarget (Vector pos); //!< a target only needs a Position and no Rotation void setLookAt (WorldEntity* lookat); }; #endif