Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members

DrawMgr.H

Go to the documentation of this file.
00001 
00009 #ifndef DRAWMGR_H
00010 #define DRAWMGR_H
00011 
00012 #include "streamwrap.H"
00013 // Gluebase includes
00014 #define OUTSIDE_GLUE_CORE
00015 #include <std/hash.H>
00016 #include <std/strings.H>
00017 #include <mlib/points.H>
00018 
00019 #include "glwrap.H"
00020 #include "SelectMgr.H"
00021 
00022 namespace InSpace {
00023 
00024 class DrawObj;
00025 class ScreenGrab;
00026 class ScreenGrabInt;
00027 class Texture;
00028 
00029 class DRAWMGR
00030 {
00031  public:
00032 
00033   // add/remove objects from the manager
00034   static void registerObj(DrawObj* o);
00035   static void register2DObj(DrawObj* o);
00036   static void removeObj(DrawObj* o, bool display=true);
00037 
00038   // access registered objects
00039   static int numObjects() { 
00040     return _objects.num() + _2dObjects.num(); 
00041   }
00042 
00043 
00044 
00045   static DrawObj* getObject(const int num) {
00046     if (num < _objects.num())
00047       return _objects[num];
00048     else if (num < (_objects.num() + _2dObjects.num()))
00049       return _2dObjects[num - _objects.num()];
00050     else
00051       return NULL;
00052   }
00053 
00054 
00055   // draws a single DrawObj* - generally called automatically for all 
00056   // registered objects from within DRAWMGR::draw()
00057   // but can call it from within your own DrawObj's draw method to draw
00058   // a second DrawObj that you want to manage on your own.
00059   static void drawObject(DrawObj* const d);
00060 
00061   // called by a GL program to do initialization and drawing
00062   static void contextInit();
00063   static void draw(int pass=0);
00064   static void frameDone();
00065 
00066   // frame/time management
00067   static double elapsedTime();
00068   static double timeSinceLastFrame();
00069   static long   frameCount() { return _frameCount; }
00070 
00071   static void   offsetTime(const double offset) { _startTime -= offset; }
00072 
00073   // access to screengrab class
00074   static ScreenGrab* screenGrab() { return _screenGrab; }
00075 
00079   static void drawFullscreenImage(Texture *image, 
00080                   float xmin=0.0, float ymin=0.0,
00081                   float xmax=1.0, float ymax=1.0);
00082   static void drawPaperBackground();
00083 
00084   static float paperXOffset() { return _paperXOffset; }
00085   static float paperYOffset() { return _paperYOffset; }
00086 
00087   static void setPaperXOffset(float o) { _paperXOffset = o; }
00088   static void setPaperYOffset(float o) { _paperYOffset = o; }
00089 
00090   static float paperRepeat()           { return _paperRepeat; }
00091   static void  setPaperRepeat(float r) { _paperRepeat = r; }
00092 
00093  protected:
00094   static GLenum getLight(const int i);
00095   
00096   // 3D objects
00097   static ARRAY<DrawObj*> _objects;
00098 
00099   // 2D screen space objects
00100   static ARRAY<DrawObj*> _2dObjects;
00101 
00102   // time values
00103   static double _startTime;
00104   static double _lastFrameTime;
00105 
00106   // frame count
00107   static long _frameCount;
00108 
00109   // facility for saving views as image files
00110   static ScreenGrab* _screenGrab;
00111   static ScreenGrabInt* _screenGrabInt;
00112 
00113   static int _useDLs;
00114 
00115   // for rendering a paper texture as the screen background
00116   static Texture *_paperTexture;
00117   static float    _paperRepeat;
00118   static float    _paperXOffset;
00119   static float    _paperYOffset;
00123   static int      _paperPass;
00124 
00126   static int      _useG3DRendering;
00127 };
00128 
00129 }
00130 
00131 #endif

Generated on Thu Jul 8 15:19:28 2004 for inspace by doxygen 1.3.4