25write(std::ostream &out) {
26 get_global_ptr()->ns_list_contents(out);
37 Materials::iterator mi = _materials.find(cpttemp);
38 if (mi == _materials.end()) {
39 mi = _materials.insert(Materials::value_type(
new Material(*temp), temp)).first;
41 if (*(*mi).first != *(*mi).second) {
54 LightMutexHolder holder(_lock);
56 CPT(Material) cpttemp = temp;
57 _materials.erase(cpttemp);
64ns_release_all_materials() {
65 LightMutexHolder holder(_lock);
75 LightMutexHolder holder(_lock);
80 Materials::iterator mi;
81 for (mi = _materials.begin(); mi != _materials.end(); ++mi) {
82 const Material *mat1 = (*mi).first;
83 Material *mat2 = (*mi).second;
85 if (gobj_cat.is_debug()) {
87 <<
"Releasing " << *mat1 <<
"\n";
91 new_set.insert(new_set.end(), *mi);
95 _materials.swap(new_set);
103ns_list_contents(std::ostream &out)
const {
104 LightMutexHolder holder(_lock);
106 out << _materials.size() <<
" materials:\n";
107 Materials::const_iterator mi;
108 for (mi = _materials.begin(); mi != _materials.end(); ++mi) {
109 const Material *mat1 = (*mi).first;
110 Material *mat2 = (*mi).second;
122 if (_global_ptr ==
nullptr) {
123 _global_ptr =
new MaterialPool;
Similar to MutexHolder, but for a light mutex.
The MaterialPool (there is only one in the universe) serves to unify different pointers to the same M...
static void write(std::ostream &out)
Lists the contents of the material pool to the indicated output stream.
Defines the way an object appears in the presence of lighting.
get_ref_count
Returns the current reference count.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.