Panda3D
|
00001 // Filename: eggMaterial.I 00002 // Created by: drose (29Jan99) 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 // Function: EggMaterial::set_diff 00018 // Access: Public 00019 // Description: 00020 //////////////////////////////////////////////////////////////////// 00021 INLINE void EggMaterial:: 00022 set_diff(const LColor &diff) { 00023 _diff = diff; 00024 _flags |= F_diff; 00025 } 00026 00027 //////////////////////////////////////////////////////////////////// 00028 // Function: EggMaterial::clear_diff 00029 // Access: Public 00030 // Description: 00031 //////////////////////////////////////////////////////////////////// 00032 INLINE void EggMaterial:: 00033 clear_diff() { 00034 _flags &= ~F_diff; 00035 } 00036 00037 //////////////////////////////////////////////////////////////////// 00038 // Function: EggMaterial::has_diff 00039 // Access: Public 00040 // Description: 00041 //////////////////////////////////////////////////////////////////// 00042 INLINE bool EggMaterial:: 00043 has_diff() const { 00044 return (_flags & F_diff) != 0; 00045 } 00046 00047 //////////////////////////////////////////////////////////////////// 00048 // Function: EggMaterial::get_diff 00049 // Access: Public 00050 // Description: It is legal to call this even if has_diff() returns 00051 // false. If so, it simply returns the default diff 00052 // color. 00053 //////////////////////////////////////////////////////////////////// 00054 INLINE LColor EggMaterial:: 00055 get_diff() const { 00056 if (has_diff()) { 00057 return _diff; 00058 } else { 00059 return LColor(1.0, 1.0, 1.0, 1.0); 00060 } 00061 } 00062 00063 //////////////////////////////////////////////////////////////////// 00064 // Function: EggMaterial::set_amb 00065 // Access: Public 00066 // Description: 00067 //////////////////////////////////////////////////////////////////// 00068 INLINE void EggMaterial:: 00069 set_amb(const LColor &amb) { 00070 _amb = amb; 00071 _flags |= F_amb; 00072 } 00073 00074 //////////////////////////////////////////////////////////////////// 00075 // Function: EggMaterial::clear_amb 00076 // Access: Public 00077 // Description: 00078 //////////////////////////////////////////////////////////////////// 00079 INLINE void EggMaterial:: 00080 clear_amb() { 00081 _flags &= ~F_amb; 00082 } 00083 00084 //////////////////////////////////////////////////////////////////// 00085 // Function: EggMaterial::has_amb 00086 // Access: Public 00087 // Description: 00088 //////////////////////////////////////////////////////////////////// 00089 INLINE bool EggMaterial:: 00090 has_amb() const { 00091 return (_flags & F_amb) != 0; 00092 } 00093 00094 //////////////////////////////////////////////////////////////////// 00095 // Function: EggMaterial::get_amb 00096 // Access: Public 00097 // Description: It is legal to call this even if has_amb() returns 00098 // false. If so, it simply returns the default amb 00099 // color. 00100 //////////////////////////////////////////////////////////////////// 00101 INLINE LColor EggMaterial:: 00102 get_amb() const { 00103 if (has_amb()) { 00104 return _amb; 00105 } else { 00106 return LColor(1.0, 1.0, 1.0, 1.0); 00107 } 00108 } 00109 00110 //////////////////////////////////////////////////////////////////// 00111 // Function: EggMaterial::set_emit 00112 // Access: Public 00113 // Description: 00114 //////////////////////////////////////////////////////////////////// 00115 INLINE void EggMaterial:: 00116 set_emit(const LColor &emit) { 00117 _emit = emit; 00118 _flags |= F_emit; 00119 } 00120 00121 //////////////////////////////////////////////////////////////////// 00122 // Function: EggMaterial::clear_emit 00123 // Access: Public 00124 // Description: 00125 //////////////////////////////////////////////////////////////////// 00126 INLINE void EggMaterial:: 00127 clear_emit() { 00128 _flags &= ~F_emit; 00129 } 00130 00131 //////////////////////////////////////////////////////////////////// 00132 // Function: EggMaterial::has_emit 00133 // Access: Public 00134 // Description: 00135 //////////////////////////////////////////////////////////////////// 00136 INLINE bool EggMaterial:: 00137 has_emit() const { 00138 return (_flags & F_emit) != 0; 00139 } 00140 00141 //////////////////////////////////////////////////////////////////// 00142 // Function: EggMaterial::get_emit 00143 // Access: Public 00144 // Description: It is legal to call this even if has_emit() returns 00145 // false. If so, it simply returns the default emit 00146 // color. 00147 //////////////////////////////////////////////////////////////////// 00148 INLINE LColor EggMaterial:: 00149 get_emit() const { 00150 if (has_emit()) { 00151 return _emit; 00152 } else { 00153 return LColor(0.0, 0.0, 0.0, 1.0); 00154 } 00155 } 00156 00157 //////////////////////////////////////////////////////////////////// 00158 // Function: EggMaterial::set_spec 00159 // Access: Public 00160 // Description: 00161 //////////////////////////////////////////////////////////////////// 00162 INLINE void EggMaterial:: 00163 set_spec(const LColor &spec) { 00164 _spec = spec; 00165 _flags |= F_spec; 00166 } 00167 00168 //////////////////////////////////////////////////////////////////// 00169 // Function: EggMaterial::clear_spec 00170 // Access: Public 00171 // Description: 00172 //////////////////////////////////////////////////////////////////// 00173 INLINE void EggMaterial:: 00174 clear_spec() { 00175 _flags &= ~F_spec; 00176 } 00177 00178 //////////////////////////////////////////////////////////////////// 00179 // Function: EggMaterial::has_spec 00180 // Access: Public 00181 // Description: 00182 //////////////////////////////////////////////////////////////////// 00183 INLINE bool EggMaterial:: 00184 has_spec() const { 00185 return (_flags & F_spec) != 0; 00186 } 00187 00188 //////////////////////////////////////////////////////////////////// 00189 // Function: EggMaterial::get_spec 00190 // Access: Public 00191 // Description: It is legal to call this even if has_spec() returns 00192 // false. If so, it simply returns the default spec 00193 // color. 00194 //////////////////////////////////////////////////////////////////// 00195 INLINE LColor EggMaterial:: 00196 get_spec() const { 00197 if (has_spec()) { 00198 return _spec; 00199 } else { 00200 return LColor(0.0, 0.0, 0.0, 1.0); 00201 } 00202 } 00203 00204 //////////////////////////////////////////////////////////////////// 00205 // Function: EggMaterial::set_shininess 00206 // Access: Public 00207 // Description: 00208 //////////////////////////////////////////////////////////////////// 00209 INLINE void EggMaterial:: 00210 set_shininess(double shininess) { 00211 _shininess = shininess; 00212 _flags |= F_shininess; 00213 } 00214 00215 //////////////////////////////////////////////////////////////////// 00216 // Function: EggMaterial::clear_shininess 00217 // Access: Public 00218 // Description: 00219 //////////////////////////////////////////////////////////////////// 00220 INLINE void EggMaterial:: 00221 clear_shininess() { 00222 _flags &= ~F_shininess; 00223 } 00224 00225 //////////////////////////////////////////////////////////////////// 00226 // Function: EggMaterial::has_shininess 00227 // Access: Public 00228 // Description: 00229 //////////////////////////////////////////////////////////////////// 00230 INLINE bool EggMaterial:: 00231 has_shininess() const { 00232 return (_flags & F_shininess) != 0; 00233 } 00234 00235 //////////////////////////////////////////////////////////////////// 00236 // Function: EggMaterial::get_shininess 00237 // Access: Public 00238 // Description: 00239 //////////////////////////////////////////////////////////////////// 00240 INLINE double EggMaterial:: 00241 get_shininess() const { 00242 if (has_shininess()) { 00243 return _shininess; 00244 } else { 00245 return 0.0; 00246 } 00247 } 00248 00249 //////////////////////////////////////////////////////////////////// 00250 // Function: EggMaterial::set_local 00251 // Access: Public 00252 // Description: 00253 //////////////////////////////////////////////////////////////////// 00254 INLINE void EggMaterial:: 00255 set_local(bool local) { 00256 _local = local; 00257 _flags |= F_local; 00258 } 00259 00260 //////////////////////////////////////////////////////////////////// 00261 // Function: EggMaterial::clear_local 00262 // Access: Public 00263 // Description: 00264 //////////////////////////////////////////////////////////////////// 00265 INLINE void EggMaterial:: 00266 clear_local() { 00267 _flags &= ~F_local; 00268 } 00269 00270 //////////////////////////////////////////////////////////////////// 00271 // Function: EggMaterial::has_local 00272 // Access: Public 00273 // Description: 00274 //////////////////////////////////////////////////////////////////// 00275 INLINE bool EggMaterial:: 00276 has_local() const { 00277 return (_flags & F_local) != 0; 00278 } 00279 00280 //////////////////////////////////////////////////////////////////// 00281 // Function: EggMaterial::get_local 00282 // Access: Public 00283 // Description: 00284 //////////////////////////////////////////////////////////////////// 00285 INLINE bool EggMaterial:: 00286 get_local() const { 00287 if (has_local()) { 00288 return _local; 00289 } else { 00290 return 0.0; 00291 } 00292 } 00293 00294 //////////////////////////////////////////////////////////////////// 00295 // Function: UniqueEggMaterials::Constructor 00296 // Access: Public 00297 // Description: 00298 //////////////////////////////////////////////////////////////////// 00299 INLINE UniqueEggMaterials:: 00300 UniqueEggMaterials(int eq) : _eq(eq) { 00301 } 00302 00303 //////////////////////////////////////////////////////////////////// 00304 // Function: UniqueEggMaterials::Function operator 00305 // Access: Public 00306 // Description: 00307 //////////////////////////////////////////////////////////////////// 00308 INLINE bool UniqueEggMaterials:: 00309 operator ()(const EggMaterial *t1, const EggMaterial *t2) const { 00310 return t1->sorts_less_than(*t2, _eq); 00311 } 00312