本文整理汇总了C++中GeometryGenerator::CreateCigarPack方法的典型用法代码示例。如果您正苦于以下问题:C++ GeometryGenerator::CreateCigarPack方法的具体用法?C++ GeometryGenerator::CreateCigarPack怎么用?C++ GeometryGenerator::CreateCigarPack使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GeometryGenerator
的用法示例。
在下文中一共展示了GeometryGenerator::CreateCigarPack方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: vertices
void LightingDemo2::buildCigar()
{
GeometryGenerator::MeshData cig;
GeometryGenerator geoGen;
geoGen.CreateCigarPack(15.f, cig);
std::vector<Vertex::PosNormalTex> vertices(cig.Vertices.size());
for (UINT i = 0; i < cig.Vertices.size(); ++i)
{
vertices[i].Pos = cig.Vertices[i].Position;
vertices[i].Normal = cig.Vertices[i].Normal;
vertices[i].Tex = cig.Vertices[i].TexC;
}
D3D11_BUFFER_DESC vbd;
vbd.Usage = D3D11_USAGE_IMMUTABLE;
vbd.ByteWidth = sizeof(Vertex::PosNormalTex) * cig.Vertices.size();
vbd.BindFlags = D3D11_BIND_VERTEX_BUFFER;
vbd.CPUAccessFlags = 0;
vbd.MiscFlags = 0;
D3D11_SUBRESOURCE_DATA vinitData;
vinitData.pSysMem = &vertices[0];
HR(md3dDevice->CreateBuffer(&vbd, &vinitData, &mCigVB));
D3D11_BUFFER_DESC ibd;
ibd.Usage = D3D11_USAGE_IMMUTABLE;
ibd.ByteWidth = sizeof(UINT) * cig.Indices.size();
ibd.BindFlags = D3D11_BIND_INDEX_BUFFER;
ibd.CPUAccessFlags = 0;
ibd.MiscFlags = 0;
D3D11_SUBRESOURCE_DATA iinitData;
iinitData.pSysMem = &cig.Indices[0];
HR(md3dDevice->CreateBuffer(&ibd, &iinitData, &mCigIB));
}