本文整理汇总了C++中LPDIRECT3DVERTEXBUFFER9类的典型用法代码示例。如果您正苦于以下问题:C++ LPDIRECT3DVERTEXBUFFER9类的具体用法?C++ LPDIRECT3DVERTEXBUFFER9怎么用?C++ LPDIRECT3DVERTEXBUFFER9使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了LPDIRECT3DVERTEXBUFFER9类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddVertexStream
//-----------------------------------------------------------------------------
// Name: VertexData::AddVertexStream()
//-----------------------------------------------------------------------------
VOID VertexData::AddVertexStream( LPDIRECT3DVERTEXBUFFER9 pBuffer, DWORD Stride, DWORD NumVerts, DWORD Divider )
{
// vertex buffers are assumed to have the correct bound
assert( pBuffer );
DWORD dwStreamIndex = (DWORD)m_VertexStreams.size();
assert( dwStreamIndex < MaxStreamCount );
m_dwStreamStrides[dwStreamIndex] = Stride;
VertexStream Stream;
Stream.pVertexBuffer = pBuffer;
Stream.Divider = Divider;
Stream.Stride = Stride;
m_VertexStreams.push_back( Stream );
m_NumVertices += NumVerts;
pBuffer->AddRef();
}
示例2: UninitBillboard
//=============================================================================
// 終了処理
//=============================================================================
void UninitBillboard(void)
{
if(g_pD3DTextureBillboard != NULL)
{// テクスチャの開放
g_pD3DTextureBillboard->Release();
g_pD3DTextureBillboard = NULL;
}
if(g_pD3DVtxBuffBillboard != NULL)
{// 頂点バッファの開放
g_pD3DVtxBuffBillboard->Release();
g_pD3DVtxBuffBillboard = NULL;
}
}
示例3: Cleanup
//-----------------------------------------------------------------------------
// Desc: 释放创建的对象
//-----------------------------------------------------------------------------
VOID Cleanup()
{
//释放顶点缓冲区对象
if( g_pVB != NULL )
g_pVB->Release();
//释放Direct3D设备对象
if( g_pd3dDevice != NULL )
g_pd3dDevice->Release();
//释放Direct3D对象
if( g_pD3D != NULL )
g_pD3D->Release();
}
示例4: Cleanup
VOID Cleanup()
{
if( g_pVB != NULL )
g_pVB->Release();
if(g_pCubeTexture != NULL)
g_pCubeTexture->Release();
if( g_pd3dDevice != NULL )
g_pd3dDevice->Release();
if( g_pD3D != NULL )
g_pD3D->Release();
}
示例5: UninitExplosion
//=============================================================================
// 終了処理
//=============================================================================
void UninitExplosion(void)
{
if(g_pD3DTextureExplosion != NULL)
{// テクスチャの開放
g_pD3DTextureExplosion->Release();
g_pD3DTextureExplosion = NULL;
}
if(g_pD3DVtxBuffExplosion != NULL)
{// 頂点バッファの開放
g_pD3DVtxBuffExplosion->Release();
g_pD3DVtxBuffExplosion = NULL;
}
}
示例6: initEffect
void TestScene::initEffect()
{
LPD3DXBUFFER bufferErrors = NULL;
HRESULT hr;
//D3DXMatrixIdentity(&world);
//D3DXMatrixIdentity(&view);
//D3DXMatrixIdentity(&proj);
//D3DXMatrixPerspectiveFovLH(&proj, D3DXToRadian(40.0f), (float)GameGlobal::GetWidth() / (float)GameGlobal::GetHeight(), 0.0f, 100.0f);
unsigned int vertexDataSize = 4 * sizeof(VertexData);
//create vertex buffer
GameGlobal::GetCurrentDevice()->CreateVertexBuffer(vertexDataSize, D3DUSAGE_WRITEONLY, D3DFVF_CUSTOMVERTEX,
D3DPOOL_DEFAULT, &vertexBuffer, 0);
void *pVertices = NULL;
vertexBuffer->Lock(0, vertexDataSize, (void**)&pVertices, 0);
memcpy(pVertices, vertexData, vertexDataSize);
vertexBuffer->Unlock();
hr = D3DXCreateEffectFromFileA(GameGlobal::GetCurrentDevice(), "Empty.fx", 0, 0, 0, 0, &effect, &bufferErrors);
//D3DXMatrixTranslation(&view, 0, 0, 2.75);
//D3DXMATRIX matrix = world * view * proj;
//effect->SetMatrix("WorldViewProj", &(world * view * proj));
//D3DXCreateTexture(GameGlobal::GetCurrentDevice(), GameGlobal::GetWidth(), GameGlobal::GetHeight(), D3DX_DEFAULT,
// D3DUSAGE_RENDERTARGET, D3DFMT_A8B8G8R8, D3DPOOL_DEFAULT, &texture0);
//D3DXCreateTexture(GameGlobal::GetCurrentDevice(), GameGlobal::GetWidth(), GameGlobal::GetHeight(), D3DX_DEFAULT,
// D3DUSAGE_RENDERTARGET, D3DFMT_A8B8G8R8, D3DPOOL_DEFAULT, &texture1);
D3DXCreateTextureFromFileA(GameGlobal::GetCurrentDevice(), "valve.png", &texture0);
D3DXCreateTextureFromFileA(GameGlobal::GetCurrentDevice(), "hungtrung.png", &texture1);
}
示例7: setupPipeline
void TriangleExercise::setupPipeline() {
// create the vertices using the CUSTOMVERTEX struct
CUSTOMVERTEX vertices[] =
{
{ 400.0f, 62.5f, 0.5f, 1.0f, D3DCOLOR_XRGB(0, 0, 255), },
{ 650.0f, 500.0f, 0.5f, 1.0f, D3DCOLOR_XRGB(0, 255, 0), },
{ 150.0f, 500.0f, 0.5f, 1.0f, D3DCOLOR_XRGB(255, 0, 0), },
};
// create a vertex buffer interface called v_buffer
d3ddev->CreateVertexBuffer(3 * sizeof(CUSTOMVERTEX),
0,
CUSTOMFVF,
D3DPOOL_MANAGED,
&v_buffer,
NULL);
VOID* pVoid; // a void pointer
// lock v_buffer and load the vertices into it
v_buffer->Lock(0, 0, (void**)&pVoid, 0);
memcpy(pVoid, vertices, sizeof(vertices));
v_buffer->Unlock();
}
示例8: Cleanup
VOID Cleanup()
{
if( g_pVB != NULL )
g_pVB->Release();
if( g_pd3dDevice != NULL )
g_pd3dDevice->Release();
if( g_pD3D != NULL )
g_pD3D->Release();
if(Objects != NULL){
Objects->Release();
}
}
示例9: CreateVertex
HRESULT CreateVertex()
{
POINTVERTEX points[] =
{
{-5.0f, 5.0f, 0.0f, 0xffff0000},
{ 0.0f, 5.0f, 0.0f, 0xffff0000},
{ 5.0f, 5.0f, 0.0f, 0xffff0000},
{-5.0f, 0.0f, 0.0f, 0xff00ff00},
{ 0.0f, 0.0f, 0.0f, 0xff00ff00},
{ 5.0f, 0.0f, 0.0f, 0xff00ff00},
{-5.0f, -5.0f, 0.0f, 0xff0000ff},
{ 0.0f, -5.0f, 0.0f, 0xff0000ff},
{ 5.0f, -5.0f, 0.0f, 0xff0000ff}
} ;
// Create vertex buffer
if (FAILED(g_pd3dDevice->CreateVertexBuffer(
NUM_VERTEX * sizeof(POINTVERTEX),
D3DUSAGE_DYNAMIC | D3DUSAGE_WRITEONLY | D3DUSAGE_POINTS,
D3DFVF_POINTVERTEX,
D3DPOOL_DEFAULT,
&g_pVB,
NULL)))
{
return E_FAIL ;
}
// Copy vertex data
VOID* pVertices;
if( FAILED( g_pVB->Lock( 0, sizeof(points), (void**)&pVertices, 0 ) ) )
return E_FAIL;
memcpy( pVertices, points, sizeof(points) );
g_pVB->Unlock();
}
示例10: Cleanup
VOID Cleanup()
{
// meshes
if ( g_pMeshMaterials != NULL )
delete[] g_pMeshMaterials;
if ( g_pMeshTextures )
{
for ( DWORD i = 0; i < g_dwNumMaterials; ++i )
{
if ( g_pMeshTextures[i] )
g_pMeshTextures[i]->Release();
}
delete[] g_pMeshTextures;
}
if ( g_pMesh != NULL )
g_pMesh->Release();
if ( g_pMeshMaterialsSecond != NULL )
delete[] g_pMeshMaterialsSecond;
if ( g_pMeshTexturesSecond )
{
for ( DWORD i = 0; i < g_dwNumMaterialsSecond; ++i )
{
if ( g_pMeshTexturesSecond[i] )
g_pMeshTexturesSecond[i]->Release();
}
delete[] g_pMeshTexturesSecond;
}
if ( g_pMeshSecond != NULL )
g_pMeshSecond->Release();
// cylinder
if ( g_pTexture != NULL )
g_pTexture->Release();
if ( g_pVB != NULL )
g_pVB->Release();
if ( g_pd3dDevice != NULL )
g_pd3dDevice->Release();
if ( g_pD3D != NULL )
g_pD3D->Release();
}
示例11: shutDown
VOID shutDown() {
if (d3dDevice != NULL) {
d3dDevice->Release();
d3dDevice = NULL;
}
if (d3dManager != NULL) {
d3dManager->Release();
d3dManager = NULL;
}
if (d3dVertexBuf != NULL) {
d3dVertexBuf->Release();
d3dVertexBuf = NULL;
}
}
示例12: Cleanup
//////////////////////////////////////////////////////////////////////////
// 객체 정리 - 순서 주의!
//////////////////////////////////////////////////////////////////////////
VOID Cleanup()
{
if ( g_pVB != NULL )
{
g_pVB->Release();
}
if ( g_pd3dDevice != NULL )
{
g_pd3dDevice->Release();
}
if ( g_pD3D != NULL )
{
g_pD3D->Release();
}
}
示例13: ReleaseD3D
void ReleaseD3D()
{
if (g_pVB) g_pVB->Release();
if(g_pDevice)
{
g_pDevice->Release();
g_pDevice = NULL;
}
if(g_pD3D)
{
g_pD3D->Release();
g_pD3D = NULL;
}
}
示例14: cleanD3D
// this is the function that cleans up Direct3D and COM
void cleanD3D(void) {
if (d3ddev != NULL) {
d3ddev->Release();
}
if (d3ddev != NULL) {
d3d->Release();
}
if (tx != NULL) {
tx->Release();
}
if (vb != NULL) {
vb->Release();
}
if (font != NULL) {
font->Release();
}
}
示例15: UninitBotton
//=============================================================================
// 終了処理
//=============================================================================
void UninitBotton(void)
{
for(int nCntTex = 0; nCntTex < MAX_BOTTON; nCntTex++)
{
if(g_apD3DTextureBotton[nCntTex] != NULL)
{// テクスチャの開放
g_apD3DTextureBotton[nCntTex]->Release();
g_apD3DTextureBotton[nCntTex] = NULL;
}
}
if(g_pD3DVtxBuffBotton != NULL)
{// 頂点バッファの開放
g_pD3DVtxBuffBotton->Release();
g_pD3DVtxBuffBotton = NULL;
}
}