Panda3D

Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Friends | List of all members
DisplayRegion Class Reference

A rectangular subregion within a window for rendering into. More...

`#include "displayRegion.h"`

Inheritance diagram for DisplayRegion:

## Classes
struct | Region

## Public Types
typedef epvector< Region > | Regions
Public Types inherited from DrawableRegion
enum | RenderTexturePlane { RTP_stencil =0 , RTP_depth_stencil =1 , RTP_color , RTP_aux_rgba_0 , RTP_aux_rgba_1 , RTP_aux_rgba_2 , RTP_aux_rgba_3 , RTP_aux_hrgba_0 , RTP_aux_hrgba_1 , RTP_aux_hrgba_2 , RTP_aux_hrgba_3 , RTP_aux_float_0 , RTP_aux_float_1 , RTP_aux_float_2 , RTP_aux_float_3 , RTP_depth , RTP_COUNT }

## Public Member Functions
void | cleanup ()
| Cleans up some pointers associated with the DisplayRegion to help reduce the chance of memory leaks due to circular reference counts.
void | clear_cull_callback ()
| Removes the callback set by an earlier call to set_cull_callback().
void | clear_cull_result ()
void | clear_draw_callback ()
| Removes the callback set by an earlier call to set_draw_callback().
void | compute_pixels ()
| Computes the pixel locations of the DisplayRegion within its window.
void | compute_pixels (int x_size, int y_size)
| Computes the pixel locations of the DisplayRegion within its window, given the size of the window in pixels.
void | compute_pixels_all_stages ()
| Computes the pixel locations of the DisplayRegion within its window.
void | compute_pixels_all_stages (int x_size, int y_size)
| Performs a compute_pixels() operation for all stages of the pipeline.
virtual TypeHandle | force_init_type ()
PN_stdfloat | get_bottom (int i=0) const
| Retrieves the y coordinate of the bottom edge of the rectangle within its GraphicsOutput.
NodePath | get_camera (Thread *current_thread=Thread::get_current_thread()) const
CallbackObject * | get_cull_callback () const
PStatCollector & | get_cull_region_pcollector ()
| Returns a PStatCollector for timing the cull operation for just this DisplayRegion.
CullResult * | get_cull_result (Thread *current_thread) const
| Returns the CullResult value that was stored on this DisplayRegion, presumably by the last successful cull operation.
CullTraverser * | get_cull_traverser ()
const std::string & | get_debug_name () const
| Returns a unique name used for debugging.
void | get_dimensions (int i, PN_stdfloat &l, PN_stdfloat &r, PN_stdfloat &b, PN_stdfloat &t) const
LVecBase4 | get_dimensions (int i=0) const
void | get_dimensions (PN_stdfloat &l, PN_stdfloat &r, PN_stdfloat &b, PN_stdfloat &t) const
CallbackObject * | get_draw_callback () const
PStatCollector & | get_draw_region_pcollector ()
| Returns a PStatCollector for timing the draw operation for just this DisplayRegion.
bool | get_incomplete_render () const
PN_stdfloat | get_left (int i=0) const
| Retrieves the x coordinate of the left edge of the rectangle within its GraphicsOutput.
int | get_lens_index () const
int | get_num_regions () const
| Returns the number of regions, see set_num_regions.
GraphicsPipe * | get_pipe () const
int | get_pixel_height (int i=0) const
| Returns the height of the DisplayRegion in pixels.
LVecBase2i | get_pixel_size (int i=0) const
int | get_pixel_width (int i=0) const
| Returns the width of the DisplayRegion in pixels.
void | get_pixels (int &pl, int &pr, int &pb, int &pt) const
| Retrieves the coordinates of the DisplayRegion within its window, in pixels.
void | get_pixels (int i, int &pl, int &pr, int &pb, int &pt) const
| Retrieves the coordinates of the DisplayRegion within its window, in pixels.
void | get_region_pixels (int &xo, int &yo, int &w, int &h) const
| Retrieves the coordinates of the DisplayRegion within its window, as the pixel location of its bottom-left corner, along with a pixel width and height.
void | get_region_pixels (int i, int &xo, int &yo, int &w, int &h) const
| Retrieves the coordinates of the DisplayRegion within its window, as the pixel location of its bottom-left corner, along with a pixel width and height.
void | get_region_pixels_i (int &xo, int &yo, int &w, int &h) const
| Similar to get_region_pixels(), but returns the upper left corner, and the pixel numbers are numbered from the top-left corner down, in the DirectX way of things.
void | get_region_pixels_i (int i, int &xo, int &yo, int &w, int &h) const
| Similar to get_region_pixels(), but returns the upper left corner, and the pixel numbers are numbered from the top-left corner down, in the DirectX way of things.
PN_stdfloat | get_right (int i=0) const
| Retrieves the x coordinate of the right edge of the rectangle within its GraphicsOutput.
SceneSetup * | get_scene_setup (Thread *current_thread) const
| Returns the SceneSetup value that was stored on this DisplayRegion, presumably by the last successful cull operation.
bool | get_scissor_enabled () const
PointerTo< Texture > | get_screenshot ()
| Captures the most-recently rendered image from the framebuffer and returns it as a Texture, or NULL on failure.
bool | get_screenshot (PNMImage &image)
| Captures the most-recently rendered image from the framebuffer into the indicated PNMImage.
int | get_sort () const
Lens::StereoChannel | get_stereo_channel () const
int | get_target_tex_page () const
int | get_tex_view_offset () const
int | get_texture_reload_priority () const
PN_stdfloat | get_top (int i=0) const
| Retrieves the y coordinate of the top edge of the rectangle within its GraphicsOutput.
virtual TypeHandle | get_type () const
GraphicsOutput * | get_window () const
bool | is_active () const
virtual bool | is_stereo () const
virtual PointerTo< PandaNode > | make_cull_result_graph ()
| Returns a special scene graph constructed to represent the results of the last frame's cull operation.
bool | operator< (const DisplayRegion &other) const
| Returns true if this DisplayRegion should be sorted before the other one, false otherwise.
virtual void | output (std::ostream &out) const
bool | save_screenshot (const Filename &filename, const std::string &image_comment="")
| Saves a screenshot of the region to the indicated filename.
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 the screenshot failed.
virtual void | set_active (bool active)
virtual void | set_camera (const NodePath &camera)
void | set_cube_map_index (int cube_map_index)
| Deprecated; replaced by set_target_tex_page().
void | set_cull_callback (CallbackObject *object)
void | set_cull_result (PointerTo< CullResult > cull_result, PointerTo< SceneSetup > scene_setup, Thread *current_thread)
| Stores the result of performing a cull operation on this DisplayRegion.
virtual void | set_cull_traverser (CullTraverser *trav)
void | set_dimensions (const LVecBase4 &dimensions)
virtual void | set_dimensions (int i, const LVecBase4 &dimensions)
void | set_dimensions (int i, PN_stdfloat l, PN_stdfloat r, PN_stdfloat b, PN_stdfloat t)
void | set_dimensions (PN_stdfloat l, PN_stdfloat r, PN_stdfloat b, PN_stdfloat t)
void | set_draw_callback (CallbackObject *object)
virtual void | set_incomplete_render (bool incomplete_render)
void | set_lens_index (int index)
void | set_num_regions (int i)
| Sets the number of regions that this DisplayRegion indicates.
void | set_scissor_enabled (bool scissor_enabled)
virtual void | set_sort (int sort)
virtual void | set_stereo_channel (Lens::StereoChannel stereo_channel)
virtual void | set_target_tex_page (int page)
virtual void | set_tex_view_offset (int tex_view_offset)
virtual void | set_texture_reload_priority (int texture_reload_priority)
virtual bool | supports_pixel_zoom () const
| Returns true if a call to set_pixel_zoom() will be respected, false if it will be ignored.
Public Member Functions inherited from TypedReferenceCount
| TypedReferenceCount (const TypedReferenceCount &copy)
void | operator= (const TypedReferenceCount &copy)
Public Member Functions inherited from TypedObject
| TypedObject (const TypedObject &copy)=default
TypedObject * | as_typed_object ()
| Returns the object, upcast (if necessary) to a TypedObject pointer.
const TypedObject * | as_typed_object () const
| Returns the object, upcast (if necessary) to a TypedObject pointer.
int | get_best_parent_from_Set (const std::set< int > &) const
int | get_type_index () const
| Returns the internal index number associated with this object's TypeHandle, a unique number for each different type.
bool | is_exact_type (TypeHandle handle) const
| Returns true if the current object is the indicated type exactly.
bool | is_of_type (TypeHandle handle) const
| Returns true if the current object is or derives from the indicated type.
TypedObject & | operator= (const TypedObject &copy)=default
Public Member Functions inherited from MemoryBase
void | operator delete (void *, void *)
void | operator delete (void *ptr)
void | operator delete[] (void *, void *)
void | operator delete[] (void *ptr)
void * | operator new (size_t size)
void * | operator new (size_t size, void *ptr)
void * | operator new[] (size_t size)
void * | operator new[] (size_t size, void *ptr)
Public Member Functions inherited from ReferenceCount
int | get_ref_count () const
WeakReferenceList * | get_weak_list () const
| Returns the WeakReferenceList associated with this ReferenceCount object.
bool | has_weak_list () const
| Returns true if this particular ReferenceCount object has a WeakReferenceList created, false otherwise.
void | local_object ()
| This function should be called, once, immediately after creating a new instance of some ReferenceCount-derived object on the stack.
void | ref () const
| Explicitly increments the reference count.
bool | ref_if_nonzero () const
| Atomically increases the reference count of this object if it is not zero.
bool | test_ref_count_integrity () const
| Does some easy checks to make sure that the reference count isn't completely bogus.
bool | test_ref_count_nonzero () const
| Does some easy checks to make sure that the reference count isn't zero, or completely bogus.
virtual bool | unref () const
| Explicitly decrements the reference count.
bool | unref_if_one () const
| Atomically decreases the reference count of this object if it is one.
WeakReferenceList * | weak_ref ()
| Adds the indicated PointerToVoid as a weak reference to this object.
void | weak_unref ()
| Removes the indicated PointerToVoid as a weak reference to this object.
Public Member Functions inherited from DrawableRegion
| DrawableRegion (const DrawableRegion &copy)
void | copy_clear_settings (const DrawableRegion &copy)
| Copies only the clear settings from the other drawable region.
virtual void | disable_clears ()
| Disables both the color and depth clear.
virtual bool | get_clear_active (int n) const
| Gets the clear-active flag for any bitplane.
const LColor & | get_clear_color () const
bool | get_clear_color_active () const
| Returns the current setting of the flag that indicates whether the color buffer should be cleared every frame.
PN_stdfloat | get_clear_depth () const
bool | get_clear_depth_active () const
| Returns the current setting of the flag that indicates whether the depth buffer should be cleared every frame.
unsigned int | get_clear_stencil () const
bool | get_clear_stencil_active () const
| Returns the current setting of the flag that indicates whether the color buffer should be cleared every frame.
virtual const LColor & | get_clear_value (int n) const
| Returns the clear value for any bitplane.
int | get_draw_buffer_type () const
| Returns the RenderBuffer into which the GSG should issue draw commands.
PN_stdfloat | get_pixel_factor () const
PN_stdfloat | get_pixel_zoom () const
int | get_screenshot_buffer_type () const
| Returns the RenderBuffer that should be used for capturing screenshots from this particular DrawableRegion.
virtual bool | is_any_clear_active () const
| Returns true if any of the clear types (so far there are just color or depth) have been set active, or false if none of them are active and there is no need to clear.
void | operator= (const DrawableRegion &copy)
virtual void | set_clear_active (int n, bool clear_aux_active)
| Sets the clear-active flag for any bitplane.
void | set_clear_color (const LColor &color)
void | set_clear_color_active (bool clear_color_active)
| Toggles the flag that indicates whether the color buffer should be cleared every frame.
void | set_clear_depth (PN_stdfloat depth)
void | set_clear_depth_active (bool clear_depth_active)
| Toggles the flag that indicates whether the depth buffer should be cleared every frame.
void | set_clear_stencil (unsigned int stencil)
void | set_clear_stencil_active (bool clear_stencil_active)
| Toggles the flag that indicates whether the stencil buffer should be cleared every frame.
virtual void | set_clear_value (int n, const LColor &clear_value)
| Sets the clear value for any bitplane.
virtual void | set_pixel_zoom (PN_stdfloat pixel_zoom)

