本文整理汇总了C++中ITexture::IsError方法的典型用法代码示例。如果您正苦于以下问题:C++ ITexture::IsError方法的具体用法?C++ ITexture::IsError怎么用?C++ ITexture::IsError使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ITexture
的用法示例。
在下文中一共展示了ITexture::IsError方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: pRenderContext
//-----------------------------------------------------------------------------
// paint it!
//-----------------------------------------------------------------------------
void CVMTPanel::OnPaint3D()
{
if (!m_pMaterial)
return;
// Deal with refraction
if ( m_pMaterial->NeedsPowerOfTwoFrameBufferTexture() )
{
ITexture *pTexture = GetPowerOfTwoFrameBufferTexture();
if ( pTexture && !pTexture->IsError() )
{
CMatRenderContextPtr pRenderContext( MaterialSystem() );
pRenderContext->CopyRenderTargetToTexture( pTexture );
pRenderContext->SetFrameBufferCopyTexture( pTexture );
}
}
// Draw a background (translucent objects will appear that way)
// FIXME: Draw the outline of this panel?
// pRenderContext->CullMode(MATERIAL_CULLMODE_CCW);
RenderSphere( vec3_origin, SPHERE_RADIUS, 20, 20 );
/*
pRenderContext->MatrixMode( MATERIAL_PROJECTION );
pRenderContext->LoadIdentity();
pRenderContext->Ortho( 0, 0, m_iViewableWidth, m_iViewableHeight, 0, 1 );
pRenderContext->Bind( m_pMaterial );
IMesh *pMesh = pRenderContext->GetDynamicMesh();
CMeshBuilder meshBuilder;
meshBuilder.Begin( pMesh, MATERIAL_QUADS, 1 );
if (!m_bUseActualSize)
{
DrawStretchedToPanel( meshBuilder );
}
else
{
DrawActualSize( meshBuilder );
}
meshBuilder.End();
pMesh->Draw();
*/
}
示例2: Paint
//-----------------------------------------------------------------------------
// Paints the texture
//-----------------------------------------------------------------------------
void CVMTPreviewPanel::Paint( void )
{
CMatRenderContextPtr pRenderContext( MaterialSystem() );
int w, h;
GetSize( w, h );
vgui::MatSystemSurface()->Begin3DPaint( 0, 0, w, h );
// Deal with refraction
if ( m_Material->NeedsPowerOfTwoFrameBufferTexture() )
{
ITexture *pTexture = GetPowerOfTwoFrameBufferTexture();
if ( pTexture && !pTexture->IsError() )
{
pRenderContext->CopyRenderTargetToTexture( pTexture );
pRenderContext->SetFrameBufferCopyTexture( pTexture );
}
}
pRenderContext->ClearColor4ub( 76, 88, 68, 255 );
pRenderContext->ClearBuffers( true, true );
pRenderContext->FogMode( MATERIAL_FOG_NONE );
pRenderContext->SetNumBoneWeights( 0 );
pRenderContext->Bind( m_Material );
pRenderContext->BindLightmapTexture( m_pLightmapTexture );
pRenderContext->BindLocalCubemap( m_DefaultEnvCubemap );
if ( m_bDrawIn3DMode || m_Material->IsSpriteCard() )
{
DrawSphere();
}
else
{
DrawRectangle();
}
vgui::MatSystemSurface()->End3DPaint( );
}
示例3: OnBind
//.........这里部分代码省略.........
C_Team *pTeam = GetGlobalTeam(g_PR->GetTeam(pPl->index));
teamFolder = pTeam->GetFolderName();
kitFolder = pTeam->GetKitFolderName();
pKitInfo = pTeam->GetKitInfo();
skinIndex = g_PR->GetSkinIndex(pPl->index);
shirtNumber = g_PR->GetShirtNumber(pPl->index);
shirtName = g_PR->GetShirtName(pPl->index);
isKeeper = g_PR->GetTeamPosType(pPl->index) == POS_GK;
int teamIndex = pTeam->GetTeamNumber() - TEAM_A;
int posIndex = g_PR->GetTeamPosIndex(pPl->index);
pDetailTexture = materials->FindTexture(VarArgs("models/player/default/detail_%d_%d", teamIndex, posIndex), NULL, true);
pProcReg = &m_pTextureRegen[teamIndex][posIndex];
}
else if (dynamic_cast<C_ReplayPlayer *>(pEnt))
{
C_ReplayPlayer *pReplayPl = dynamic_cast<C_ReplayPlayer *>(pEnt);
C_Team *pTeam = GetGlobalTeam(pReplayPl->m_nTeamNumber);
teamFolder = pTeam->GetFolderName();
kitFolder = pTeam->GetKitFolderName();
pKitInfo = pTeam->GetKitInfo();
skinIndex = pReplayPl->m_nSkinIndex;
shirtNumber = pReplayPl->m_nShirtNumber;
shirtName = pReplayPl->m_szShirtName;
isKeeper = pReplayPl->m_bIsKeeper;
int teamIndex = pReplayPl->m_nTeamNumber - TEAM_A;
int posIndex = pReplayPl->m_nTeamPosIndex;
pDetailTexture = materials->FindTexture(VarArgs("models/player/default/detail_%d_%d", teamIndex, posIndex), NULL, true);
pProcReg = &m_pTextureRegen[teamIndex][posIndex];
}
else if (dynamic_cast<C_BaseAnimatingOverlay *>(pEnt))
{
C_BaseAnimatingOverlay *pPlayerModelPreview = dynamic_cast<C_BaseAnimatingOverlay *>(pEnt);
CAppearanceSettingPanel *pPanel = (CAppearanceSettingPanel *)iosOptionsMenu->GetPanel()->GetSettingPanel(SETTING_PANEL_APPEARANCE);
pPanel->GetPlayerTeamInfo(&teamFolder, &kitFolder);
pKitInfo = CTeamInfo::FindTeamByKitName(VarArgs("%s/%s", teamFolder, kitFolder));
skinIndex = pPanel->GetPlayerSkinIndex();
shirtNumber = pPanel->GetPlayerOutfieldShirtNumber();
shirtName = pPanel->GetPlayerShirtName();
isKeeper = false;
pDetailTexture = materials->FindTexture("models/player/default/detail_preview", NULL, true);
pProcReg = &m_pPreviewTextureRegen;
}
else
{
return;
}
if (!Q_strcmp(m_szTextureType, "shirt") || !Q_strcmp(m_szTextureType, "keepershirt"))
{
if (!(*pProcReg))
*pProcReg = new CProceduralRegenerator();
pDetailTexture->SetTextureRegenerator(*pProcReg);
m_pDetailTextureVar->SetTextureValue(pDetailTexture);
bool needsUpdate;
if (isKeeper)
needsUpdate = (*pProcReg)->SetPlayerInfo(shirtName, shirtNumber, pKitInfo->m_KeeperShirtNameColor, pKitInfo->m_nKeeperShirtNameOffset, pKitInfo->m_KeeperShirtNumberColor, pKitInfo->m_nKeeperShirtNumberOffset, true, pKitInfo->m_pFontAtlas);
else
needsUpdate = (*pProcReg)->SetPlayerInfo(shirtName, shirtNumber, pKitInfo->m_OutfieldShirtNameColor, pKitInfo->m_nOutfieldShirtNameOffset, pKitInfo->m_OutfieldShirtNumberColor, pKitInfo->m_nOutfieldShirtNumberOffset, false, pKitInfo->m_pFontAtlas);
if (needsUpdate)
pDetailTexture->Download();
}
char texture[128];
if (Q_stricmp(m_szTextureType, "shirt") == 0)
Q_snprintf(texture, sizeof(texture), "%s/%s/%s/outfield", TEAMKITS_PATH, teamFolder, kitFolder);
else if (Q_stricmp(m_szTextureType, "keepershirt") == 0)
Q_snprintf(texture, sizeof(texture), "%s/%s/%s/keeper", TEAMKITS_PATH, teamFolder, kitFolder);
else if (Q_stricmp(m_szTextureType, "socks") == 0)
Q_snprintf(texture, sizeof(texture), "%s/%s/%s/socks", TEAMKITS_PATH, teamFolder, kitFolder);
else if (Q_stricmp(m_szTextureType, "gksocks") == 0)
Q_snprintf(texture, sizeof(texture), "%s/%s/%s/gksocks", TEAMKITS_PATH, teamFolder, kitFolder);
else if (Q_stricmp(m_szTextureType, "skin") == 0)
Q_snprintf(texture, sizeof(texture), "models/player/skins/skin%d", skinIndex + 1);
else
Q_snprintf(texture, sizeof(texture), "%s", m_pTexture->GetName());
ITexture *pNewTex = materials->FindTexture(texture, NULL, false);
if (!pNewTex->IsError())
m_pTexture = pNewTex;
m_pBaseTextureVar->SetTextureValue(m_pTexture);
GetMaterial()->RecomputeStateSnapshots();
}