CmRenderWindowManager.h 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. #pragma once
  2. #include "CmPrerequisites.h"
  3. #include "CmModule.h"
  4. namespace CamelotEngine
  5. {
  6. class CM_EXPORT RenderWindowManager : public Module<RenderWindowManager>
  7. {
  8. public:
  9. /** Creates a new rendering window.
  10. @remarks
  11. This method creates a new rendering window as specified
  12. by the paramteters. The rendering system could be
  13. responible for only a single window (e.g. in the case
  14. of a game), or could be in charge of multiple ones (in the
  15. case of a level editor). The option to create the window
  16. as a child of another is therefore given.
  17. This method will create an appropriate subclass of
  18. RenderWindow depending on the API and platform implementation.
  19. @par
  20. After creation, this window can be retrieved using getRenderTarget().
  21. @param
  22. name The name of the window. Used in other methods
  23. later like setRenderTarget and getRenderTarget.
  24. @param
  25. width The width of the new window.
  26. @param
  27. height The height of the new window.
  28. @param
  29. fullScreen Specify true to make the window full screen
  30. without borders, title bar or menu bar.
  31. @param
  32. miscParams A NameValuePairList describing the other parameters for the new rendering window.
  33. Options are case sensitive. Unrecognised parameters will be ignored silently.
  34. These values might be platform dependent, but these are present for all platforms unless
  35. indicated otherwise:
  36. <table>
  37. <tr>
  38. <td><b>Key</b></td>
  39. <td><b>Type/Values</b></td>
  40. <td><b>Default</b></td>
  41. <td><b>Description</b></td>
  42. <td><b>Notes</b></td>
  43. </tr>
  44. <tr>
  45. <td>title</td>
  46. <td>Any string</td>
  47. <td>RenderTarget name</td>
  48. <td>The title of the window that will appear in the title bar</td>
  49. <td>&nbsp;</td>
  50. </tr>
  51. <tr>
  52. <td>colourDepth</td>
  53. <td>16, 32</td>
  54. <td>Desktop depth</td>
  55. <td>Colour depth of the resulting rendering window; only applies if fullScreen</td>
  56. <td>Win32 Specific</td>
  57. </tr>
  58. <tr>
  59. <td>left</td>
  60. <td>Positive integers</td>
  61. <td>Centred</td>
  62. <td>Screen x coordinate from left</td>
  63. <td>&nbsp;</td>
  64. </tr>
  65. <tr>
  66. <td>top</td>
  67. <td>Positive integers</td>
  68. <td>Centred</td>
  69. <td>Screen y coordinate from left</td>
  70. <td>&nbsp;</td>
  71. </tr>
  72. <tr>
  73. <td>depthBuffer</td>
  74. <td>true, false</td>
  75. <td>true</td>
  76. <td>Use depth buffer</td>
  77. <td>DirectX9 specific</td>
  78. </tr>
  79. <tr>
  80. <td>externalWindowHandle</td>
  81. <td>Win32: HWND as integer<br/>
  82. GLX: poslong:posint:poslong (display*:screen:windowHandle) or poslong:posint:poslong:poslong (display*:screen:windowHandle:XVisualInfo*)</td>
  83. <td>0 (none)</td>
  84. <td>External window handle, for embedding the OGRE render in an existing window</td>
  85. <td>&nbsp;</td>
  86. </tr>
  87. <tr>
  88. <td>externalGLControl</td>
  89. <td>true, false</td>
  90. <td>false</td>
  91. <td>Let the external window control OpenGL i.e. don't select a pixel format for the window,
  92. do not change v-sync and do not swap buffer. When set to true, the calling application
  93. is responsible of OpenGL initialization and buffer swapping. It should also create an
  94. OpenGL context for its own rendering, Ogre will create one for its use. Then the calling
  95. application must also enable Ogre OpenGL context before calling any Ogre function and
  96. restore its OpenGL context after these calls.</td>
  97. <td>OpenGL specific</td>
  98. </tr>
  99. <tr>
  100. <td>externalGLContext</td>
  101. <td>Context as Unsigned Long</td>
  102. <td>0 (create own context)</td>
  103. <td>Use an externally created GL context</td>
  104. <td>OpenGL Specific</td>
  105. </tr>
  106. <tr>
  107. <td>parentWindowHandle</td>
  108. <td>Win32: HWND as integer<br/>
  109. GLX: poslong:posint:poslong (display*:screen:windowHandle) or poslong:posint:poslong:poslong (display*:screen:windowHandle:XVisualInfo*)</td>
  110. <td>0 (none)</td>
  111. <td>Parent window handle, for embedding the engine in a child of an external window</td>
  112. <td>&nbsp;</td>
  113. </tr>
  114. <tr>
  115. <td>macAPI</td>
  116. <td>String: "cocoa" or "carbon"</td>
  117. <td>"carbon"</td>
  118. <td>Specifies the type of rendering window on the Mac Platform.</td>
  119. <td>&nbsp;</td>
  120. </tr>
  121. <tr>
  122. <td>macAPICocoaUseNSView</td>
  123. <td>bool "true" or "false"</td>
  124. <td>"false"</td>
  125. <td>On the Mac platform the most diffused method to embed engine in a custom application is to use Interface Builder
  126. and add to the interface an instance of OgreView.
  127. The pointer to this instance is then used as "externalWindowHandle".
  128. However, there are cases where you are NOT using Interface Builder and you get the Cocoa NSView* of an existing interface.
  129. For example, this is happens when you want to render into a Java/AWT interface.
  130. In short, by setting this flag to "true" the Ogre::Root::createRenderWindow interprets the "externalWindowHandle" as a NSView*
  131. instead of an OgreView*. See OgreOSXCocoaView.h/mm.
  132. </td>
  133. <td>&nbsp;</td>
  134. </tr>
  135. <tr>
  136. <td>FSAA</td>
  137. <td>Positive integer (usually 0, 2, 4, 8, 16)</td>
  138. <td>0</td>
  139. <td>Full screen antialiasing factor</td>
  140. <td>&nbsp;</td>
  141. </tr>
  142. <tr>
  143. <td>FSAAHint</td>
  144. <td>Depends on RenderSystem and hardware. Currently supports:<br/>
  145. "Quality": on systems that have an option to prefer higher AA quality over speed, use it</td>
  146. <td>Blank</td>
  147. <td>Full screen antialiasing hint</td>
  148. <td>&nbsp;</td>
  149. </tr>
  150. <tr>
  151. <td>displayFrequency</td>
  152. <td>Refresh rate in Hertz (e.g. 60, 75, 100)</td>
  153. <td>Desktop vsync rate</td>
  154. <td>Display frequency rate, for fullscreen mode</td>
  155. <td>&nbsp;</td>
  156. </tr>
  157. <tr>
  158. <td>vsync</td>
  159. <td>true, false</td>
  160. <td>false</td>
  161. <td>Synchronize buffer swaps to monitor vsync, eliminating tearing at the expense of a fixed frame rate</td>
  162. <td>&nbsp;</td>
  163. </tr>
  164. <tr>
  165. <td>vsyncInterval</td>
  166. <td>1, 2, 3, 4</td>
  167. <td>1</td>
  168. <td>If vsync is enabled, the minimum number of vertical blanks that should occur between renders.
  169. For example if vsync is enabled, the refresh rate is 60 and this is set to 2, then the
  170. frame rate will be locked at 30.</td>
  171. <td>&nbsp;</td>
  172. </tr>
  173. <tr>
  174. <td>border</td>
  175. <td>none, fixed, resize</td>
  176. <td>resize</td>
  177. <td>The type of window border (in windowed mode)</td>
  178. <td>&nbsp;</td>
  179. </tr>
  180. <tr>
  181. <td>outerDimensions</td>
  182. <td>true, false</td>
  183. <td>false</td>
  184. <td>Whether the width/height is expressed as the size of the
  185. outer window, rather than the content area</td>
  186. <td>&nbsp;</td>
  187. </tr>
  188. <tr>
  189. <td>useNVPerfHUD</td>
  190. <td>true, false</td>
  191. <td>false</td>
  192. <td>Enable the use of nVidia NVPerfHUD</td>
  193. <td>&nbsp;</td>
  194. </tr>
  195. <tr>
  196. <td>gamma</td>
  197. <td>true, false</td>
  198. <td>false</td>
  199. <td>Enable hardware conversion from linear colour space to gamma
  200. colour space on rendering to the window.</td>
  201. <td>&nbsp;</td>
  202. </tr>
  203. */
  204. RenderWindowPtr create(const String& name, UINT32 width, UINT32 height,
  205. bool fullScreen, const map<String, String>::type* miscParams = nullptr);
  206. protected:
  207. virtual void createImpl(const String& name, UINT32 width, UINT32 height,
  208. bool fullScreen, const map<String, String>::type& miscParams, AsyncOp& asyncOp) = 0;
  209. };
  210. }