void CC_Generate_Density_Tex( void ) { CMaterialReference DensityMaterial("dev/density", TEXTURE_GROUP_CLIENT_EFFECTS); ITexture *pTex = materials->FindTexture("dev/density", TEXTURE_GROUP_CLIENT_EFFECTS, true); Msg("density_generate_tex: Generating density texture\n"); if( pTex ) pTex->Download(); else Msg("Texture not found\n"); DensityMaterial.Shutdown(); }
//----------------------------------------------------------------------------- // Called when the texture is bound... //----------------------------------------------------------------------------- void CCamoMaterialProxy::OnBind( C_BaseEntity *pEntity ) { if( !m_pCamoTextureVar ) { return; } m_pEnt = pEntity; ITexture *pCamoTexture = m_pCamoTextureVar->GetTextureValue(); pCamoTexture->Download(); // Mark it so it doesn't get regenerated on task switch m_pEnt = NULL; }
//----------------------------------------------------------------------------- // Called when the texture is bound... //----------------------------------------------------------------------------- void CZZMaterialProxy::OnBind( C_BaseEntity *pEntity ) { if( !m_pTextureVar ) { return; } if(!m_pTextureVar->IsTexture()) // Make sure it is a texture return; //ITexture *pTexture = m_pTextureVar->GetTextureValue(); m_pTexture->Download(); // Mark it so it doesn't get regenerated on task switch //m_pEnt = NULL; }
void CTextureSystem::OnFileChange( const char *pFilename, int context, CTextureSystem::EFileType eFileType ) { // It requires the forward slashes later... char fixedSlashes[MAX_PATH]; V_StrSubst( pFilename, "\\", "/", fixedSlashes, sizeof( fixedSlashes ) ); // Get rid of the extension. if ( V_strlen( fixedSlashes ) < 5 ) { Assert( false ); return; } fixedSlashes[ V_strlen( fixedSlashes ) - 4 ] = 0; // Handle it based on what type of file we've got. if ( eFileType == k_eFileTypeVMT ) { IEditorTexture *pTex = FindActiveTexture( fixedSlashes, NULL, FALSE ); if ( pTex ) { pTex->Reload( true ); } else { EnumMaterial( fixedSlashes, context ); IEditorTexture *pTex = FindActiveTexture( fixedSlashes, NULL, FALSE ); if ( pTex ) { GetMainWnd()->m_TextureBar.NotifyNewMaterial( pTex ); GetMainWnd()->GetFaceEditSheet()->NotifyNewMaterial( pTex ); } } } else if ( eFileType == k_eFileTypeVTF ) { // Whether a VTF was added, removed, or modified, we do the same thing.. refresh it and any materials that reference it. ITexture *pTexture = materials->FindTexture( fixedSlashes, TEXTURE_GROUP_UNACCOUNTED, false ); if ( pTexture ) { pTexture->Download( NULL ); ReloadMaterialsUsingTexture( pTexture ); } } }
void CPlayerTextureProxy::OnBind( C_BaseEntity *pEnt ) { // Bail if no base variable if ( !m_pBaseTextureVar ) return; CTeamKitInfo *pKitInfo; const char *teamFolder; const char *kitFolder; int skinIndex; int shirtNumber; const char *shirtName; bool isKeeper; ITexture *pDetailTexture; CProceduralRegenerator **pProcReg; if (dynamic_cast<C_SDKPlayer *>(pEnt)) { C_SDKPlayer *pPl = dynamic_cast<C_SDKPlayer *>(pEnt); 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(); }