00001 // Filename: graphicsWindow.I 00002 // Created by: frang (07Mar99) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved 00008 // 00009 // All use of this software is subject to the terms of the Panda 3d 00010 // Software license. You should have received a copy of this license 00011 // along with this source code; you will also find a current copy of 00012 // the license at http://www.panda3d.org/license.txt . 00013 // 00014 // To contact the maintainers of this program write to 00015 // panda3d@yahoogroups.com . 00016 // 00017 //////////////////////////////////////////////////////////////////// 00018 00019 00020 //////////////////////////////////////////////////////////////////// 00021 // Function: GraphicsWindow::is_closed 00022 // Access: Published 00023 // Description: Returns true if the window has not yet been opened, 00024 // or has been fully closed, false if it is open. The 00025 // window is not opened immediately after 00026 // GraphicsEngine::make_window() is called; nor is it 00027 // closed immediately after 00028 // GraphicsEngine::remove_window() is called. Either 00029 // operation may take a frame or two. 00030 //////////////////////////////////////////////////////////////////// 00031 INLINE bool GraphicsWindow:: 00032 is_closed() const { 00033 return !_properties.get_open(); 00034 } 00035 00036 //////////////////////////////////////////////////////////////////// 00037 // Function: GraphicsWindow::is_active 00038 // Access: Published 00039 // Description: Returns true if the window is ready to be rendered 00040 // into, false otherwise. 00041 //////////////////////////////////////////////////////////////////// 00042 INLINE bool GraphicsWindow:: 00043 is_active() const { 00044 // Make this smarter? 00045 return _properties.get_open() && !_properties.get_minimized(); 00046 } 00047 00048 //////////////////////////////////////////////////////////////////// 00049 // Function: GraphicsWindow::is_fullscreen 00050 // Access: Published 00051 // Description: Returns true if the window has been opened as a 00052 // fullscreen window, false otherwise. 00053 //////////////////////////////////////////////////////////////////// 00054 INLINE bool GraphicsWindow:: 00055 is_fullscreen() const { 00056 return _properties.get_fullscreen(); 00057 } 00058 00059 //////////////////////////////////////////////////////////////////// 00060 // Function: GraphicsWindow::get_gsg 00061 // Access: Published 00062 // Description: Returns the GSG that is associated with this window. 00063 // There is a one-to-one association between windows and 00064 // GSG's. 00065 // 00066 // This may return NULL if the graphics context has not 00067 // yet been created for the window, e.g. before the 00068 // first frame has rendered; or after the window has 00069 // been closed. 00070 //////////////////////////////////////////////////////////////////// 00071 INLINE GraphicsStateGuardian *GraphicsWindow:: 00072 get_gsg() const { 00073 return _gsg; 00074 } 00075 00076 //////////////////////////////////////////////////////////////////// 00077 // Function: GraphicsWindow::get_pipe 00078 // Access: Published 00079 // Description: Returns the GraphicsPipe that this window is 00080 // associated with. It is possible that the 00081 // GraphicsPipe might have been deleted while an 00082 // outstanding PT(GraphicsWindow) prevented all of its 00083 // children windows from also being deleted; in this 00084 // unlikely case, get_pipe() may return NULL. 00085 //////////////////////////////////////////////////////////////////// 00086 INLINE GraphicsPipe *GraphicsWindow:: 00087 get_pipe() const { 00088 return _pipe; 00089 } 00090 00091 //////////////////////////////////////////////////////////////////// 00092 // Function: GraphicsWindow::win_display_regions_changed 00093 // Access: Public 00094 // Description: Intended to be called when the active state on a 00095 // nested channel or layer or display region changes, 00096 // forcing the window to recompute its list of active 00097 // display regions. 00098 //////////////////////////////////////////////////////////////////// 00099 INLINE void GraphicsWindow:: 00100 win_display_regions_changed() { 00101 _display_regions_stale = true; 00102 } 00103 00104 00105 //////////////////////////////////////////////////////////////////// 00106 // Function: GraphicsWindow::determine_display_regions 00107 // Access: Private 00108 // Description: Recomputes the list of active DisplayRegions within 00109 // the window, if they have changed recently. 00110 //////////////////////////////////////////////////////////////////// 00111 INLINE void GraphicsWindow:: 00112 determine_display_regions() const { 00113 // This function isn't strictly speaking const, but we pretend it is 00114 // because it only updates a transparent cache value. 00115 if (_display_regions_stale) { 00116 ((GraphicsWindow *)this)->do_determine_display_regions(); 00117 } 00118 }