Panda3D
|
A rectangular subregion within a window for rendering into. More...
#include "displayRegion.h"
Classes | |
struct | Region |
Public Types | |
typedef epvector< Region > | Regions |
![]() | |
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. More... | |
void | clear_cull_callback () |
Removes the callback set by an earlier call to set_cull_callback(). More... | |
void | clear_draw_callback () |
Removes the callback set by an earlier call to set_draw_callback(). More... | |
void | compute_pixels () |
Computes the pixel locations of the DisplayRegion within its window. More... | |
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. More... | |
void | compute_pixels_all_stages () |
Computes the pixel locations of the DisplayRegion within its window. More... | |
void | compute_pixels_all_stages (int x_size, int y_size) |
Performs a compute_pixels() operation for all stages of the pipeline. More... | |
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. More... | |
NodePath | get_camera (Thread *current_thread=Thread::get_current_thread()) const |
Returns the camera associated with this DisplayRegion, or an empty NodePath if no camera is associated. More... | |
CallbackObject * | get_cull_callback () const |
Returns the CallbackObject set by set_cull_callback(). More... | |
PStatCollector & | get_cull_region_pcollector () |
Returns a PStatCollector for timing the cull operation for just this DisplayRegion. More... | |
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. More... | |
CullTraverser * | get_cull_traverser () |
Returns the CullTraverser that will be used to draw the contents of this DisplayRegion. More... | |
void | get_dimensions (PN_stdfloat &l, PN_stdfloat &r, PN_stdfloat &b, PN_stdfloat &t) const |
Retrieves the coordinates of the DisplayRegion's rectangle within its GraphicsOutput. More... | |
void | get_dimensions (int i, PN_stdfloat &l, PN_stdfloat &r, PN_stdfloat &b, PN_stdfloat &t) const |
Retrieves the coordinates of the DisplayRegion's rectangle within its GraphicsOutput. More... | |
LVecBase4 | get_dimensions (int i=0) const |
Retrieves the coordinates of the DisplayRegion's rectangle within its GraphicsOutput. More... | |
CallbackObject * | get_draw_callback () const |
Returns the CallbackObject set by set_draw_callback(). More... | |
PStatCollector & | get_draw_region_pcollector () |
Returns a PStatCollector for timing the draw operation for just this DisplayRegion. More... | |
bool | get_incomplete_render () const |
Returns the incomplete_render flag. More... | |
PN_stdfloat | get_left (int i=0) const |
Retrieves the x coordinate of the left edge of the rectangle within its GraphicsOutput. More... | |
int | get_lens_index () const |
Returns the specific lens of the associated Camera that will be used for rendering this scene. More... | |
int | get_num_regions () const |
Returns the number of regions, see set_num_regions. More... | |
GraphicsPipe * | get_pipe () const |
Returns the GraphicsPipe that this DisplayRegion is ultimately associated with, or NULL if no pipe is associated. More... | |
int | get_pixel_height (int i=0) const |
Returns the height of the DisplayRegion in pixels. More... | |
int | get_pixel_width (int i=0) const |
Returns the width of the DisplayRegion in pixels. More... | |
void | get_pixels (int &pl, int &pr, int &pb, int &pt) const |
Retrieves the coordinates of the DisplayRegion within its window, in pixels. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
PN_stdfloat | get_right (int i=0) const |
Retrieves the x coordinate of the right edge of the rectangle within its GraphicsOutput. More... | |
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. More... | |
bool | get_scissor_enabled () const |
Returns whether or not scissor testing is enabled for this region. More... | |
bool | get_screenshot (PNMImage &image) |
Captures the most-recently rendered image from the framebuffer into the indicated PNMImage. More... | |
int | get_sort () const |
Returns the sort value associated with the DisplayRegion. More... | |
Lens::StereoChannel | get_stereo_channel () const |
Returns whether the DisplayRegion is specified as the left or right channel of a stereo pair, or whether it is a normal, monocular image. More... | |
int | get_target_tex_page () const |
Returns the target page number associated with this particular DisplayRegion, or -1 if it is not associated with a page. More... | |
int | get_tex_view_offset () const |
Returns the current texture view offset for this DisplayRegion. More... | |
int | get_texture_reload_priority () const |
Returns the priority which is assigned to asynchronous texture reload requests. More... | |
PN_stdfloat | get_top (int i=0) const |
Retrieves the y coordinate of the top edge of the rectangle within its GraphicsOutput. More... | |
virtual TypeHandle | get_type () const |
GraphicsOutput * | get_window () const |
Returns the GraphicsOutput that this DisplayRegion is ultimately associated with, or NULL if no window is associated. More... | |
bool | is_active () const |
Returns the active flag associated with the DisplayRegion. More... | |
virtual bool | is_stereo () const |
Returns true if this is a StereoDisplayRegion, false otherwise. More... | |
bool | operator< (const DisplayRegion &other) const |
Returns true if this DisplayRegion should be sorted before the other one, false otherwise. More... | |
virtual void | output (ostream &out) const |
PT (Texture) get_screenshot() | |
virtual | PT (PandaNode) make_cull_result_graph() |
bool | save_screenshot (const Filename &filename, const string &image_comment="") |
Saves a screenshot of the region to the indicated filename. More... | |
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 the screenshot failed. More... | |
virtual void | set_active (bool active) |
Sets the active flag associated with the DisplayRegion. More... | |
virtual void | set_camera (const NodePath &camera) |
Sets the camera that is associated with this DisplayRegion. More... | |
void | set_cube_map_index (int cube_map_index) |
Deprecated; replaced by set_target_tex_page(). More... | |
void | set_cull_callback (CallbackObject *object) |
Sets the CallbackObject that will be notified when the DisplayRegion is visited during the cull traversal. More... | |
void | set_cull_result (CullResult *cull_result, SceneSetup *scene_setup, Thread *current_thread) |
Stores the result of performing a cull operation on this DisplayRegion. More... | |
virtual void | set_cull_traverser (CullTraverser *trav) |
Specifies the CullTraverser that will be used to draw the contents of this DisplayRegion. More... | |
void | set_dimensions (PN_stdfloat l, PN_stdfloat r, PN_stdfloat b, PN_stdfloat t) |
Changes the portion of the framebuffer this DisplayRegion corresponds to. More... | |
void | set_dimensions (int i, PN_stdfloat l, PN_stdfloat r, PN_stdfloat b, PN_stdfloat t) |
Changes the portion of the framebuffer this DisplayRegion corresponds to. More... | |
void | set_dimensions (const LVecBase4 &dimensions) |
Changes the portion of the framebuffer this DisplayRegion corresponds to. More... | |
virtual void | set_dimensions (int i, const LVecBase4 &dimensions) |
Changes the portion of the framebuffer this DisplayRegion corresponds to. More... | |
void | set_draw_callback (CallbackObject *object) |
Sets the CallbackObject that will be notified when the contents of DisplayRegion is drawn during the draw traversal. More... | |
virtual void | set_incomplete_render (bool incomplete_render) |
Sets the incomplete_render flag. More... | |
void | set_lens_index (int index) |
Sets the lens index, allows for multiple lenses to be attached to a camera. More... | |
void | set_num_regions (int i) |
Sets the number of regions that this DisplayRegion indicates. More... | |
void | set_scissor_enabled (bool scissor_enabled) |
Sets whether or not scissor testing is enabled for this region. More... | |
virtual void | set_sort (int sort) |
Sets the sort value associated with the DisplayRegion. More... | |
virtual void | set_stereo_channel (Lens::StereoChannel stereo_channel) |
Specifies whether the DisplayRegion represents the left or right channel of a stereo pair, or whether it is a normal, monocular image. More... | |
virtual void | set_target_tex_page (int page) |
This is a special parameter that is only used when rendering the faces of a cube map or multipage and/or multiview texture. More... | |
virtual void | set_tex_view_offset (int tex_view_offset) |
Sets the current texture view offset for this DisplayRegion. More... | |
virtual void | set_texture_reload_priority (int texture_reload_priority) |
Specifies an integer priority which is assigned to any asynchronous texture reload requests spawned while processing this DisplayRegion. More... | |
virtual bool | supports_pixel_zoom () const |
Returns true if a call to set_pixel_zoom() will be respected, false if it will be ignored. More... | |
![]() | |
TypedReferenceCount (const TypedReferenceCount ©) | |
void | operator= (const TypedReferenceCount ©) |
![]() | |
TypedObject (const TypedObject ©) | |
TypedObject * | as_typed_object () |
Returns the object, upcast (if necessary) to a TypedObject pointer. More... | |
const TypedObject * | as_typed_object () const |
Returns the object, upcast (if necessary) to a TypedObject pointer. More... | |
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. More... | |
bool | is_exact_type (TypeHandle handle) const |
Returns true if the current object is the indicated type exactly. More... | |
bool | is_of_type (TypeHandle handle) const |
Returns true if the current object is or derives from the indicated type. More... | |
void | operator= (const TypedObject ©) |
![]() | |
int | get_ref_count () const |
Returns the current reference count. More... | |
WeakReferenceList * | get_weak_list () const |
Returns the WeakReferenceList associated with this ReferenceCount object. More... | |
bool | has_weak_list () const |
Returns true if this particular ReferenceCount object has a WeakReferenceList created, false otherwise. More... | |
void | local_object () |
This function should be called, once, immediately after creating a new instance of some ReferenceCount-derived object on the stack. More... | |
void | ref () const |
Explicitly increments the reference count. More... | |
bool | test_ref_count_integrity () const |
Does some easy checks to make sure that the reference count isn't completely bogus. More... | |
bool | test_ref_count_nonzero () const |
Does some easy checks to make sure that the reference count isn't zero, or completely bogus. More... | |
virtual bool | unref () const |
Explicitly decrements the reference count. More... | |
void | weak_ref (WeakPointerToVoid *ptv) |
Adds the indicated PointerToVoid as a weak reference to this object. More... | |
void | weak_unref (WeakPointerToVoid *ptv) |
Removes the indicated PointerToVoid as a weak reference to this object. More... | |
![]() | |
DrawableRegion (const DrawableRegion ©) | |
void | copy_clear_settings (const DrawableRegion ©) |
Copies only the clear settings from the other drawable region. More... | |
virtual void | disable_clears () |
Disables both the color and depth clear. More... | |
virtual bool | get_clear_active (int n) const |
Gets the clear-active flag for any bitplane. More... | |
const LColor & | get_clear_color () const |
Returns the current clear color value. More... | |
bool | get_clear_color_active () const |
Returns the current setting of the flag that indicates whether the color buffer should be cleared every frame. More... | |
PN_stdfloat | get_clear_depth () const |
Returns the current clear depth value. More... | |
bool | get_clear_depth_active () const |
Returns the current setting of the flag that indicates whether the depth buffer should be cleared every frame. More... | |
unsigned int | get_clear_stencil () const |
Returns the current clear stencil value. More... | |
bool | get_clear_stencil_active () const |
Returns the current setting of the flag that indicates whether the color buffer should be cleared every frame. More... | |
virtual const LColor & | get_clear_value (int n) const |
Returns the clear value for any bitplane. More... | |
int | get_draw_buffer_type () const |
Returns the RenderBuffer into which the GSG should issue draw commands. More... | |
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(). More... | |
PN_stdfloat | get_pixel_zoom () const |
Returns the value set by set_pixel_zoom(), regardless of whether it is being respected or not. More... | |
int | get_screenshot_buffer_type () const |
Returns the RenderBuffer that should be used for capturing screenshots from this particular DrawableRegion. More... | |
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. More... | |
void | operator= (const DrawableRegion ©) |
virtual void | set_clear_active (int n, bool clear_aux_active) |
Sets the clear-active flag for any bitplane. More... | |
void | set_clear_color (const LColor &color) |
Sets the clear color to the indicated value. More... | |
void | set_clear_color_active (bool clear_color_active) |
Toggles the flag that indicates whether the color buffer should be cleared every frame. More... | |
void | set_clear_depth (PN_stdfloat depth) |
Sets the clear depth to the indicated value. More... | |
void | set_clear_depth_active (bool clear_depth_active) |
Toggles the flag that indicates whether the depth buffer should be cleared every frame. More... | |
void | set_clear_stencil (unsigned int stencil) |
Sets the clear stencil to the indicated value. More... | |
void | set_clear_stencil_active (bool clear_stencil_active) |
Toggles the flag that indicates whether the stencil buffer should be cleared every frame. More... | |
virtual void | set_clear_value (int n, const LColor &clear_value) |
Sets the clear value for any bitplane. More... | |
virtual void | set_pixel_zoom (PN_stdfloat pixel_zoom) |
Sets the amount by which the pixels of the region are scaled internally when filling the image interally. More... | |
Static Public Member Functions | |
static TypeHandle | get_class_type () |
static void | init_type () |
static Filename | make_screenshot_filename (const string &prefix="screenshot") |
Synthesizes a suitable default filename for passing to save_screenshot(). More... | |
![]() | |
static TypeHandle | get_class_type () |
static void | init_type () |
![]() | |
static TypeHandle | get_class_type () |
static void | init_type () |
![]() | |
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. More... | |
![]() | |
static TypeHandle | get_class_type () |
static void | init_type () |
![]() | |
static int | get_renderbuffer_type (int plane) |
Returns the RenderBuffer::Type that corresponds to a RenderTexturePlane. More... | |
Friends | |
class | DisplayRegionCullCallbackData |
class | DisplayRegionPipelineReader |
class | GraphicsEngine |
class | GraphicsOutput |
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 61 of file displayRegion.h.
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 98 of file displayRegion.cxx.
References set_lens_index().
Referenced by GraphicsOutput::process_events(), and GraphicsOutput::remove_all_display_regions().
|
inline |
Removes the callback set by an earlier call to set_cull_callback().
Definition at line 402 of file displayRegion.I.
References get_cull_callback(), and set_cull_callback().
Referenced by set_cull_callback().
|
inline |
Removes the callback set by an earlier call to set_draw_callback().
Definition at line 464 of file displayRegion.I.
References get_draw_callback(), and set_draw_callback().
Referenced by set_draw_callback().
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 642 of file displayRegion.cxx.
References compute_pixels_all_stages().
Referenced by compute_pixels_all_stages(), and get_screenshot().
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 684 of file displayRegion.cxx.
References compute_pixels_all_stages().
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 660 of file displayRegion.cxx.
References compute_pixels(), and Thread::get_current_pipeline_stage().
Referenced by compute_pixels().
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 701 of file displayRegion.cxx.
References supports_pixel_zoom().
|
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 145 of file displayRegion.I.
References get_top().
Referenced by get_right().
|
inline |
Returns the camera associated with this DisplayRegion, or an empty NodePath if no camera is associated.
Definition at line 225 of file displayRegion.I.
References is_active().
Referenced by NonlinearImager::add_viewer(), GraphicsEngine::do_cull(), get_window(), and GraphicsEngine::render_frame().
|
inline |
Returns the CallbackObject set by set_cull_callback().
Definition at line 412 of file displayRegion.I.
References set_draw_callback().
Referenced by clear_cull_callback(), and GraphicsEngine::do_cull().
|
inline |
Returns a PStatCollector for timing the cull operation for just this DisplayRegion.
Definition at line 644 of file displayRegion.I.
References get_draw_region_pcollector().
Referenced by GraphicsEngine::do_cull(), and get_scene_setup().
|
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 617 of file displayRegion.I.
References get_scene_setup().
Referenced by GraphicsEngine::do_cull(), and set_cull_result().
CullTraverser * DisplayRegion::get_cull_traverser | ( | ) |
Returns the CullTraverser that will be used to draw the contents of this DisplayRegion.
Definition at line 383 of file displayRegion.cxx.
References set_target_tex_page().
Referenced by GraphicsEngine::do_cull(), and set_cull_traverser().
|
inline |
Retrieves the coordinates of the DisplayRegion's rectangle within its GraphicsOutput.
These numbers will be in the range [0..1].
Definition at line 77 of file displayRegion.I.
References get_dimensions().
Referenced by get_dimensions(), DisplayRegionPipelineReader::get_dimensions(), and set_num_regions().
|
inline |
Retrieves the coordinates of the DisplayRegion's rectangle within its GraphicsOutput.
These numbers will be in the range [0..1].
Definition at line 89 of file displayRegion.I.
References 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 106 of file displayRegion.I.
References get_left().
|
inline |
Returns the CallbackObject set by set_draw_callback().
Definition at line 474 of file displayRegion.I.
References get_pixel_width().
Referenced by clear_draw_callback().
|
inline |
Returns a PStatCollector for timing the draw operation for just this DisplayRegion.
Definition at line 655 of file displayRegion.I.
References DisplayRegionPipelineReader::get_num_regions(), and PipelineCycler< CycleDataType >::read().
Referenced by GraphicsEngine::do_cull(), and get_cull_region_pcollector().
|
inline |
Returns the incomplete_render flag.
Definition at line 294 of file displayRegion.I.
References get_texture_reload_priority().
Referenced by GraphicsEngine::do_cull(), and get_tex_view_offset().
|
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 119 of file displayRegion.I.
References get_right().
Referenced by get_dimensions().
|
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 36 of file displayRegion.I.
References get_num_regions().
Referenced by operator<().
|
inline |
Returns the number of regions, see set_num_regions.
Definition at line 47 of file displayRegion.I.
References set_num_regions().
Referenced by get_lens_index().
GraphicsPipe * DisplayRegion::get_pipe | ( | ) | const |
Returns the GraphicsPipe that this DisplayRegion is ultimately associated with, or NULL if no pipe is associated.
Definition at line 151 of file displayRegion.cxx.
References is_stereo().
Referenced by set_dimensions().
|
inline |
Returns the height of the DisplayRegion in pixels.
Definition at line 496 of file displayRegion.I.
References get_pixels().
Referenced by get_pixel_width().
|
inline |
Returns the width of the DisplayRegion in pixels.
Definition at line 485 of file displayRegion.I.
References get_pixel_height().
Referenced by get_draw_callback().
|
inline |
Retrieves the coordinates of the DisplayRegion within its window, in pixels.
Definition at line 508 of file displayRegion.I.
Referenced by get_pixel_height(), and DisplayRegionPipelineReader::get_pixels().
|
inline |
Retrieves the coordinates of the DisplayRegion within its window, in pixels.
Definition at line 519 of file displayRegion.I.
References get_region_pixels().
|
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 536 of file displayRegion.I.
Referenced by get_pixels(), and DisplayRegionPipelineReader::get_region_pixels().
|
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 548 of file displayRegion.I.
References get_region_pixels_i().
|
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 566 of file displayRegion.I.
Referenced by DXGraphicsStateGuardian9::do_framebuffer_copy_to_ram(), TinyGraphicsStateGuardian::framebuffer_copy_to_ram(), TinyGraphicsStateGuardian::framebuffer_copy_to_texture(), DXGraphicsStateGuardian9::framebuffer_copy_to_texture(), get_region_pixels(), and DisplayRegionPipelineReader::get_region_pixels_i().
|
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 579 of file displayRegion.I.
References set_cull_result().
|
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 132 of file displayRegion.I.
References get_bottom().
Referenced by get_left().
|
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 632 of file displayRegion.I.
References get_cull_region_pcollector().
Referenced by GraphicsEngine::do_cull(), and get_cull_result().
|
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 355 of file displayRegion.I.
References set_cull_callback().
Referenced by set_scissor_enabled().
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 550 of file displayRegion.cxx.
References GraphicsOutput::begin_frame(), compute_pixels(), GraphicsOutput::end_frame(), GraphicsStateGuardian::framebuffer_copy_to_ram(), Thread::get_current_thread(), GraphicsOutput::get_gsg(), GraphicsStateGuardian::get_render_buffer(), and GraphicsStateGuardian::prepare_display_region().
Referenced by save_screenshot().
|
inline |
Returns the sort value associated with the DisplayRegion.
Definition at line 249 of file displayRegion.I.
References get_stereo_channel().
Referenced by is_active(), operator<(), and StereoDisplayRegion::set_target_tex_page().
|
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 263 of file displayRegion.I.
References get_tex_view_offset().
Referenced by get_sort().
|
inline |
Returns the target page number associated with this particular DisplayRegion, or -1 if it is not associated with a page.
Definition at line 329 of file displayRegion.I.
References set_scissor_enabled().
Referenced by set_cube_map_index().
|
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 282 of file displayRegion.I.
References get_incomplete_render().
Referenced by get_stereo_channel().
|
inline |
Returns the priority which is assigned to asynchronous texture reload requests.
See set_texture_reload_priority().
Definition at line 306 of file displayRegion.I.
References set_cube_map_index().
Referenced by get_incomplete_render().
|
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 158 of file displayRegion.I.
References set_dimensions().
Referenced by get_bottom().
|
inline |
Returns the GraphicsOutput that this DisplayRegion is ultimately associated with, or NULL if no window is associated.
Definition at line 213 of file displayRegion.I.
References get_camera().
Referenced by NonlinearImager::add_viewer(), set_dimensions(), GraphicsOutput::set_overlay_display_region(), WindowFramework::split_window(), DisplayRegionCullCallbackData::upcall(), and DisplayRegionDrawCallbackData::upcall().
|
inline |
Returns the active flag associated with the DisplayRegion.
Definition at line 237 of file displayRegion.I.
References get_sort().
Referenced by get_camera(), and GraphicsOutput::process_events().
|
virtual |
Returns true if this is a StereoDisplayRegion, false otherwise.
Reimplemented in StereoDisplayRegion.
Definition at line 162 of file displayRegion.cxx.
References set_camera().
Referenced by GraphicsEngine::do_cull(), get_pipe(), MouseWatcher::note_activity(), GraphicsOutput::remove_display_region(), and DisplayRegionDrawCallbackData::upcall().
|
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 444 of file displayRegion.cxx.
References ClockObject::get_frame_count(), ClockObject::get_global_clock(), and save_screenshot_default().
Referenced by GraphicsOutput::make_screenshot_filename(), and set_target_tex_page().
|
inline |
Returns true if this DisplayRegion should be sorted before the other one, false otherwise.
Definition at line 23 of file displayRegion.I.
References get_lens_index(), and get_sort().
bool DisplayRegion::save_screenshot | ( | const Filename & | filename, |
const string & | image_comment = "" |
||
) |
Saves a screenshot of the region to the indicated filename.
Returns true on success, false on failure.
Definition at line 529 of file displayRegion.cxx.
References get_screenshot(), PNMImageHeader::set_comment(), and PNMImage::write().
Referenced by save_screenshot_default().
Filename DisplayRegion::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 the screenshot failed.
The filename is generated by make_screenshot_filename().
Definition at line 514 of file displayRegion.cxx.
References save_screenshot().
Referenced by make_screenshot_filename().
|
virtual |
Sets the active flag associated with the DisplayRegion.
If the DisplayRegion is marked inactive, nothing is rendered.
Reimplemented in StereoDisplayRegion.
Definition at line 219 of file displayRegion.cxx.
References Thread::get_current_pipeline_stage(), and set_sort().
Referenced by StereoDisplayRegion::set_active(), and set_camera().
|
virtual |
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.
Reimplemented in StereoDisplayRegion.
Definition at line 179 of file displayRegion.cxx.
References Thread::get_current_pipeline_stage(), NodePath::is_empty(), NodePath::node(), and set_active().
Referenced by MultitexReducer::flatten(), is_stereo(), GraphicsOutput::make_cube_map(), NonlinearImager::recompute_if_stale(), and StereoDisplayRegion::set_camera().
|
inline |
Deprecated; replaced by set_target_tex_page().
Definition at line 316 of file displayRegion.I.
References get_target_tex_page(), and set_target_tex_page().
Referenced by get_texture_reload_priority().
|
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 390 of file displayRegion.I.
References clear_cull_callback().
Referenced by clear_cull_callback(), and get_scissor_enabled().
|
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 600 of file displayRegion.I.
References get_cull_result().
Referenced by GraphicsEngine::do_cull(), and get_region_pixels_i().
|
virtual |
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.
Reimplemented in StereoDisplayRegion.
Definition at line 372 of file displayRegion.cxx.
References get_cull_traverser().
Referenced by StereoDisplayRegion::set_cull_traverser(), and set_texture_reload_priority().
|
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.
Definition at line 173 of file displayRegion.I.
Referenced by get_top(), StereoDisplayRegion::set_dimensions(), set_dimensions(), set_lens_index(), and WindowFramework::split_window().
|
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.
Definition at line 187 of file displayRegion.I.
References 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.
Definition at line 201 of file displayRegion.I.
References get_window(), and set_dimensions().
|
virtual |
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.
Reimplemented in StereoDisplayRegion.
Definition at line 131 of file displayRegion.cxx.
References Thread::get_current_pipeline_stage(), and get_pipe().
|
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 452 of file displayRegion.I.
References clear_draw_callback().
Referenced by clear_draw_callback(), and get_cull_callback().
|
virtual |
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.
Reimplemented in StereoDisplayRegion.
Definition at line 337 of file displayRegion.cxx.
References set_texture_reload_priority().
Referenced by StereoDisplayRegion::set_incomplete_render(), and set_tex_view_offset().
void DisplayRegion::set_lens_index | ( | int | 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.
Definition at line 114 of file displayRegion.cxx.
References Thread::get_current_pipeline_stage(), and set_dimensions().
Referenced by cleanup().
|
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 63 of file displayRegion.I.
References get_dimensions().
Referenced by get_num_regions().
|
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 342 of file displayRegion.I.
References get_scissor_enabled().
Referenced by get_target_tex_page().
|
virtual |
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.
Reimplemented in StereoDisplayRegion.
Definition at line 240 of file displayRegion.cxx.
References Thread::get_current_pipeline_stage(), and set_stereo_channel().
Referenced by set_active(), and StereoDisplayRegion::set_sort().
|
virtual |
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.
Reimplemented in StereoDisplayRegion.
Definition at line 286 of file displayRegion.cxx.
References Thread::get_current_pipeline_stage(), and set_tex_view_offset().
Referenced by GraphicsOutput::make_mono_display_region(), set_sort(), and StereoDisplayRegion::set_stereo_channel().
|
virtual |
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.
Reimplemented in StereoDisplayRegion.
Definition at line 408 of file displayRegion.cxx.
References Thread::get_current_pipeline_stage(), and make_screenshot_filename().
Referenced by get_cull_traverser(), GraphicsOutput::make_cube_map(), set_cube_map_index(), and StereoDisplayRegion::set_target_tex_page().
|
virtual |
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().
Reimplemented in StereoDisplayRegion.
Definition at line 311 of file displayRegion.cxx.
References Thread::get_current_pipeline_stage(), and set_incomplete_render().
Referenced by set_stereo_channel(), and StereoDisplayRegion::set_tex_view_offset().
|
virtual |
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.
Reimplemented in StereoDisplayRegion.
Definition at line 359 of file displayRegion.cxx.
References set_cull_traverser().
Referenced by set_incomplete_render(), and StereoDisplayRegion::set_texture_reload_priority().
|
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 726 of file displayRegion.cxx.
References GraphicsEngine::do_cull(), and DisplayRegionPipelineReader::get_pipe().
Referenced by compute_pixels_all_stages().