## Static Public Member Functions
static TypeHandle | get_class_type ()
static void | init_type ()
static Filename | make_screenshot_filename (const std::string &prefix="screenshot")
| Synthesizes a suitable default filename for passing to save_screenshot().
Static Public Member Functions inherited from TypedReferenceCount
static TypeHandle | get_class_type ()
static void | init_type ()
Static Public Member Functions inherited from TypedObject
static TypeHandle | get_class_type ()
static void | init_type ()
| This function is declared non-inline to work around a compiler bug in g++ 2.96.
Static Public Member Functions inherited from ReferenceCount
static TypeHandle | get_class_type ()
static void | init_type ()
Static Public Member Functions inherited from DrawableRegion
static int | get_renderbuffer_type (int plane)
| Returns the RenderBuffer::Type that corresponds to a RenderTexturePlane.

## Public Attributes
| get_camera
| Returns the camera associated with this DisplayRegion, or an empty NodePath if no camera is associated.
| get_cull_callback
| Returns the CallbackObject set by set_cull_callback().
| get_cull_traverser
| Returns the CullTraverser that will be used to draw the contents of this DisplayRegion.
| get_dimensions
| Retrieves the coordinates of the DisplayRegion's rectangle within its GraphicsOutput.
| get_draw_callback
| Returns the CallbackObject set by set_draw_callback().
| get_incomplete_render
| Returns the incomplete_render flag.
| get_lens_index
| Returns the specific lens of the associated Camera that will be used for rendering this scene.
| get_pipe
| Returns the GraphicsPipe that this DisplayRegion is ultimately associated with, or NULL if no pipe is associated.
| get_pixel_size
| Returns the size of the DisplayRegion in pixels.
| get_scissor_enabled
| Returns whether or not scissor testing is enabled for this region.
| get_sort
| Returns the sort value associated with the DisplayRegion.
| get_stereo_channel
| Returns whether the DisplayRegion is specified as the left or right channel of a stereo pair, or whether it is a normal, monocular image.
| get_target_tex_page
| Returns the target page number associated with this particular DisplayRegion, or -1 if it is not associated with a page.
| get_tex_view_offset
| Returns the current texture view offset for this DisplayRegion.
| get_texture_reload_priority
| Returns the priority which is assigned to asynchronous texture reload requests.
| get_window
| Returns the GraphicsOutput that this DisplayRegion is ultimately associated with, or NULL if no window is associated.
| is_active
| Returns the active flag associated with the DisplayRegion.
| is_stereo
| Returns true if this is a StereoDisplayRegion, false otherwise.
| set_active
| Sets the active flag associated with the DisplayRegion.
| set_camera
| Sets the camera that is associated with this DisplayRegion.
| set_cull_callback
| Sets the CallbackObject that will be notified when the DisplayRegion is visited during the cull traversal.
| set_cull_traverser
| Specifies the CullTraverser that will be used to draw the contents of this DisplayRegion.
| set_dimensions
| Changes the portion of the framebuffer this DisplayRegion corresponds to.
| set_draw_callback
| Sets the CallbackObject that will be notified when the contents of DisplayRegion is drawn during the draw traversal.
| set_incomplete_render
| Sets the incomplete_render flag.
| set_lens_index
| Sets the lens index, allows for multiple lenses to be attached to a camera.
| set_scissor_enabled
| Sets whether or not scissor testing is enabled for this region.
| set_sort
| Sets the sort value associated with the DisplayRegion.
| set_stereo_channel
| Specifies whether the DisplayRegion represents the left or right channel of a stereo pair, or whether it is a normal, monocular image.
| set_target_tex_page
| This is a special parameter that is only used when rendering the faces of a cube map or multipage and/or multiview texture.
| set_tex_view_offset
| Sets the current texture view offset for this DisplayRegion.
| set_texture_reload_priority
| Specifies an integer priority which is assigned to any asynchronous texture reload requests spawned while processing this DisplayRegion.
Public Attributes inherited from TypedObject
| get_type
Public Attributes inherited from ReferenceCount
| get_ref_count
| Returns the current reference count.
Public Attributes inherited from DrawableRegion
| get_clear_color
| Returns the current clear color value.
| get_clear_depth
| Returns the current clear depth value.
| get_clear_stencil
| Returns the current clear stencil value.
| get_pixel_factor
| 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().
| get_pixel_zoom
| Returns the value set by set_pixel_zoom(), regardless of whether it is being respected or not.
| set_clear_color
| Sets the clear color to the indicated value.
| set_clear_depth
| Sets the clear depth to the indicated value.
| set_clear_stencil
| Sets the clear stencil to the indicated value.
| set_pixel_zoom
| Sets the amount by which the pixels of the region are scaled internally when filling the image interally.

