Texture2DArray.cs 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323
  1. // WARNING - AUTOGENERATED - DO NOT EDIT
  2. //
  3. // Generated using `sharpie urho`
  4. //
  5. // Texture2DArray.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. /// 2D texture array resource.
  21. /// </summary>
  22. public unsafe partial class Texture2DArray : Texture
  23. {
  24. public Texture2DArray (IntPtr handle) : base (handle)
  25. {
  26. }
  27. protected Texture2DArray (UrhoObjectFlag emptyFlag) : base (emptyFlag)
  28. {
  29. }
  30. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  31. internal static extern int Texture2DArray_GetType (IntPtr handle);
  32. private StringHash UrhoGetType ()
  33. {
  34. Runtime.ValidateRefCounted (this);
  35. return new StringHash (Texture2DArray_GetType (handle));
  36. }
  37. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  38. internal static extern IntPtr Texture2DArray_GetTypeName (IntPtr handle);
  39. private string GetTypeName ()
  40. {
  41. Runtime.ValidateRefCounted (this);
  42. return Marshal.PtrToStringAnsi (Texture2DArray_GetTypeName (handle));
  43. }
  44. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  45. internal static extern int Texture2DArray_GetTypeStatic ();
  46. private static StringHash GetTypeStatic ()
  47. {
  48. Runtime.Validate (typeof(Texture2DArray));
  49. return new StringHash (Texture2DArray_GetTypeStatic ());
  50. }
  51. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  52. internal static extern IntPtr Texture2DArray_GetTypeNameStatic ();
  53. private static string GetTypeNameStatic ()
  54. {
  55. Runtime.Validate (typeof(Texture2DArray));
  56. return Marshal.PtrToStringAnsi (Texture2DArray_GetTypeNameStatic ());
  57. }
  58. public Texture2DArray () : this (Application.CurrentContext)
  59. {
  60. }
  61. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  62. internal static extern IntPtr Texture2DArray_Texture2DArray (IntPtr context);
  63. public Texture2DArray (Context context) : base (UrhoObjectFlag.Empty)
  64. {
  65. Runtime.Validate (typeof(Texture2DArray));
  66. handle = Texture2DArray_Texture2DArray ((object)context == null ? IntPtr.Zero : context.Handle);
  67. Runtime.RegisterObject (this);
  68. }
  69. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  70. internal static extern void Texture2DArray_RegisterObject (IntPtr context);
  71. /// <summary>
  72. /// Register object factory.
  73. /// </summary>
  74. public static void RegisterObject (Context context)
  75. {
  76. Runtime.Validate (typeof(Texture2DArray));
  77. Texture2DArray_RegisterObject ((object)context == null ? IntPtr.Zero : context.Handle);
  78. }
  79. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  80. internal static extern bool Texture2DArray_BeginLoad_File (IntPtr handle, IntPtr source);
  81. /// <summary>
  82. /// Load resource from stream. May be called from a worker thread. Return true if successful.
  83. /// </summary>
  84. public override bool BeginLoad (File source)
  85. {
  86. Runtime.ValidateRefCounted (this);
  87. return Texture2DArray_BeginLoad_File (handle, (object)source == null ? IntPtr.Zero : source.Handle);
  88. }
  89. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  90. internal static extern bool Texture2DArray_BeginLoad_MemoryBuffer (IntPtr handle, IntPtr source);
  91. /// <summary>
  92. /// Load resource from stream. May be called from a worker thread. Return true if successful.
  93. /// </summary>
  94. public override bool BeginLoad (MemoryBuffer source)
  95. {
  96. Runtime.ValidateRefCounted (this);
  97. return Texture2DArray_BeginLoad_MemoryBuffer (handle, (object)source == null ? IntPtr.Zero : source.Handle);
  98. }
  99. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  100. internal static extern bool Texture2DArray_EndLoad (IntPtr handle);
  101. /// <summary>
  102. /// Finish resource loading. Always called from the main thread. Return true if successful.
  103. /// </summary>
  104. public override bool EndLoad ()
  105. {
  106. Runtime.ValidateRefCounted (this);
  107. return Texture2DArray_EndLoad (handle);
  108. }
  109. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  110. internal static extern void Texture2DArray_OnDeviceLost (IntPtr handle);
  111. /// <summary>
  112. /// Mark the GPU resource destroyed on context destruction.
  113. /// </summary>
  114. public void OnDeviceLost ()
  115. {
  116. Runtime.ValidateRefCounted (this);
  117. Texture2DArray_OnDeviceLost (handle);
  118. }
  119. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  120. internal static extern void Texture2DArray_OnDeviceReset (IntPtr handle);
  121. /// <summary>
  122. /// Recreate the GPU resource and restore data if applicable.
  123. /// </summary>
  124. public void OnDeviceReset ()
  125. {
  126. Runtime.ValidateRefCounted (this);
  127. Texture2DArray_OnDeviceReset (handle);
  128. }
  129. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  130. internal static extern void Texture2DArray_Release (IntPtr handle);
  131. /// <summary>
  132. /// Release the texture.
  133. /// </summary>
  134. public void Release ()
  135. {
  136. Runtime.ValidateRefCounted (this);
  137. Texture2DArray_Release (handle);
  138. }
  139. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  140. internal static extern void Texture2DArray_SetLayers (IntPtr handle, uint layers);
  141. /// <summary>
  142. /// Set the number of layers in the texture. To be used before SetData.
  143. /// </summary>
  144. private void SetLayers (uint layers)
  145. {
  146. Runtime.ValidateRefCounted (this);
  147. Texture2DArray_SetLayers (handle, layers);
  148. }
  149. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  150. internal static extern bool Texture2DArray_SetSize (IntPtr handle, uint layers, int width, int height, uint format, TextureUsage usage);
  151. /// <summary>
  152. /// Set layers, size, format and usage. Set layers to zero to leave them unchanged. Return true if successful.
  153. /// </summary>
  154. public bool SetSize (uint layers, int width, int height, uint format, TextureUsage usage)
  155. {
  156. Runtime.ValidateRefCounted (this);
  157. return Texture2DArray_SetSize (handle, layers, width, height, format, usage);
  158. }
  159. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  160. internal static extern bool Texture2DArray_SetData (IntPtr handle, uint layer, uint level, int x, int y, int width, int height, void* data);
  161. /// <summary>
  162. /// Set data either partially or fully on a layer's mip level. Return true if successful.
  163. /// </summary>
  164. public bool SetData (uint layer, uint level, int x, int y, int width, int height, void* data)
  165. {
  166. Runtime.ValidateRefCounted (this);
  167. return Texture2DArray_SetData (handle, layer, level, x, y, width, height, data);
  168. }
  169. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  170. internal static extern bool Texture2DArray_SetData0_File (IntPtr handle, uint layer, IntPtr source);
  171. /// <summary>
  172. /// Set data of one layer from a stream. Return true if successful.
  173. /// </summary>
  174. public bool SetData (uint layer, File source)
  175. {
  176. Runtime.ValidateRefCounted (this);
  177. return Texture2DArray_SetData0_File (handle, layer, (object)source == null ? IntPtr.Zero : source.Handle);
  178. }
  179. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  180. internal static extern bool Texture2DArray_SetData0_MemoryBuffer (IntPtr handle, uint layer, IntPtr source);
  181. /// <summary>
  182. /// Set data of one layer from a stream. Return true if successful.
  183. /// </summary>
  184. public bool SetData (uint layer, MemoryBuffer source)
  185. {
  186. Runtime.ValidateRefCounted (this);
  187. return Texture2DArray_SetData0_MemoryBuffer (handle, layer, (object)source == null ? IntPtr.Zero : source.Handle);
  188. }
  189. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  190. internal static extern bool Texture2DArray_SetData1 (IntPtr handle, uint layer, IntPtr image, bool useAlpha);
  191. /// <summary>
  192. /// Set data of one layer from an image. Return true if successful. Optionally make a single channel image alpha-only.
  193. /// </summary>
  194. public bool SetData (uint layer, Image image, bool useAlpha)
  195. {
  196. Runtime.ValidateRefCounted (this);
  197. return Texture2DArray_SetData1 (handle, layer, (object)image == null ? IntPtr.Zero : image.Handle, useAlpha);
  198. }
  199. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  200. internal static extern uint Texture2DArray_GetLayers (IntPtr handle);
  201. /// <summary>
  202. /// Return number of layers in the texture.
  203. /// </summary>
  204. private uint GetLayers ()
  205. {
  206. Runtime.ValidateRefCounted (this);
  207. return Texture2DArray_GetLayers (handle);
  208. }
  209. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  210. internal static extern bool Texture2DArray_GetData (IntPtr handle, uint layer, uint level, IntPtr dest);
  211. /// <summary>
  212. /// Get data from a mip level. The destination buffer must be big enough. Return true if successful.
  213. /// </summary>
  214. public bool GetData (uint layer, uint level, IntPtr dest)
  215. {
  216. Runtime.ValidateRefCounted (this);
  217. return Texture2DArray_GetData (handle, layer, level, dest);
  218. }
  219. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  220. internal static extern IntPtr Texture2DArray_GetRenderSurface (IntPtr handle);
  221. /// <summary>
  222. /// Return render surface.
  223. /// </summary>
  224. private RenderSurface GetRenderSurface ()
  225. {
  226. Runtime.ValidateRefCounted (this);
  227. return Runtime.LookupRefCounted<RenderSurface> (Texture2DArray_GetRenderSurface (handle));
  228. }
  229. public override StringHash Type {
  230. get {
  231. return UrhoGetType ();
  232. }
  233. }
  234. public override string TypeName {
  235. get {
  236. return GetTypeName ();
  237. }
  238. }
  239. public new static StringHash TypeStatic {
  240. get {
  241. return GetTypeStatic ();
  242. }
  243. }
  244. public new static string TypeNameStatic {
  245. get {
  246. return GetTypeNameStatic ();
  247. }
  248. }
  249. /// <summary>
  250. /// Return number of layers in the texture.
  251. /// Or
  252. /// Set the number of layers in the texture. To be used before SetData.
  253. /// </summary>
  254. public uint Layers {
  255. get {
  256. return GetLayers ();
  257. }
  258. set {
  259. SetLayers (value);
  260. }
  261. }
  262. /// <summary>
  263. /// Return render surface.
  264. /// </summary>
  265. public RenderSurface RenderSurface {
  266. get {
  267. return GetRenderSurface ();
  268. }
  269. }
  270. }
  271. }