00001 // Filename: eggRenderMode.I 00002 // Created by: drose (20Jan99) 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: EggRenderMode::Copy Constructor 00019 // Access: Public 00020 // Description: 00021 //////////////////////////////////////////////////////////////////// 00022 INLINE EggRenderMode:: 00023 EggRenderMode(const EggRenderMode ©) { 00024 (*this) = copy; 00025 } 00026 00027 //////////////////////////////////////////////////////////////////// 00028 // Function: EggRenderMode::set_depth_write_mode 00029 // Access: Public 00030 // Description: Specifies whether writes should be made to the depth 00031 // buffer (assuming the rendering backend provides a 00032 // depth buffer) when rendering this geometry. 00033 //////////////////////////////////////////////////////////////////// 00034 INLINE void EggRenderMode:: 00035 set_depth_write_mode(DepthWriteMode mode) { 00036 _depth_write_mode = mode; 00037 } 00038 00039 //////////////////////////////////////////////////////////////////// 00040 // Function: EggRenderMode::get_depth_write_mode 00041 // Access: Public 00042 // Description: Returns the depth_write mode that was set, or 00043 // DWM_unspecified if nothing was set. See 00044 // set_depth_write_mode(). 00045 //////////////////////////////////////////////////////////////////// 00046 INLINE EggRenderMode::DepthWriteMode EggRenderMode:: 00047 get_depth_write_mode() const { 00048 return _depth_write_mode; 00049 } 00050 00051 //////////////////////////////////////////////////////////////////// 00052 // Function: EggRenderMode::set_depth_test_mode 00053 // Access: Public 00054 // Description: Specifies whether this geometry should be tested 00055 // against the depth buffer when it is drawn (assuming 00056 // the rendering backend provides a depth buffer). Note 00057 // that this is different, and independent from, the 00058 // depth_write mode. 00059 //////////////////////////////////////////////////////////////////// 00060 INLINE void EggRenderMode:: 00061 set_depth_test_mode(DepthTestMode mode) { 00062 _depth_test_mode = mode; 00063 } 00064 00065 //////////////////////////////////////////////////////////////////// 00066 // Function: EggRenderMode::get_depth_test_mode 00067 // Access: Public 00068 // Description: Returns the depth_test mode that was set, or 00069 // DTM_unspecified if nothing was set. See 00070 // set_depth_test_mode(). 00071 //////////////////////////////////////////////////////////////////// 00072 INLINE EggRenderMode::DepthTestMode EggRenderMode:: 00073 get_depth_test_mode() const { 00074 return _depth_test_mode; 00075 } 00076 00077 //////////////////////////////////////////////////////////////////// 00078 // Function: EggRenderMode::set_visibility_mode 00079 // Access: Public 00080 // Description: Specifies whether this geometry is to be considered 00081 // normally visible, or hidden. If it is hidden, it is 00082 // either not loaded into the scene graph at all, or 00083 // loaded as a "stashed" node, according to the setting 00084 // of egg-suppress-hidden. 00085 //////////////////////////////////////////////////////////////////// 00086 INLINE void EggRenderMode:: 00087 set_visibility_mode(VisibilityMode mode) { 00088 _visibility_mode = mode; 00089 } 00090 00091 //////////////////////////////////////////////////////////////////// 00092 // Function: EggRenderMode::get_visibility_mode 00093 // Access: Public 00094 // Description: Returns the visibility mode that was set, or 00095 // VM_unspecified if nothing was set. See 00096 // set_visibility_mode(). 00097 //////////////////////////////////////////////////////////////////// 00098 INLINE EggRenderMode::VisibilityMode EggRenderMode:: 00099 get_visibility_mode() const { 00100 return _visibility_mode; 00101 } 00102 00103 //////////////////////////////////////////////////////////////////// 00104 // Function: EggRenderMode::set_alpha_mode 00105 // Access: Public 00106 // Description: Specifies precisely how the transparency for this 00107 // geometry should be achieved, or if it should be used. 00108 // The default, AM_unspecified, is to use transparency 00109 // if the geometry has a color whose alpha value is 00110 // non-1, or if it has a four-channel texture applied; 00111 // otherwise, AM_on forces transparency on, and AM_off 00112 // forces it off. The other flavors of transparency are 00113 // specific ways to turn on transparency, which may or 00114 // may not be supported by a particular rendering 00115 // backend. 00116 //////////////////////////////////////////////////////////////////// 00117 INLINE void EggRenderMode:: 00118 set_alpha_mode(AlphaMode mode) { 00119 _alpha_mode = mode; 00120 } 00121 00122 //////////////////////////////////////////////////////////////////// 00123 // Function: EggRenderMode::get_alpha_mode 00124 // Access: Public 00125 // Description: Returns the alpha mode that was set, or 00126 // AM_unspecified if nothing was set. See 00127 // set_alpha_mode(). 00128 //////////////////////////////////////////////////////////////////// 00129 INLINE EggRenderMode::AlphaMode EggRenderMode:: 00130 get_alpha_mode() const { 00131 return _alpha_mode; 00132 } 00133 00134 //////////////////////////////////////////////////////////////////// 00135 // Function: EggRenderMode::set_depth_offset 00136 // Access: Public 00137 // Description: Sets the "depth-offset" flag associated with this 00138 // object. This adds or subtracts an offset bias 00139 // into the depth buffer. See also DepthOffsetAttrib 00140 // and NodePath::set_depth_offset(). 00141 //////////////////////////////////////////////////////////////////// 00142 INLINE void EggRenderMode:: 00143 set_depth_offset(int order) { 00144 _depth_offset = order; 00145 _has_depth_offset = true; 00146 } 00147 00148 00149 //////////////////////////////////////////////////////////////////// 00150 // Function: EggRenderMode::get_depth_offset 00151 // Access: Public 00152 // Description: Returns the "depth-offset" flag as set for this 00153 // particular object. See set_depth_offset(). 00154 //////////////////////////////////////////////////////////////////// 00155 INLINE int EggRenderMode:: 00156 get_depth_offset() const { 00157 return _depth_offset; 00158 } 00159 00160 //////////////////////////////////////////////////////////////////// 00161 // Function: EggRenderMode::has_depth_offset 00162 // Access: Public 00163 // Description: Returns true if the depth-offset flag has been set for 00164 // this particular object. See set_depth_offset(). 00165 //////////////////////////////////////////////////////////////////// 00166 INLINE bool EggRenderMode:: 00167 has_depth_offset() const { 00168 return _has_depth_offset; 00169 } 00170 00171 //////////////////////////////////////////////////////////////////// 00172 // Function: EggRenderMode::clear_depth_offset 00173 // Access: Public 00174 // Description: Removes the depth-offset flag from this particular 00175 // object. See set_depth_offset(). 00176 //////////////////////////////////////////////////////////////////// 00177 INLINE void EggRenderMode:: 00178 clear_depth_offset() { 00179 _has_depth_offset = false; 00180 } 00181 00182 00183 //////////////////////////////////////////////////////////////////// 00184 // Function: EggRenderMode::set_draw_order 00185 // Access: Public 00186 // Description: Sets the "draw-order" flag associated with this 00187 // object. This specifies a particular order in which 00188 // objects of this type should be drawn, within the 00189 // specified bin. If a bin is not explicitly specified, 00190 // "fixed" is used. See also set_bin(). 00191 //////////////////////////////////////////////////////////////////// 00192 INLINE void EggRenderMode:: 00193 set_draw_order(int order) { 00194 _draw_order = order; 00195 _has_draw_order = true; 00196 } 00197 00198 //////////////////////////////////////////////////////////////////// 00199 // Function: EggRenderMode::get_draw_order 00200 // Access: Public 00201 // Description: Returns the "draw-order" flag as set for this 00202 // particular object. See set_draw_order(). 00203 //////////////////////////////////////////////////////////////////// 00204 INLINE int EggRenderMode:: 00205 get_draw_order() const { 00206 return _draw_order; 00207 } 00208 00209 //////////////////////////////////////////////////////////////////// 00210 // Function: EggRenderMode::has_draw_order 00211 // Access: Public 00212 // Description: Returns true if the draw-order flag has been set for 00213 // this particular object. See set_draw_order(). 00214 //////////////////////////////////////////////////////////////////// 00215 INLINE bool EggRenderMode:: 00216 has_draw_order() const { 00217 return _has_draw_order; 00218 } 00219 00220 //////////////////////////////////////////////////////////////////// 00221 // Function: EggRenderMode::clear_draw_order 00222 // Access: Public 00223 // Description: Removes the draw-order flag from this particular 00224 // object. See set_draw_order(). 00225 //////////////////////////////////////////////////////////////////// 00226 INLINE void EggRenderMode:: 00227 clear_draw_order() { 00228 _has_draw_order = false; 00229 } 00230 00231 //////////////////////////////////////////////////////////////////// 00232 // Function: EggRenderMode::set_bin 00233 // Access: Public 00234 // Description: Sets the "bin" string for this particular object. 00235 // This names a particular bin in which the object 00236 // should be rendered. The exact meaning of a bin is 00237 // implementation defined, but generally a GeomBin 00238 // matching each bin name must also be specifically 00239 // added to the rendering engine (e.g. the 00240 // CullTraverser) in use for this to work. See also 00241 // set_draw_order(). 00242 //////////////////////////////////////////////////////////////////// 00243 INLINE void EggRenderMode:: 00244 set_bin(const string &bin) { 00245 _bin = bin; 00246 } 00247 00248 //////////////////////////////////////////////////////////////////// 00249 // Function: EggRenderMode::get_bin 00250 // Access: Public 00251 // Description: Returns the bin name that has been set for this 00252 // particular object, if any. See set_bin(). 00253 //////////////////////////////////////////////////////////////////// 00254 INLINE string EggRenderMode:: 00255 get_bin() const { 00256 return _bin; 00257 } 00258 00259 //////////////////////////////////////////////////////////////////// 00260 // Function: EggRenderMode::has_bin 00261 // Access: Public 00262 // Description: Returns true if a bin name has been set for this 00263 // particular object. See set_bin(). 00264 //////////////////////////////////////////////////////////////////// 00265 INLINE bool EggRenderMode:: 00266 has_bin() const { 00267 return !_bin.empty(); 00268 } 00269 00270 //////////////////////////////////////////////////////////////////// 00271 // Function: EggRenderMode::clear_bin 00272 // Access: Public 00273 // Description: Removes the bin name that was set for this particular 00274 // object. See set_bin(). 00275 //////////////////////////////////////////////////////////////////// 00276 INLINE void EggRenderMode:: 00277 clear_bin() { 00278 _bin = string(); 00279 } 00280 00281 //////////////////////////////////////////////////////////////////// 00282 // Function: EggRenderMode::Inequality Operator 00283 // Access: Public 00284 // Description: 00285 //////////////////////////////////////////////////////////////////// 00286 INLINE bool EggRenderMode:: 00287 operator != (const EggRenderMode &other) const { 00288 return !(*this == other); 00289 }