本文整理汇总了C++中EntityManager::EmitMessage方法的典型用法代码示例。如果您正苦于以下问题:C++ EntityManager::EmitMessage方法的具体用法?C++ EntityManager::EmitMessage怎么用?C++ EntityManager::EmitMessage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EntityManager
的用法示例。
在下文中一共展示了EntityManager::EmitMessage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TriggerReload
void ResourceManager::TriggerReload(const std::string& path, EntityManager& em)
{
RemoveFromNodeCache(path);
ResourceChangedMessage msg;
msg.SetPath(path);
em.EmitMessage(msg);
}
示例2: if
osg::ref_ptr<osg::Node> ResourceManager::GetNode(EntityManager& em, const std::string& path, unsigned int options)
{
osg::Node* ret = NULL;
std::string abspath = GetSystemInterface()->FindDataFile(path);
if(abspath.empty())
{
LOG_ERROR("Error loading node, could not find data file: " << path);
return NULL;
}
if((options & ResourceManagerOptions::CopyNodes) != 0)
{
NodeStore::iterator i = mNodeStore.find(abspath);
if(i != mNodeStore.end())
{
ret = osg::clone(i->second.get(), osg::CopyOp(
osg::CopyOp::DEEP_COPY_OBJECTS |
osg::CopyOp::DEEP_COPY_NODES |
osg::CopyOp::DEEP_COPY_USERDATA
));
}
}
else if((options & ResourceManagerOptions::ShallowCopy) != 0)
{
NodeStore::iterator i = mNodeStore.find(abspath);
if(i != mNodeStore.end())
{
ret = osg::clone(i->second.get(), osg::CopyOp(
osg::CopyOp::DEEP_COPY_USERDATA
));
}
}
else if((options & ResourceManagerOptions::CopyHardwareMeshes) != 0)
{
NodeStore::iterator i = mNodeStore.find(abspath);
if(i != mNodeStore.end())
{
ret = osg::clone(i->second.get(), osg::CopyOp(
osg::CopyOp::DEEP_COPY_ALL
& ~osg::CopyOp::DEEP_COPY_PRIMITIVES
& ~osg::CopyOp::DEEP_COPY_ARRAYS
& ~osg::CopyOp::DEEP_COPY_TEXTURES
& ~osg::CopyOp::DEEP_COPY_STATEATTRIBUTES
& ~osg::CopyOp::DEEP_COPY_IMAGES
& ~osg::CopyOp::DEEP_COPY_SHAPES
& ~osg::CopyOp::DEEP_COPY_UNIFORMS
));
}
}
else if((options & ResourceManagerOptions::DeepCopy) != 0)
{
NodeStore::iterator i = mNodeStore.find(abspath);
if(i != mNodeStore.end())
{
ret = osg::clone(i->second.get(), osg::CopyOp(
osg::CopyOp::DEEP_COPY_ALL
));
}
}
if(ret != NULL)
{
ret->setUserData(NULL);
return ret;
}
osg::Node* node = osgDB::readNodeFile(abspath);
if(node == NULL)
{
LOG_ERROR("Error loading node, could not interpret data file: " << abspath);
return NULL;
}
if((options & ResourceManagerOptions::DoOptimization) != 0)
{
osgUtil::Optimizer optimizer;
optimizer.optimize(node);
}
if((options & ResourceManagerOptions::DeepCopy) == 0)
{
mNodeStore[abspath] = node;
}
ResourceLoadedMessage msg;
msg.SetPath(abspath);
em.EmitMessage(msg);
if((options & ResourceManagerOptions::CopyHardwareMeshes) != 0)
{
return osg::clone(node, osg::CopyOp(
osg::CopyOp::DEEP_COPY_ALL &
~osg::CopyOp::DEEP_COPY_PRIMITIVES &
~osg::CopyOp::DEEP_COPY_ARRAYS &
~osg::CopyOp::DEEP_COPY_TEXTURES
));
}
else
//.........这里部分代码省略.........