CCamera.generated.cs 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468
  1. using System;
  2. using System.Runtime.CompilerServices;
  3. using System.Runtime.InteropServices;
  4. namespace BansheeEngine
  5. {
  6. /** @addtogroup Rendering
  7. * @{
  8. */
  9. /// <summary>
  10. /// Camera determines how is world geometry projected onto a 2D surface. You may position and orient it in space, set
  11. /// options like aspect ratio and field or view and it outputs view and projection matrices required for rendering.
  12. /// </summary>
  13. [ShowInInspector]
  14. public partial class Camera : Component
  15. {
  16. private Camera(bool __dummy0) { }
  17. protected Camera() { }
  18. /// <summary>Returns the viewport used by the camera.</summary>
  19. [ShowInInspector]
  20. [NativeWrapper]
  21. public Viewport Viewport
  22. {
  23. get { return Internal_getViewport(mCachedPtr); }
  24. }
  25. /// <summary>
  26. /// Determines the camera horizontal field of view. This determines how wide the camera viewing angle is along the
  27. /// horizontal axis. Vertical FOV is calculated from the horizontal FOV and the aspect ratio.
  28. /// </summary>
  29. [ShowInInspector]
  30. [NativeWrapper]
  31. public Radian FieldOfView
  32. {
  33. get
  34. {
  35. Radian temp;
  36. Internal_getHorzFOV(mCachedPtr, out temp);
  37. return temp;
  38. }
  39. set { Internal_setHorzFOV(mCachedPtr, ref value); }
  40. }
  41. /// <summary>
  42. /// Determines the distance from the frustum to the near clipping plane. Anything closer than the near clipping plane
  43. /// will not be rendered. Decreasing this value decreases depth buffer precision.
  44. /// </summary>
  45. [ShowInInspector]
  46. [NativeWrapper]
  47. public float NearClipPlane
  48. {
  49. get { return Internal_getNearClipDistance(mCachedPtr); }
  50. set { Internal_setNearClipDistance(mCachedPtr, value); }
  51. }
  52. /// <summary>
  53. /// Determines the distance from the frustum to the far clipping plane. Anything farther than the far clipping plane will
  54. /// not be rendered. Increasing this value decreases depth buffer precision.
  55. /// </summary>
  56. [ShowInInspector]
  57. [NativeWrapper]
  58. public float FarClipPlane
  59. {
  60. get { return Internal_getFarClipDistance(mCachedPtr); }
  61. set { Internal_setFarClipDistance(mCachedPtr, value); }
  62. }
  63. /// <summary>Determines the current viewport aspect ratio (width / height).</summary>
  64. [ShowInInspector]
  65. [NativeWrapper]
  66. public float AspectRatio
  67. {
  68. get { return Internal_getAspectRatio(mCachedPtr); }
  69. set { Internal_setAspectRatio(mCachedPtr, value); }
  70. }
  71. /// <summary>
  72. /// Returns the standard projection matrix that determines how are 3D points projected to two dimensions. The layout of
  73. /// this matrix depends on currently used render system.
  74. /// </summary>
  75. [ShowInInspector]
  76. [NativeWrapper]
  77. public Matrix4 ProjMatrix
  78. {
  79. get
  80. {
  81. Matrix4 temp;
  82. Internal_getProjectionMatrixRS(mCachedPtr, out temp);
  83. return temp;
  84. }
  85. }
  86. /// <summary>Gets the camera view matrix. Used for positioning/orienting the camera.</summary>
  87. [ShowInInspector]
  88. [NativeWrapper]
  89. public Matrix4 ViewMatrix
  90. {
  91. get
  92. {
  93. Matrix4 temp;
  94. Internal_getViewMatrix(mCachedPtr, out temp);
  95. return temp;
  96. }
  97. }
  98. /// <summary>
  99. /// Determines the type of projection used by the camera. Projection type controls how is 3D geometry projected onto a
  100. /// 2D plane.
  101. /// </summary>
  102. [ShowInInspector]
  103. [NativeWrapper]
  104. public ProjectionType ProjectionType
  105. {
  106. get { return Internal_getProjectionType(mCachedPtr); }
  107. set { Internal_setProjectionType(mCachedPtr, value); }
  108. }
  109. /// <summary>
  110. /// Determines the orthographic window height, for use with orthographic rendering only. The width of the window will be
  111. /// calculated from the aspect ratio. Value is specified in world units.
  112. /// </summary>
  113. [ShowInInspector]
  114. [NativeWrapper]
  115. public float OrthoHeight
  116. {
  117. get { return Internal_getOrthoWindowHeight(mCachedPtr); }
  118. set { Internal_setOrthoWindowHeight(mCachedPtr, value); }
  119. }
  120. /// <summary>
  121. /// Determines the orthographic window width, for use with orthographic rendering only. The height of the window will be
  122. /// calculated from the aspect ratio. Value is specified in world units.
  123. /// </summary>
  124. [ShowInInspector]
  125. [NativeWrapper]
  126. public float OrthoWidth
  127. {
  128. get { return Internal_getOrthoWindowWidth(mCachedPtr); }
  129. set { Internal_setOrthoWindowWidth(mCachedPtr, value); }
  130. }
  131. /// <summary>
  132. /// Determines a priority that determines in which orders the cameras are rendered. This only applies to cameras
  133. /// rendering to the same render target. Higher value means the camera will be rendered sooner.
  134. /// </summary>
  135. [ShowInInspector]
  136. [NativeWrapper]
  137. public int Priority
  138. {
  139. get { return Internal_getPriority(mCachedPtr); }
  140. set { Internal_setPriority(mCachedPtr, value); }
  141. }
  142. /// <summary>Determines layer bitfield that is used when determining which object should the camera render.</summary>
  143. [ShowInInspector]
  144. [NativeWrapper]
  145. public ulong Layers
  146. {
  147. get { return Internal_getLayers(mCachedPtr); }
  148. set { Internal_setLayers(mCachedPtr, value); }
  149. }
  150. /// <summary>
  151. /// Determines number of samples to use when rendering to this camera. Values larger than 1 will enable MSAA rendering.
  152. /// </summary>
  153. [ShowInInspector]
  154. [NativeWrapper]
  155. public uint SampleCount
  156. {
  157. get { return Internal_getMSAACount(mCachedPtr); }
  158. set { Internal_setMSAACount(mCachedPtr, value); }
  159. }
  160. /// <summary>
  161. /// Settings that control rendering for this view. They determine how will the renderer process this view, which effects
  162. /// will be enabled, and what properties will those effects use.
  163. /// </summary>
  164. [ShowInInspector]
  165. [NativeWrapper]
  166. public RenderSettings RenderSettings
  167. {
  168. get { return Internal_getRenderSettings(mCachedPtr); }
  169. set { Internal_setRenderSettings(mCachedPtr, value); }
  170. }
  171. /// <summary>
  172. /// Determines whether this is the main application camera. Main camera controls the final render surface that is
  173. /// displayed to the user.
  174. /// </summary>
  175. [ShowInInspector]
  176. [NativeWrapper]
  177. public bool Main
  178. {
  179. get { return Internal_isMain(mCachedPtr); }
  180. set { Internal_setMain(mCachedPtr, value); }
  181. }
  182. /// <summary>Converts a point in world space to screen coordinates.</summary>
  183. /// <param name="worldPoint">3D point in world space.</param>
  184. /// <returns>2D point on the render target attached to the camera's viewport, in pixels.</returns>
  185. public Vector2I WorldToScreenPoint(Vector3 worldPoint)
  186. {
  187. Vector2I temp;
  188. Internal_worldToScreenPoint(mCachedPtr, ref worldPoint, out temp);
  189. return temp;
  190. }
  191. /// <summary>Converts a point in world space to normalized device coordinates.</summary>
  192. /// <param name="worldPoint">3D point in world space.</param>
  193. /// <returns>2D point in normalized device coordinates ([-1, 1] range), relative to the camera's viewport.</returns>
  194. public Vector2 WorldToNdcPoint(Vector3 worldPoint)
  195. {
  196. Vector2 temp;
  197. Internal_worldToNdcPoint(mCachedPtr, ref worldPoint, out temp);
  198. return temp;
  199. }
  200. /// <summary>Converts a point in world space to view space coordinates.</summary>
  201. /// <param name="worldPoint">3D point in world space.</param>
  202. /// <returns>3D point relative to the camera's coordinate system.</returns>
  203. public Vector3 WorldToViewPoint(Vector3 worldPoint)
  204. {
  205. Vector3 temp;
  206. Internal_worldToViewPoint(mCachedPtr, ref worldPoint, out temp);
  207. return temp;
  208. }
  209. /// <summary>Converts a point in screen space to a point in world space.</summary>
  210. /// <param name="screenPoint">2D point on the render target attached to the camera's viewport, in pixels.</param>
  211. /// <param name="depth">
  212. /// Depth to place the world point at, in world coordinates. The depth is applied to the vector going from camera origin
  213. /// to the point on the near plane.
  214. /// </param>
  215. /// <returns>3D point in world space.</returns>
  216. public Vector3 ScreenToWorldPoint(Vector2I screenPoint, float depth = 0.5f)
  217. {
  218. Vector3 temp;
  219. Internal_screenToWorldPoint(mCachedPtr, ref screenPoint, depth, out temp);
  220. return temp;
  221. }
  222. /// <summary>Converts a point in screen space to a point in view space.</summary>
  223. /// <param name="screenPoint">2D point on the render target attached to the camera's viewport, in pixels.</param>
  224. /// <param name="depth">
  225. /// Depth to place the world point at, in device depth. The depth is applied to the vector going from camera origin to
  226. /// the point on the near plane.
  227. /// </param>
  228. /// <returns>3D point relative to the camera's coordinate system.</returns>
  229. public Vector3 ScreenToViewPoint(Vector2I screenPoint, float depth = 0.5f)
  230. {
  231. Vector3 temp;
  232. Internal_screenToViewPoint(mCachedPtr, ref screenPoint, depth, out temp);
  233. return temp;
  234. }
  235. /// <summary>Converts a point in screen space to normalized device coordinates.</summary>
  236. /// <param name="screenPoint">2D point on the render target attached to the camera's viewport, in pixels.</param>
  237. /// <returns>2D point in normalized device coordinates ([-1, 1] range), relative to the camera's viewport.</returns>
  238. public Vector2 ScreenToNdcPoint(Vector2I screenPoint)
  239. {
  240. Vector2 temp;
  241. Internal_screenToNdcPoint(mCachedPtr, ref screenPoint, out temp);
  242. return temp;
  243. }
  244. /// <summary>Converts a point in view space to world space.</summary>
  245. /// <param name="viewPoint">3D point relative to the camera's coordinate system.</param>
  246. /// <returns>3D point in world space.</returns>
  247. public Vector3 ViewToWorldPoint(Vector3 viewPoint)
  248. {
  249. Vector3 temp;
  250. Internal_viewToWorldPoint(mCachedPtr, ref viewPoint, out temp);
  251. return temp;
  252. }
  253. /// <summary>Converts a point in view space to screen space.</summary>
  254. /// <param name="viewPoint">3D point relative to the camera's coordinate system.</param>
  255. /// <returns>2D point on the render target attached to the camera's viewport, in pixels.</returns>
  256. public Vector2I ViewToScreenPoint(Vector3 viewPoint)
  257. {
  258. Vector2I temp;
  259. Internal_viewToScreenPoint(mCachedPtr, ref viewPoint, out temp);
  260. return temp;
  261. }
  262. /// <summary>Converts a point in view space to normalized device coordinates.</summary>
  263. /// <param name="viewPoint">3D point relative to the camera's coordinate system.</param>
  264. /// <returns>2D point in normalized device coordinates ([-1, 1] range), relative to the camera's viewport.</returns>
  265. public Vector2 ViewToNdcPoint(Vector3 viewPoint)
  266. {
  267. Vector2 temp;
  268. Internal_viewToNdcPoint(mCachedPtr, ref viewPoint, out temp);
  269. return temp;
  270. }
  271. /// <summary>Converts a point in normalized device coordinates to world space.</summary>
  272. /// <param name="ndcPoint">
  273. /// 2D point in normalized device coordinates ([-1, 1] range), relative to the camera's viewport.
  274. /// </param>
  275. /// <param name="depth">
  276. /// Depth to place the world point at. The depth is applied to the vector going from camera origin to the point on the
  277. /// near plane.
  278. /// </param>
  279. /// <returns>3D point in world space.</returns>
  280. public Vector3 NdcToWorldPoint(Vector2 ndcPoint, float depth = 0.5f)
  281. {
  282. Vector3 temp;
  283. Internal_ndcToWorldPoint(mCachedPtr, ref ndcPoint, depth, out temp);
  284. return temp;
  285. }
  286. /// <summary>Converts a point in normalized device coordinates to view space.</summary>
  287. /// <param name="ndcPoint">
  288. /// 2D point in normalized device coordinates ([-1, 1] range), relative to the camera's viewport.
  289. /// </param>
  290. /// <param name="depth">
  291. /// Depth to place the world point at. The depth is applied to the vector going from camera origin to the point on the
  292. /// near plane.
  293. /// </param>
  294. /// <returns>3D point relative to the camera's coordinate system.</returns>
  295. public Vector3 NdcToViewPoint(Vector2 ndcPoint, float depth = 0.5f)
  296. {
  297. Vector3 temp;
  298. Internal_ndcToViewPoint(mCachedPtr, ref ndcPoint, depth, out temp);
  299. return temp;
  300. }
  301. /// <summary>Converts a point in normalized device coordinates to screen space.</summary>
  302. /// <param name="ndcPoint">
  303. /// 2D point in normalized device coordinates ([-1, 1] range), relative to the camera's viewport.
  304. /// </param>
  305. /// <returns>2D point on the render target attached to the camera's viewport, in pixels.</returns>
  306. public Vector2I NdcToScreenPoint(Vector2 ndcPoint)
  307. {
  308. Vector2I temp;
  309. Internal_ndcToScreenPoint(mCachedPtr, ref ndcPoint, out temp);
  310. return temp;
  311. }
  312. /// <summary>Converts a point in screen space to a ray in world space.</summary>
  313. /// <param name="screenPoint">2D point on the render target attached to the camera's viewport, in pixels.</param>
  314. /// <returns>Ray in world space, originating at the selected point on the camera near plane.</returns>
  315. public Ray ScreenPointToRay(Vector2I screenPoint)
  316. {
  317. Ray temp;
  318. Internal_screenPointToRay(mCachedPtr, ref screenPoint, out temp);
  319. return temp;
  320. }
  321. /// <summary>
  322. /// Projects a point in view space to normalized device coordinates. Similar to viewToNdcPoint() but preserves the depth
  323. /// component.
  324. /// </summary>
  325. /// <param name="point">3D point relative to the camera's coordinate system.</param>
  326. /// <returns>
  327. /// 3D point in normalized device coordinates ([-1, 1] range), relative to the camera's viewport. Z value range depends
  328. /// on active render API.
  329. /// </returns>
  330. public Vector3 ProjectPoint(Vector3 point)
  331. {
  332. Vector3 temp;
  333. Internal_projectPoint(mCachedPtr, ref point, out temp);
  334. return temp;
  335. }
  336. /// <summary>Un-projects a point in normalized device space to view space.</summary>
  337. /// <param name="point">
  338. /// 3D point in normalized device coordinates ([-1, 1] range), relative to the camera's viewport. Z value range depends
  339. /// on active render API.
  340. /// </param>
  341. /// <returns>3D point relative to the camera's coordinate system.</returns>
  342. public Vector3 UnprojectPoint(Vector3 point)
  343. {
  344. Vector3 temp;
  345. Internal_unprojectPoint(mCachedPtr, ref point, out temp);
  346. return temp;
  347. }
  348. [MethodImpl(MethodImplOptions.InternalCall)]
  349. private static extern Viewport Internal_getViewport(IntPtr thisPtr);
  350. [MethodImpl(MethodImplOptions.InternalCall)]
  351. private static extern void Internal_setHorzFOV(IntPtr thisPtr, ref Radian fovy);
  352. [MethodImpl(MethodImplOptions.InternalCall)]
  353. private static extern void Internal_getHorzFOV(IntPtr thisPtr, out Radian __output);
  354. [MethodImpl(MethodImplOptions.InternalCall)]
  355. private static extern void Internal_setNearClipDistance(IntPtr thisPtr, float nearDist);
  356. [MethodImpl(MethodImplOptions.InternalCall)]
  357. private static extern float Internal_getNearClipDistance(IntPtr thisPtr);
  358. [MethodImpl(MethodImplOptions.InternalCall)]
  359. private static extern void Internal_setFarClipDistance(IntPtr thisPtr, float farDist);
  360. [MethodImpl(MethodImplOptions.InternalCall)]
  361. private static extern float Internal_getFarClipDistance(IntPtr thisPtr);
  362. [MethodImpl(MethodImplOptions.InternalCall)]
  363. private static extern void Internal_setAspectRatio(IntPtr thisPtr, float ratio);
  364. [MethodImpl(MethodImplOptions.InternalCall)]
  365. private static extern float Internal_getAspectRatio(IntPtr thisPtr);
  366. [MethodImpl(MethodImplOptions.InternalCall)]
  367. private static extern void Internal_getProjectionMatrixRS(IntPtr thisPtr, out Matrix4 __output);
  368. [MethodImpl(MethodImplOptions.InternalCall)]
  369. private static extern void Internal_getViewMatrix(IntPtr thisPtr, out Matrix4 __output);
  370. [MethodImpl(MethodImplOptions.InternalCall)]
  371. private static extern void Internal_setProjectionType(IntPtr thisPtr, ProjectionType pt);
  372. [MethodImpl(MethodImplOptions.InternalCall)]
  373. private static extern ProjectionType Internal_getProjectionType(IntPtr thisPtr);
  374. [MethodImpl(MethodImplOptions.InternalCall)]
  375. private static extern void Internal_setOrthoWindowHeight(IntPtr thisPtr, float h);
  376. [MethodImpl(MethodImplOptions.InternalCall)]
  377. private static extern float Internal_getOrthoWindowHeight(IntPtr thisPtr);
  378. [MethodImpl(MethodImplOptions.InternalCall)]
  379. private static extern void Internal_setOrthoWindowWidth(IntPtr thisPtr, float w);
  380. [MethodImpl(MethodImplOptions.InternalCall)]
  381. private static extern float Internal_getOrthoWindowWidth(IntPtr thisPtr);
  382. [MethodImpl(MethodImplOptions.InternalCall)]
  383. private static extern void Internal_setPriority(IntPtr thisPtr, int priority);
  384. [MethodImpl(MethodImplOptions.InternalCall)]
  385. private static extern int Internal_getPriority(IntPtr thisPtr);
  386. [MethodImpl(MethodImplOptions.InternalCall)]
  387. private static extern void Internal_setLayers(IntPtr thisPtr, ulong layers);
  388. [MethodImpl(MethodImplOptions.InternalCall)]
  389. private static extern ulong Internal_getLayers(IntPtr thisPtr);
  390. [MethodImpl(MethodImplOptions.InternalCall)]
  391. private static extern void Internal_setMSAACount(IntPtr thisPtr, uint count);
  392. [MethodImpl(MethodImplOptions.InternalCall)]
  393. private static extern uint Internal_getMSAACount(IntPtr thisPtr);
  394. [MethodImpl(MethodImplOptions.InternalCall)]
  395. private static extern void Internal_setRenderSettings(IntPtr thisPtr, RenderSettings settings);
  396. [MethodImpl(MethodImplOptions.InternalCall)]
  397. private static extern RenderSettings Internal_getRenderSettings(IntPtr thisPtr);
  398. [MethodImpl(MethodImplOptions.InternalCall)]
  399. private static extern void Internal_worldToScreenPoint(IntPtr thisPtr, ref Vector3 worldPoint, out Vector2I __output);
  400. [MethodImpl(MethodImplOptions.InternalCall)]
  401. private static extern void Internal_worldToNdcPoint(IntPtr thisPtr, ref Vector3 worldPoint, out Vector2 __output);
  402. [MethodImpl(MethodImplOptions.InternalCall)]
  403. private static extern void Internal_worldToViewPoint(IntPtr thisPtr, ref Vector3 worldPoint, out Vector3 __output);
  404. [MethodImpl(MethodImplOptions.InternalCall)]
  405. private static extern void Internal_screenToWorldPoint(IntPtr thisPtr, ref Vector2I screenPoint, float depth, out Vector3 __output);
  406. [MethodImpl(MethodImplOptions.InternalCall)]
  407. private static extern void Internal_screenToViewPoint(IntPtr thisPtr, ref Vector2I screenPoint, float depth, out Vector3 __output);
  408. [MethodImpl(MethodImplOptions.InternalCall)]
  409. private static extern void Internal_screenToNdcPoint(IntPtr thisPtr, ref Vector2I screenPoint, out Vector2 __output);
  410. [MethodImpl(MethodImplOptions.InternalCall)]
  411. private static extern void Internal_viewToWorldPoint(IntPtr thisPtr, ref Vector3 viewPoint, out Vector3 __output);
  412. [MethodImpl(MethodImplOptions.InternalCall)]
  413. private static extern void Internal_viewToScreenPoint(IntPtr thisPtr, ref Vector3 viewPoint, out Vector2I __output);
  414. [MethodImpl(MethodImplOptions.InternalCall)]
  415. private static extern void Internal_viewToNdcPoint(IntPtr thisPtr, ref Vector3 viewPoint, out Vector2 __output);
  416. [MethodImpl(MethodImplOptions.InternalCall)]
  417. private static extern void Internal_ndcToWorldPoint(IntPtr thisPtr, ref Vector2 ndcPoint, float depth, out Vector3 __output);
  418. [MethodImpl(MethodImplOptions.InternalCall)]
  419. private static extern void Internal_ndcToViewPoint(IntPtr thisPtr, ref Vector2 ndcPoint, float depth, out Vector3 __output);
  420. [MethodImpl(MethodImplOptions.InternalCall)]
  421. private static extern void Internal_ndcToScreenPoint(IntPtr thisPtr, ref Vector2 ndcPoint, out Vector2I __output);
  422. [MethodImpl(MethodImplOptions.InternalCall)]
  423. private static extern void Internal_screenPointToRay(IntPtr thisPtr, ref Vector2I screenPoint, out Ray __output);
  424. [MethodImpl(MethodImplOptions.InternalCall)]
  425. private static extern void Internal_projectPoint(IntPtr thisPtr, ref Vector3 point, out Vector3 __output);
  426. [MethodImpl(MethodImplOptions.InternalCall)]
  427. private static extern void Internal_unprojectPoint(IntPtr thisPtr, ref Vector3 point, out Vector3 __output);
  428. [MethodImpl(MethodImplOptions.InternalCall)]
  429. private static extern void Internal_setMain(IntPtr thisPtr, bool main);
  430. [MethodImpl(MethodImplOptions.InternalCall)]
  431. private static extern bool Internal_isMain(IntPtr thisPtr);
  432. }
  433. /** @} */
  434. }