Пример #1
0
static ModelCache::iterator ModelCache_insert (const std::string& path, const std::string& name, scene::Node& node)
{
    if (g_modelCache_enabled) {
        return g_modelCache.insert(ModelKey(path, name), NodeSmartReference(node));
    }
    return g_modelCache.insert(ModelKey("", ""), g_nullModel);
}
Пример #2
0
static ModelCache::iterator ModelCache_find (const std::string& path, const std::string& name)
{
    if (g_modelCache_enabled) {
        return g_modelCache.find(ModelKey(path, name));
    }
    return g_modelCache.end();
}
Пример #3
0
ModelCache::iterator ModelCache_find(const char* path, const char* name)
{
  if(g_modelCache_enabled)
  {
    return g_modelCache.find(ModelKey(path, name));
  }
  return g_modelCache.end();
}
Пример #4
0
void ModelCache_flush (const std::string& path, const std::string& name)
{
    ModelCache::iterator i = g_modelCache.find(ModelKey(path, name));
    if (i != g_modelCache.end()) {
        //ASSERT_MESSAGE((*i).value.getCount() == 0, "resource flushed while still in use: " << (*i).key.first.c_str() << (*i).key.second.c_str());
        g_modelCache.erase(i);
    }
}
Пример #5
0
    void setNode (scene::Node* node)
    {
        ModelCache::iterator i = ModelCache_find(m_path, m_name);
        if (i != g_modelCache.end()) {
            (*i).value = NodeSmartReference(*node);
        }
        setModel(NodeSmartReference(*node));

        connectMap();
    }
Пример #6
0
  ModelWrapper(entity_interfaces_t* model, const char* name)
    : m_refcount(1), m_name(name)
  {
    m_model = g_model_cache.capture(ModelCache::key_type(m_name.GetBuffer(), 0));

    model->pRender = this;
    model->pRender->IncRef();
    model->pEdit = NULL;
    model->pSelect = this;
    model->pSelect->IncRef();
  }
Пример #7
0
    void loadCached ()
    {
        if (g_modelCache_enabled) {
            // cache lookup
            ModelCache::iterator i = ModelCache_find(m_path, m_name);
            if (i == g_modelCache.end()) {
                i = ModelCache_insert(m_path, m_name, Model_load(m_loader, m_path, m_name, m_type));
            }

            setModel((*i).value);
        } else {
            setModel(Model_load(m_loader, m_path, m_name, m_type));
        }
    }
Пример #8
0
  RemapWrapper(entity_interfaces_t* model, const char* name)
    : m_refcount(1)
  {
    parse_namestr(name);

    m_model = g_model_cache.capture(ModelCache::key_type(m_name.GetBuffer(), m_frame));

    model->pRender = this;
    model->pRender->IncRef();
    model->pEdit = NULL;
    model->pSelect = this;
    model->pSelect->IncRef();

    construct_shaders();
  }
Пример #9
0
  virtual ~RemapWrapper()
  {
    g_model_cache.release(ModelCache::key_type(m_name.GetBuffer(), m_frame));

    for(shaders_t::iterator i = m_shaders.begin(); i != m_shaders.end(); ++i) {
      (*i)->DecRef();
	}

    for(remaps_t::iterator j = m_remaps.begin(); j != m_remaps.end(); ++j)
    {
      remap_t *pRemap = (*j);
      delete pRemap;
    }
    m_remaps.clear();
  }
Пример #10
0
void ModelCache_clear()
{
  g_modelCache_enabled = false;
  g_modelCache.clear();
  g_modelCache_enabled = true;
}
Пример #11
0
  virtual ~ModelWrapper()
  {
    g_model_cache.release(ModelCache::key_type(m_name.GetBuffer(), 0));
	}