//////////////////////////////////////////////////////////////////////////////// // spinningHexahedronEngine.h // //////////////////////////////////////////////////////////////////////////////// #ifndef SPINNING_HEXAHEDRON_ENGINE_H #define SPINNING_HEXAHEDRON_ENGINE_H #include #include #include #include namespace animal{ /// This is a simple engine in order to show how to use AnimAL engines. /// This engine makes the vertices of an hexahedron /// move along an interpolated path: move(dt). It can be init and drawn: init() and draw(). /// The interpolated path can be drawn or not: setPathDrawn(), getPathDrawn() /// A key frame data structure for the key frame engine class Morphings : public std::map > { public: typedef float Key; typedef std::vector Values; }; /// A key frame engine typedef MorphingEngine AMorphingEngine; class SpinningHexahedronEngine : public AMorphingEngine { public : SpinningHexahedronEngine(); //=============================================================== /** @name Virtual methods */ //@{ /// Initialize the positions virtual void reset(); /// Move the object virtual void move(double dt); /// Draw the object virtual void draw(); /// Compute the bounding box of the object virtual void getBoundingBox( float & minX, float & minY, float & minZ, float & maxX, float & maxY, float & maxZ); //@} //================================================================ //====================== Getters /// Get if the interpolated path is drawn bool * getPathDrawn(){ return & pathDrawn;} //====================== Setters /// Set if the interpolated path is drawn void setPathDrawn(bool b){ pathDrawn = b;} public: void updatePath(); private: /// Updates the vertices to draw the trajectories void updatePath(unsigned int num); protected: // Attributes /// True when the interpolated path is drawn bool pathDrawn; private: typedef std::vector Vertices; /// The vertices to draw the trajectory Vertices * vertices; /// The key vertices to draw the trajectory Vertices * keys; }; }//namespace animal #endif