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.

62 lines
2.4 KiB

  1. //========= Copyright 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. class IMaterial;
  11. class ITexture;
  12. enum
  13. {
  14. INVALID_TEXTURE_ID = -1
  15. };
  16. //-----------------------------------------------------------------------------
  17. // A class that manages textures used by the material system surface
  18. //-----------------------------------------------------------------------------
  19. class ITextureDictionary
  20. {
  21. public:
  22. // Create, destroy textures
  23. virtual int CreateTexture( bool procedural = false ) = 0;
  24. virtual int CreateTextureByTexture( ITexture *pTexture, bool procedural = true ) = 0;
  25. virtual void DestroyTexture( int id ) = 0;
  26. virtual void DestroyAllTextures() = 0;
  27. // Is this a valid id?
  28. virtual bool IsValidId( int id ) const = 0;
  29. // Binds a material to a texture
  30. virtual void BindTextureToFile( int id, const char *pFileName ) = 0;
  31. // Binds a material to a texture
  32. virtual void BindTextureToMaterial( int id, IMaterial *pMaterial ) = 0;
  33. // Binds a material to a texture
  34. virtual void BindTextureToMaterialReference( int id, int referenceId, IMaterial *pMaterial ) = 0;
  35. // Texture info
  36. virtual IMaterial *GetTextureMaterial( int id ) = 0;
  37. virtual void GetTextureSize(int id, int& iWide, int& iTall ) = 0;
  38. virtual void GetTextureTexCoords( int id, float &s0, float &t0, float &s1, float &t1 ) = 0;
  39. virtual void SetTextureRGBA( int id, const char* rgba, int wide, int tall ) = 0;
  40. virtual int FindTextureIdForTextureFile( char const *pFileName ) = 0;
  41. virtual void SetSubTextureRGBA( int id, int drawX, int drawY, unsigned const char *rgba, int subTextureWide, int subTextureTall ) = 0;
  42. virtual void SetSubTextureRGBAEx( int id, int drawX, int drawY, unsigned const char *rgba, int subTextureWide, int subTextureTall, ImageFormat format ) = 0;
  43. virtual void SetTextureRGBAEx( int id, const char* rgba, int wide, int tall, ImageFormat format, bool bFixupTextCoordsForDimensions ) = 0;
  44. virtual void UpdateSubTextureRGBA( int id, int drawX, int drawY, unsigned const char *rgba, int subTextureWide, int subTextureTall, ImageFormat imageFormat ) = 0;
  45. };
  46. ITextureDictionary *TextureDictionary();
  47. #endif // TEXTUREDICTIONARY_H