本文整理汇总了C++中ModelLoader::indices方法的典型用法代码示例。如果您正苦于以下问题:C++ ModelLoader::indices方法的具体用法?C++ ModelLoader::indices怎么用?C++ ModelLoader::indices使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ModelLoader
的用法示例。
在下文中一共展示了ModelLoader::indices方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: assert
BasicModel::BasicModel(ID3D11Device* device, const ModelLoader& modelLoader) :
texture_(device, "red-ball-graphics/src/main/resources/seafloor.dds"),
samplerState_(device),
vertexCount_(modelLoader.indices()->size())
{
assert(vertexCount_ > 0);
D3D11_BUFFER_DESC vertexBufferDesc;
ZeroMemory(&vertexBufferDesc, sizeof(vertexBufferDesc));
vertexBufferDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
vertexBufferDesc.ByteWidth = modelLoader.vertices()->size() * sizeof(Vertex);
vertexBufferDesc.Usage = D3D11_USAGE_DEFAULT;
D3D11_SUBRESOURCE_DATA vertexBufferData;
ZeroMemory(&vertexBufferData, sizeof(vertexBufferData));
vertexBufferData.pSysMem = &modelLoader.vertices()->front();
check(
device->CreateBuffer(&vertexBufferDesc, &vertexBufferData, &vertexBuffer_.get()),
"CreateBuffer failed for vertex buffer"
);
D3D11_BUFFER_DESC indexBufferDesc;
ZeroMemory(&indexBufferDesc, sizeof(indexBufferDesc));
indexBufferDesc.BindFlags = D3D11_BIND_INDEX_BUFFER;
indexBufferDesc.ByteWidth = modelLoader.indices()->size() * sizeof(unsigned long);
indexBufferDesc.Usage = D3D11_USAGE_DEFAULT;
D3D11_SUBRESOURCE_DATA indexBufferData;
ZeroMemory(&indexBufferData, sizeof(indexBufferData));
indexBufferData.pSysMem = &modelLoader.indices()->front();
check(
device->CreateBuffer(&indexBufferDesc, &indexBufferData, &indexBuffer_.get()),
"CreateBuffer failed for index buffer"
);
}