Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

panda/src/gobj/material.I

Go to the documentation of this file.
00001 // Filename: material.I
00002 // Created by:  mike (05Feb99)
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: Material::Constructor
00022 //       Access: Public
00023 //  Description:
00024 ////////////////////////////////////////////////////////////////////
00025 INLINE Material::
00026 Material() {
00027   _flags = 0;
00028   _shininess = 0.0;
00029 }
00030 
00031 ////////////////////////////////////////////////////////////////////
00032 //     Function: Material::Copy Constructor
00033 //       Access: Public
00034 //  Description:
00035 ////////////////////////////////////////////////////////////////////
00036 INLINE Material::
00037 Material(const Material &copy) {
00038   operator = (copy);
00039 }
00040 
00041 ////////////////////////////////////////////////////////////////////
00042 //     Function: Material::Destructor
00043 //       Access: Public
00044 //  Description:
00045 ////////////////////////////////////////////////////////////////////
00046 INLINE Material::
00047 ~Material() {
00048 }
00049 
00050 ////////////////////////////////////////////////////////////////////
00051 //     Function: Material::has_ambient
00052 //       Access: Public
00053 //  Description: Returns true if the ambient color has been explicitly
00054 //               set for this material, false otherwise.
00055 ////////////////////////////////////////////////////////////////////
00056 INLINE bool Material::
00057 has_ambient() const {
00058   return (_flags & F_ambient) != 0;
00059 }
00060 
00061 ////////////////////////////////////////////////////////////////////
00062 //     Function: Material::get_ambient
00063 //       Access: Public
00064 //  Description: Returns the ambient color setting, if it has been
00065 //               set.  Returns (0,0,0,0) if the ambient color has not
00066 //               been set.
00067 ////////////////////////////////////////////////////////////////////
00068 INLINE const Colorf &Material::
00069 get_ambient() const {
00070   return (_flags & F_ambient) != 0 ? _ambient : Colorf::zero();
00071 }
00072 
00073 ////////////////////////////////////////////////////////////////////
00074 //     Function: Material::clear_ambient
00075 //       Access: Public
00076 //  Description: Removes the explicit ambient color from the material.
00077 ////////////////////////////////////////////////////////////////////
00078 INLINE void Material::
00079 clear_ambient() {
00080   _flags &= ~F_ambient;
00081 }
00082 
00083 ////////////////////////////////////////////////////////////////////
00084 //     Function: Material::has_diffuse
00085 //       Access: Public
00086 //  Description: Returns true if the diffuse color has been explicitly
00087 //               set for this material, false otherwise.
00088 ////////////////////////////////////////////////////////////////////
00089 INLINE bool Material::
00090 has_diffuse() const {
00091   return (_flags & F_diffuse) != 0;
00092 }
00093 
00094 ////////////////////////////////////////////////////////////////////
00095 //     Function: Material::get_diffuse
00096 //       Access: Public
00097 //  Description: Returns the diffuse color setting, if it has been
00098 //               set.  Returns (0,0,0,0) if the diffuse color has not
00099 //               been set.
00100 ////////////////////////////////////////////////////////////////////
00101 INLINE const Colorf &Material::
00102 get_diffuse() const {
00103   return (_flags & F_diffuse) != 0 ? _diffuse : Colorf::zero();
00104 }
00105 
00106 ////////////////////////////////////////////////////////////////////
00107 //     Function: Material::clear_diffuse
00108 //       Access: Public
00109 //  Description: Removes the explicit diffuse color from the material.
00110 ////////////////////////////////////////////////////////////////////
00111 INLINE void Material::
00112 clear_diffuse() {
00113   _flags &= ~F_diffuse;
00114 }
00115 
00116 ////////////////////////////////////////////////////////////////////
00117 //     Function: Material::has_specular
00118 //       Access: Public
00119 //  Description: Returns true if the specular color has been explicitly
00120 //               set for this material, false otherwise.
00121 ////////////////////////////////////////////////////////////////////
00122 INLINE bool Material::
00123 has_specular() const {
00124   return (_flags & F_specular) != 0;
00125 }
00126 
00127 ////////////////////////////////////////////////////////////////////
00128 //     Function: Material::get_specular
00129 //       Access: Public
00130 //  Description: Returns the specular color setting, if it has been
00131 //               set.  Returns (0,0,0,0) if the specular color has not
00132 //               been set.
00133 ////////////////////////////////////////////////////////////////////
00134 INLINE const Colorf &Material::
00135 get_specular() const {
00136   return (_flags & F_specular) != 0 ? _specular : Colorf::zero();
00137 }
00138 
00139 ////////////////////////////////////////////////////////////////////
00140 //     Function: Material::clear_specular
00141 //       Access: Public
00142 //  Description: Removes the explicit specular color from the material.
00143 ////////////////////////////////////////////////////////////////////
00144 INLINE void Material::
00145 clear_specular() {
00146   _flags &= ~F_specular;
00147 }
00148 
00149 ////////////////////////////////////////////////////////////////////
00150 //     Function: Material::has_emission
00151 //       Access: Public
00152 //  Description: Returns true if the emission color has been explicitly
00153 //               set for this material, false otherwise.
00154 ////////////////////////////////////////////////////////////////////
00155 INLINE bool Material::
00156 has_emission() const {
00157   return (_flags & F_emission) != 0;
00158 }
00159 
00160 ////////////////////////////////////////////////////////////////////
00161 //     Function: Material::get_emission
00162 //       Access: Public
00163 //  Description: Returns the emmission color setting, if it has been
00164 //               set.  Returns (0,0,0,0) if the emmission color has not
00165 //               been set.
00166 ////////////////////////////////////////////////////////////////////
00167 INLINE const Colorf &Material::
00168 get_emission() const {
00169   return (_flags & F_emission) != 0 ? _emission : Colorf::zero();
00170 }
00171 
00172 ////////////////////////////////////////////////////////////////////
00173 //     Function: Material::clear_emission
00174 //       Access: Public
00175 //  Description: Removes the explicit emission color from the material.
00176 ////////////////////////////////////////////////////////////////////
00177 INLINE void Material::
00178 clear_emission() {
00179   _flags &= ~F_emission;
00180 }
00181 
00182 ////////////////////////////////////////////////////////////////////
00183 //     Function: Material::get_shininess
00184 //       Access: Public
00185 //  Description: Returns the shininess exponent of the material.
00186 ////////////////////////////////////////////////////////////////////
00187 INLINE float Material::
00188 get_shininess() const {
00189   return _shininess;
00190 }
00191 
00192 ////////////////////////////////////////////////////////////////////
00193 //     Function: Material::set_shininess
00194 //       Access: Public
00195 //  Description: Sets the shininess exponent of the material.  This
00196 //               controls the size of the specular highlight spot.  In
00197 //               general, larger number produce a smaller specular
00198 //               highlight, which makes the object appear shinier.
00199 //               Smaller numbers produce a larger highlight, which
00200 //               makes the object appear less shiny.
00201 ////////////////////////////////////////////////////////////////////
00202 INLINE void Material::
00203 set_shininess(float shininess) {
00204   _shininess = shininess;
00205 }
00206 
00207 ////////////////////////////////////////////////////////////////////
00208 //     Function: Material::get_local
00209 //       Access: Public
00210 //  Description:
00211 ////////////////////////////////////////////////////////////////////
00212 INLINE bool Material::
00213 get_local() const {
00214   return (_flags & F_local) != 0;
00215 }
00216 
00217 ////////////////////////////////////////////////////////////////////
00218 //     Function: Material::set_local
00219 //       Access: Public
00220 //  Description:
00221 ////////////////////////////////////////////////////////////////////
00222 INLINE void Material::
00223 set_local(bool local) {
00224   if (local) {
00225     _flags |= F_local;
00226   } else {
00227     _flags &= ~F_local;
00228   }
00229 }
00230 
00231 ////////////////////////////////////////////////////////////////////
00232 //     Function: Material::get_twoside
00233 //       Access: Public
00234 //  Description:
00235 ////////////////////////////////////////////////////////////////////
00236 INLINE bool Material::
00237 get_twoside() const {
00238   return (_flags & F_twoside) != 0;
00239 }
00240 
00241 ////////////////////////////////////////////////////////////////////
00242 //     Function: Material::set_twoside
00243 //       Access: Public
00244 //  Description:
00245 ////////////////////////////////////////////////////////////////////
00246 INLINE void Material::
00247 set_twoside(bool twoside) {
00248   if (twoside) {
00249     _flags |= F_twoside;
00250   } else {
00251     _flags &= ~F_twoside;
00252   }
00253 }
00254 
00255 ////////////////////////////////////////////////////////////////////
00256 //     Function: Material::operator ==
00257 //       Access: Public
00258 //  Description:
00259 ////////////////////////////////////////////////////////////////////
00260 INLINE bool Material::
00261 operator == (const Material &other) const {
00262   return compare_to(other) == 0;
00263 }
00264 
00265 ////////////////////////////////////////////////////////////////////
00266 //     Function: Material::operator !=
00267 //       Access: Public
00268 //  Description:
00269 ////////////////////////////////////////////////////////////////////
00270 INLINE bool Material::
00271 operator != (const Material &other) const {
00272   return compare_to(other) != 0;
00273 }
00274 
00275 ////////////////////////////////////////////////////////////////////
00276 //     Function: Material::operator <
00277 //       Access: Public
00278 //  Description:
00279 ////////////////////////////////////////////////////////////////////
00280 INLINE bool Material::
00281 operator < (const Material &other) const {
00282   return compare_to(other) < 0;
00283 }

Generated on Fri May 2 00:39:37 2003 for Panda by doxygen1.3