## Friends
class | DisplayRegionCullCallbackData
class | DisplayRegionPipelineReader
class | GraphicsEngine
class | GraphicsOutput

## Detailed Description

A rectangular subregion within a window for rendering into.

Typically, there is one DisplayRegion that covers the whole window, but you may also create smaller DisplayRegions for having different regions within the window that represent different scenes. You may also stack up DisplayRegions like panes of glass, usually for layering 2-d interfaces on top of a 3-d scene.

Definition at line 57 of file displayRegion.h.

## Member Typedef Documentation

## ◆ Regions

typedef epvector<Region> DisplayRegion::Regions

Definition at line 197 of file displayRegion.h.

## Constructor & Destructor Documentation

## ◆ ~DisplayRegion()

DisplayRegion::~DisplayRegion | ( |  | ) |
| virtual

Definition at line 54 of file displayRegion.cxx.

## Member Function Documentation

## ◆ cleanup()

void DisplayRegion::cleanup | ( |  | ) |

Cleans up some pointers associated with the DisplayRegion to help reduce the chance of memory leaks due to circular reference counts.

Definition at line 68 of file displayRegion.cxx.

Referenced by GraphicsOutput::remove_all_display_regions().

## ◆ clear_cull_callback()

void DisplayRegion::clear_cull_callback | ( |  | ) |
| inline

