本文整理汇总了C++中GraphicsDevice::createVertexBuffer方法的典型用法代码示例。如果您正苦于以下问题:C++ GraphicsDevice::createVertexBuffer方法的具体用法?C++ GraphicsDevice::createVertexBuffer怎么用?C++ GraphicsDevice::createVertexBuffer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GraphicsDevice
的用法示例。
在下文中一共展示了GraphicsDevice::createVertexBuffer方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: init
void TerrainTessellator::init(const GraphicsDevice& device, unsigned size, unsigned numPatches, unsigned stripeSize)
{
this->size = size;
this->stripeSize = stripeSize;
this->numPatches = numPatches;
numVertices = (size + 3) * (size + 3);
unsigned lod = (unsigned)MathHelper::log2(size) + 1;
patchIndexBuffers = IndexBufferCollection(lod);
skirtIndexBuffers = IndexBufferCollection(lod);
for (unsigned i = 0; i < lod; ++i)
{
patchIndexBuffers[i] = createPatchIndexBuffer(device, i);
skirtIndexBuffers[i] = createSkirtIndexBuffer(device, i);
}
VertexCollection vertices(numVertices);
for (int row = -1; row <= (int)size + 1; ++row)
for (int col = -1; col <= (int)size + 1; ++col)
{
int r = MathHelper::clamp(row, 0, (int)size);
int c = MathHelper::clamp(col, 0, (int)size);
float y = (r == row && c == col) ? 0.0f : -1.0f;
vertices[getIndex(row, col)].position = Vector3((float)c, y, (float)r);
}
vertexBuffer = device.createVertexBuffer(sizeof(TerrainVertex) * numVertices, TerrainVertex::fvf, D3DUSAGE_WRITEONLY);
vertexBuffer.setData(vertices);
instanceVertexDeclaration = device.createVertexDeclaration(TerrainGeometry::vertexElements);
}
示例2: onResetDevice
void TerrainTessellator::onResetDevice(const GraphicsDevice& device)
{
instanceVertexBuffer = device.createVertexBuffer(sizeof(TerrainInstance) * numPatches, 0, D3DUSAGE_DYNAMIC, D3DPOOL_DEFAULT);
}
示例3: onResetDevice
void FBXModel::onResetDevice(const GraphicsDevice& device)
{
instanceVertexBuffer = device.createVertexBuffer(sizeof(InstanceType) * maxInstances, 0, D3DUSAGE_DYNAMIC, D3DPOOL_DEFAULT);
effect.onResetDevice();
}