StaticModel.cs 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365
  1. // WARNING - AUTOGENERATED - DO NOT EDIT
  2. //
  3. // Generated using `sharpie urho`
  4. //
  5. // StaticModel.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. /// Static model component.
  21. /// </summary>
  22. public unsafe partial class StaticModel : Drawable
  23. {
  24. unsafe partial void OnStaticModelCreated ();
  25. [Preserve]
  26. public StaticModel (IntPtr handle) : base (handle)
  27. {
  28. OnStaticModelCreated ();
  29. }
  30. [Preserve]
  31. protected StaticModel (UrhoObjectFlag emptyFlag) : base (emptyFlag)
  32. {
  33. OnStaticModelCreated ();
  34. }
  35. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  36. internal static extern int StaticModel_GetType (IntPtr handle);
  37. private StringHash UrhoGetType ()
  38. {
  39. Runtime.ValidateRefCounted (this);
  40. return new StringHash (StaticModel_GetType (handle));
  41. }
  42. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  43. internal static extern IntPtr StaticModel_GetTypeName (IntPtr handle);
  44. private string GetTypeName ()
  45. {
  46. Runtime.ValidateRefCounted (this);
  47. return Marshal.PtrToStringAnsi (StaticModel_GetTypeName (handle));
  48. }
  49. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  50. internal static extern int StaticModel_GetTypeStatic ();
  51. private static StringHash GetTypeStatic ()
  52. {
  53. Runtime.Validate (typeof(StaticModel));
  54. return new StringHash (StaticModel_GetTypeStatic ());
  55. }
  56. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  57. internal static extern IntPtr StaticModel_GetTypeNameStatic ();
  58. private static string GetTypeNameStatic ()
  59. {
  60. Runtime.Validate (typeof(StaticModel));
  61. return Marshal.PtrToStringAnsi (StaticModel_GetTypeNameStatic ());
  62. }
  63. [Preserve]
  64. public StaticModel () : this (Application.CurrentContext)
  65. {
  66. }
  67. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  68. internal static extern IntPtr StaticModel_StaticModel (IntPtr context);
  69. [Preserve]
  70. public StaticModel (Context context) : base (UrhoObjectFlag.Empty)
  71. {
  72. Runtime.Validate (typeof(StaticModel));
  73. handle = StaticModel_StaticModel ((object)context == null ? IntPtr.Zero : context.Handle);
  74. Runtime.RegisterObject (this);
  75. OnStaticModelCreated ();
  76. }
  77. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  78. internal static extern void StaticModel_RegisterObject (IntPtr context);
  79. /// <summary>
  80. /// Register object factory. Drawable must be registered first.
  81. /// </summary>
  82. public new static void RegisterObject (Context context)
  83. {
  84. Runtime.Validate (typeof(StaticModel));
  85. StaticModel_RegisterObject ((object)context == null ? IntPtr.Zero : context.Handle);
  86. }
  87. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  88. internal static extern IntPtr StaticModel_GetLodGeometry (IntPtr handle, uint batchIndex, uint level);
  89. /// <summary>
  90. /// Return the geometry for a specific LOD level.
  91. /// </summary>
  92. public override Geometry GetLodGeometry (uint batchIndex, uint level)
  93. {
  94. Runtime.ValidateRefCounted (this);
  95. return Runtime.LookupObject<Geometry> (StaticModel_GetLodGeometry (handle, batchIndex, level));
  96. }
  97. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  98. internal static extern uint StaticModel_GetNumOccluderTriangles (IntPtr handle);
  99. /// <summary>
  100. /// Return number of occlusion geometry triangles.
  101. /// </summary>
  102. private uint GetNumOccluderTriangles ()
  103. {
  104. Runtime.ValidateRefCounted (this);
  105. return StaticModel_GetNumOccluderTriangles (handle);
  106. }
  107. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  108. internal static extern bool StaticModel_DrawOcclusion (IntPtr handle, IntPtr buffer);
  109. /// <summary>
  110. /// Draw to occlusion buffer. Return true if did not run out of triangles.
  111. /// </summary>
  112. public override bool DrawOcclusion (OcclusionBuffer buffer)
  113. {
  114. Runtime.ValidateRefCounted (this);
  115. return StaticModel_DrawOcclusion (handle, (object)buffer == null ? IntPtr.Zero : buffer.Handle);
  116. }
  117. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  118. internal static extern void StaticModel_SetModel (IntPtr handle, IntPtr model);
  119. /// <summary>
  120. /// Set model.
  121. /// </summary>
  122. private void SetModel (Model model)
  123. {
  124. Runtime.ValidateRefCounted (this);
  125. StaticModel_SetModel (handle, (object)model == null ? IntPtr.Zero : model.Handle);
  126. }
  127. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  128. internal static extern void StaticModel_SetMaterial (IntPtr handle, IntPtr material);
  129. /// <summary>
  130. /// Set material on all geometries.
  131. /// </summary>
  132. public void SetMaterial (Material material)
  133. {
  134. Runtime.ValidateRefCounted (this);
  135. StaticModel_SetMaterial (handle, (object)material == null ? IntPtr.Zero : material.Handle);
  136. }
  137. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  138. internal static extern bool StaticModel_SetMaterial0 (IntPtr handle, uint index, IntPtr material);
  139. /// <summary>
  140. /// Set material on one geometry. Return true if successful.
  141. /// </summary>
  142. public bool SetMaterial (uint index, Material material)
  143. {
  144. Runtime.ValidateRefCounted (this);
  145. return StaticModel_SetMaterial0 (handle, index, (object)material == null ? IntPtr.Zero : material.Handle);
  146. }
  147. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  148. internal static extern void StaticModel_SetOcclusionLodLevel (IntPtr handle, uint level);
  149. /// <summary>
  150. /// Set occlusion LOD level. By default (M_MAX_UNSIGNED) same as visible.
  151. /// </summary>
  152. private void SetOcclusionLodLevel (uint level)
  153. {
  154. Runtime.ValidateRefCounted (this);
  155. StaticModel_SetOcclusionLodLevel (handle, level);
  156. }
  157. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  158. internal static extern void StaticModel_ApplyMaterialList (IntPtr handle, string fileName);
  159. /// <summary>
  160. /// Apply default materials from a material list file. If filename is empty (default), the model's resource name with extension .txt will be used.
  161. /// </summary>
  162. public void ApplyMaterialList (string fileName = "")
  163. {
  164. Runtime.ValidateRefCounted (this);
  165. StaticModel_ApplyMaterialList (handle, fileName);
  166. }
  167. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  168. internal static extern IntPtr StaticModel_GetModel (IntPtr handle);
  169. /// <summary>
  170. /// Return model.
  171. /// </summary>
  172. private Model GetModel ()
  173. {
  174. Runtime.ValidateRefCounted (this);
  175. return Runtime.LookupObject<Model> (StaticModel_GetModel (handle));
  176. }
  177. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  178. internal static extern uint StaticModel_GetNumGeometries (IntPtr handle);
  179. /// <summary>
  180. /// Return number of geometries.
  181. /// </summary>
  182. private uint GetNumGeometries ()
  183. {
  184. Runtime.ValidateRefCounted (this);
  185. return StaticModel_GetNumGeometries (handle);
  186. }
  187. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  188. internal static extern IntPtr StaticModel_GetMaterial (IntPtr handle, uint index);
  189. /// <summary>
  190. /// Return material by geometry index.
  191. /// </summary>
  192. public Material GetMaterial (uint index = 0)
  193. {
  194. Runtime.ValidateRefCounted (this);
  195. return Runtime.LookupObject<Material> (StaticModel_GetMaterial (handle, index));
  196. }
  197. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  198. internal static extern uint StaticModel_GetOcclusionLodLevel (IntPtr handle);
  199. /// <summary>
  200. /// Return occlusion LOD level.
  201. /// </summary>
  202. private uint GetOcclusionLodLevel ()
  203. {
  204. Runtime.ValidateRefCounted (this);
  205. return StaticModel_GetOcclusionLodLevel (handle);
  206. }
  207. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  208. internal static extern bool StaticModel_IsInside (IntPtr handle, ref Urho.Vector3 point);
  209. /// <summary>
  210. /// Determines if the given world space point is within the model geometry.
  211. /// </summary>
  212. public bool IsInside (Urho.Vector3 point)
  213. {
  214. Runtime.ValidateRefCounted (this);
  215. return StaticModel_IsInside (handle, ref point);
  216. }
  217. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  218. internal static extern bool StaticModel_IsInsideLocal (IntPtr handle, ref Urho.Vector3 point);
  219. /// <summary>
  220. /// Determines if the given local space point is within the model geometry.
  221. /// </summary>
  222. public bool IsInsideLocal (Urho.Vector3 point)
  223. {
  224. Runtime.ValidateRefCounted (this);
  225. return StaticModel_IsInsideLocal (handle, ref point);
  226. }
  227. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  228. internal static extern ResourceRef StaticModel_GetModelAttr (IntPtr handle);
  229. /// <summary>
  230. /// Return model attribute.
  231. /// </summary>
  232. private ResourceRef GetModelAttr ()
  233. {
  234. Runtime.ValidateRefCounted (this);
  235. return StaticModel_GetModelAttr (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 occlusion geometry triangles.
  260. /// </summary>
  261. public override uint NumOccluderTriangles {
  262. get {
  263. return GetNumOccluderTriangles ();
  264. }
  265. }
  266. /// <summary>
  267. /// Return model.
  268. /// Or
  269. /// Set model.
  270. /// </summary>
  271. public Model Model {
  272. get {
  273. return GetModel ();
  274. }
  275. set {
  276. SetModel (value);
  277. }
  278. }
  279. /// <summary>
  280. /// Return occlusion LOD level.
  281. /// Or
  282. /// Set occlusion LOD level. By default (M_MAX_UNSIGNED) same as visible.
  283. /// </summary>
  284. public uint OcclusionLodLevel {
  285. get {
  286. return GetOcclusionLodLevel ();
  287. }
  288. set {
  289. SetOcclusionLodLevel (value);
  290. }
  291. }
  292. /// <summary>
  293. /// Return number of geometries.
  294. /// </summary>
  295. public uint NumGeometries {
  296. get {
  297. return GetNumGeometries ();
  298. }
  299. }
  300. /// <summary>
  301. /// Return model attribute.
  302. /// </summary>
  303. public virtual ResourceRef ModelAttr {
  304. get {
  305. return GetModelAttr ();
  306. }
  307. }
  308. }
  309. }