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.

165 lines
5.2 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: Defines the interface a given texture for the 3D renderer. Current
  4. // implementations are for world textures (WADTexture.cpp) and sprite
  5. // textures (Texture.cpp).
  6. //
  7. //=============================================================================
  8. #ifndef IEDITORTEXTURE_H
  9. #define IEDITORTEXTURE_H
  10. #ifdef _WIN32
  11. #pragma once
  12. #endif
  13. #include <utlvector.h>
  14. class CDC;
  15. class CPalette;
  16. class IMaterial;
  17. // FGDLIB:
  18. #define DEFAULT_TEXTURE_SCALE 0.25
  19. #define DEFAULT_LIGHTMAP_SCALE 16
  20. //
  21. // Set your texture ID to this in your implementation's constructor.
  22. //
  23. #define TEXTURE_ID_NONE -1
  24. //
  25. // Texture formats. hack: MUST correlate with radio buttons in IDD_OPTIONS_CONFIGS.
  26. //
  27. enum TEXTUREFORMAT
  28. {
  29. tfNone = -1,
  30. tfWAD = 0,
  31. tfWAL = 1,
  32. tfWAD3 = 2,
  33. tfWAD4 = 3,
  34. tfWAD5 = 4,
  35. tfVMT = 5,
  36. tfSprite = 6 // dvs: not sure if I want to do it this way
  37. };
  38. //
  39. // Flags for DrawTexData_t.
  40. //
  41. #define drawCaption 0x01
  42. #define drawResizeAlways 0x02
  43. #define drawIcons 0x04
  44. #define drawErrors 0x08
  45. #define drawUsageCount 0x10
  46. struct DrawTexData_t
  47. {
  48. int nFlags;
  49. int nUsageCount;
  50. };
  51. class IEditorTexture
  52. {
  53. public:
  54. virtual ~IEditorTexture(void)
  55. {
  56. }
  57. //
  58. // dvs: remove one of these
  59. //
  60. virtual int GetImageWidth( void ) const = 0;
  61. virtual int GetImageHeight( void ) const = 0;
  62. virtual int GetWidth( void ) const = 0;
  63. virtual int GetHeight( void ) const = 0;
  64. virtual float GetDecalScale( void ) const = 0;
  65. //
  66. // dvs: Try to remove as many of these as possible:
  67. //
  68. virtual const char *GetName( void ) const = 0;
  69. virtual int GetShortName( char *szShortName ) const = 0;
  70. virtual int GetKeywords( char *szKeywords ) const = 0;
  71. // FGDLIB:
  72. //virtual void Draw(CDC *pDC, RECT &rect, int iFontHeight, int iIconHeight, DrawTexData_t &DrawTexData) = 0;
  73. virtual TEXTUREFORMAT GetTextureFormat( void ) const = 0;
  74. virtual int GetSurfaceAttributes( void ) const = 0;
  75. virtual int GetSurfaceContents(void ) const = 0;
  76. virtual int GetSurfaceValue( void ) const = 0;
  77. virtual CPalette *GetPalette( void ) const = 0;
  78. virtual bool HasData( void ) const = 0;
  79. virtual bool HasPalette( void ) const = 0;
  80. virtual bool Load( void ) = 0; // ensure that texture is loaded. could this be done internally?
  81. virtual void Reload( void ) = 0; // The texture changed
  82. virtual bool IsLoaded( void ) const = 0;
  83. virtual const char *GetFileName( void ) const = 0;
  84. virtual bool IsWater( void ) const = 0;
  85. //-----------------------------------------------------------------------------
  86. // Purpose:
  87. // Input : pData -
  88. // Output :
  89. //-----------------------------------------------------------------------------
  90. virtual int GetImageDataRGB( void *pData = NULL ) = 0;
  91. //-----------------------------------------------------------------------------
  92. // Purpose:
  93. // Input : pData -
  94. // Output :
  95. //-----------------------------------------------------------------------------
  96. virtual int GetImageDataRGBA( void *pData = NULL ) = 0;
  97. //-----------------------------------------------------------------------------
  98. // Purpose: Returns true if this texture has an alpha component, false if not.
  99. //-----------------------------------------------------------------------------
  100. virtual bool HasAlpha( void ) const = 0;
  101. //-----------------------------------------------------------------------------
  102. // Purpose: Returns whether this texture is a dummy texture or not. Dummy textures
  103. // serve as placeholders for textures that were found in the map, but
  104. // not in the WAD (or the materials tree). The dummy texture enables us
  105. // to bind the texture, find it by name, etc.
  106. //-----------------------------------------------------------------------------
  107. virtual bool IsDummy( void ) const = 0; // dvs: perhaps not the best name?
  108. //-----------------------------------------------------------------------------
  109. // Purpose: Returns the unique texture ID for this texture object. The texture ID
  110. // identifies the texture object across all renderers, and is assigned
  111. // by the first renderer that actually binds the texture thru BindTexture.
  112. //
  113. // Only the renderer ever needs to call SetTextureID.
  114. //-----------------------------------------------------------------------------
  115. virtual int GetTextureID( void ) const = 0;
  116. //-----------------------------------------------------------------------------
  117. // Purpose: Sets the unique texture ID for this texture object. The texture ID
  118. // identifies the texture object across all renderers, and is assigned
  119. // by the first renderer that actually binds the texture thru BindTexture.
  120. //
  121. // Only the renderer should ever call SetTextureID!
  122. //-----------------------------------------------------------------------------
  123. virtual void SetTextureID( int nTextureID ) = 0;
  124. //-----------------------------------------------------------------------------
  125. // Returns the material system material associated with a texture
  126. //-----------------------------------------------------------------------------
  127. virtual IMaterial* GetMaterial() { return 0; }
  128. };
  129. typedef CUtlVector<IEditorTexture *> EditorTextureList_t;
  130. #endif // IEDITORTEXTURE_H