00001 // Filename: projectionScreen.I 00002 // Created by: drose (11Dec01) 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 //////////////////////////////////////////////////////////////////// 00022 // Function: ProjectionScreen::get_projector 00023 // Access: Published 00024 // Description: Returns the NodePath to the LensNode that is to serve 00025 // as the projector for this screen, or empty if no 00026 // projector is associated. 00027 //////////////////////////////////////////////////////////////////// 00028 INLINE const NodePath &ProjectionScreen:: 00029 get_projector() const { 00030 return _projector; 00031 } 00032 00033 //////////////////////////////////////////////////////////////////// 00034 // Function: ProjectionScreen::set_invert_uvs 00035 // Access: Published 00036 // Description: Some OpenGL graphics drivers are known to invert the 00037 // framebuffer image when they copy it to texture. 00038 // (This is arguably a problem with the OpenGL spec, 00039 // which seems to be unclear about the proper ordering 00040 // of pixels in this operation.) 00041 // 00042 // In any case, set this true to compensate for this 00043 // effect by inverting the UV's of the projection 00044 // screen. The default is taken from the Configrc 00045 // variable project-invert-uvs. 00046 //////////////////////////////////////////////////////////////////// 00047 INLINE void ProjectionScreen:: 00048 set_invert_uvs(bool invert_uvs) { 00049 _invert_uvs = invert_uvs; 00050 _stale = true; 00051 } 00052 00053 00054 //////////////////////////////////////////////////////////////////// 00055 // Function: ProjectionScreen::get_invert_uvs 00056 // Access: Published 00057 // Description: Returns whether this screen is compensating for a 00058 // graphics driver inverting the framebuffer image. See 00059 // set_invert_uvs(). 00060 //////////////////////////////////////////////////////////////////// 00061 INLINE bool ProjectionScreen:: 00062 get_invert_uvs() const { 00063 return _invert_uvs; 00064 } 00065 00066 //////////////////////////////////////////////////////////////////// 00067 // Function: ProjectionScreen::set_vignette_on 00068 // Access: Published 00069 // Description: Specifies whether vertex-based vignetting should be 00070 // on. When this is enabled, vertex color will be set 00071 // on the screen vertices to color the screen two 00072 // distinct colors, usually white and black, for the 00073 // parts of the screen in front of and outside the lens' 00074 // frustum, respectively. When this is not enabled, the 00075 // screen color will be left alone. 00076 // 00077 // This effect generally looks terrible, but it does 00078 // at least make the boundaries of the lens clear. 00079 //////////////////////////////////////////////////////////////////// 00080 INLINE void ProjectionScreen:: 00081 set_vignette_on(bool vignette_on) { 00082 _vignette_on = vignette_on; 00083 _stale = true; 00084 } 00085 00086 00087 //////////////////////////////////////////////////////////////////// 00088 // Function: ProjectionScreen::get_vignette_on 00089 // Access: Published 00090 // Description: Returns true if vertex-based vignetting is on, false 00091 // otherwise. See set_vignette_on(). 00092 //////////////////////////////////////////////////////////////////// 00093 INLINE bool ProjectionScreen:: 00094 get_vignette_on() const { 00095 return _vignette_on; 00096 } 00097 00098 //////////////////////////////////////////////////////////////////// 00099 // Function: ProjectionScreen::set_vignette_color 00100 // Access: Published 00101 // Description: Specifies the color the screen will be painted at the 00102 // portions outside of the lens' frustum; i.e. where the 00103 // lens can't see it or illuminate it. This color is 00104 // only used if the vignette_on flag is true; see 00105 // set_vignette_on(). 00106 //////////////////////////////////////////////////////////////////// 00107 INLINE void ProjectionScreen:: 00108 set_vignette_color(const Colorf &vignette_color) { 00109 _vignette_color = vignette_color; 00110 _stale = true; 00111 } 00112 00113 //////////////////////////////////////////////////////////////////// 00114 // Function: ProjectionScreen::get_vignette_color 00115 // Access: Published 00116 // Description: Returns the color the screen will be painted at the 00117 // portions outside of the lens' frustum. See 00118 // set_vignette_color(). 00119 //////////////////////////////////////////////////////////////////// 00120 INLINE const Colorf &ProjectionScreen:: 00121 get_vignette_color() const { 00122 return _vignette_color; 00123 } 00124 00125 //////////////////////////////////////////////////////////////////// 00126 // Function: ProjectionScreen::set_frame_color 00127 // Access: Published 00128 // Description: Specifies the color the screen will be painted at the 00129 // portions outside of the lens' frustum; i.e. where the 00130 // lens can't see it or illuminate it. This color is 00131 // only used if the vignette_on flag is true; see 00132 // set_vignette_on(). 00133 //////////////////////////////////////////////////////////////////// 00134 INLINE void ProjectionScreen:: 00135 set_frame_color(const Colorf &frame_color) { 00136 _frame_color = frame_color; 00137 _stale = true; 00138 } 00139 00140 //////////////////////////////////////////////////////////////////// 00141 // Function: ProjectionScreen::get_frame_color 00142 // Access: Published 00143 // Description: Returns the color the screen will be painted at the 00144 // portions outside of the lens' frustum. See 00145 // set_frame_color(). 00146 //////////////////////////////////////////////////////////////////// 00147 INLINE const Colorf &ProjectionScreen:: 00148 get_frame_color() const { 00149 return _frame_color; 00150 } 00151 00152 //////////////////////////////////////////////////////////////////// 00153 // Function: ProjectionScreen::get_last_screen 00154 // Access: Public 00155 // Description: Returns an UpdateSeq corresponding to the last time a 00156 // screen mesh was generated for the ProjectionScreen. 00157 // Each time generate_screen() is called, this number is 00158 // incremented; this allows other objects (like 00159 // NonlinearImager) to know when they need to recompute 00160 // themselves. 00161 //////////////////////////////////////////////////////////////////// 00162 INLINE const UpdateSeq &ProjectionScreen:: 00163 get_last_screen() const { 00164 return _last_screen; 00165 }