Camera.cs 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278
  1. // WARNING - AUTOGENERATED - DO NOT EDIT
  2. //
  3. // Generated using `sharpie urho`
  4. //
  5. // Camera.cs
  6. //
  7. // Copyright 2015 Xamarin Inc. All rights reserved.
  8. using System;
  9. using System.Runtime.InteropServices;
  10. using System.Collections.Generic;
  11. using Urho.Urho2D;
  12. using Urho.Gui;
  13. using Urho.Resources;
  14. using Urho.IO;
  15. using Urho.Navigation;
  16. using Urho.Network;
  17. namespace Urho
  18. {
  19. /// <summary>
  20. /// %Camera component.
  21. /// </summary>
  22. public unsafe partial class Camera : Component
  23. {
  24. unsafe partial void OnCameraCreated ();
  25. [Preserve]
  26. public Camera (IntPtr handle) : base (handle)
  27. {
  28. OnCameraCreated ();
  29. }
  30. [Preserve]
  31. protected Camera (UrhoObjectFlag emptyFlag) : base (emptyFlag)
  32. {
  33. OnCameraCreated ();
  34. }
  35. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  36. internal static extern int Camera_GetType (IntPtr handle);
  37. private StringHash UrhoGetType ()
  38. {
  39. Runtime.ValidateRefCounted (this);
  40. return new StringHash (Camera_GetType (handle));
  41. }
  42. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  43. internal static extern IntPtr Camera_GetTypeName (IntPtr handle);
  44. private string GetTypeName ()
  45. {
  46. Runtime.ValidateRefCounted (this);
  47. return Marshal.PtrToStringAnsi (Camera_GetTypeName (handle));
  48. }
  49. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  50. internal static extern int Camera_GetTypeStatic ();
  51. private static StringHash GetTypeStatic ()
  52. {
  53. Runtime.Validate (typeof(Camera));
  54. return new StringHash (Camera_GetTypeStatic ());
  55. }
  56. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  57. internal static extern IntPtr Camera_GetTypeNameStatic ();
  58. private static string GetTypeNameStatic ()
  59. {
  60. Runtime.Validate (typeof(Camera));
  61. return Marshal.PtrToStringAnsi (Camera_GetTypeNameStatic ());
  62. }
  63. [Preserve]
  64. public Camera () : this (Application.CurrentContext)
  65. {
  66. }
  67. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  68. internal static extern IntPtr Camera_Camera (IntPtr context);
  69. [Preserve]
  70. public Camera (Context context) : base (UrhoObjectFlag.Empty)
  71. {
  72. Runtime.Validate (typeof(Camera));
  73. handle = Camera_Camera ((object)context == null ? IntPtr.Zero : context.Handle);
  74. Runtime.RegisterObject (this);
  75. OnCameraCreated ();
  76. }
  77. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  78. internal static extern void Camera_RegisterObject (IntPtr context);
  79. /// <summary>
  80. /// Register object factory.
  81. /// </summary>
  82. public new static void RegisterObject (Context context)
  83. {
  84. Runtime.Validate (typeof(Camera));
  85. Camera_RegisterObject ((object)context == null ? IntPtr.Zero : context.Handle);
  86. }
  87. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  88. internal static extern void Camera_DrawDebugGeometry (IntPtr handle, IntPtr debug, bool depthTest);
  89. /// <summary>
  90. /// Visualize the component as debug geometry.
  91. /// </summary>
  92. public override void DrawDebugGeometry (DebugRenderer debug, bool depthTest)
  93. {
  94. Runtime.ValidateRefCounted (this);
  95. Camera_DrawDebugGeometry (handle, (object)debug == null ? IntPtr.Zero : debug.Handle, depthTest);
  96. }
  97. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  98. internal static extern void Camera_SetNearClip (IntPtr handle, float nearClip);
  99. /// <summary>
  100. /// Set near clip distance.
  101. /// </summary>
  102. private void SetNearClip (float nearClip)
  103. {
  104. Runtime.ValidateRefCounted (this);
  105. Camera_SetNearClip (handle, nearClip);
  106. }
  107. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  108. internal static extern void Camera_SetFarClip (IntPtr handle, float farClip);
  109. /// <summary>
  110. /// Set far clip distance.
  111. /// </summary>
  112. private void SetFarClip (float farClip)
  113. {
  114. Runtime.ValidateRefCounted (this);
  115. Camera_SetFarClip (handle, farClip);
  116. }
  117. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  118. internal static extern void Camera_SetFov (IntPtr handle, float fov);
  119. /// <summary>
  120. /// Set vertical field of view in degrees.
  121. /// </summary>
  122. private void SetFov (float fov)
  123. {
  124. Runtime.ValidateRefCounted (this);
  125. Camera_SetFov (handle, fov);
  126. }
  127. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  128. internal static extern void Camera_SetSkew (IntPtr handle, float skew);
  129. /// <summary>
  130. /// Set skew
  131. /// </summary>
  132. private void SetSkew (float skew)
  133. {
  134. Runtime.ValidateRefCounted (this);
  135. Camera_SetSkew (handle, skew);
  136. }
  137. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  138. internal static extern void Camera_SetOrthoSize (IntPtr handle, float orthoSize);
  139. /// <summary>
  140. /// Set orthographic mode view uniform size.
  141. /// </summary>
  142. private void SetOrthoSize (float orthoSize)
  143. {
  144. Runtime.ValidateRefCounted (this);
  145. Camera_SetOrthoSize (handle, orthoSize);
  146. }
  147. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  148. internal static extern void Camera_SetOrthoSize0 (IntPtr handle, ref Urho.Vector2 orthoSize);
  149. /// <summary>
  150. /// Set orthographic mode view non-uniform size. Disables the auto aspect ratio -mode.
  151. /// </summary>
  152. public void SetOrthoSize (Urho.Vector2 orthoSize)
  153. {
  154. Runtime.ValidateRefCounted (this);
  155. Camera_SetOrthoSize0 (handle, ref orthoSize);
  156. }
  157. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  158. internal static extern void Camera_SetAspectRatio (IntPtr handle, float aspectRatio);
  159. /// <summary>
  160. /// Set aspect ratio manually. Disables the auto aspect ratio -mode.
  161. /// </summary>
  162. private void SetAspectRatio (float aspectRatio)
  163. {
  164. Runtime.ValidateRefCounted (this);
  165. Camera_SetAspectRatio (handle, aspectRatio);
  166. }
  167. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  168. internal static extern void Camera_SetFillMode (IntPtr handle, FillMode mode);
  169. /// <summary>
  170. /// Set polygon fill mode to use when rendering a scene.
  171. /// </summary>
  172. private void SetFillMode (FillMode mode)
  173. {
  174. Runtime.ValidateRefCounted (this);
  175. Camera_SetFillMode (handle, mode);
  176. }
  177. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  178. internal static extern void Camera_SetZoom (IntPtr handle, float zoom);
  179. /// <summary>
  180. /// Set zoom.
  181. /// </summary>
  182. private void SetZoom (float zoom)
  183. {
  184. Runtime.ValidateRefCounted (this);
  185. Camera_SetZoom (handle, zoom);
  186. }
  187. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  188. internal static extern void Camera_SetLodBias (IntPtr handle, float bias);
  189. /// <summary>
  190. /// Set LOD bias.
  191. /// </summary>
  192. private void SetLodBias (float bias)
  193. {
  194. Runtime.ValidateRefCounted (this);
  195. Camera_SetLodBias (handle, bias);
  196. }
  197. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  198. internal static extern void Camera_SetViewMask (IntPtr handle, uint mask);
  199. /// <summary>
  200. /// Set view mask. Will be and'ed with object's view mask to see if the object should be rendered.
  201. /// </summary>
  202. private void SetViewMask (uint mask)
  203. {
  204. Runtime.ValidateRefCounted (this);
  205. Camera_SetViewMask (handle, mask);
  206. }
  207. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  208. internal static extern void Camera_SetViewOverrideFlags (IntPtr handle, uint flags);
  209. /// <summary>
  210. /// Set view override flags.
  211. /// </summary>
  212. private void SetViewOverrideFlags (uint flags)
  213. {
  214. Runtime.ValidateRefCounted (this);
  215. Camera_SetViewOverrideFlags (handle, flags);
  216. }
  217. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  218. internal static extern void Camera_SetOrthographic (IntPtr handle, bool enable);
  219. /// <summary>
  220. /// Set orthographic mode enabled/disabled.
  221. /// </summary>
  222. private void SetOrthographic (bool enable)
  223. {
  224. Runtime.ValidateRefCounted (this);
  225. Camera_SetOrthographic (handle, enable);
  226. }
  227. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  228. internal static extern void Camera_SetAutoAspectRatio (IntPtr handle, bool enable);
  229. /// <summary>
  230. /// Set automatic aspect ratio based on viewport dimensions. Enabled by default.
  231. /// </summary>
  232. private void SetAutoAspectRatio (bool enable)
  233. {
  234. Runtime.ValidateRefCounted (this);
  235. Camera_SetAutoAspectRatio (handle, enable);
  236. }
  237. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  238. internal static extern void Camera_SetProjectionOffset (IntPtr handle, ref Urho.Vector2 offset);
  239. /// <summary>
  240. /// Set projection offset. It needs to be calculated as (offset in pixels) / (viewport dimensions.)
  241. /// </summary>
  242. private void SetProjectionOffset (Urho.Vector2 offset)
  243. {
  244. Runtime.ValidateRefCounted (this);
  245. Camera_SetProjectionOffset (handle, ref offset);
  246. }
  247. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  248. internal static extern void Camera_SetUseReflection (IntPtr handle, bool enable);
  249. /// <summary>
  250. /// Set reflection mode.
  251. /// </summary>
  252. private void SetUseReflection (bool enable)
  253. {
  254. Runtime.ValidateRefCounted (this);
  255. Camera_SetUseReflection (handle, enable);
  256. }
  257. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  258. internal static extern void Camera_SetReflectionPlane (IntPtr handle, ref Urho.Plane plane);
  259. /// <summary>
  260. /// Set reflection plane in world space for reflection mode.
  261. /// </summary>
  262. private void SetReflectionPlane (Urho.Plane plane)
  263. {
  264. Runtime.ValidateRefCounted (this);
  265. Camera_SetReflectionPlane (handle, ref plane);
  266. }
  267. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  268. internal static extern void Camera_SetUseClipping (IntPtr handle, bool enable);
  269. /// <summary>
  270. /// Set whether to use a custom clip plane.
  271. /// </summary>
  272. private void SetUseClipping (bool enable)
  273. {
  274. Runtime.ValidateRefCounted (this);
  275. Camera_SetUseClipping (handle, enable);
  276. }
  277. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  278. internal static extern void Camera_SetClipPlane (IntPtr handle, ref Urho.Plane plane);
  279. /// <summary>
  280. /// Set custom clipping plane in world space.
  281. /// </summary>
  282. private void SetClipPlane (Urho.Plane plane)
  283. {
  284. Runtime.ValidateRefCounted (this);
  285. Camera_SetClipPlane (handle, ref plane);
  286. }
  287. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  288. internal static extern void Camera_SetFlipVertical (IntPtr handle, bool enable);
  289. /// <summary>
  290. /// Set vertical flipping mode. Called internally by View to resolve OpenGL / Direct3D9 rendertarget sampling differences.
  291. /// </summary>
  292. private void SetFlipVertical (bool enable)
  293. {
  294. Runtime.ValidateRefCounted (this);
  295. Camera_SetFlipVertical (handle, enable);
  296. }
  297. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  298. internal static extern void Camera_SetProjection (IntPtr handle, ref Urho.Matrix4 projection);
  299. /// <summary>
  300. /// Set custom projection matrix, which should be specified in D3D convention with depth range 0 - 1. Disables auto aspect ratio.
  301. /// Change any of the standard view parameters (FOV, far clip, zoom etc.) to revert to the standard projection.
  302. /// Note that the custom projection is not serialized or replicated through the network.
  303. /// </summary>
  304. public void SetProjection (Urho.Matrix4 projection)
  305. {
  306. Runtime.ValidateRefCounted (this);
  307. Camera_SetProjection (handle, ref projection);
  308. }
  309. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  310. internal static extern float Camera_GetFarClip (IntPtr handle);
  311. /// <summary>
  312. /// Return far clip distance. If a custom projection matrix is in use, is calculated from it instead of the value assigned with SetFarClip().
  313. /// </summary>
  314. private float GetFarClip ()
  315. {
  316. Runtime.ValidateRefCounted (this);
  317. return Camera_GetFarClip (handle);
  318. }
  319. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  320. internal static extern float Camera_GetNearClip (IntPtr handle);
  321. /// <summary>
  322. /// Return near clip distance. If a custom projection matrix is in use, is calculated from it instead of the value assigned with SetNearClip().
  323. /// </summary>
  324. private float GetNearClip ()
  325. {
  326. Runtime.ValidateRefCounted (this);
  327. return Camera_GetNearClip (handle);
  328. }
  329. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  330. internal static extern float Camera_GetSkew (IntPtr handle);
  331. /// <summary>
  332. /// Return skew.
  333. /// </summary>
  334. private float GetSkew ()
  335. {
  336. Runtime.ValidateRefCounted (this);
  337. return Camera_GetSkew (handle);
  338. }
  339. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  340. internal static extern float Camera_GetFov (IntPtr handle);
  341. /// <summary>
  342. /// Return vertical field of view in degrees.
  343. /// </summary>
  344. private float GetFov ()
  345. {
  346. Runtime.ValidateRefCounted (this);
  347. return Camera_GetFov (handle);
  348. }
  349. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  350. internal static extern float Camera_GetOrthoSize (IntPtr handle);
  351. /// <summary>
  352. /// Return orthographic mode size.
  353. /// </summary>
  354. private float GetOrthoSize ()
  355. {
  356. Runtime.ValidateRefCounted (this);
  357. return Camera_GetOrthoSize (handle);
  358. }
  359. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  360. internal static extern float Camera_GetAspectRatio (IntPtr handle);
  361. /// <summary>
  362. /// Return aspect ratio.
  363. /// </summary>
  364. private float GetAspectRatio ()
  365. {
  366. Runtime.ValidateRefCounted (this);
  367. return Camera_GetAspectRatio (handle);
  368. }
  369. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  370. internal static extern float Camera_GetZoom (IntPtr handle);
  371. /// <summary>
  372. /// Return zoom.
  373. /// </summary>
  374. private float GetZoom ()
  375. {
  376. Runtime.ValidateRefCounted (this);
  377. return Camera_GetZoom (handle);
  378. }
  379. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  380. internal static extern float Camera_GetLodBias (IntPtr handle);
  381. /// <summary>
  382. /// Return LOD bias.
  383. /// </summary>
  384. private float GetLodBias ()
  385. {
  386. Runtime.ValidateRefCounted (this);
  387. return Camera_GetLodBias (handle);
  388. }
  389. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  390. internal static extern uint Camera_GetViewMask (IntPtr handle);
  391. /// <summary>
  392. /// Return view mask.
  393. /// </summary>
  394. private uint GetViewMask ()
  395. {
  396. Runtime.ValidateRefCounted (this);
  397. return Camera_GetViewMask (handle);
  398. }
  399. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  400. internal static extern uint Camera_GetViewOverrideFlags (IntPtr handle);
  401. /// <summary>
  402. /// Return view override flags.
  403. /// </summary>
  404. private uint GetViewOverrideFlags ()
  405. {
  406. Runtime.ValidateRefCounted (this);
  407. return Camera_GetViewOverrideFlags (handle);
  408. }
  409. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  410. internal static extern FillMode Camera_GetFillMode (IntPtr handle);
  411. /// <summary>
  412. /// Return fill mode.
  413. /// </summary>
  414. private FillMode GetFillMode ()
  415. {
  416. Runtime.ValidateRefCounted (this);
  417. return Camera_GetFillMode (handle);
  418. }
  419. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  420. internal static extern bool Camera_IsOrthographic (IntPtr handle);
  421. /// <summary>
  422. /// Return orthographic flag.
  423. /// </summary>
  424. private bool IsOrthographic ()
  425. {
  426. Runtime.ValidateRefCounted (this);
  427. return Camera_IsOrthographic (handle);
  428. }
  429. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  430. internal static extern bool Camera_GetAutoAspectRatio (IntPtr handle);
  431. /// <summary>
  432. /// Return auto aspect ratio flag.
  433. /// </summary>
  434. private bool GetAutoAspectRatio ()
  435. {
  436. Runtime.ValidateRefCounted (this);
  437. return Camera_GetAutoAspectRatio (handle);
  438. }
  439. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  440. internal static extern IntPtr Camera_GetFrustum (IntPtr handle);
  441. /// <summary>
  442. /// Return frustum in world space.
  443. /// </summary>
  444. private Frustum GetFrustum ()
  445. {
  446. Runtime.ValidateRefCounted (this);
  447. return new Frustum (Camera_GetFrustum (handle));
  448. }
  449. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  450. internal static extern Matrix4 Camera_GetProjection (IntPtr handle);
  451. /// <summary>
  452. /// Return projection matrix. It's in D3D convention with depth range 0 - 1.
  453. /// </summary>
  454. private Matrix4 GetProjection ()
  455. {
  456. Runtime.ValidateRefCounted (this);
  457. return Camera_GetProjection (handle);
  458. }
  459. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  460. internal static extern Matrix4 Camera_GetGPUProjection (IntPtr handle);
  461. /// <summary>
  462. /// Return projection matrix converted to API-specific format for use as a shader parameter.
  463. /// </summary>
  464. private Matrix4 GetGPUProjection ()
  465. {
  466. Runtime.ValidateRefCounted (this);
  467. return Camera_GetGPUProjection (handle);
  468. }
  469. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  470. internal static extern Urho.Matrix3x4 Camera_GetView (IntPtr handle);
  471. /// <summary>
  472. /// Return view matrix.
  473. /// </summary>
  474. private Urho.Matrix3x4 GetView ()
  475. {
  476. Runtime.ValidateRefCounted (this);
  477. return Camera_GetView (handle);
  478. }
  479. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  480. internal static extern float Camera_GetHalfViewSize (IntPtr handle);
  481. /// <summary>
  482. /// Return half view size.
  483. /// </summary>
  484. private float GetHalfViewSize ()
  485. {
  486. Runtime.ValidateRefCounted (this);
  487. return Camera_GetHalfViewSize (handle);
  488. }
  489. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  490. internal static extern IntPtr Camera_GetSplitFrustum (IntPtr handle, float nearClip, float farClip);
  491. /// <summary>
  492. /// Return frustum split by custom near and far clip distances.
  493. /// </summary>
  494. public Frustum GetSplitFrustum (float nearClip, float farClip)
  495. {
  496. Runtime.ValidateRefCounted (this);
  497. return new Frustum (Camera_GetSplitFrustum (handle, nearClip, farClip));
  498. }
  499. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  500. internal static extern IntPtr Camera_GetViewSpaceFrustum (IntPtr handle);
  501. /// <summary>
  502. /// Return frustum in view space.
  503. /// </summary>
  504. private Frustum GetViewSpaceFrustum ()
  505. {
  506. Runtime.ValidateRefCounted (this);
  507. return new Frustum (Camera_GetViewSpaceFrustum (handle));
  508. }
  509. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  510. internal static extern IntPtr Camera_GetViewSpaceSplitFrustum (IntPtr handle, float nearClip, float farClip);
  511. /// <summary>
  512. /// Return split frustum in view space.
  513. /// </summary>
  514. public Frustum GetViewSpaceSplitFrustum (float nearClip, float farClip)
  515. {
  516. Runtime.ValidateRefCounted (this);
  517. return new Frustum (Camera_GetViewSpaceSplitFrustum (handle, nearClip, farClip));
  518. }
  519. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  520. internal static extern Ray Camera_GetScreenRay (IntPtr handle, float x, float y);
  521. /// <summary>
  522. /// Return ray corresponding to normalized screen coordinates (0 - 1), with origin on the near clip plane.
  523. /// </summary>
  524. public Ray GetScreenRay (float x, float y)
  525. {
  526. Runtime.ValidateRefCounted (this);
  527. return Camera_GetScreenRay (handle, x, y);
  528. }
  529. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  530. internal static extern Vector2 Camera_WorldToScreenPoint (IntPtr handle, ref Urho.Vector3 worldPos);
  531. /// <summary>
  532. /// Convert a world space point to normalized screen coordinates (0 - 1).
  533. /// </summary>
  534. public Vector2 WorldToScreenPoint (Urho.Vector3 worldPos)
  535. {
  536. Runtime.ValidateRefCounted (this);
  537. return Camera_WorldToScreenPoint (handle, ref worldPos);
  538. }
  539. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  540. internal static extern Vector3 Camera_ScreenToWorldPoint (IntPtr handle, ref Urho.Vector3 screenPos);
  541. /// <summary>
  542. /// Convert normalized screen coordinates (0 - 1) and distance along view Z axis (in Z coordinate) to a world space point. The distance can not be closer than the near clip plane.
  543. /// Note that a HitDistance() from the camera screen ray is not the same as distance along the view Z axis, as under a perspective projection the ray is likely to not be Z-aligned.
  544. /// </summary>
  545. public Vector3 ScreenToWorldPoint (Urho.Vector3 screenPos)
  546. {
  547. Runtime.ValidateRefCounted (this);
  548. return Camera_ScreenToWorldPoint (handle, ref screenPos);
  549. }
  550. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  551. internal static extern Urho.Vector2 Camera_GetProjectionOffset (IntPtr handle);
  552. /// <summary>
  553. /// Return projection offset.
  554. /// </summary>
  555. private Urho.Vector2 GetProjectionOffset ()
  556. {
  557. Runtime.ValidateRefCounted (this);
  558. return Camera_GetProjectionOffset (handle);
  559. }
  560. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  561. internal static extern bool Camera_GetUseReflection (IntPtr handle);
  562. /// <summary>
  563. /// Return whether is using reflection.
  564. /// </summary>
  565. private bool GetUseReflection ()
  566. {
  567. Runtime.ValidateRefCounted (this);
  568. return Camera_GetUseReflection (handle);
  569. }
  570. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  571. internal static extern Urho.Plane Camera_GetReflectionPlane (IntPtr handle);
  572. /// <summary>
  573. /// Return the reflection plane.
  574. /// </summary>
  575. private Urho.Plane GetReflectionPlane ()
  576. {
  577. Runtime.ValidateRefCounted (this);
  578. return Camera_GetReflectionPlane (handle);
  579. }
  580. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  581. internal static extern bool Camera_GetUseClipping (IntPtr handle);
  582. /// <summary>
  583. /// Return whether is using a custom clipping plane.
  584. /// </summary>
  585. private bool GetUseClipping ()
  586. {
  587. Runtime.ValidateRefCounted (this);
  588. return Camera_GetUseClipping (handle);
  589. }
  590. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  591. internal static extern Urho.Plane Camera_GetClipPlane (IntPtr handle);
  592. /// <summary>
  593. /// Return the custom clipping plane.
  594. /// </summary>
  595. private Urho.Plane GetClipPlane ()
  596. {
  597. Runtime.ValidateRefCounted (this);
  598. return Camera_GetClipPlane (handle);
  599. }
  600. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  601. internal static extern bool Camera_GetFlipVertical (IntPtr handle);
  602. /// <summary>
  603. /// Return vertical flipping mode.
  604. /// </summary>
  605. private bool GetFlipVertical ()
  606. {
  607. Runtime.ValidateRefCounted (this);
  608. return Camera_GetFlipVertical (handle);
  609. }
  610. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  611. internal static extern bool Camera_GetReverseCulling (IntPtr handle);
  612. /// <summary>
  613. /// Return whether to reverse culling; affected by vertical flipping and reflection.
  614. /// </summary>
  615. private bool GetReverseCulling ()
  616. {
  617. Runtime.ValidateRefCounted (this);
  618. return Camera_GetReverseCulling (handle);
  619. }
  620. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  621. internal static extern float Camera_GetDistance (IntPtr handle, ref Urho.Vector3 worldPos);
  622. /// <summary>
  623. /// Return distance to position. In orthographic mode uses only Z coordinate.
  624. /// </summary>
  625. public float GetDistance (Urho.Vector3 worldPos)
  626. {
  627. Runtime.ValidateRefCounted (this);
  628. return Camera_GetDistance (handle, ref worldPos);
  629. }
  630. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  631. internal static extern float Camera_GetDistanceSquared (IntPtr handle, ref Urho.Vector3 worldPos);
  632. /// <summary>
  633. /// Return squared distance to position. In orthographic mode uses only Z coordinate.
  634. /// </summary>
  635. public float GetDistanceSquared (Urho.Vector3 worldPos)
  636. {
  637. Runtime.ValidateRefCounted (this);
  638. return Camera_GetDistanceSquared (handle, ref worldPos);
  639. }
  640. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  641. internal static extern float Camera_GetLodDistance (IntPtr handle, float distance, float scale, float bias);
  642. /// <summary>
  643. /// Return a scene node's LOD scaled distance.
  644. /// </summary>
  645. public float GetLodDistance (float distance, float scale, float bias)
  646. {
  647. Runtime.ValidateRefCounted (this);
  648. return Camera_GetLodDistance (handle, distance, scale, bias);
  649. }
  650. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  651. internal static extern Quaternion Camera_GetFaceCameraRotation (IntPtr handle, ref Urho.Vector3 position, ref Urho.Quaternion rotation, FaceCameraMode mode, float minAngle);
  652. /// <summary>
  653. /// Return a world rotation for facing a camera on certain axes based on the existing world rotation.
  654. /// </summary>
  655. public Quaternion GetFaceCameraRotation (Urho.Vector3 position, Urho.Quaternion rotation, FaceCameraMode mode, float minAngle = 0f)
  656. {
  657. Runtime.ValidateRefCounted (this);
  658. return Camera_GetFaceCameraRotation (handle, ref position, ref rotation, mode, minAngle);
  659. }
  660. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  661. internal static extern Matrix3x4 Camera_GetEffectiveWorldTransform (IntPtr handle);
  662. /// <summary>
  663. /// Get effective world transform for matrix and frustum calculations including reflection but excluding node scaling.
  664. /// </summary>
  665. private Matrix3x4 GetEffectiveWorldTransform ()
  666. {
  667. Runtime.ValidateRefCounted (this);
  668. return Camera_GetEffectiveWorldTransform (handle);
  669. }
  670. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  671. internal static extern bool Camera_IsProjectionValid (IntPtr handle);
  672. /// <summary>
  673. /// Return if projection parameters are valid for rendering and raycasting.
  674. /// </summary>
  675. private bool IsProjectionValid ()
  676. {
  677. Runtime.ValidateRefCounted (this);
  678. return Camera_IsProjectionValid (handle);
  679. }
  680. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  681. internal static extern void Camera_SetAspectRatioInternal (IntPtr handle, float aspectRatio);
  682. /// <summary>
  683. /// Set aspect ratio without disabling the "auto aspect ratio" mode. Called internally by View.
  684. /// </summary>
  685. public void SetAspectRatioInternal (float aspectRatio)
  686. {
  687. Runtime.ValidateRefCounted (this);
  688. Camera_SetAspectRatioInternal (handle, aspectRatio);
  689. }
  690. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  691. internal static extern void Camera_SetOrthoSizeAttr (IntPtr handle, float orthoSize);
  692. /// <summary>
  693. /// Set orthographic size attribute without forcing the aspect ratio.
  694. /// </summary>
  695. public void SetOrthoSizeAttr (float orthoSize)
  696. {
  697. Runtime.ValidateRefCounted (this);
  698. Camera_SetOrthoSizeAttr (handle, orthoSize);
  699. }
  700. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  701. internal static extern void Camera_SetReflectionPlaneAttr (IntPtr handle, ref Urho.Vector4 value);
  702. /// <summary>
  703. /// Set reflection plane attribute.
  704. /// </summary>
  705. public void SetReflectionPlaneAttr (Urho.Vector4 value)
  706. {
  707. Runtime.ValidateRefCounted (this);
  708. Camera_SetReflectionPlaneAttr (handle, ref value);
  709. }
  710. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  711. internal static extern Vector4 Camera_GetReflectionPlaneAttr (IntPtr handle);
  712. /// <summary>
  713. /// Return reflection plane attribute.
  714. /// </summary>
  715. private Vector4 GetReflectionPlaneAttr ()
  716. {
  717. Runtime.ValidateRefCounted (this);
  718. return Camera_GetReflectionPlaneAttr (handle);
  719. }
  720. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  721. internal static extern void Camera_SetClipPlaneAttr (IntPtr handle, ref Urho.Vector4 value);
  722. /// <summary>
  723. /// Set clipping plane attribute.
  724. /// </summary>
  725. public void SetClipPlaneAttr (Urho.Vector4 value)
  726. {
  727. Runtime.ValidateRefCounted (this);
  728. Camera_SetClipPlaneAttr (handle, ref value);
  729. }
  730. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  731. internal static extern Vector4 Camera_GetClipPlaneAttr (IntPtr handle);
  732. /// <summary>
  733. /// Return clipping plane attribute.
  734. /// </summary>
  735. private Vector4 GetClipPlaneAttr ()
  736. {
  737. Runtime.ValidateRefCounted (this);
  738. return Camera_GetClipPlaneAttr (handle);
  739. }
  740. public override StringHash Type {
  741. get {
  742. return UrhoGetType ();
  743. }
  744. }
  745. public override string TypeName {
  746. get {
  747. return GetTypeName ();
  748. }
  749. }
  750. [Preserve]
  751. public new static StringHash TypeStatic {
  752. get {
  753. return GetTypeStatic ();
  754. }
  755. }
  756. public new static string TypeNameStatic {
  757. get {
  758. return GetTypeNameStatic ();
  759. }
  760. }
  761. /// <summary>
  762. /// Return near clip distance. If a custom projection matrix is in use, is calculated from it instead of the value assigned with SetNearClip().
  763. /// Or
  764. /// Set near clip distance.
  765. /// </summary>
  766. public float NearClip {
  767. get {
  768. return GetNearClip ();
  769. }
  770. set {
  771. SetNearClip (value);
  772. }
  773. }
  774. /// <summary>
  775. /// Return far clip distance. If a custom projection matrix is in use, is calculated from it instead of the value assigned with SetFarClip().
  776. /// Or
  777. /// Set far clip distance.
  778. /// </summary>
  779. public float FarClip {
  780. get {
  781. return GetFarClip ();
  782. }
  783. set {
  784. SetFarClip (value);
  785. }
  786. }
  787. /// <summary>
  788. /// Return vertical field of view in degrees.
  789. /// Or
  790. /// Set vertical field of view in degrees.
  791. /// </summary>
  792. public float Fov {
  793. get {
  794. return GetFov ();
  795. }
  796. set {
  797. SetFov (value);
  798. }
  799. }
  800. /// <summary>
  801. /// Return skew.
  802. /// Or
  803. /// Set skew
  804. /// </summary>
  805. public float Skew {
  806. get {
  807. return GetSkew ();
  808. }
  809. set {
  810. SetSkew (value);
  811. }
  812. }
  813. /// <summary>
  814. /// Return orthographic mode size.
  815. /// Or
  816. /// Set orthographic mode view uniform size.
  817. /// </summary>
  818. public float OrthoSize {
  819. get {
  820. return GetOrthoSize ();
  821. }
  822. set {
  823. SetOrthoSize (value);
  824. }
  825. }
  826. /// <summary>
  827. /// Return aspect ratio.
  828. /// Or
  829. /// Set aspect ratio manually. Disables the auto aspect ratio -mode.
  830. /// </summary>
  831. public float AspectRatio {
  832. get {
  833. return GetAspectRatio ();
  834. }
  835. set {
  836. SetAspectRatio (value);
  837. }
  838. }
  839. /// <summary>
  840. /// Return fill mode.
  841. /// Or
  842. /// Set polygon fill mode to use when rendering a scene.
  843. /// </summary>
  844. public FillMode FillMode {
  845. get {
  846. return GetFillMode ();
  847. }
  848. set {
  849. SetFillMode (value);
  850. }
  851. }
  852. /// <summary>
  853. /// Return zoom.
  854. /// Or
  855. /// Set zoom.
  856. /// </summary>
  857. public float Zoom {
  858. get {
  859. return GetZoom ();
  860. }
  861. set {
  862. SetZoom (value);
  863. }
  864. }
  865. /// <summary>
  866. /// Return LOD bias.
  867. /// Or
  868. /// Set LOD bias.
  869. /// </summary>
  870. public float LodBias {
  871. get {
  872. return GetLodBias ();
  873. }
  874. set {
  875. SetLodBias (value);
  876. }
  877. }
  878. /// <summary>
  879. /// Return view mask.
  880. /// Or
  881. /// Set view mask. Will be and'ed with object's view mask to see if the object should be rendered.
  882. /// </summary>
  883. public uint ViewMask {
  884. get {
  885. return GetViewMask ();
  886. }
  887. set {
  888. SetViewMask (value);
  889. }
  890. }
  891. /// <summary>
  892. /// Return view override flags.
  893. /// Or
  894. /// Set view override flags.
  895. /// </summary>
  896. public ViewOverrideFlags ViewOverrideFlags {
  897. get {
  898. return (ViewOverrideFlags)GetViewOverrideFlags ();
  899. }
  900. set {
  901. SetViewOverrideFlags ((uint)value);
  902. }
  903. }
  904. /// <summary>
  905. /// Return orthographic flag.
  906. /// Or
  907. /// Set orthographic mode enabled/disabled.
  908. /// </summary>
  909. public bool Orthographic {
  910. get {
  911. return IsOrthographic ();
  912. }
  913. set {
  914. SetOrthographic (value);
  915. }
  916. }
  917. /// <summary>
  918. /// Return auto aspect ratio flag.
  919. /// Or
  920. /// Set automatic aspect ratio based on viewport dimensions. Enabled by default.
  921. /// </summary>
  922. public bool AutoAspectRatio {
  923. get {
  924. return GetAutoAspectRatio ();
  925. }
  926. set {
  927. SetAutoAspectRatio (value);
  928. }
  929. }
  930. /// <summary>
  931. /// Return projection offset.
  932. /// Or
  933. /// Set projection offset. It needs to be calculated as (offset in pixels) / (viewport dimensions.)
  934. /// </summary>
  935. public Urho.Vector2 ProjectionOffset {
  936. get {
  937. return GetProjectionOffset ();
  938. }
  939. set {
  940. SetProjectionOffset (value);
  941. }
  942. }
  943. /// <summary>
  944. /// Return whether is using reflection.
  945. /// Or
  946. /// Set reflection mode.
  947. /// </summary>
  948. public bool UseReflection {
  949. get {
  950. return GetUseReflection ();
  951. }
  952. set {
  953. SetUseReflection (value);
  954. }
  955. }
  956. /// <summary>
  957. /// Return the reflection plane.
  958. /// Or
  959. /// Set reflection plane in world space for reflection mode.
  960. /// </summary>
  961. public Urho.Plane ReflectionPlane {
  962. get {
  963. return GetReflectionPlane ();
  964. }
  965. set {
  966. SetReflectionPlane (value);
  967. }
  968. }
  969. /// <summary>
  970. /// Return whether is using a custom clipping plane.
  971. /// Or
  972. /// Set whether to use a custom clip plane.
  973. /// </summary>
  974. public bool UseClipping {
  975. get {
  976. return GetUseClipping ();
  977. }
  978. set {
  979. SetUseClipping (value);
  980. }
  981. }
  982. /// <summary>
  983. /// Return the custom clipping plane.
  984. /// Or
  985. /// Set custom clipping plane in world space.
  986. /// </summary>
  987. public Urho.Plane ClipPlane {
  988. get {
  989. return GetClipPlane ();
  990. }
  991. set {
  992. SetClipPlane (value);
  993. }
  994. }
  995. /// <summary>
  996. /// Return vertical flipping mode.
  997. /// Or
  998. /// Set vertical flipping mode. Called internally by View to resolve OpenGL / Direct3D9 rendertarget sampling differences.
  999. /// </summary>
  1000. public bool FlipVertical {
  1001. get {
  1002. return GetFlipVertical ();
  1003. }
  1004. set {
  1005. SetFlipVertical (value);
  1006. }
  1007. }
  1008. /// <summary>
  1009. /// Return projection matrix. It's in D3D convention with depth range 0 - 1.
  1010. /// </summary>
  1011. public Matrix4 Projection {
  1012. get {
  1013. return GetProjection ();
  1014. }
  1015. }
  1016. /// <summary>
  1017. /// Return frustum in world space.
  1018. /// </summary>
  1019. public Frustum Frustum {
  1020. get {
  1021. return GetFrustum ();
  1022. }
  1023. }
  1024. /// <summary>
  1025. /// Return projection matrix converted to API-specific format for use as a shader parameter.
  1026. /// </summary>
  1027. public Matrix4 GPUProjection {
  1028. get {
  1029. return GetGPUProjection ();
  1030. }
  1031. }
  1032. /// <summary>
  1033. /// Return view matrix.
  1034. /// </summary>
  1035. public Urho.Matrix3x4 View {
  1036. get {
  1037. return GetView ();
  1038. }
  1039. }
  1040. /// <summary>
  1041. /// Return half view size.
  1042. /// </summary>
  1043. public float HalfViewSize {
  1044. get {
  1045. return GetHalfViewSize ();
  1046. }
  1047. }
  1048. /// <summary>
  1049. /// Return frustum in view space.
  1050. /// </summary>
  1051. public Frustum ViewSpaceFrustum {
  1052. get {
  1053. return GetViewSpaceFrustum ();
  1054. }
  1055. }
  1056. /// <summary>
  1057. /// Return whether to reverse culling; affected by vertical flipping and reflection.
  1058. /// </summary>
  1059. public bool ReverseCulling {
  1060. get {
  1061. return GetReverseCulling ();
  1062. }
  1063. }
  1064. /// <summary>
  1065. /// Get effective world transform for matrix and frustum calculations including reflection but excluding node scaling.
  1066. /// </summary>
  1067. public Matrix3x4 EffectiveWorldTransform {
  1068. get {
  1069. return GetEffectiveWorldTransform ();
  1070. }
  1071. }
  1072. /// <summary>
  1073. /// Return if projection parameters are valid for rendering and raycasting.
  1074. /// </summary>
  1075. public bool ProjectionValid {
  1076. get {
  1077. return IsProjectionValid ();
  1078. }
  1079. }
  1080. /// <summary>
  1081. /// Return reflection plane attribute.
  1082. /// </summary>
  1083. public Vector4 ReflectionPlaneAttr {
  1084. get {
  1085. return GetReflectionPlaneAttr ();
  1086. }
  1087. }
  1088. /// <summary>
  1089. /// Return clipping plane attribute.
  1090. /// </summary>
  1091. public Vector4 ClipPlaneAttr {
  1092. get {
  1093. return GetClipPlaneAttr ();
  1094. }
  1095. }
  1096. }
  1097. }