Removes the callback set by an earlier call to set_cull_callback().

Definition at line 307 of file displayRegion.I.

References set_cull_callback.

## ◆ clear_cull_result()

void DisplayRegion::clear_cull_result | ( |  | ) |

Definition at line 520 of file displayRegion.cxx.

## ◆ clear_draw_callback()

void DisplayRegion::clear_draw_callback | ( |  | ) |
| inline

Removes the callback set by an earlier call to set_draw_callback().

Definition at line 355 of file displayRegion.I.

References set_draw_callback.

## ◆ compute_pixels() [1/2]

void DisplayRegion::compute_pixels | ( |  | ) |

Computes the pixel locations of the DisplayRegion within its window.

The DisplayRegion will request the size from the window.

Definition at line 554 of file displayRegion.cxx.

## ◆ compute_pixels() [2/2]

void DisplayRegion::compute_pixels | ( | int | x_size,
|  | int | y_size )

Computes the pixel locations of the DisplayRegion within its window, given the size of the window in pixels.

Definition at line 587 of file displayRegion.cxx.

## ◆ compute_pixels_all_stages() [1/2]

void DisplayRegion::compute_pixels_all_stages | ( |  | ) |

Computes the pixel locations of the DisplayRegion within its window.

The DisplayRegion will request the size from the window.

Definition at line 569 of file displayRegion.cxx.

## ◆ compute_pixels_all_stages() [2/2]

void DisplayRegion::compute_pixels_all_stages | ( | int | x_size,
|  | int | y_size )

Performs a compute_pixels() operation for all stages of the pipeline.

This is appropriate, for instance, when a window changes sizes, since this is a global operation; and you want the new window size to be immediately available even to the downstream stages.

Definition at line 601 of file displayRegion.cxx.

## ◆ force_init_type()

virtual TypeHandle DisplayRegion::force_init_type | ( |  | ) |
| inline virtual

Reimplemented from TypedReferenceCount.

Definition at line 297 of file displayRegion.h.

## ◆ get_bottom()

PN_stdfloat DisplayRegion::get_bottom | ( | int | i = 0 | ) | const
| inline

Retrieves the y coordinate of the bottom edge of the rectangle within its GraphicsOutput.

This number will be in the range [0..1].

Definition at line 113 of file displayRegion.I.

## ◆ get_class_type()

static TypeHandle DisplayRegion::get_class_type | ( |  | ) |
| inline static

Definition at line 286 of file displayRegion.h.

## ◆ get_cull_region_pcollector()

PStatCollector & DisplayRegion::get_cull_region_pcollector | ( |  | ) |
| inline

Returns a PStatCollector for timing the cull operation for just this DisplayRegion.

Definition at line 512 of file displayRegion.I.

Referenced by GraphicsEngine::do_cull().

## ◆ get_cull_result()

CullResult * DisplayRegion::get_cull_result | ( | Thread * | current_thread | ) | const
| inline

Returns the CullResult value that was stored on this DisplayRegion, presumably by the last successful cull operation.

This method is for the benefit of the GraphicsEngine; normally you shouldn't call this directly.

Definition at line 491 of file displayRegion.I.

Referenced by make_cull_result_graph().

## ◆ get_debug_name()

const std::string & DisplayRegion::get_debug_name | ( |  | ) | const
| inline

Returns a unique name used for debugging.

Definition at line 529 of file displayRegion.I.

## ◆ get_draw_region_pcollector()

PStatCollector & DisplayRegion::get_draw_region_pcollector | ( |  | ) |
| inline

Returns a PStatCollector for timing the draw operation for just this DisplayRegion.

Definition at line 521 of file displayRegion.I.

## ◆ get_left()

PN_stdfloat DisplayRegion::get_left | ( | int | i = 0 | ) | const
| inline

Retrieves the x coordinate of the left edge of the rectangle within its GraphicsOutput.

This number will be in the range [0..1].

Definition at line 93 of file displayRegion.I.

## ◆ get_num_regions()

int DisplayRegion::get_num_regions | ( |  | ) | const
| inline

Returns the number of regions, see set_num_regions.

Definition at line 37 of file displayRegion.I.

## ◆ get_pixel_height()

int DisplayRegion::get_pixel_height | ( | int | i = 0 | ) | const
| inline

Returns the height of the DisplayRegion in pixels.

Definition at line 381 of file displayRegion.I.

## ◆ get_pixel_width()

int DisplayRegion::get_pixel_width | ( | int | i = 0 | ) | const
| inline

Returns the width of the DisplayRegion in pixels.

Definition at line 372 of file displayRegion.I.

## ◆ get_pixels() [1/2]

void DisplayRegion::get_pixels | ( | int & | pl,
|  | int & | pr,
|  | int & | pb,
|  | int & | pt ) const
| inline

Retrieves the coordinates of the DisplayRegion within its window, in pixels.

Definition at line 401 of file displayRegion.I.

References get_pixels().

Referenced by get_pixels().

## ◆ get_pixels() [2/2]

void DisplayRegion::get_pixels | ( | int | i,
|  | int & | pl,
|  | int & | pr,
|  | int & | pb,
|  | int & | pt ) const
| inline

Retrieves the coordinates of the DisplayRegion within its window, in pixels.

Definition at line 410 of file displayRegion.I.

## ◆ get_region_pixels() [1/2]

void DisplayRegion::get_region_pixels | ( | int & | xo,
|  | int & | yo,
|  | int & | w,
|  | int & | h ) const
| inline

Retrieves the coordinates of the DisplayRegion within its window, as the pixel location of its bottom-left corner, along with a pixel width and height.

Definition at line 425 of file displayRegion.I.

References get_region_pixels().

Referenced by get_region_pixels().

## ◆ get_region_pixels() [2/2]

void DisplayRegion::get_region_pixels | ( | int | i,
|  | int & | xo,
|  | int & | yo,
|  | int & | w,
|  | int & | h ) const
| inline

Retrieves the coordinates of the DisplayRegion within its window, as the pixel location of its bottom-left corner, along with a pixel width and height.

