本文整理汇总了C++中scene::Ptr::MakeGroup方法的典型用法代码示例。如果您正苦于以下问题:C++ Ptr::MakeGroup方法的具体用法?C++ Ptr::MakeGroup怎么用?C++ Ptr::MakeGroup使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类scene::Ptr
的用法示例。
在下文中一共展示了Ptr::MakeGroup方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LoadModelGL
void ModelRenderer::LoadModelGL() {
Scene::Ptr scene = GetScene();
// Clear out any previously loaded model.
ClearModel();
// Load the model as a scene graph resource.
Scene::Ptr model = AssetImporter::ImportFile(GetResources(), model_fname_);
if (!model) {
return;
}
// Create a node in the main scene graph.
node_ = scene->MakeGroup(GetBaseNode());
// Instantiate the model as a child of the newly created node.
scene->MakeGroupFromScene(node_, model);
// Scale and translate the model so that it fits inside a unit cube
// centered at the origin.
const AxisAlignedBox& box = model->Root()->WorldBoundingBox();
const QVector3D span = box.Max() - box.Min();
const float max_span = std::max(std::max(span.x(), span.y()), span.z());
const double scale_factor = 1.0 / max_span;
node_->SetScale(QVector3D(scale_factor, scale_factor, scale_factor));
node_->SetTranslation(-0.5 * scale_factor * (box.Max() + box.Min()));
GetViewport()->ScheduleRedraw();
}