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

panda/src/display/displayRegion.h

Go to the documentation of this file.
00001 // Filename: displayRegion.h
00002 // Created by:  mike (09Jan97)
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 #ifndef DISPLAYREGION_H
00019 #define DISPLAYREGION_H
00020 
00021 #include "pandabase.h"
00022 
00023 #include "clearableRegion.h"
00024 #include "referenceCount.h"
00025 #include "nodePath.h"
00026 #include "cullResult.h"
00027 #include "pointerTo.h"
00028 #include "pmutex.h"
00029 
00030 #include "plist.h"
00031 
00032 class GraphicsLayer;
00033 class GraphicsChannel;
00034 class GraphicsWindow;
00035 class GraphicsPipe;
00036 class CullHandler;
00037 class Camera;
00038 
00039 ////////////////////////////////////////////////////////////////////
00040 //       Class : DisplayRegion
00041 // Description :
00042 ////////////////////////////////////////////////////////////////////
00043 class EXPCL_PANDA DisplayRegion : public ReferenceCount, public ClearableRegion {
00044 public:
00045   DisplayRegion(GraphicsLayer *layer);
00046   DisplayRegion(GraphicsLayer *layer,
00047                 const float l, const float r,
00048                 const float b, const float t);
00049   DisplayRegion(int xsize, int ysize);
00050 private:
00051   DisplayRegion(const DisplayRegion &copy);
00052   void operator = (const DisplayRegion &copy);
00053 
00054 public:
00055   ~DisplayRegion();
00056 
00057 PUBLISHED:
00058   void get_dimensions(float &l, float &r, float &b, float &t) const;
00059   float get_left() const;
00060   float get_right() const;
00061   float get_bottom() const;
00062   float get_top() const;
00063   void set_dimensions(float l, float r, float b, float t);
00064 
00065   GraphicsLayer *get_layer() const;
00066   GraphicsChannel *get_channel() const;
00067   GraphicsWindow *get_window() const;
00068   GraphicsPipe *get_pipe() const;
00069 
00070   void set_camera(const NodePath &camera);
00071   const NodePath &get_camera() const;
00072 
00073   void set_active(bool active);
00074   INLINE bool is_active() const;
00075 
00076   void compute_pixels();
00077   void compute_pixels(int x_size, int y_size);
00078   void get_pixels(int &pl, int &pr, int &pb, int &pt) const;
00079   void get_region_pixels(int &xo, int &yo, int &w, int &h) const;
00080 
00081   int get_pixel_width() const;
00082   int get_pixel_height() const;
00083 
00084   void output(ostream &out) const;
00085 
00086 private:
00087   void win_display_regions_changed();
00088   INLINE void do_compute_pixels(int x_size, int y_size);
00089   Mutex _lock;
00090 
00091   float _l;
00092   float _r;
00093   float _b;
00094   float _t;
00095 
00096   int _pl;
00097   int _pr;
00098   int _pb;
00099   int _pt;
00100 
00101   GraphicsLayer *_layer;
00102   NodePath _camera;
00103 
00104   // This needs to be a PT(Camera) so we prevent the Camera node from
00105   // destructing while we hold its pointer.
00106   PT(Camera) _camera_node;
00107 
00108   bool _active;
00109 
00110   // This is used to cache the culling result from last frame's
00111   // drawing into this display region.  It should only be accessed or
00112   // modified by the GraphicsEngine, during the cull traversal.
00113   PT(CullResult) _cull_result;
00114 
00115   friend class GraphicsLayer;
00116   friend class GraphicsEngine;
00117 };
00118 
00119 INLINE ostream &operator << (ostream &out, const DisplayRegion &dr);
00120 
00121 #include "displayRegion.I"
00122 
00123 #endif /* DISPLAYREGION_H */

Generated on Fri May 2 00:36:22 2003 for Panda by doxygen1.3