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.

160 lines
5.3 KiB

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