GraphicsEvents.h 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. //
  2. // Copyright (c) 2008-2017 the Urho3D project.
  3. //
  4. // Permission is hereby granted, free of charge, to any person obtaining a copy
  5. // of this software and associated documentation files (the "Software"), to deal
  6. // in the Software without restriction, including without limitation the rights
  7. // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8. // copies of the Software, and to permit persons to whom the Software is
  9. // furnished to do so, subject to the following conditions:
  10. //
  11. // The above copyright notice and this permission notice shall be included in
  12. // all copies or substantial portions of the Software.
  13. //
  14. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19. // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  20. // THE SOFTWARE.
  21. //
  22. #pragma once
  23. #include "../Core/Object.h"
  24. namespace Atomic
  25. {
  26. /// New screen mode set.
  27. ATOMIC_EVENT(E_SCREENMODE, ScreenMode)
  28. {
  29. ATOMIC_PARAM(P_WIDTH, Width); // int
  30. ATOMIC_PARAM(P_HEIGHT, Height); // int
  31. ATOMIC_PARAM(P_FULLSCREEN, Fullscreen); // bool
  32. ATOMIC_PARAM(P_BORDERLESS, Borderless); // bool
  33. ATOMIC_PARAM(P_RESIZABLE, Resizable); // bool
  34. ATOMIC_PARAM(P_HIGHDPI, HighDPI); // bool
  35. ATOMIC_PARAM(P_MONITOR, Monitor); // int
  36. ATOMIC_PARAM(P_REFRESHRATE, RefreshRate); // int
  37. }
  38. /// Window position changed.
  39. ATOMIC_EVENT(E_WINDOWPOS, WindowPos)
  40. {
  41. ATOMIC_PARAM(P_X, X); // int
  42. ATOMIC_PARAM(P_Y, Y); // int
  43. }
  44. /// Request for queuing rendersurfaces either in manual or always-update mode.
  45. ATOMIC_EVENT(E_RENDERSURFACEUPDATE, RenderSurfaceUpdate)
  46. {
  47. }
  48. /// Frame rendering started.
  49. ATOMIC_EVENT(E_BEGINRENDERING, BeginRendering)
  50. {
  51. }
  52. /// Frame rendering ended.
  53. ATOMIC_EVENT(E_ENDRENDERING, EndRendering)
  54. {
  55. }
  56. /// Update of a view started.
  57. ATOMIC_EVENT(E_BEGINVIEWUPDATE, BeginViewUpdate)
  58. {
  59. ATOMIC_PARAM(P_VIEW, View); // View pointer
  60. ATOMIC_PARAM(P_TEXTURE, Texture); // Texture pointer
  61. ATOMIC_PARAM(P_SURFACE, Surface); // RenderSurface pointer
  62. ATOMIC_PARAM(P_SCENE, Scene); // Scene pointer
  63. ATOMIC_PARAM(P_CAMERA, Camera); // Camera pointer
  64. }
  65. /// Update of a view ended.
  66. ATOMIC_EVENT(E_ENDVIEWUPDATE, EndViewUpdate)
  67. {
  68. ATOMIC_PARAM(P_VIEW, View); // View pointer
  69. ATOMIC_PARAM(P_TEXTURE, Texture); // Texture pointer
  70. ATOMIC_PARAM(P_SURFACE, Surface); // RenderSurface pointer
  71. ATOMIC_PARAM(P_SCENE, Scene); // Scene pointer
  72. ATOMIC_PARAM(P_CAMERA, Camera); // Camera pointer
  73. }
  74. /// Render of a view started.
  75. ATOMIC_EVENT(E_BEGINVIEWRENDER, BeginViewRender)
  76. {
  77. ATOMIC_PARAM(P_VIEW, View); // View pointer
  78. ATOMIC_PARAM(P_TEXTURE, Texture); // Texture pointer
  79. ATOMIC_PARAM(P_SURFACE, Surface); // RenderSurface pointer
  80. ATOMIC_PARAM(P_SCENE, Scene); // Scene pointer
  81. ATOMIC_PARAM(P_CAMERA, Camera); // Camera pointer
  82. }
  83. /// A view has allocated its screen buffers for rendering. They can be accessed now with View::FindNamedTexture().
  84. ATOMIC_EVENT(E_VIEWBUFFERSREADY, ViewBuffersReady)
  85. {
  86. ATOMIC_PARAM(P_VIEW, View); // View pointer
  87. ATOMIC_PARAM(P_TEXTURE, Texture); // Texture pointer
  88. ATOMIC_PARAM(P_SURFACE, Surface); // RenderSurface pointer
  89. ATOMIC_PARAM(P_SCENE, Scene); // Scene pointer
  90. ATOMIC_PARAM(P_CAMERA, Camera); // Camera pointer
  91. }
  92. /// A view has set global shader parameters for a new combination of vertex/pixel shaders. Custom global parameters can now be set.
  93. ATOMIC_EVENT(E_VIEWGLOBALSHADERPARAMETERS, ViewGlobalShaderParameters)
  94. {
  95. ATOMIC_PARAM(P_VIEW, View); // View pointer
  96. ATOMIC_PARAM(P_TEXTURE, Texture); // Texture pointer
  97. ATOMIC_PARAM(P_SURFACE, Surface); // RenderSurface pointer
  98. ATOMIC_PARAM(P_SCENE, Scene); // Scene pointer
  99. ATOMIC_PARAM(P_CAMERA, Camera); // Camera pointer
  100. }
  101. /// Render of a view ended. Its screen buffers are still accessible if needed.
  102. ATOMIC_EVENT(E_ENDVIEWRENDER, EndViewRender)
  103. {
  104. ATOMIC_PARAM(P_VIEW, View); // View pointer
  105. ATOMIC_PARAM(P_TEXTURE, Texture); // Texture pointer
  106. ATOMIC_PARAM(P_SURFACE, Surface); // RenderSurface pointer
  107. ATOMIC_PARAM(P_SCENE, Scene); // Scene pointer
  108. ATOMIC_PARAM(P_CAMERA, Camera); // Camera pointer
  109. }
  110. /// Render of all views is finished for the frame.
  111. ATOMIC_EVENT(E_ENDALLVIEWSRENDER, EndAllViewsRender)
  112. {
  113. }
  114. /// A render path event has occurred.
  115. ATOMIC_EVENT(E_RENDERPATHEVENT, RenderPathEvent)
  116. {
  117. ATOMIC_PARAM(P_NAME, Name); // String
  118. }
  119. /// Graphics context has been lost. Some or all (depending on the API) GPU objects have lost their contents.
  120. ATOMIC_EVENT(E_DEVICELOST, DeviceLost)
  121. {
  122. }
  123. /// Graphics context has been recreated after being lost. GPU objects in the "data lost" state can be restored now.
  124. ATOMIC_EVENT(E_DEVICERESET, DeviceReset)
  125. {
  126. }
  127. }