00001 // Filename: displayRegion.I 00002 // Created by: frang (07Mar99) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 00016 //////////////////////////////////////////////////////////////////// 00017 // Function: DisplayRegion::operator < 00018 // Access: Public 00019 // Description: Returns true if this DisplayRegion should be sorted 00020 // before the other one, false otherwise. 00021 //////////////////////////////////////////////////////////////////// 00022 INLINE bool DisplayRegion:: 00023 operator < (const DisplayRegion &other) const { 00024 return get_sort() < other.get_sort(); 00025 } 00026 00027 //////////////////////////////////////////////////////////////////// 00028 // Function: DisplayRegion::get_lens_index 00029 // Access: Public 00030 // Description: Returns the specific lens of the associated Camera 00031 // that will be used for rendering this scene. Most 00032 // Cameras hold only one lens, but for multiple lenses 00033 // this method may be used to selected between them. 00034 //////////////////////////////////////////////////////////////////// 00035 INLINE int DisplayRegion:: 00036 get_lens_index() const { 00037 CDReader cdata(_cycler); 00038 return cdata->_lens_index; 00039 } 00040 00041 /////////////////////////////////////////////////////////////////// 00042 // Function: DisplayRegion::get_dimensions 00043 // Access: Published 00044 // Description: Retrieves the coordinates of the DisplayRegion's 00045 // rectangle within its GraphicsOutput. These numbers 00046 // will be in the range [0..1]. 00047 //////////////////////////////////////////////////////////////////// 00048 INLINE void DisplayRegion:: 00049 get_dimensions(PN_stdfloat &l, PN_stdfloat &r, PN_stdfloat &b, PN_stdfloat &t) const { 00050 CDReader cdata(_cycler); 00051 l = cdata->_dimensions[0]; 00052 r = cdata->_dimensions[1]; 00053 b = cdata->_dimensions[2]; 00054 t = cdata->_dimensions[3]; 00055 } 00056 00057 /////////////////////////////////////////////////////////////////// 00058 // Function: DisplayRegion::get_dimensions 00059 // Access: Published 00060 // Description: Retrieves the coordinates of the DisplayRegion's 00061 // rectangle within its GraphicsOutput. These numbers 00062 // will be in the range [0..1]. 00063 //////////////////////////////////////////////////////////////////// 00064 INLINE LVecBase4 DisplayRegion:: 00065 get_dimensions() const { 00066 CDReader cdata(_cycler); 00067 return cdata->_dimensions; 00068 } 00069 00070 //////////////////////////////////////////////////////////////////// 00071 // Function: DisplayRegion::get_left 00072 // Access: Published 00073 // Description: Retrieves the x coordinate of the left edge of the 00074 // rectangle within its GraphicsOutput. This number 00075 // will be in the range [0..1]. 00076 //////////////////////////////////////////////////////////////////// 00077 INLINE PN_stdfloat DisplayRegion:: 00078 get_left() const { 00079 CDReader cdata(_cycler); 00080 return cdata->_dimensions[0]; 00081 } 00082 00083 //////////////////////////////////////////////////////////////////// 00084 // Function: DisplayRegion::get_right 00085 // Access: Published 00086 // Description: Retrieves the x coordinate of the right edge of the 00087 // rectangle within its GraphicsOutput. This number 00088 // will be in the range [0..1]. 00089 //////////////////////////////////////////////////////////////////// 00090 INLINE PN_stdfloat DisplayRegion:: 00091 get_right() const { 00092 CDReader cdata(_cycler); 00093 return cdata->_dimensions[1]; 00094 } 00095 00096 //////////////////////////////////////////////////////////////////// 00097 // Function: DisplayRegion::get_bottom 00098 // Access: Published 00099 // Description: Retrieves the y coordinate of the bottom edge of 00100 // the rectangle within its GraphicsOutput. This 00101 // number will be in the range [0..1]. 00102 //////////////////////////////////////////////////////////////////// 00103 INLINE PN_stdfloat DisplayRegion:: 00104 get_bottom() const { 00105 CDReader cdata(_cycler); 00106 return cdata->_dimensions[2]; 00107 } 00108 00109 //////////////////////////////////////////////////////////////////// 00110 // Function: DisplayRegion::get_top 00111 // Access: Published 00112 // Description: Retrieves the y coordinate of the top edge of the 00113 // rectangle within its GraphicsOutput. This number 00114 // will be in the range [0..1]. 00115 //////////////////////////////////////////////////////////////////// 00116 INLINE PN_stdfloat DisplayRegion:: 00117 get_top() const { 00118 CDReader cdata(_cycler); 00119 return cdata->_dimensions[3]; 00120 } 00121 00122 //////////////////////////////////////////////////////////////////// 00123 // Function: DisplayRegion::set_dimensions 00124 // Access: Published, Virtual 00125 // Description: Changes the portion of the framebuffer this 00126 // DisplayRegion corresponds to. The parameters range 00127 // from 0 to 1, where 0,0 is the lower left corner and 00128 // 1,1 is the upper right; (0, 1, 0, 1) represents the 00129 // whole screen. 00130 //////////////////////////////////////////////////////////////////// 00131 INLINE void DisplayRegion:: 00132 set_dimensions(PN_stdfloat l, PN_stdfloat r, PN_stdfloat b, PN_stdfloat t) { 00133 set_dimensions(LVecBase4(l, r, b, t)); 00134 } 00135 00136 //////////////////////////////////////////////////////////////////// 00137 // Function: DisplayRegion::get_window 00138 // Access: Published 00139 // Description: Returns the GraphicsOutput that this DisplayRegion is 00140 // ultimately associated with, or NULL if no window is 00141 // associated. 00142 //////////////////////////////////////////////////////////////////// 00143 INLINE GraphicsOutput *DisplayRegion:: 00144 get_window() const { 00145 return _window; 00146 } 00147 00148 //////////////////////////////////////////////////////////////////// 00149 // Function: DisplayRegion::get_camera 00150 // Access: Published 00151 // Description: Returns the camera associated with this 00152 // DisplayRegion, or an empty NodePath if no camera is 00153 // associated. 00154 //////////////////////////////////////////////////////////////////// 00155 INLINE NodePath DisplayRegion:: 00156 get_camera(Thread *current_thread) const { 00157 CDReader cdata(_cycler, current_thread); 00158 return cdata->_camera; 00159 } 00160 00161 //////////////////////////////////////////////////////////////////// 00162 // Function: DisplayRegion::is_active 00163 // Access: Published 00164 // Description: Returns the active flag associated with the 00165 // DisplayRegion. 00166 //////////////////////////////////////////////////////////////////// 00167 INLINE bool DisplayRegion:: 00168 is_active() const { 00169 CDReader cdata(_cycler); 00170 return cdata->_active; 00171 } 00172 00173 //////////////////////////////////////////////////////////////////// 00174 // Function: DisplayRegion::get_sort 00175 // Access: Published 00176 // Description: Returns the sort value associated with the 00177 // DisplayRegion. 00178 //////////////////////////////////////////////////////////////////// 00179 INLINE int DisplayRegion:: 00180 get_sort() const { 00181 CDReader cdata(_cycler); 00182 return cdata->_sort; 00183 } 00184 00185 //////////////////////////////////////////////////////////////////// 00186 // Function: DisplayRegion::get_stereo_channel 00187 // Access: Published 00188 // Description: Returns whether the DisplayRegion is specified as the 00189 // left or right channel of a stereo pair, or whether it 00190 // is a normal, monocular image. See 00191 // set_stereo_channel(). 00192 //////////////////////////////////////////////////////////////////// 00193 INLINE Lens::StereoChannel DisplayRegion:: 00194 get_stereo_channel() const { 00195 CDReader cdata(_cycler); 00196 return cdata->_stereo_channel; 00197 } 00198 00199 //////////////////////////////////////////////////////////////////// 00200 // Function: DisplayRegion::get_tex_view_offset 00201 // Access: Public 00202 // Description: Returns the current texture view offset for this 00203 // DisplayRegion. This is normally set to zero. If 00204 // nonzero, it is used to select a particular view of 00205 // any multiview textures that are rendered within this 00206 // DisplayRegion. 00207 // 00208 // For a StereoDisplayRegion, this is normally 0 for the 00209 // left eye, and 1 for the right eye, to support stereo 00210 // textures. 00211 //////////////////////////////////////////////////////////////////// 00212 INLINE int DisplayRegion:: 00213 get_tex_view_offset() const { 00214 CDReader cdata(_cycler); 00215 return cdata->_tex_view_offset; 00216 } 00217 00218 //////////////////////////////////////////////////////////////////// 00219 // Function: DisplayRegion::get_incomplete_render 00220 // Access: Published 00221 // Description: Returns the incomplete_render flag. See 00222 // set_incomplete_render(). 00223 //////////////////////////////////////////////////////////////////// 00224 INLINE bool DisplayRegion:: 00225 get_incomplete_render() const { 00226 return _incomplete_render; 00227 } 00228 00229 //////////////////////////////////////////////////////////////////// 00230 // Function: DisplayRegion::get_texture_reload_priority 00231 // Access: Published 00232 // Description: Returns the priority which is assigned to 00233 // asynchronous texture reload requests. See 00234 // set_texture_reload_priority(). 00235 //////////////////////////////////////////////////////////////////// 00236 INLINE int DisplayRegion:: 00237 get_texture_reload_priority() const { 00238 return _texture_reload_priority; 00239 } 00240 00241 //////////////////////////////////////////////////////////////////// 00242 // Function: DisplayRegion::get_cube_map_index 00243 // Access: Published 00244 // Description: Returns the cube map face index associated with this 00245 // particular DisplayRegion, or -1 if it is not 00246 // associated with a cube map. See 00247 // set_cube_map_index(). 00248 //////////////////////////////////////////////////////////////////// 00249 INLINE int DisplayRegion:: 00250 get_cube_map_index() const { 00251 CDReader cdata(_cycler); 00252 return cdata->_cube_map_index; 00253 } 00254 00255 //////////////////////////////////////////////////////////////////// 00256 // Function: DisplayRegion::set_cull_callback 00257 // Access: Published 00258 // Description: Sets the CallbackObject that will be notified when 00259 // the DisplayRegion is visited during the cull 00260 // traversal. This callback will be made during the 00261 // cull thread. 00262 // 00263 // The cull traversal is responsible for determining 00264 // which nodes are visible and within the view frustum, 00265 // and for accumulating state and transform, and 00266 // generally building up the list of CullableObjects 00267 // that are to be eventually passed to the draw 00268 // traversal for rendering. 00269 // 00270 // At the time the cull traversal callback is made, the 00271 // traversal for this DisplayRegion has not yet started. 00272 // 00273 // The callback is passed an instance of a 00274 // DisplayRegionCullCallbackData, which contains 00275 // pointers to the current scene information, as well as 00276 // the current DisplayRegion and GSG. The callback 00277 // *replaces* the normal cull behavior, so if your 00278 // callback does nothing, the scene graph will not be 00279 // traversed and therefore nothing will be drawn. If 00280 // you wish the normal cull traversal to be performed 00281 // for this DisplayRegion, you must call 00282 // cbdata->upcall() from your callback. 00283 //////////////////////////////////////////////////////////////////// 00284 INLINE void DisplayRegion:: 00285 set_cull_callback(CallbackObject *object) { 00286 CDWriter cdata(_cycler); 00287 cdata->_cull_callback = object; 00288 } 00289 00290 //////////////////////////////////////////////////////////////////// 00291 // Function: DisplayRegion::clear_cull_callback 00292 // Access: Published 00293 // Description: Removes the callback set by an earlier call to 00294 // set_cull_callback(). 00295 //////////////////////////////////////////////////////////////////// 00296 INLINE void DisplayRegion:: 00297 clear_cull_callback() { 00298 set_cull_callback(NULL); 00299 } 00300 00301 //////////////////////////////////////////////////////////////////// 00302 // Function: DisplayRegion::get_cull_callback 00303 // Access: Published 00304 // Description: Returns the CallbackObject set by set_cull_callback(). 00305 //////////////////////////////////////////////////////////////////// 00306 INLINE CallbackObject *DisplayRegion:: 00307 get_cull_callback() const { 00308 CDReader cdata(_cycler); 00309 return cdata->_cull_callback; 00310 } 00311 00312 //////////////////////////////////////////////////////////////////// 00313 // Function: DisplayRegion::set_draw_callback 00314 // Access: Published 00315 // Description: Sets the CallbackObject that will be notified when 00316 // the contents of DisplayRegion is drawn during the 00317 // draw traversal. This callback will be made during 00318 // the draw thread. 00319 // 00320 // The draw traversal is responsible for actually 00321 // issuing the commands to the graphics engine to draw 00322 // primitives. Its job is to walk through the list of 00323 // CullableObjects build up by the cull traversal, as 00324 // quickly as possible, issuing the appropriate commands 00325 // to draw each one. 00326 // 00327 // At the time the draw traversal callback is made, the 00328 // graphics state is in the initial state, and no 00329 // projection matrix or modelview matrix is in effect. 00330 // begin_scene() has not yet been called, and no objects 00331 // have yet been drawn. However, the viewport has 00332 // already been set to the appropriate part of the 00333 // window, and the clear commands for this DisplayRegion 00334 // (if any) have been issued. 00335 // 00336 // The callback is passed an instance of a 00337 // DisplayRegionDrawCallbackData, which contains 00338 // pointers to the current scene information, as well as 00339 // the current DisplayRegion and GSG. The callback 00340 // *replaces* the normal draw behavior, so if your 00341 // callback does nothing, nothing in the DisplayRegion 00342 // will be drawn. If you wish the draw traversal to 00343 // continue to draw the contents of this DisplayRegion, 00344 // you must call cbdata->upcall() from your callback. 00345 //////////////////////////////////////////////////////////////////// 00346 INLINE void DisplayRegion:: 00347 set_draw_callback(CallbackObject *object) { 00348 CDWriter cdata(_cycler); 00349 cdata->_draw_callback = object; 00350 } 00351 00352 //////////////////////////////////////////////////////////////////// 00353 // Function: DisplayRegion::clear_draw_callback 00354 // Access: Published 00355 // Description: Removes the callback set by an earlier call to 00356 // set_draw_callback(). 00357 //////////////////////////////////////////////////////////////////// 00358 INLINE void DisplayRegion:: 00359 clear_draw_callback() { 00360 set_draw_callback(NULL); 00361 } 00362 00363 //////////////////////////////////////////////////////////////////// 00364 // Function: DisplayRegion::get_draw_callback 00365 // Access: Published 00366 // Description: Returns the CallbackObject set by set_draw_callback(). 00367 //////////////////////////////////////////////////////////////////// 00368 INLINE CallbackObject *DisplayRegion:: 00369 get_draw_callback() const { 00370 CDReader cdata(_cycler); 00371 return cdata->_draw_callback; 00372 } 00373 00374 //////////////////////////////////////////////////////////////////// 00375 // Function: DisplayRegion::get_pixel_width 00376 // Access: Published 00377 // Description: Returns the width of the DisplayRegion in pixels. 00378 //////////////////////////////////////////////////////////////////// 00379 INLINE int DisplayRegion:: 00380 get_pixel_width() const { 00381 CDReader cdata(_cycler); 00382 return cdata->_pr - cdata->_pl; 00383 } 00384 00385 //////////////////////////////////////////////////////////////////// 00386 // Function: DisplayRegion::get_pixel_height 00387 // Access: Published 00388 // Description: Returns the height of the DisplayRegion in pixels. 00389 //////////////////////////////////////////////////////////////////// 00390 INLINE int DisplayRegion:: 00391 get_pixel_height() const { 00392 CDReader cdata(_cycler); 00393 return cdata->_pt - cdata->_pb; 00394 } 00395 00396 //////////////////////////////////////////////////////////////////// 00397 // Function: DisplayRegion::get_pixels 00398 // Access: Public 00399 // Description: Retrieves the coordinates of the DisplayRegion within 00400 // its window, in pixels. 00401 //////////////////////////////////////////////////////////////////// 00402 INLINE void DisplayRegion:: 00403 get_pixels(int &pl, int &pr, int &pb, int &pt) const { 00404 CDReader cdata(_cycler); 00405 pl = cdata->_pl; 00406 pr = cdata->_pr; 00407 pb = cdata->_pb; 00408 pt = cdata->_pt; 00409 } 00410 00411 //////////////////////////////////////////////////////////////////// 00412 // Function: DisplayRegion::get_region_pixels 00413 // Access: Public 00414 // Description: Retrieves the coordinates of the DisplayRegion within 00415 // its window, as the pixel location of its bottom-left 00416 // corner, along with a pixel width and height. 00417 //////////////////////////////////////////////////////////////////// 00418 INLINE void DisplayRegion:: 00419 get_region_pixels(int &xo, int &yo, int &w, int &h) const { 00420 CDReader cdata(_cycler); 00421 xo = cdata->_pl; 00422 yo = cdata->_pb; 00423 w = cdata->_pr - cdata->_pl; 00424 h = cdata->_pt - cdata->_pb; 00425 } 00426 00427 //////////////////////////////////////////////////////////////////// 00428 // Function: DisplayRegion::get_region_pixels_i 00429 // Access: Public 00430 // Description: Similar to get_region_pixels(), but returns the upper 00431 // left corner, and the pixel numbers are numbered from 00432 // the top-left corner down, in the DirectX way of 00433 // things. 00434 //////////////////////////////////////////////////////////////////// 00435 INLINE void DisplayRegion:: 00436 get_region_pixels_i(int &xo, int &yo, int &w, int &h) const { 00437 CDReader cdata(_cycler); 00438 xo = cdata->_pl; 00439 yo = cdata->_pti; 00440 w = cdata->_pr - cdata->_pl; 00441 h = cdata->_pbi - cdata->_pti; 00442 } 00443 00444 //////////////////////////////////////////////////////////////////// 00445 // Function: DisplayRegion::set_cull_result 00446 // Access: Public 00447 // Description: Stores the result of performing a cull operation on 00448 // this DisplayRegion. Normally, this will only be 00449 // called by the GraphicsEngine; you should not call 00450 // this directly. 00451 // 00452 // The stored result will automatically be applied back 00453 // to all upstream pipeline stages. 00454 //////////////////////////////////////////////////////////////////// 00455 INLINE void DisplayRegion:: 00456 set_cull_result(CullResult *cull_result, SceneSetup *scene_setup, 00457 Thread *current_thread) { 00458 CDCullWriter cdata(_cycler_cull, true, current_thread); 00459 cdata->_cull_result = cull_result; 00460 cdata->_scene_setup = scene_setup; 00461 } 00462 00463 //////////////////////////////////////////////////////////////////// 00464 // Function: DisplayRegion::get_cull_result 00465 // Access: Public 00466 // Description: Returns the CullResult value that was stored on this 00467 // DisplayRegion, presumably by the last successful cull 00468 // operation. This method is for the benefit of the 00469 // GraphicsEngine; normally you shouldn't call this 00470 // directly. 00471 //////////////////////////////////////////////////////////////////// 00472 INLINE CullResult *DisplayRegion:: 00473 get_cull_result(Thread *current_thread) const { 00474 CDCullReader cdata(_cycler_cull, current_thread); 00475 return cdata->_cull_result; 00476 } 00477 00478 //////////////////////////////////////////////////////////////////// 00479 // Function: DisplayRegion::get_scene_setup 00480 // Access: Public 00481 // Description: Returns the SceneSetup value that was stored on this 00482 // DisplayRegion, presumably by the last successful cull 00483 // operation. This method is for the benefit of the 00484 // GraphicsEngine; normally you shouldn't call this 00485 // directly. 00486 //////////////////////////////////////////////////////////////////// 00487 INLINE SceneSetup *DisplayRegion:: 00488 get_scene_setup(Thread *current_thread) const { 00489 CDCullReader cdata(_cycler_cull, current_thread); 00490 return cdata->_scene_setup; 00491 } 00492 00493 //////////////////////////////////////////////////////////////////// 00494 // Function: DisplayRegion::get_cull_region_pcollector 00495 // Access: Public 00496 // Description: Returns a PStatCollector for timing the cull 00497 // operation for just this DisplayRegion. 00498 //////////////////////////////////////////////////////////////////// 00499 INLINE PStatCollector &DisplayRegion:: 00500 get_cull_region_pcollector() { 00501 return _cull_region_pcollector; 00502 } 00503 00504 //////////////////////////////////////////////////////////////////// 00505 // Function: DisplayRegion::get_draw_region_pcollector 00506 // Access: Public 00507 // Description: Returns a PStatCollector for timing the draw 00508 // operation for just this DisplayRegion. 00509 //////////////////////////////////////////////////////////////////// 00510 INLINE PStatCollector &DisplayRegion:: 00511 get_draw_region_pcollector() { 00512 return _draw_region_pcollector; 00513 } 00514 00515 //////////////////////////////////////////////////////////////////// 00516 // Function: DisplayRegion::CDataCull::Constructor 00517 // Access: Public 00518 // Description: 00519 //////////////////////////////////////////////////////////////////// 00520 INLINE DisplayRegion::CDataCull:: 00521 CDataCull() { 00522 } 00523 00524 //////////////////////////////////////////////////////////////////// 00525 // Function: DisplayRegion::CDataCull::Copy Constructor 00526 // Access: Public 00527 // Description: 00528 //////////////////////////////////////////////////////////////////// 00529 INLINE DisplayRegion::CDataCull:: 00530 CDataCull(const DisplayRegion::CDataCull ©) : 00531 _cull_result(copy._cull_result), 00532 _scene_setup(copy._scene_setup) 00533 { 00534 } 00535 00536 //////////////////////////////////////////////////////////////////// 00537 // Function: DisplayRegionPipelineReader::Constructor 00538 // Access: Public 00539 // Description: 00540 //////////////////////////////////////////////////////////////////// 00541 INLINE DisplayRegionPipelineReader:: 00542 DisplayRegionPipelineReader(DisplayRegion *object, Thread *current_thread) : 00543 _object(object), 00544 _current_thread(current_thread), 00545 _cdata(object->_cycler.read(current_thread)) 00546 { 00547 #ifdef _DEBUG 00548 nassertv(_object->test_ref_count_nonzero()); 00549 #ifdef DO_PIPELINING 00550 nassertv(_cdata->test_ref_count_nonzero()); 00551 #endif // DO_PIPELINING 00552 #endif // _DEBUG 00553 } 00554 00555 //////////////////////////////////////////////////////////////////// 00556 // Function: DisplayRegionPipelineReader::Copy Constructor 00557 // Access: Private 00558 // Description: Don't attempt to copy these objects. 00559 //////////////////////////////////////////////////////////////////// 00560 INLINE DisplayRegionPipelineReader:: 00561 DisplayRegionPipelineReader(const DisplayRegionPipelineReader &) { 00562 nassertv(false); 00563 } 00564 00565 //////////////////////////////////////////////////////////////////// 00566 // Function: DisplayRegionPipelineReader::Copy Assignment Operator 00567 // Access: Private 00568 // Description: Don't attempt to copy these objects. 00569 //////////////////////////////////////////////////////////////////// 00570 INLINE void DisplayRegionPipelineReader:: 00571 operator = (const DisplayRegionPipelineReader &) { 00572 nassertv(false); 00573 } 00574 00575 //////////////////////////////////////////////////////////////////// 00576 // Function: DisplayRegionPipelineReader::Destructor 00577 // Access: Public 00578 // Description: 00579 //////////////////////////////////////////////////////////////////// 00580 INLINE DisplayRegionPipelineReader:: 00581 ~DisplayRegionPipelineReader() { 00582 #ifdef _DEBUG 00583 nassertv(_object->test_ref_count_nonzero()); 00584 #ifdef DO_PIPELINING 00585 nassertv(_cdata->test_ref_count_nonzero()); 00586 #endif // DO_PIPELINING 00587 #endif // _DEBUG 00588 _object->_cycler.release_read(_cdata); 00589 00590 #ifdef _DEBUG 00591 _object = NULL; 00592 _cdata = NULL; 00593 #endif // _DEBUG 00594 } 00595 00596 //////////////////////////////////////////////////////////////////// 00597 // Function: DisplayRegionPipelineReader::get_object 00598 // Access: Public 00599 // Description: 00600 //////////////////////////////////////////////////////////////////// 00601 INLINE DisplayRegion *DisplayRegionPipelineReader:: 00602 get_object() const { 00603 return _object; 00604 } 00605 00606 //////////////////////////////////////////////////////////////////// 00607 // Function: DisplayRegionPipelineReader::get_current_thread 00608 // Access: Public 00609 // Description: 00610 //////////////////////////////////////////////////////////////////// 00611 INLINE Thread *DisplayRegionPipelineReader:: 00612 get_current_thread() const { 00613 return _current_thread; 00614 } 00615 00616 //////////////////////////////////////////////////////////////////// 00617 // Function: DisplayRegionPipelineReader::is_any_clear_active 00618 // Access: Public 00619 // Description: 00620 //////////////////////////////////////////////////////////////////// 00621 INLINE bool DisplayRegionPipelineReader:: 00622 is_any_clear_active() const { 00623 return _object->is_any_clear_active(); 00624 } 00625 00626 //////////////////////////////////////////////////////////////////// 00627 // Function: DisplayRegionPipelineReader::get_dimensions 00628 // Access: Public 00629 // Description: Retrieves the coordinates of the DisplayRegion's 00630 // rectangle within its GraphicsOutput. These numbers 00631 // will be in the range [0..1]. 00632 //////////////////////////////////////////////////////////////////// 00633 INLINE void DisplayRegionPipelineReader:: 00634 get_dimensions(PN_stdfloat &l, PN_stdfloat &r, PN_stdfloat &b, PN_stdfloat &t) const { 00635 l = _cdata->_dimensions[0]; 00636 r = _cdata->_dimensions[1]; 00637 b = _cdata->_dimensions[2]; 00638 t = _cdata->_dimensions[3]; 00639 } 00640 00641 //////////////////////////////////////////////////////////////////// 00642 // Function: DisplayRegionPipelineReader::get_dimensions 00643 // Access: Public 00644 // Description: Retrieves the coordinates of the DisplayRegion's 00645 // rectangle within its GraphicsOutput. These numbers 00646 // will be in the range [0..1]. 00647 //////////////////////////////////////////////////////////////////// 00648 INLINE const LVecBase4 &DisplayRegionPipelineReader:: 00649 get_dimensions() const { 00650 return _cdata->_dimensions; 00651 } 00652 00653 //////////////////////////////////////////////////////////////////// 00654 // Function: DisplayRegionPipelineReader::get_left 00655 // Access: Public 00656 // Description: Retrieves the x coordinate of the left edge of the 00657 // rectangle within its GraphicsOutput. This number 00658 // will be in the range [0..1]. 00659 //////////////////////////////////////////////////////////////////// 00660 INLINE PN_stdfloat DisplayRegionPipelineReader:: 00661 get_left() const { 00662 return _cdata->_dimensions[0]; 00663 } 00664 00665 //////////////////////////////////////////////////////////////////// 00666 // Function: DisplayRegionPipelineReader::get_right 00667 // Access: Public 00668 // Description: Retrieves the x coordinate of the right edge of the 00669 // rectangle within its GraphicsOutput. This number 00670 // will be in the range [0..1]. 00671 //////////////////////////////////////////////////////////////////// 00672 INLINE PN_stdfloat DisplayRegionPipelineReader:: 00673 get_right() const { 00674 return _cdata->_dimensions[1]; 00675 } 00676 00677 //////////////////////////////////////////////////////////////////// 00678 // Function: DisplayRegionPipelineReader::get_bottom 00679 // Access: Public 00680 // Description: Retrieves the y coordinate of the bottom edge of 00681 // the rectangle within its GraphicsOutput. This 00682 // number will be in the range [0..1]. 00683 //////////////////////////////////////////////////////////////////// 00684 INLINE PN_stdfloat DisplayRegionPipelineReader:: 00685 get_bottom() const { 00686 return _cdata->_dimensions[2]; 00687 } 00688 00689 //////////////////////////////////////////////////////////////////// 00690 // Function: DisplayRegionPipelineReader::get_top 00691 // Access: Public 00692 // Description: Retrieves the y coordinate of the top edge of the 00693 // rectangle within its GraphicsOutput. This number 00694 // will be in the range [0..1]. 00695 //////////////////////////////////////////////////////////////////// 00696 INLINE PN_stdfloat DisplayRegionPipelineReader:: 00697 get_top() const { 00698 return _cdata->_dimensions[3]; 00699 } 00700 00701 //////////////////////////////////////////////////////////////////// 00702 // Function: DisplayRegionPipelineReader::get_window 00703 // Access: Public 00704 // Description: Returns the GraphicsOutput that this DisplayRegion is 00705 // ultimately associated with, or NULL if no window is 00706 // associated. 00707 //////////////////////////////////////////////////////////////////// 00708 INLINE GraphicsOutput *DisplayRegionPipelineReader:: 00709 get_window() const { 00710 return _object->_window; 00711 } 00712 00713 //////////////////////////////////////////////////////////////////// 00714 // Function: DisplayRegionPipelineReader::get_camera 00715 // Access: Public 00716 // Description: Returns the camera associated with this 00717 // DisplayRegion, or an empty NodePath if no camera is 00718 // associated. 00719 //////////////////////////////////////////////////////////////////// 00720 INLINE NodePath DisplayRegionPipelineReader:: 00721 get_camera() const { 00722 return _cdata->_camera; 00723 } 00724 00725 //////////////////////////////////////////////////////////////////// 00726 // Function: DisplayRegionPipelineReader::is_active 00727 // Access: Public 00728 // Description: Returns the active flag associated with the 00729 // DisplayRegion. 00730 //////////////////////////////////////////////////////////////////// 00731 INLINE bool DisplayRegionPipelineReader:: 00732 is_active() const { 00733 return _cdata->_active; 00734 } 00735 00736 //////////////////////////////////////////////////////////////////// 00737 // Function: DisplayRegionPipelineReader::get_sort 00738 // Access: Public 00739 // Description: Returns the sort value associated with the 00740 // DisplayRegion. 00741 //////////////////////////////////////////////////////////////////// 00742 INLINE int DisplayRegionPipelineReader:: 00743 get_sort() const { 00744 return _cdata->_sort; 00745 } 00746 00747 //////////////////////////////////////////////////////////////////// 00748 // Function: DisplayRegionPipelineReader::get_stereo_channel 00749 // Access: Public 00750 // Description: Returns whether the DisplayRegion is specified as the 00751 // left or right channel of a stereo pair, or whether it 00752 // is a normal, monocular image. See 00753 // set_stereo_channel(). 00754 //////////////////////////////////////////////////////////////////// 00755 INLINE Lens::StereoChannel DisplayRegionPipelineReader:: 00756 get_stereo_channel() const { 00757 return _cdata->_stereo_channel; 00758 } 00759 00760 //////////////////////////////////////////////////////////////////// 00761 // Function: DisplayRegionPipelineReader::get_tex_view_offset 00762 // Access: Public 00763 // Description: Returns the current texture view offset for this 00764 // DisplayRegion. This is normally set to zero. If 00765 // nonzero, it is used to select a particular view of 00766 // any multiview textures that are rendered within this 00767 // DisplayRegion. 00768 // 00769 // For a StereoDisplayRegion, this is normally 0 for the 00770 // left eye, and 1 for the right eye, to support stereo 00771 // textures. 00772 //////////////////////////////////////////////////////////////////// 00773 INLINE int DisplayRegionPipelineReader:: 00774 get_tex_view_offset() { 00775 return _cdata->_tex_view_offset; 00776 } 00777 00778 //////////////////////////////////////////////////////////////////// 00779 // Function: DisplayRegionPipelineReader::get_cube_map_index 00780 // Access: Public 00781 // Description: Returns the cube map face index associated with this 00782 // particular DisplayRegion, or -1 if it is not 00783 // associated with a cube map. See 00784 // set_cube_map_index(). 00785 //////////////////////////////////////////////////////////////////// 00786 INLINE int DisplayRegionPipelineReader:: 00787 get_cube_map_index() const { 00788 return _cdata->_cube_map_index; 00789 } 00790 00791 //////////////////////////////////////////////////////////////////// 00792 // Function: DisplayRegionPipelineReader::get_draw_callback 00793 // Access: Published 00794 // Description: Returns the CallbackObject set by set_draw_callback(). 00795 //////////////////////////////////////////////////////////////////// 00796 INLINE CallbackObject *DisplayRegionPipelineReader:: 00797 get_draw_callback() const { 00798 return _cdata->_draw_callback; 00799 } 00800 00801 //////////////////////////////////////////////////////////////////// 00802 // Function: DisplayRegionPipelineReader::get_pixels 00803 // Access: Public 00804 // Description: Retrieves the coordinates of the DisplayRegion within 00805 // its window, in pixels. 00806 //////////////////////////////////////////////////////////////////// 00807 INLINE void DisplayRegionPipelineReader:: 00808 get_pixels(int &pl, int &pr, int &pb, int &pt) const { 00809 pl = _cdata->_pl; 00810 pr = _cdata->_pr; 00811 pb = _cdata->_pb; 00812 pt = _cdata->_pt; 00813 } 00814 00815 //////////////////////////////////////////////////////////////////// 00816 // Function: DisplayRegionPipelineReader::get_region_pixels 00817 // Access: Public 00818 // Description: Retrieves the coordinates of the DisplayRegion within 00819 // its window, as the pixel location of its bottom-left 00820 // corner, along with a pixel width and height. 00821 //////////////////////////////////////////////////////////////////// 00822 INLINE void DisplayRegionPipelineReader:: 00823 get_region_pixels(int &xo, int &yo, int &w, int &h) const { 00824 xo = _cdata->_pl; 00825 yo = _cdata->_pb; 00826 w = _cdata->_pr - _cdata->_pl; 00827 h = _cdata->_pt - _cdata->_pb; 00828 } 00829 00830 //////////////////////////////////////////////////////////////////// 00831 // Function: DisplayRegionPipelineReader::get_region_pixels_i 00832 // Access: Public 00833 // Description: Similar to get_region_pixels(), but returns the upper 00834 // left corner, and the pixel numbers are numbered from 00835 // the top-left corner down, in the DirectX way of 00836 // things. 00837 //////////////////////////////////////////////////////////////////// 00838 INLINE void DisplayRegionPipelineReader:: 00839 get_region_pixels_i(int &xo, int &yo, int &w, int &h) const { 00840 xo = _cdata->_pl; 00841 yo = _cdata->_pti; 00842 w = _cdata->_pr - _cdata->_pl; 00843 h = _cdata->_pbi - _cdata->_pti; 00844 } 00845 00846 //////////////////////////////////////////////////////////////////// 00847 // Function: DisplayRegionPipelineReader::get_pixel_width 00848 // Access: Public 00849 // Description: Returns the width of the DisplayRegion in pixels. 00850 //////////////////////////////////////////////////////////////////// 00851 INLINE int DisplayRegionPipelineReader:: 00852 get_pixel_width() const { 00853 return _cdata->_pr - _cdata->_pl; 00854 } 00855 00856 //////////////////////////////////////////////////////////////////// 00857 // Function: DisplayRegionPipelineReader::get_lens_index 00858 // Access: Public 00859 // Description: Gets the index into a lens_node lens array. 0 default 00860 //////////////////////////////////////////////////////////////////// 00861 INLINE int DisplayRegionPipelineReader:: 00862 get_lens_index() const 00863 { 00864 return _cdata->_lens_index; 00865 } 00866 00867 //////////////////////////////////////////////////////////////////// 00868 // Function: DisplayRegionPipelineReader::get_pixel_height 00869 // Access: Public 00870 // Description: Returns the height of the DisplayRegion in pixels. 00871 //////////////////////////////////////////////////////////////////// 00872 INLINE int DisplayRegionPipelineReader:: 00873 get_pixel_height() const { 00874 return _cdata->_pt - _cdata->_pb; 00875 }