View3D.cs 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347
  1. // WARNING - AUTOGENERATED - DO NOT EDIT
  2. //
  3. // Generated using `sharpie urho`
  4. //
  5. // View3D.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.Gui
  18. {
  19. /// <summary>
  20. /// %UI element which renders a 3D scene.
  21. /// </summary>
  22. public unsafe partial class View3D : Window
  23. {
  24. unsafe partial void OnView3DCreated ();
  25. [Preserve]
  26. public View3D (IntPtr handle) : base (handle)
  27. {
  28. OnView3DCreated ();
  29. }
  30. [Preserve]
  31. protected View3D (UrhoObjectFlag emptyFlag) : base (emptyFlag)
  32. {
  33. OnView3DCreated ();
  34. }
  35. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  36. internal static extern int View3D_GetType (IntPtr handle);
  37. private StringHash UrhoGetType ()
  38. {
  39. Runtime.ValidateRefCounted (this);
  40. return new StringHash (View3D_GetType (handle));
  41. }
  42. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  43. internal static extern IntPtr View3D_GetTypeName (IntPtr handle);
  44. private string GetTypeName ()
  45. {
  46. Runtime.ValidateRefCounted (this);
  47. return Marshal.PtrToStringAnsi (View3D_GetTypeName (handle));
  48. }
  49. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  50. internal static extern int View3D_GetTypeStatic ();
  51. private static StringHash GetTypeStatic ()
  52. {
  53. Runtime.Validate (typeof(View3D));
  54. return new StringHash (View3D_GetTypeStatic ());
  55. }
  56. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  57. internal static extern IntPtr View3D_GetTypeNameStatic ();
  58. private static string GetTypeNameStatic ()
  59. {
  60. Runtime.Validate (typeof(View3D));
  61. return Marshal.PtrToStringAnsi (View3D_GetTypeNameStatic ());
  62. }
  63. [Preserve]
  64. public View3D () : this (Application.CurrentContext)
  65. {
  66. }
  67. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  68. internal static extern IntPtr View3D_View3D (IntPtr context);
  69. [Preserve]
  70. public View3D (Context context) : base (UrhoObjectFlag.Empty)
  71. {
  72. Runtime.Validate (typeof(View3D));
  73. handle = View3D_View3D ((object)context == null ? IntPtr.Zero : context.Handle);
  74. Runtime.RegisterObject (this);
  75. OnView3DCreated ();
  76. }
  77. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  78. internal static extern void View3D_RegisterObject (IntPtr context);
  79. /// <summary>
  80. /// Register object factory.
  81. /// </summary>
  82. public new static void RegisterObject (Context context)
  83. {
  84. Runtime.Validate (typeof(View3D));
  85. View3D_RegisterObject ((object)context == null ? IntPtr.Zero : context.Handle);
  86. }
  87. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  88. internal static extern void View3D_OnResize (IntPtr handle, ref Urho.IntVector2 newSize, ref Urho.IntVector2 delta);
  89. /// <summary>
  90. /// React to resize.
  91. /// </summary>
  92. public override void OnResize (Urho.IntVector2 newSize, Urho.IntVector2 delta)
  93. {
  94. Runtime.ValidateRefCounted (this);
  95. View3D_OnResize (handle, ref newSize, ref delta);
  96. }
  97. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  98. internal static extern void View3D_SetView (IntPtr handle, IntPtr scene, IntPtr camera, bool ownScene);
  99. /// <summary>
  100. /// Define the scene and camera to use in rendering. When ownScene is true the View3D will take ownership of them with shared pointers.
  101. /// </summary>
  102. public void SetView (Scene scene, Camera camera, bool ownScene = true)
  103. {
  104. Runtime.ValidateRefCounted (this);
  105. View3D_SetView (handle, (object)scene == null ? IntPtr.Zero : scene.Handle, (object)camera == null ? IntPtr.Zero : camera.Handle, ownScene);
  106. }
  107. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  108. internal static extern void View3D_SetFormat (IntPtr handle, uint format);
  109. /// <summary>
  110. /// Set render texture pixel format. Default is RGB.
  111. /// </summary>
  112. private void SetFormat (uint format)
  113. {
  114. Runtime.ValidateRefCounted (this);
  115. View3D_SetFormat (handle, format);
  116. }
  117. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  118. internal static extern void View3D_SetAutoUpdate (IntPtr handle, bool enable);
  119. /// <summary>
  120. /// Set render target auto update mode. Default is true.
  121. /// </summary>
  122. private void SetAutoUpdate (bool enable)
  123. {
  124. Runtime.ValidateRefCounted (this);
  125. View3D_SetAutoUpdate (handle, enable);
  126. }
  127. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  128. internal static extern void View3D_QueueUpdate (IntPtr handle);
  129. /// <summary>
  130. /// Queue manual update on the render texture.
  131. /// </summary>
  132. public void QueueUpdate ()
  133. {
  134. Runtime.ValidateRefCounted (this);
  135. View3D_QueueUpdate (handle);
  136. }
  137. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  138. internal static extern uint View3D_GetFormat (IntPtr handle);
  139. /// <summary>
  140. /// Return render texture pixel format.
  141. /// </summary>
  142. private uint GetFormat ()
  143. {
  144. Runtime.ValidateRefCounted (this);
  145. return View3D_GetFormat (handle);
  146. }
  147. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  148. internal static extern bool View3D_GetAutoUpdate (IntPtr handle);
  149. /// <summary>
  150. /// Return whether render target updates automatically.
  151. /// </summary>
  152. private bool GetAutoUpdate ()
  153. {
  154. Runtime.ValidateRefCounted (this);
  155. return View3D_GetAutoUpdate (handle);
  156. }
  157. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  158. internal static extern IntPtr View3D_GetScene (IntPtr handle);
  159. /// <summary>
  160. /// Return scene.
  161. /// </summary>
  162. private Scene GetScene ()
  163. {
  164. Runtime.ValidateRefCounted (this);
  165. return Runtime.LookupObject<Scene> (View3D_GetScene (handle));
  166. }
  167. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  168. internal static extern IntPtr View3D_GetCameraNode (IntPtr handle);
  169. /// <summary>
  170. /// Return camera scene node.
  171. /// </summary>
  172. private Node GetCameraNode ()
  173. {
  174. Runtime.ValidateRefCounted (this);
  175. return Runtime.LookupObject<Node> (View3D_GetCameraNode (handle));
  176. }
  177. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  178. internal static extern IntPtr View3D_GetRenderTexture (IntPtr handle);
  179. /// <summary>
  180. /// Return render texture.
  181. /// </summary>
  182. private Texture2D GetRenderTexture ()
  183. {
  184. Runtime.ValidateRefCounted (this);
  185. return Runtime.LookupObject<Texture2D> (View3D_GetRenderTexture (handle));
  186. }
  187. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  188. internal static extern IntPtr View3D_GetDepthTexture (IntPtr handle);
  189. /// <summary>
  190. /// Return depth stencil texture.
  191. /// </summary>
  192. private Texture2D GetDepthTexture ()
  193. {
  194. Runtime.ValidateRefCounted (this);
  195. return Runtime.LookupObject<Texture2D> (View3D_GetDepthTexture (handle));
  196. }
  197. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  198. internal static extern IntPtr View3D_GetViewport (IntPtr handle);
  199. /// <summary>
  200. /// Return viewport.
  201. /// </summary>
  202. private Viewport GetViewport ()
  203. {
  204. Runtime.ValidateRefCounted (this);
  205. return Runtime.LookupObject<Viewport> (View3D_GetViewport (handle));
  206. }
  207. public override StringHash Type {
  208. get {
  209. return UrhoGetType ();
  210. }
  211. }
  212. public override string TypeName {
  213. get {
  214. return GetTypeName ();
  215. }
  216. }
  217. [Preserve]
  218. public new static StringHash TypeStatic {
  219. get {
  220. return GetTypeStatic ();
  221. }
  222. }
  223. public new static string TypeNameStatic {
  224. get {
  225. return GetTypeNameStatic ();
  226. }
  227. }
  228. /// <summary>
  229. /// Return render texture pixel format.
  230. /// Or
  231. /// Set render texture pixel format. Default is RGB.
  232. /// </summary>
  233. public uint Format {
  234. get {
  235. return GetFormat ();
  236. }
  237. set {
  238. SetFormat (value);
  239. }
  240. }
  241. /// <summary>
  242. /// Return whether render target updates automatically.
  243. /// Or
  244. /// Set render target auto update mode. Default is true.
  245. /// </summary>
  246. public bool AutoUpdate {
  247. get {
  248. return GetAutoUpdate ();
  249. }
  250. set {
  251. SetAutoUpdate (value);
  252. }
  253. }
  254. /// <summary>
  255. /// Return scene.
  256. /// </summary>
  257. public Scene Scene {
  258. get {
  259. return GetScene ();
  260. }
  261. }
  262. /// <summary>
  263. /// Return camera scene node.
  264. /// </summary>
  265. public Node CameraNode {
  266. get {
  267. return GetCameraNode ();
  268. }
  269. }
  270. /// <summary>
  271. /// Return render texture.
  272. /// </summary>
  273. public Texture2D RenderTexture {
  274. get {
  275. return GetRenderTexture ();
  276. }
  277. }
  278. /// <summary>
  279. /// Return depth stencil texture.
  280. /// </summary>
  281. public Texture2D DepthTexture {
  282. get {
  283. return GetDepthTexture ();
  284. }
  285. }
  286. /// <summary>
  287. /// Return viewport.
  288. /// </summary>
  289. public Viewport Viewport {
  290. get {
  291. return GetViewport ();
  292. }
  293. }
  294. }
  295. }