14#ifndef DISPLAYREGION_H
15#define DISPLAYREGION_H
57class EXPCL_PANDA_DISPLAY DisplayRegion :
public TypedReferenceCount,
public DrawableRegion {
59 DisplayRegion(GraphicsOutput *window,
const LVecBase4 &dimensions);
60 DisplayRegion(
const DisplayRegion ©) =
delete;
61 void operator = (
const DisplayRegion ©) =
delete;
64 virtual ~DisplayRegion();
67 INLINE
bool operator < (
const DisplayRegion &other)
const;
72 INLINE
void get_dimensions(PN_stdfloat &l, PN_stdfloat &r, PN_stdfloat &b, PN_stdfloat &t)
const;
73 INLINE
void get_dimensions(
int i, PN_stdfloat &l, PN_stdfloat &r, PN_stdfloat &b, PN_stdfloat &t)
const;
75 INLINE PN_stdfloat
get_left(
int i = 0)
const;
76 INLINE PN_stdfloat
get_right(
int i = 0)
const;
77 INLINE PN_stdfloat
get_bottom(
int i = 0)
const;
78 INLINE PN_stdfloat
get_top(
int i = 0)
const;
79 INLINE
void set_dimensions(PN_stdfloat l, PN_stdfloat r, PN_stdfloat b, PN_stdfloat t);
80 INLINE
void set_dimensions(
int i, PN_stdfloat l, PN_stdfloat r, PN_stdfloat b, PN_stdfloat t);
153 virtual void output(std::ostream &out)
const;
156 const std::string &prefix =
"screenshot");
159 const Filename &filename,
const std::string &image_comment =
"");
163 void clear_cull_result();
171 INLINE
void get_pixels(
int &pl,
int &pr,
int &pb,
int &pt)
const;
172 INLINE
void get_pixels(
int i,
int &pl,
int &pr,
int &pb,
int &pt)
const;
193 LVecBase4 _dimensions;
195 LVecBase4i _pixels_i;
197 typedef epvector<Region> Regions;
202 void win_display_regions_changed();
203 void do_compute_pixels(
int i,
int x_size,
int y_size, CData *cdata);
204 void set_active_index(
int index);
213 GraphicsOutput *_window;
215 bool _incomplete_render;
216 int _texture_reload_priority;
225 class EXPCL_PANDA_DISPLAY CData :
public CycleData {
228 CData(
const CData ©);
232 return DisplayRegion::get_class_type();
244 Lens::StereoChannel _stereo_channel;
245 int _tex_view_offset;
246 int _target_tex_page;
247 bool _scissor_enabled;
253 PipelineCycler<CData> _cycler;
254 typedef CycleDataLockedReader<CData> CDLockedReader;
255 typedef CycleDataReader<CData> CDReader;
256 typedef CycleDataWriter<CData> CDWriter;
257 typedef CycleDataStageWriter<CData> CDStageWriter;
264 class EXPCL_PANDA_DISPLAY CDataCull :
public CycleData {
267 CDataCull(
const CDataCull ©);
269 virtual CycleData *make_copy()
const;
270 virtual TypeHandle get_parent_type()
const {
271 return DisplayRegion::get_class_type();
274 PT(CullResult) _cull_result;
275 PT(SceneSetup) _scene_setup;
277 PipelineCycler<CDataCull> _cycler_cull;
278 typedef CycleDataReader<CDataCull> CDCullReader;
279 typedef CycleDataWriter<CDataCull> CDCullWriter;
281 PStatCollector _cull_region_pcollector;
282 PStatCollector _draw_region_pcollector;
283 std::string _debug_name;
286 static TypeHandle get_class_type() {
289 static void init_type() {
290 TypedReferenceCount::init_type();
292 TypedReferenceCount::get_class_type());
294 virtual TypeHandle get_type()
const {
295 return get_class_type();
297 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
300 static TypeHandle _type_handle;
302 friend class GraphicsEngine;
303 friend class GraphicsOutput;
304 friend class DisplayRegionCullCallbackData;
305 friend class DisplayRegionPipelineReader;
312class EXPCL_PANDA_DISPLAY DisplayRegionPipelineReader {
315 DisplayRegionPipelineReader(
const DisplayRegionPipelineReader ©) =
delete;
316 void operator = (
const DisplayRegionPipelineReader ©) =
delete;
319 INLINE ~DisplayRegionPipelineReader();
320 ALLOC_DELETED_CHAIN(DisplayRegionPipelineReader);
323 INLINE
Thread *get_current_thread()
const;
328 INLINE
void get_dimensions(PN_stdfloat &l, PN_stdfloat &r, PN_stdfloat &b, PN_stdfloat &t)
const;
329 INLINE
void get_dimensions(
int i, PN_stdfloat &l, PN_stdfloat &r, PN_stdfloat &b, PN_stdfloat &t)
const;
331 INLINE PN_stdfloat
get_left(
int i = 0)
const;
332 INLINE PN_stdfloat
get_right(
int i = 0)
const;
333 INLINE PN_stdfloat
get_bottom(
int i = 0)
const;
334 INLINE PN_stdfloat
get_top(
int i = 0)
const;
344 INLINE
bool get_clear_depth_between_eyes()
const;
349 INLINE
void get_pixels(
int &pl,
int &pr,
int &pb,
int &pt)
const;
350 INLINE
void get_pixels(
int i,
int &pl,
int &pr,
int &pb,
int &pt)
const;
364 const DisplayRegion::CData *_cdata;
370 static void init_type() {
378INLINE std::ostream &operator << (std::ostream &out,
const DisplayRegion &dr);
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is a generic object that can be assigned to a callback at various points in the rendering proces...
A node that can be positioned around in the scene graph to represent a point of view for rendering a ...
This defines the abstract interface for an object that receives Geoms identified by the CullTraverser...
This stores the result of a BinCullHandler traversal: an ordered collection of CullBins,...
This object performs a depth-first traversal of the scene graph, with optional view-frustum culling,...
A single page of data maintained by a PipelineCycler.
int get_target_tex_page() const
Returns the target page number associated with this particular DisplayRegion, or -1 if it is not asso...
PN_stdfloat get_left(int i=0) const
Retrieves the x coordinate of the left edge of the rectangle within its GraphicsOutput.
GraphicsOutput * get_window() const
Returns the GraphicsOutput that this DisplayRegion is ultimately associated with, or NULL if no windo...
GraphicsPipe * get_pipe() const
Returns the GraphicsPipe that this DisplayRegion is ultimately associated with, or NULL if no pipe is...
int get_sort() const
Returns the sort value associated with the DisplayRegion.
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...
PN_stdfloat get_bottom(int i=0) const
Retrieves the y coordinate of the bottom edge of the rectangle within its GraphicsOutput.
int get_lens_index() const
Gets the index into a lens_node lens array.
PN_stdfloat get_top(int i=0) const
Retrieves the y coordinate of the top edge of the rectangle within its GraphicsOutput.
CallbackObject * get_draw_callback() const
Returns the CallbackObject set by set_draw_callback().
void get_pixels(int &pl, int &pr, int &pb, int &pt) const
Retrieves the coordinates of the DisplayRegion within its window, in pixels.
NodePath get_camera() const
Returns the camera associated with this DisplayRegion, or an empty NodePath if no camera is associate...
bool is_active() const
Returns the active flag associated with the DisplayRegion.
bool get_scissor_enabled() const
Returns whether or not scissor testing is enabled for this region.
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.
int get_pixel_width(int i=0) const
Returns the width of the DisplayRegion in pixels.
int get_pixel_height(int i=0) const
Returns the height of the DisplayRegion in pixels.
int get_tex_view_offset()
Returns the current texture view offset for this DisplayRegion.
Lens::StereoChannel get_stereo_channel() const
Returns whether the DisplayRegion is specified as the left or right channel of a stereo pair,...
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...
PN_stdfloat get_right(int i=0) const
Retrieves the x coordinate of the right edge of the rectangle within its GraphicsOutput.
int get_num_regions() const
Returns the number of regions, see set_num_regions.
A rectangular subregion within a window for rendering into.
is_stereo
Returns true if this is a StereoDisplayRegion, false otherwise.
get_cull_traverser
Returns the CullTraverser that will be used to draw the contents of this DisplayRegion.
void compute_pixels()
Computes the pixel locations of the DisplayRegion within its window.
bool save_screenshot(const Filename &filename, const std::string &image_comment="")
Saves a screenshot of the region to the indicated filename.
get_incomplete_render
Returns the incomplete_render flag.
void clear_draw_callback()
Removes the callback set by an earlier call to set_draw_callback().
CullResult * get_cull_result(Thread *current_thread) const
Returns the CullResult value that was stored on this DisplayRegion, presumably by the last successful...
set_camera
Sets the camera that is associated with this DisplayRegion.
PN_stdfloat get_left(int i=0) const
Retrieves the x coordinate of the left edge of the rectangle within its GraphicsOutput.
set_tex_view_offset
Sets the current texture view offset for this DisplayRegion.
virtual PointerTo< PandaNode > make_cull_result_graph()
Returns a special scene graph constructed to represent the results of the last frame's cull operation...
PN_stdfloat get_bottom(int i=0) const
Retrieves the y coordinate of the bottom edge of the rectangle within its GraphicsOutput.
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.
set_target_tex_page
This is a special parameter that is only used when rendering the faces of a cube map or multipage and...
bool get_screenshot(PNMImage &image)
Captures the most-recently rendered image from the framebuffer into the indicated PNMImage.
PStatCollector & get_draw_region_pcollector()
Returns a PStatCollector for timing the draw operation for just this DisplayRegion.
PStatCollector & get_cull_region_pcollector()
Returns a PStatCollector for timing the cull operation for just this DisplayRegion.
get_texture_reload_priority
Returns the priority which is assigned to asynchronous texture reload requests.
get_dimensions
Retrieves the coordinates of the DisplayRegion's rectangle within its GraphicsOutput.
is_active
Returns the active flag associated with the DisplayRegion.
void get_pixels(int &pl, int &pr, int &pb, int &pt) const
Retrieves the coordinates of the DisplayRegion within its window, in pixels.
get_lens_index
Returns the specific lens of the associated Camera that will be used for rendering this scene.
int get_pixel_height(int i=0) const
Returns the height of the DisplayRegion in pixels.
get_camera
Returns the camera associated with this DisplayRegion, or an empty NodePath if no camera is associate...
set_lens_index
Sets the lens index, allows for multiple lenses to be attached to a camera.
const std::string & get_debug_name() const
Returns a unique name used for debugging.
get_window
Returns the GraphicsOutput that this DisplayRegion is ultimately associated with, or NULL if no windo...
set_cull_callback
Sets the CallbackObject that will be notified when the DisplayRegion is visited during the cull trave...
get_scissor_enabled
Returns whether or not scissor testing is enabled for this region.
get_stereo_channel
Returns whether the DisplayRegion is specified as the left or right channel of a stereo pair,...
void cleanup()
Cleans up some pointers associated with the DisplayRegion to help reduce the chance of memory leaks d...
void compute_pixels_all_stages()
Computes the pixel locations of the DisplayRegion within its window.
get_target_tex_page
Returns the target page number associated with this particular DisplayRegion, or -1 if it is not asso...
get_sort
Returns the sort value associated with the DisplayRegion.
int get_num_regions() const
Returns the number of regions, see set_num_regions.
get_pipe
Returns the GraphicsPipe that this DisplayRegion is ultimately associated with, or NULL if no pipe is...
set_sort
Sets the sort value associated with the DisplayRegion.
void set_cube_map_index(int cube_map_index)
Deprecated; replaced by set_target_tex_page().
static Filename make_screenshot_filename(const std::string &prefix="screenshot")
Synthesizes a suitable default filename for passing to save_screenshot().
set_cull_traverser
Specifies the CullTraverser that will be used to draw the contents of this DisplayRegion.
SceneSetup * get_scene_setup(Thread *current_thread) const
Returns the SceneSetup value that was stored on this DisplayRegion, presumably by the last successful...
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...
PN_stdfloat get_right(int i=0) const
Retrieves the x coordinate of the right edge of the rectangle within its GraphicsOutput.
get_cull_callback
Returns the CallbackObject set by set_cull_callback().
get_tex_view_offset
Returns the current texture view offset for this DisplayRegion.
set_dimensions
Changes the portion of the framebuffer this DisplayRegion corresponds to.
void set_num_regions(int i)
Sets the number of regions that this DisplayRegion indicates.
set_active
Sets the active flag associated with the DisplayRegion.
set_scissor_enabled
Sets whether or not scissor testing is enabled for this region.
int get_pixel_width(int i=0) const
Returns the width of the DisplayRegion in pixels.
PN_stdfloat get_top(int i=0) const
Retrieves the y coordinate of the top edge of the rectangle within its GraphicsOutput.
set_stereo_channel
Specifies whether the DisplayRegion represents the left or right channel of a stereo pair,...
set_draw_callback
Sets the CallbackObject that will be notified when the contents of DisplayRegion is drawn during the ...
set_texture_reload_priority
Specifies an integer priority which is assigned to any asynchronous texture reload requests spawned w...
void clear_cull_callback()
Removes the callback set by an earlier call to set_cull_callback().
get_draw_callback
Returns the CallbackObject set by set_draw_callback().
get_pixel_size
Returns the size of the DisplayRegion in pixels.
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 ...
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...
set_incomplete_render
Sets the incomplete_render flag.
virtual bool supports_pixel_zoom() const
Returns true if a call to set_pixel_zoom() will be respected, false if it will be ignored.
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,...
The name of a file, such as a texture file or an Egg file.
This is a base class for the various different classes that represent the result of a frame of render...
An object to create GraphicsOutputs that share a particular 3-D API.
Encapsulates all the communication with a particular instance of a given rendering backend.
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
The name of this class derives from the fact that we originally implemented it as a layer on top of t...
A lightweight class that represents a single element that may be timed and/or counted via stats.
A basic node of the scene graph or data graph.
This object holds the camera position, etc., and other general setup information for rendering a part...
Represents a texture object, which is typically a single 2-d image but may also represent a 1-d or 3-...
A thread; that is, a lightweight process.
get_current_thread
Returns a pointer to the currently-executing Thread object.
TypeHandle is the identifier used to differentiate C++ class types.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.