Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

56 lines
1.7 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #include "shaderlib/cshader.h"
  8. // memdbgon must be the last include file in a .cpp file!!!
  9. #include "tier0/memdbgon.h"
  10. SOFTWARE_VERTEX_SHADER( myHappyLittleSoftwareVertexShader )
  11. {
  12. float t = pShaderAPI->CurrentTime();
  13. for( int i = 0; i < meshBuilder.NumVertices(); i++ )
  14. {
  15. const float *pPos = meshBuilder.Position();
  16. meshBuilder.Position3f( pPos[0], pPos[1], pPos[2] + 10.0f * sin( t + pPos[0] ) );
  17. meshBuilder.AdvanceVertex();
  18. }
  19. }
  20. FORWARD_DECLARE_SOFTWARE_VERTEX_SHADER( myHappyLittleSoftwareVertexShader );
  21. BEGIN_SHADER_FLAGS( DebugSoftwareVertexShader, "blah", SHADER_NOT_EDITABLE )
  22. BEGIN_SHADER_PARAMS
  23. SHADER_PARAM_OVERRIDE( BASETEXTURE, SHADER_PARAM_TYPE_TEXTURE, "shadertest/basetexture", "unused", SHADER_PARAM_NOT_EDITABLE )
  24. SHADER_PARAM_OVERRIDE( FRAME, SHADER_PARAM_TYPE_INTEGER, "0", "unused", SHADER_PARAM_NOT_EDITABLE )
  25. SHADER_PARAM_OVERRIDE( BASETEXTURETRANSFORM, SHADER_PARAM_TYPE_MATRIX, "center .5 .5 scale 1 1 rotate 0 translate 0 0", "unused", SHADER_PARAM_NOT_EDITABLE )
  26. SHADER_PARAM_OVERRIDE( COLOR, SHADER_PARAM_TYPE_COLOR, "{255 255 255}", "unused", SHADER_PARAM_NOT_EDITABLE )
  27. SHADER_PARAM_OVERRIDE( ALPHA, SHADER_PARAM_TYPE_FLOAT, "1.0", "unused", SHADER_PARAM_NOT_EDITABLE )
  28. END_SHADER_PARAMS
  29. SHADER_INIT
  30. {
  31. if( g_pHardwareConfig->SupportsVertexAndPixelShaders() )
  32. {
  33. USE_SOFTWARE_VERTEX_SHADER( myHappyLittleSoftwareVertexShader );
  34. }
  35. else
  36. {
  37. USE_SOFTWARE_VERTEX_SHADER( myHappyLittleSoftwareVertexShader );
  38. }
  39. }
  40. SHADER_DRAW
  41. {
  42. SHADOW_STATE
  43. {
  44. }
  45. DYNAMIC_STATE
  46. {
  47. }
  48. Draw();
  49. }
  50. END_SHADER