本文整理汇总了C++中IScene::deserialize方法的典型用法代码示例。如果您正苦于以下问题:C++ IScene::deserialize方法的具体用法?C++ IScene::deserialize怎么用?C++ IScene::deserialize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IScene
的用法示例。
在下文中一共展示了IScene::deserialize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: deserialize
virtual bool deserialize(UniverseContext& ctx,
InputBlob& serializer) override
{
SerializedEngineHeader header;
serializer.read(header);
if (header.m_magic != SERIALIZED_ENGINE_MAGIC)
{
g_log_error.log("engine") << "Wrong or corrupted file";
return false;
}
if (header.m_version > SerializedEngineVersion::LATEST)
{
g_log_error.log("engine") << "Unsupported version";
return false;
}
if (!hasSerializedPlugins(serializer))
{
return false;
}
g_path_manager.deserialize(serializer);
ctx.m_universe->deserialize(serializer);
ctx.m_hierarchy->deserialize(serializer);
m_plugin_manager->deserialize(serializer);
int32_t scene_count;
serializer.read(scene_count);
for (int i = 0; i < scene_count; ++i)
{
char tmp[32];
serializer.readString(tmp, sizeof(tmp));
IScene* scene = ctx.getScene(crc32(tmp));
scene->deserialize(serializer);
}
g_path_manager.clear();
return true;
}
示例2: deserialize
bool deserialize(UniverseContext& ctx, InputBlob& serializer) override
{
SerializedEngineHeader header;
serializer.read(header);
if (header.m_magic != SERIALIZED_ENGINE_MAGIC)
{
g_log_error.log("engine") << "Wrong or corrupted file";
return false;
}
if (header.m_version > SerializedEngineVersion::LATEST)
{
g_log_error.log("engine") << "Unsupported version";
return false;
}
if (!hasSerializedPlugins(serializer))
{
return false;
}
if (header.m_version > SerializedEngineVersion::SCENE_VERSION_CHECK &&
!hasSupportedSceneVersions(serializer, ctx))
{
return false;
}
m_path_manager.deserialize(serializer);
ctx.m_universe->deserialize(serializer);
if (header.m_version <= SerializedEngineVersion::HIERARCHY_COMPONENT)
{
ctx.getScene(HIERARCHY_HASH)->deserialize(serializer, 0);
}
m_plugin_manager->deserialize(serializer);
int32 scene_count;
serializer.read(scene_count);
for (int i = 0; i < scene_count; ++i)
{
char tmp[32];
serializer.readString(tmp, sizeof(tmp));
IScene* scene = ctx.getScene(crc32(tmp));
int scene_version = -1;
if (header.m_version > SerializedEngineVersion::SCENE_VERSION)
{
serializer.read(scene_version);
}
scene->deserialize(serializer, scene_version);
}
m_path_manager.clear();
return true;
}