84 return cdata->_textures.size();
96 return (cdata->_textures.size() > 0);
115 if ((i < 0) || (i >= ((
int)cdata->_textures.size()))) {
118 return cdata->_textures[i]._texture;
131 if ((i < 0) || (i >= ((
int)cdata->_textures.size()))) {
132 return (RenderTexturePlane)0;
134 return cdata->_textures[i]._plane;
147 if ((i < 0) || (i >= ((
int)cdata->_textures.size()))) {
150 return cdata->_textures[i]._rtm_mode;
188 return _size.get_x();
207 return _size.get_y();
261 PN_stdfloat left_w = _sbs_left_dimensions[1] - _sbs_left_dimensions[0];
262 PN_stdfloat left_h = _sbs_left_dimensions[3] - _sbs_left_dimensions[2];
263 return LVecBase2i(max(
int(_size.get_x() * left_w), 1),
264 max(
int(_size.get_y() * left_h), 1));
278 PN_stdfloat left_w = _sbs_left_dimensions[1] - _sbs_left_dimensions[0];
279 return max(
int(_size.get_x() * left_w), 1);
293 PN_stdfloat left_h = _sbs_left_dimensions[3] - _sbs_left_dimensions[2];
294 return max(
int(_size.get_y() * left_h), 1);
308 PN_stdfloat right_w = _sbs_right_dimensions[1] - _sbs_right_dimensions[0];
309 PN_stdfloat right_h = _sbs_right_dimensions[3] - _sbs_right_dimensions[2];
310 return LVecBase2i(max(
int(_size.get_x() * right_w), 1),
311 max(
int(_size.get_y() * right_h), 1));
325 PN_stdfloat right_w = _sbs_right_dimensions[1] - _sbs_right_dimensions[0];
326 return max(
int(_size.get_x() * right_w), 1);
340 PN_stdfloat right_h = _sbs_right_dimensions[3] - _sbs_right_dimensions[2];
341 return max(
int(_size.get_y() * right_h), 1);
366 return _is_valid && _is_nonzero_size;
378 return _is_nonzero_size;
407 _swap_eyes = swap_eyes;
440 unsigned int left_eye_color_mask,
441 unsigned int right_eye_color_mask) {
442 _red_blue_stereo = red_blue_stereo;
443 if (_red_blue_stereo) {
444 _left_eye_color_mask = left_eye_color_mask;
445 _right_eye_color_mask = right_eye_color_mask;
447 _left_eye_color_mask = 0x0f;
448 _right_eye_color_mask = 0x0f;
460 return _red_blue_stereo;
473 return _left_eye_color_mask;
486 return _right_eye_color_mask;
497 return _side_by_side_stereo;
510 return _sbs_left_dimensions;
523 return _sbs_right_dimensions;
533 return _fb_properties;
546 return _red_blue_stereo || _side_by_side_stereo || _fb_properties.is_stereo();
558 _delete_flag =
false;
595 _child_sort = child_sort;
596 _got_child_sort =
true;
608 _got_child_sort =
false;
619 if (_got_child_sort) {
635 _trigger_copy =
true;
757 return _overlay_display_region;
790 return _overlay_display_region->save_screenshot_default(prefix);
805 return _overlay_display_region->save_screenshot(filename, image_comment);
817 return _overlay_display_region->get_screenshot(image);
829 return _overlay_display_region->get_screenshot();
842 if (_sort != other._sort) {
843 return _sort < other._sort;
845 return _internal_sort_index < other._internal_sort_index;
855 INLINE
void GraphicsOutput::
856 determine_display_regions()
const {
859 CDLockedReader cdata(_cycler);
860 if (cdata->_active_display_regions_stale) {
873 INLINE
void GraphicsOutput::
874 win_display_regions_changed() {
875 CDWriter cdata(_cycler,
true);
876 cdata->_active_display_regions_stale =
true;
887 return _cull_window_pcollector;
898 return _draw_window_pcollector;
906 INLINE
void GraphicsOutput::
907 begin_frame_spam(FrameMode mode) {
908 if (display_cat.is_spam()) {
910 <<
"begin_frame(" << mode <<
"): " << get_type() <<
" "
911 <<
get_name() <<
" " << (
void *)
this <<
"\n";
920 INLINE
void GraphicsOutput::
921 end_frame_spam(FrameMode mode) {
922 if (display_cat.is_spam()) {
924 <<
"end_frame(" << mode <<
"): " << get_type() <<
" "
925 <<
get_name() <<
" " << (
void *)
this <<
"\n";
935 INLINE
void GraphicsOutput::
936 clear_cube_map_selection() {
937 _target_tex_page = -1;
938 _prev_page_dr = NULL;
948 INLINE
void GraphicsOutput::
950 if (!_fb_properties.is_single_buffered()) {
void set_child_sort(int child_sort)
Specifies the sort value of future offscreen buffers created by make_texture_sort().
bool save_screenshot(const Filename &filename, const string &image_comment="")
Saves a screenshot of the region to the indicated filename.
static Filename make_screenshot_filename(const string &prefix="screenshot")
Synthesizes a suitable default filename for passing to save_screenshot().
void set_swap_eyes(bool swap_eyes)
Changes the "swap eyes" flag.
StereoDisplayRegion * make_stereo_display_region()
Creates a new DisplayRegion that covers the entire window.
bool has_size() const
Returns true if the size of the window/frame buffer is known, false otherwise.
virtual Texture * get_texture(int i=0) const
Returns the nth texture into which the GraphicsOutput renders.
The name of this class derives from the fact that we originally implemented it as a layer on top of t...
bool is_stereo() const
Returns Returns true if this window can render stereo DisplayRegions, either through red-blue stereo ...
bool has_texture() const
Returns true if the GraphicsOutput is rendering into any textures at all.
PN_stdfloat get_pixel_factor() const
Returns the amount by which the height and width of the region will be scaled internally, based on the zoom factor set by set_pixel_zoom().
bool get_screenshot(PNMImage &image)
Captures the most-recently rendered image from the framebuffer into the indicated PNMImage...
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...
Filename save_screenshot_default(const string &prefix="screenshot")
Saves a screenshot of the region to a default filename, and returns the filename, or empty string if ...
Represents a texture object, which is typically a single 2-d image but may also represent a 1-d or 3-...
This is the base class for all two-component vectors and points.
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...
int get_y_size() const
Returns the visible height of the window or buffer, if it is known.
static Filename make_screenshot_filename(const string &prefix="screenshot")
Saves a screenshot of the region to a default filename, and returns the filename, or empty string if ...
DisplayRegion * get_overlay_display_region() const
Returns the special "overlay" DisplayRegion that is created for each window or buffer.
DisplayRegion * make_display_region()
Creates a new DisplayRegion that covers the entire window.
void trigger_copy()
When the GraphicsOutput is in triggered copy mode, this function triggers the copy (at the end of the...
GraphicsEngine * get_engine() const
Returns the graphics engine that created this output.
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...
bool operator<(const GraphicsOutput &other) const
The sorting operator is used to order the GraphicsOutput object in order by their sort number...
This template class calls PipelineCycler::read_unlocked(), and then provides a transparent read-only ...
GraphicsPipe * get_pipe() const
Returns the GraphicsPipe that this window is associated with.
bool is_valid() const
Returns true if the output is fully created and ready for rendering, false otherwise.
PStatCollector & get_draw_window_pcollector()
Returns a PStatCollector for timing the draw operation for just this GraphicsOutput.
int get_child_sort() const
Returns the sort value of future offscreen buffers created by make_texture_sort().
RenderTexturePlane get_texture_plane(int i=0) const
Returns the RenderTexturePlane associated with the nth render-texture.
A lightweight class that represents a single element that may be timed and/or counted via stats...
DisplayRegion * make_mono_display_region()
Creates a new DisplayRegion that covers the entire window.
bool get_inverted() const
Returns the current setting of the inverted flag.
LVecBase2i get_sbs_left_size() const
If side-by-side stereo is enabled, this returns the pixel size of the left eye, based on scaling get_...
int get_sort() const
Returns the sorting order of this particular GraphicsOutput.
The name of a file, such as a texture file or an Egg file.
An object to create GraphicsOutputs that share a particular 3-D API.
GraphicsStateGuardian * get_gsg() const
Returns the GSG that is associated with this window.
RenderTextureMode get_rtm_mode(int i=0) const
Returns the RenderTextureMode associated with the nth render-texture.
bool get_screenshot(PNMImage &image)
Captures the most-recently rendered image from the framebuffer into the indicated PNMImage...
const LVecBase2i & get_size() const
Returns the visible size of the window or buffer, if it is known.
bool get_side_by_side_stereo() const
Returns whether side-by-side stereo mode is in effect for this particular window. ...
This is a base class for the various different classes that represent the result of a frame of render...
This is a special DisplayRegion wrapper that actually includes a pair of DisplayRegions internally: t...
LVecBase2i get_sbs_right_size() const
If side-by-side stereo is enabled, this returns the pixel size of the right eye, based on scaling get...
This is the base class for all three-component vectors and points.
int count_textures() const
If the GraphicsOutput is set to render into a texture, returns the number of textures that are being ...
int get_x_size() const
Returns the visible width of the window or buffer, if it is known.
bool get_swap_eyes() const
Returns the current setting of the "swap eyes" flag.
bool get_red_blue_stereo() const
Returns whether red-blue stereo mode is in effect for this particular window.
int get_sbs_right_y_size() const
If side-by-side stereo is enabled, this returns the pixel height of the right eye, based on scaling get_y_size() by get_sbs_right_dimensions().
int get_fb_x_size() const
Returns the internal width of the window or buffer.
Encapsulates all the communication with a particular instance of a given rendering backend...
void clear_child_sort()
Resets the sort value of future offscreen buffers created by make_texture_sort() to the default value...
int get_fb_y_size() const
Returns the internal height of the window or buffer.
A rectangular subregion within a window for rendering into.
This class is the main interface to controlling the render process.
PStatCollector & get_cull_window_pcollector()
Returns a PStatCollector for timing the cull operation for just this GraphicsOutput.
const FrameBufferProperties & get_fb_properties() const
Returns the framebuffer properties of the window.
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...
A container for the various kinds of properties we might ask to have on a graphics frameBuffer before...
const string & get_name() const
Returns the name that was passed to the GraphicsOutput constructor.
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 ...
void clear_delete_flag()
Resets the delete flag, so the GraphicsOutput will not be automatically deleted before the beginning ...
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...
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...
LVecBase2i get_fb_size() const
Returns the internal size of the window or buffer.
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...
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.