43class EXPCL_PANDA_GOBJ Material :
public TypedWritableReferenceCount,
public Namable {
45 INLINE
explicit Material(
const std::string &name =
"");
46 INLINE Material(
const Material ©);
47 void operator = (
const Material ©);
98 INLINE
bool operator == (
const Material &other)
const;
99 INLINE
bool operator != (
const Material &other)
const;
100 INLINE
bool operator < (
const Material &other)
const;
104 void output(std::ostream &out)
const;
105 void write(std::ostream &out,
int indent)
const;
132 INLINE
bool is_used_by_auto_shader()
const;
136 INLINE
int get_flags()
const;
145 F_attrib_lock = 0x040,
148 F_base_color = 0x200,
149 F_refractive_index = 0x400,
150 F_used_by_auto_shader = 0x800,
159 PN_stdfloat _shininess;
160 PN_stdfloat _roughness;
161 PN_stdfloat _metallic;
162 PN_stdfloat _refractive_index;
169 static void register_with_read_factory();
180 static void init_type() {
181 TypedWritableReferenceCount::init_type();
183 TypedWritableReferenceCount::get_class_type());
185 virtual TypeHandle get_type()
const {
186 return get_class_type();
188 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
192 static TypeHandle _type_handle;
195INLINE std::ostream &operator << (std::ostream &out,
const Material &m) {
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
A class to retrieve the individual data elements previously stored in a Datagram.
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
An instance of this class is passed to the Factory when requesting it to do its business and construc...
Defines the way an object appears in the presence of lighting.
get_ambient
Returns the ambient color setting, if it has been set.
has_specular
Returns true if the specular color has been explicitly set for this material, false otherwise.
set_emission
Specifies the emission color setting of the material.
bool has_metallic() const
Returns true if the metallic has been explicitly set for this material, false otherwise.
set_diffuse
Specifies the diffuse color setting of the material.
get_emission
Returns the emission color setting, if it has been set.
has_diffuse
Returns true if the diffuse color has been explicitly set for this material, false otherwise.
set_metallic
Sets the metallic setting of the material, which is is used for physically- based rendering models.
set_shininess
Sets the shininess exponent of the material.
has_base_color
Returns true if the base color has been explicitly set for this material, false otherwise.
set_roughness
Sets the roughness exponent of the material, where 0 is completely shiny (infinite shininess),...
void clear_metallic()
Removes the explicit metallic setting from the material.
set_base_color
Specifies the base color of the material.
get_base_color
Returns the base_color color setting, if it has been set.
get_refractive_index
Returns the index of refraction, or 1 if none has been set for this material.
clear_specular
Removes the explicit specular color from the material.
void mark_used_by_auto_shader()
Called by the shader generator to indicate that a shader has been generated that uses this material.
set_specular
Specifies the specular color setting of the material.
get_twoside
Returns the state of the two-sided lighting flag.
set_ambient
Specifies the ambient color setting of the material.
set_twoside
Set this true to enable two-sided lighting.
clear_diffuse
Removes the explicit diffuse color from the material.
clear_emission
Removes the explicit emission color from the material.
get_specular
Returns the specular color setting, if it has been set.
has_emission
Returns true if the emission color has been explicitly set for this material, false otherwise.
has_ambient
Returns true if the ambient color has been explicitly set for this material, false otherwise.
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 ...
get_metallic
Returns the metallic setting, if it has been set.
bool is_attrib_locked() const
get_roughness
Returns the roughness previously specified by set_roughness.
clear_base_color
Removes the explicit base_color color from the material.
set_refractive_index
Sets the index of refraction of the material, which is used to determine the specular color in absenc...
get_shininess
Returns the shininess exponent of the material.
static Material * get_default()
Returns the default material.
clear_ambient
Removes the explicit ambient color from the material.
bool has_refractive_index() const
Returns true if a refractive index has explicitly been specified for this material.
set_local
Sets the local viewer flag.
get_diffuse
Returns the diffuse color setting, if it has been set.
bool has_roughness() const
Returns true if the roughness has been explicitly set for this material, false otherwise.
get_local
Returns the local viewer flag.
void output(std::ostream &out) const
Outputs the Namable.
TypeHandle is the identifier used to differentiate C++ class types.
Base class for objects that can be written to and read from Bam files.
virtual void fillin(DatagramIterator &scan, BamReader *manager)
This internal function is intended to be called by each class's make_from_bam() method to read in all...
virtual void write_datagram(BamWriter *manager, Datagram &dg)
Writes the contents of this object to the datagram for shipping out to a Bam file.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
std::ostream & indent(std::ostream &out, int indent_level)
A handy function for doing text formatting.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.