45 INLINE
explicit Material(
const std::string &name =
"");
47 void operator = (
const Material ©);
50 INLINE
static Material *get_default();
52 INLINE
bool has_base_color()
const;
53 INLINE
const LColor &get_base_color()
const;
54 void set_base_color(
const LColor &color);
55 void clear_base_color();
57 INLINE
bool has_ambient()
const;
58 INLINE
const LColor &get_ambient()
const;
59 void set_ambient(
const LColor &color);
60 INLINE
void clear_ambient();
62 INLINE
bool has_diffuse()
const;
63 INLINE
const LColor &get_diffuse()
const;
64 void set_diffuse(
const LColor &color);
65 INLINE
void clear_diffuse();
67 INLINE
bool has_specular()
const;
68 INLINE
const LColor &get_specular()
const;
69 void set_specular(
const LColor &color);
70 void clear_specular();
72 INLINE
bool has_emission()
const;
73 INLINE
const LColor &get_emission()
const;
74 void set_emission(
const LColor &color);
75 INLINE
void clear_emission();
77 INLINE PN_stdfloat get_shininess()
const;
78 void set_shininess(PN_stdfloat shininess);
80 INLINE
bool has_roughness()
const;
81 PN_stdfloat get_roughness()
const;
82 void set_roughness(PN_stdfloat roughness);
84 INLINE
bool has_metallic()
const;
85 INLINE PN_stdfloat get_metallic()
const;
86 void set_metallic(PN_stdfloat metallic);
87 void clear_metallic();
89 INLINE
bool has_refractive_index()
const;
90 INLINE PN_stdfloat get_refractive_index()
const;
91 void set_refractive_index(PN_stdfloat refractive_index);
93 INLINE
bool get_local()
const;
94 INLINE
void set_local(
bool local);
95 INLINE
bool get_twoside()
const;
96 INLINE
void set_twoside(
bool twoside);
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;
107 INLINE
bool is_attrib_locked()
const;
108 INLINE
void set_attrib_lock();
111 MAKE_PROPERTY2(base_color, has_base_color, get_base_color,
112 set_base_color, clear_base_color);
113 MAKE_PROPERTY2(ambient, has_ambient, get_ambient,
114 set_ambient, clear_ambient);
115 MAKE_PROPERTY2(diffuse, has_diffuse, get_diffuse,
116 set_diffuse, clear_diffuse);
117 MAKE_PROPERTY2(specular, has_specular, get_specular,
118 set_specular, clear_specular);
119 MAKE_PROPERTY2(emission, has_emission, get_emission,
120 set_emission, clear_emission);
122 MAKE_PROPERTY(shininess, get_shininess, set_shininess);
123 MAKE_PROPERTY(roughness, get_roughness, set_roughness);
124 MAKE_PROPERTY(metallic, get_metallic, set_metallic);
125 MAKE_PROPERTY(refractive_index, get_refractive_index,
126 set_refractive_index);
128 MAKE_PROPERTY(local, get_local, set_local);
129 MAKE_PROPERTY(twoside, get_twoside, set_twoside);
132 INLINE
bool is_used_by_auto_shader()
const;
135 INLINE
void mark_used_by_auto_shader();
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());
186 return get_class_type();
188 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
195 INLINE 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...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Base class for objects that can be written to and read from Bam files.
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.
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
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.
void output(std::ostream &out) const
Outputs the Namable.
A base class for all things which can have a name.
std::ostream & indent(std::ostream &out, int indent_level)
A handy function for doing text formatting.
An instance of this class is passed to the Factory when requesting it to do its business and construc...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A base class for things which need to inherit from both TypedWritable and from ReferenceCount.
Defines the way an object appears in the presence of lighting.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
An STL function object class, this is intended to be used on any ordered collection of class objects ...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A class to retrieve the individual data elements previously stored in a Datagram.
TypeHandle is the identifier used to differentiate C++ class types.
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...