Definition at line 435 of file displayRegion.I.

## ◆ get_region_pixels_i() [1/2]

void DisplayRegion::get_region_pixels_i | ( | int & | xo,
|  | int & | yo,
|  | int & | w,
|  | int & | h ) const
| inline

Similar to get_region_pixels(), but returns the upper left corner, and the pixel numbers are numbered from the top-left corner down, in the DirectX way of things.

Definition at line 450 of file displayRegion.I.

References get_region_pixels_i().

Referenced by DXGraphicsStateGuardian9::do_framebuffer_copy_to_ram(), DXGraphicsStateGuardian9::framebuffer_copy_to_texture(), and get_region_pixels_i().

## ◆ get_region_pixels_i() [2/2]

void DisplayRegion::get_region_pixels_i | ( | int | i,
|  | int & | xo,
|  | int & | yo,
|  | int & | w,
|  | int & | h ) const
| inline

Similar to get_region_pixels(), but returns the upper left corner, and the pixel numbers are numbered from the top-left corner down, in the DirectX way of things.

Definition at line 460 of file displayRegion.I.

## ◆ get_right()

PN_stdfloat DisplayRegion::get_right | ( | int | i = 0 | ) | const
| inline

Retrieves the x coordinate of the right edge of the rectangle within its GraphicsOutput.

This number will be in the range [0..1].

Definition at line 103 of file displayRegion.I.

## ◆ get_scene_setup()

SceneSetup * DisplayRegion::get_scene_setup | ( | Thread * | current_thread | ) | const
| inline

Returns the SceneSetup value that was stored on this DisplayRegion, presumably by the last successful cull operation.

This method is for the benefit of the GraphicsEngine; normally you shouldn't call this directly.

Definition at line 502 of file displayRegion.I.

## ◆ get_screenshot() [1/2]

PointerTo< Texture > DisplayRegion::get_screenshot | ( |  | ) |

Captures the most-recently rendered image from the framebuffer and returns it as a Texture, or NULL on failure.

Definition at line 476 of file displayRegion.cxx.

References GraphicsOutput::begin_frame(), GraphicsEngine::do_get_screenshot(), GraphicsOutput::end_frame(), GraphicsStateGuardian::framebuffer_copy_to_ram(), Thread::get_current_thread, GraphicsThreadingModel::get_draw_stage(), GraphicsOutput::get_engine, GraphicsOutput::get_gsg, Thread::get_pipeline_stage, GraphicsStateGuardian::get_render_buffer(), DrawableRegion::get_screenshot_buffer_type(), GraphicsStateGuardian::get_threading_model(), get_window, and GraphicsStateGuardian::prepare_display_region().

Referenced by get_screenshot(), and save_screenshot().

## ◆ get_screenshot() [2/2]

bool DisplayRegion::get_screenshot | ( | PNMImage & | image | ) |

Captures the most-recently rendered image from the framebuffer into the indicated PNMImage.

Returns true on success, false on failure.

Definition at line 457 of file displayRegion.cxx.

References get_screenshot().

## ◆ get_top()

PN_stdfloat DisplayRegion::get_top | ( | int | i = 0 | ) | const
| inline

Retrieves the y coordinate of the top edge of the rectangle within its GraphicsOutput.

This number will be in the range [0..1].

Definition at line 123 of file displayRegion.I.

## ◆ get_type()

virtual TypeHandle DisplayRegion::get_type | ( |  | ) | const
| inline virtual

Reimplemented from TypedReferenceCount.

Definition at line 294 of file displayRegion.h.

## ◆ init_type()

static void DisplayRegion::init_type | ( |  | ) |
| inline static

Definition at line 289 of file displayRegion.h.

## ◆ is_stereo()

virtual bool DisplayRegion::is_stereo | ( |  | ) | const
| virtual

Reimplemented in StereoDisplayRegion.

## ◆ make_cull_result_graph()

PointerTo< PandaNode > DisplayRegion::make_cull_result_graph | ( |  | ) |
| virtual

Returns a special scene graph constructed to represent the results of the last frame's cull operation.

This will be a hierarchy of nodes, one node for each bin, each of which will in term be a parent of a number of GeomNodes, representing the geometry drawn in each bin.

This is useful mainly for high-level debugging and abstraction tools; it should not be mistaken for the low-level cull result itself, which is constructed and maintained internally. No such scene graph is normally constructed during the rendering of a frame; this is an artificial construct created for the purpose of making it easy to analyze the results of the cull operation.

Reimplemented in StereoDisplayRegion.

Definition at line 541 of file displayRegion.cxx.

References get_cull_result(), Thread::get_current_thread, and CullResult::make_result_graph().

## ◆ make_screenshot_filename()

Filename DisplayRegion::make_screenshot_filename | ( | const std::string & | prefix = "screenshot" | ) |
| static

Synthesizes a suitable default filename for passing to save_screenshot().

The default filename is generated from the supplied prefix and from the Config variable screenshot-filename, which contains the following strings:

%~p - the supplied prefix %~f - the frame count %~e - the value of screenshot-extension All other % strings in strftime().

Definition at line 359 of file displayRegion.cxx.

References ClockObject::get_frame_count, and ClockObject::get_global_clock().

Referenced by GraphicsOutput::make_screenshot_filename(), and save_screenshot_default().

## ◆ operator<()

bool DisplayRegion::operator< | ( | const DisplayRegion & | other | ) | const
| inline

Returns true if this DisplayRegion should be sorted before the other one, false otherwise.

Definition at line 18 of file displayRegion.I.

References get_sort.

## ◆ output()

void DisplayRegion::output | ( | std::ostream & | out | ) | const
| virtual

Definition at line 343 of file displayRegion.cxx.

## ◆ save_screenshot()

bool DisplayRegion::save_screenshot | ( | const Filename & | filename,
|  | const std::string & | image_comment = "" )

Saves a screenshot of the region to the indicated filename.

Returns true on success, false on failure.

Definition at line 439 of file displayRegion.cxx.

References get_screenshot(), PNMImageHeader::set_comment, and PNMImage::write().

Referenced by save_screenshot_default().

## ◆ save_screenshot_default()

Filename DisplayRegion::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 the screenshot failed.

