2
0

DecalSet.cs 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447
  1. // WARNING - AUTOGENERATED - DO NOT EDIT
  2. //
  3. // Generated using `sharpie urho`
  4. //
  5. // DecalSet.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. /// %Decal renderer component.
  21. /// </summary>
  22. public unsafe partial class DecalSet : Drawable
  23. {
  24. unsafe partial void OnDecalSetCreated ();
  25. [Preserve]
  26. public DecalSet (IntPtr handle) : base (handle)
  27. {
  28. OnDecalSetCreated ();
  29. }
  30. [Preserve]
  31. protected DecalSet (UrhoObjectFlag emptyFlag) : base (emptyFlag)
  32. {
  33. OnDecalSetCreated ();
  34. }
  35. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  36. internal static extern int DecalSet_GetType (IntPtr handle);
  37. private StringHash UrhoGetType ()
  38. {
  39. Runtime.ValidateRefCounted (this);
  40. return new StringHash (DecalSet_GetType (handle));
  41. }
  42. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  43. internal static extern IntPtr DecalSet_GetTypeName (IntPtr handle);
  44. private string GetTypeName ()
  45. {
  46. Runtime.ValidateRefCounted (this);
  47. return Marshal.PtrToStringAnsi (DecalSet_GetTypeName (handle));
  48. }
  49. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  50. internal static extern int DecalSet_GetTypeStatic ();
  51. private static StringHash GetTypeStatic ()
  52. {
  53. Runtime.Validate (typeof(DecalSet));
  54. return new StringHash (DecalSet_GetTypeStatic ());
  55. }
  56. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  57. internal static extern IntPtr DecalSet_GetTypeNameStatic ();
  58. private static string GetTypeNameStatic ()
  59. {
  60. Runtime.Validate (typeof(DecalSet));
  61. return Marshal.PtrToStringAnsi (DecalSet_GetTypeNameStatic ());
  62. }
  63. [Preserve]
  64. public DecalSet () : this (Application.CurrentContext)
  65. {
  66. }
  67. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  68. internal static extern IntPtr DecalSet_DecalSet (IntPtr context);
  69. [Preserve]
  70. public DecalSet (Context context) : base (UrhoObjectFlag.Empty)
  71. {
  72. Runtime.Validate (typeof(DecalSet));
  73. handle = DecalSet_DecalSet ((object)context == null ? IntPtr.Zero : context.Handle);
  74. Runtime.RegisterObject (this);
  75. OnDecalSetCreated ();
  76. }
  77. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  78. internal static extern void DecalSet_RegisterObject (IntPtr context);
  79. /// <summary>
  80. /// Register object factory.
  81. /// </summary>
  82. public new static void RegisterObject (Context context)
  83. {
  84. Runtime.Validate (typeof(DecalSet));
  85. DecalSet_RegisterObject ((object)context == null ? IntPtr.Zero : context.Handle);
  86. }
  87. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  88. internal static extern void DecalSet_ApplyAttributes (IntPtr handle);
  89. /// <summary>
  90. /// Apply attribute changes that can not be applied immediately. Called after scene load or a network update.
  91. /// </summary>
  92. public override void ApplyAttributes ()
  93. {
  94. Runtime.ValidateRefCounted (this);
  95. DecalSet_ApplyAttributes (handle);
  96. }
  97. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  98. internal static extern void DecalSet_OnSetEnabled (IntPtr handle);
  99. /// <summary>
  100. /// Handle enabled/disabled state change.
  101. /// </summary>
  102. public override void OnSetEnabled ()
  103. {
  104. Runtime.ValidateRefCounted (this);
  105. DecalSet_OnSetEnabled (handle);
  106. }
  107. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  108. internal static extern UpdateGeometryType DecalSet_GetUpdateGeometryType (IntPtr handle);
  109. /// <summary>
  110. /// Return whether a geometry update is necessary, and if it can happen in a worker thread.
  111. /// </summary>
  112. private UpdateGeometryType GetUpdateGeometryType ()
  113. {
  114. Runtime.ValidateRefCounted (this);
  115. return DecalSet_GetUpdateGeometryType (handle);
  116. }
  117. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  118. internal static extern void DecalSet_SetMaterial (IntPtr handle, IntPtr material);
  119. /// <summary>
  120. /// Set material. The material should use a small negative depth bias to avoid Z-fighting.
  121. /// </summary>
  122. private void SetMaterial (Material material)
  123. {
  124. Runtime.ValidateRefCounted (this);
  125. DecalSet_SetMaterial (handle, (object)material == null ? IntPtr.Zero : material.Handle);
  126. }
  127. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  128. internal static extern void DecalSet_SetMaxVertices (IntPtr handle, uint num);
  129. /// <summary>
  130. /// Set maximum number of decal vertices.
  131. /// </summary>
  132. private void SetMaxVertices (uint num)
  133. {
  134. Runtime.ValidateRefCounted (this);
  135. DecalSet_SetMaxVertices (handle, num);
  136. }
  137. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  138. internal static extern void DecalSet_SetMaxIndices (IntPtr handle, uint num);
  139. /// <summary>
  140. /// Set maximum number of decal vertex indices.
  141. /// </summary>
  142. private void SetMaxIndices (uint num)
  143. {
  144. Runtime.ValidateRefCounted (this);
  145. DecalSet_SetMaxIndices (handle, num);
  146. }
  147. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  148. internal static extern void DecalSet_SetOptimizeBufferSize (IntPtr handle, bool enable);
  149. /// <summary>
  150. /// Set whether to optimize GPU buffer sizes according to current amount of decals. Default false, which will size the buffers according to the maximum vertices/indices. When true, buffers will be reallocated whenever decals are added/removed, which can be worse for performance.
  151. /// </summary>
  152. private void SetOptimizeBufferSize (bool enable)
  153. {
  154. Runtime.ValidateRefCounted (this);
  155. DecalSet_SetOptimizeBufferSize (handle, enable);
  156. }
  157. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  158. internal static extern bool DecalSet_AddDecal (IntPtr handle, IntPtr target, ref Urho.Vector3 worldPosition, ref Urho.Quaternion worldRotation, float size, float aspectRatio, float depth, ref Urho.Vector2 topLeftUV, ref Urho.Vector2 bottomRightUV, float timeToLive, float normalCutoff, uint subGeometry);
  159. /// <summary>
  160. /// Add a decal at world coordinates, using a target drawable's geometry for reference. If the decal needs to move with the target, the decal component should be created to the target's node. Return true if successful.
  161. /// </summary>
  162. public bool AddDecal (Drawable target, Urho.Vector3 worldPosition, Urho.Quaternion worldRotation, float size, float aspectRatio, float depth, Urho.Vector2 topLeftUV, Urho.Vector2 bottomRightUV, float timeToLive = 0f, float normalCutoff = 0.1f, uint subGeometry = uint.MaxValue)
  163. {
  164. Runtime.ValidateRefCounted (this);
  165. return DecalSet_AddDecal (handle, (object)target == null ? IntPtr.Zero : target.Handle, ref worldPosition, ref worldRotation, size, aspectRatio, depth, ref topLeftUV, ref bottomRightUV, timeToLive, normalCutoff, subGeometry);
  166. }
  167. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  168. internal static extern void DecalSet_RemoveDecals (IntPtr handle, uint num);
  169. /// <summary>
  170. /// Remove n oldest decals.
  171. /// </summary>
  172. public void RemoveDecals (uint num)
  173. {
  174. Runtime.ValidateRefCounted (this);
  175. DecalSet_RemoveDecals (handle, num);
  176. }
  177. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  178. internal static extern void DecalSet_RemoveAllDecals (IntPtr handle);
  179. /// <summary>
  180. /// Remove all decals.
  181. /// </summary>
  182. public void RemoveAllDecals ()
  183. {
  184. Runtime.ValidateRefCounted (this);
  185. DecalSet_RemoveAllDecals (handle);
  186. }
  187. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  188. internal static extern IntPtr DecalSet_GetMaterial (IntPtr handle);
  189. /// <summary>
  190. /// Return material.
  191. /// </summary>
  192. private Material GetMaterial ()
  193. {
  194. Runtime.ValidateRefCounted (this);
  195. return Runtime.LookupObject<Material> (DecalSet_GetMaterial (handle));
  196. }
  197. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  198. internal static extern uint DecalSet_GetNumDecals (IntPtr handle);
  199. /// <summary>
  200. /// Return number of decals.
  201. /// </summary>
  202. private uint GetNumDecals ()
  203. {
  204. Runtime.ValidateRefCounted (this);
  205. return DecalSet_GetNumDecals (handle);
  206. }
  207. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  208. internal static extern uint DecalSet_GetNumVertices (IntPtr handle);
  209. /// <summary>
  210. /// Retur number of vertices in the decals.
  211. /// </summary>
  212. private uint GetNumVertices ()
  213. {
  214. Runtime.ValidateRefCounted (this);
  215. return DecalSet_GetNumVertices (handle);
  216. }
  217. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  218. internal static extern uint DecalSet_GetNumIndices (IntPtr handle);
  219. /// <summary>
  220. /// Retur number of vertex indices in the decals.
  221. /// </summary>
  222. private uint GetNumIndices ()
  223. {
  224. Runtime.ValidateRefCounted (this);
  225. return DecalSet_GetNumIndices (handle);
  226. }
  227. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  228. internal static extern uint DecalSet_GetMaxVertices (IntPtr handle);
  229. /// <summary>
  230. /// Return maximum number of decal vertices.
  231. /// </summary>
  232. private uint GetMaxVertices ()
  233. {
  234. Runtime.ValidateRefCounted (this);
  235. return DecalSet_GetMaxVertices (handle);
  236. }
  237. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  238. internal static extern uint DecalSet_GetMaxIndices (IntPtr handle);
  239. /// <summary>
  240. /// Return maximum number of decal vertex indices.
  241. /// </summary>
  242. private uint GetMaxIndices ()
  243. {
  244. Runtime.ValidateRefCounted (this);
  245. return DecalSet_GetMaxIndices (handle);
  246. }
  247. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  248. internal static extern bool DecalSet_GetOptimizeBufferSize (IntPtr handle);
  249. /// <summary>
  250. /// Return whether is optimizing GPU buffer sizes according to current amount of decals.
  251. /// </summary>
  252. private bool GetOptimizeBufferSize ()
  253. {
  254. Runtime.ValidateRefCounted (this);
  255. return DecalSet_GetOptimizeBufferSize (handle);
  256. }
  257. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  258. internal static extern ResourceRef DecalSet_GetMaterialAttr (IntPtr handle);
  259. /// <summary>
  260. /// Return material attribute.
  261. /// </summary>
  262. private ResourceRef GetMaterialAttr ()
  263. {
  264. Runtime.ValidateRefCounted (this);
  265. return DecalSet_GetMaterialAttr (handle);
  266. }
  267. public override StringHash Type {
  268. get {
  269. return UrhoGetType ();
  270. }
  271. }
  272. public override string TypeName {
  273. get {
  274. return GetTypeName ();
  275. }
  276. }
  277. [Preserve]
  278. public new static StringHash TypeStatic {
  279. get {
  280. return GetTypeStatic ();
  281. }
  282. }
  283. public new static string TypeNameStatic {
  284. get {
  285. return GetTypeNameStatic ();
  286. }
  287. }
  288. /// <summary>
  289. /// Return whether a geometry update is necessary, and if it can happen in a worker thread.
  290. /// </summary>
  291. public override UpdateGeometryType UpdateGeometryType {
  292. get {
  293. return GetUpdateGeometryType ();
  294. }
  295. }
  296. /// <summary>
  297. /// Return material.
  298. /// Or
  299. /// Set material. The material should use a small negative depth bias to avoid Z-fighting.
  300. /// </summary>
  301. public Material Material {
  302. get {
  303. return GetMaterial ();
  304. }
  305. set {
  306. SetMaterial (value);
  307. }
  308. }
  309. /// <summary>
  310. /// Return maximum number of decal vertices.
  311. /// Or
  312. /// Set maximum number of decal vertices.
  313. /// </summary>
  314. public uint MaxVertices {
  315. get {
  316. return GetMaxVertices ();
  317. }
  318. set {
  319. SetMaxVertices (value);
  320. }
  321. }
  322. /// <summary>
  323. /// Return maximum number of decal vertex indices.
  324. /// Or
  325. /// Set maximum number of decal vertex indices.
  326. /// </summary>
  327. public uint MaxIndices {
  328. get {
  329. return GetMaxIndices ();
  330. }
  331. set {
  332. SetMaxIndices (value);
  333. }
  334. }
  335. /// <summary>
  336. /// Return whether is optimizing GPU buffer sizes according to current amount of decals.
  337. /// Or
  338. /// Set whether to optimize GPU buffer sizes according to current amount of decals. Default false, which will size the buffers according to the maximum vertices/indices. When true, buffers will be reallocated whenever decals are added/removed, which can be worse for performance.
  339. /// </summary>
  340. public bool OptimizeBufferSize {
  341. get {
  342. return GetOptimizeBufferSize ();
  343. }
  344. set {
  345. SetOptimizeBufferSize (value);
  346. }
  347. }
  348. /// <summary>
  349. /// Return number of decals.
  350. /// </summary>
  351. public uint NumDecals {
  352. get {
  353. return GetNumDecals ();
  354. }
  355. }
  356. /// <summary>
  357. /// Retur number of vertices in the decals.
  358. /// </summary>
  359. public uint NumVertices {
  360. get {
  361. return GetNumVertices ();
  362. }
  363. }
  364. /// <summary>
  365. /// Retur number of vertex indices in the decals.
  366. /// </summary>
  367. public uint NumIndices {
  368. get {
  369. return GetNumIndices ();
  370. }
  371. }
  372. /// <summary>
  373. /// Return material attribute.
  374. /// </summary>
  375. public ResourceRef MaterialAttr {
  376. get {
  377. return GetMaterialAttr ();
  378. }
  379. }
  380. }
  381. }