//-------------------------------------------------------------------------------------- CPUTBuffer *CPUTModel::GetBuffer( const cString &name, int meshIndex ) const { if( meshIndex >= 0 ) { CPUTMaterial *pMaterial = mpMaterial[meshIndex]; if( pMaterial ) { UINT bufferCount = pMaterial->GetBufferCount(); for( UINT ii=0; ii<bufferCount; ii++ ) { CPUTBuffer *pBuffer = pMaterial->GetBuffer(ii); if( 0 == _wcsicmp( pBuffer->GetName().data(), name.data() ) ) { pBuffer->AddRef(); return pBuffer; } } } } else { // No meshIndex specified, so check all materials for(UINT ii=0; ii<mMeshCount; ii++ ) { CPUTBuffer *pBuffer = GetBuffer( name, ii ); if( pBuffer ) { return pBuffer; } } } return NULL; }
//----------------------------------------------------------------------------- CPUTBuffer *CPUTAssetLibrary::GetConstantBuffer(const cString &name, const CPUTModel *pModel, int meshIndex ) { // If we already have one by this name, then return it CPUTBuffer *pBuffer = FindConstantBuffer(name, true, pModel, meshIndex); ASSERT( pBuffer, _L("Can't find constant buffer ") + name ); pBuffer->AddRef(); return pBuffer; }
//----------------------------------------------------------------------------- CPUTBuffer *CPUTAssetLibrary::GetBuffer(const cString &name ) { // If we already have one by this name, then return it CPUTBuffer *pBuffer = FindBuffer(name, true); ASSERT( pBuffer, _L("Can't find buffer ") + name ); pBuffer->AddRef(); return pBuffer; }
//----------------------------------------------------------------------------- CPUTBuffer *CPUTAssetLibrary::GetConstantBuffer(const std::string &name) { // If we already have one by this name, then return it CPUTBuffer *pBuffer = FindConstantBuffer(name, true); LIBRARY_ASSERT(pBuffer, "Can't find constant buffer " + name); if(pBuffer != NULL) pBuffer->AddRef(); return pBuffer; }
CPUTBuffer *CPUTAssetLibrary::GetConstantBufferByName(const cString &name) { CPUTBuffer *pConstantBuffer = (CPUTBuffer *) FindAssetByName(name, mpConstantBufferList); if (pConstantBuffer != NULL) { pConstantBuffer->AddRef(); return pConstantBuffer; } return NULL; }
CPUTBuffer *CPUTAssetLibrary::GetBufferByName(const std::string &name) { CPUTBuffer *pBuffer = (CPUTBuffer *) FindAssetByName(name, mpBufferList); if (pBuffer != NULL) { pBuffer->AddRef(); return pBuffer; } return NULL; }
void DrawQuadSC(CPUTRenderParameters &renderParams, float2 position, float size, CPUTColor4 color) { CPUTBuffer *pBuffer = (CPUTBuffer*)(renderParams.mpPerModelConstants); CPUTModelConstantBuffer cb; cb.UserData1 = color.ToFloat4(); pBuffer->SetData(0, sizeof(CPUTModelConstantBuffer), &cb); CPUTSprite *sprite = gUtilGlob.QuadSprite; sprite->SetCoordType(SpriteCoordType_Screen); sprite->SetC(position.x, position.y, size, size); sprite->DrawSprite(renderParams); }