Panda3D
 All Classes Functions Variables Enumerations
drawableRegion.h
1 // Filename: drawableRegion.h
2 // Created by: drose (11Jul02)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef DRAWABLEREGION_H
16 #define DRAWABLEREGION_H
17 
18 #include "pandabase.h"
19 #include "luse.h"
20 #include "renderBuffer.h"
21 #include "typedWritableReferenceCount.h"
22 
23 ////////////////////////////////////////////////////////////////////
24 // Class : DrawableRegion
25 // Description : This is a base class for GraphicsWindow (actually,
26 // GraphicsOutput) and DisplayRegion, both of which are
27 // conceptually rectangular regions into which drawing
28 // commands may be issued. Sometimes you want to deal
29 // with a single display region, and sometimes you want
30 // to deal with the whole window at once, particularly
31 // for issuing clear commands and capturing screenshots.
32 ////////////////////////////////////////////////////////////////////
33 class EXPCL_PANDA_DISPLAY DrawableRegion {
34 public:
35  INLINE DrawableRegion();
36  INLINE DrawableRegion(const DrawableRegion &copy);
37  INLINE void operator = (const DrawableRegion &copy);
38  virtual ~DrawableRegion();
39 
40  INLINE void copy_clear_settings(const DrawableRegion &copy);
41 
42 PUBLISHED:
43  // It seems awkward to have this type, and also
44  // RenderBuffer::Type. However, the fact that RenderBuffer::Type
45  // is a bitmask makes it awfully awkward to work with.
46  enum RenderTexturePlane {
47  RTP_stencil=0,
48  RTP_depth_stencil=1,
49  RTP_color,
50  RTP_aux_rgba_0,
51  RTP_aux_rgba_1,
52  RTP_aux_rgba_2,
53  RTP_aux_rgba_3,
54  RTP_aux_hrgba_0,
55  RTP_aux_hrgba_1,
56  RTP_aux_hrgba_2,
57  RTP_aux_hrgba_3,
58  RTP_aux_float_0,
59  RTP_aux_float_1,
60  RTP_aux_float_2,
61  RTP_aux_float_3,
62  RTP_depth,
63  RTP_COUNT
64  };
65 
66  INLINE void set_clear_color_active(bool clear_color_active);
67  INLINE bool get_clear_color_active() const;
68 
69  INLINE void set_clear_depth_active(bool clear_depth_active);
70  INLINE bool get_clear_depth_active() const;
71 
72  INLINE void set_clear_stencil_active(bool clear_stencil_active);
73  INLINE bool get_clear_stencil_active() const;
74 
75  INLINE void set_clear_color(const LColor &color);
76  INLINE const LColor &get_clear_color() const;
77 
78  INLINE void set_clear_depth(PN_stdfloat depth);
79  INLINE PN_stdfloat get_clear_depth() const;
80 
81  INLINE void set_clear_stencil(unsigned int stencil);
82  INLINE unsigned int get_clear_stencil() const;
83 
84  virtual void set_clear_active(int n, bool clear_aux_active);
85  virtual bool get_clear_active(int n) const;
86 
87  virtual void set_clear_value(int n, const LColor &clear_value);
88  virtual const LColor &get_clear_value(int n) const;
89 
90  virtual void disable_clears();
91  virtual bool is_any_clear_active() const;
92 
93  virtual void set_pixel_zoom(PN_stdfloat pixel_zoom);
94  INLINE PN_stdfloat get_pixel_zoom() const;
95  INLINE PN_stdfloat get_pixel_factor() const;
96  virtual bool supports_pixel_zoom() const;
97 
98  static int get_renderbuffer_type(int plane);
99 
100 public:
101  INLINE int get_screenshot_buffer_type() const;
102  INLINE int get_draw_buffer_type() const;
103 
104 protected:
105  INLINE void update_pixel_factor();
106  virtual void pixel_factor_changed();
107 
108 protected:
109  int _screenshot_buffer_type;
110  int _draw_buffer_type;
111 
112 private:
113  bool _clear_active[RTP_COUNT];
114  LColor _clear_value[RTP_COUNT];
115 
116  PN_stdfloat _pixel_zoom;
117  PN_stdfloat _pixel_factor;
118 };
119 
120 
121 #include "drawableRegion.I"
122 
123 #endif
This is a base class for GraphicsWindow (actually, GraphicsOutput) and DisplayRegion, both of which are conceptually rectangular regions into which drawing commands may be issued.
This is the base class for all three-component vectors and points.
Definition: lvecBase4.h:111