void EntityRenderer::validateModels(RenderContext& context) { m_modelRenderers.clear(); EntityModelRendererManager& modelRendererManager = m_document.sharedResources().modelRendererManager(); Model::EntitySet::iterator entityIt, entityEnd; for (entityIt = m_entities.begin(), entityEnd = m_entities.end(); entityIt != entityEnd; ++entityIt) { Model::Entity* entity = *entityIt; const String* classname = entity->classname(); if (classname != NULL) { EntityModelRenderer* renderer = modelRendererManager.modelRenderer(*entity, m_document.searchPaths()); if (renderer != NULL) m_modelRenderers[entity] = CachedEntityModelRenderer(renderer, *classname); } } m_modelRendererCacheValid = true; }
void EntityRenderer::addEntity(Model::Entity& entity) { if (!m_entities.insert(&entity).second) return; EntityModelRendererManager& modelRendererManager = m_document.sharedResources().modelRendererManager(); const String* classname = entity.classname(); if (classname == NULL) classname = &Model::Entity::NoClassnameValue; if (classname != NULL) { EntityModelRenderer* renderer = modelRendererManager.modelRenderer(entity, m_document.searchPaths()); if (renderer != NULL) m_modelRenderers[&entity] = CachedEntityModelRenderer(renderer, *classname); m_classnameRenderer->addString(&entity, *classname, Text::TextAnchor::Ptr(new EntityClassnameAnchor(entity, renderer))); } m_entities.insert(&entity); m_boundsValid = false; }
void EntityRenderer::addEntities(const Model::EntityList& entities) { if (entities.empty()) return; EntityModelRendererManager& modelRendererManager = m_document.sharedResources().modelRendererManager(); for (unsigned int i = 0; i < entities.size(); i++) { Model::Entity* entity = entities[i]; const String* classname = entity->classname(); if (classname == NULL) classname = &Model::Entity::NoClassnameValue; if (classname != NULL) { EntityModelRenderer* renderer = modelRendererManager.modelRenderer(*entity, m_document.searchPaths()); if (renderer != NULL) m_modelRenderers[entity] = CachedEntityModelRenderer(renderer, *classname); m_classnameRenderer->addString(entity, *classname, Text::TextAnchor::Ptr(new EntityClassnameAnchor(*entity, renderer))); } } m_entities.insert(entities.begin(), entities.end()); m_boundsValid = false; }