Blender  V2.59
RAS_ListRasterizer.h
Go to the documentation of this file.
00001 
00006 #ifndef __RAS_LISTRASTERIZER_H__
00007 #define __RAS_LISTRASTERIZER_H__
00008 
00009 #include "RAS_MaterialBucket.h"
00010 #include "RAS_VAOpenGLRasterizer.h"
00011 #include <vector>
00012 #include <map>
00013 
00014 class RAS_ListRasterizer;
00015 class RAS_ListSlot : public KX_ListSlot
00016 {
00017         friend class RAS_ListRasterizer;
00018         unsigned int m_list;
00019         unsigned int m_flag;
00020         unsigned int m_matnr;
00021         RAS_ListRasterizer* m_rasty;
00022 public:
00023         RAS_ListSlot(RAS_ListRasterizer* rasty);
00024         virtual ~RAS_ListSlot();
00025         virtual void SetModified(bool mod);
00026         virtual int Release();
00027 
00028         void RemoveList();
00029         void DrawList();
00030         void EndList();
00031         bool End();
00032 
00033 };
00034 
00035 enum RAS_ListSlotFlags  {
00036         LIST_CREATE             =1,
00037         LIST_MODIFY             =2,
00038         LIST_STREAM             =4,
00039         LIST_NOCREATE   =8,
00040         LIST_BEGIN              =16,
00041         LIST_END                =32,
00042         LIST_REGEN              =64,
00043         LIST_DERIVEDMESH=128,
00044 };
00045 
00046 struct DerivedMesh;
00047 
00048 typedef std::map<RAS_DisplayArrayList, RAS_ListSlot*> RAS_ArrayLists;
00049 typedef std::vector<RAS_ListSlot*>                                        RAS_ListSlots;        // indexed by material slot number
00050 typedef std::map<DerivedMesh*, RAS_ListSlots*>            RAS_DerivedMeshLists;
00051 
00052 class RAS_ListRasterizer : public RAS_VAOpenGLRasterizer
00053 {
00054         bool mUseVertexArrays;
00055         bool mATI;
00056         RAS_ArrayLists mArrayLists;
00057         RAS_DerivedMeshLists mDerivedMeshLists;
00058 
00059         RAS_ListSlot* FindOrAdd(class RAS_MeshSlot& ms);
00060         void ReleaseAlloc();
00061 
00062 public:
00063         void RemoveListSlot(RAS_ListSlot* list);
00064         RAS_ListRasterizer(RAS_ICanvas* canvas, bool useVertexArrays=false, bool lock=false);
00065         virtual ~RAS_ListRasterizer();
00066 
00067         virtual void    IndexPrimitives(class RAS_MeshSlot& ms);
00068         virtual void    IndexPrimitivesMulti(class RAS_MeshSlot& ms);
00069 
00070         virtual bool    Init();
00071         virtual void    Exit();
00072 
00073         virtual void    SetDrawingMode(int drawingmode);
00074 
00075         virtual bool    QueryLists(){return true;}
00076         
00077         
00078 #ifdef WITH_CXX_GUARDEDALLOC
00079 public:
00080         void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:RAS_ListRasterizer"); }
00081         void operator delete( void *mem ) { MEM_freeN(mem); }
00082 #endif
00083 };
00084 
00085 #endif