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.

142 lines
3.4 KiB

  1. //====== Copyright � 1996-2005, Valve Corporation, All rights reserved. =======
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================
  6. #ifndef PROCEDURALPRESETS_H
  7. #define PROCEDURALPRESETS_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. // IMPORTANT - only add preset enums to the END, and NEVER remove or replace any!!!
  12. // (alternatively, fix up every dmx file with presets)
  13. // The proper solution is to change CDmePreset::m_nProceduralType to be a bool m_bIsProceduralType
  14. // and have a non-attribute int as a cached value inferred from the preset's name
  15. enum
  16. {
  17. PROCEDURAL_PRESET_NOT = 0,
  18. PROCEDURAL_PRESET_DEFAULT_CROSSFADE,
  19. PROCEDURAL_PRESET_ZERO_CROSSFADE,
  20. PROCEDURAL_PRESET_HALF_CROSSFADE,
  21. PROCEDRUAL_PRESET_ONE_CROSSFADE,
  22. PROCEDURAL_PRESET_HEAD_CROSSFADE,
  23. PROCEDURAL_PRESET_IN_CROSSFADE,
  24. PROCEDURAL_PRESET_OUT_CROSSFADE,
  25. PROCEDURAL_PRESET_INOUT,
  26. PROCEDURAL_PRESET_REVEAL,
  27. PROCEDURAL_PRESET_PASTE,
  28. PROCEDURAL_PRESET_DROP_LAYER, // Provides a blend value for finishing the current modification layer
  29. PROCEDURAL_PRESET_JITTER,
  30. PROCEDURAL_PRESET_SMOOTH,
  31. PROCEDURAL_PRESET_SHARPEN,
  32. PROCEDURAL_PRESET_SOFTEN,
  33. PROCEDURAL_PRESET_STAGGER,
  34. PROCEDURAL_PRESET_HOLD, // Pushes time samples in falloff toward the green selected region
  35. PROCEDURAL_PRESET_RELEASE, // Pushes time samples in falloff toward the edges of the falloff
  36. PROCEDURAL_PRESET_STEADY, // Smooths the "velocity" of samples in the time selection
  37. PROCEDURAL_PRESET_SPLINE,
  38. // Must be last
  39. NUM_PROCEDURAL_PRESET_TYPES,
  40. };
  41. static const char *g_ProceduralPresetNames[ NUM_PROCEDURAL_PRESET_TYPES ] =
  42. {
  43. "NotProcedural!!!",
  44. "Default",
  45. "Zero",
  46. "Half",
  47. "One",
  48. "Head",
  49. "In",
  50. "Out",
  51. "Ramp",
  52. "Reveal",
  53. "Paste",
  54. "Drop",
  55. "Jitter",
  56. "Smooth",
  57. "Sharpen",
  58. "Soften",
  59. "Stagger",
  60. "Hold",
  61. "Release",
  62. "Steady",
  63. "Spline",
  64. };
  65. #define PROCEDURAL_PRESET_GROUP_NAME "Procedural"
  66. inline char const *GetProceduralPresetName( int nPresetType )
  67. {
  68. if ( nPresetType < PROCEDURAL_PRESET_NOT || nPresetType >= NUM_PROCEDURAL_PRESET_TYPES )
  69. return "???";
  70. return g_ProceduralPresetNames[ nPresetType ];
  71. }
  72. inline int ProceduralTypeForPresetName( const char *pPresetName )
  73. {
  74. for ( int i = PROCEDURAL_PRESET_NOT; i < NUM_PROCEDURAL_PRESET_TYPES; ++i )
  75. {
  76. if ( !V_stricmp( pPresetName, g_ProceduralPresetNames[ i ] ) )
  77. return i;
  78. }
  79. return -1;
  80. }
  81. // Does preset blending only affect timing of samples?
  82. inline bool IsPresetTimeOperation( int nPresetType )
  83. {
  84. switch ( nPresetType )
  85. {
  86. default:
  87. break;
  88. case PROCEDURAL_PRESET_STAGGER:
  89. case PROCEDURAL_PRESET_STEADY:
  90. case PROCEDURAL_PRESET_HOLD:
  91. case PROCEDURAL_PRESET_RELEASE:
  92. return true;
  93. }
  94. return false;
  95. }
  96. // Does the preset blend towards a single value
  97. inline bool IsPresetStaticValue( int nPresetType )
  98. {
  99. switch ( nPresetType )
  100. {
  101. case PROCEDURAL_PRESET_NOT:
  102. case PROCEDURAL_PRESET_DEFAULT_CROSSFADE:
  103. case PROCEDURAL_PRESET_ZERO_CROSSFADE:
  104. case PROCEDURAL_PRESET_HALF_CROSSFADE:
  105. case PROCEDRUAL_PRESET_ONE_CROSSFADE:
  106. return true;
  107. default:
  108. return false;
  109. }
  110. return false;
  111. }
  112. // Should area under time selection be "resampled" into a smooth curve worth of samples before
  113. // the preset operations?
  114. inline bool ShouldPresetPreserveSamples( int nPresetType )
  115. {
  116. switch ( nPresetType )
  117. {
  118. default:
  119. break;
  120. case PROCEDURAL_PRESET_STAGGER:
  121. case PROCEDURAL_PRESET_STEADY:
  122. return true;
  123. }
  124. return false;
  125. }
  126. #endif // PROCEDURALPRESETS_H