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.

104 lines
3.3 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $Header: $
  6. // $NoKeywords: $
  7. // An interface that should not ever be accessed directly from shaders
  8. // but instead is visible only to shaderlib.
  9. //===========================================================================//
  10. #ifndef ISHADERSYSTEM_H
  11. #define ISHADERSYSTEM_H
  12. #ifdef _WIN32
  13. #pragma once
  14. #endif
  15. #include "interface.h"
  16. #include <materialsystem/IShader.h>
  17. //-----------------------------------------------------------------------------
  18. // Forward declarations
  19. //-----------------------------------------------------------------------------
  20. enum Sampler_t;
  21. class ITexture;
  22. class IShader;
  23. //-----------------------------------------------------------------------------
  24. // The Shader system interface version
  25. //-----------------------------------------------------------------------------
  26. #define SHADERSYSTEM_INTERFACE_VERSION "ShaderSystem002"
  27. //-----------------------------------------------------------------------------
  28. // Modulation flags
  29. //-----------------------------------------------------------------------------
  30. enum
  31. {
  32. SHADER_USING_COLOR_MODULATION = 0x1,
  33. SHADER_USING_ALPHA_MODULATION = 0x2,
  34. SHADER_USING_FLASHLIGHT = 0x4,
  35. SHADER_USING_FIXED_FUNCTION_BAKED_LIGHTING = 0x8,
  36. SHADER_USING_EDITOR = 0x10,
  37. };
  38. //-----------------------------------------------------------------------------
  39. // The shader system (a singleton)
  40. //-----------------------------------------------------------------------------
  41. abstract_class IShaderSystem
  42. {
  43. public:
  44. virtual ShaderAPITextureHandle_t GetShaderAPITextureBindHandle( ITexture *pTexture, int nFrameVar, int nTextureChannel = 0 ) =0;
  45. // Binds a texture
  46. virtual void BindTexture( Sampler_t sampler1, ITexture *pTexture, int nFrameVar = 0 ) = 0;
  47. virtual void BindTexture( Sampler_t sampler1, Sampler_t sampler2, ITexture *pTexture, int nFrameVar = 0 ) = 0;
  48. // Takes a snapshot
  49. virtual void TakeSnapshot( ) = 0;
  50. // Draws a snapshot
  51. virtual void DrawSnapshot( bool bMakeActualDrawCall = true ) = 0;
  52. // Are we using graphics?
  53. virtual bool IsUsingGraphics() const = 0;
  54. // Are we using graphics?
  55. virtual bool CanUseEditorMaterials() const = 0;
  56. };
  57. //-----------------------------------------------------------------------------
  58. // The Shader plug-in DLL interface version
  59. //-----------------------------------------------------------------------------
  60. #define SHADER_DLL_INTERFACE_VERSION "ShaderDLL004"
  61. //-----------------------------------------------------------------------------
  62. // The Shader interface versions
  63. //-----------------------------------------------------------------------------
  64. abstract_class IShaderDLLInternal
  65. {
  66. public:
  67. // Here's where the app systems get to learn about each other
  68. virtual bool Connect( CreateInterfaceFn factory, bool bIsMaterialSystem ) = 0;
  69. virtual void Disconnect( bool bIsMaterialSystem ) = 0;
  70. // Returns the number of shaders defined in this DLL
  71. virtual int ShaderCount() const = 0;
  72. // Returns information about each shader defined in this DLL
  73. virtual IShader *GetShader( int nShader ) = 0;
  74. };
  75. //-----------------------------------------------------------------------------
  76. // Singleton interface
  77. //-----------------------------------------------------------------------------
  78. IShaderDLLInternal *GetShaderDLLInternal();
  79. #endif // ISHADERSYSTEM_H