IRenderer.h 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #pragma once
  9. #include "VertexFormats.h"
  10. #include <AzCore/Casting/numeric_cast.h>
  11. #include <AzCore/std/containers/intrusive_slist.h>
  12. // Object states
  13. #define OS_ALPHA_BLEND 0x1
  14. #define OS_ADD_BLEND 0x2
  15. #define OS_MULTIPLY_BLEND 0x4
  16. #define OS_TRANSPARENT (OS_ALPHA_BLEND | OS_ADD_BLEND | OS_MULTIPLY_BLEND)
  17. #define OS_NODEPTH_TEST 0x8
  18. #define OS_NODEPTH_WRITE 0x10
  19. #define OS_ANIM_BLEND 0x20
  20. #define OS_ENVIRONMENT_CUBEMAP 0x40
  21. // Render State flags
  22. #define GS_BLSRC_MASK 0xf
  23. #define GS_BLSRC_ZERO 0x1
  24. #define GS_BLSRC_ONE 0x2
  25. #define GS_BLSRC_DSTCOL 0x3
  26. #define GS_BLSRC_ONEMINUSDSTCOL 0x4
  27. #define GS_BLSRC_SRCALPHA 0x5
  28. #define GS_BLSRC_ONEMINUSSRCALPHA 0x6
  29. #define GS_BLSRC_DSTALPHA 0x7
  30. #define GS_BLSRC_ONEMINUSDSTALPHA 0x8
  31. #define GS_BLSRC_ALPHASATURATE 0x9
  32. #define GS_BLSRC_SRCALPHA_A_ZERO 0xa // separate alpha blend state
  33. #define GS_BLSRC_SRC1ALPHA 0xb // dual source blending
  34. #define GS_BLDST_MASK 0xf0
  35. #define GS_BLDST_ZERO 0x10
  36. #define GS_BLDST_ONE 0x20
  37. #define GS_BLDST_SRCCOL 0x30
  38. #define GS_BLDST_ONEMINUSSRCCOL 0x40
  39. #define GS_BLDST_SRCALPHA 0x50
  40. #define GS_BLDST_ONEMINUSSRCALPHA 0x60
  41. #define GS_BLDST_DSTALPHA 0x70
  42. #define GS_BLDST_ONEMINUSDSTALPHA 0x80
  43. #define GS_BLDST_ONE_A_ZERO 0x90 // separate alpha blend state
  44. #define GS_BLDST_ONEMINUSSRC1ALPHA 0xa0 // dual source blending
  45. #define GS_DEPTHWRITE 0x00000100
  46. #define GS_COLMASK_RT1 0x00000200
  47. #define GS_COLMASK_RT2 0x00000400
  48. #define GS_COLMASK_RT3 0x00000800
  49. #define GS_NOCOLMASK_R 0x00001000
  50. #define GS_NOCOLMASK_G 0x00002000
  51. #define GS_NOCOLMASK_B 0x00004000
  52. #define GS_NOCOLMASK_A 0x00008000
  53. #define GS_COLMASK_RGB (GS_NOCOLMASK_A)
  54. #define GS_COLMASK_A (GS_NOCOLMASK_R | GS_NOCOLMASK_G | GS_NOCOLMASK_B)
  55. #define GS_COLMASK_NONE (GS_NOCOLMASK_R | GS_NOCOLMASK_G | GS_NOCOLMASK_B | GS_NOCOLMASK_A)
  56. #define GS_COLMASK_MASK GS_COLMASK_NONE
  57. #define GS_COLMASK_SHIFT 12
  58. #define GS_WIREFRAME 0x00010000
  59. #define GS_NODEPTHTEST 0x00040000
  60. #define GS_BLEND_MASK 0x0f0000ff
  61. #define GS_DEPTHFUNC_LEQUAL 0x00000000
  62. #define GS_DEPTHFUNC_EQUAL 0x00100000
  63. #define GS_DEPTHFUNC_GREAT 0x00200000
  64. #define GS_DEPTHFUNC_LESS 0x00300000
  65. #define GS_DEPTHFUNC_GEQUAL 0x00400000
  66. #define GS_DEPTHFUNC_NOTEQUAL 0x00500000
  67. #define GS_DEPTHFUNC_HIZEQUAL 0x00600000 // keep hi-z test, always pass fine depth. Useful for debug display
  68. #define GS_DEPTHFUNC_ALWAYS 0x00700000
  69. #define GS_DEPTHFUNC_MASK 0x00700000
  70. #define GS_STENCIL 0x00800000
  71. #define GS_BLEND_OP_MASK 0x03000000
  72. #define GS_BLOP_MAX 0x01000000
  73. #define GS_BLOP_MIN 0x02000000
  74. // Separate alpha blend mode
  75. #define GS_BLALPHA_MASK 0x0c000000
  76. #define GS_BLALPHA_MIN 0x04000000
  77. #define GS_BLALPHA_MAX 0x08000000
  78. #define GS_ALPHATEST_MASK 0xf0000000
  79. #define GS_ALPHATEST_GREATER 0x10000000
  80. #define GS_ALPHATEST_LESS 0x20000000
  81. #define GS_ALPHATEST_GEQUAL 0x40000000
  82. #define GS_ALPHATEST_LEQUAL 0x80000000
  83. //////////////////////////////////////////////////////////////////////
  84. #define R_SOLID_MODE 0
  85. #define R_WIREFRAME_MODE 1
  86. #define MAX_NUM_VIEWPORTS 7
  87. constexpr float UIDRAW_TEXTSIZEFACTOR = 12.0f;
  88. constexpr float MIN_RESOLUTION_SCALE = 0.25f;
  89. constexpr float MAX_RESOLUTION_SCALE = 4.0f;
  90. //////////////////////////////////////////////////////////////////////
  91. // All possible primitive types
  92. enum class PublicRenderPrimitiveType
  93. {
  94. prtTriangleList,
  95. prtTriangleStrip,
  96. prtLineList,
  97. prtLineStrip
  98. };
  99. // Summary:
  100. // Flags used in DrawText function.
  101. // See also:
  102. // SDrawTextInfo
  103. // Remarks:
  104. // Text must be fixed pixel size.
  105. enum EDrawTextFlags
  106. {
  107. eDrawText_Left = 0, // default left alignment if neither Center or Right are specified
  108. eDrawText_Center = BIT(0), // centered alignment, otherwise right or left
  109. eDrawText_Right = BIT(1), // right alignment, otherwise center or left
  110. eDrawText_CenterV = BIT(2), // center vertically, otherwise top
  111. eDrawText_Bottom = BIT(3), // bottom alignment
  112. eDrawText_2D = BIT(4), // 3 component vector is used for xy screen position, otherwise it's 3d world space position
  113. eDrawText_FixedSize = BIT(5), // font size is defined in the actual pixel resolution, otherwise it's in the virtual 800x600
  114. eDrawText_800x600 = BIT(6), // position are specified in the virtual 800x600 resolution, otherwise coordinates are in pixels
  115. eDrawText_Monospace = BIT(7), // non proportional font rendering (Font width is same for all characters)
  116. eDrawText_Framed = BIT(8), // draw a transparent, rectangular frame behind the text to ease readability independent from the background
  117. eDrawText_DepthTest = BIT(9), // text should be occluded by world geometry using the depth buffer
  118. eDrawText_IgnoreOverscan = BIT(10), // ignore the overscan borders, text should be drawn at the location specified
  119. eDrawText_UseTransform = BIT(11), // use a transform for the text
  120. };