本文整理汇总了C++中ITexture::GetFlags方法的典型用法代码示例。如果您正苦于以下问题:C++ ITexture::GetFlags方法的具体用法?C++ ITexture::GetFlags怎么用?C++ ITexture::GetFlags使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ITexture
的用法示例。
在下文中一共展示了ITexture::GetFlags方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetupRenderTargets
void CDAViewRender::SetupRenderTargets()
{
ITexture *depthOld = materials->FindTexture("_rt_ResolvedFullFrameDepth", TEXTURE_GROUP_RENDER_TARGET);
static int flags = TEXTUREFLAGS_NOMIP | TEXTUREFLAGS_NOLOD | TEXTUREFLAGS_RENDERTARGET;
if ( depthOld )
flags = depthOld->GetFlags();
int iW, iH;
materials->GetBackBufferDimensions( iW, iH );
materials->BeginRenderTargetAllocation();
materials->CreateNamedRenderTargetTextureEx(
"_rt_ResolvedFullFrameDepth_DA",
iW, iH, RT_SIZE_NO_CHANGE,
IMAGE_FORMAT_RGBA16161616F,
MATERIAL_RT_DEPTH_NONE,
flags,
0);
materials->CreateNamedRenderTargetTextureEx(
"_rt_ssao_0",
iW, iH, RT_SIZE_NO_CHANGE,
IMAGE_FORMAT_RGBA16161616F,
MATERIAL_RT_DEPTH_NONE,
flags,
0);
materials->CreateNamedRenderTargetTextureEx(
"_rt_ssao_1",
iW, iH, RT_SIZE_NO_CHANGE,
IMAGE_FORMAT_RGBA16161616F,
MATERIAL_RT_DEPTH_NONE,
flags,
0);
materials->EndRenderTargetAllocation();
}
示例2: Init
//-----------------------------------------------------------------------------
// Purpose: Initializes all view systems
//-----------------------------------------------------------------------------
void CViewRender::Init( void )
{
memset( &m_PitchDrift, 0, sizeof( m_PitchDrift ) );
m_bDrawOverlay = false;
m_pDrawEntities = cvar->FindVar( "r_drawentities" );
m_pDrawBrushModels = cvar->FindVar( "r_drawbrushmodels" );
beams->InitBeams();
tempents->Init();
m_TranslucentSingleColor.Init( "debug/debugtranslucentsinglecolor", TEXTURE_GROUP_OTHER );
m_ModulateSingleColor.Init( "engine/modulatesinglecolor", TEXTURE_GROUP_OTHER );
extern CMaterialReference g_material_WriteZ;
g_material_WriteZ.Init( "engine/writez", TEXTURE_GROUP_OTHER );
// FIXME:
QAngle angles;
engine->GetViewAngles( angles );
AngleVectors( angles, &m_vecLastFacing );
#if defined( REPLAY_ENABLED )
m_pReplayScreenshotTaker = NULL;
#endif
#if defined( CSTRIKE_DLL )
m_flLastFOV = default_fov.GetFloat();
#endif
ITexture *depthOld = materials->FindTexture("_rt_FullFrameDepth", TEXTURE_GROUP_RENDER_TARGET);
static int flags = TEXTUREFLAGS_NOMIP | TEXTUREFLAGS_NOLOD | TEXTUREFLAGS_DEPTHRENDERTARGET;
if (depthOld)
flags = depthOld->GetFlags();
int iW, iH;
materials->GetBackBufferDimensions(iW, iH);
materials->BeginRenderTargetAllocation();
materials->CreateNamedRenderTargetTextureEx(
"_rt_FullFrameDepth_Alt",
iW, iH, RT_SIZE_NO_CHANGE,
IMAGE_FORMAT_A8,
MATERIAL_RT_DEPTH_NONE,
flags,
0);
materials->EndRenderTargetAllocation();
}
示例3: DrawLightmappedGeneric_DX9_Internal
//.........这里部分代码省略.........
{
pShaderShadow->EnableTexture( SHADER_SAMPLER7, true );
pShaderShadow->EnableSRGBRead( SHADER_SAMPLER7, true );
}
// if( hasLightmap )
pShaderShadow->EnableTexture( SHADER_SAMPLER1, true );
if( g_pHardwareConfig->GetHDRType() == HDR_TYPE_NONE )
{
pShaderShadow->EnableSRGBRead( SHADER_SAMPLER1, true );
}
else
{
pShaderShadow->EnableSRGBRead( SHADER_SAMPLER1, false );
}
if( hasEnvmap || ( IsX360() && hasFlashlight ) )
{
if( hasEnvmap )
{
pShaderShadow->EnableTexture( SHADER_SAMPLER2, true );
if( g_pHardwareConfig->GetHDRType() == HDR_TYPE_NONE )
{
pShaderShadow->EnableSRGBRead( SHADER_SAMPLER2, true );
}
}
flags |= VERTEX_TANGENT_S | VERTEX_TANGENT_T | VERTEX_NORMAL;
}
int nDetailBlendMode = 0;
if ( hasDetailTexture )
{
nDetailBlendMode = GetIntParam( info.m_nDetailTextureCombineMode, params );
ITexture *pDetailTexture = params[info.m_nDetail]->GetTextureValue();
if ( pDetailTexture->GetFlags() & TEXTUREFLAGS_SSBUMP )
{
if ( hasBump )
nDetailBlendMode = 10; // ssbump
else
nDetailBlendMode = 11; // ssbump_nobump
}
}
if( hasDetailTexture )
{
pShaderShadow->EnableTexture( SHADER_SAMPLER12, true );
bool bSRGBState = ( nDetailBlendMode == 1 );
pShaderShadow->EnableSRGBRead( SHADER_SAMPLER12, bSRGBState );
}
if( hasBump || hasNormalMapAlphaEnvmapMask )
{
pShaderShadow->EnableTexture( SHADER_SAMPLER4, true );
if ( nNormalDecodeMode == NORMAL_DECODE_ATI2N_ALPHA )
{
pShaderShadow->EnableTexture( SHADER_SAMPLER9, true ); // Normal map alpha, in the compressed normal case
}
}
if( hasBump2 )
{
pShaderShadow->EnableTexture( SHADER_SAMPLER5, true );
if ( nNormalDecodeMode == NORMAL_DECODE_ATI2N_ALPHA )
{
pShaderShadow->EnableTexture( SHADER_SAMPLER10, true ); // Secondary normal alpha, in the compressed normal case
}
}
if( hasBumpMask )
示例4: DrawPhong_DX9
void DrawPhong_DX9( CBaseVSShader *pShader, IMaterialVar** params, IShaderDynamicAPI *pShaderAPI, IShaderShadow* pShaderShadow,
VertexLitGeneric_DX9_Vars_t &info, VertexCompressionType_t vertexCompression, CBasePerMaterialContextData **pContextDataPtr, bool bDeferredActive )
{
CPhong_DX9_Context *pContextData = reinterpret_cast< CPhong_DX9_Context *> ( *pContextDataPtr );
bool bHasFlashlight = !bDeferredActive && pShader->UsingFlashlight( params );
bool bHasFlashlightOnly = bHasFlashlight && !IsX360();
#ifndef _X360
bool bIsDecal = IS_FLAG_SET( MATERIAL_VAR_DECAL );
#endif
bool bIsAlphaTested = IS_FLAG_SET( MATERIAL_VAR_ALPHATEST ) != 0;
BlendType_t nBlendType = pShader->EvaluateBlendRequirements( info.m_nBaseTexture, true );
bool bFullyOpaque = (nBlendType != BT_BLENDADD) && (nBlendType != BT_BLEND) && !bIsAlphaTested && !bHasFlashlightOnly; //dest alpha is free for special use
bool bHasDisplacement = (info.m_nDisplacementMap != -1) && params[info.m_nDisplacementMap]->IsTexture();
#if !defined( PLATFORM_X360 )
bool bHasDisplacementWrinkles = (info.m_nDisplacementWrinkleMap != -1) && params[info.m_nDisplacementWrinkleMap]->GetIntValue();
#endif
bool bHasTeamColorTexture = ( info.m_nTeamColorTexture != -1 ) && params[info.m_nTeamColorTexture]->IsTexture();
bool bHasFoW = ( ( info.m_nFoW != -1 ) && ( params[ info.m_nFoW ]->IsTexture() != 0 ) );
bool bFOWValidTexture = true;
if ( bHasFoW == true )
{
ITexture *pTexture = params[ info.m_nFoW ]->GetTextureValue();
if ( ( pTexture->GetFlags() & TEXTUREFLAGS_RENDERTARGET ) == 0 )
{
bHasFoW = true;
bFOWValidTexture = false;
}
}
else
{
bHasFoW = true;
bFOWValidTexture = false;
}
if( pShader->IsSnapshotting() )
{
PhongShaderInfo_t phongInfo;
ComputePhongShaderInfo( pShader, params, info, bHasFlashlightOnly, &phongInfo );
bool bShaderSrgbRead = ( IsX360() && IS_PARAM_DEFINED( info.m_nShaderSrgbRead360 ) && params[info.m_nShaderSrgbRead360]->GetIntValue() );
int nDetailBlendMode = ( info.m_nDetailTextureCombineMode == -1 ) ? 0 : params[info.m_nDetailTextureCombineMode]->GetIntValue();
bool bHasVertexColor = IS_FLAG_SET( MATERIAL_VAR_VERTEXCOLOR );
bool bHasVertexAlpha = IS_FLAG_SET( MATERIAL_VAR_VERTEXALPHA );
// look at color and alphamod stuff.
// Unlit generic never uses the flashlight
bool bHasEnvmap = !bHasFlashlightOnly && params[info.m_nEnvmap]->IsTexture();
// Alpha test: FIXME: shouldn't this be handled in CBaseVSShader::SetInitialShadowState
pShaderShadow->EnableAlphaTest( bIsAlphaTested );
if( info.m_nAlphaTestReference != -1 && params[info.m_nAlphaTestReference]->GetFloatValue() > 0.0f )
{
pShaderShadow->AlphaFunc( SHADER_ALPHAFUNC_GEQUAL, params[info.m_nAlphaTestReference]->GetFloatValue() );
}
// Based upon vendor and device dependent formats
int nShadowFilterMode = bHasFlashlight ? g_pHardwareConfig->GetShadowFilterMode() : 0;
if( bHasFlashlightOnly )
{
if (params[info.m_nBaseTexture]->IsTexture())
{
pShader->SetAdditiveBlendingShadowState( info.m_nBaseTexture, true );
}
if( bIsAlphaTested )
{
// disable alpha test and use the zfunc zequals since alpha isn't guaranteed to
// be the same on both the regular pass and the flashlight pass.
pShaderShadow->EnableAlphaTest( false );
pShaderShadow->DepthFunc( SHADER_DEPTHFUNC_EQUAL );
}
pShaderShadow->EnableBlending( true );
pShaderShadow->EnableDepthWrites( false );
// Be sure not to write to dest alpha
pShaderShadow->EnableAlphaWrites( false );
}
if ( !bHasFlashlightOnly ) // not flashlight pass
{
if (params[info.m_nBaseTexture]->IsTexture())
{
pShader->SetDefaultBlendingShadowState( info.m_nBaseTexture, true );
}
if ( bHasEnvmap )
{
pShaderShadow->EnableTexture( SHADER_SAMPLER8, true ); // Cubic environment map
if( g_pHardwareConfig->GetHDRType() == HDR_TYPE_NONE )
{
pShaderShadow->EnableSRGBRead( SHADER_SAMPLER8, true );
}
}
}
unsigned int flags = VERTEX_POSITION | VERTEX_NORMAL;
//.........这里部分代码省略.........
示例5: GetIntParam
void CBaseVSShader::DrawFlashlight_dx90( IMaterialVar** params, IShaderDynamicAPI *pShaderAPI,
IShaderShadow* pShaderShadow, DrawFlashlight_dx90_Vars_t &vars )
{
// FLASHLIGHTFIXME: hack . . need to fix the vertex shader so that it can deal with and without bumps for vertexlitgeneric
if( !vars.m_bLightmappedGeneric )
{
vars.m_bBump = false;
}
bool bBump2 = vars.m_bWorldVertexTransition && vars.m_bBump && vars.m_nBumpmap2Var != -1 && params[vars.m_nBumpmap2Var]->IsTexture();
bool bSeamless = vars.m_fSeamlessScale != 0.0;
bool bDetail = vars.m_bLightmappedGeneric && (vars.m_nDetailVar != -1) && params[vars.m_nDetailVar]->IsDefined() && (vars.m_nDetailScale != -1);
int nDetailBlendMode = 0;
if ( bDetail )
{
nDetailBlendMode = GetIntParam( vars.m_nDetailTextureCombineMode, params );
ITexture *pDetailTexture = params[vars.m_nDetailVar]->GetTextureValue();
if ( pDetailTexture->GetFlags() & TEXTUREFLAGS_SSBUMP )
{
if ( vars.m_bBump )
nDetailBlendMode = 10; // ssbump
else
nDetailBlendMode = 11; // ssbump_nobump
}
}
if( pShaderShadow )
{
SetInitialShadowState();
pShaderShadow->EnableDepthWrites( false );
pShaderShadow->EnableAlphaWrites( false );
// Alpha blend
SetAdditiveBlendingShadowState( BASETEXTURE, true );
// Alpha test
pShaderShadow->EnableAlphaTest( IS_FLAG_SET( MATERIAL_VAR_ALPHATEST ) );
if ( vars.m_nAlphaTestReference != -1 && params[vars.m_nAlphaTestReference]->GetFloatValue() > 0.0f )
{
pShaderShadow->AlphaFunc( SHADER_ALPHAFUNC_GEQUAL, params[vars.m_nAlphaTestReference]->GetFloatValue() );
}
// Spot sampler
pShaderShadow->EnableTexture( SHADER_SAMPLER0, true );
// Base sampler
pShaderShadow->EnableTexture( SHADER_SAMPLER1, true );
pShaderShadow->EnableSRGBRead( SHADER_SAMPLER1, true );
// Normalizing cubemap sampler
pShaderShadow->EnableTexture( SHADER_SAMPLER2, true );
// Normalizing cubemap sampler2 or normal map sampler
pShaderShadow->EnableTexture( SHADER_SAMPLER3, true );
// RandomRotation sampler
pShaderShadow->EnableTexture( SHADER_SAMPLER5, true );
// Flashlight depth sampler
pShaderShadow->EnableTexture( SHADER_SAMPLER7, true );
pShaderShadow->SetShadowDepthFiltering( SHADER_SAMPLER7 );
if( vars.m_bWorldVertexTransition )
{
// $basetexture2
pShaderShadow->EnableTexture( SHADER_SAMPLER4, true );
pShaderShadow->EnableSRGBRead( SHADER_SAMPLER4, true );
}
if( bBump2 )
{
// Normalmap2 sampler
pShaderShadow->EnableTexture( SHADER_SAMPLER6, true );
}
if( bDetail )
{
pShaderShadow->EnableTexture( SHADER_SAMPLER8, true ); // detail sampler
if ( nDetailBlendMode == 1 )
pShaderShadow->EnableSRGBRead( SHADER_SAMPLER8, true );
}
pShaderShadow->EnableSRGBWrite( true );
if( vars.m_bLightmappedGeneric )
{
#ifndef _X360
if ( g_pHardwareConfig->HasFastVertexTextures() )
{
DECLARE_STATIC_VERTEX_SHADER( lightmappedgeneric_flashlight_vs30 );
SET_STATIC_VERTEX_SHADER_COMBO( WORLDVERTEXTRANSITION, vars.m_bWorldVertexTransition );
SET_STATIC_VERTEX_SHADER_COMBO( NORMALMAP, vars.m_bBump );
SET_STATIC_VERTEX_SHADER_COMBO( SEAMLESS, bSeamless );
SET_STATIC_VERTEX_SHADER_COMBO( DETAIL, bDetail );
SET_STATIC_VERTEX_SHADER( lightmappedgeneric_flashlight_vs30 );
}
else
#endif
{
DECLARE_STATIC_VERTEX_SHADER( lightmappedgeneric_flashlight_vs20 );
SET_STATIC_VERTEX_SHADER_COMBO( WORLDVERTEXTRANSITION, vars.m_bWorldVertexTransition );
SET_STATIC_VERTEX_SHADER_COMBO( NORMALMAP, vars.m_bBump );
//.........这里部分代码省略.........
示例6: DrawLightmappedGeneric_DX9
//.........这里部分代码省略.........
}
// if( hasLightmap )
pShaderShadow->EnableTexture( SHADER_SAMPLER1, true );
if( g_pHardwareConfig->GetHDRType() == HDR_TYPE_NONE )
{
pShaderShadow->EnableSRGBRead( SHADER_SAMPLER1, true );
}
else
{
pShaderShadow->EnableSRGBRead( SHADER_SAMPLER1, false );
}
if( hasEnvmap || ( IsX360() && hasFlashlight ) )
{
if( hasEnvmap )
{
pShaderShadow->EnableTexture( SHADER_SAMPLER2, true );
if( g_pHardwareConfig->GetHDRType() == HDR_TYPE_NONE )
{
pShaderShadow->EnableSRGBRead( SHADER_SAMPLER2, true );
}
}
flags |= VERTEX_TANGENT_S | VERTEX_TANGENT_T | VERTEX_NORMAL;
}
#define TCOMBINE_NONE 12 // there is no detail texture
int nDetailBlendMode = TCOMBINE_NONE;
if ( hasDetailTexture )
{
nDetailBlendMode = GetIntParam( info.m_nDetailTextureCombineMode, params );
ITexture *pDetailTexture = params[info.m_nDetail]->GetTextureValue();
if ( pDetailTexture->GetFlags() & TEXTUREFLAGS_SSBUMP )
{
if ( hasBump )
nDetailBlendMode = 10; // ssbump
else
nDetailBlendMode = 11; // ssbump_nobump
}
pShaderShadow->EnableTexture( SHADER_SAMPLER12, true );
bool bSRGBState = ( nDetailBlendMode == 1 );
pShaderShadow->EnableSRGBRead( SHADER_SAMPLER12, bSRGBState );
}
// Hijack detail blend mode 9 for paint (this blend mode was previously skipped/unused in lightmappedgeneric)
if ( g_pConfig->m_bPaintInGame && !r_twopasspaint.GetBool() )
{
nDetailBlendMode = 9;
}
if( hasBump || hasNormalMapAlphaEnvmapMask )
{
pShaderShadow->EnableTexture( SHADER_SAMPLER4, true );
}
if( hasBump2 )
{
pShaderShadow->EnableTexture( SHADER_SAMPLER5, true );
}
if( hasBumpMask )
{
pShaderShadow->EnableTexture( SHADER_SAMPLER8, true );
}
if( hasEnvmapMask )
{
pShaderShadow->EnableTexture( SHADER_SAMPLER5, true );
示例7: DrawMultiblend_DX9
void DrawMultiblend_DX9( CBaseVSShader *pShader, IMaterialVar** params, IShaderDynamicAPI *pShaderAPI,
IShaderShadow* pShaderShadow, Multiblend_DX9_Vars_t &info, VertexCompressionType_t vertexCompression,
CBasePerMaterialContextData **pContextDataPtr )
{
CMultiblend_DX9_Context *pContextData = reinterpret_cast< CMultiblend_DX9_Context * > ( *pContextDataPtr );//TODO: DISABLE?
bool bIsModel = IS_FLAG_SET( MATERIAL_VAR_MODEL );
bool bHasFoW = ( ( info.m_nFoW != -1 ) && ( params[ info.m_nFoW ]->IsTexture() != 0 ) );
if ( bHasFoW == true )
{
ITexture *pTexture = params[ info.m_nFoW ]->GetTextureValue();
if ( ( pTexture->GetFlags() & TEXTUREFLAGS_RENDERTARGET ) == 0 )
{
bHasFoW = false;
}
}
int nLightingPreviewMode = IS_FLAG2_SET( MATERIAL_VAR2_USE_GBUFFER0 ) + 2 * IS_FLAG2_SET( MATERIAL_VAR2_USE_GBUFFER1 );
bool bHasSpec1 = ( info.m_nSpecTexture != -1 && params[ info.m_nSpecTexture ]->IsDefined() );
bool bHasSpec2 = ( info.m_nSpecTexture2 != -1 && params[ info.m_nSpecTexture2 ]->IsDefined() );
bool bHasSpec3 = ( info.m_nSpecTexture3 != -1 && params[ info.m_nSpecTexture3 ]->IsDefined() );
bool bHasSpec4 = ( info.m_nSpecTexture4 != -1 && params[ info.m_nSpecTexture4 ]->IsDefined() );
bool bUsingEditor = pShader->CanUseEditorMaterials(); // pShader->UsingEditor( params );
bool bSinglePassFlashlight = true; //TODO: DISABLE?
bool bHasFlashlight = pShader->UsingFlashlight( params );
//TODO: DISABLE?
#if 1
if ( pShader->IsSnapshotting() || ( !pContextData ) || ( pContextData->m_bMaterialVarsChanged ) )
{
if ( !pContextData ) // make sure allocated
{
pContextData = new CMultiblend_DX9_Context;
*pContextDataPtr = pContextData;
}
// need to regenerate the semistatic cmds
pContextData->m_SemiStaticCmdsOut.Reset();
if ( bHasFlashlight )
{
pContextData->m_SemiStaticCmdsOut.SetVertexShaderFlashlightState( VERTEX_SHADER_SHADER_SPECIFIC_CONST_6 );
CBCmdSetPixelShaderFlashlightState_t state;
state.m_LightSampler = SHADER_SAMPLER13;
state.m_DepthSampler = SHADER_SAMPLER14;
state.m_ShadowNoiseSampler = SHADER_SAMPLER15;
state.m_nColorConstant = 28;
state.m_nAttenConstant = 13;
state.m_nOriginConstant = 14;
state.m_nDepthTweakConstant = 19;
state.m_nScreenScaleConstant = 31;
state.m_nWorldToTextureConstant = -1;
state.m_bFlashlightNoLambert = false;
state.m_bSinglePassFlashlight = bSinglePassFlashlight;
pContextData->m_SemiStaticCmdsOut.SetPixelShaderFlashlightState( state );
}
pContextData->m_SemiStaticCmdsOut.End();
}
#endif
SHADOW_STATE
{
pShader->SetInitialShadowState( );
pShaderShadow->EnableTexture( SHADER_SAMPLER1, true );
pShaderShadow->EnableTexture( SHADER_SAMPLER2, true );
pShaderShadow->EnableTexture( SHADER_SAMPLER3, true );
pShaderShadow->EnableTexture( SHADER_SAMPLER4, true );
pShaderShadow->EnableTexture( SHADER_SAMPLER5, true );
pShaderShadow->EnableTexture( SHADER_SAMPLER6, true );
pShaderShadow->EnableTexture( SHADER_SAMPLER7, true );
pShaderShadow->EnableTexture( SHADER_SAMPLER8, true );
pShaderShadow->EnableTexture( SHADER_SAMPLER9, true );
pShaderShadow->EnableSRGBRead( SHADER_SAMPLER1, true ); // Always SRGB read on base map 1
pShaderShadow->EnableSRGBRead( SHADER_SAMPLER2, true ); // Always SRGB read on base map 2
pShaderShadow->EnableSRGBRead( SHADER_SAMPLER3, true ); // Always SRGB read on base map 3
pShaderShadow->EnableSRGBRead( SHADER_SAMPLER4, true ); // Always SRGB read on base map 4
pShaderShadow->EnableSRGBRead( SHADER_SAMPLER6, true ); // Always SRGB read on spec map 1
pShaderShadow->EnableSRGBRead( SHADER_SAMPLER7, true ); // Always SRGB read on spec map 1
pShaderShadow->EnableSRGBRead( SHADER_SAMPLER8, true ); // Always SRGB read on spec map 1
pShaderShadow->EnableSRGBRead( SHADER_SAMPLER9, true ); // Always SRGB read on spec map 1
if( g_pHardwareConfig->GetHDRType() == HDR_TYPE_NONE )
{
pShaderShadow->EnableSRGBRead( SHADER_SAMPLER5, true );
}
else
{
pShaderShadow->EnableSRGBRead( SHADER_SAMPLER5, false );
}
if ( bHasFoW )
{
pShaderShadow->EnableTexture( SHADER_SAMPLER10, true );
}
if( bHasFlashlight )
{
pShaderShadow->EnableTexture( SHADER_SAMPLER13, true );
pShaderShadow->EnableTexture( SHADER_SAMPLER14, true );
pShaderShadow->SetShadowDepthFiltering( SHADER_SAMPLER14 );
//.........这里部分代码省略.........