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