Panda3D
|
A rectangular subregion within a window for rendering into. More...
#include "displayRegion.h"
Classes | |
class | CData |
class | CDataCull |
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_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 () 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 |
Returns the camera associated with this DisplayRegion, or an empty NodePath if no camera is associated. | |
int | get_cube_map_index () const |
Returns the cube map face index associated with this particular DisplayRegion, or -1 if it is not associated with a cube map. | |
CallbackObject * | get_cull_callback () const |
Returns the CallbackObject set by set_cull_callback(). | |
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 () |
Returns the CullTraverser that will be used to draw the contents of this DisplayRegion. | |
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. | |
LVecBase4 | get_dimensions () const |
Retrieves the coordinates of the DisplayRegion's rectangle within its GraphicsOutput. | |
CallbackObject * | get_draw_callback () const |
Returns the CallbackObject set by set_draw_callback(). | |
PStatCollector & | get_draw_region_pcollector () |
Returns a PStatCollector for timing the draw operation for just this DisplayRegion. | |
bool | get_incomplete_render () const |
Returns the incomplete_render flag. | |
PN_stdfloat | get_left () const |
Retrieves the x coordinate of the left edge of the rectangle within its GraphicsOutput. | |
int | get_lens_index () const |
Returns the specific lens of the associated Camera that will be used for rendering this scene. | |
GraphicsPipe * | get_pipe () const |
Returns the GraphicsPipe that this DisplayRegion is ultimately associated with, or NULL if no pipe is associated. | |
int | get_pixel_height () const |
Returns the height of the DisplayRegion in pixels. | |
int | get_pixel_width () 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_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_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 () 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_screenshot (PNMImage &image) |
Captures the most-recently rendered image from the framebuffer into the indicated PNMImage. | |
int | get_sort () const |
Returns the sort value associated with the DisplayRegion. | |
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. | |
int | get_tex_view_offset () const |
Returns the current texture view offset for this DisplayRegion. | |
int | get_texture_reload_priority () const |
Returns the priority which is assigned to asynchronous texture reload requests. | |
PN_stdfloat | get_top () const |
Retrieves the y coordinate of the top edge of the rectangle within its GraphicsOutput. | |
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. | |
bool | is_active () const |
Returns the active flag associated with the DisplayRegion. | |
virtual bool | is_stereo () const |
Returns true if this is a StereoDisplayRegion, false otherwise. | |
bool | operator< (const DisplayRegion &other) const |
Returns true if this DisplayRegion should be sorted before the other one, false otherwise. | |
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. | |
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. | |
virtual void | set_active (bool active) |
Sets the active flag associated with the DisplayRegion. | |
virtual void | set_camera (const NodePath &camera) |
Sets the camera that is associated with this DisplayRegion. | |
virtual void | set_cube_map_index (int cube_map_index) |
This is a special parameter that is only used when rendering the faces of a cube map. | |
void | set_cull_callback (CallbackObject *object) |
Sets the CallbackObject that will be notified when the DisplayRegion is visited during the cull traversal. | |
void | set_cull_result (CullResult *cull_result, SceneSetup *scene_setup, Thread *current_thread) |
Stores the result of performing a cull operation on this DisplayRegion. | |
virtual void | set_cull_traverser (CullTraverser *trav) |
Specifies the CullTraverser that will be used to draw the contents of this DisplayRegion. | |
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. | |
virtual void | set_dimensions (const LVecBase4 &dimensions) |
Changes the portion of the framebuffer this DisplayRegion corresponds to. | |
void | set_draw_callback (CallbackObject *object) |
Sets the CallbackObject that will be notified when the contents of DisplayRegion is drawn during the draw traversal. | |
virtual void | set_incomplete_render (bool incomplete_render) |
Sets the incomplete_render flag. | |
void | set_lens_index (int index) |
Sets the lens index, allows for multiple lenses to be attached to a camera. | |
virtual void | set_sort (int sort) |
Sets the sort value associated with the DisplayRegion. | |
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. | |
virtual void | set_tex_view_offset (int tex_view_offset) |
Sets the current texture view offset for this DisplayRegion. | |
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. | |
virtual bool | supports_pixel_zoom () const |
Returns true if a call to set_pixel_zoom() will be respected, false if it will be ignored. | |
Static Public Member Functions | |
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 Filename | make_screenshot_filename (const string &prefix="screenshot") |
Synthesizes a suitable default filename for passing to save_screenshot(). | |
Protected Member Functions | |
DisplayRegion (GraphicsOutput *window, const LVecBase4 &dimensions) | |
virtual void | do_cull (CullHandler *cull_handler, SceneSetup *scene_setup, GraphicsStateGuardian *gsg, Thread *current_thread) |
Performs a cull traversal. | |
PT (CullTraverser) _trav | |
Protected Attributes | |
bool | _incomplete_render |
int | _texture_reload_priority |
GraphicsOutput * | _window |
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 60 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 97 of file displayRegion.cxx.
References set_camera().
Referenced by GraphicsOutput::remove_all_display_regions().
void DisplayRegion::clear_cull_callback | ( | ) | [inline] |
Removes the callback set by an earlier call to set_cull_callback().
Definition at line 297 of file displayRegion.I.
References set_cull_callback().
void DisplayRegion::clear_draw_callback | ( | ) | [inline] |
Removes the callback set by an earlier call to set_draw_callback().
Definition at line 359 of file displayRegion.I.
References 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 630 of file displayRegion.cxx.
References GraphicsOutput::get_fb_x_size(), and GraphicsOutput::get_fb_y_size().
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 668 of file displayRegion.cxx.
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 646 of file displayRegion.cxx.
References Thread::get_current_pipeline_stage(), GraphicsOutput::get_fb_x_size(), and GraphicsOutput::get_fb_y_size().
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 683 of file displayRegion.cxx.
void DisplayRegion::do_cull | ( | CullHandler * | cull_handler, |
SceneSetup * | scene_setup, | ||
GraphicsStateGuardian * | gsg, | ||
Thread * | current_thread | ||
) | [protected, virtual] |
Performs a cull traversal.
The default implementation simply calls GraphicsEngine::do_cull.
Reimplemented in RocketRegion.
Definition at line 798 of file displayRegion.cxx.
Referenced by DisplayRegionCullCallbackData::upcall().
PN_stdfloat DisplayRegion::get_bottom | ( | ) | 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 104 of file displayRegion.I.
NodePath DisplayRegion::get_camera | ( | Thread * | current_thread = Thread::get_current_thread() | ) | const [inline] |
Returns the camera associated with this DisplayRegion, or an empty NodePath if no camera is associated.
Definition at line 156 of file displayRegion.I.
Referenced by NonlinearImager::add_viewer(), and GraphicsEngine::render_frame().
int DisplayRegion::get_cube_map_index | ( | ) | const [inline] |
Returns the cube map face index associated with this particular DisplayRegion, or -1 if it is not associated with a cube map.
See set_cube_map_index().
Definition at line 250 of file displayRegion.I.
CallbackObject * DisplayRegion::get_cull_callback | ( | ) | const [inline] |
Returns the CallbackObject set by set_cull_callback().
Definition at line 307 of file displayRegion.I.
PStatCollector & DisplayRegion::get_cull_region_pcollector | ( | ) | [inline] |
Returns a PStatCollector for timing the cull operation for just this DisplayRegion.
Definition at line 500 of file displayRegion.I.
Referenced by RocketRegion::do_cull(), and GraphicsEngine::do_cull().
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 473 of file displayRegion.I.
CullTraverser * DisplayRegion::get_cull_traverser | ( | ) |
Returns the CullTraverser that will be used to draw the contents of this DisplayRegion.
Definition at line 382 of file displayRegion.cxx.
Referenced by RocketRegion::do_cull(), and GraphicsEngine::do_cull().
LVecBase4 DisplayRegion::get_dimensions | ( | ) | const [inline] |
Retrieves the coordinates of the DisplayRegion's rectangle within its GraphicsOutput.
These numbers will be in the range [0..1].
Definition at line 65 of file displayRegion.I.
void DisplayRegion::get_dimensions | ( | PN_stdfloat & | l, |
PN_stdfloat & | r, | ||
PN_stdfloat & | b, | ||
PN_stdfloat & | t | ||
) | const [inline] |
Retrieves the coordinates of the DisplayRegion's rectangle within its GraphicsOutput.
These numbers will be in the range [0..1].
Definition at line 49 of file displayRegion.I.
CallbackObject * DisplayRegion::get_draw_callback | ( | ) | const [inline] |
Returns the CallbackObject set by set_draw_callback().
Definition at line 369 of file displayRegion.I.
PStatCollector & DisplayRegion::get_draw_region_pcollector | ( | ) | [inline] |
Returns a PStatCollector for timing the draw operation for just this DisplayRegion.
Definition at line 511 of file displayRegion.I.
bool DisplayRegion::get_incomplete_render | ( | ) | const [inline] |
Returns the incomplete_render flag.
Definition at line 225 of file displayRegion.I.
Referenced by RocketRegion::do_cull(), and GraphicsEngine::do_cull().
PN_stdfloat DisplayRegion::get_left | ( | ) | 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 78 of file displayRegion.I.
int DisplayRegion::get_lens_index | ( | ) | const [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.
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 150 of file displayRegion.cxx.
References GraphicsOutput::get_pipe().
int DisplayRegion::get_pixel_height | ( | ) | const [inline] |
Returns the height of the DisplayRegion in pixels.
Definition at line 391 of file displayRegion.I.
int DisplayRegion::get_pixel_width | ( | ) | const [inline] |
Returns the width of the DisplayRegion in pixels.
Definition at line 380 of file displayRegion.I.
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 403 of file displayRegion.I.
Referenced by RocketRegion::do_cull(), and RocketRegion::RocketRegion().
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 419 of file displayRegion.I.
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 436 of file displayRegion.I.
Referenced by DXGraphicsStateGuardian8::do_framebuffer_copy_to_ram(), DXGraphicsStateGuardian9::do_framebuffer_copy_to_ram(), TinyGraphicsStateGuardian::framebuffer_copy_to_ram(), TinyGraphicsStateGuardian::framebuffer_copy_to_texture(), DXGraphicsStateGuardian9::framebuffer_copy_to_texture(), and DXGraphicsStateGuardian8::framebuffer_copy_to_texture().
PN_stdfloat DisplayRegion::get_right | ( | ) | 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 91 of file displayRegion.I.
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 488 of file displayRegion.I.
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 544 of file displayRegion.cxx.
Referenced by save_screenshot().
int DisplayRegion::get_sort | ( | ) | const [inline] |
Returns the sort value associated with the DisplayRegion.
Definition at line 180 of file displayRegion.I.
Referenced by operator<().
Lens::StereoChannel DisplayRegion::get_stereo_channel | ( | ) | const [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 194 of file displayRegion.I.
Referenced by StereoDisplayRegion::set_active().
int DisplayRegion::get_tex_view_offset | ( | ) | const [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 213 of file displayRegion.I.
Referenced by TinyGraphicsStateGuardian::framebuffer_copy_to_texture(), and DXGraphicsStateGuardian9::framebuffer_copy_to_texture().
int DisplayRegion::get_texture_reload_priority | ( | ) | const [inline] |
Returns the priority which is assigned to asynchronous texture reload requests.
See set_texture_reload_priority().
Definition at line 237 of file displayRegion.I.
PN_stdfloat DisplayRegion::get_top | ( | ) | 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 117 of file displayRegion.I.
GraphicsOutput * DisplayRegion::get_window | ( | ) | const [inline] |
Returns the GraphicsOutput that this DisplayRegion is ultimately associated with, or NULL if no window is associated.
Definition at line 144 of file displayRegion.I.
Referenced by NonlinearImager::add_viewer(), GraphicsOutput::set_overlay_display_region(), DisplayRegionDrawCallbackData::upcall(), and DisplayRegionCullCallbackData::upcall().
static void DisplayRegion::init_type | ( | ) | [inline, static] |
This function is declared non-inline to work around a compiler bug in g++ 2.96.
Making it inline seems to cause problems in the optimizer.
Reimplemented from DisplayRegionBase.
Reimplemented in StereoDisplayRegion, and RocketRegion.
Definition at line 255 of file displayRegion.h.
References DisplayRegionBase::init_type().
Referenced by RocketRegion::init_type(), and StereoDisplayRegion::init_type().
bool DisplayRegion::is_active | ( | ) | const [inline] |
Returns the active flag associated with the DisplayRegion.
Definition at line 168 of file displayRegion.I.
Referenced by StereoDisplayRegion::set_stereo_channel().
bool DisplayRegion::is_stereo | ( | ) | const [virtual] |
Returns true if this is a StereoDisplayRegion, false otherwise.
Reimplemented in StereoDisplayRegion.
Definition at line 161 of file displayRegion.cxx.
Referenced by GraphicsOutput::remove_display_region(), set_stereo_channel(), and DisplayRegionDrawCallbackData::upcall().
Filename DisplayRegion::make_screenshot_filename | ( | const 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 438 of file displayRegion.cxx.
References ClockObject::get_frame_count(), and ClockObject::get_global_clock().
Referenced by save_screenshot_default().
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 23 of file displayRegion.I.
References 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 523 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 508 of file displayRegion.cxx.
References make_screenshot_filename(), and save_screenshot().
void DisplayRegion::set_active | ( | bool | active | ) | [virtual] |
Sets the active flag associated with the DisplayRegion.
If the DisplayRegion is marked inactive, nothing is rendered.
Reimplemented in StereoDisplayRegion.
Definition at line 218 of file displayRegion.cxx.
References Thread::get_current_pipeline_stage().
void DisplayRegion::set_camera | ( | const NodePath & | 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 178 of file displayRegion.cxx.
References Thread::get_current_pipeline_stage(), NodePath::is_empty(), and NodePath::node().
Referenced by cleanup(), MultitexReducer::flatten(), GraphicsOutput::make_cube_map(), and RocketRegion::RocketRegion().
void DisplayRegion::set_cube_map_index | ( | int | cube_map_index | ) | [virtual] |
This is a special parameter that is only used when rendering the faces of a cube map.
Normally you should not need to set it directly. This sets up the DisplayRegion to render to the nth cube map face; the value must be between 0 and 5, inclusive. A normal DisplayRegion that is not associated with any particular cube map should be set to -1.
Reimplemented in StereoDisplayRegion.
Definition at line 401 of file displayRegion.cxx.
References Thread::get_current_pipeline_stage().
Referenced by GraphicsOutput::make_cube_map().
void DisplayRegion::set_cull_callback | ( | CallbackObject * | object | ) | [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 285 of file displayRegion.I.
Referenced by clear_cull_callback().
void DisplayRegion::set_cull_result | ( | CullResult * | cull_result, |
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 456 of file displayRegion.I.
void DisplayRegion::set_cull_traverser | ( | CullTraverser * | trav | ) | [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 371 of file displayRegion.cxx.
void DisplayRegion::set_dimensions | ( | PN_stdfloat | l, |
PN_stdfloat | r, | ||
PN_stdfloat | b, | ||
PN_stdfloat | t | ||
) | [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 132 of file displayRegion.I.
void DisplayRegion::set_dimensions | ( | const LVecBase4 & | 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 130 of file displayRegion.cxx.
References Thread::get_current_pipeline_stage(), GraphicsOutput::get_fb_x_size(), GraphicsOutput::get_fb_y_size(), and GraphicsOutput::has_size().
void DisplayRegion::set_draw_callback | ( | CallbackObject * | object | ) | [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 347 of file displayRegion.I.
Referenced by clear_draw_callback().
void DisplayRegion::set_incomplete_render | ( | bool | incomplete_render | ) | [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 336 of file displayRegion.cxx.
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 113 of file displayRegion.cxx.
References Thread::get_current_pipeline_stage().
void DisplayRegion::set_sort | ( | int | sort | ) | [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 239 of file displayRegion.cxx.
References Thread::get_current_pipeline_stage().
void DisplayRegion::set_stereo_channel | ( | Lens::StereoChannel | stereo_channel | ) | [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 285 of file displayRegion.cxx.
References Thread::get_current_pipeline_stage(), and is_stereo().
Referenced by GraphicsOutput::make_mono_display_region().
void DisplayRegion::set_tex_view_offset | ( | int | tex_view_offset | ) | [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 310 of file displayRegion.cxx.
References Thread::get_current_pipeline_stage().
void DisplayRegion::set_texture_reload_priority | ( | int | texture_reload_priority | ) | [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 358 of file displayRegion.cxx.
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 706 of file displayRegion.cxx.
References DrawableRegion::get_clear_color_active(), DrawableRegion::get_clear_depth_active(), and DrawableRegion::supports_pixel_zoom().