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