本文整理汇总了C++中ModelData::Read方法的典型用法代码示例。如果您正苦于以下问题:C++ ModelData::Read方法的具体用法?C++ ModelData::Read怎么用?C++ ModelData::Read使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ModelData
的用法示例。
在下文中一共展示了ModelData::Read方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Init
void ModelViewerModule::Init(const rArrayString& args) {
auto createControllerFunc = [&](const rString& name, rEngine* engine, ruiDocument* document) {
return new ModelViewerController(_skeletonGeometry.get(), name, engine, document);
};
auto deleteControllerFunc = [](ruiController* controller) {
delete controller;
};
_engine->ui->RegisterControllerClass("ModelViewerController", createControllerFunc, deleteControllerFunc);
Model* model = nullptr;
rString file, archive;
ParseArgs(args, file, archive);
if (!archive.empty()) {
_engine->resources->OpenArchive(archive);
model = _engine->content->Models()->LoadFromResource(file, "model");
}
else {
auto fileSystemRef = _engine->filesystem->OpenReadFileRef(file);
ModelData modelData;
modelData.Read(*fileSystemRef);
_engine->filesystem->CloseReadFileRef(fileSystemRef);
model = _engine->content->Models()->LoadFromData(modelData, "model");
}
if (model->GetSkeleton()) {
rPawn* pawn = new rPawn(model, "model", _engine);
_skeletonGeometry.reset(new SkeletonGeometry(_engine, pawn));
_engine->scene->AddActor(pawn);
}
else {
rProp* prop = new rProp(model, "model", _engine);
_engine->scene->AddActor(prop);
}
rViewport* mainViewport = CreateView(model, _engine);
_engine->ui->LoadUiDocument("C:/development/recondite/samples/modelviewer/modelviewer/modelviewer.xml", mainViewport);
}