65 return cdata->_textures.size();
74 return (cdata->_textures.size() > 0);
89 if ((i < 0) || (i >= ((
int)cdata->_textures.size()))) {
92 return cdata->_textures[i]._texture;
102 if ((i < 0) || (i >= ((
int)cdata->_textures.size()))) {
103 return (RenderTexturePlane)0;
105 return cdata->_textures[i]._plane;
115 if ((i < 0) || (i >= ((
int)cdata->_textures.size()))) {
118 return cdata->_textures[i]._rtm_mode;
146 return _size.get_x();
160 return _size.get_y();
201 PN_stdfloat left_w = _sbs_left_dimensions[1] - _sbs_left_dimensions[0];
202 PN_stdfloat left_h = _sbs_left_dimensions[3] - _sbs_left_dimensions[2];
203 return LVecBase2i(std::max(
int(_size.get_x() * left_w), 1),
204 std::max(
int(_size.get_y() * left_h), 1));
214 PN_stdfloat left_w = _sbs_left_dimensions[1] - _sbs_left_dimensions[0];
215 return std::max(
int(_size.get_x() * left_w), 1);
225 PN_stdfloat left_h = _sbs_left_dimensions[3] - _sbs_left_dimensions[2];
226 return std::max(
int(_size.get_y() * left_h), 1);
236 PN_stdfloat right_w = _sbs_right_dimensions[1] - _sbs_right_dimensions[0];
237 PN_stdfloat right_h = _sbs_right_dimensions[3] - _sbs_right_dimensions[2];
238 return LVecBase2i(std::max(
int(_size.get_x() * right_w), 1),
239 std::max(
int(_size.get_y() * right_h), 1));
249 PN_stdfloat right_w = _sbs_right_dimensions[1] - _sbs_right_dimensions[0];
250 return std::max(
int(_size.get_x() * right_w), 1);
260 PN_stdfloat right_h = _sbs_right_dimensions[3] - _sbs_right_dimensions[2];
261 return std::max(
int(_size.get_y() * right_h), 1);
281 return _is_valid && _is_nonzero_size;
290 return _is_nonzero_size;
312 _swap_eyes = swap_eyes;
339 unsigned int left_eye_color_mask,
340 unsigned int right_eye_color_mask) {
341 _red_blue_stereo = red_blue_stereo;
342 if (_red_blue_stereo) {
343 _left_eye_color_mask = left_eye_color_mask;
344 _right_eye_color_mask = right_eye_color_mask;
346 _left_eye_color_mask = 0x0f;
347 _right_eye_color_mask = 0x0f;
357 return _red_blue_stereo;
367 return _left_eye_color_mask;
377 return _right_eye_color_mask;
386 return _side_by_side_stereo;
396 return _sbs_left_dimensions;
406 return _sbs_right_dimensions;
414 return _fb_properties;
424 return _red_blue_stereo || _side_by_side_stereo || _fb_properties.is_stereo();
433 _delete_flag =
false;
463 _child_sort = child_sort;
464 _got_child_sort =
true;
473 _got_child_sort =
false;
482 if (_got_child_sort) {
497 if (future ==
nullptr) {
499 _trigger_copy = future;
592 return _overlay_display_region;
616 return _overlay_display_region->save_screenshot_default(prefix);
627 return _overlay_display_region->save_screenshot(filename, image_comment);
636 return _overlay_display_region->get_screenshot(image);
645 return _overlay_display_region->get_screenshot();
655 if (_sort != other._sort) {
656 return _sort < other._sort;
658 return _internal_sort_index < other._internal_sort_index;
666 INLINE
void GraphicsOutput::
667 determine_display_regions()
const {
670 CDLockedReader cdata(_cycler);
671 if (cdata->_active_display_regions_stale) {
682 INLINE
void GraphicsOutput::
683 win_display_regions_changed() {
684 CDWriter cdata(_cycler,
true);
685 cdata->_active_display_regions_stale =
true;
694 return _cull_window_pcollector;
703 return _draw_window_pcollector;
712 return _clear_window_pcollector;
718 INLINE
void GraphicsOutput::
719 begin_frame_spam(FrameMode mode) {
720 if (display_cat.is_spam()) {
722 <<
"begin_frame(" << mode <<
"): " << get_type() <<
" "
723 <<
get_name() <<
" " << (
void *)
this <<
"\n";
730 INLINE
void GraphicsOutput::
731 end_frame_spam(FrameMode mode) {
732 if (display_cat.is_spam()) {
734 <<
"end_frame(" << mode <<
"): " << get_type() <<
" "
735 <<
get_name() <<
" " << (
void *)
this <<
"\n";
743 INLINE
void GraphicsOutput::
744 clear_cube_map_selection() {
745 _target_tex_page = -1;
746 _prev_page_dr =
nullptr;
753 INLINE
void GraphicsOutput::
755 if (!_fb_properties.is_single_buffered()) {
This class represents a thread-safe handle to a promised future result of an asynchronous operation,...
This template class calls PipelineCycler::read_unlocked(), and then provides a transparent read-only ...
A rectangular subregion within a window for rendering into.
static Filename make_screenshot_filename(const std::string &prefix="screenshot")
Synthesizes a suitable default filename for passing to save_screenshot().
get_pixel_factor
Returns the amount by which the height and width of the region will be scaled internally,...
The name of a file, such as a texture file or an Egg file.
A container for the various kinds of properties we might ask to have on a graphics frameBuffer before...
This class is the main interface to controlling the render process.
This is a base class for the various different classes that represent the result of a frame of render...
set_swap_eyes
Changes the "swap eyes" flag.
bool has_texture() const
Returns true if the GraphicsOutput is rendering into any textures at all.
int get_fb_x_size() const
Returns the internal width of the window or buffer.
get_inverted
Returns the current setting of the inverted flag.
get_pipe
Returns the GraphicsPipe that this window is associated with.
bool has_size() const
Returns true if the size of the window/frame buffer is known, false otherwise.
bool operator<(const GraphicsOutput &other) const
The sorting operator is used to order the GraphicsOutput object in order by their sort number,...
void clear_child_sort()
Resets the sort value of future offscreen buffers created by make_texture_sort() to the default value...
get_gsg
Returns the GSG that is associated with this window.
get_sbs_left_size
If side-by-side stereo is enabled, this returns the pixel size of the left eye, based on scaling get_...
int count_textures() const
If the GraphicsOutput is set to render into a texture, returns the number of textures that are being ...
int get_sbs_left_x_size() const
If side-by-side stereo is enabled, this returns the pixel width of the left eye, based on scaling get...
PStatCollector & get_draw_window_pcollector()
Returns a PStatCollector for timing the draw operation for just this GraphicsOutput.
PStatCollector & get_cull_window_pcollector()
Returns a PStatCollector for timing the cull operation for just this GraphicsOutput.
get_fb_size
Returns the internal size of the window or buffer.
const FrameBufferProperties & get_fb_properties() const
Returns the framebuffer properties of the window.
bool is_nonzero_size() const
Returns true if the output has a nonzero size in both X and Y, or false if it is zero (and therefore ...
StereoDisplayRegion * make_stereo_display_region()
Creates a new DisplayRegion that covers the entire window.
DisplayRegion * make_mono_display_region()
Creates a new DisplayRegion that covers the entire window.
bool get_side_by_side_stereo() const
Returns whether side-by-side stereo mode is in effect for this particular window.
int get_sbs_right_x_size() const
If side-by-side stereo is enabled, this returns the pixel width of the right eye, based on scaling ge...
bool get_screenshot(PNMImage &image)
Captures the most-recently rendered image from the framebuffer into the indicated PNMImage.
Filename save_screenshot_default(const std::string &prefix="screenshot")
Saves a screenshot of the region to a default filename, and returns the filename, or empty string if ...
RenderTexturePlane get_texture_plane(int i=0) const
Returns the RenderTexturePlane associated with the nth render-texture.
DisplayRegion * get_overlay_display_region() const
Returns the special "overlay" DisplayRegion that is created for each window or buffer.
void set_red_blue_stereo(bool red_blue_stereo, unsigned int left_eye_color_mask, unsigned int right_eye_color_mask)
Enables red-blue stereo mode on this particular window.
get_child_sort
Returns the sort value of future offscreen buffers created by make_texture_sort().
void clear_delete_flag()
Resets the delete flag, so the GraphicsOutput will not be automatically deleted before the beginning ...
unsigned int get_right_eye_color_mask() const
Returns the color mask in effect when rendering a right-eye view in red_blue stereo mode.
int get_fb_y_size() const
Returns the internal height of the window or buffer.
DisplayRegion * make_display_region()
Creates a new DisplayRegion that covers the entire window.
get_size
Returns the visible size of the window or buffer, if it is known.
get_sbs_right_size
If side-by-side stereo is enabled, this returns the pixel size of the right eye, based on scaling get...
static Filename make_screenshot_filename(const std::string &prefix="screenshot")
Saves a screenshot of the region to a default filename, and returns the filename, or empty string if ...
get_swap_eyes
Returns the current setting of the "swap eyes" flag.
get_engine
Returns the graphics engine that created this output.
bool is_valid() const
Returns true if the output is fully created and ready for rendering, false otherwise.
int get_y_size() const
Returns the visible height of the window or buffer, if it is known.
const LVecBase4 & get_sbs_left_dimensions() const
Returns the effective sub-region of the window for displaying the left channel, if side-by-side stere...
get_sort
Returns the sorting order of this particular GraphicsOutput.
get_name
Returns the name that was passed to the GraphicsOutput constructor.
set_child_sort
Specifies the sort value of future offscreen buffers created by make_texture_sort().
PStatCollector & get_clear_window_pcollector()
Returns a PStatCollector for timing the clear operation for just this GraphicsOutput.
unsigned int get_left_eye_color_mask() const
Returns the color mask in effect when rendering a left-eye view in red_blue stereo mode.
RenderTextureMode get_rtm_mode(int i=0) const
Returns the RenderTextureMode associated with the nth render-texture.
bool is_stereo() const
Returns Returns true if this window can render stereo DisplayRegions, either through red-blue stereo ...
bool get_red_blue_stereo() const
Returns whether red-blue stereo mode is in effect for this particular window.
int get_sbs_left_y_size() const
If side-by-side stereo is enabled, this returns the pixel height of the left eye, based on scaling ge...
int get_x_size() const
Returns the visible width of the window or buffer, if it is known.
AsyncFuture * trigger_copy()
When the GraphicsOutput is in triggered copy mode, this function triggers the copy (at the end of the...
bool save_screenshot(const Filename &filename, const std::string &image_comment="")
Saves a screenshot of the region to the indicated filename.
int get_sbs_right_y_size() const
If side-by-side stereo is enabled, this returns the pixel height of the right eye,...
virtual Texture * get_texture(int i=0) const
Returns the nth texture into which the GraphicsOutput renders.
const LVecBase4 & get_sbs_right_dimensions() const
Returns the effective sub-region of the window for displaying the right channel, if side-by-side ster...
An object to create GraphicsOutputs that share a particular 3-D API.
Encapsulates all the communication with a particular instance of a given rendering backend.
The name of this class derives from the fact that we originally implemented it as a layer on top of t...
A lightweight class that represents a single element that may be timed and/or counted via stats.
This is a special DisplayRegion wrapper that actually includes a pair of DisplayRegions internally: t...
Represents a texture object, which is typically a single 2-d image but may also represent a 1-d or 3-...
PT(Texture) GraphicsOutput
Captures the most-recently rendered image from the framebuffer and returns it as Texture,...