00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
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
00041
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 ©);
00052 void operator = (const DisplayRegion ©);
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
00105
00106 PT(Camera) _camera_node;
00107
00108 bool _active;
00109
00110
00111
00112
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