+
+void PartCache::begin_rebuild()
+{
+ if(rebuilding)
+ throw logic_error("nested rebuild");
+ rebuilding = true;
+
+ next = parts.begin();
+ current = parts.end();
+}
+
+void PartCache::insert_special(const Part &part)
+{
+ if(part.get_name().empty())
+ throw invalid_argument("PartCache::insert_special");
+ if(!rebuilding)
+ throw logic_error("!rebuilding");
+
+ for(current=next; current!=parts.end(); ++current)
+ if(current->part==&part)
+ {
+ parts.erase(next, current);
+ break;
+ }
+
+ if(current==parts.end())
+ current = parts.insert(next, CachedPart());
+ else
+ *current = CachedPart();
+ current->part = ∂
+
+ next = current;
+ ++next;
+}
+
+GL::Mesh &PartCache::create_mesh(const Part &part, const GL::Texture2D &tex)