Panda3D

graphicsOutput.I

00001 // Filename: graphicsOutput.I
00002 // Created by:  drose (06Feb04)
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: GraphicsOutput::get_gsg
00018 //       Access: Published
00019 //  Description: Returns the GSG that is associated with this window.
00020 //               There is a one-to-one association between windows and
00021 //               GSG's.
00022 //
00023 //               This may return NULL if the graphics context has not
00024 //               yet been created for the window, e.g. before the
00025 //               first frame has rendered; or after the window has
00026 //               been closed.
00027 ////////////////////////////////////////////////////////////////////
00028 INLINE GraphicsStateGuardian *GraphicsOutput::
00029 get_gsg() const {
00030   return _gsg;
00031 }
00032 
00033 ////////////////////////////////////////////////////////////////////
00034 //     Function: GraphicsOutput::get_pipe
00035 //       Access: Published
00036 //  Description: Returns the GraphicsPipe that this window is
00037 //               associated with.  It is possible that the
00038 //               GraphicsPipe might have been deleted while an
00039 //               outstanding PT(GraphicsOutput) prevented all of its
00040 //               children windows from also being deleted; in this
00041 //               unlikely case, get_pipe() may return NULL.
00042 ////////////////////////////////////////////////////////////////////
00043 INLINE GraphicsPipe *GraphicsOutput::
00044 get_pipe() const {
00045   return _pipe;
00046 }
00047 
00048 ////////////////////////////////////////////////////////////////////
00049 //     Function: GraphicsOutput::get_engine
00050 //       Access: Published
00051 //  Description: Returns the graphics engine that created this output.
00052 //               Since there is normally only one GraphicsEngine
00053 //               object in an application, this is usually the same as
00054 //               the global GraphicsEngine.
00055 ////////////////////////////////////////////////////////////////////
00056 INLINE GraphicsEngine *GraphicsOutput::
00057 get_engine() const {
00058   return _engine;
00059 }
00060 
00061 ////////////////////////////////////////////////////////////////////
00062 //     Function: GraphicsOutput::get_name
00063 //       Access: Published
00064 //  Description: Returns the name that was passed to the
00065 //               GraphicsOutput constructor.
00066 ////////////////////////////////////////////////////////////////////
00067 INLINE const string &GraphicsOutput::
00068 get_name() const {
00069   return _name;
00070 }
00071 
00072 ////////////////////////////////////////////////////////////////////
00073 //     Function: GraphicsOutput::count_textures
00074 //       Access: Published
00075 //  Description: If the GraphicsOutput is set to render into a
00076 //               texture, returns the number of textures that are
00077 //               being rendered into.  Normally, the textures would
00078 //               be associated with different buffers - a color
00079 //               texture, a depth texture, and a stencil texture.
00080 ////////////////////////////////////////////////////////////////////
00081 INLINE int GraphicsOutput::
00082 count_textures() const {
00083   return _textures.size();
00084 }
00085 
00086 ////////////////////////////////////////////////////////////////////
00087 //     Function: GraphicsOutput::has_texture
00088 //       Access: Published
00089 //  Description: Returns true if the GraphicsOutput is rendering 
00090 //               into any textures at all.
00091 ////////////////////////////////////////////////////////////////////
00092 INLINE bool GraphicsOutput::
00093 has_texture() const {
00094   return (_textures.size() > 0);
00095 }
00096 
00097 ////////////////////////////////////////////////////////////////////
00098 //     Function: GraphicsOutput::get_texture
00099 //       Access: Published
00100 //  Description: Returns the nth texture into which the GraphicsOutput
00101 //               renders.  Returns NULL if there is no such texture.
00102 //
00103 //               If the texture is non-NULL, it may be applied to
00104 //               geometry to be rendered for any other windows or
00105 //               outputs that share the same GSG as this
00106 //               GraphicsOutput.  The effect is undefined for windows
00107 //               that share a different GSG; usually in these cases
00108 //               the texture will be invalid.
00109 ////////////////////////////////////////////////////////////////////
00110 INLINE Texture *GraphicsOutput::
00111 get_texture(int i) const {
00112   if ((i < 0) || (i >= ((int)_textures.size()))) {
00113     return (Texture *)NULL;
00114   }
00115   return _textures[i]._texture;
00116 }
00117 
00118 ////////////////////////////////////////////////////////////////////
00119 //     Function: GraphicsOutput::get_texture_plane
00120 //       Access: Published
00121 //  Description: Returns the RenderTexturePlane associated with the
00122 //               nth render-texture.  Returns 0 if there is no such
00123 //               texture.
00124 ////////////////////////////////////////////////////////////////////
00125 INLINE GraphicsOutput::RenderTexturePlane GraphicsOutput::
00126 get_texture_plane(int i) const {
00127   if ((i < 0) || (i >= ((int)_textures.size()))) {
00128     return (RenderTexturePlane)0;
00129   }
00130   return _textures[i]._plane;
00131 }
00132 
00133 ////////////////////////////////////////////////////////////////////
00134 //     Function: GraphicsOutput::get_rtm_mode
00135 //       Access: Published
00136 //  Description: Returns the RenderTextureMode associated with the
00137 //               nth render-texture.  Returns RTM_none if there is
00138 //               no such texture.
00139 ////////////////////////////////////////////////////////////////////
00140 INLINE GraphicsOutput::RenderTextureMode GraphicsOutput::
00141 get_rtm_mode(int i) const {
00142   if ((i < 0) || (i >= ((int)_textures.size()))) {
00143     return RTM_none;
00144   }
00145   return _textures[i]._rtm_mode;
00146 }
00147 
00148 ////////////////////////////////////////////////////////////////////
00149 //     Function: GraphicsOutput::get_x_size
00150 //       Access: Published
00151 //  Description: Returns the visible width of the window or buffer, if
00152 //               it is known.  In certain cases (e.g. fullscreen
00153 //               windows), the size may not be known until after the
00154 //               object has been fully created.  Check has_size()
00155 //               first.
00156 //
00157 //               Certain objects (like windows) may change size
00158 //               spontaneously; this method is not thread-safe.  To
00159 //               get the size of a window in a thread-safe manner,
00160 //               query get_properties().
00161 ////////////////////////////////////////////////////////////////////
00162 INLINE int GraphicsOutput::
00163 get_x_size() const {
00164   return _x_size;
00165 }
00166 
00167 ////////////////////////////////////////////////////////////////////
00168 //     Function: GraphicsOutput::get_y_size
00169 //       Access: Published
00170 //  Description: Returns the visible height of the window or buffer,
00171 //               if it is known.  In certain cases (e.g. fullscreen
00172 //               windows), the size may not be known until after the
00173 //               object has been fully created.  Check has_size()
00174 //               first.
00175 //
00176 //               Certain objects (like windows) may change size
00177 //               spontaneously; this method is not thread-safe.  To
00178 //               get the size of a window in a thread-safe manner,
00179 //               query get_properties().
00180 ////////////////////////////////////////////////////////////////////
00181 INLINE int GraphicsOutput::
00182 get_y_size() const {
00183   return _y_size;
00184 }
00185 
00186 ////////////////////////////////////////////////////////////////////
00187 //     Function: GraphicsOutput::get_fb_x_size
00188 //       Access: Published
00189 //  Description: Returns the internal width of the window or buffer.
00190 //               This is almost always the same as get_x_size(),
00191 //               except when a pixel_zoom is in effect--see
00192 //               set_pixel_zoom().
00193 ////////////////////////////////////////////////////////////////////
00194 INLINE int GraphicsOutput::
00195 get_fb_x_size() const {
00196   return max(int(_x_size * get_pixel_factor()), 1);
00197 }
00198 
00199 ////////////////////////////////////////////////////////////////////
00200 //     Function: GraphicsOutput::get_fb_y_size
00201 //       Access: Published
00202 //  Description: Returns the internal height of the window or buffer.
00203 //               This is almost always the same as get_y_size(),
00204 //               except when a pixel_zoom is in effect--see
00205 //               set_pixel_zoom().
00206 ////////////////////////////////////////////////////////////////////
00207 INLINE int GraphicsOutput::
00208 get_fb_y_size() const {
00209   return max(int(_y_size * get_pixel_factor()), 1);
00210 }
00211 
00212 ////////////////////////////////////////////////////////////////////
00213 //     Function: GraphicsOutput::has_size
00214 //       Access: Published
00215 //  Description: Returns true if the size of the window/frame buffer
00216 //               is known, false otherwise.  In certain cases the size
00217 //               may not be known until after the object has been
00218 //               fully created.  Also, certain objects (like windows)
00219 //               may change size spontaneously.
00220 ////////////////////////////////////////////////////////////////////
00221 INLINE bool GraphicsOutput::
00222 has_size() const {
00223   return _has_size;
00224 }
00225 
00226 ////////////////////////////////////////////////////////////////////
00227 //     Function: GraphicsOutput::is_valid
00228 //       Access: Published
00229 //  Description: Returns true if the output is fully created and ready
00230 //               for rendering, false otherwise.
00231 ////////////////////////////////////////////////////////////////////
00232 INLINE bool GraphicsOutput::
00233 is_valid() const {
00234   return _is_valid;
00235 }
00236 
00237 ////////////////////////////////////////////////////////////////////
00238 //     Function: GraphicsOutput::set_one_shot
00239 //       Access: Published
00240 //  Description: Changes the current setting of the one-shot flag.
00241 //               When this is true, the GraphicsOutput will render one
00242 //               frame and then automatically set itself inactive.
00243 //               This is particularly useful for buffers that are
00244 //               created for the purposes of render-to-texture, for
00245 //               static textures that don't need to be continually
00246 //               re-rendered once they have been rendered the first
00247 //               time.
00248 //
00249 //               Setting the buffer inactive is not the same thing as
00250 //               destroying it.  You are still responsible for passing
00251 //               this buffer to GraphicsEngine::remove_window() when
00252 //               you no longer need the texture, in order to clean up
00253 //               fully.  (However, you should not call remove_window()
00254 //               on this buffer while the texture is still needed,
00255 //               because depending on the render-to-texture mechanism
00256 //               in use, this may invalidate the texture contents.)
00257 ////////////////////////////////////////////////////////////////////
00258 INLINE void GraphicsOutput::
00259 set_one_shot(bool one_shot) {
00260   _one_shot = one_shot;
00261 }
00262 
00263 ////////////////////////////////////////////////////////////////////
00264 //     Function: GraphicsOutput::get_one_shot
00265 //       Access: Published
00266 //  Description: Returns the current setting of the one-shot flag.
00267 //               When this is true, the GraphicsOutput will
00268 //               automatically detach its texture (if it has one) and
00269 //               remove itself from the GraphicsEngine after it
00270 //               renders the next frame.
00271 ////////////////////////////////////////////////////////////////////
00272 INLINE bool GraphicsOutput::
00273 get_one_shot() const {
00274   return _one_shot;
00275 }
00276 
00277 ////////////////////////////////////////////////////////////////////
00278 //     Function: GraphicsOutput::get_inverted
00279 //       Access: Published
00280 //  Description: Returns the current setting of the inverted flag.
00281 //               When this is true, the scene is rendered into the
00282 //               window upside-down, flipped like a mirror along the X
00283 //               axis.  See set_inverted().
00284 ////////////////////////////////////////////////////////////////////
00285 INLINE bool GraphicsOutput::
00286 get_inverted() const {
00287   return _inverted;
00288 }
00289 
00290 ////////////////////////////////////////////////////////////////////
00291 //     Function: GraphicsOutput::set_red_blue_stereo
00292 //       Access: Published
00293 //  Description: Enables red-blue stereo mode on this particular
00294 //               window.  When red-blue stereo mode is in effect,
00295 //               DisplayRegions that have the "left" channel set will
00296 //               render in the red (or specified) channel only, while
00297 //               DisplayRegions that have the "right" channel set will
00298 //               render in the blue (or specified) channel only.
00299 //
00300 //               The remaining two parameters specify the particular
00301 //               color channel(s) to associate with each eye.  Use the
00302 //               bits defined in ColorWriteAttrib::Channels.
00303 //
00304 //               This can be used to achieve a cheesy stereo mode in
00305 //               the absence of hardware-supported stereo.
00306 ////////////////////////////////////////////////////////////////////
00307 INLINE void GraphicsOutput::
00308 set_red_blue_stereo(bool red_blue_stereo,
00309                     unsigned int left_eye_color_mask,
00310                     unsigned int right_eye_color_mask) {
00311   _red_blue_stereo = red_blue_stereo;
00312   if (_red_blue_stereo) {
00313     _left_eye_color_mask = left_eye_color_mask;
00314     _right_eye_color_mask = right_eye_color_mask;
00315   } else {
00316     _left_eye_color_mask = 0x0f;
00317     _right_eye_color_mask = 0x0f;
00318   }
00319 }
00320 
00321 ////////////////////////////////////////////////////////////////////
00322 //     Function: GraphicsOutput::get_red_blue_stereo
00323 //       Access: Published
00324 //  Description: Returns whether red-blue stereo mode is in effect for
00325 //               this particular window.  See set_red_blue_stereo().
00326 ////////////////////////////////////////////////////////////////////
00327 INLINE bool GraphicsOutput::
00328 get_red_blue_stereo() const {
00329   return _red_blue_stereo;
00330 }
00331 
00332 ////////////////////////////////////////////////////////////////////
00333 //     Function: GraphicsOutput::get_left_eye_color_mask
00334 //       Access: Published
00335 //  Description: Returns the color mask in effect when rendering a
00336 //               left-eye view in red_blue stereo mode.  This is one
00337 //               or more bits defined in ColorWriteAttrib::Channels.
00338 //               See set_red_blue_stereo().
00339 ////////////////////////////////////////////////////////////////////
00340 INLINE unsigned int GraphicsOutput::
00341 get_left_eye_color_mask() const {
00342   return _left_eye_color_mask;
00343 }
00344 
00345 ////////////////////////////////////////////////////////////////////
00346 //     Function: GraphicsOutput::get_right_eye_color_mask
00347 //       Access: Published
00348 //  Description: Returns the color mask in effect when rendering a
00349 //               right-eye view in red_blue stereo mode.  This is one
00350 //               or more bits defined in ColorWriteAttrib::Channels.
00351 //               See set_red_blue_stereo().
00352 ////////////////////////////////////////////////////////////////////
00353 INLINE unsigned int GraphicsOutput::
00354 get_right_eye_color_mask() const {
00355   return _right_eye_color_mask;
00356 }
00357 
00358 ////////////////////////////////////////////////////////////////////
00359 //     Function: GraphicsOutput::get_fb_properties
00360 //       Access: Published
00361 //  Description: Returns the framebuffer properties of the window.
00362 ////////////////////////////////////////////////////////////////////
00363 INLINE const FrameBufferProperties &GraphicsOutput::
00364 get_fb_properties() const {
00365   return _fb_properties;
00366 }
00367 
00368 ////////////////////////////////////////////////////////////////////
00369 //     Function: GraphicsOutput::is_stereo
00370 //       Access: Published
00371 //  Description: Returns Returns true if this window can render stereo
00372 //               DisplayRegions, either through red-blue stereo (see
00373 //               set_red_blue_stereo()) or through true hardware
00374 //               stereo rendering.
00375 ////////////////////////////////////////////////////////////////////
00376 INLINE bool GraphicsOutput::
00377 is_stereo() const {
00378   return _red_blue_stereo || _fb_properties.is_stereo();
00379 }
00380 
00381 ////////////////////////////////////////////////////////////////////
00382 //     Function: GraphicsOutput::clear_delete_flag
00383 //       Access: Published
00384 //  Description: Resets the delete flag, so the GraphicsOutput will
00385 //               not be automatically deleted before the beginning of
00386 //               the next frame.
00387 ////////////////////////////////////////////////////////////////////
00388 INLINE void GraphicsOutput::
00389 clear_delete_flag() {
00390   _delete_flag = false;
00391 }
00392 
00393 ////////////////////////////////////////////////////////////////////
00394 //     Function: GraphicsOutput::get_delete_flag
00395 //       Access: Published
00396 //  Description: Returns the current setting of the delete flag.  When
00397 //               this is true, the GraphicsOutput will automatically
00398 //               be removed before the beginning of the next frame by
00399 //               the GraphicsEngine.
00400 ////////////////////////////////////////////////////////////////////
00401 INLINE bool GraphicsOutput::
00402 get_delete_flag() const {
00403   // We only delete the window or buffer automatically when it is
00404   // no longer associated with a texture.
00405   for (int i=0; i<(int)_hold_textures.size(); i++) {
00406     if (_hold_textures[i].is_valid_pointer()) {
00407       return false;
00408     }
00409   }
00410   return _delete_flag;
00411 }
00412 
00413 ////////////////////////////////////////////////////////////////////
00414 //     Function: GraphicsOutput::get_sort
00415 //       Access: Published
00416 //  Description: Returns the sorting order of this particular
00417 //               GraphicsOutput.  The various GraphicsOutputs within a
00418 //               particular thread will be rendered in the indicated
00419 //               order.
00420 ////////////////////////////////////////////////////////////////////
00421 INLINE int GraphicsOutput::
00422 get_sort() const {
00423   return _sort;
00424 }
00425 
00426 ////////////////////////////////////////////////////////////////////
00427 //     Function: GraphicsOutput::set_child_sort
00428 //       Access: Published
00429 //  Description: Specifies the sort value of future offscreen buffers
00430 //               created by make_texture_sort().
00431 //
00432 //               The purpose of this method is to allow the user to
00433 //               limit the sort value chosen for a buffer created via
00434 //               make_texture_buffer().  Normally, this buffer will be
00435 //               assigned a value of get_sort() - 1, so that it
00436 //               will be rendered before this window is rendered; but
00437 //               sometimes this isn't sufficiently early, especially
00438 //               if other buffers also have a view into the same
00439 //               scene.
00440 //
00441 //               If you specify a value here, then new buffers created
00442 //               via make_texture_buffer() will be given that sort
00443 //               value instead of get_sort() - 1.
00444 ////////////////////////////////////////////////////////////////////
00445 INLINE void GraphicsOutput::
00446 set_child_sort(int child_sort) {
00447   _child_sort = child_sort;
00448   _got_child_sort = true;
00449 }
00450 
00451 ////////////////////////////////////////////////////////////////////
00452 //     Function: GraphicsOutput::clear_child_sort
00453 //       Access: Published
00454 //  Description: Resets the sort value of future offscreen buffers
00455 //               created by make_texture_sort() to the default value.
00456 //               See set_child_sort().
00457 ////////////////////////////////////////////////////////////////////
00458 INLINE void GraphicsOutput::
00459 clear_child_sort() {
00460   _got_child_sort = false;
00461 }
00462 
00463 ////////////////////////////////////////////////////////////////////
00464 //     Function: GraphicsOutput::get_child_sort
00465 //       Access: Published
00466 //  Description: Returns the sort value of future offscreen buffers
00467 //               created by make_texture_sort(). See set_child_sort().
00468 ////////////////////////////////////////////////////////////////////
00469 INLINE int GraphicsOutput::
00470 get_child_sort() const {
00471   if (_got_child_sort) {
00472     return _child_sort;
00473   } else {
00474     return get_sort() - 1;
00475   }
00476 }
00477 
00478 ////////////////////////////////////////////////////////////////////
00479 //     Function: GraphicsOutput::trigger_copy
00480 //       Access: Published
00481 //  Description: When the GraphicsOutput is in triggered copy mode,
00482 //               this function triggers the copy (at the end of the
00483 //               next frame).
00484 ////////////////////////////////////////////////////////////////////
00485 INLINE void GraphicsOutput::
00486 trigger_copy()  {
00487   _trigger_copy = true;
00488 }
00489 
00490 ////////////////////////////////////////////////////////////////////
00491 //     Function: GraphicsOutput::make_display_region
00492 //       Access: Published
00493 //  Description: Creates a new DisplayRegion that covers the entire
00494 //               window.
00495 //
00496 //               If is_stereo() is true for this window, and
00497 //               default-stereo-camera is configured true, this
00498 //               actually makes a StereoDisplayRegion.  Call
00499 //               make_mono_display_region() or
00500 //               make_stereo_display_region() if you want to insist on
00501 //               one or the other.
00502 ////////////////////////////////////////////////////////////////////
00503 INLINE DisplayRegion *GraphicsOutput::
00504 make_display_region() {
00505   return make_display_region(0.0f, 1.0f, 0.0f, 1.0f);
00506 }
00507 
00508 ////////////////////////////////////////////////////////////////////
00509 //     Function: GraphicsOutput::make_mono_display_region
00510 //       Access: Published
00511 //  Description: Creates a new DisplayRegion that covers the entire
00512 //               window.
00513 //
00514 //               This always returns a mono DisplayRegion, even if
00515 //               is_stereo() is true.
00516 ////////////////////////////////////////////////////////////////////
00517 INLINE DisplayRegion *GraphicsOutput::
00518 make_mono_display_region() {
00519   return make_mono_display_region(0.0f, 1.0f, 0.0f, 1.0f);
00520 }
00521 
00522 ////////////////////////////////////////////////////////////////////
00523 //     Function: GraphicsOutput::make_stereo_display_region
00524 //       Access: Published
00525 //  Description: Creates a new DisplayRegion that covers the entire
00526 //               window.
00527 //
00528 //               This always returns a stereo DisplayRegion, even if
00529 //               is_stereo() is false.
00530 ////////////////////////////////////////////////////////////////////
00531 INLINE StereoDisplayRegion *GraphicsOutput::
00532 make_stereo_display_region() {
00533   return make_stereo_display_region(0.0f, 1.0f, 0.0f, 1.0f);
00534 }
00535 
00536 ////////////////////////////////////////////////////////////////////
00537 //     Function: GraphicsOutput::make_screenshot_filename
00538 //       Access: Published, Static
00539 //  Description: Saves a screenshot of the region to a default
00540 //               filename, and returns the filename, or empty string
00541 //               if the screenshot failed.  The default filename is
00542 //               generated from the supplied prefix and from the
00543 //               Config variable screenshot-filename, which contains
00544 //               the following strings:
00545 //
00546 //                 %~p - the supplied prefix
00547 //                 %~f - the frame count
00548 //                 %~e - the value of screenshot-extension
00549 //                 All other % strings in strftime().
00550 ////////////////////////////////////////////////////////////////////
00551 INLINE Filename GraphicsOutput::
00552 make_screenshot_filename(const string &prefix) {
00553   return DisplayRegion::make_screenshot_filename(prefix);
00554 }
00555 
00556 ////////////////////////////////////////////////////////////////////
00557 //     Function: GraphicsOutput::save_screenshot_default
00558 //       Access: Published
00559 //  Description: Saves a screenshot of the region to a default
00560 //               filename, and returns the filename, or empty string
00561 //               if the screenshot failed.  The filename is generated
00562 //               by make_screenshot_filename().
00563 ////////////////////////////////////////////////////////////////////
00564 INLINE Filename GraphicsOutput::
00565 save_screenshot_default(const string &prefix) {
00566   return _default_display_region->save_screenshot_default(prefix);
00567 }
00568 
00569 ////////////////////////////////////////////////////////////////////
00570 //     Function: GraphicsOutput::save_screenshot
00571 //       Access: Published
00572 //  Description: Saves a screenshot of the region to the indicated
00573 //               filename.  The image comment is an optional user
00574 //               readable string that will be saved with the header
00575 //               of the image (if the file format supports embedded
00576 //               data; for example jpg allows comments).  Returns
00577 //               true on success, false on failure.
00578 ////////////////////////////////////////////////////////////////////
00579 INLINE bool GraphicsOutput::
00580 save_screenshot(const Filename &filename, const string &image_comment) {
00581   return _default_display_region->save_screenshot(filename, image_comment);
00582 }
00583 
00584 ////////////////////////////////////////////////////////////////////
00585 //     Function: GraphicsOutput::get_screenshot
00586 //       Access: Published
00587 //  Description: Captures the most-recently rendered image from the
00588 //               framebuffer into the indicated PNMImage.  Returns
00589 //               true on success, false on failure.
00590 ////////////////////////////////////////////////////////////////////
00591 INLINE bool GraphicsOutput::
00592 get_screenshot(PNMImage &image) {
00593   return _default_display_region->get_screenshot(image);
00594 }
00595 
00596 ////////////////////////////////////////////////////////////////////
00597 //     Function: GraphicsOutput::flip_ready
00598 //       Access: Public
00599 //  Description: Returns true if a frame has been rendered and needs
00600 //               to be flipped, false otherwise.
00601 ////////////////////////////////////////////////////////////////////
00602 INLINE bool GraphicsOutput::
00603 flip_ready() const {
00604   return _flip_ready;
00605 }
00606 
00607 ////////////////////////////////////////////////////////////////////
00608 //     Function: GraphicsOutput::operator <
00609 //       Access: Public
00610 //  Description: The sorting operator is used to order the
00611 //               GraphicsOutput object in order by their sort number,
00612 //               so that they will render in the correct order in the
00613 //               GraphicsEngine.
00614 ////////////////////////////////////////////////////////////////////
00615 INLINE bool GraphicsOutput::
00616 operator < (const GraphicsOutput &other) const {
00617   if (_sort != other._sort) {
00618     return _sort < other._sort;
00619   }
00620   return _internal_sort_index < other._internal_sort_index;
00621 }
00622 
00623 
00624 ////////////////////////////////////////////////////////////////////
00625 //     Function: GraphicsOutput::determine_display_regions
00626 //       Access: Private
00627 //  Description: Recomputes the list of active DisplayRegions within
00628 //               the window, if they have changed recently.
00629 ////////////////////////////////////////////////////////////////////
00630 INLINE void GraphicsOutput::
00631 determine_display_regions() const {
00632   // This function isn't strictly speaking const, but we pretend it is
00633   // because it only updates a transparent cache value.
00634   if (_display_regions_stale) {
00635     ((GraphicsOutput *)this)->do_determine_display_regions();
00636   }
00637 }
00638 
00639 ////////////////////////////////////////////////////////////////////
00640 //     Function: GraphicsOutput::win_display_regions_changed
00641 //       Access: Private
00642 //  Description: Intended to be called when the active state on a
00643 //               nested display region changes, forcing the window to
00644 //               recompute its list of active display regions.
00645 ////////////////////////////////////////////////////////////////////
00646 INLINE void GraphicsOutput::
00647 win_display_regions_changed() {
00648   _display_regions_stale = true;
00649 }
00650 
00651 ////////////////////////////////////////////////////////////////////
00652 //     Function: GraphicsOutput::get_cull_window_pcollector
00653 //       Access: Public
00654 //  Description: Returns a PStatCollector for timing the cull
00655 //               operation for just this GraphicsOutput.
00656 ////////////////////////////////////////////////////////////////////
00657 INLINE PStatCollector &GraphicsOutput::
00658 get_cull_window_pcollector() {
00659   return _cull_window_pcollector;
00660 }
00661 
00662 ////////////////////////////////////////////////////////////////////
00663 //     Function: GraphicsOutput::get_draw_window_pcollector
00664 //       Access: Public
00665 //  Description: Returns a PStatCollector for timing the draw
00666 //               operation for just this GraphicsOutput.
00667 ////////////////////////////////////////////////////////////////////
00668 INLINE PStatCollector &GraphicsOutput::
00669 get_draw_window_pcollector() {
00670   return _draw_window_pcollector;
00671 }
00672 
00673 ////////////////////////////////////////////////////////////////////
00674 //     Function: GraphicsOutput::begin_frame_spam
00675 //       Access: Public
00676 //  Description: Display the spam message associated with begin_frame
00677 ////////////////////////////////////////////////////////////////////
00678 INLINE void GraphicsOutput::
00679 begin_frame_spam(FrameMode mode) {
00680   if (display_cat.is_spam()) {
00681     display_cat.spam()
00682       << "begin_frame(" << mode << "): " << get_type() << " "
00683       << get_name() << " " << (void *)this << "\n";
00684   }
00685 }
00686 
00687 ////////////////////////////////////////////////////////////////////
00688 //     Function: GraphicsOutput::end_frame_spam
00689 //       Access: Public
00690 //  Description: Display the spam message associated with end_frame
00691 ////////////////////////////////////////////////////////////////////
00692 INLINE void GraphicsOutput::
00693 end_frame_spam(FrameMode mode) {
00694   if (display_cat.is_spam()) {
00695     display_cat.spam()
00696       << "end_frame(" << mode << "): " << get_type() << " "
00697       << get_name() << " " << (void *)this << "\n";
00698   }
00699 }
00700 
00701 ////////////////////////////////////////////////////////////////////
00702 //     Function: GraphicsOutput::clear_cube_map_selection
00703 //       Access: Public
00704 //  Description: Clear the variables that select a cube-map face.
00705 ////////////////////////////////////////////////////////////////////
00706 INLINE void GraphicsOutput::
00707 clear_cube_map_selection() {
00708   _cube_map_index = -1;
00709   _cube_map_dr = NULL;
00710 }
00711 
00712 ////////////////////////////////////////////////////////////////////
00713 //     Function: GraphicsOutput::trigger_flip
00714 //       Access: Public
00715 //  Description: Set the flip_ready flag, only if legal to do so.
00716 ////////////////////////////////////////////////////////////////////
00717 INLINE void GraphicsOutput::
00718 trigger_flip() {
00719   if (!_fb_properties.is_single_buffered()) {
00720     _flip_ready = true;
00721   }
00722 }
00723 
 All Classes Functions Variables Enumerations