Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

panda/src/chancfg/chancfg.h

Go to the documentation of this file.
00001 // Filename: chancfg.h
00002 // Created by:  cary (04Feb99)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
00008 //
00009 // All use of this software is subject to the terms of the Panda 3d
00010 // Software license.  You should have received a copy of this license
00011 // along with this source code; you will also find a current copy of
00012 // the license at http://www.panda3d.org/license.txt .
00013 //
00014 // To contact the maintainers of this program write to
00015 // panda3d@yahoogroups.com .
00016 //
00017 ////////////////////////////////////////////////////////////////////
00018 
00019 #ifndef __CHANCFG_H__
00020 #define __CHANCFG_H__
00021 
00022 #include "pandabase.h"
00023 
00024 #include "chanlayout.h"
00025 #include "chansetup.h"
00026 #include "chanwindow.h"
00027 #include "chanshare.h"
00028 
00029 #include "graphicsWindow.h"
00030 #include "pandaNode.h"
00031 #include "nodePath.h"
00032 
00033 #include "pmap.h"
00034 
00035 class GraphicsEngine;
00036 class GraphicsPipe;
00037 
00038 class EXPCL_PANDA ChanCfgOverrides {
00039 public:
00040   enum Field { OrigX, OrigY, SizeX, SizeY, Title, Mask, Cameras };
00041 private:
00042   class EXPCL_PANDA Types {
00043   private:
00044     bool         _b;
00045     int          _i;
00046     unsigned int _ui;
00047     float        _f;
00048     double       _d;
00049     std::string  _str;
00050   public:
00051     INLINE Types(void) {}
00052     INLINE Types(const Types& c) : _b(c._b), _i(c._i), _ui(c._ui), _f(c._f),
00053                                    _d(c._d), _str(c._str) {}
00054     INLINE ~Types(void) {}
00055     INLINE Types& operator=(const Types& c) {
00056       _b = c._b;
00057       _i = c._i;
00058       _ui = c._ui;
00059       _f = c._f;
00060       _d = c._d;
00061       _str = c._str;
00062       return *this;
00063     }
00064     INLINE void setBool(const bool v) { _b = v; }
00065     INLINE bool getBool(void) const { return _b; }
00066     INLINE void setInt(const int v) { _i = v; }
00067     INLINE int getInt(void) const { return _i; }
00068     INLINE void setUInt(const unsigned int v) { _ui = v; }
00069     INLINE unsigned int getUInt(void) const { return _ui; }
00070     INLINE void setFloat(const float v) { _f = v; }
00071     INLINE float getFloat(void) const { return _f; }
00072     INLINE void setDouble(const double v) { _d = v; }
00073     INLINE double getDouble(void) const { return _d; }
00074     INLINE void setString(const std::string& v) { _str = v; }
00075     INLINE std::string getString(void) const { return _str; }
00076   };
00077   typedef pmap<Field, Types> Fields;
00078   Fields _fields;
00079 public:
00080   ChanCfgOverrides(void);
00081   ChanCfgOverrides(const ChanCfgOverrides&);
00082   ~ChanCfgOverrides(void);
00083 
00084   ChanCfgOverrides& operator=(const ChanCfgOverrides&);
00085 
00086   void setField(const Field, const bool);
00087   void setField(const Field, const int);
00088   void setField(const Field, const unsigned int);
00089   void setField(const Field, const float);
00090   void setField(const Field, const double);
00091   void setField(const Field, const std::string&);
00092   void setField(const Field, const char*);
00093 
00094   bool defined(const Field) const;
00095 
00096   bool getBool(const Field) const;
00097   int getInt(const Field) const;
00098   unsigned int getUInt(const Field) const;
00099   float getFloat(const Field) const;
00100   double getDouble(const Field) const;
00101   std::string getString(const Field) const;
00102 };
00103 
00104 extern ChanCfgOverrides ChanOverrideNone;
00105 
00106 typedef pvector<SetupItem> SVec;
00107 
00108 class EXPCL_PANDA ChanConfig
00109 {
00110 private:
00111   std::vector< PT(PandaNode) > _group_node;
00112   std::vector< PT(DisplayRegion) > _display_region;
00113   std::vector<int> _group_membership;
00114   PT(GraphicsWindow) _graphics_window;
00115   void chan_eval(GraphicsWindow* win, WindowItem& W, LayoutItem& L, 
00116          SVec& S, ChanViewport& V, int hw_offset, 
00117          int xsize, int ysize, const NodePath &render, bool want_cameras);
00118 PUBLISHED:
00119   ChanConfig(GraphicsEngine *engine, GraphicsPipe *pipe,
00120              std::string cfg, const NodePath &render,
00121              ChanCfgOverrides& = ChanOverrideNone);
00122   INLINE PandaNode *get_group_node(const int node_index) const;
00123   INLINE int get_group_membership(const int dr_index) const;
00124   INLINE int get_num_groups(void) const;
00125   INLINE int get_num_drs(void) const;
00126   INLINE PT(DisplayRegion) get_dr(const int dr_index) const;
00127   INLINE PT(GraphicsWindow) get_win(void) const;
00128 };
00129 
00130 #include "chancfg.I"
00131 
00132 #endif /* __CHANCFG_H__ */

Generated on Fri May 2 00:35:18 2003 for Panda by doxygen1.3