d3d8indexbuffer.cpp
来自「game code对于游戏地图的编辑代码」· C++ 代码 · 共 27 行
CPP
27 行
#include "D3D8IndexBuffer.h"
#include "../../Main/QVertexIndexData.h"
#include "../../Main/QLogManager.h"
D3D8IndexBuffer::D3D8IndexBuffer(LPDIRECT3DDEVICE8 device,IndexData* id)
{
if( FAILED( device->CreateIndexBuffer(id->index_count*sizeof(Int16),0,
D3DFMT_INDEX16,D3DPOOL_DEFAULT,
&m_pIndexBuffer) ))
{
LOGLOW("D3D8IndexBuffer::D3D8IndexBuffer : Cannot create IndexBuffer");
return;
}
Int16* pindices;
if( FAILED(m_pIndexBuffer->Lock(0,0,(BYTE**)&pindices,0)))
{
LOGLOW("D3D8IndexBuffer::D3D8IndexBuffer : Cannot Lock IndexBuffer");
return;
}
memcpy(pindices,id->index_data,id->index_count*sizeof(Int16));
m_pIndexBuffer->Unlock();
}
D3D8IndexBuffer::~D3D8IndexBuffer()
{
m_pIndexBuffer->Release();
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?