15 #include "materialPool.h"
16 #include "config_gobj.h"
17 #include "lightMutexHolder.h"
30 get_global_ptr()->ns_list_contents(out);
43 Materials::iterator mi = _materials.find(cpttemp);
44 if (mi == _materials.end()) {
45 mi = _materials.insert(Materials::value_type(
new Material(*temp), temp)).first;
47 if (*(*mi).first != *(*mi).second) {
62 ns_release_material(
Material *temp) {
66 _materials.erase(cpttemp);
75 ns_release_all_materials() {
87 ns_garbage_collect() {
93 Materials::iterator mi;
94 for (mi = _materials.begin(); mi != _materials.end(); ++mi) {
98 if (gobj_cat.is_debug()) {
100 <<
"Releasing " << *mat1 <<
"\n";
104 new_set.insert(new_set.end(), *mi);
108 _materials.swap(new_set);
118 ns_list_contents(ostream &out)
const {
121 out << _materials.size() <<
" materials:\n";
122 Materials::const_iterator mi;
123 for (mi = _materials.begin(); mi != _materials.end(); ++mi) {
The MaterialPool (there is only one in the universe) serves to unify different pointers to the same M...
Similar to MutexHolder, but for a light mutex.
Defines the way an object appears in the presence of lighting.
static void write(ostream &out)
Lists the contents of the material pool to the indicated output stream.
int get_ref_count() const
Returns the current reference count.