gee_transparency_list.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_TRANSPARENCY_LIST_H
00021 #define GEE_TRANSPARENCY_LIST_H
00022 
00023 #include <vee_vector3.h>
00024 #include <vee_matrix4.h>
00025 
00026 #include <map>
00027 
00028 class GEE_Geometry;
00029 
00030 class VEE_Object;
00031 class VEE_SceneBox;
00032 
00040 class GEE_TransparencyList
00041 {
00042 public:
00043   enum Type {
00044     UNKNOWN,
00045     VEE_OBJ,
00046     GEE_DATA
00047   };
00048 
00049   class Item {
00050   public:
00051     Item(Type t = UNKNOWN, void * ptr = 0)
00052       : m_type(t), m_ptr(ptr) {}
00053 
00054     Item(GEE_Geometry * d, const VEE_Matrix4 &m) 
00055       : m_type(GEE_DATA), m_ptr(d), m_transformation(m)
00056     {}
00057 
00058     Item(VEE_Object * d, const VEE_Matrix4 &m, float scale) 
00059       : m_type(VEE_OBJ), m_ptr(d), m_transformation(m), m_scale(scale)
00060     {}
00061 
00062     Type type() const { return m_type; }
00063     void * ptr() { return m_ptr; }
00064 
00065     VEE_Matrix4 &       transformation()         { return m_transformation; }
00066     const VEE_Matrix4 & transformation() const   { return m_transformation; }
00067     void setTransformation(const VEE_Matrix4 &t) { m_transformation = t; }
00068 
00069     float scale() const { return m_scale; }
00070 
00071   protected:
00072     Type   m_type;
00073     void * m_ptr;
00074     VEE_Matrix4 m_transformation;
00075     float  m_scale;
00076   };
00077 
00078   typedef std::multimap<float, Item> container;
00079   typedef container::iterator iterator;
00080 
00081   GEE_TransparencyList();
00082   ~GEE_TransparencyList();
00083 
00084   void addVee(VEE_Object *, const VEE_Matrix4 &, float scale = 0.0f);
00085   void addVeeScene(VEE_SceneBox *, const VEE_Matrix4 &);
00086   void addGee(GEE_Geometry *, const VEE_Matrix4 &);
00087 
00088   iterator begin()  { return m_items.begin(); }
00089   iterator end()    { return m_items.end(); }
00090   uint size() const { return m_items.size(); }
00091 
00092   void setCameraLocation(const VEE_Vector3 &l) { m_camPos = l; }
00093 
00094   void clear();
00095 
00096   static Item & getItem(iterator & it) { return (*it).second; }
00097 
00098 protected:
00099 
00100   container m_items;
00104   iterator  m_latest;
00105 
00106   VEE_Vector3 m_camPos;
00107 };
00108 
00109 #endif

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