Panda3D

projectionScreen.I

00001 // Filename: projectionScreen.I
00002 // Created by:  drose (11Dec01)
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 ////////////////////////////////////////////////////////////////////
00018 //     Function: ProjectionScreen::get_projector
00019 //       Access: Published
00020 //  Description: Returns the NodePath to the LensNode that is to serve
00021 //               as the projector for this screen, or empty if no
00022 //               projector is associated.
00023 ////////////////////////////////////////////////////////////////////
00024 INLINE const NodePath &ProjectionScreen::
00025 get_projector() const {
00026   return _projector;
00027 }
00028 
00029 ////////////////////////////////////////////////////////////////////
00030 //     Function: ProjectionScreen::set_texcoord_name
00031 //       Access: Published
00032 //  Description: Specifies the name of the texture coordinates that
00033 //               are generated by this particular ProjectionScreen.
00034 //               This can be used in the presence of multitexturing to
00035 //               compute the UV's for just a subset of all of the
00036 //               active stages of the multitexture pipeline.
00037 ////////////////////////////////////////////////////////////////////
00038 INLINE void ProjectionScreen::
00039 set_texcoord_name(const string &texcoord_name) {
00040   _texcoord_name = InternalName::get_texcoord_name(texcoord_name);
00041   _stale = true;
00042 }
00043 
00044 ////////////////////////////////////////////////////////////////////
00045 //     Function: ProjectionScreen::get_texcoord_name
00046 //       Access: Published
00047 //  Description: Returns the name of the texture coordinates that
00048 //               will be generated by this particular
00049 //               ProjectionScreen, as set by set_texcoord_name().
00050 ////////////////////////////////////////////////////////////////////
00051 INLINE string ProjectionScreen::
00052 get_texcoord_name() const {
00053   return _texcoord_name->get_name();
00054 }
00055 
00056 ////////////////////////////////////////////////////////////////////
00057 //     Function: ProjectionScreen::set_invert_uvs
00058 //       Access: Published
00059 //  Description: Some OpenGL graphics drivers are known to invert the
00060 //               framebuffer image when they copy it to texture.
00061 //               (This is arguably a problem with the OpenGL spec,
00062 //               which seems to be unclear about the proper ordering
00063 //               of pixels in this operation.)
00064 //
00065 //               In any case, set this true to compensate for this
00066 //               effect by inverting the UV's of the projection
00067 //               screen.  The default is taken from the Configrc
00068 //               variable project-invert-uvs.
00069 ////////////////////////////////////////////////////////////////////
00070 INLINE void ProjectionScreen::
00071 set_invert_uvs(bool invert_uvs) {
00072   _invert_uvs = invert_uvs;
00073   _stale = true;
00074 }
00075 
00076 
00077 ////////////////////////////////////////////////////////////////////
00078 //     Function: ProjectionScreen::get_invert_uvs
00079 //       Access: Published
00080 //  Description: Returns whether this screen is compensating for a
00081 //               graphics driver inverting the framebuffer image.  See
00082 //               set_invert_uvs().
00083 ////////////////////////////////////////////////////////////////////
00084 INLINE bool ProjectionScreen::
00085 get_invert_uvs() const {
00086   return _invert_uvs;
00087 }
00088 
00089 ////////////////////////////////////////////////////////////////////
00090 //     Function: ProjectionScreen::set_vignette_on
00091 //       Access: Published
00092 //  Description: Specifies whether vertex-based vignetting should be
00093 //               on.  When this is enabled, vertex color will be set
00094 //               on the screen vertices to color the screen two
00095 //               distinct colors, usually white and black, for the
00096 //               parts of the screen in front of and outside the lens'
00097 //               frustum, respectively.  When this is not enabled, the
00098 //               screen color will be left alone.
00099 //
00100 //               This effect generally looks terrible, but it does
00101 //               at least make the boundaries of the lens clear.
00102 ////////////////////////////////////////////////////////////////////
00103 INLINE void ProjectionScreen::
00104 set_vignette_on(bool vignette_on) {
00105   _vignette_on = vignette_on;
00106   _stale = true;
00107 }
00108 
00109 
00110 ////////////////////////////////////////////////////////////////////
00111 //     Function: ProjectionScreen::get_vignette_on
00112 //       Access: Published
00113 //  Description: Returns true if vertex-based vignetting is on, false
00114 //               otherwise.  See set_vignette_on().
00115 ////////////////////////////////////////////////////////////////////
00116 INLINE bool ProjectionScreen::
00117 get_vignette_on() const {
00118   return _vignette_on;
00119 }
00120 
00121 ////////////////////////////////////////////////////////////////////
00122 //     Function: ProjectionScreen::set_vignette_color
00123 //       Access: Published
00124 //  Description: Specifies the color the screen will be painted at the
00125 //               portions outside of the lens' frustum; i.e. where the
00126 //               lens can't see it or illuminate it.  This color is
00127 //               only used if the vignette_on flag is true; see
00128 //               set_vignette_on().
00129 ////////////////////////////////////////////////////////////////////
00130 INLINE void ProjectionScreen::
00131 set_vignette_color(const LColor &vignette_color) {
00132   _vignette_color = vignette_color;
00133   _stale = true;
00134 }
00135 
00136 ////////////////////////////////////////////////////////////////////
00137 //     Function: ProjectionScreen::get_vignette_color
00138 //       Access: Published
00139 //  Description: Returns the color the screen will be painted at the
00140 //               portions outside of the lens' frustum.  See
00141 //               set_vignette_color().
00142 ////////////////////////////////////////////////////////////////////
00143 INLINE const LColor &ProjectionScreen::
00144 get_vignette_color() const {
00145   return _vignette_color;
00146 }
00147 
00148 ////////////////////////////////////////////////////////////////////
00149 //     Function: ProjectionScreen::set_frame_color
00150 //       Access: Published
00151 //  Description: Specifies the color the screen will be painted at the
00152 //               portions outside of the lens' frustum; i.e. where the
00153 //               lens can't see it or illuminate it.  This color is
00154 //               only used if the vignette_on flag is true; see
00155 //               set_vignette_on().
00156 ////////////////////////////////////////////////////////////////////
00157 INLINE void ProjectionScreen::
00158 set_frame_color(const LColor &frame_color) {
00159   _frame_color = frame_color;
00160   _stale = true;
00161 }
00162 
00163 ////////////////////////////////////////////////////////////////////
00164 //     Function: ProjectionScreen::get_frame_color
00165 //       Access: Published
00166 //  Description: Returns the color the screen will be painted at the
00167 //               portions outside of the lens' frustum.  See
00168 //               set_frame_color().
00169 ////////////////////////////////////////////////////////////////////
00170 INLINE const LColor &ProjectionScreen::
00171 get_frame_color() const {
00172   return _frame_color;
00173 }
00174 
00175 ////////////////////////////////////////////////////////////////////
00176 //     Function: ProjectionScreen::set_auto_recompute
00177 //       Access: Published
00178 //  Description: Sets the auto_recompute flag.  When this is true,
00179 //               the ProjectionScreen will always be recomputed if
00180 //               necessary before the frame is drawn; when it is
00181 //               false, an explicit call to recompute_if_stale() may
00182 //               be required.
00183 ////////////////////////////////////////////////////////////////////
00184 INLINE void ProjectionScreen::
00185 set_auto_recompute(bool auto_recompute) {
00186   _auto_recompute = auto_recompute;
00187 }
00188 
00189 
00190 ////////////////////////////////////////////////////////////////////
00191 //     Function: ProjectionScreen::set_auto_recompute
00192 //       Access: Published
00193 //  Description: Returns the auto_recompute flag.  When this is true,
00194 //               the ProjectionScreen will always be recomputed if
00195 //               necessary before the frame is drawn; when it is
00196 //               false, an explicit call to recompute_if_stale() may
00197 //               be required.
00198 ////////////////////////////////////////////////////////////////////
00199 INLINE bool ProjectionScreen::
00200 get_auto_recompute() const {
00201   return _auto_recompute;
00202 }
00203 
00204 
00205 ////////////////////////////////////////////////////////////////////
00206 //     Function: ProjectionScreen::get_last_screen
00207 //       Access: Published
00208 //  Description: Returns an UpdateSeq corresponding to the last time a
00209 //               screen mesh was generated for the ProjectionScreen.
00210 //               Each time generate_screen() is called, this number is
00211 //               incremented; this allows other objects (like
00212 //               NonlinearImager) to know when they need to recompute
00213 //               themselves.
00214 ////////////////////////////////////////////////////////////////////
00215 INLINE const UpdateSeq &ProjectionScreen::
00216 get_last_screen() const {
00217   return _last_screen;
00218 }
00219 
 All Classes Functions Variables Enumerations