本文整理汇总了C++中ModelCache类的典型用法代码示例。如果您正苦于以下问题:C++ ModelCache类的具体用法?C++ ModelCache怎么用?C++ ModelCache使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ModelCache类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ModelCache_insert
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: ModelCache_find
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: ModelCache_find
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: ModelCache_flush
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: setNode
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: ModelWrapper
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: loadCached
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: RemapWrapper
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:
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: ModelCache_clear
void ModelCache_clear()
{
g_modelCache_enabled = false;
g_modelCache.clear();
g_modelCache_enabled = true;
}