The filename is generated by make_screenshot_filename().

Definition at line 426 of file displayRegion.cxx.

References make_screenshot_filename(), and save_screenshot().

## ◆ set_active()

virtual void DisplayRegion::set_active | ( | bool | active | ) |
| virtual

Reimplemented in StereoDisplayRegion.

## ◆ set_camera()

virtual void DisplayRegion::set_camera | ( | const NodePath & | camera | ) |
| virtual

Reimplemented in StereoDisplayRegion.

## ◆ set_cube_map_index()

void DisplayRegion::set_cube_map_index | ( | int | cube_map_index | ) |
| inline

Deprecated; replaced by set_target_tex_page().

Definition at line 241 of file displayRegion.I.

References set_target_tex_page.

## ◆ set_cull_result()

void DisplayRegion::set_cull_result | ( | PointerTo< CullResult > | cull_result,
|  | PointerTo< SceneSetup > | scene_setup,
|  | Thread * | current_thread )
| inline

Stores the result of performing a cull operation on this DisplayRegion.

Normally, this will only be called by the GraphicsEngine; you should not call this directly.

The stored result will automatically be applied back to all upstream pipeline stages.

Definition at line 478 of file displayRegion.I.

## ◆ set_cull_traverser()

virtual void DisplayRegion::set_cull_traverser | ( | CullTraverser * | trav | ) |
| virtual

Reimplemented in StereoDisplayRegion.

## ◆ set_dimensions()

virtual void DisplayRegion::set_dimensions | ( | int | i,
|  | const LVecBase4 & | dimensions )
| virtual

Reimplemented in StereoDisplayRegion.

## ◆ set_incomplete_render()

virtual void DisplayRegion::set_incomplete_render | ( | bool | incomplete_render | ) |
| virtual

Reimplemented in StereoDisplayRegion.

## ◆ set_num_regions()

void DisplayRegion::set_num_regions | ( | int | i | ) |
| inline

Sets the number of regions that this DisplayRegion indicates.

Usually, this number is 1 (and it is always at least 1), and only the first is used for rendering. However, if more than one is provided, you may select which one to render into using a geometry shader (gl_ViewportIndex in GLSL).

Definition at line 49 of file displayRegion.I.

## ◆ set_sort()

virtual void DisplayRegion::set_sort | ( | int | sort | ) |
| virtual

Reimplemented in StereoDisplayRegion.

## ◆ set_stereo_channel()

virtual void DisplayRegion::set_stereo_channel | ( | Lens::StereoChannel | stereo_channel | ) |
| virtual

Reimplemented in StereoDisplayRegion.

## ◆ set_target_tex_page()

virtual void DisplayRegion::set_target_tex_page | ( | int | page | ) |
| virtual

Reimplemented in StereoDisplayRegion.

## ◆ set_tex_view_offset()

virtual void DisplayRegion::set_tex_view_offset | ( | int | tex_view_offset | ) |
| virtual

Reimplemented in StereoDisplayRegion.

## ◆ set_texture_reload_priority()

virtual void DisplayRegion::set_texture_reload_priority | ( | int | texture_reload_priority | ) |
| virtual

Reimplemented in StereoDisplayRegion.

## ◆ supports_pixel_zoom()

bool DisplayRegion::supports_pixel_zoom | ( |  | ) | const
| virtual

Returns true if a call to set_pixel_zoom() will be respected, false if it will be ignored.

If this returns false, then get_pixel_factor() will always return 1.0, regardless of what value you specify for set_pixel_zoom().

This may return false if the underlying renderer doesn't support pixel zooming, or if you have called this on a DisplayRegion that doesn't have both set_clear_color() and set_clear_depth() enabled.

Reimplemented from DrawableRegion.

Definition at line 622 of file displayRegion.cxx.

References DrawableRegion::get_clear_color_active(), and DrawableRegion::get_clear_depth_active().

## Friends And Related Symbol Documentation

## ◆ DisplayRegionCullCallbackData

friend class DisplayRegionCullCallbackData
| friend

Definition at line 304 of file displayRegion.h.

## ◆ DisplayRegionPipelineReader

friend class DisplayRegionPipelineReader
| friend

Definition at line 305 of file displayRegion.h.

## ◆ GraphicsEngine

friend class GraphicsEngine
| friend

Definition at line 302 of file displayRegion.h.

## ◆ GraphicsOutput

friend class GraphicsOutput
| friend

Definition at line 303 of file displayRegion.h.

## Member Data Documentation

## ◆ get_camera

NodePath DisplayRegion::get_camera
| inline

Returns the camera associated with this DisplayRegion, or an empty NodePath if no camera is associated.

Definition at line 94 of file displayRegion.h.

Referenced by NonlinearImager::add_viewer().

## ◆ get_cull_callback

CallbackObject * DisplayRegion::get_cull_callback
| inline

Returns the CallbackObject set by set_cull_callback().

Definition at line 141 of file displayRegion.h.

## ◆ get_cull_traverser

CullTraverser * DisplayRegion::get_cull_traverser

Returns the CullTraverser that will be used to draw the contents of this DisplayRegion.

Definition at line 127 of file displayRegion.h.

Referenced by GraphicsEngine::do_cull().

## ◆ get_dimensions

LVecBase4 DisplayRegion::get_dimensions
| inline

Retrieves the coordinates of the DisplayRegion's rectangle within its GraphicsOutput.

These numbers will be in the range [0..1].

Definition at line 83 of file displayRegion.h.

Referenced by WindowFramework::split_window().

## ◆ get_draw_callback

CallbackObject * DisplayRegion::get_draw_callback
| inline

Returns the CallbackObject set by set_draw_callback().

Definition at line 146 of file displayRegion.h.

## ◆ get_incomplete_render

bool DisplayRegion::get_incomplete_render
| inline

Returns the incomplete_render flag.

See set_incomplete_render().

Definition at line 114 of file displayRegion.h.

Referenced by GraphicsEngine::do_cull().

## ◆ get_lens_index

int DisplayRegion::get_lens_index
| inline

Returns the specific lens of the associated Camera that will be used for rendering this scene.

Most Cameras hold only one lens, but for multiple lenses this method may be used to selected between them.

