15 #ifndef DISPLAYREGION_H 16 #define DISPLAYREGION_H 18 #include "pandabase.h" 20 #include "displayRegionBase.h" 21 #include "drawableRegion.h" 22 #include "referenceCount.h" 24 #include "cullResult.h" 25 #include "sceneSetup.h" 26 #include "pointerTo.h" 27 #include "cycleData.h" 28 #include "cycleDataLockedReader.h" 29 #include "cycleDataReader.h" 30 #include "cycleDataWriter.h" 31 #include "cycleDataStageWriter.h" 32 #include "pipelineCycler.h" 33 #include "config_display.h" 35 #include "deletedChain.h" 37 #include "pStatCollector.h" 38 #include "cullTraverser.h" 39 #include "callbackObject.h" 76 INLINE
int get_num_regions()
const;
77 INLINE
void set_num_regions(
int i);
78 INLINE
void get_dimensions(PN_stdfloat &l, PN_stdfloat &r, PN_stdfloat &b, PN_stdfloat &t)
const;
79 INLINE
void get_dimensions(
int i, PN_stdfloat &l, PN_stdfloat &r, PN_stdfloat &b, PN_stdfloat &t)
const;
80 INLINE
LVecBase4 get_dimensions(
int i = 0)
const;
81 INLINE PN_stdfloat get_left(
int i = 0)
const;
82 INLINE PN_stdfloat get_right(
int i = 0)
const;
83 INLINE PN_stdfloat get_bottom(
int i = 0)
const;
84 INLINE PN_stdfloat get_top(
int i = 0)
const;
85 INLINE
void set_dimensions(PN_stdfloat l, PN_stdfloat r, PN_stdfloat b, PN_stdfloat t);
86 INLINE
void set_dimensions(
int i, PN_stdfloat l, PN_stdfloat r, PN_stdfloat b, PN_stdfloat t);
87 INLINE
void set_dimensions(
const LVecBase4 &dimensions);
88 virtual void set_dimensions(
int i,
const LVecBase4 &dimensions);
92 virtual bool is_stereo()
const;
94 virtual void set_camera(
const NodePath &camera);
97 virtual void set_active(
bool active);
98 INLINE
bool is_active()
const;
100 virtual void set_sort(
int sort);
101 INLINE
int get_sort()
const;
103 virtual void set_stereo_channel(Lens::StereoChannel stereo_channel);
104 INLINE Lens::StereoChannel get_stereo_channel()
const;
105 virtual void set_tex_view_offset(
int tex_view_offset);
106 INLINE
int get_tex_view_offset()
const;
108 virtual void set_incomplete_render(
bool incomplete_render);
109 INLINE
bool get_incomplete_render()
const;
111 virtual void set_texture_reload_priority(
int texture_reload_priority);
112 INLINE
int get_texture_reload_priority()
const;
114 void set_lens_index(
int index);
115 INLINE
int get_lens_index()
const;
120 INLINE
void set_cube_map_index(
int cube_map_index);
121 virtual void set_target_tex_page(
int page);
122 INLINE
int get_target_tex_page()
const;
124 INLINE
void set_scissor_enabled(
bool scissor_enabled);
125 INLINE
bool get_scissor_enabled()
const;
128 INLINE
void clear_cull_callback();
132 INLINE
void clear_draw_callback();
135 INLINE
int get_pixel_width(
int i = 0)
const;
136 INLINE
int get_pixel_height(
int i = 0)
const;
138 virtual void output(ostream &out)
const;
140 static Filename make_screenshot_filename(
141 const string &prefix =
"screenshot");
142 Filename save_screenshot_default(
const string &prefix =
"screenshot");
143 bool save_screenshot(
144 const Filename &filename,
const string &image_comment =
"");
145 bool get_screenshot(
PNMImage &image);
148 virtual PT(
PandaNode) make_cull_result_graph();
151 void compute_pixels();
152 void compute_pixels_all_stages();
153 void compute_pixels(
int x_size,
int y_size);
154 void compute_pixels_all_stages(
int x_size,
int y_size);
155 INLINE
void get_pixels(
int &pl,
int &pr,
int &pb,
int &pt)
const;
156 INLINE
void get_pixels(
int i,
int &pl,
int &pr,
int &pb,
int &pt)
const;
157 INLINE
void get_region_pixels(
int &xo,
int &yo,
int &w,
int &h)
const;
158 INLINE
void get_region_pixels(
int i,
int &xo,
int &yo,
int &w,
int &h)
const;
159 INLINE
void get_region_pixels_i(
int &xo,
int &yo,
int &w,
int &h)
const;
160 INLINE
void get_region_pixels_i(
int i,
int &xo,
int &yo,
int &w,
int &h)
const;
179 typedef epvector<Region> Regions;
184 void win_display_regions_changed();
185 void do_compute_pixels(
int i,
int x_size,
int y_size, CData *cdata);
186 void set_active_index(
int index);
197 bool _incomplete_render;
198 int _texture_reload_priority;
208 class EXPCL_PANDA_DISPLAY CData :
public CycleData {
211 CData(
const CData ©);
215 return DisplayRegion::get_class_type();
227 Lens::StereoChannel _stereo_channel;
228 int _tex_view_offset;
229 int _target_tex_page;
230 bool _scissor_enabled;
248 class EXPCL_PANDA_DISPLAY CDataCull :
public CycleData {
251 CDataCull(
const CDataCull ©);
255 return DisplayRegion::get_class_type();
272 static void init_type() {
273 DisplayRegionBase::init_type();
274 register_type(_type_handle,
"DisplayRegion",
275 DisplayRegionBase::get_class_type());
278 return get_class_type();
280 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
300 INLINE DisplayRegionPipelineReader(
const DisplayRegionPipelineReader ©);
301 INLINE
void operator = (
const DisplayRegionPipelineReader ©);
304 INLINE ~DisplayRegionPipelineReader();
305 ALLOC_DELETED_CHAIN(DisplayRegionPipelineReader);
308 INLINE
Thread *get_current_thread()
const;
310 INLINE
bool is_any_clear_active()
const;
312 INLINE
int get_num_regions()
const;
313 INLINE
void get_dimensions(PN_stdfloat &l, PN_stdfloat &r, PN_stdfloat &b, PN_stdfloat &t)
const;
314 INLINE
void get_dimensions(
int i, PN_stdfloat &l, PN_stdfloat &r, PN_stdfloat &b, PN_stdfloat &t)
const;
315 INLINE
const LVecBase4 &get_dimensions(
int i = 0)
const;
316 INLINE PN_stdfloat get_left(
int i = 0)
const;
317 INLINE PN_stdfloat get_right(
int i = 0)
const;
318 INLINE PN_stdfloat get_bottom(
int i = 0)
const;
319 INLINE PN_stdfloat get_top(
int i = 0)
const;
325 INLINE
bool is_active()
const;
326 INLINE
int get_sort()
const;
327 INLINE Lens::StereoChannel get_stereo_channel()
const;
328 INLINE
int get_tex_view_offset();
329 INLINE
bool get_clear_depth_between_eyes()
const;
330 INLINE
int get_target_tex_page()
const;
331 INLINE
bool get_scissor_enabled()
const;
334 INLINE
void get_pixels(
int &pl,
int &pr,
int &pb,
int &pt)
const;
335 INLINE
void get_pixels(
int i,
int &pl,
int &pr,
int &pb,
int &pt)
const;
336 INLINE
void get_region_pixels(
int &xo,
int &yo,
int &w,
int &h)
const;
337 INLINE
void get_region_pixels(
int i,
int &xo,
int &yo,
int &w,
int &h)
const;
338 INLINE
void get_region_pixels_i(
int &xo,
int &yo,
int &w,
int &h)
const;
339 INLINE
void get_region_pixels_i(
int i,
int &xo,
int &yo,
int &w,
int &h)
const;
341 INLINE
int get_pixel_width(
int i = 0)
const;
342 INLINE
int get_pixel_height(
int i = 0)
const;
344 INLINE
int get_lens_index()
const;
349 const DisplayRegion::CData *_cdata;
355 static void init_type() {
356 register_type(_type_handle,
"DisplayRegionPipelineReader");
363 #include "displayRegion.I" A basic node of the scene graph or data graph.
Encapsulates the data from a DisplayRegion, pre-fetched for one stage of the pipeline.
This is a base class for GraphicsWindow (actually, GraphicsOutput) and DisplayRegion, both of which are conceptually rectangular regions into which drawing commands may be issued.
The name of this class derives from the fact that we originally implemented it as a layer on top of t...
This class is similar to CycleDataWriter, except it allows writing to a particular stage of the pipel...
A single page of data maintained by a PipelineCycler.
Represents a texture object, which is typically a single 2-d image but may also represent a 1-d or 3-...
This is the base class for all three-component vectors and points.
This specialization on CallbackData is passed when the callback is initiated from the cull traversal...
static Thread * get_current_thread()
Returns a pointer to the currently-executing Thread object.
This template class calls PipelineCycler::read_unlocked(), and then provides a transparent read-only ...
A lightweight class that represents a single element that may be timed and/or counted via stats...
This defines the abstract interface for an object that receives Geoms identified by the CullTraverser...
The name of a file, such as a texture file or an Egg file.
virtual bool supports_pixel_zoom() const
Returns true if a call to set_pixel_zoom() will be respected, false if it will be ignored...
An object to create GraphicsOutputs that share a particular 3-D API.
This template class calls PipelineCycler::read() in the constructor and PipelineCycler::release_read(...
This template class calls PipelineCycler::write() in the constructor and PipelineCycler::release_writ...
This is a base class for the various different classes that represent the result of a frame of render...
This is a generic object that can be assigned to a callback at various points in the rendering proces...
This is the base class for all three-component vectors and points.
This stores the result of a BinCullHandler traversal: an ordered collection of CullBins, each of which holds a number of Geoms and RenderStates to be rendered in some defined order.
A thread; that is, a lightweight process.
Encapsulates all the communication with a particular instance of a given rendering backend...
A rectangular subregion within a window for rendering into.
An abstract base class for DisplayRegion, mainly so we can store DisplayRegion pointers in a Camera...
This class is the main interface to controlling the render process.
TypeHandle is the identifier used to differentiate C++ class types.
This object holds the camera position, etc., and other general setup information for rendering a part...
A node that can be positioned around in the scene graph to represent a point of view for rendering a ...
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
This object performs a depth-first traversal of the scene graph, with optional view-frustum culling...