本文整理汇总了C++中SharedPtr::AddGeometry方法的典型用法代码示例。如果您正苦于以下问题:C++ SharedPtr::AddGeometry方法的具体用法?C++ SharedPtr::AddGeometry怎么用?C++ SharedPtr::AddGeometry使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SharedPtr
的用法示例。
在下文中一共展示了SharedPtr::AddGeometry方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateComponent
void GridDescriptor::CreateComponent(Node *node, Engine *engine)
{
SharedPtr<Mesh> mesh = new Mesh(engine);
mesh->AddGeometry(GeometryGenerator::GenerateGrid(engine, size, countX, countZ), BoundingBox(-vec3(size.x, 1, size.y) * 0.5f, vec3(size.x, 1, size.y) * 0.5f), engine->GetResourceCache()->GetResource<Material>(materialFileName));
auto staticModel = node->CreateComponent<StaticModel>(mesh);
staticModel->SetCastShadow(castShadow);
component = staticModel;
}
示例2: Recreate
void GridDescriptor::Recreate(FireCube::Engine *engine)
{
if (component)
{
auto staticModel = static_cast<StaticModel *>(component);
SharedPtr<Mesh> mesh = new Mesh(engine);
mesh->AddGeometry(GeometryGenerator::GenerateGrid(engine, size, countX, countZ), BoundingBox(-vec3(size.x, 1, size.y) * 0.5f, vec3(size.x, 1, size.y) * 0.5f), engine->GetResourceCache()->GetResource<Material>(materialFileName));
staticModel->CreateFromMesh(mesh);
}
}
示例3: UpdatePreview
void MaterialEditorWindow::UpdatePreview(FireCube::Material *material)
{
auxRenderWindow.Reset();
auto root = auxRenderWindow.GetRoot();
auto lightNode1 = root->CreateChild();
auto light = lightNode1->CreateComponent<Light>();
light->SetLightType(LightType::DIRECTIONAL);
light->SetColor(vec3(1.0f));
lightNode1->Rotate(vec3((float)-PI * 0.25f, (float)-PI * 0.25f, 0.0f));
auto lightNode2 = root->CreateChild();
light = lightNode2->CreateComponent<Light>();
light->SetLightType(LightType::DIRECTIONAL);
light->SetColor(vec3(1.0f));
lightNode2->Rotate(vec3((float)PI * 0.25f, (float)PI * 0.25f, 0.0f));
auto meshNode = root->CreateChild();
auto geometry = GeometryGenerator::GenerateSphere(engine, 0.5f, 16, 16);
SharedPtr<Mesh> sphereMesh = new Mesh(engine);
sphereMesh->AddGeometry(geometry, BoundingBox(vec3(-0.5f), vec3(0.5f)), material);
meshNode->CreateComponent<StaticModel>(sphereMesh);
}