CCamera.generated.cs 19 KB

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