/* Texture Shader */ #include "BaseVSShader.h" #include "convar.h" #include // Note: you have to run buildshaders.bat to generate these files from the FXC code. #include "textureshader_ps20.inc" #include "textureshader_vs20.inc" BEGIN_VS_SHADER( TextureShader, "Help for Texture shader" ) BEGIN_SHADER_PARAMS END_SHADER_PARAMS // Set up anything that is necessary to make decisions in SHADER_FALLBACK. SHADER_INIT_PARAMS() { } SHADER_FALLBACK { return 0; } SHADER_INIT { /* Load texture */ LoadTexture( BASETEXTURE ); } SHADER_DRAW { SHADOW_STATE { /* Enable the texture */ pShaderShadow->EnableTexture( SHADER_TEXTURE_STAGE0, true ); int fmt = VERTEX_POSITION; pShaderShadow->VertexShaderVertexFormat( fmt, 2, 0, 0, 0 ); textureshader_vs20_Static_Index vshIndex; pShaderShadow->SetVertexShader( "textureshader_vs20", vshIndex.GetIndex() ); textureshader_ps20_Static_Index pshIndex; pShaderShadow->SetPixelShader( "textureshader_ps20", pshIndex.GetIndex() ); DefaultFog(); } DYNAMIC_STATE { BindTexture( SHADER_TEXTURE_STAGE0, BASETEXTURE, FRAME ); float sin_time; sin_time = sin((timeGetTime()/1000.0f)); pShaderAPI->SetVertexShaderConstant( VERTEX_SHADER_SHADER_SPECIFIC_CONST_0, &sin_time ); } Draw(); } END_SHADER