Model.cs 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467
  1. // WARNING - AUTOGENERATED - DO NOT EDIT
  2. //
  3. // Generated using `sharpie urho`
  4. //
  5. // Model.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. /// 3D model resource.
  21. /// </summary>
  22. public unsafe partial class Model : Resource
  23. {
  24. public Model (IntPtr handle) : base (handle)
  25. {
  26. }
  27. protected Model (UrhoObjectFlag emptyFlag) : base (emptyFlag)
  28. {
  29. }
  30. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  31. internal static extern int Model_GetType (IntPtr handle);
  32. private StringHash UrhoGetType ()
  33. {
  34. Runtime.ValidateRefCounted (this);
  35. return new StringHash (Model_GetType (handle));
  36. }
  37. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  38. internal static extern IntPtr Model_GetTypeName (IntPtr handle);
  39. private string GetTypeName ()
  40. {
  41. Runtime.ValidateRefCounted (this);
  42. return Marshal.PtrToStringAnsi (Model_GetTypeName (handle));
  43. }
  44. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  45. internal static extern int Model_GetTypeStatic ();
  46. private static StringHash GetTypeStatic ()
  47. {
  48. Runtime.Validate (typeof(Model));
  49. return new StringHash (Model_GetTypeStatic ());
  50. }
  51. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  52. internal static extern IntPtr Model_GetTypeNameStatic ();
  53. private static string GetTypeNameStatic ()
  54. {
  55. Runtime.Validate (typeof(Model));
  56. return Marshal.PtrToStringAnsi (Model_GetTypeNameStatic ());
  57. }
  58. public Model () : this (Application.CurrentContext)
  59. {
  60. }
  61. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  62. internal static extern IntPtr Model_Model (IntPtr context);
  63. public Model (Context context) : base (UrhoObjectFlag.Empty)
  64. {
  65. Runtime.Validate (typeof(Model));
  66. handle = Model_Model ((object)context == null ? IntPtr.Zero : context.Handle);
  67. Runtime.RegisterObject (this);
  68. }
  69. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  70. internal static extern void Model_RegisterObject (IntPtr context);
  71. /// <summary>
  72. /// Register object factory.
  73. /// </summary>
  74. public static void RegisterObject (Context context)
  75. {
  76. Runtime.Validate (typeof(Model));
  77. Model_RegisterObject ((object)context == null ? IntPtr.Zero : context.Handle);
  78. }
  79. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  80. internal static extern bool Model_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 Model_BeginLoad_File (handle, (object)source == null ? IntPtr.Zero : source.Handle);
  88. }
  89. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  90. internal static extern bool Model_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 Model_BeginLoad_MemoryBuffer (handle, (object)source == null ? IntPtr.Zero : source.Handle);
  98. }
  99. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  100. internal static extern bool Model_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 Model_EndLoad (handle);
  108. }
  109. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  110. internal static extern bool Model_Save_File (IntPtr handle, IntPtr dest);
  111. /// <summary>
  112. /// Save resource. Return true if successful.
  113. /// </summary>
  114. public override bool Save (File dest)
  115. {
  116. Runtime.ValidateRefCounted (this);
  117. return Model_Save_File (handle, (object)dest == null ? IntPtr.Zero : dest.Handle);
  118. }
  119. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  120. internal static extern bool Model_Save_MemoryBuffer (IntPtr handle, IntPtr dest);
  121. /// <summary>
  122. /// Save resource. Return true if successful.
  123. /// </summary>
  124. public override bool Save (MemoryBuffer dest)
  125. {
  126. Runtime.ValidateRefCounted (this);
  127. return Model_Save_MemoryBuffer (handle, (object)dest == null ? IntPtr.Zero : dest.Handle);
  128. }
  129. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  130. internal static extern void Model_SetBoundingBox (IntPtr handle, ref Urho.BoundingBox box);
  131. /// <summary>
  132. /// Set local-space bounding box.
  133. /// </summary>
  134. private void SetBoundingBox (Urho.BoundingBox box)
  135. {
  136. Runtime.ValidateRefCounted (this);
  137. Model_SetBoundingBox (handle, ref box);
  138. }
  139. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  140. internal static extern void Model_SetNumGeometries (IntPtr handle, uint num);
  141. /// <summary>
  142. /// Set number of geometries.
  143. /// </summary>
  144. private void SetNumGeometries (uint num)
  145. {
  146. Runtime.ValidateRefCounted (this);
  147. Model_SetNumGeometries (handle, num);
  148. }
  149. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  150. internal static extern bool Model_SetNumGeometryLodLevels (IntPtr handle, uint index, uint num);
  151. /// <summary>
  152. /// Set number of LOD levels in a geometry.
  153. /// </summary>
  154. public bool SetNumGeometryLodLevels (uint index, uint num)
  155. {
  156. Runtime.ValidateRefCounted (this);
  157. return Model_SetNumGeometryLodLevels (handle, index, num);
  158. }
  159. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  160. internal static extern bool Model_SetGeometry (IntPtr handle, uint index, uint lodLevel, IntPtr geometry);
  161. /// <summary>
  162. /// Set geometry.
  163. /// </summary>
  164. public bool SetGeometry (uint index, uint lodLevel, Geometry geometry)
  165. {
  166. Runtime.ValidateRefCounted (this);
  167. return Model_SetGeometry (handle, index, lodLevel, (object)geometry == null ? IntPtr.Zero : geometry.Handle);
  168. }
  169. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  170. internal static extern bool Model_SetGeometryCenter (IntPtr handle, uint index, ref Urho.Vector3 center);
  171. /// <summary>
  172. /// Set geometry center.
  173. /// </summary>
  174. public bool SetGeometryCenter (uint index, Urho.Vector3 center)
  175. {
  176. Runtime.ValidateRefCounted (this);
  177. return Model_SetGeometryCenter (handle, index, ref center);
  178. }
  179. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  180. internal static extern IntPtr Model_Clone (IntPtr handle, string cloneName);
  181. /// <summary>
  182. /// Clone the model. The geometry data is deep-copied and can be modified in the clone without affecting the original.
  183. /// </summary>
  184. public Model Clone (string cloneName)
  185. {
  186. Runtime.ValidateRefCounted (this);
  187. return Runtime.LookupRefCounted<Model> (Model_Clone (handle, cloneName));
  188. }
  189. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  190. internal static extern Urho.BoundingBox Model_GetBoundingBox (IntPtr handle);
  191. /// <summary>
  192. /// Return bounding box.
  193. /// </summary>
  194. private Urho.BoundingBox GetBoundingBox ()
  195. {
  196. Runtime.ValidateRefCounted (this);
  197. return Model_GetBoundingBox (handle);
  198. }
  199. private IReadOnlyList<VertexBuffer> _GetVertexBuffers_cache;
  200. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  201. internal static extern IntPtr Model_GetVertexBuffers (IntPtr handle);
  202. /// <summary>
  203. /// Return vertex buffers.
  204. /// </summary>
  205. private IReadOnlyList<VertexBuffer> GetVertexBuffers ()
  206. {
  207. Runtime.ValidateRefCounted (this);
  208. return _GetVertexBuffers_cache != null ? _GetVertexBuffers_cache : _GetVertexBuffers_cache = Runtime.CreateVectorSharedPtrProxy<VertexBuffer> (Model_GetVertexBuffers (handle));
  209. }
  210. private IReadOnlyList<IndexBuffer> _GetIndexBuffers_cache;
  211. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  212. internal static extern IntPtr Model_GetIndexBuffers (IntPtr handle);
  213. /// <summary>
  214. /// Return index buffers.
  215. /// </summary>
  216. private IReadOnlyList<IndexBuffer> GetIndexBuffers ()
  217. {
  218. Runtime.ValidateRefCounted (this);
  219. return _GetIndexBuffers_cache != null ? _GetIndexBuffers_cache : _GetIndexBuffers_cache = Runtime.CreateVectorSharedPtrProxy<IndexBuffer> (Model_GetIndexBuffers (handle));
  220. }
  221. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  222. internal static extern uint Model_GetNumGeometries (IntPtr handle);
  223. /// <summary>
  224. /// Return number of geometries.
  225. /// </summary>
  226. private uint GetNumGeometries ()
  227. {
  228. Runtime.ValidateRefCounted (this);
  229. return Model_GetNumGeometries (handle);
  230. }
  231. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  232. internal static extern uint Model_GetNumGeometryLodLevels (IntPtr handle, uint index);
  233. /// <summary>
  234. /// Return number of LOD levels in geometry.
  235. /// </summary>
  236. public uint GetNumGeometryLodLevels (uint index)
  237. {
  238. Runtime.ValidateRefCounted (this);
  239. return Model_GetNumGeometryLodLevels (handle, index);
  240. }
  241. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  242. internal static extern IntPtr Model_GetGeometry (IntPtr handle, uint index, uint lodLevel);
  243. /// <summary>
  244. /// Return geometry by index and LOD level. The LOD level is clamped if out of range.
  245. /// </summary>
  246. public Geometry GetGeometry (uint index, uint lodLevel)
  247. {
  248. Runtime.ValidateRefCounted (this);
  249. return Runtime.LookupObject<Geometry> (Model_GetGeometry (handle, index, lodLevel));
  250. }
  251. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  252. internal static extern Urho.Vector3 Model_GetGeometryCenter (IntPtr handle, uint index);
  253. /// <summary>
  254. /// Return geometry center by index.
  255. /// </summary>
  256. public Urho.Vector3 GetGeometryCenter (uint index)
  257. {
  258. Runtime.ValidateRefCounted (this);
  259. return Model_GetGeometryCenter (handle, index);
  260. }
  261. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  262. internal static extern uint Model_GetNumMorphs (IntPtr handle);
  263. /// <summary>
  264. /// Return number of vertex morphs.
  265. /// </summary>
  266. private uint GetNumMorphs ()
  267. {
  268. Runtime.ValidateRefCounted (this);
  269. return Model_GetNumMorphs (handle);
  270. }
  271. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  272. internal static extern ModelMorph* Model_GetMorph (IntPtr handle, uint index);
  273. /// <summary>
  274. /// Return vertex morph by index.
  275. /// </summary>
  276. public ModelMorph* GetMorph (uint index)
  277. {
  278. Runtime.ValidateRefCounted (this);
  279. return Model_GetMorph (handle, index);
  280. }
  281. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  282. internal static extern ModelMorph* Model_GetMorph0 (IntPtr handle, string name);
  283. /// <summary>
  284. /// Return vertex morph by name.
  285. /// </summary>
  286. public ModelMorph* GetMorph (string name)
  287. {
  288. Runtime.ValidateRefCounted (this);
  289. return Model_GetMorph0 (handle, name);
  290. }
  291. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  292. internal static extern ModelMorph* Model_GetMorph1 (IntPtr handle, int nameHash);
  293. /// <summary>
  294. /// Return vertex morph by name hash.
  295. /// </summary>
  296. public ModelMorph* GetMorph (StringHash nameHash)
  297. {
  298. Runtime.ValidateRefCounted (this);
  299. return Model_GetMorph1 (handle, nameHash.Code);
  300. }
  301. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  302. internal static extern uint Model_GetMorphRangeStart (IntPtr handle, uint bufferIndex);
  303. /// <summary>
  304. /// Return vertex buffer morph range start.
  305. /// </summary>
  306. public uint GetMorphRangeStart (uint bufferIndex)
  307. {
  308. Runtime.ValidateRefCounted (this);
  309. return Model_GetMorphRangeStart (handle, bufferIndex);
  310. }
  311. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  312. internal static extern uint Model_GetMorphRangeCount (IntPtr handle, uint bufferIndex);
  313. /// <summary>
  314. /// Return vertex buffer morph range vertex count.
  315. /// </summary>
  316. public uint GetMorphRangeCount (uint bufferIndex)
  317. {
  318. Runtime.ValidateRefCounted (this);
  319. return Model_GetMorphRangeCount (handle, bufferIndex);
  320. }
  321. public override StringHash Type {
  322. get {
  323. return UrhoGetType ();
  324. }
  325. }
  326. public override string TypeName {
  327. get {
  328. return GetTypeName ();
  329. }
  330. }
  331. public new static StringHash TypeStatic {
  332. get {
  333. return GetTypeStatic ();
  334. }
  335. }
  336. public new static string TypeNameStatic {
  337. get {
  338. return GetTypeNameStatic ();
  339. }
  340. }
  341. /// <summary>
  342. /// Return bounding box.
  343. /// Or
  344. /// Set local-space bounding box.
  345. /// </summary>
  346. public Urho.BoundingBox BoundingBox {
  347. get {
  348. return GetBoundingBox ();
  349. }
  350. set {
  351. SetBoundingBox (value);
  352. }
  353. }
  354. /// <summary>
  355. /// Return number of geometries.
  356. /// Or
  357. /// Set number of geometries.
  358. /// </summary>
  359. public uint NumGeometries {
  360. get {
  361. return GetNumGeometries ();
  362. }
  363. set {
  364. SetNumGeometries (value);
  365. }
  366. }
  367. /// <summary>
  368. /// Return vertex buffers.
  369. /// </summary>
  370. public IReadOnlyList<VertexBuffer> VertexBuffers {
  371. get {
  372. return GetVertexBuffers ();
  373. }
  374. }
  375. /// <summary>
  376. /// Return index buffers.
  377. /// </summary>
  378. public IReadOnlyList<IndexBuffer> IndexBuffers {
  379. get {
  380. return GetIndexBuffers ();
  381. }
  382. }
  383. /// <summary>
  384. /// Return number of vertex morphs.
  385. /// </summary>
  386. public uint NumMorphs {
  387. get {
  388. return GetNumMorphs ();
  389. }
  390. }
  391. }
  392. }