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.

175 lines
6.0 KiB

  1. //===== Copyright (c) Valve Corporation, All rights reserved. ======//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //==================================================================//
  7. #ifndef VTF_DECLARATIONS_H
  8. #define VTF_DECLARATIONS_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. //-----------------------------------------------------------------------------
  13. // Forward declarations
  14. //-----------------------------------------------------------------------------
  15. class CUtlBuffer;
  16. class Vector;
  17. struct Rect_t;
  18. class IFileSystem;
  19. //-----------------------------------------------------------------------------
  20. // Texture flags
  21. //-----------------------------------------------------------------------------
  22. enum CompiledVtfFlags
  23. {
  24. // Flags from the *.txt config file
  25. TEXTUREFLAGS_POINTSAMPLE = 0x00000001,
  26. TEXTUREFLAGS_TRILINEAR = 0x00000002,
  27. TEXTUREFLAGS_CLAMPS = 0x00000004,
  28. TEXTUREFLAGS_CLAMPT = 0x00000008,
  29. TEXTUREFLAGS_ANISOTROPIC = 0x00000010,
  30. TEXTUREFLAGS_HINT_DXT5 = 0x00000020,
  31. TEXTUREFLAGS_PWL_CORRECTED = 0x00000040,
  32. TEXTUREFLAGS_NORMAL = 0x00000080,
  33. TEXTUREFLAGS_NOMIP = 0x00000100,
  34. TEXTUREFLAGS_NOLOD = 0x00000200,
  35. TEXTUREFLAGS_ALL_MIPS = 0x00000400,
  36. TEXTUREFLAGS_PROCEDURAL = 0x00000800,
  37. // These are automatically generated by vtex from the texture data.
  38. TEXTUREFLAGS_ONEBITALPHA = 0x00001000,
  39. TEXTUREFLAGS_EIGHTBITALPHA = 0x00002000,
  40. // Newer flags from the *.txt config file
  41. TEXTUREFLAGS_ENVMAP = 0x00004000,
  42. TEXTUREFLAGS_RENDERTARGET = 0x00008000,
  43. TEXTUREFLAGS_DEPTHRENDERTARGET = 0x00010000,
  44. TEXTUREFLAGS_NODEBUGOVERRIDE = 0x00020000,
  45. TEXTUREFLAGS_SINGLECOPY = 0x00040000,
  46. TEXTUREFLAGS_SRGB = 0x00080000, //SRGB correction has already been applied to this texture.
  47. TEXTUREFLAGS_DEFAULT_POOL = 0x00100000, // Nvidia Stereo Change: Water (Force a texture to the default pool)
  48. TEXTUREFLAGS_COMBINED = 0x00200000,
  49. TEXTUREFLAGS_ASYNC_DOWNLOAD = 0x00400000,
  50. TEXTUREFLAGS_NODEPTHBUFFER = 0x00800000,
  51. TEXTUREFLAGS_SKIP_INITIAL_DOWNLOAD = 0x01000000, // Skip initial download when creating a procedural texture
  52. TEXTUREFLAGS_CLAMPU = 0x02000000,
  53. TEXTUREFLAGS_VERTEXTEXTURE = 0x04000000, // Usable as a vertex texture
  54. TEXTUREFLAGS_SSBUMP = 0x08000000,
  55. TEXTUREFLAGS_MOST_MIPS = 0x10000000, // Don't load the bottom few mips at runtime
  56. TEXTUREFLAGS_BORDER = 0x20000000, // Clamp to border color on all texture coordinates
  57. #if defined( _PS3 ) || defined SPU
  58. // PS3 extensions
  59. TEXTUREFLAGS_QUINCUNX = 0x40000000,
  60. TEXTUREFLAGS_QUINCUNX_ALT = 0x80000000,
  61. #elif defined( _X360 )
  62. TEXTUREFLAGS_ALIAS_COLOR_AND_DEPTH_SURFACES = 0x40000000,
  63. TEXTUREFLAGS_UNUSED_80000000 = 0x80000000,
  64. #else
  65. TEXTUREFLAGS_UNUSED_40000000 = 0x40000000,
  66. TEXTUREFLAGS_UNUSED_80000000 = 0x80000000,
  67. #endif
  68. };
  69. enum VersionedVtfFlags
  70. {
  71. VERSIONED_VTF_FLAGS_MASK_7_3 = ~0xD1780400, // For a ver 7.3 or earlier only these flags are valid
  72. };
  73. struct VtfProcessingOptions
  74. {
  75. uint32 cbSize; // Set to sizeof( VtfProcessingOptions )
  76. //
  77. // Flags0
  78. //
  79. enum Flags0
  80. {
  81. // Have a channel decaying to a given decay goal for the given last number of mips
  82. OPT_DECAY_R = 0x00000001, // Red decays
  83. OPT_DECAY_G = 0x00000002, // Green decays
  84. OPT_DECAY_B = 0x00000004, // Blue decays
  85. OPT_DECAY_A = 0x00000008, // Alpha decays
  86. OPT_DECAY_EXP_R = 0x00000010, // Channel R decays exponentially (otherwise linearly)
  87. OPT_DECAY_EXP_G = 0x00000020, // Channel G decays exponentially (otherwise linearly)
  88. OPT_DECAY_EXP_B = 0x00000040, // Channel B decays exponentially (otherwise linearly)
  89. OPT_DECAY_EXP_A = 0x00000080, // Channel A decays exponentially (otherwise linearly)
  90. OPT_NOCOMPRESS = 0x00000100, // Use uncompressed image format
  91. OPT_NORMAL_DUDV = 0x00000200, // dU dV normal map
  92. OPT_FILTER_NICE = 0x00000400, // Use nice filtering
  93. OPT_SRGB_PC_TO_360 = 0x00000800, // Perform srgb correction for colormaps
  94. OPT_SET_ALPHA_ONEOVERMIP = 0x00001000, // Alpha = 1/miplevel
  95. OPT_PREMULT_COLOR_ONEOVERMIP = 0x00002000, // Color *= 1/miplevel
  96. OPT_MIP_ALPHATEST = 0x00004000, // Alpha-tested mip generation
  97. OPT_NORMAL_GA = 0x00008000, // Use Green-Alpha normal compression
  98. OPT_PREMULT_ALPHA_MIPFRACTION = 0x00010000, // Alpha *= miplevel/mipcount
  99. OPT_COMPUTE_GRADIENT = 0x00020000 // Compute normalized du du gradients of green channel and store in r and b
  100. };
  101. uint32 flags0; // A combination of "Flags0"
  102. //
  103. // Decay settings
  104. //
  105. uint8 clrDecayGoal[4]; // Goal colors for R G B A
  106. uint8 numNotDecayMips[4]; // Number of first mips unaffected by decay (0 means all below mip0)
  107. float fDecayExponentBase[4]; // For exponential decay the base number (e.g. 0.75)
  108. //
  109. // Alpha fading with mip levels
  110. //
  111. uint8 fullAlphaAtMipLevel;
  112. uint8 minAlpha;
  113. };
  114. //-----------------------------------------------------------------------------
  115. // Cubemap face indices
  116. //-----------------------------------------------------------------------------
  117. enum CubeMapFaceIndex_t
  118. {
  119. CUBEMAP_FACE_RIGHT = 0,
  120. CUBEMAP_FACE_LEFT,
  121. CUBEMAP_FACE_BACK, // NOTE: This face is in the +y direction?!?!?
  122. CUBEMAP_FACE_FRONT, // NOTE: This face is in the -y direction!?!?
  123. CUBEMAP_FACE_UP,
  124. CUBEMAP_FACE_DOWN,
  125. CUBEMAP_FACE_COUNT,
  126. // This is the fallback for low-end (obsolete, here for backward compat!)
  127. CUBEMAP_FACE_SPHEREMAP = CUBEMAP_FACE_COUNT,
  128. };
  129. //-----------------------------------------------------------------------------
  130. // Enumeration used for spheremap generation
  131. //-----------------------------------------------------------------------------
  132. enum LookDir_t
  133. {
  134. LOOK_DOWN_X = 0,
  135. LOOK_DOWN_NEGX,
  136. LOOK_DOWN_Y,
  137. LOOK_DOWN_NEGY,
  138. LOOK_DOWN_Z,
  139. LOOK_DOWN_NEGZ,
  140. };
  141. #endif // VTF_H