Definition at line 123 of file displayRegion.h.

## ◆ get_pipe

GraphicsPipe * DisplayRegion::get_pipe

Returns the GraphicsPipe that this DisplayRegion is ultimately associated with, or NULL if no pipe is associated.

Definition at line 89 of file displayRegion.h.

## ◆ get_pixel_size

LVecBase2i DisplayRegion::get_pixel_size
| inline

Returns the size of the DisplayRegion in pixels.

Definition at line 151 of file displayRegion.h.

## ◆ get_scissor_enabled

bool DisplayRegion::get_scissor_enabled
| inline

Returns whether or not scissor testing is enabled for this region.

The default is true, except for the overlay display region.

Definition at line 136 of file displayRegion.h.

## ◆ get_sort

int DisplayRegion::get_sort
| inline

Returns the sort value associated with the DisplayRegion.

Definition at line 102 of file displayRegion.h.

Referenced by operator<().

## ◆ get_stereo_channel

Lens::StereoChannel DisplayRegion::get_stereo_channel
| inline

Returns whether the DisplayRegion is specified as the left or right channel of a stereo pair, or whether it is a normal, monocular image.

See set_stereo_channel().

Definition at line 106 of file displayRegion.h.

Referenced by StereoDisplayRegion::set_active().

## ◆ get_target_tex_page

int DisplayRegion::get_target_tex_page
| inline

Returns the target page number associated with this particular DisplayRegion, or -1 if it is not associated with a page.

See set_target_tex_page().

Definition at line 132 of file displayRegion.h.

## ◆ get_tex_view_offset

int DisplayRegion::get_tex_view_offset
| inline

Returns the current texture view offset for this DisplayRegion.

This is normally set to zero. If nonzero, it is used to select a particular view of any multiview textures that are rendered within this DisplayRegion.

For a StereoDisplayRegion, this is normally 0 for the left eye, and 1 for the right eye, to support stereo textures.

Definition at line 110 of file displayRegion.h.

## ◆ get_texture_reload_priority

int DisplayRegion::get_texture_reload_priority
| inline

Returns the priority which is assigned to asynchronous texture reload requests.

See set_texture_reload_priority().

Definition at line 119 of file displayRegion.h.

## ◆ get_window

GraphicsOutput * DisplayRegion::get_window
| inline

Returns the GraphicsOutput that this DisplayRegion is ultimately associated with, or NULL if no window is associated.

Definition at line 88 of file displayRegion.h.

Referenced by NonlinearImager::add_viewer(), get_screenshot(), GraphicsOutput::set_overlay_display_region(), WindowFramework::split_window(), DisplayRegionCullCallbackData::upcall(), and DisplayRegionDrawCallbackData::upcall().

## ◆ is_active

bool DisplayRegion::is_active
| inline

Returns the active flag associated with the DisplayRegion.

Definition at line 98 of file displayRegion.h.

Referenced by StereoDisplayRegion::set_stereo_channel().

## ◆ is_stereo

bool DisplayRegion::is_stereo

Returns true if this is a StereoDisplayRegion, false otherwise.

Definition at line 90 of file displayRegion.h.

Referenced by GraphicsOutput::remove_display_region(), and DisplayRegionDrawCallbackData::upcall().

## ◆ set_active

void DisplayRegion::set_active

Sets the active flag associated with the DisplayRegion.

If the DisplayRegion is marked inactive, nothing is rendered.

Don't call this in a downstream thread unless you don't mind it blowing away other changes you might have recently made in an upstream thread.

Definition at line 98 of file displayRegion.h.

Referenced by StereoDisplayRegion::set_active().

## ◆ set_camera

void DisplayRegion::set_camera

Sets the camera that is associated with this DisplayRegion.

There is a one-to-many association between cameras and DisplayRegions; one camera may be shared by multiple DisplayRegions.

The camera is actually set via a NodePath, which clarifies which instance of the camera (if there happen to be multiple instances) we should use.

Don't call this in a downstream thread unless you don't mind it blowing away other changes you might have recently made in an upstream thread.

Definition at line 94 of file displayRegion.h.

Referenced by MultitexReducer::flatten(), GraphicsStateGuardian::get_shadow_map(), GraphicsOutput::make_cube_map(), and StereoDisplayRegion::set_camera().

## ◆ set_cull_callback

void DisplayRegion::set_cull_callback
| inline

Sets the CallbackObject that will be notified when the DisplayRegion is visited during the cull traversal.

This callback will be made during the cull thread.

The cull traversal is responsible for determining which nodes are visible and within the view frustum, and for accumulating state and transform, and generally building up the list of CullableObjects that are to be eventually passed to the draw traversal for rendering.

At the time the cull traversal callback is made, the traversal for this DisplayRegion has not yet started.

The callback is passed an instance of a DisplayRegionCullCallbackData, which contains pointers to the current scene information, as well as the current DisplayRegion and GSG. The callback *replaces* the normal cull behavior, so if your callback does nothing, the scene graph will not be traversed and therefore nothing will be drawn. If you wish the normal cull traversal to be performed for this DisplayRegion, you must call cbdata->upcall() from your callback.

Definition at line 141 of file displayRegion.h.

Referenced by clear_cull_callback().

## ◆ set_cull_traverser

void DisplayRegion::set_cull_traverser

Specifies the CullTraverser that will be used to draw the contents of this DisplayRegion.

Normally the default CullTraverser is sufficient, but this may be changed to change the default cull behavior.

Definition at line 127 of file displayRegion.h.

Referenced by StereoDisplayRegion::set_cull_traverser().

## ◆ set_dimensions

void DisplayRegion::set_dimensions
| inline

Changes the portion of the framebuffer this DisplayRegion corresponds to.

The parameters range from 0 to 1, where 0,0 is the lower left corner and 1,1 is the upper right; (0, 1, 0, 1) represents the whole screen.

Don't call this in a downstream thread unless you don't mind it blowing away other changes you might have recently made in an upstream thread.

The parameters range from 0 to 1, where 0,0 is the lower left corner and 1,1 is the upper right; (0, 1, 0, 1) represents the whole screen.

Definition at line 83 of file displayRegion.h.

