本文整理汇总了C++中IsSnapshotting函数的典型用法代码示例。如果您正苦于以下问题:C++ IsSnapshotting函数的具体用法?C++ IsSnapshotting怎么用?C++ IsSnapshotting使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IsSnapshotting函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Assert
void CBaseShader::SetFixedFunctionTextureScale( MaterialMatrixMode_t textureTransform, int scaleVar )
{
Assert( !IsSnapshotting() );
// handle scrolling of base texture
Vector2D vScale;
s_ppParams[scaleVar]->GetVecValue( vScale.Base(), 2 );
if( vScale[0] != 0.0f || vScale[1] != 0.0f )
{
s_pShaderAPI->MatrixMode( textureTransform );
// only do the upper 3x3 since this is a 2D matrix
float mat[16];
mat[0] = vScale[0]; mat[1] = 0.0f; mat[2] = 0.0f;
mat[4] = 0.0f; mat[5] = vScale[1]; mat[6] = 0.0f;
mat[8] = 0.0f; mat[9] = 0.0f; mat[10] = 1.0f;
// Better set the stuff we don't set with some sort of value!
mat[3] = mat[7] = mat[11] = 0;
mat[12] = mat[13] = mat[14] = 0;
mat[15] = 1;
s_pShaderAPI->LoadMatrix( mat );
}
else
{
LoadIdentity( textureTransform );
}
}
示例2: FixedFunctionMaskedEnvmapPass
//-----------------------------------------------------------------------------
// Masked environment map
//-----------------------------------------------------------------------------
void CBaseShader::FixedFunctionMaskedEnvmapPass( int envMapVar, int envMapMaskVar,
int baseTextureVar, int envMapFrameVar, int envMapMaskFrameVar,
int frameVar, int maskOffsetVar, int maskScaleVar, int envMapTintVar )
{
// IMaterialVar** params = ShaderState().m_ppParams;
if (IsSnapshotting())
{
// Alpha blending
SetDefaultBlendingShadowState( envMapMaskVar, false );
// Disable overbright
s_pShaderShadow->OverbrightValue( SHADER_TEXTURE_STAGE0, 1.0f );
s_pShaderShadow->OverbrightValue( SHADER_TEXTURE_STAGE1, 1.0f );
int flags = SetShadowEnvMappingState( envMapMaskVar, envMapTintVar );
s_pShaderShadow->DrawFlags( flags );
Draw();
s_pShaderShadow->EnableCustomPixelPipe( false );
s_pShaderShadow->EnableAlphaPipe( false );
}
else
{
SetDynamicEnvMappingState( envMapVar, envMapMaskVar, baseTextureVar,
envMapFrameVar, envMapMaskFrameVar, frameVar,
maskOffsetVar, maskScaleVar, envMapTintVar );
DefaultFog();
Draw();
}
}
示例3: Assert
void CBaseVSShader::SetPixelShaderConstantGammaToLinear( int pixelReg, int constantVar, int constantVar2 )
{
Assert( !IsSnapshotting() );
if ((!s_ppParams) || (constantVar == -1) || (constantVar2 == -1))
return;
IMaterialVar* pPixelVar = s_ppParams[constantVar];
Assert( pPixelVar );
IMaterialVar* pPixelVar2 = s_ppParams[constantVar2];
Assert( pPixelVar2 );
float val[4];
if (pPixelVar->GetType() == MATERIAL_VAR_TYPE_VECTOR)
{
pPixelVar->GetVecValue( val, 3 );
}
else
{
val[0] = val[1] = val[2] = pPixelVar->GetFloatValue();
}
val[3] = pPixelVar2->GetFloatValue();
val[0] = val[0] > 1.0f ? val[0] : GammaToLinear( val[0] );
val[1] = val[1] > 1.0f ? val[1] : GammaToLinear( val[1] );
val[2] = val[2] > 1.0f ? val[2] : GammaToLinear( val[2] );
s_pShaderAPI->SetPixelShaderConstant( pixelReg, val );
}
示例4: VPROF
void CBaseShader::DrawElements( IMaterialVar **ppParams, int nModulationFlags,
IShaderShadow* pShaderShadow, IShaderDynamicAPI* pShaderAPI, VertexCompressionType_t vertexCompression, CBasePerMaterialContextData **pContextDataPtr, CBasePerInstanceContextData** pInstanceDataPtr )
{
VPROF("CBaseShader::DrawElements");
// Re-entrancy check
Assert( !s_ppParams );
s_ppParams = ppParams;
s_pShaderAPI = pShaderAPI;
s_pShaderShadow = pShaderShadow;
s_nModulationFlags = nModulationFlags;
s_pInstanceDataPtr = (CPerInstanceContextData**)( pInstanceDataPtr );
s_nPassCount = 0;
if ( IsSnapshotting() )
{
// Set up the shadow state
SetInitialShadowState( );
}
OnDrawElements( ppParams, pShaderShadow, pShaderAPI, vertexCompression, pContextDataPtr );
s_pInstanceDataPtr = NULL;
s_nPassCount = 0;
s_nModulationFlags = 0;
s_ppParams = NULL;
s_pShaderAPI = NULL;
s_pShaderShadow = NULL;
}
示例5: Assert
//-----------------------------------------------------------------------------
//
// Helper methods for alpha blending....
//
//-----------------------------------------------------------------------------
void CBaseShader::EnableAlphaBlending( ShaderBlendFactor_t src, ShaderBlendFactor_t dst )
{
Assert( IsSnapshotting() );
s_pShaderShadow->EnableBlending( true );
s_pShaderShadow->BlendFunc( src, dst );
s_pShaderShadow->EnableDepthWrites(false);
}
示例6: UsingEditor
bool CBaseShader::UsingEditor( IMaterialVar **params ) const
{
if( IsSnapshotting() )
{
return CShader_IsFlag2Set( params, MATERIAL_VAR2_USE_EDITOR );
}
else
{
return s_pShaderAPI->InEditorMode();
}
}
示例7: UsingFlashlight
bool CBaseShader::UsingFlashlight( IMaterialVar **params ) const
{
if( IsSnapshotting() )
{
return CShader_IsFlag2Set( params, MATERIAL_VAR2_USE_FLASHLIGHT );
}
else
{
return s_pShaderAPI->InFlashlightMode();
}
}
示例8: Assert
void CBaseShader::FogToFogColor( void )
{
Assert( IsSnapshotting() );
if (( CurrentMaterialVarFlags() & MATERIAL_VAR_NOFOG ) == 0)
{
s_pShaderShadow->FogMode( SHADER_FOGMODE_FOGCOLOR );
}
else
{
s_pShaderShadow->FogMode( SHADER_FOGMODE_DISABLED );
}
}
示例9: FixedFunctionSelfIlluminationPass
//-----------------------------------------------------------------------------
// Fixed function Self illumination pass
//-----------------------------------------------------------------------------
void CBaseShader::FixedFunctionSelfIlluminationPass( TextureStage_t stage,
int baseTextureVar, int frameVar, int baseTextureTransformVar, int selfIllumTintVar )
{
// IMaterialVar** params = s_ppParams;
if (IsSnapshotting())
{
// A little setup for self illum here...
SetModulationShadowState( selfIllumTintVar );
s_pShaderShadow->EnableTexGen( SHADER_TEXTURE_STAGE0, false );
s_pShaderShadow->EnableTexGen( SHADER_TEXTURE_STAGE1, false );
s_pShaderShadow->EnableAlphaTest( false );
s_pShaderShadow->EnableTexture( SHADER_TEXTURE_STAGE0, false );
s_pShaderShadow->EnableTexture( SHADER_TEXTURE_STAGE1, false );
s_pShaderShadow->EnableTexture( stage, true );
// No overbrighting
s_pShaderShadow->OverbrightValue( SHADER_TEXTURE_STAGE0, 1.0f );
s_pShaderShadow->OverbrightValue( SHADER_TEXTURE_STAGE1, 1.0f );
// Don't bother with z writes here...
s_pShaderShadow->EnableDepthWrites( false );
// We're always blending
EnableAlphaBlending( SHADER_BLEND_SRC_ALPHA, SHADER_BLEND_ONE_MINUS_SRC_ALPHA );
int flags = SHADER_DRAW_POSITION;
if (stage == SHADER_TEXTURE_STAGE0)
flags |= SHADER_DRAW_TEXCOORD0;
else
flags |= SHADER_DRAW_TEXCOORD1;
s_pShaderShadow->DrawFlags( flags );
}
else
{
SetFixedFunctionTextureTransform(
(stage == SHADER_TEXTURE_STAGE0) ? MATERIAL_TEXTURE0 : MATERIAL_TEXTURE1,
baseTextureTransformVar );
BindTexture( stage, baseTextureVar, frameVar );
// NOTE: Texture + texture offset are set from BaseTimesLightmap
SetModulationDynamicState( selfIllumTintVar );
FogToFogColor();
}
Draw();
}
示例10: DrawDecal
void DrawDecal( IMaterialVar **params, IShaderDynamicAPI *pShaderAPI, IShaderShadow *pShaderShadow )
{
if( IsSnapshotting() )
{
// Be sure not to write to dest alpha
pShaderShadow->EnableAlphaWrites( false );
pShaderShadow->EnableTexture( SHADER_SAMPLER0, true );
pShaderShadow->EnableTexture( SHADER_SAMPLER1, true );
pShaderShadow->EnableTexture( SHADER_SAMPLER2, true );
pShaderShadow->EnableTexture( SHADER_SAMPLER3, true );
SetNormalBlendingShadowState( BASETEXTURE, true );
int pTexCoords[3] = { 2, 2, 1 };
pShaderShadow->VertexShaderVertexFormat( VERTEX_POSITION | VERTEX_COLOR, 3, pTexCoords, 0 );
sdk_lightmappedgeneric_decal_Static_Index vshIndex;
pShaderShadow->SetVertexShader( "SDK_LightmappedGeneric_Decal", vshIndex.GetIndex() );
pShaderShadow->SetPixelShader( "SDK_LightmappedGeneric_Decal" );
FogToFogColor();
}
else
{
BindTexture( SHADER_SAMPLER0, BASETEXTURE, FRAME );
// Load the z^2 components of the lightmap coordinate axes only
// This is (N dot basis)^2
Vector vecZValues( g_localBumpBasis[0].z, g_localBumpBasis[1].z, g_localBumpBasis[2].z );
vecZValues *= vecZValues;
Vector4D basis[3];
basis[0].Init( vecZValues.x, vecZValues.x, vecZValues.x, 0.0f );
basis[1].Init( vecZValues.y, vecZValues.y, vecZValues.y, 0.0f );
basis[2].Init( vecZValues.z, vecZValues.z, vecZValues.z, 0.0f );
pShaderAPI->SetPixelShaderConstant( 0, (float*)basis, 3 );
pShaderAPI->BindStandardTexture( SHADER_SAMPLER1, TEXTURE_LIGHTMAP_BUMPED );
SetVertexShaderTextureTransform( VERTEX_SHADER_SHADER_SPECIFIC_CONST_0, BASETEXTURETRANSFORM );
SetModulationPixelShaderDynamicState( 3 );
sdk_lightmappedgeneric_decal_Dynamic_Index vshIndex;
vshIndex.SetDOWATERFOG( pShaderAPI->GetSceneFogMode() == MATERIAL_FOG_LINEAR_BELOW_FOG_Z );
pShaderAPI->SetVertexShaderIndex( vshIndex.GetIndex() );
}
Draw();
}
示例11: Draw
//-----------------------------------------------------------------------------
// Draws a snapshot
//-----------------------------------------------------------------------------
void CBaseShader::Draw( )
{
if ( IsSnapshotting() )
{
// Turn off transparency if we're asked to....
if (g_pConfig->bNoTransparency &&
((s_ppParams[FLAGS]->GetIntValue() & MATERIAL_VAR_NO_DEBUG_OVERRIDE) == 0))
{
s_pShaderShadow->EnableDepthWrites( true );
s_pShaderShadow->EnableBlending( false );
}
GetShaderSystem()->TakeSnapshot();
}
else
{
GetShaderSystem()->DrawSnapshot();
}
}
示例12: AssertOnce
// FIXME: Figure out a better way to do this?
//-----------------------------------------------------------------------------
int CBaseShader::ComputeModulationFlags( IMaterialVar** params, IShaderDynamicAPI* pShaderAPI )
{
s_pShaderAPI = pShaderAPI;
int mod = 0;
if( UsingFlashlight(params) )
{
mod |= SHADER_USING_FLASHLIGHT;
}
if ( UsingEditor(params) )
{
mod |= SHADER_USING_EDITOR;
}
if( IS_FLAG2_SET( MATERIAL_VAR2_USE_FIXED_FUNCTION_BAKED_LIGHTING ) )
{
AssertOnce( IS_FLAG2_SET( MATERIAL_VAR2_NEEDS_BAKED_LIGHTING_SNAPSHOTS ) );
if( IS_FLAG2_SET( MATERIAL_VAR2_NEEDS_BAKED_LIGHTING_SNAPSHOTS ) )
{
mod |= SHADER_USING_FIXED_FUNCTION_BAKED_LIGHTING;
}
}
if ( IsSnapshotting() )
{
if ( IS_FLAG2_SET( MATERIAL_VAR2_USE_GBUFFER0 ) )
mod |= SHADER_USING_GBUFFER0;
if ( IS_FLAG2_SET( MATERIAL_VAR2_USE_GBUFFER1 ) )
mod |= SHADER_USING_GBUFFER1;
}
else
{
int nFixedLightingMode = pShaderAPI->GetIntRenderingParameter( INT_RENDERPARM_ENABLE_FIXED_LIGHTING );
if ( nFixedLightingMode & 1 )
mod |= SHADER_USING_GBUFFER0;
if ( nFixedLightingMode & 2 )
mod |= SHADER_USING_GBUFFER1;
}
s_pShaderAPI = NULL;
return mod;
}