Texture2DArray.cs 10 KB

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