67 const std::string &name,
72 bool default_stereo_flags);
77 enum RenderTextureMode {
92 RTM_triggered_copy_texture,
96 RTM_triggered_copy_ram,
116 INLINE
const std::string &get_name()
const;
117 MAKE_PROPERTY(gsg, get_gsg);
118 MAKE_PROPERTY(pipe, get_pipe);
119 MAKE_PROPERTY(engine, get_engine);
120 MAKE_PROPERTY(name, get_name);
122 INLINE
int count_textures()
const;
123 INLINE
bool has_texture()
const;
124 virtual INLINE
Texture *get_texture(
int i=0)
const;
125 INLINE RenderTexturePlane get_texture_plane(
int i=0)
const;
126 INLINE RenderTextureMode get_rtm_mode(
int i=0)
const;
127 void clear_render_textures();
128 void add_render_texture(
Texture *tex, RenderTextureMode mode,
129 RenderTexturePlane bitplane=RTP_COUNT);
130 void setup_render_texture(
Texture *tex,
bool allow_bind,
bool to_ram);
132 INLINE
const LVecBase2i &get_size()
const;
133 INLINE
int get_x_size()
const;
134 INLINE
int get_y_size()
const;
135 INLINE LVecBase2i get_fb_size()
const;
136 INLINE
int get_fb_x_size()
const;
137 INLINE
int get_fb_y_size()
const;
138 INLINE LVecBase2i get_sbs_left_size()
const;
139 INLINE
int get_sbs_left_x_size()
const;
140 INLINE
int get_sbs_left_y_size()
const;
141 INLINE LVecBase2i get_sbs_right_size()
const;
142 INLINE
int get_sbs_right_x_size()
const;
143 INLINE
int get_sbs_right_y_size()
const;
144 INLINE
bool has_size()
const;
145 INLINE
bool is_valid()
const;
146 INLINE
bool is_nonzero_size()
const;
148 MAKE_PROPERTY(size, get_size);
149 MAKE_PROPERTY(fb_size, get_fb_size);
150 MAKE_PROPERTY(sbs_left_size, get_sbs_left_size);
151 MAKE_PROPERTY(sbs_right_size, get_sbs_right_size);
153 void set_active(
bool active);
154 virtual bool is_active()
const;
155 MAKE_PROPERTY(active, is_active, set_active);
157 void set_one_shot(
bool one_shot);
158 bool get_one_shot()
const;
159 MAKE_PROPERTY(one_shot, get_one_shot, set_one_shot);
161 void set_inverted(
bool inverted);
162 INLINE
bool get_inverted()
const;
163 MAKE_PROPERTY(inverted, get_inverted, set_inverted);
165 INLINE
void set_swap_eyes(
bool swap_eyes);
166 INLINE
bool get_swap_eyes()
const;
167 MAKE_PROPERTY(swap_eyes, get_swap_eyes, set_swap_eyes);
169 INLINE
void set_red_blue_stereo(
bool red_blue_stereo,
170 unsigned int left_eye_color_mask,
171 unsigned int right_eye_color_mask);
172 INLINE
bool get_red_blue_stereo()
const;
173 INLINE
unsigned int get_left_eye_color_mask()
const;
174 INLINE
unsigned int get_right_eye_color_mask()
const;
176 void set_side_by_side_stereo(
bool side_by_side_stereo);
177 void set_side_by_side_stereo(
bool side_by_side_stereo,
178 const LVecBase4 &sbs_left_dimensions,
179 const LVecBase4 &sbs_right_dimensions);
180 INLINE
bool get_side_by_side_stereo()
const;
181 INLINE
const LVecBase4 &get_sbs_left_dimensions()
const;
182 INLINE
const LVecBase4 &get_sbs_right_dimensions()
const;
185 INLINE
bool is_stereo()
const;
187 INLINE
void clear_delete_flag();
188 bool get_delete_flag()
const;
190 virtual void set_sort(
int sort);
191 INLINE
int get_sort()
const;
192 MAKE_PROPERTY(sort, get_sort, set_sort);
194 INLINE
void set_child_sort(
int child_sort);
195 INLINE
void clear_child_sort();
196 INLINE
int get_child_sort()
const;
197 MAKE_PROPERTY(child_sort, get_child_sort, set_child_sort);
202 INLINE
DisplayRegion *make_display_region(PN_stdfloat l, PN_stdfloat r, PN_stdfloat b, PN_stdfloat t);
203 DisplayRegion *make_display_region(
const LVecBase4 &dimensions);
205 INLINE
DisplayRegion *make_mono_display_region(PN_stdfloat l, PN_stdfloat r, PN_stdfloat b, PN_stdfloat t);
206 DisplayRegion *make_mono_display_region(
const LVecBase4 &dimensions);
208 INLINE
StereoDisplayRegion *make_stereo_display_region(PN_stdfloat l, PN_stdfloat r, PN_stdfloat b, PN_stdfloat t);
211 void remove_all_display_regions();
214 void set_overlay_display_region(
DisplayRegion *display_region);
216 int get_num_display_regions()
const;
218 MAKE_SEQ(get_display_regions, get_num_display_regions, get_display_region);
219 MAKE_SEQ_PROPERTY(display_regions, get_num_display_regions, get_display_region);
221 int get_num_active_display_regions()
const;
223 MAKE_SEQ(get_active_display_regions, get_num_active_display_regions, get_active_display_region);
224 MAKE_SEQ_PROPERTY(active_display_regions, get_num_active_display_regions, get_active_display_region);
227 const std::string &name,
int x_size,
int y_size,
234 INLINE
static Filename make_screenshot_filename(
235 const std::string &prefix =
"screenshot");
236 INLINE
Filename save_screenshot_default(
237 const std::string &prefix =
"screenshot");
238 INLINE
bool save_screenshot(
239 const Filename &filename,
const std::string &image_comment =
"");
240 INLINE
bool get_screenshot(
PNMImage &image);
241 INLINE PT(
Texture) get_screenshot();
246 virtual void unshare_depth_buffer();
248 virtual bool get_supports_render_texture()
const;
249 MAKE_PROPERTY(supports_render_texture, get_supports_render_texture);
255 virtual bool flip_ready()
const;
261 virtual void request_open();
262 virtual void request_close();
264 virtual void set_close_now();
265 virtual void reset_window(
bool swapchain);
266 virtual void clear_pipe();
268 void set_size_and_recalc(
int x,
int y);
273 virtual void clear(
Thread *current_thread);
274 virtual bool begin_frame(FrameMode mode,
Thread *current_thread);
275 virtual void end_frame(FrameMode mode,
Thread *current_thread);
278 virtual void select_target_tex_page(
int page);
281 virtual void begin_flip();
282 virtual void ready_flip();
283 virtual void end_flip();
288 virtual void process_events();
295 virtual void pixel_factor_changed();
296 void prepare_for_deletion();
297 void promote_to_copy_texture();
298 bool copy_to_textures();
300 INLINE
void begin_frame_spam(FrameMode mode);
301 INLINE
void end_frame_spam(FrameMode mode);
302 INLINE
void clear_cube_map_selection();
303 INLINE
void trigger_flip();
311 bool do_remove_display_region(
DisplayRegion *display_region);
313 INLINE
void win_display_regions_changed();
315 INLINE
void determine_display_regions()
const;
316 void do_determine_display_regions(CData *cdata);
318 static unsigned int parse_color_mask(
const std::string &word);
329 int _target_tex_page;
330 int _target_tex_view;
335 class RenderTexture {
338 RenderTexturePlane _plane;
339 RenderTextureMode _rtm_mode;
346 bool _got_child_sort;
347 unsigned int _internal_sort_index;
352 bool _red_blue_stereo;
353 unsigned int _left_eye_color_mask;
354 unsigned int _right_eye_color_mask;
355 bool _side_by_side_stereo;
356 LVecBase4 _sbs_left_dimensions;
357 LVecBase4 _sbs_right_dimensions;
371 TotalDisplayRegions _total_display_regions;
377 class EXPCL_PANDA_DISPLAY CData :
public CycleData {
380 CData(
const CData ©);
384 return GraphicsOutput::get_class_type();
387 RenderTextures _textures;
391 ActiveDisplayRegions _active_display_regions;
392 bool _active_display_regions_stale;
405 bool _is_nonzero_size;
419 static void init_type() {
420 GraphicsOutputBase::init_type();
422 GraphicsOutputBase::get_class_type());
425 return get_class_type();
427 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
Represents a texture object, which is typically a single 2-d image but may also represent a 1-d or 3-...