Panda3D
Loading...
Searching...
No Matches
displayRegion.I
Go to the documentation of this file.
1/**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file displayRegion.I
10 * @author frang
11 * @date 1999-03-07
12 */
13
14/**
15 * Returns true if this DisplayRegion should be sorted before the other one,
16 * false otherwise.
17 */
18INLINE bool DisplayRegion::
19operator < (const DisplayRegion &other) const {
20 return get_sort() < other.get_sort();
21}
22
23/**
24 * Returns the specific lens of the associated Camera that will be used for
25 * rendering this scene. Most Cameras hold only one lens, but for multiple
26 * lenses this method may be used to selected between them.
27 */
28INLINE int DisplayRegion::
29get_lens_index() const {
30 CDReader cdata(_cycler);
31 return cdata->_lens_index;
32}
33
34/**
35 * Returns the number of regions, see set_num_regions.
36 */
38get_num_regions() const {
39 CDReader cdata(_cycler);
40 return cdata->_regions.size();
41}
42
43/**
44 * Sets the number of regions that this DisplayRegion indicates. Usually,
45 * this number is 1 (and it is always at least 1), and only the first is used
46 * for rendering. However, if more than one is provided, you may select which
47 * one to render into using a geometry shader (gl_ViewportIndex in GLSL).
48 */
49INLINE void DisplayRegion::
50set_num_regions(int i) {
51 nassertv(i >= 1);
52 CDWriter cdata(_cycler);
53 cdata->_regions.resize(i);
54}
55
56/**
57 * Retrieves the coordinates of the DisplayRegion's rectangle within its
58 * GraphicsOutput. These numbers will be in the range [0..1].
59 */
60INLINE void DisplayRegion::
61get_dimensions(PN_stdfloat &l, PN_stdfloat &r, PN_stdfloat &b, PN_stdfloat &t) const {
62 get_dimensions(0, l, r, b, t);
63}
64
65/**
66 * Retrieves the coordinates of the DisplayRegion's rectangle within its
67 * GraphicsOutput. These numbers will be in the range [0..1].
68 */
69INLINE void DisplayRegion::
70get_dimensions(int i, PN_stdfloat &l, PN_stdfloat &r, PN_stdfloat &b, PN_stdfloat &t) const {
71 CDReader cdata(_cycler);
72 const Region &region = cdata->_regions[i];
73 l = region._dimensions[0];
74 r = region._dimensions[1];
75 b = region._dimensions[2];
76 t = region._dimensions[3];
77}
78
79/**
80 * Retrieves the coordinates of the DisplayRegion's rectangle within its
81 * GraphicsOutput. These numbers will be in the range [0..1].
82 */
83INLINE LVecBase4 DisplayRegion::
84get_dimensions(int i) const {
85 CDReader cdata(_cycler);
86 return cdata->_regions[i]._dimensions;
87}
88
89/**
90 * Retrieves the x coordinate of the left edge of the rectangle within its
91 * GraphicsOutput. This number will be in the range [0..1].
92 */
93INLINE PN_stdfloat DisplayRegion::
94get_left(int i) const {
95 CDReader cdata(_cycler);
96 return cdata->_regions[i]._dimensions[0];
97}
98
99/**
100 * Retrieves the x coordinate of the right edge of the rectangle within its
101 * GraphicsOutput. This number will be in the range [0..1].
102 */
103INLINE PN_stdfloat DisplayRegion::
104get_right(int i) const {
105 CDReader cdata(_cycler);
106 return cdata->_regions[i]._dimensions[1];
107}
108
109/**
110 * Retrieves the y coordinate of the bottom edge of the rectangle within its
111 * GraphicsOutput. This number will be in the range [0..1].
112 */
113INLINE PN_stdfloat DisplayRegion::
114get_bottom(int i) const {
115 CDReader cdata(_cycler);
116 return cdata->_regions[i]._dimensions[2];
117}
118
119/**
120 * Retrieves the y coordinate of the top edge of the rectangle within its
121 * GraphicsOutput. This number will be in the range [0..1].
122 */
123INLINE PN_stdfloat DisplayRegion::
124get_top(int i) const {
125 CDReader cdata(_cycler);
126 return cdata->_regions[i]._dimensions[3];
127}
128
129/**
130 * Changes the portion of the framebuffer this DisplayRegion corresponds to.
131 * The parameters range from 0 to 1, where 0,0 is the lower left corner and
132 * 1,1 is the upper right; (0, 1, 0, 1) represents the whole screen.
133 */
134INLINE void DisplayRegion::
135set_dimensions(PN_stdfloat l, PN_stdfloat r, PN_stdfloat b, PN_stdfloat t) {
136 set_dimensions(0, LVecBase4(l, r, b, t));
137}
138
139/**
140 * Changes the portion of the framebuffer this DisplayRegion corresponds to.
141 * The parameters range from 0 to 1, where 0,0 is the lower left corner and
142 * 1,1 is the upper right; (0, 1, 0, 1) represents the whole screen.
143 */
144INLINE void DisplayRegion::
145set_dimensions(int i, PN_stdfloat l, PN_stdfloat r, PN_stdfloat b, PN_stdfloat t) {
146 set_dimensions(i, LVecBase4(l, r, b, t));
147}
148
149/**
150 * Changes the portion of the framebuffer this DisplayRegion corresponds to.
151 * The parameters range from 0 to 1, where 0,0 is the lower left corner and
152 * 1,1 is the upper right; (0, 1, 0, 1) represents the whole screen.
153 */
154INLINE void DisplayRegion::
155set_dimensions(const LVecBase4 &dimensions) {
156 set_dimensions(0, dimensions);
157}
158
159/**
160 * Returns the GraphicsOutput that this DisplayRegion is ultimately associated
161 * with, or NULL if no window is associated.
162 */
164get_window() const {
165 return _window;
166}
167
168/**
169 * Returns the camera associated with this DisplayRegion, or an empty NodePath
170 * if no camera is associated.
171 */
173get_camera(Thread *current_thread) const {
174 CDReader cdata(_cycler, current_thread);
175 return cdata->_camera;
176}
177
178/**
179 * Returns the active flag associated with the DisplayRegion.
180 */
181INLINE bool DisplayRegion::
182is_active() const {
183 CDReader cdata(_cycler);
184 return cdata->_active;
185}
186
187/**
188 * Returns the sort value associated with the DisplayRegion.
189 */
190INLINE int DisplayRegion::
191get_sort() const {
192 CDReader cdata(_cycler);
193 return cdata->_sort;
194}
195
196/**
197 * Returns whether the DisplayRegion is specified as the left or right channel
198 * of a stereo pair, or whether it is a normal, monocular image. See
199 * set_stereo_channel().
200 */
201INLINE Lens::StereoChannel DisplayRegion::
202get_stereo_channel() const {
203 CDReader cdata(_cycler);
204 return cdata->_stereo_channel;
205}
206
207/**
208 * Returns the current texture view offset for this DisplayRegion. This is
209 * normally set to zero. If nonzero, it is used to select a particular view
210 * of any multiview textures that are rendered within this DisplayRegion.
211 *
212 * For a StereoDisplayRegion, this is normally 0 for the left eye, and 1 for
213 * the right eye, to support stereo textures.
214 */
215INLINE int DisplayRegion::
216get_tex_view_offset() const {
217 CDReader cdata(_cycler);
218 return cdata->_tex_view_offset;
219}
220
221/**
222 * Returns the incomplete_render flag. See set_incomplete_render().
223 */
224INLINE bool DisplayRegion::
225get_incomplete_render() const {
226 return _incomplete_render;
227}
228
229/**
230 * Returns the priority which is assigned to asynchronous texture reload
231 * requests. See set_texture_reload_priority().
232 */
233INLINE int DisplayRegion::
235 return _texture_reload_priority;
236}
237
238/**
239 * Deprecated; replaced by set_target_tex_page().
240 */
242set_cube_map_index(int cube_map_index) {
243 set_target_tex_page(cube_map_index);
244}
245
246/**
247 * Returns the target page number associated with this particular
248 * DisplayRegion, or -1 if it is not associated with a page. See
249 * set_target_tex_page().
250 */
251INLINE int DisplayRegion::
252get_target_tex_page() const {
253 CDReader cdata(_cycler);
254 return cdata->_target_tex_page;
255}
256
257/**
258 * Sets whether or not scissor testing is enabled for this region. The
259 * default is true, except for the overlay display region.
260 */
261INLINE void DisplayRegion::
262set_scissor_enabled(bool scissor_enabled) {
263 CDWriter cdata(_cycler);
264 cdata->_scissor_enabled = scissor_enabled;
265}
266
267/**
268 * Returns whether or not scissor testing is enabled for this region. The
269 * default is true, except for the overlay display region.
270 */
271INLINE bool DisplayRegion::
272get_scissor_enabled() const {
273 CDReader cdata(_cycler);
274 return cdata->_scissor_enabled;
275}
276
277/**
278 * Sets the CallbackObject that will be notified when the DisplayRegion is
279 * visited during the cull traversal. This callback will be made during the
280 * cull thread.
281 *
282 * The cull traversal is responsible for determining which nodes are visible
283 * and within the view frustum, and for accumulating state and transform, and
284 * generally building up the list of CullableObjects that are to be eventually
285 * passed to the draw traversal for rendering.
286 *
287 * At the time the cull traversal callback is made, the traversal for this
288 * DisplayRegion has not yet started.
289 *
290 * The callback is passed an instance of a DisplayRegionCullCallbackData,
291 * which contains pointers to the current scene information, as well as the
292 * current DisplayRegion and GSG. The callback *replaces* the normal cull
293 * behavior, so if your callback does nothing, the scene graph will not be
294 * traversed and therefore nothing will be drawn. If you wish the normal cull
295 * traversal to be performed for this DisplayRegion, you must call
296 * cbdata->upcall() from your callback.
297 */
298INLINE void DisplayRegion::
300 CDWriter cdata(_cycler);
301 cdata->_cull_callback = object;
302}
303
304/**
305 * Removes the callback set by an earlier call to set_cull_callback().
306 */
309 set_cull_callback(nullptr);
310}
311
312/**
313 * Returns the CallbackObject set by set_cull_callback().
314 */
316get_cull_callback() const {
317 CDReader cdata(_cycler);
318 return cdata->_cull_callback;
319}
320
321/**
322 * Sets the CallbackObject that will be notified when the contents of
323 * DisplayRegion is drawn during the draw traversal. This callback will be
324 * made during the draw thread.
325 *
326 * The draw traversal is responsible for actually issuing the commands to the
327 * graphics engine to draw primitives. Its job is to walk through the list of
328 * CullableObjects build up by the cull traversal, as quickly as possible,
329 * issuing the appropriate commands to draw each one.
330 *
331 * At the time the draw traversal callback is made, the graphics state is in
332 * the initial state, and no projection matrix or modelview matrix is in
333 * effect. begin_scene() has not yet been called, and no objects have yet
334 * been drawn. However, the viewport has already been set to the appropriate
335 * part of the window, and the clear commands for this DisplayRegion (if any)
336 * have been issued.
337 *
338 * The callback is passed an instance of a DisplayRegionDrawCallbackData,
339 * which contains pointers to the current scene information, as well as the
340 * current DisplayRegion and GSG. The callback *replaces* the normal draw
341 * behavior, so if your callback does nothing, nothing in the DisplayRegion
342 * will be drawn. If you wish the draw traversal to continue to draw the
343 * contents of this DisplayRegion, you must call cbdata->upcall() from your
344 * callback.
345 */
346INLINE void DisplayRegion::
348 CDWriter cdata(_cycler);
349 cdata->_draw_callback = object;
350}
351
352/**
353 * Removes the callback set by an earlier call to set_draw_callback().
354 */
357 set_draw_callback(nullptr);
358}
359
360/**
361 * Returns the CallbackObject set by set_draw_callback().
362 */
364get_draw_callback() const {
365 CDReader cdata(_cycler);
366 return cdata->_draw_callback;
367}
368
369/**
370 * Returns the width of the DisplayRegion in pixels.
371 */
373get_pixel_width(int i) const {
374 CDReader cdata(_cycler);
375 return cdata->_regions[i]._pixels[1] - cdata->_regions[i]._pixels[0];
376}
377
378/**
379 * Returns the height of the DisplayRegion in pixels.
380 */
382get_pixel_height(int i) const {
383 CDReader cdata(_cycler);
384 return cdata->_regions[i]._pixels[3] - cdata->_regions[i]._pixels[2];
385}
386
387/**
388 * Returns the size of the DisplayRegion in pixels.
389 */
390INLINE LVecBase2i DisplayRegion::
391get_pixel_size(int i) const {
392 CDReader cdata(_cycler);
393 return LVecBase2i(cdata->_regions[i]._pixels[1] - cdata->_regions[i]._pixels[0],
394 cdata->_regions[i]._pixels[3] - cdata->_regions[i]._pixels[2]);
395}
396
397/**
398 * Retrieves the coordinates of the DisplayRegion within its window, in
399 * pixels.
400 */
402get_pixels(int &pl, int &pr, int &pb, int &pt) const {
403 get_pixels(0, pl, pr, pb, pt);
404}
405
406/**
407 * Retrieves the coordinates of the DisplayRegion within its window, in
408 * pixels.
409 */
411get_pixels(int i, int &pl, int &pr, int &pb, int &pt) const {
412 CDReader cdata(_cycler);
413 const Region &region = cdata->_regions[i];
414 pl = region._pixels[0];
415 pr = region._pixels[1];
416 pb = region._pixels[2];
417 pt = region._pixels[3];
418}
419
420/**
421 * Retrieves the coordinates of the DisplayRegion within its window, as the
422 * pixel location of its bottom-left corner, along with a pixel width and
423 * height.
424 */
426get_region_pixels(int &xo, int &yo, int &w, int &h) const {
427 get_region_pixels(0, xo, yo, w, h);
428}
429
430/**
431 * Retrieves the coordinates of the DisplayRegion within its window, as the
432 * pixel location of its bottom-left corner, along with a pixel width and
433 * height.
434 */
436get_region_pixels(int i, int &xo, int &yo, int &w, int &h) const {
437 CDReader cdata(_cycler);
438 const Region &region = cdata->_regions[i];
439 xo = region._pixels[0];
440 yo = region._pixels[2];
441 w = region._pixels[1] - xo;
442 h = region._pixels[3] - yo;
443}
444
445/**
446 * Similar to get_region_pixels(), but returns the upper left corner, and the
447 * pixel numbers are numbered from the top-left corner down, in the DirectX
448 * way of things.
449 */
451get_region_pixels_i(int &xo, int &yo, int &w, int &h) const {
452 get_region_pixels_i(0, xo, yo, w, h);
453}
454
455/**
456 * Similar to get_region_pixels(), but returns the upper left corner, and the
457 * pixel numbers are numbered from the top-left corner down, in the DirectX
458 * way of things.
459 */
461get_region_pixels_i(int i, int &xo, int &yo, int &w, int &h) const {
462 CDReader cdata(_cycler);
463 const Region &region = cdata->_regions[i];
464 xo = region._pixels_i[0];
465 yo = region._pixels_i[3];
466 w = region._pixels_i[1] - xo;
467 h = region._pixels_i[2] - yo;
468}
469
470/**
471 * Stores the result of performing a cull operation on this DisplayRegion.
472 * Normally, this will only be called by the GraphicsEngine; you should not
473 * call this directly.
474 *
475 * The stored result will automatically be applied back to all upstream
476 * pipeline stages.
477 */
479set_cull_result(PT(CullResult) cull_result, PT(SceneSetup) scene_setup,
480 Thread *current_thread) {
481 CDCullWriter cdata(_cycler_cull, true, current_thread);
482 cdata->_cull_result = std::move(cull_result);
483 cdata->_scene_setup = std::move(scene_setup);
484}
485
486/**
487 * Returns the CullResult value that was stored on this DisplayRegion,
488 * presumably by the last successful cull operation. This method is for the
489 * benefit of the GraphicsEngine; normally you shouldn't call this directly.
490 */
492get_cull_result(Thread *current_thread) const {
493 CDCullReader cdata(_cycler_cull, current_thread);
494 return cdata->_cull_result;
495}
496
497/**
498 * Returns the SceneSetup value that was stored on this DisplayRegion,
499 * presumably by the last successful cull operation. This method is for the
500 * benefit of the GraphicsEngine; normally you shouldn't call this directly.
501 */
503get_scene_setup(Thread *current_thread) const {
504 CDCullReader cdata(_cycler_cull, current_thread);
505 return cdata->_scene_setup;
506}
507
508/**
509 * Returns a PStatCollector for timing the cull operation for just this
510 * DisplayRegion.
511 */
514 return _cull_region_pcollector;
515}
516
517/**
518 * Returns a PStatCollector for timing the draw operation for just this
519 * DisplayRegion.
520 */
523 return _draw_region_pcollector;
524}
525
526/**
527 * Returns a unique name used for debugging.
528 */
529INLINE const std::string &DisplayRegion::
530get_debug_name() const {
531 return _debug_name;
532}
533
534/**
535 *
536 */
537INLINE DisplayRegion::Region::
538Region() :
539 _dimensions(0, 1, 0, 1),
540 _pixels(0),
541 _pixels_i(0) {
542}
543
544/**
545 *
546 */
547INLINE DisplayRegion::CDataCull::
548CDataCull() {
549}
550
551/**
552 *
553 */
554INLINE DisplayRegion::CDataCull::
555CDataCull(const DisplayRegion::CDataCull &copy) :
556 _cull_result(copy._cull_result),
557 _scene_setup(copy._scene_setup)
558{
559}
560
561/**
562 *
563 */
564INLINE DisplayRegionPipelineReader::
565DisplayRegionPipelineReader(DisplayRegion *object, Thread *current_thread) :
566 _object(object),
567 _current_thread(current_thread),
568 _cdata(object->_cycler.read(current_thread))
569{
570#ifdef _DEBUG
571 nassertv(_object->test_ref_count_nonzero());
572#ifdef DO_PIPELINING
573 nassertv(_cdata->test_ref_count_nonzero());
574#endif // DO_PIPELINING
575#endif // _DEBUG
576}
577
578/**
579 *
580 */
581INLINE DisplayRegionPipelineReader::
582~DisplayRegionPipelineReader() {
583#ifdef _DEBUG
584 nassertv(_object->test_ref_count_nonzero());
585#ifdef DO_PIPELINING
586 nassertv(_cdata->test_ref_count_nonzero());
587#endif // DO_PIPELINING
588#endif // _DEBUG
589 _object->_cycler.release_read(_cdata);
590
591#ifdef _DEBUG
592 _object = nullptr;
593 _cdata = nullptr;
594#endif // _DEBUG
595}
596
597/**
598 *
599 */
600INLINE DisplayRegion *DisplayRegionPipelineReader::
601get_object() const {
602 return _object;
603}
604
605/**
606 *
607 */
608INLINE Thread *DisplayRegionPipelineReader::
609get_current_thread() const {
610 return _current_thread;
611}
612
613/**
614 *
615 */
616INLINE bool DisplayRegionPipelineReader::
617is_any_clear_active() const {
618 return _object->is_any_clear_active();
619}
620
621/**
622 * Returns the number of regions, see set_num_regions.
623 */
625get_num_regions() const {
626 return _cdata->_regions.size();
627}
628
629/**
630 * Retrieves the coordinates of the DisplayRegion's rectangle within its
631 * GraphicsOutput. These numbers will be in the range [0..1].
632 */
634get_dimensions(PN_stdfloat &l, PN_stdfloat &r, PN_stdfloat &b, PN_stdfloat &t) const {
635 return get_dimensions(0, l, r, b, t);
636}
637
638/**
639 * Retrieves the coordinates of the DisplayRegion's rectangle within its
640 * GraphicsOutput. These numbers will be in the range [0..1].
641 */
643get_dimensions(int i, PN_stdfloat &l, PN_stdfloat &r, PN_stdfloat &b, PN_stdfloat &t) const {
644 const DisplayRegion::Region &region = _cdata->_regions[i];
645 l = region._dimensions[0];
646 r = region._dimensions[1];
647 b = region._dimensions[2];
648 t = region._dimensions[3];
649}
650
651/**
652 * Retrieves the coordinates of the DisplayRegion's rectangle within its
653 * GraphicsOutput. These numbers will be in the range [0..1].
654 */
655INLINE const LVecBase4 &DisplayRegionPipelineReader::
656get_dimensions(int i) const {
657 return _cdata->_regions[i]._dimensions;
658}
659
660/**
661 * Retrieves the x coordinate of the left edge of the rectangle within its
662 * GraphicsOutput. This number will be in the range [0..1].
663 */
665get_left(int i) const {
666 return _cdata->_regions[i]._dimensions[0];
667}
668
669/**
670 * Retrieves the x coordinate of the right edge of the rectangle within its
671 * GraphicsOutput. This number will be in the range [0..1].
672 */
674get_right(int i) const {
675 return _cdata->_regions[i]._dimensions[1];
676}
677
678/**
679 * Retrieves the y coordinate of the bottom edge of the rectangle within its
680 * GraphicsOutput. This number will be in the range [0..1].
681 */
683get_bottom(int i) const {
684 return _cdata->_regions[i]._dimensions[2];
685}
686
687/**
688 * Retrieves the y coordinate of the top edge of the rectangle within its
689 * GraphicsOutput. This number will be in the range [0..1].
690 */
692get_top(int i) const {
693 return _cdata->_regions[i]._dimensions[3];
694}
695
696/**
697 * Returns the GraphicsOutput that this DisplayRegion is ultimately associated
698 * with, or NULL if no window is associated.
699 */
701get_window() const {
702 return _object->_window;
703}
704
705/**
706 * Returns the camera associated with this DisplayRegion, or an empty NodePath
707 * if no camera is associated.
708 */
710get_camera() const {
711 return _cdata->_camera;
712}
713
714/**
715 * Returns the active flag associated with the DisplayRegion.
716 */
718is_active() const {
719 return _cdata->_active;
720}
721
722/**
723 * Returns the sort value associated with the DisplayRegion.
724 */
726get_sort() const {
727 return _cdata->_sort;
728}
729
730/**
731 * Returns whether the DisplayRegion is specified as the left or right channel
732 * of a stereo pair, or whether it is a normal, monocular image. See
733 * set_stereo_channel().
734 */
735INLINE Lens::StereoChannel DisplayRegionPipelineReader::
736get_stereo_channel() const {
737 return _cdata->_stereo_channel;
738}
739
740/**
741 * Returns the current texture view offset for this DisplayRegion. This is
742 * normally set to zero. If nonzero, it is used to select a particular view
743 * of any multiview textures that are rendered within this DisplayRegion.
744 *
745 * For a StereoDisplayRegion, this is normally 0 for the left eye, and 1 for
746 * the right eye, to support stereo textures.
747 */
750 return _cdata->_tex_view_offset;
751}
752
753/**
754 * Returns the target page number associated with this particular
755 * DisplayRegion, or -1 if it is not associated with a page. See
756 * set_target_tex_page().
757 */
759get_target_tex_page() const {
760 return _cdata->_target_tex_page;
761}
762
763/**
764 * Returns whether or not scissor testing is enabled for this region. The
765 * default is true, except for the overlay display region.
766 */
768get_scissor_enabled() const {
769 return _cdata->_scissor_enabled;
770}
771
772/**
773 * Returns the CallbackObject set by set_draw_callback().
774 */
776get_draw_callback() const {
777 return _cdata->_draw_callback;
778}
779
780/**
781 * Retrieves the coordinates of the DisplayRegion within its window, in
782 * pixels.
783 */
785get_pixels(int &pl, int &pr, int &pb, int &pt) const {
786 get_pixels(0, pl, pr, pb, pt);
787}
788
789/**
790 * Retrieves the coordinates of the DisplayRegion within its window, in
791 * pixels.
792 */
794get_pixels(int i, int &pl, int &pr, int &pb, int &pt) const {
795 const DisplayRegion::Region &region = _cdata->_regions[i];
796 pl = region._pixels[0];
797 pr = region._pixels[1];
798 pb = region._pixels[2];
799 pt = region._pixels[3];
800}
801
802/**
803 * Retrieves the coordinates of the DisplayRegion within its window, as the
804 * pixel location of its bottom-left corner, along with a pixel width and
805 * height.
806 */
808get_region_pixels(int &xo, int &yo, int &w, int &h) const {
809 get_region_pixels(0, xo, yo, w, h);
810}
811
812/**
813 * Retrieves the coordinates of the DisplayRegion within its window, as the
814 * pixel location of its bottom-left corner, along with a pixel width and
815 * height.
816 */
818get_region_pixels(int i, int &xo, int &yo, int &w, int &h) const {
819 const DisplayRegion::Region &region = _cdata->_regions[i];
820 xo = region._pixels[0];
821 yo = region._pixels[2];
822 w = region._pixels[1] - xo;
823 h = region._pixels[3] - yo;
824}
825
826/**
827 * Similar to get_region_pixels(), but returns the upper left corner, and the
828 * pixel numbers are numbered from the top-left corner down, in the DirectX
829 * way of things.
830 */
832get_region_pixels_i(int &xo, int &yo, int &w, int &h) const {
833 get_region_pixels_i(0, xo, yo, w, h);
834}
835
836/**
837 * Similar to get_region_pixels(), but returns the upper left corner, and the
838 * pixel numbers are numbered from the top-left corner down, in the DirectX
839 * way of things.
840 */
842get_region_pixels_i(int i, int &xo, int &yo, int &w, int &h) const {
843 const DisplayRegion::Region &region = _cdata->_regions[i];
844 xo = region._pixels_i[0];
845 yo = region._pixels_i[3];
846 w = region._pixels_i[1] - xo;
847 h = region._pixels_i[2] - yo;
848}
849
850/**
851 * Returns the width of the DisplayRegion in pixels.
852 */
854get_pixel_width(int i) const {
855 return _cdata->_regions[i]._pixels[1] - _cdata->_regions[i]._pixels[0];
856}
857
858/**
859 * Gets the index into a lens_node lens array. 0 default
860 */
862get_lens_index() const {
863 return _cdata->_lens_index;
864}
865
866/**
867 * Returns the height of the DisplayRegion in pixels.
868 */
870get_pixel_height(int i) const {
871 return _cdata->_regions[i]._pixels[3] - _cdata->_regions[i]._pixels[2];
872}
873
874INLINE std::ostream &
875operator << (std::ostream &out, const DisplayRegion &dr) {
876 dr.output(out);
877 return out;
878}
This is a generic object that can be assigned to a callback at various points in the rendering proces...
This stores the result of a BinCullHandler traversal: an ordered collection of CullBins,...
Definition cullResult.h:44
This template class calls PipelineCycler::read_unlocked(), and then provides a transparent read-only ...
This template class calls PipelineCycler::write() in the constructor and PipelineCycler::release_writ...
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...
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.
void set_cull_result(PT(CullResult) cull_result, PT(SceneSetup) scene_setup, Thread *current_thread)
Stores the result of performing a cull operation on this DisplayRegion.
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...
PN_stdfloat get_left(int i=0) const
Retrieves the x coordinate of the left edge of the rectangle within its GraphicsOutput.
PN_stdfloat get_bottom(int i=0) const
Retrieves the y coordinate of the bottom edge of the rectangle within its GraphicsOutput.
set_target_tex_page
This is a special parameter that is only used when rendering the faces of a cube map or multipage and...
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.
bool operator<(const DisplayRegion &other) const
Returns true if this DisplayRegion should be sorted before the other one, false otherwise.
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...
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,...
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.
void set_cube_map_index(int cube_map_index)
Deprecated; replaced by set_target_tex_page().
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_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_draw_callback
Sets the CallbackObject that will be notified when the contents of DisplayRegion is drawn during the ...
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.
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...
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,...
This is a base class for the various different classes that represent the result of a frame of render...
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
Definition nodePath.h:159
A lightweight class that represents a single element that may be timed and/or counted via stats.
bool test_ref_count_nonzero() const
Does some easy checks to make sure that the reference count isn't zero, or completely bogus.
This object holds the camera position, etc., and other general setup information for rendering a part...
Definition sceneSetup.h:32
A thread; that is, a lightweight process.
Definition thread.h:46
void release_read(const CycleData *pointer) const
Releases a pointer previously obtained via a call to read().