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.

126 lines
3.9 KiB

  1. //====== Copyright � 1996-2004, Valve Corporation, All rights reserved. =======
  2. //
  3. // A class representing a procedural texture
  4. //
  5. //=============================================================================
  6. #ifndef DMEPRECOMPILEDTEXTURE_H
  7. #define DMEPRECOMPILEDTEXTURE_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "datamodel/dmelement.h"
  12. #include "materialobjects/dmetexture.h"
  13. //-----------------------------------------------------------------------------
  14. // Forward declarations
  15. //-----------------------------------------------------------------------------
  16. class CDmeTexture;
  17. //-----------------------------------------------------------------------------
  18. // A Dme element that describes a texture processing operation
  19. //-----------------------------------------------------------------------------
  20. class CDmeTextureProcessor : public CDmElement
  21. {
  22. DEFINE_ELEMENT( CDmeTextureProcessor, CDmElement );
  23. public:
  24. virtual void ProcessTexture( CDmeTexture *pSrcTexture, CDmeTexture *pDstTexture ) = 0;
  25. };
  26. //-----------------------------------------------------------------------------
  27. // A precompiled texture
  28. //-----------------------------------------------------------------------------
  29. class CDmePrecompiledTexture : public CDmElement
  30. {
  31. DEFINE_ELEMENT( CDmePrecompiledTexture, CDmElement );
  32. public:
  33. bool ValidateValues();
  34. template< class T > T *AddProcessor( const char *pName );
  35. template< class T > T *FindProcessor( const char *pName );
  36. public:
  37. CDmaElementArray< CDmeTextureProcessor > m_Processors;
  38. CDmaElement< CDmeTexture > m_pSourceTexture;
  39. CDmaString m_ImageFileName;
  40. CDmaVar< int > m_nStartFrame;
  41. CDmaVar< int > m_nEndFrame;
  42. CDmaVar< int > m_nTextureArraySize;
  43. CDmaVar< int > m_nVolumeTextureDepth;
  44. CDmaVar< int > m_nTextureType; // 0 = normal, 1 = cubemap
  45. CDmaVar< float > m_flBumpScale;
  46. CDmaVar< float > m_flPFMScale;
  47. CDmaVar< int > m_nFilterType; // See DmeTextureFilter_t
  48. CDmaVar< bool > m_bClampS;
  49. CDmaVar< bool > m_bClampT;
  50. CDmaVar< bool > m_bClampU;
  51. CDmaVar< bool > m_bLoadMipLevels;
  52. CDmaVar< bool > m_bBorder;
  53. CDmaVar< bool > m_bNormalMap; // FIXME: Should normal/normalga be combined?
  54. CDmaVar< bool > m_bSSBump;
  55. CDmaVar< bool > m_bNoMip; // FIXME: Should nomip/allmips be combined?
  56. CDmaVar< bool > m_bAllMips;
  57. CDmaVar< bool > m_bNoLod;
  58. CDmaVar< bool > m_bNoDebugOverride;
  59. CDmaVar< bool > m_bNoCompression;
  60. CDmaVar< bool > m_bHintDxt5Compression;
  61. };
  62. template< class T > inline T *CDmePrecompiledTexture::AddProcessor( const char *pName )
  63. {
  64. T* pProcessor = CreateElement< T >( pName, GetFileId() );
  65. m_Processors.AddToTail( pProcessor );
  66. return pProcessor;
  67. }
  68. template< class T > inline T *CDmePrecompiledTexture::FindProcessor( const char *pName )
  69. {
  70. for ( int i = 0; i < m_Processors.Count(); ++i )
  71. {
  72. if ( !Q_stricmp( pName, m_Processors[i]->GetName() ) )
  73. return CastElement< T >( m_Processors[i] );
  74. }
  75. return NULL;
  76. }
  77. //-----------------------------------------------------------------------------
  78. // Texture processors
  79. //-----------------------------------------------------------------------------
  80. class CDmeTP_ComputeMipmaps : public CDmeTextureProcessor
  81. {
  82. DEFINE_ELEMENT( CDmeTP_ComputeMipmaps, CDmeTextureProcessor );
  83. public:
  84. virtual void ProcessTexture( CDmeTexture *pSrcTexture, CDmeTexture *pDstTexture );
  85. CDmaVar< bool > m_bNoNiceFiltering;
  86. CDmaVar< bool > m_bAlphaTestDownsampling;
  87. CDmaVar< float > m_flAlphaTestDownsampleThreshhold;
  88. CDmaVar< float > m_flAlphaTestDownsampleHiFreqThreshhold;
  89. };
  90. //-----------------------------------------------------------------------------
  91. // Changes color channels
  92. //-----------------------------------------------------------------------------
  93. class CDmeTP_ChangeColorChannels : public CDmeTextureProcessor
  94. {
  95. DEFINE_ELEMENT( CDmeTP_ChangeColorChannels, CDmeTextureProcessor );
  96. public:
  97. virtual void ProcessTexture( CDmeTexture *pSrcTexture, CDmeTexture *pDstTexture );
  98. void ProcessImage( CDmeImage *pDstImage, CDmeImage *pSrcImage );
  99. CDmaVar< int > m_nMaxChannels;
  100. };
  101. #endif // DMEPRECOMPILEDTEXTURE_H