本文整理汇总了C++中GeometryGenerator::CreateCircle方法的典型用法代码示例。如果您正苦于以下问题:C++ GeometryGenerator::CreateCircle方法的具体用法?C++ GeometryGenerator::CreateCircle怎么用?C++ GeometryGenerator::CreateCircle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GeometryGenerator
的用法示例。
在下文中一共展示了GeometryGenerator::CreateCircle方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BuildOrbitBuffers
void SuperSolarSystemApp::BuildOrbitBuffers( )
{
GeometryGenerator geoGen;
GeometryGenerator::MeshData orbitMash;
geoGen.CreateCircle( 1.0f, 100, orbitMash );
//
// 缓存偏移信息和数量信息
//
mCVertexOffset[CVT_ORBIT] = 0;
mCIndexCount[CVT_ORBIT] = orbitMash.Indices.size( );
mCIndexOffset[CVT_ORBIT] = 0;
//
// 创建顶点缓冲
//
UINT totVertexCount =
orbitMash.Vertices.size( );
std::vector<Vertex::ColorObjVertex> vertices;
vertices.resize( totVertexCount );
XMFLOAT4 white( 1.0f, 1.0f, 1.0f, 1.0f );
UINT k = 0;
for ( size_t i = 0; i < orbitMash.Vertices.size( ); i++, k++ )
{
vertices[k].Pos = orbitMash.Vertices[i].Position;
vertices[k].Color = white;
}
D3D11_BUFFER_DESC vbd;
vbd.Usage = D3D11_USAGE_IMMUTABLE;
vbd.ByteWidth = sizeof( Vertex::ColorObjVertex ) * totVertexCount;
vbd.BindFlags = D3D11_BIND_VERTEX_BUFFER;
vbd.CPUAccessFlags = 0;
vbd.MiscFlags = 0;
vbd.StructureByteStride = 0;
D3D11_SUBRESOURCE_DATA vinitData;
vinitData.pSysMem = &vertices[0];
HR( mD3dDevice->CreateBuffer( &vbd, &vinitData, &mColorVB ) );
//
// 创建索引缓冲
//
UINT totIndexCount =
orbitMash.Indices.size( );
std::vector<UINT> indices;
indices.insert( indices.end( ), orbitMash.Indices.begin( ), orbitMash.Indices.end( ) );
D3D11_BUFFER_DESC ibd;
ibd.Usage = D3D11_USAGE_IMMUTABLE;
ibd.ByteWidth = sizeof( UINT ) * totIndexCount;
ibd.BindFlags = D3D11_BIND_INDEX_BUFFER;
ibd.CPUAccessFlags = 0;
ibd.MiscFlags = 0;
ibd.StructureByteStride = 0;
D3D11_SUBRESOURCE_DATA iinitData;
iinitData.pSysMem = &indices[0];
HR( mD3dDevice->CreateBuffer( &ibd, &iinitData, &mColorIB ) );
}
示例2:
Circle::Circle()
{
GeometryGenerator gen;
gen.CreateCircle(*m_Data, 0.5f, 12);
}