View.cs 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499
  1. // WARNING - AUTOGENERATED - DO NOT EDIT
  2. //
  3. // Generated using `sharpie urho`
  4. //
  5. // View.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. /// Internal structure for 3D rendering work. Created for each backbuffer and texture viewport, but not for shadow cameras.
  21. /// </summary>
  22. public unsafe partial class View : UrhoObject
  23. {
  24. unsafe partial void OnViewCreated ();
  25. [Preserve]
  26. public View (IntPtr handle) : base (handle)
  27. {
  28. OnViewCreated ();
  29. }
  30. [Preserve]
  31. protected View (UrhoObjectFlag emptyFlag) : base (emptyFlag)
  32. {
  33. OnViewCreated ();
  34. }
  35. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  36. internal static extern int View_GetType (IntPtr handle);
  37. private StringHash UrhoGetType ()
  38. {
  39. Runtime.ValidateRefCounted (this);
  40. return new StringHash (View_GetType (handle));
  41. }
  42. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  43. internal static extern IntPtr View_GetTypeName (IntPtr handle);
  44. private string GetTypeName ()
  45. {
  46. Runtime.ValidateRefCounted (this);
  47. return Marshal.PtrToStringAnsi (View_GetTypeName (handle));
  48. }
  49. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  50. internal static extern int View_GetTypeStatic ();
  51. private static StringHash GetTypeStatic ()
  52. {
  53. Runtime.Validate (typeof(View));
  54. return new StringHash (View_GetTypeStatic ());
  55. }
  56. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  57. internal static extern IntPtr View_GetTypeNameStatic ();
  58. private static string GetTypeNameStatic ()
  59. {
  60. Runtime.Validate (typeof(View));
  61. return Marshal.PtrToStringAnsi (View_GetTypeNameStatic ());
  62. }
  63. [Preserve]
  64. public View () : this (Application.CurrentContext)
  65. {
  66. }
  67. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  68. internal static extern IntPtr View_View (IntPtr context);
  69. [Preserve]
  70. public View (Context context) : base (UrhoObjectFlag.Empty)
  71. {
  72. Runtime.Validate (typeof(View));
  73. handle = View_View ((object)context == null ? IntPtr.Zero : context.Handle);
  74. Runtime.RegisterObject (this);
  75. OnViewCreated ();
  76. }
  77. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  78. internal static extern bool View_Define (IntPtr handle, IntPtr renderTarget, IntPtr viewport);
  79. /// <summary>
  80. /// Define with rendertarget and viewport. Return true if successful.
  81. /// </summary>
  82. public bool Define (RenderSurface renderTarget, Viewport viewport)
  83. {
  84. Runtime.ValidateRefCounted (this);
  85. return View_Define (handle, (object)renderTarget == null ? IntPtr.Zero : renderTarget.Handle, (object)viewport == null ? IntPtr.Zero : viewport.Handle);
  86. }
  87. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  88. internal static extern void View_Render (IntPtr handle);
  89. /// <summary>
  90. /// Render batches.
  91. /// </summary>
  92. public void Render ()
  93. {
  94. Runtime.ValidateRefCounted (this);
  95. View_Render (handle);
  96. }
  97. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  98. internal static extern IntPtr View_GetGraphics (IntPtr handle);
  99. /// <summary>
  100. /// Return graphics subsystem.
  101. /// </summary>
  102. private Graphics GetGraphics ()
  103. {
  104. Runtime.ValidateRefCounted (this);
  105. return Runtime.LookupObject<Graphics> (View_GetGraphics (handle));
  106. }
  107. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  108. internal static extern IntPtr View_GetRenderer (IntPtr handle);
  109. /// <summary>
  110. /// Return renderer subsystem.
  111. /// </summary>
  112. private Renderer GetRenderer ()
  113. {
  114. Runtime.ValidateRefCounted (this);
  115. return Runtime.LookupObject<Renderer> (View_GetRenderer (handle));
  116. }
  117. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  118. internal static extern IntPtr View_GetScene (IntPtr handle);
  119. /// <summary>
  120. /// Return scene.
  121. /// </summary>
  122. private Scene GetScene ()
  123. {
  124. Runtime.ValidateRefCounted (this);
  125. return Runtime.LookupObject<Scene> (View_GetScene (handle));
  126. }
  127. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  128. internal static extern IntPtr View_GetOctree (IntPtr handle);
  129. /// <summary>
  130. /// Return octree.
  131. /// </summary>
  132. private Octree GetOctree ()
  133. {
  134. Runtime.ValidateRefCounted (this);
  135. return Runtime.LookupObject<Octree> (View_GetOctree (handle));
  136. }
  137. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  138. internal static extern IntPtr View_GetCamera (IntPtr handle);
  139. /// <summary>
  140. /// Return viewport camera.
  141. /// </summary>
  142. private Camera GetCamera ()
  143. {
  144. Runtime.ValidateRefCounted (this);
  145. return Runtime.LookupObject<Camera> (View_GetCamera (handle));
  146. }
  147. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  148. internal static extern IntPtr View_GetCullCamera (IntPtr handle);
  149. /// <summary>
  150. /// Return culling camera. Normally same as the viewport camera.
  151. /// </summary>
  152. private Camera GetCullCamera ()
  153. {
  154. Runtime.ValidateRefCounted (this);
  155. return Runtime.LookupObject<Camera> (View_GetCullCamera (handle));
  156. }
  157. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  158. internal static extern IntPtr View_GetRenderTarget (IntPtr handle);
  159. /// <summary>
  160. /// Return the rendertarget. 0 if using the backbuffer.
  161. /// </summary>
  162. private RenderSurface GetRenderTarget ()
  163. {
  164. Runtime.ValidateRefCounted (this);
  165. return Runtime.LookupRefCounted<RenderSurface> (View_GetRenderTarget (handle));
  166. }
  167. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  168. internal static extern bool View_GetDrawDebug (IntPtr handle);
  169. /// <summary>
  170. /// Return whether should draw debug geometry.
  171. /// </summary>
  172. private bool GetDrawDebug ()
  173. {
  174. Runtime.ValidateRefCounted (this);
  175. return View_GetDrawDebug (handle);
  176. }
  177. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  178. internal static extern Urho.IntRect View_GetViewRect (IntPtr handle);
  179. /// <summary>
  180. /// Return view rectangle.
  181. /// </summary>
  182. private Urho.IntRect GetViewRect ()
  183. {
  184. Runtime.ValidateRefCounted (this);
  185. return View_GetViewRect (handle);
  186. }
  187. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  188. internal static extern Urho.IntVector2 View_GetViewSize (IntPtr handle);
  189. /// <summary>
  190. /// Return view dimensions.
  191. /// </summary>
  192. private Urho.IntVector2 GetViewSize ()
  193. {
  194. Runtime.ValidateRefCounted (this);
  195. return View_GetViewSize (handle);
  196. }
  197. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  198. internal static extern IntPtr View_GetOcclusionBuffer (IntPtr handle);
  199. /// <summary>
  200. /// Return the last used software occlusion buffer.
  201. /// </summary>
  202. private OcclusionBuffer GetOcclusionBuffer ()
  203. {
  204. Runtime.ValidateRefCounted (this);
  205. return Runtime.LookupObject<OcclusionBuffer> (View_GetOcclusionBuffer (handle));
  206. }
  207. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  208. internal static extern uint View_GetNumActiveOccluders (IntPtr handle);
  209. /// <summary>
  210. /// Return number of occluders that were actually rendered. Occluders may be rejected if running out of triangles or if behind other occluders.
  211. /// </summary>
  212. private uint GetNumActiveOccluders ()
  213. {
  214. Runtime.ValidateRefCounted (this);
  215. return View_GetNumActiveOccluders (handle);
  216. }
  217. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  218. internal static extern IntPtr View_GetSourceView (IntPtr handle);
  219. /// <summary>
  220. /// Return the source view that was already prepared. Used when viewports specify the same culling camera.
  221. /// </summary>
  222. private View GetSourceView ()
  223. {
  224. Runtime.ValidateRefCounted (this);
  225. return Runtime.LookupObject<View> (View_GetSourceView (handle));
  226. }
  227. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  228. internal static extern void View_SetGlobalShaderParameters (IntPtr handle);
  229. /// <summary>
  230. /// Set global (per-frame) shader parameters. Called by Batch and internally by View.
  231. /// </summary>
  232. public void SetGlobalShaderParameters ()
  233. {
  234. Runtime.ValidateRefCounted (this);
  235. View_SetGlobalShaderParameters (handle);
  236. }
  237. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  238. internal static extern void View_SetCameraShaderParameters (IntPtr handle, IntPtr camera);
  239. /// <summary>
  240. /// Set camera-specific shader parameters. Called by Batch and internally by View.
  241. /// </summary>
  242. public void SetCameraShaderParameters (Camera camera)
  243. {
  244. Runtime.ValidateRefCounted (this);
  245. View_SetCameraShaderParameters (handle, (object)camera == null ? IntPtr.Zero : camera.Handle);
  246. }
  247. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  248. internal static extern void View_SetCommandShaderParameters (IntPtr handle, ref Urho.RenderPathCommand command);
  249. /// <summary>
  250. /// Set command's shader parameters if any. Called internally by View.
  251. /// </summary>
  252. public void SetCommandShaderParameters (Urho.RenderPathCommand command)
  253. {
  254. Runtime.ValidateRefCounted (this);
  255. View_SetCommandShaderParameters (handle, ref command);
  256. }
  257. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  258. internal static extern void View_SetGBufferShaderParameters (IntPtr handle, ref Urho.IntVector2 texSize, ref Urho.IntRect viewRect);
  259. /// <summary>
  260. /// Set G-buffer offset and inverse size shader parameters. Called by Batch and internally by View.
  261. /// </summary>
  262. public void SetGBufferShaderParameters (Urho.IntVector2 texSize, Urho.IntRect viewRect)
  263. {
  264. Runtime.ValidateRefCounted (this);
  265. View_SetGBufferShaderParameters (handle, ref texSize, ref viewRect);
  266. }
  267. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  268. internal static extern void View_SetStereoMode (IntPtr handle, bool stereo);
  269. /// <summary>
  270. /// Set stereo mode
  271. /// </summary>
  272. public void SetStereoMode (bool stereo)
  273. {
  274. Runtime.ValidateRefCounted (this);
  275. View_SetStereoMode (handle, stereo);
  276. }
  277. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  278. internal static extern void View_DrawFullscreenQuad (IntPtr handle, bool setIdentityProjection);
  279. /// <summary>
  280. /// Draw a fullscreen quad. Shaders and renderstates must have been set beforehand. Quad will be drawn to the middle of depth range, similarly to deferred directional lights.
  281. /// </summary>
  282. public void DrawFullscreenQuad (bool setIdentityProjection = false)
  283. {
  284. Runtime.ValidateRefCounted (this);
  285. View_DrawFullscreenQuad (handle, setIdentityProjection);
  286. }
  287. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  288. internal static extern IntPtr View_FindNamedTexture (IntPtr handle, string name, bool isRenderTarget, bool isVolumeMap);
  289. /// <summary>
  290. /// Get a named texture from the rendertarget list or from the resource cache, to be either used as a rendertarget or texture binding.
  291. /// </summary>
  292. public Texture FindNamedTexture (string name, bool isRenderTarget, bool isVolumeMap = false)
  293. {
  294. Runtime.ValidateRefCounted (this);
  295. return Runtime.LookupObject<Texture> (View_FindNamedTexture (handle, name, isRenderTarget, isVolumeMap));
  296. }
  297. public override StringHash Type {
  298. get {
  299. return UrhoGetType ();
  300. }
  301. }
  302. public override string TypeName {
  303. get {
  304. return GetTypeName ();
  305. }
  306. }
  307. [Preserve]
  308. public static StringHash TypeStatic {
  309. get {
  310. return GetTypeStatic ();
  311. }
  312. }
  313. public static string TypeNameStatic {
  314. get {
  315. return GetTypeNameStatic ();
  316. }
  317. }
  318. /// <summary>
  319. /// Return graphics subsystem.
  320. /// </summary>
  321. public Graphics Graphics {
  322. get {
  323. return GetGraphics ();
  324. }
  325. }
  326. /// <summary>
  327. /// Return renderer subsystem.
  328. /// </summary>
  329. public Renderer Renderer {
  330. get {
  331. return GetRenderer ();
  332. }
  333. }
  334. /// <summary>
  335. /// Return scene.
  336. /// </summary>
  337. public Scene Scene {
  338. get {
  339. return GetScene ();
  340. }
  341. }
  342. /// <summary>
  343. /// Return octree.
  344. /// </summary>
  345. public Octree Octree {
  346. get {
  347. return GetOctree ();
  348. }
  349. }
  350. /// <summary>
  351. /// Return viewport camera.
  352. /// </summary>
  353. public Camera Camera {
  354. get {
  355. return GetCamera ();
  356. }
  357. }
  358. /// <summary>
  359. /// Return culling camera. Normally same as the viewport camera.
  360. /// </summary>
  361. public Camera CullCamera {
  362. get {
  363. return GetCullCamera ();
  364. }
  365. }
  366. /// <summary>
  367. /// Return the rendertarget. 0 if using the backbuffer.
  368. /// </summary>
  369. public RenderSurface RenderTarget {
  370. get {
  371. return GetRenderTarget ();
  372. }
  373. }
  374. /// <summary>
  375. /// Return whether should draw debug geometry.
  376. /// </summary>
  377. public bool DrawDebug {
  378. get {
  379. return GetDrawDebug ();
  380. }
  381. }
  382. /// <summary>
  383. /// Return view rectangle.
  384. /// </summary>
  385. public Urho.IntRect ViewRect {
  386. get {
  387. return GetViewRect ();
  388. }
  389. }
  390. /// <summary>
  391. /// Return view dimensions.
  392. /// </summary>
  393. public Urho.IntVector2 ViewSize {
  394. get {
  395. return GetViewSize ();
  396. }
  397. }
  398. /// <summary>
  399. /// Return the last used software occlusion buffer.
  400. /// </summary>
  401. public OcclusionBuffer OcclusionBuffer {
  402. get {
  403. return GetOcclusionBuffer ();
  404. }
  405. }
  406. /// <summary>
  407. /// Return number of occluders that were actually rendered. Occluders may be rejected if running out of triangles or if behind other occluders.
  408. /// </summary>
  409. public uint NumActiveOccluders {
  410. get {
  411. return GetNumActiveOccluders ();
  412. }
  413. }
  414. /// <summary>
  415. /// Return the source view that was already prepared. Used when viewports specify the same culling camera.
  416. /// </summary>
  417. public View SourceView {
  418. get {
  419. return GetSourceView ();
  420. }
  421. }
  422. }
  423. }