gee_profile.h

Go to the documentation of this file.
00001 /* -*- C++ -*- */
00002 
00003 /* COPYRIGHT
00004  *
00005  * This file is part of the Visual Effects Engine - VEE
00006  *
00007  * Read the "VEE-LICENSE" file for the license.
00008  *
00009  * Authors & Copyright:   
00010  *
00011  * Tommi Ilmonen, Tuukka Heikura, Marko Myllymaa and 
00012  * Janne Kontkanen 2001-2004
00013  *
00014  * Additional copyrights: Tekes 2003-2004
00015  *
00016  * firstname.lastname@hut.fi
00017  *
00018  */
00019 
00020 #ifndef GEE_PROFILE_H
00021 #define GEE_PROFILE_H
00022 
00023 #include <gee_geometry.h>
00024 
00025 #include <vee_vector2.h>
00026 
00027 #include <vector>
00028 
00029 class GEE_ProfileVertex2D
00030 {
00031 public:
00032   GEE_ProfileVertex2D(const VEE_Vector2 & location = VEE_Vector2ZERO,
00033           const VEE_Vector2 & normal   = VEE_Vector2ZERO,
00034           bool continues = true)
00035     : m_location(location), m_normal(normal), m_continues(continues)
00036   {}
00037 
00038   bool read(GEE_Io * );
00039   bool write(GEE_Io *);
00040 
00041   VEE_Vector2 m_location;
00042   VEE_Vector2 m_normal;
00046   bool        m_continues;
00047 };
00048 
00051 
00055 class GEE_Profile : public GEE_Geometry
00056 {
00057 public:
00058   typedef std::vector<GEE_ProfileVertex2D> container;
00059   typedef container::iterator iterator;
00060 
00061   GEE_Profile();
00062   virtual ~GEE_Profile();
00063 
00064   virtual void render(GEE_Renderer *);
00065   virtual bool getBoundingBox(VEE_BoundingBox *);
00066 
00067   virtual bool read(GEE_Io * );
00068   virtual bool write(GEE_Io *);
00069 
00070   void clear();
00071 
00072   void generateCircle(float radius, int segments);
00073   void generateBar(float height = 1.0, float topWidth = 0.0);
00074   void generateCross(float radius);
00075   
00076   void addVertex(const GEE_ProfileVertex2D &v) { m_vertices.push_back(v); }
00077 
00078   void normalize(const VEE_Vector3 & span);
00079 
00080   uint size() const { return m_vertices.size(); }
00081   void resize(uint n) { m_vertices.resize(n); }
00082   uint segments() const;
00083   GEE_ProfileVertex2D & getVertex(uint i) { return m_vertices[i]; }
00084 
00085   iterator begin() { return m_vertices.begin(); }
00086   iterator end()   { return m_vertices.end(); }
00087 
00088 protected:
00089 
00090   container m_vertices;
00091 
00092 };
00093 
00094 #endif

Generated on Mon Mar 12 21:09:00 2007 for VEE - The Visual Effects Engine by  doxygen 1.4.6