本文整理汇总了C++中CGrowableArray::GetSize方法的典型用法代码示例。如果您正苦于以下问题:C++ CGrowableArray::GetSize方法的具体用法?C++ CGrowableArray::GetSize怎么用?C++ CGrowableArray::GetSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGrowableArray
的用法示例。
在下文中一共展示了CGrowableArray::GetSize方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RemoveEffect
//-------------------------------------------------------------------------------------
// Removes all instances of this effect from the binding list
//-------------------------------------------------------------------------------------
HRESULT CDXUTEffectMap::RemoveEffect( ID3DXEffect* pEffect )
{
if( pEffect == NULL )
return E_INVALIDARG;
// Search through the list of registered semantics and remove all items
// assigned to the given effect
for( UINT iSemantic = 0; iSemantic < NUM_DXUT_SEMANTICS; iSemantic++ )
{
for( UINT iObject = 0; iObject < NUM_DXUT_OBJECTS; iObject++ )
{
for( UINT iIndex = 0; iIndex < MAX_INDEX; iIndex++ )
{
CGrowableArray<ParamList>* pBinding = &m_Bindings[ iSemantic ][ iObject ][ iIndex ];
// Clear nested arrays first
for( int iParamList = 0; iParamList < pBinding->GetSize(); iParamList++ )
{
ParamList& rParamList = pBinding->GetAt( iParamList );
if( rParamList.pEffect == pEffect )
rParamList.Reset();
}
}
}
}
return S_OK;
}
示例2: SetStandardParameter
//-------------------------------------------------------------------------------------
HRESULT CDXUTEffectMap::SetStandardParameter( DXUT_SEMANTIC eSemantic,
DXUT_OBJECT eObject,
DWORD dwObjectIndex,
float* pData,
DWORD dwDataLen,
const WCHAR* strType,
const WCHAR* strUnits,
const WCHAR* strSpace )
{
HRESULT hr;
// TODO: remove index limits
if( dwObjectIndex >= MAX_INDEX )
return E_INVALIDARG;
// TODO: handle unit and space conversions
// Retrieve the interested handles
CGrowableArray<ParamList>* pBindings = &m_Bindings[ eSemantic ][ eObject ][ dwObjectIndex ];
for( int iList=0; iList < pBindings->GetSize(); iList++ )
{
ParamList& paramList = pBindings->GetAt(iList);
for( int iParam=0; iParam < paramList.ahParameters.GetSize(); iParam++ )
{
V_RETURN( paramList.pEffect->SetFloatArray( paramList.ahParameters[iParam], pData, dwDataLen ) );
}
}
return S_OK;
}
示例3: Reset
//-------------------------------------------------------------------------------------
VOID CDXUTEffectMap::Reset()
{
D3DXMatrixIdentity( &m_matWorld );
D3DXMatrixIdentity( &m_matView );
D3DXMatrixIdentity( &m_matProjection );
// Reset all the stored parameter lists
for( UINT iSemantic = 0; iSemantic < NUM_DXUT_SEMANTICS; iSemantic++ )
{
for( UINT iObject = 0; iObject < NUM_DXUT_OBJECTS; iObject++ )
{
for( UINT iIndex = 0; iIndex < MAX_INDEX; iIndex++ )
{
CGrowableArray<ParamList>* pBinding = &m_Bindings[ iSemantic ][ iObject ][ iIndex ];
// Clear nested arrays first
for( int iParamList = 0; iParamList < pBinding->GetSize(); iParamList++ )
{
pBinding->GetAt( iParamList ).Reset();
}
// Remove all the bound parameter lists
pBinding->RemoveAll();
}
}
}
}
示例4: RenderTerrain
//--------------------------------------------------------------------------------------
// RenderTerrain
//--------------------------------------------------------------------------------------
void RenderTerrain( ID3D10Device* pd3dDevice )
{
D3DXMATRIX mWorld;
D3DXMatrixIdentity( &mWorld );
D3DXVECTOR3 vEye;
D3DXVECTOR3 vDir;
D3DXMATRIX mCamWorld;
D3DXMATRIX mView;
D3DXMATRIX mProj;
GetCameraData( &mCamWorld, &mView, &mProj, &vEye, &vDir );
D3DXMATRIX mWVP = mCamWorld * mView * mProj;
pd3dDevice->IASetInputLayout( g_pBasicDecl10 );
g_pmWorldViewProj->SetMatrix( ( float* )&mWVP );
g_pmWorld->SetMatrix( ( float* )&mWorld );
g_ptxNormal->SetResource( g_pNormalTexRV );
g_ptxDirt->SetResource( g_pDirtTexRV );
g_ptxGrass->SetResource( g_pGroundGrassTexRV );
g_ptxMask->SetResource( g_pMaskTexRV );
if( !g_bShowTiles )
{
D3DXVECTOR4 color( 1,1,1,1 );
g_pvColor->SetFloatVector( ( float* )&color );
}
pd3dDevice->IASetIndexBuffer( g_Terrain.GetTerrainIB10(), DXGI_FORMAT_R16_UINT, 0 );
D3D10_TECHNIQUE_DESC techDesc;
g_pRenderTerrain->GetDesc( &techDesc );
for( UINT p = 0; p < techDesc.Passes; ++p )
{
// Render front to back
UINT NumTiles = g_VisibleTileArray.GetSize();
SetNumVisibleTiles( NumTiles );
for( UINT i = 0; i < NumTiles; i++ )
{
TERRAIN_TILE* pTile = g_Terrain.GetTile( g_VisibleTileArray.GetAt( i ) );
if( g_bShowTiles )
{
g_pvColor->SetFloatVector( ( float* )&pTile->Color );
}
g_pRenderTerrain->GetPassByIndex( p )->Apply( 0 );
g_Terrain.RenderTile( pTile );
}
}
}
示例5: sizeof
void Dx11TextHelper::EndText11( ID3D11Device* pd3dDevice, ID3D11DeviceContext* pd3d11DeviceContext )
{
// ensure our buffer size can hold our sprites
UINT FontDataBytes = g_FontVertices.GetSize() * sizeof( DXUTSpriteVertex );
if( g_FontBufferBytes11 < FontDataBytes )
{
SAFE_RELEASE( g_pFontBuffer11 );
g_FontBufferBytes11 = FontDataBytes;
D3D11_BUFFER_DESC BufferDesc;
BufferDesc.ByteWidth = g_FontBufferBytes11;
BufferDesc.Usage = D3D11_USAGE_DYNAMIC;
BufferDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
BufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
BufferDesc.MiscFlags = 0;
pd3dDevice->CreateBuffer( &BufferDesc, NULL, &g_pFontBuffer11 );
//DXUT_SetDebugName( g_pFontBuffer11, "DXUT Text11" );
}
// Copy the sprites over
D3D11_BOX destRegion;
destRegion.left = 0;
destRegion.right = FontDataBytes;
destRegion.top = 0;
destRegion.bottom = 1;
destRegion.front = 0;
destRegion.back = 1;
D3D11_MAPPED_SUBRESOURCE MappedResource;
if ( S_OK == pd3d11DeviceContext->Map( g_pFontBuffer11, 0, D3D11_MAP_WRITE_DISCARD, 0, &MappedResource ) ) {
CopyMemory( MappedResource.pData, (void*)g_FontVertices.GetData(), FontDataBytes );
pd3d11DeviceContext->Unmap(g_pFontBuffer11, 0);
}
ID3D11ShaderResourceView* pOldTexture = NULL;
pd3d11DeviceContext->PSGetShaderResources( 0, 1, &pOldTexture );
//pd3d11DeviceContext->PSSetShaderResources( 0, 1, &g_pFont11 );
// Draw
UINT Stride = sizeof( DXUTSpriteVertex );
UINT Offset = 0;
pd3d11DeviceContext->IASetVertexBuffers( 0, 1, &g_pFontBuffer11, &Stride, &Offset );
pd3d11DeviceContext->IASetIndexBuffer( NULL, DXGI_FORMAT_R16_UINT, 0 );
pd3d11DeviceContext->IASetInputLayout( g_pInputLayout11 );
pd3d11DeviceContext->IASetPrimitiveTopology( D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST );
m_pFontTex->SetResource(g_pFont11);
D3DX11_TECHNIQUE_DESC techDesc;
g_pFontTec->GetDesc( &techDesc );
for( UINT p = 0; p < techDesc.Passes; ++p )
{
g_pFontTec->GetPassByIndex( p )->Apply( 0, pd3d11DeviceContext );
pd3d11DeviceContext->Draw( g_FontVertices.GetSize(), 0 );
}
pd3d11DeviceContext->PSSetShaderResources( 0, 1, &pOldTexture );
SAFE_RELEASE( pOldTexture );
g_FontVertices.Reset();
}
示例6: AddEffect
//-------------------------------------------------------------------------------------
// Investigates all the parameters, looking at semantics and annotations and placing
// handles to these parameters within the internal database.
//-------------------------------------------------------------------------------------
HRESULT CDXUTEffectMap::AddEffect( ID3DXEffect* pEffect )
{
HRESULT hr;
if( pEffect == NULL )
return E_INVALIDARG;
// Get the number of parameters
D3DXEFFECT_DESC descEffect;
V_RETURN( pEffect->GetDesc( &descEffect ) );
// Enumerate the parameters
for( UINT iParam=0; iParam < descEffect.Parameters; iParam++ )
{
// Retrieve param
D3DXHANDLE hParameter = pEffect->GetParameter( NULL, iParam );
if( NULL == hParameter )
return E_FAIL;
// Grab description
D3DXPARAMETER_DESC desc;
V_RETURN( pEffect->GetParameterDesc( hParameter, &desc ) );
// If this parameter doesn't have a semantic, skip to the next parameter
if( desc.Semantic == NULL )
continue;
// Map the semantic to the standard set
DXUT_SEMANTIC eSemantic = StringToSemantic( desc.Semantic );
if( eSemantic == DXUT_UNKNOWN_SEMANTIC )
continue;
// Get the object annotation
const char* cstrObject = "Geometry";
D3DXHANDLE hAnnotation = pEffect->GetAnnotationByName( hParameter, "Object" );
if( hAnnotation )
{
V_RETURN( pEffect->GetString( hAnnotation, &cstrObject ) );
}
// Map the object to the standard set
DXUT_OBJECT eObject = StringToObject( cstrObject );
if( eObject == DXUT_UNKNOWN_OBJECT )
continue;
// Extract the index from the semantic
int index = 0;
const char* strIndex = desc.Semantic + strlen(desc.Semantic)-1;
// If there is a digit at the end of the semantic, locate the beginning of the index
// and convert to an integer
if( isdigit( (BYTE) (*strIndex) ) )
{
while( isdigit( (BYTE) (*(strIndex-1)) ) )
{
--strIndex;
}
index = atoi( strIndex );
}
// Check whether index is out of bounds
if( index < 0 || index >= MAX_INDEX )
continue;
// Store the handle
CGrowableArray<ParamList>* pBindings = &m_Bindings[ eSemantic ][ eObject ][ index ];
bool bBound = false;
for( int i=0; i < pBindings->GetSize(); i++ )
{
if( pBindings->GetAt(i).pEffect == pEffect )
{
// Found the containing effect for this parameter in the list, add the new handle
pBindings->GetAt(i).ahParameters.Add( hParameter );
bBound = true;
break;
}
}
if( !bBound )
{
// This parameter belongs to a new effect
ParamList newParamList;
newParamList.pEffect = pEffect;
pEffect->AddRef();
newParamList.ahParameters.Add( hParameter );
pBindings->Add( newParamList );
}
}
return S_OK;
}