Referenced by StereoDisplayRegion::set_dimensions(), and WindowFramework::split_window().

## ◆ set_draw_callback

void DisplayRegion::set_draw_callback
| inline

Sets the CallbackObject that will be notified when the contents of DisplayRegion is drawn during the draw traversal.

This callback will be made during the draw thread.

The draw traversal is responsible for actually issuing the commands to the graphics engine to draw primitives. Its job is to walk through the list of CullableObjects build up by the cull traversal, as quickly as possible, issuing the appropriate commands to draw each one.

At the time the draw traversal callback is made, the graphics state is in the initial state, and no projection matrix or modelview matrix is in effect. begin_scene() has not yet been called, and no objects have yet been drawn. However, the viewport has already been set to the appropriate part of the window, and the clear commands for this DisplayRegion (if any) have been issued.

The callback is passed an instance of a DisplayRegionDrawCallbackData, which contains pointers to the current scene information, as well as the current DisplayRegion and GSG. The callback *replaces* the normal draw behavior, so if your callback does nothing, nothing in the DisplayRegion will be drawn. If you wish the draw traversal to continue to draw the contents of this DisplayRegion, you must call cbdata->upcall() from your callback.

Definition at line 146 of file displayRegion.h.

Referenced by clear_draw_callback().

## ◆ set_incomplete_render

void DisplayRegion::set_incomplete_render

Sets the incomplete_render flag.

When this is true, the frame will be rendered even if some of the geometry or textures in the scene are not available (e.g. they have been temporarily paged out). When this is false, the frame will be held up while this data is reloaded.

This flag may also be set on the GraphicsStateGuardian. It will be considered true for a given DisplayRegion only if it is true on both the GSG and on the DisplayRegion.

See GraphicsStateGuardian::set_incomplete_render() for more detail.

Definition at line 114 of file displayRegion.h.

Referenced by StereoDisplayRegion::set_incomplete_render().

## ◆ set_lens_index

void DisplayRegion::set_lens_index

Sets the lens index, allows for multiple lenses to be attached to a camera.

This is useful for a variety of setups, such as fish eye rendering. The default is 0.

Don't call this in a downstream thread unless you don't mind it blowing away other changes you might have recently made in an upstream thread.

Definition at line 123 of file displayRegion.h.

Referenced by GraphicsStateGuardian::get_shadow_map().

## ◆ set_scissor_enabled

void DisplayRegion::set_scissor_enabled
| inline

Sets whether or not scissor testing is enabled for this region.

The default is true, except for the overlay display region.

Definition at line 136 of file displayRegion.h.

## ◆ set_sort

void DisplayRegion::set_sort

Sets the sort value associated with the DisplayRegion.

Within a window, DisplayRegions will be rendered in order from the lowest sort value to the highest.

Don't call this in a downstream thread unless you don't mind it blowing away other changes you might have recently made in an upstream thread.

Definition at line 102 of file displayRegion.h.

Referenced by StereoDisplayRegion::set_sort().

## ◆ set_stereo_channel

void DisplayRegion::set_stereo_channel

Specifies whether the DisplayRegion represents the left or right channel of a stereo pair, or whether it is a normal, monocular image.

This automatically adjusts the lens that is used to render to this DisplayRegion to its left or right eye, according to the lens's stereo properties.

When the DisplayRegion is attached to a stereo window (one for which is_stereo() returns true), this also specifies which physical channel the DisplayRegion renders to.

Normally you would create at least two DisplayRegions for a stereo window, one for each of the left and right channels. The two DisplayRegions may share the same camera (and thus the same lens); this parameter is used to control the exact properties of the lens when it is used to render into this DisplayRegion.

Also see the StereoDisplayRegion, which automates managing a pair of left/right DisplayRegions.

An ordinary DisplayRegion may be set to SC_mono, SC_left, or SC_right. You may set SC_stereo only on a StereoDisplayRegion.

This call also resets tex_view_offset to its default value, which is 0 for the left eye or 1 for the right eye of a stereo display region, or 0 for a mono display region.

Definition at line 106 of file displayRegion.h.

Referenced by StereoDisplayRegion::set_active(), and StereoDisplayRegion::set_stereo_channel().

## ◆ set_target_tex_page

void DisplayRegion::set_target_tex_page

This is a special parameter that is only used when rendering the faces of a cube map or multipage and/or multiview texture.

This sets up the DisplayRegion to render to the ith page and jth view of its associated texture(s); the value must be consistent with the range of values availble to the texture. A normal DisplayRegion that is not associated with any particular page should be set to page -1 and view 0.

This is particularly useful when rendering cube maps and/or stereo textures.

Don't call this in a downstream thread unless you don't mind it blowing away other changes you might have recently made in an upstream thread.

Definition at line 132 of file displayRegion.h.

Referenced by GraphicsOutput::make_cube_map(), set_cube_map_index(), and StereoDisplayRegion::set_target_tex_page().

## ◆ set_tex_view_offset

void DisplayRegion::set_tex_view_offset

Sets the current texture view offset for this DisplayRegion.

This is normally set to zero. If nonzero, it is used to select a particular view of any multiview textures that are rendered within this DisplayRegion.

For a StereoDisplayRegion, this is normally 0 for the left eye, and 1 for the right eye, to support stereo textures. This is set automatically when you call set_stereo_channel().

Definition at line 110 of file displayRegion.h.

Referenced by StereoDisplayRegion::set_tex_view_offset().

## ◆ set_texture_reload_priority

void DisplayRegion::set_texture_reload_priority

Specifies an integer priority which is assigned to any asynchronous texture reload requests spawned while processing this DisplayRegion.

This controls which textures are loaded first when multiple textures need to be reloaded at once; it also controls the relative priority between asynchronous texture loads and asynchronous model or animation loads.

Specifying a larger number here makes the textures rendered by this DisplayRegion load up first. This may be particularly useful to do, for instance, for the DisplayRegion that renders the gui.

Definition at line 119 of file displayRegion.h.

Referenced by StereoDisplayRegion::set_texture_reload_priority().

The documentation for this class was generated from the following files:

- panda/src/display/displayRegion.h
- panda/src/display/displayRegion.cxx
- panda/src/display/displayRegion.I