22 Material(
const string &name) :
Namable(name) {
23 _ambient.set(1.0f, 1.0f, 1.0f, 1.0f);
24 _diffuse.set(1.0f, 1.0f, 1.0f, 1.0f);
25 _specular.set(0.0f, 0.0f, 0.0f, 1.0f);
26 _emission.set(0.0f, 0.0f, 0.0f, 1.0f);
71 return (_flags & F_ambient) != 0;
93 if (enforce_attrib_lock) {
94 nassertv(!is_attrib_locked());
97 _ambient.set(0.0f, 0.0f, 0.0f, 0.0f);
108 return (_flags & F_diffuse) != 0;
130 if (enforce_attrib_lock) {
131 nassertv(!is_attrib_locked());
133 _flags &= ~F_diffuse;
134 _diffuse.set(1.0f, 1.0f, 1.0f, 1.0f);
145 return (_flags & F_specular) != 0;
167 if (enforce_attrib_lock) {
168 nassertv(!is_attrib_locked());
170 _flags &= ~F_specular;
171 _specular.set(0.0f, 0.0f, 0.0f, 0.0f);
182 return (_flags & F_emission) != 0;
204 if (enforce_attrib_lock) {
205 nassertv(!is_attrib_locked());
207 _flags &= ~F_emission;
208 _emission.set(0.0f, 0.0f, 0.0f, 0.0f);
233 _shininess = shininess;
243 return (_flags & F_local) != 0;
257 if (enforce_attrib_lock) {
258 nassertv(!is_attrib_locked());
275 return (_flags & F_twoside) != 0;
289 if (enforce_attrib_lock) {
290 nassertv(!is_attrib_locked());
295 _flags &= ~F_twoside;
304 INLINE
bool Material::
305 operator == (
const Material &other)
const {
314 INLINE
bool Material::
315 operator != (
const Material &other)
const {
324 INLINE
bool Material::
325 operator < (
const Material &other)
const {
334 INLINE
bool Material::
335 is_attrib_locked()
const {
336 return (_flags & F_attrib_lock) != 0;
344 INLINE
void Material::
346 _flags |= F_attrib_lock;
bool get_local() const
Returns the local viewer flag.
void set_shininess(PN_stdfloat shininess)
Sets the shininess exponent of the material.
bool has_ambient() const
Returns true if the ambient color has been explicitly set for this material, false otherwise...
PN_stdfloat get_shininess() const
Returns the shininess exponent of the material.
void set_twoside(bool twoside)
Set this true to enable two-sided lighting.
static Material * get_default()
Returns the default material.
int compare_to(const Material &other) const
Returns a number less than zero if this material sorts before the other one, greater than zero if it ...
const LColor & get_diffuse() const
Returns the diffuse color setting, if it has been set.
const LColor & get_ambient() const
Returns the ambient color setting, if it has been set.
A base class for all things which can have a name.
void clear_specular()
Removes the explicit specular color from the material.
void clear_diffuse()
Removes the explicit diffuse color from the material.
void clear_ambient()
Removes the explicit ambient color from the material.
bool has_specular() const
Returns true if the specular color has been explicitly set for this material, false otherwise...
Defines the way an object appears in the presence of lighting.
This is the base class for all three-component vectors and points.
void set_local(bool local)
Sets the local viewer flag.
const LColor & get_emission() const
Returns the emission color setting, if it has been set.
bool has_diffuse() const
Returns true if the diffuse color has been explicitly set for this material, false otherwise...
bool get_twoside() const
Returns the state of the two-sided lighting flag.
bool has_emission() const
Returns true if the emission color has been explicitly set for this material, false otherwise...
void clear_emission()
Removes the explicit emission color from the material.
const LColor & get_specular() const
Returns the specular color setting, if it has been set.