StaticModel.cs 10 KB

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