本文整理汇总了C++中LPD3DXMESH::Release方法的典型用法代码示例。如果您正苦于以下问题:C++ LPD3DXMESH::Release方法的具体用法?C++ LPD3DXMESH::Release怎么用?C++ LPD3DXMESH::Release使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LPD3DXMESH
的用法示例。
在下文中一共展示了LPD3DXMESH::Release方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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();
}
示例2: FreeMemory
void D3D9Mesh::CreateText(const char *string, char *FontName, int FontHeight,
float deviation, float depth, bool bold, bool italic)
{
//just call the DirectX function to create the text
FreeMemory();
LPD3DXMESH TextMesh;
HDC hdc = CreateCompatibleDC( NULL );
HFONT hFont;
HFONT hFontOld;
INT nHeight = -MulDiv( FontHeight, GetDeviceCaps(hdc, LOGPIXELSY), 72 );
hFont = CreateFont(nHeight, 0, 0, 0, bold ? FW_BOLD : FW_NORMAL, italic, FALSE, FALSE, DEFAULT_CHARSET,
OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, FontName);
hFontOld = (HFONT)SelectObject(hdc, hFont);
if(FAILED(D3DXCreateText(GetD3DDevice(), hdc, string, deviation, depth, &TextMesh, NULL, NULL))) _asm int 3;
SelectObject(hdc, hFontOld);
DeleteObject( hFont );
DeleteDC( hdc );
TextMesh->CloneMeshFVF(D3DMeshOptions, D3DMeshFVF, GetD3DDevice(), &_Mesh);
TextMesh->Release();
SetColor(RGBColor::White);
GenerateNormals();
}
示例3: Cleanup
//-----------------------------------------------------------------------------
// Desc: 释放创建的对象
//-----------------------------------------------------------------------------
VOID Cleanup()
{
//释放网格模型材质
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();
//释放Direct3D设备对象
if( g_pd3dDevice != NULL )
g_pd3dDevice->Release();
//释放Direct3D对象
if( g_pD3D != NULL )
g_pD3D->Release();
}
示例4: obtainSourceGeometry
//------------------------------------------------------------------------------------------------
// Name: obtainSourceGeometry
// Desc: Loads geometry from the source file into the output subset geometry
//------------------------------------------------------------------------------------------------
bool XMesh::obtainSourceGeometry(LPDIRECT3DDEVICE9 pd3dDevice, SubsetGeometry* subsetGeometry) const
{
// Fail without a device or if something is wrong with the output pointer
if (APP_ERROR(!pd3dDevice || !subsetGeometry)("Invalid paramter to obtainSourceGeometry") ||
APP_ERROR(!subsetGeometry->empty())("Provided geometry subset for obtainSourceGeometry must be empty"))
return false;
// Check to make sure a file exists (if not, just exit)
if (mySourceFile.getValue().empty()) return true;
// Keeps track of how many subsets this mesh contains
DWORD subsets = 0;
// Stores the mesh that was loaded from the file
LPD3DXMESH pXMesh = NULL;
// Load the mesh from the specified file
if (APP_ERROR(D3DXLoadMeshFromX(mySourceFile.getValue().c_str(), D3DXMESH_SYSTEMMEM,
pd3dDevice, NULL, NULL, NULL, &subsets,
&pXMesh))("XMesh couldn't load \"%s\"", mySourceFile.getValue().c_str()))
return false;
// Convert the mesh
bool succeeded = buildGeometryFromD3DXMesh(pXMesh, subsetGeometry, subsets);
// Release the mesh
pXMesh->Release();
// Return an error code if an error occurred
if (APP_ERROR(!succeeded)("Unable to build geometry for mesh from \"%s\"", mySourceFile.getValue().c_str()))
return false;
// Success
return true;
}
示例5: Cleanup
VOID Cleanup()
{
if ( NULL != g_pMeshMaterials0 )
{
delete[] g_pMeshMaterials0;
}
if ( g_pMeshTextures0 )
{
for ( DWORD i = 0; i < g_dwNumMaterials; ++i )
{
if ( g_pMeshTextures0[i] )
{
g_pMeshTextures0[i]->Release();
}
}
delete[] g_pMeshTextures0;
}
if ( NULL != g_pMesh0 )
{
g_pMesh0->Release();
}
if ( NULL != g_pD3DDevice )
{
g_pD3DDevice->Release();
}
if ( NULL != g_pD3D )
{
g_pD3D->Release();
}
}
示例6: Cleanup
VOID Cleanup()
{
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();
}
}
}
if ( g_pMesh )
{
g_pMesh->Release();
}
if ( g_pd3dDevice != NULL )
{
g_pd3dDevice->Release();
}
if ( g_pD3D != NULL )
{
g_pD3D->Release();
}
}
示例7: shutDown_1
//-----------------------------------------------------------------------------
// Name: shutDown()
// Desc:
//-----------------------------------------------------------------------------
void shutDown_1( void )
{
if( g_pTeapotMesh_1 != NULL )
g_pTeapotMesh_1->Release();
if( g_pd3dDevice_1 != NULL )
g_pd3dDevice_1->Release();
}
示例8: CreateMappedSphere
LPD3DXMESH SkyBox::CreateMappedSphere(float fRad, UINT slices, UINT stacks)
{
// create the sphere
LPD3DXMESH mesh;
if (FAILED(D3DXCreateSphere(GameManager::GetDevice( ), fRad, slices, stacks, &mesh, NULL)))
return NULL;
// create a copy of the mesh with texture coordinates,
// since the D3DX function doesn't include them
LPD3DXMESH texMesh;
if (FAILED(mesh->CloneMeshFVF(D3DXMESH_SYSTEMMEM, FVF_PositionNormalTexture::FVF, GameManager::GetDevice( ), &texMesh)))
return mesh; // failed, return un-textured mesh
mesh->Release( ); // finished with the original mesh, release it
// lock the vertex buffer
FVF_PositionNormalTexture* pVerts;
//if (SUCCEEDED(texMesh->LockVertexBuffer(0, (BYTE **)&pVerts)))
if (SUCCEEDED(texMesh->LockVertexBuffer(0, (LPVOID*)&pVerts)))
{
int numVerts = texMesh->GetNumVertices( ); // get vertex count
// loop through the vertices
for (int i = 0; i < numVerts; i++)
{
// calculate texture coordinates
pVerts->tex.x = asinf(pVerts->normal.x) / D3DX_PI + 0.5f;
pVerts->tex.y = asinf(pVerts->normal.y) / D3DX_PI + 0.5f;
//pVerts->tex.x = 0.5f - (atan2f(pVerts->normal.z, pVerts->normal.x) / (2 * D3DX_PI));
//pVerts->tex.y = 0.5f - asinf(pVerts->normal.y) / (D3DX_PI);
//pVerts->tex.y = pVerts->normal.y * 0.5 + 0.5;
//if (pVerts->tex.x <(FLOAT)0.9) pVerts->tex.x = (FLOAT)0.0;
//pVerts->tex.x = pVerts->pos.x / sqrtf((pVerts->pos.x * pVerts->pos.x) + (pVerts->pos.y * pVerts->pos.x) + (pVerts->pos.z * pVerts->pos.z));
//pVerts->tex.y = pVerts->pos.y / sqrtf((pVerts->pos.x * pVerts->pos.x) + (pVerts->pos.y * pVerts->pos.x) + (pVerts->pos.z * pVerts->pos.z));
//float theta = asinf(pVerts->normal.z);
//float phi = atan2(pVerts->normal.y, pVerts->normal.x);
//
//pVerts->tex = D3DXVECTOR2(phi / 2 / 3.14159265, theta / 3.14159265);
// go to next vertex
pVerts++;
}
texMesh->UnlockVertexBuffer( ); // unlock the vertex buffer
}
// return pointer to caller
return texMesh;
}
示例9: Game_End
void Game_End()
{
//free memory and shut down
mesh->Release();
DirectSound_Shutdown();
DirectInput_Shutdown();
Direct3D_Shutdown();
}
示例10: Cleanup
void Cleanup()
{
// 폰트를 release 한다.
if (gpFont)
{
gpFont->Release();
gpFont = NULL;
}
// 모델을 release 한다.
if (gpSphere)
{
gpSphere->Release();
gpSphere = NULL;
}
// 쉐이더를 release 한다.
if (gpNormalMappingShader)
{
gpNormalMappingShader->Release();
gpNormalMappingShader = NULL;
}
// 텍스처를 release 한다.
if (gpStoneDM)
{
gpStoneDM->Release();
gpStoneDM = NULL;
}
if (gpStoneSM)
{
gpStoneSM->Release();
gpStoneSM = NULL;
}
if (gpStoneNM)
{
gpStoneNM->Release();
gpStoneNM = NULL;
}
// D3D를 release 한다.
if (gpD3DDevice)
{
gpD3DDevice->Release();
gpD3DDevice = NULL;
}
if (gpD3D)
{
gpD3D->Release();
gpD3D = NULL;
}
}
示例11: shutDown_0
//-----------------------------------------------------------------------------
// Name: shutDown()
// Desc:
//-----------------------------------------------------------------------------
void shutDown_0( void )
{
if( g_pTeapotMesh_0 != NULL )
g_pTeapotMesh_0->Release();
if( g_pd3dDevice_0 != NULL )
g_pd3dDevice_0->Release();
if( g_pD3D != NULL )
g_pD3D->Release();
}
示例12: CreateBox
void CBoundBox::CreateBox( const D3DXVECTOR3 *pVMin, const D3DXVECTOR3 *pVMax )
{
m_fWidth = pVMax->x - pVMin->x;
m_fHeight = pVMax->y - pVMin->y;
m_fDepth = pVMax->z - pVMin->z;
LPD3DXMESH tmpMesh;
D3DXCreateBox( m_pDevice, m_fWidth, m_fHeight, m_fDepth, &tmpMesh, NULL );
tmpMesh->CloneMeshFVF( tmpMesh->GetOptions(), D3DFVF_XYZ|D3DFVF_DIFFUSE, m_pDevice, &m_box );
tmpMesh->CloneMeshFVF( tmpMesh->GetOptions(), D3DFVF_XYZ|D3DFVF_DIFFUSE, m_pDevice, &m_boxOrig );
tmpMesh->Release();
}
示例13: Cleanup
//-----------------------------------------------------------------------------
// Name: Cleanup()
// Desc: Releases all previously initialized objects
//-----------------------------------------------------------------------------
VOID Cleanup()
{
if( g_pMeshMaterials != NULL )
delete[] g_pMeshMaterials;
if( g_pMeshMaterials2 != NULL )
delete[] g_pMeshMaterials2;
if( g_pMeshTextures )
{
for( DWORD i = 0; i < g_dwNumMaterials; i++ )
{
if( g_pMeshTextures[i] )
g_pMeshTextures[i]->Release();
}
delete[] g_pMeshTextures;
}
if( g_pMeshTextures2 )
{
for( DWORD i = 0; i < g_dwNumMaterials2; i++ )
{
if( g_pMeshTextures2[i] )
g_pMeshTextures2[i]->Release();
}
delete[] g_pMeshTextures2;
}
if( g_pMesh != NULL )
g_pMesh->Release();
if( g_pMesh2 != NULL )
g_pMesh2->Release();
if( g_pd3dDevice != NULL )
g_pd3dDevice->Release();
if( g_pD3D != NULL )
g_pD3D->Release();
}
示例14: _MDLOptimize
PROTECTED void _MDLOptimize(LPD3DXMESH mesh, const LPD3DXBUFFER pAdjacencyBuffer, int numInd,
LPD3DXMESH *optMesh)
{
HRESULT hr;
DWORD *rgdwAdjacencyTemp = 0;
LPD3DXMESH tempMesh;
DWORD dw32Bit = mesh->GetOptions() & D3DXMESH_32BIT;
// allocate a second adjacency buffer to store post attribute sorted adjacency
if(MemAlloc((void**)&rgdwAdjacencyTemp, sizeof(DWORD)*numInd, M_ZERO) != RETCODE_SUCCESS)
{ ASSERT_MSG(0, "Unable to allocate rgdwAdjacencyTemp", "Error in _MDLOptimize"); goto End; }
// attribute sort - the un-optimized mesh option
// remember the adjacency for the vertex cache optimization
hr = mesh->OptimizeInplace( D3DXMESHOPT_COMPACT|D3DXMESHOPT_ATTRSORT,
(DWORD*)pAdjacencyBuffer->GetBufferPointer(),
rgdwAdjacencyTemp, NULL, NULL);
if( FAILED(hr) )
goto End;
// snapshot the attribute sorted mesh, shown as the un-optimized version
hr = mesh->CloneMeshFVF( dw32Bit|D3DXMESH_MANAGED, mesh->GetFVF(),
g_p3DDevice, &tempMesh );
if( FAILED(hr) )
goto End;
// actually do the vertex cache optimization
hr = mesh->OptimizeInplace( D3DXMESHOPT_COMPACT|D3DXMESHOPT_ATTRSORT|D3DXMESHOPT_VERTEXCACHE,
rgdwAdjacencyTemp,
NULL, NULL, NULL);
if( FAILED(hr) )
goto End;
// snapshot as the optimized mesh
hr = mesh->CloneMeshFVF( dw32Bit|D3DXMESH_MANAGED, mesh->GetFVF(),
g_p3DDevice, optMesh );
if( FAILED(hr) )
goto End;
End:
if(rgdwAdjacencyTemp)
MemFree((void**)&rgdwAdjacencyTemp);
if(tempMesh)
tempMesh->Release();
}
示例15: Unlock
void D3D9Mesh::NPatchEnhance(float segs, bool quadratic)
{
DWORD *adj;
Unlock();
//get the _Mesh adjacency (needed by NPatchEnhance)
GenerateAdj(adj);
LPD3DXMESH sphere;
//do the n-patching using the DirectX function
D3DXTessellateNPatches(_Mesh, adj, segs, quadratic, &sphere, NULL);
FreeMemory();
//load the data into
sphere->CloneMeshFVF(D3DMeshOptions, D3DMeshFVF, GetD3DDevice(), &_Mesh);
sphere->Release();
delete[] adj;
}