render_constants.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. #pragma once
  2. #include <cstdint>
  3. #include <numbers>
  4. namespace Render::GL::MathConstants {
  5. inline constexpr float k_pi = std::numbers::pi_v<float>;
  6. inline constexpr float k_two_pi = std::numbers::pi_v<float> * 2.0F;
  7. } // namespace Render::GL::MathConstants
  8. namespace Render::GL::VertexAttrib {
  9. inline constexpr int Position = 0;
  10. inline constexpr int Normal = 1;
  11. inline constexpr int TexCoord = 2;
  12. inline constexpr int InstancePosition = 3;
  13. inline constexpr int InstanceScale = 4;
  14. inline constexpr int InstanceColor = 5;
  15. inline constexpr int InstanceAlpha = 6;
  16. inline constexpr int InstanceTint = 7;
  17. } // namespace Render::GL::VertexAttrib
  18. namespace Render::GL::ComponentCount {
  19. inline constexpr int Vec2 = 2;
  20. inline constexpr int Vec3 = 3;
  21. inline constexpr int Vec4 = 4;
  22. } // namespace Render::GL::ComponentCount
  23. namespace Render::GL::BufferCapacity {
  24. inline constexpr int DefaultCylinderInstances = 256;
  25. inline constexpr int DefaultFogInstances = 512;
  26. inline constexpr int BuffersInFlight = 3;
  27. inline constexpr int ShaderInfoLogSize = 512;
  28. } // namespace Render::GL::BufferCapacity
  29. namespace Render::GL::Geometry {
  30. inline constexpr int QuadVertexCount = 4;
  31. inline constexpr int QuadIndexCount = 6;
  32. inline constexpr int GrassBladeVertexCount = 6;
  33. inline constexpr int CubeVertexCount = 24;
  34. inline constexpr int CubeIndexCount = 36;
  35. inline constexpr int PlantCrossQuadVertexCount = 16;
  36. inline constexpr int PlantCrossQuadIndexCount = 24;
  37. inline constexpr int PineTreeSegments = 6;
  38. inline constexpr int OliveTreeSegments = 6;
  39. inline constexpr int GroundPlaneSubdivisions = 64;
  40. inline constexpr int DefaultCapsuleSegments = 8;
  41. inline constexpr int DefaultTorsoHeightSegments = 8;
  42. inline constexpr int DefaultChunkSize = 16;
  43. inline constexpr int MinLengthSteps = 8;
  44. inline constexpr int MinLengthSegments = 8;
  45. } // namespace Render::GL::Geometry
  46. namespace Render::GL::Growth {
  47. inline constexpr int CapacityMultiplier = 2;
  48. }
  49. namespace Render::GL::ColorIndex {
  50. inline constexpr int Red = 0;
  51. inline constexpr int Green = 1;
  52. inline constexpr int Blue = 2;
  53. inline constexpr int Alpha = 3;
  54. } // namespace Render::GL::ColorIndex
  55. namespace Render::GL::FrustumPlane {
  56. inline constexpr int MatrixSize = 16;
  57. inline constexpr int Index0 = 0;
  58. inline constexpr int Index1 = 1;
  59. inline constexpr int Index2 = 2;
  60. inline constexpr int Index3 = 3;
  61. inline constexpr int Index4 = 4;
  62. inline constexpr int Index5 = 5;
  63. inline constexpr int Index6 = 6;
  64. inline constexpr int Index7 = 7;
  65. inline constexpr int Index8 = 8;
  66. inline constexpr int Index9 = 9;
  67. inline constexpr int Index10 = 10;
  68. inline constexpr int Index11 = 11;
  69. } // namespace Render::GL::FrustumPlane
  70. namespace Render::GL::RGBA {
  71. inline constexpr unsigned char MaxValue = 255;
  72. inline constexpr unsigned char MinValue = 0;
  73. } // namespace Render::GL::RGBA
  74. namespace Render::GL::BitShift {
  75. inline constexpr int Shift8 = 8;
  76. inline constexpr int Shift16 = 16;
  77. inline constexpr int Shift32 = 32;
  78. inline constexpr unsigned int Mask24Bit = 0xFFFFFF;
  79. inline constexpr float Mask24BitFloat = 16777215.0F;
  80. inline constexpr unsigned int k_mask_24bit_hex = 0x01000000U;
  81. } // namespace Render::GL::BitShift
  82. namespace Render::GL::HashXorShift {
  83. inline constexpr int k_xor_shift_amount_5 = 5;
  84. inline constexpr int k_xor_shift_amount_13 = 13;
  85. inline constexpr int k_xor_shift_amount_17 = 17;
  86. inline constexpr uint32_t k_golden_ratio = 0x9E3779B9U;
  87. } // namespace Render::GL::HashXorShift