Counter Strike : Global Offensive Source Code
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.

101 lines
3.5 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: Contains all texture state for the material system surface to use
  4. //
  5. // $Revision: $
  6. // $NoKeywords: $
  7. //=============================================================================//
  8. #ifndef TEXTUREDICTIONARY_H
  9. #define TEXTUREDICTIONARY_H
  10. #ifdef _WIN32
  11. #pragma once
  12. #endif
  13. #include "rendersystem/irenderdevice.h"
  14. class IMaterial;
  15. class IMaterial2;
  16. enum
  17. {
  18. INVALID_TEXTURE_ID = -1
  19. };
  20. enum ETextureScaling
  21. {
  22. k_ETextureScalingLinear = 1,
  23. k_ETextureScalingPointSample = 2,
  24. };
  25. //-----------------------------------------------------------------------------
  26. // A class that manages textures used by the material system surface
  27. //-----------------------------------------------------------------------------
  28. class ITextureDictionary
  29. {
  30. public:
  31. // Create, destroy textures
  32. virtual int CreateTexture( bool procedural = false ) = 0;
  33. virtual void DestroyTexture( int id ) = 0;
  34. virtual void DestroyAllTextures() = 0;
  35. // Is this a valid id?
  36. virtual bool IsValidId( int id ) const = 0;
  37. // Binds a material to a texture
  38. virtual void BindTextureToFile( int id, const char *pFileName ) = 0;
  39. // Binds a material to a texture
  40. virtual void BindTextureToMaterial( int id, IMaterial *pMaterial ) = 0;
  41. // Binds a material to a texture
  42. virtual void BindTextureToMaterialReference( int id, int referenceId, IMaterial *pMaterial ) = 0;
  43. // Texture info
  44. virtual IMaterial *GetTextureMaterial( int id ) = 0; // Source1 version
  45. virtual HRenderTexture GetTextureHandle( int textureId ) = 0; // Source2 version
  46. virtual void GetTextureSize(int id, int& iWide, int& iTall ) = 0;
  47. virtual void GetTextureTexCoords( int id, float &s0, float &t0, float &s1, float &t1 ) = 0;
  48. virtual void SetTextureRGBA( int id, const char* rgba, int wide, int tall ) = 0;
  49. virtual void SetTextureRGBAEx( int id, const char* rgba, int wide, int tall, ImageFormat format, ETextureScaling eScaling ) = 0;
  50. virtual int FindTextureIdForTextureFile( char const *pFileName ) = 0;
  51. virtual void SetSubTextureRGBA( int id, int drawX, int drawY, unsigned const char *rgba, int subTextureWide, int subTextureTall ) = 0;
  52. virtual void SetSubTextureRGBAEx( int id, int drawX, int drawY, unsigned const char *rgba, int subTextureWide, int subTextureTall, ImageFormat format ) = 0;
  53. virtual void UpdateSubTextureRGBA( int id, int drawX, int drawY, unsigned const char *rgba, int subTextureWide, int subTextureTall, ImageFormat imageFormat ) = 0;
  54. virtual void BindTextureToMaterial2Reference( int id, int referenceId, IMaterial2 *pMaterial ) = 0;
  55. virtual void BindTextureToMaterial2( int id, IMaterial2 *pMaterial ) = 0;
  56. virtual IMaterial2 *GetTextureMaterial2( int id ) = 0; // Source2 version
  57. #if defined( _X360 )
  58. //
  59. // Local gamerpic
  60. //
  61. // Get the texture id for the local gamerpic.
  62. virtual int GetLocalGamerpicTextureID( void ) const = 0;
  63. // Update the local gamerpic texture. Use the given texture if a gamerpic cannot be loaded.
  64. virtual bool SetLocalGamerpicTexture( DWORD userIndex, const char *pDefaultGamerpicFileName ) = 0;
  65. //
  66. // Remote gamerpic
  67. //
  68. // Get the texture id for a remote gamerpic with the given xuid.
  69. virtual int GetRemoteGamerpicTextureID( XUID xuid ) = 0;
  70. // Update the remote gamerpic texture for the given xuid. Use the given texture if a gamerpic cannot be loaded.
  71. virtual bool SetRemoteGamerpicTextureID( XUID xuid, const char *pDefaultGamerpicFileName ) = 0;
  72. #endif // _X360
  73. };
  74. ITextureDictionary *TextureDictionary();
  75. #endif // TEXTUREDICTIONARY_H