nuclear@9: #include "material.h" nuclear@9: nuclear@9: int Material::get_attrib_count() const nuclear@9: { nuclear@9: return (int)attrib.size(); nuclear@9: } nuclear@9: nuclear@9: const char *Material::get_attrib_name(int idx) const nuclear@9: { nuclear@9: if(idx < 0 || idx >= get_attrib_count()) { nuclear@9: return 0; nuclear@9: } nuclear@9: nuclear@9: std::map::const_iterator it = attrib.begin(); nuclear@9: for(int i=0; ifirst.c_str(); nuclear@9: } nuclear@9: nuclear@9: MaterialAttrib &Material::operator [](int idx) nuclear@9: { nuclear@9: if(idx < 0 || idx >= get_attrib_count()) { nuclear@9: return def_attr; nuclear@9: } nuclear@9: nuclear@9: std::map::iterator it = attrib.begin(); nuclear@9: for(int i=0; isecond; nuclear@9: } nuclear@9: nuclear@9: const MaterialAttrib &Material::operator [](int idx) const nuclear@9: { nuclear@9: if(idx < 0 || idx >= get_attrib_count()) { nuclear@9: return def_attr; nuclear@9: } nuclear@9: nuclear@9: std::map::const_iterator it = attrib.begin(); nuclear@9: for(int i=0; isecond; nuclear@9: } nuclear@9: nuclear@9: MaterialAttrib &Material::operator [](const std::string &name) nuclear@9: { nuclear@9: return attrib[name]; nuclear@9: } nuclear@9: nuclear@9: const MaterialAttrib &Material::operator [](const std::string &name) const nuclear@9: { nuclear@9: std::map::const_iterator it; nuclear@9: if((it = attrib.find(name)) != attrib.end()) { nuclear@9: return it->second; nuclear@9: } nuclear@9: return def_attr; nuclear@9: } nuclear@9: