NavigationMesh.cs 33 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121
  1. // WARNING - AUTOGENERATED - DO NOT EDIT
  2. //
  3. // Generated using `sharpie urho`
  4. //
  5. // NavigationMesh.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.Navigation
  18. {
  19. /// <summary>
  20. /// Navigation mesh component. Collects the navigation geometry from child nodes with the Navigable component and responds to path queries.
  21. /// </summary>
  22. public unsafe partial class NavigationMesh : Component
  23. {
  24. unsafe partial void OnNavigationMeshCreated ();
  25. [Preserve]
  26. public NavigationMesh (IntPtr handle) : base (handle)
  27. {
  28. OnNavigationMeshCreated ();
  29. }
  30. [Preserve]
  31. protected NavigationMesh (UrhoObjectFlag emptyFlag) : base (emptyFlag)
  32. {
  33. OnNavigationMeshCreated ();
  34. }
  35. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  36. internal static extern int NavigationMesh_GetType (IntPtr handle);
  37. private StringHash UrhoGetType ()
  38. {
  39. Runtime.ValidateRefCounted (this);
  40. return new StringHash (NavigationMesh_GetType (handle));
  41. }
  42. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  43. internal static extern IntPtr NavigationMesh_GetTypeName (IntPtr handle);
  44. private string GetTypeName ()
  45. {
  46. Runtime.ValidateRefCounted (this);
  47. return Marshal.PtrToStringAnsi (NavigationMesh_GetTypeName (handle));
  48. }
  49. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  50. internal static extern int NavigationMesh_GetTypeStatic ();
  51. private static StringHash GetTypeStatic ()
  52. {
  53. Runtime.Validate (typeof(NavigationMesh));
  54. return new StringHash (NavigationMesh_GetTypeStatic ());
  55. }
  56. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  57. internal static extern IntPtr NavigationMesh_GetTypeNameStatic ();
  58. private static string GetTypeNameStatic ()
  59. {
  60. Runtime.Validate (typeof(NavigationMesh));
  61. return Marshal.PtrToStringAnsi (NavigationMesh_GetTypeNameStatic ());
  62. }
  63. [Preserve]
  64. public NavigationMesh () : this (Application.CurrentContext)
  65. {
  66. }
  67. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  68. internal static extern IntPtr NavigationMesh_NavigationMesh (IntPtr context);
  69. [Preserve]
  70. public NavigationMesh (Context context) : base (UrhoObjectFlag.Empty)
  71. {
  72. Runtime.Validate (typeof(NavigationMesh));
  73. handle = NavigationMesh_NavigationMesh ((object)context == null ? IntPtr.Zero : context.Handle);
  74. Runtime.RegisterObject (this);
  75. OnNavigationMeshCreated ();
  76. }
  77. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  78. internal static extern void NavigationMesh_RegisterObject (IntPtr context);
  79. /// <summary>
  80. /// Register object factory.
  81. /// </summary>
  82. public new static void RegisterObject (Context context)
  83. {
  84. Runtime.Validate (typeof(NavigationMesh));
  85. NavigationMesh_RegisterObject ((object)context == null ? IntPtr.Zero : context.Handle);
  86. }
  87. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  88. internal static extern void NavigationMesh_DrawDebugGeometry (IntPtr handle, IntPtr debug, bool depthTest);
  89. /// <summary>
  90. /// Visualize the component as debug geometry.
  91. /// </summary>
  92. public override void DrawDebugGeometry (DebugRenderer debug, bool depthTest)
  93. {
  94. Runtime.ValidateRefCounted (this);
  95. NavigationMesh_DrawDebugGeometry (handle, (object)debug == null ? IntPtr.Zero : debug.Handle, depthTest);
  96. }
  97. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  98. internal static extern void NavigationMesh_SetTileSize (IntPtr handle, int size);
  99. /// <summary>
  100. /// Set tile size.
  101. /// </summary>
  102. private void SetTileSize (int size)
  103. {
  104. Runtime.ValidateRefCounted (this);
  105. NavigationMesh_SetTileSize (handle, size);
  106. }
  107. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  108. internal static extern void NavigationMesh_SetCellSize (IntPtr handle, float size);
  109. /// <summary>
  110. /// Set cell size.
  111. /// </summary>
  112. private void SetCellSize (float size)
  113. {
  114. Runtime.ValidateRefCounted (this);
  115. NavigationMesh_SetCellSize (handle, size);
  116. }
  117. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  118. internal static extern void NavigationMesh_SetCellHeight (IntPtr handle, float height);
  119. /// <summary>
  120. /// Set cell height.
  121. /// </summary>
  122. private void SetCellHeight (float height)
  123. {
  124. Runtime.ValidateRefCounted (this);
  125. NavigationMesh_SetCellHeight (handle, height);
  126. }
  127. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  128. internal static extern void NavigationMesh_SetAgentHeight (IntPtr handle, float height);
  129. /// <summary>
  130. /// Set navigation agent height.
  131. /// </summary>
  132. private void SetAgentHeight (float height)
  133. {
  134. Runtime.ValidateRefCounted (this);
  135. NavigationMesh_SetAgentHeight (handle, height);
  136. }
  137. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  138. internal static extern void NavigationMesh_SetAgentRadius (IntPtr handle, float radius);
  139. /// <summary>
  140. /// Set navigation agent radius.
  141. /// </summary>
  142. private void SetAgentRadius (float radius)
  143. {
  144. Runtime.ValidateRefCounted (this);
  145. NavigationMesh_SetAgentRadius (handle, radius);
  146. }
  147. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  148. internal static extern void NavigationMesh_SetAgentMaxClimb (IntPtr handle, float maxClimb);
  149. /// <summary>
  150. /// Set navigation agent max vertical climb.
  151. /// </summary>
  152. private void SetAgentMaxClimb (float maxClimb)
  153. {
  154. Runtime.ValidateRefCounted (this);
  155. NavigationMesh_SetAgentMaxClimb (handle, maxClimb);
  156. }
  157. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  158. internal static extern void NavigationMesh_SetAgentMaxSlope (IntPtr handle, float maxSlope);
  159. /// <summary>
  160. /// Set navigation agent max slope.
  161. /// </summary>
  162. private void SetAgentMaxSlope (float maxSlope)
  163. {
  164. Runtime.ValidateRefCounted (this);
  165. NavigationMesh_SetAgentMaxSlope (handle, maxSlope);
  166. }
  167. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  168. internal static extern void NavigationMesh_SetRegionMinSize (IntPtr handle, float size);
  169. /// <summary>
  170. /// Set region minimum size.
  171. /// </summary>
  172. private void SetRegionMinSize (float size)
  173. {
  174. Runtime.ValidateRefCounted (this);
  175. NavigationMesh_SetRegionMinSize (handle, size);
  176. }
  177. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  178. internal static extern void NavigationMesh_SetRegionMergeSize (IntPtr handle, float size);
  179. /// <summary>
  180. /// Set region merge size.
  181. /// </summary>
  182. private void SetRegionMergeSize (float size)
  183. {
  184. Runtime.ValidateRefCounted (this);
  185. NavigationMesh_SetRegionMergeSize (handle, size);
  186. }
  187. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  188. internal static extern void NavigationMesh_SetEdgeMaxLength (IntPtr handle, float length);
  189. /// <summary>
  190. /// Set edge max length.
  191. /// </summary>
  192. private void SetEdgeMaxLength (float length)
  193. {
  194. Runtime.ValidateRefCounted (this);
  195. NavigationMesh_SetEdgeMaxLength (handle, length);
  196. }
  197. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  198. internal static extern void NavigationMesh_SetEdgeMaxError (IntPtr handle, float error);
  199. /// <summary>
  200. /// Set edge max error.
  201. /// </summary>
  202. private void SetEdgeMaxError (float error)
  203. {
  204. Runtime.ValidateRefCounted (this);
  205. NavigationMesh_SetEdgeMaxError (handle, error);
  206. }
  207. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  208. internal static extern void NavigationMesh_SetDetailSampleDistance (IntPtr handle, float distance);
  209. /// <summary>
  210. /// Set detail sampling distance.
  211. /// </summary>
  212. private void SetDetailSampleDistance (float distance)
  213. {
  214. Runtime.ValidateRefCounted (this);
  215. NavigationMesh_SetDetailSampleDistance (handle, distance);
  216. }
  217. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  218. internal static extern void NavigationMesh_SetDetailSampleMaxError (IntPtr handle, float error);
  219. /// <summary>
  220. /// Set detail sampling maximum error.
  221. /// </summary>
  222. private void SetDetailSampleMaxError (float error)
  223. {
  224. Runtime.ValidateRefCounted (this);
  225. NavigationMesh_SetDetailSampleMaxError (handle, error);
  226. }
  227. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  228. internal static extern void NavigationMesh_SetPadding (IntPtr handle, ref Urho.Vector3 padding);
  229. /// <summary>
  230. /// Set padding of the navigation mesh bounding box. Having enough padding allows to add geometry on the extremities of the navigation mesh when doing partial rebuilds.
  231. /// </summary>
  232. private void SetPadding (Urho.Vector3 padding)
  233. {
  234. Runtime.ValidateRefCounted (this);
  235. NavigationMesh_SetPadding (handle, ref padding);
  236. }
  237. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  238. internal static extern void NavigationMesh_SetAreaCost (IntPtr handle, uint areaID, float cost);
  239. /// <summary>
  240. /// Set the cost of an area.
  241. /// </summary>
  242. public void SetAreaCost (uint areaID, float cost)
  243. {
  244. Runtime.ValidateRefCounted (this);
  245. NavigationMesh_SetAreaCost (handle, areaID, cost);
  246. }
  247. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  248. internal static extern bool NavigationMesh_Allocate (IntPtr handle, ref Urho.BoundingBox boundingBox, uint maxTiles);
  249. /// <summary>
  250. /// Allocate the navigation mesh without building any tiles. Bounding box is not padded. Return true if successful.
  251. /// </summary>
  252. public virtual bool Allocate (Urho.BoundingBox boundingBox, uint maxTiles)
  253. {
  254. Runtime.ValidateRefCounted (this);
  255. return NavigationMesh_Allocate (handle, ref boundingBox, maxTiles);
  256. }
  257. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  258. internal static extern bool NavigationMesh_Build (IntPtr handle);
  259. /// <summary>
  260. /// Rebuild the navigation mesh. Return true if successful.
  261. /// </summary>
  262. public virtual bool Build ()
  263. {
  264. Runtime.ValidateRefCounted (this);
  265. return NavigationMesh_Build (handle);
  266. }
  267. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  268. internal static extern bool NavigationMesh_Build0 (IntPtr handle, ref Urho.BoundingBox boundingBox);
  269. /// <summary>
  270. /// Rebuild part of the navigation mesh contained by the world-space bounding box. Return true if successful.
  271. /// </summary>
  272. public virtual bool Build (Urho.BoundingBox boundingBox)
  273. {
  274. Runtime.ValidateRefCounted (this);
  275. return NavigationMesh_Build0 (handle, ref boundingBox);
  276. }
  277. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  278. internal static extern bool NavigationMesh_Build1 (IntPtr handle, ref Urho.IntVector2 from, ref Urho.IntVector2 to);
  279. /// <summary>
  280. /// Rebuild part of the navigation mesh in the rectangular area. Return true if successful.
  281. /// </summary>
  282. public virtual bool Build (Urho.IntVector2 from, Urho.IntVector2 to)
  283. {
  284. Runtime.ValidateRefCounted (this);
  285. return NavigationMesh_Build1 (handle, ref from, ref to);
  286. }
  287. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  288. internal static extern void NavigationMesh_RemoveTile (IntPtr handle, ref Urho.IntVector2 tile);
  289. /// <summary>
  290. /// Remove tile from navigation mesh.
  291. /// </summary>
  292. public virtual void RemoveTile (Urho.IntVector2 tile)
  293. {
  294. Runtime.ValidateRefCounted (this);
  295. NavigationMesh_RemoveTile (handle, ref tile);
  296. }
  297. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  298. internal static extern void NavigationMesh_RemoveAllTiles (IntPtr handle);
  299. /// <summary>
  300. /// Remove all tiles from navigation mesh.
  301. /// </summary>
  302. public virtual void RemoveAllTiles ()
  303. {
  304. Runtime.ValidateRefCounted (this);
  305. NavigationMesh_RemoveAllTiles (handle);
  306. }
  307. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  308. internal static extern bool NavigationMesh_HasTile (IntPtr handle, ref Urho.IntVector2 tile);
  309. /// <summary>
  310. /// Return whether the navigation mesh has tile.
  311. /// </summary>
  312. public bool HasTile (Urho.IntVector2 tile)
  313. {
  314. Runtime.ValidateRefCounted (this);
  315. return NavigationMesh_HasTile (handle, ref tile);
  316. }
  317. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  318. internal static extern BoundingBox NavigationMesh_GetTileBoudningBox (IntPtr handle, ref Urho.IntVector2 tile);
  319. /// <summary>
  320. /// Return bounding box of the tile in the node space.
  321. /// </summary>
  322. public BoundingBox GetTileBoudningBox (Urho.IntVector2 tile)
  323. {
  324. Runtime.ValidateRefCounted (this);
  325. return NavigationMesh_GetTileBoudningBox (handle, ref tile);
  326. }
  327. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  328. internal static extern Urho.IntVector2 NavigationMesh_GetTileIndex (IntPtr handle, ref Urho.Vector3 position);
  329. /// <summary>
  330. /// Return index of the tile at the position.
  331. /// </summary>
  332. public Urho.IntVector2 GetTileIndex (Urho.Vector3 position)
  333. {
  334. Runtime.ValidateRefCounted (this);
  335. return NavigationMesh_GetTileIndex (handle, ref position);
  336. }
  337. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  338. internal static extern Vector3 NavigationMesh_FindNearestPoint (IntPtr handle, ref Urho.Vector3 point, ref Urho.Vector3 extents, dtQueryFilter* filter, uint* nearestRef);
  339. /// <summary>
  340. /// Find the nearest point on the navigation mesh to a given point. Extents specifies how far out from the specified point to check along each axis.
  341. /// </summary>
  342. public Vector3 FindNearestPoint (Urho.Vector3 point, Urho.Vector3 extents, dtQueryFilter* filter = null, uint* nearestRef = null)
  343. {
  344. Runtime.ValidateRefCounted (this);
  345. return NavigationMesh_FindNearestPoint (handle, ref point, ref extents, filter, nearestRef);
  346. }
  347. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  348. internal static extern Vector3 NavigationMesh_MoveAlongSurface (IntPtr handle, ref Urho.Vector3 start, ref Urho.Vector3 end, ref Urho.Vector3 extents, int maxVisited, dtQueryFilter* filter);
  349. /// <summary>
  350. /// Try to move along the surface from one point to another.
  351. /// </summary>
  352. public Vector3 MoveAlongSurface (Urho.Vector3 start, Urho.Vector3 end, Urho.Vector3 extents, int maxVisited = 3, dtQueryFilter* filter = null)
  353. {
  354. Runtime.ValidateRefCounted (this);
  355. return NavigationMesh_MoveAlongSurface (handle, ref start, ref end, ref extents, maxVisited, filter);
  356. }
  357. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  358. internal static extern Vector3 NavigationMesh_GetRandomPoint (IntPtr handle, dtQueryFilter* filter, uint* randomRef);
  359. /// <summary>
  360. /// Return a random point on the navigation mesh.
  361. /// </summary>
  362. public Vector3 GetRandomPoint (dtQueryFilter* filter = null, uint* randomRef = null)
  363. {
  364. Runtime.ValidateRefCounted (this);
  365. return NavigationMesh_GetRandomPoint (handle, filter, randomRef);
  366. }
  367. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  368. internal static extern Vector3 NavigationMesh_GetRandomPointInCircle (IntPtr handle, ref Urho.Vector3 center, float radius, ref Urho.Vector3 extents, dtQueryFilter* filter, uint* randomRef);
  369. /// <summary>
  370. /// Return a random point on the navigation mesh within a circle. The circle radius is only a guideline and in practice the returned point may be further away.
  371. /// </summary>
  372. public Vector3 GetRandomPointInCircle (Urho.Vector3 center, float radius, Urho.Vector3 extents, dtQueryFilter* filter = null, uint* randomRef = null)
  373. {
  374. Runtime.ValidateRefCounted (this);
  375. return NavigationMesh_GetRandomPointInCircle (handle, ref center, radius, ref extents, filter, randomRef);
  376. }
  377. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  378. internal static extern float NavigationMesh_GetDistanceToWall (IntPtr handle, ref Urho.Vector3 point, float radius, ref Urho.Vector3 extents, dtQueryFilter* filter, Vector3* hitPos, Vector3* hitNormal);
  379. /// <summary>
  380. /// Return distance to wall from a point. Maximum search radius must be specified.
  381. /// </summary>
  382. public float GetDistanceToWall (Urho.Vector3 point, float radius, Urho.Vector3 extents, dtQueryFilter* filter = null, Vector3* hitPos = null, Vector3* hitNormal = null)
  383. {
  384. Runtime.ValidateRefCounted (this);
  385. return NavigationMesh_GetDistanceToWall (handle, ref point, radius, ref extents, filter, hitPos, hitNormal);
  386. }
  387. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  388. internal static extern Vector3 NavigationMesh_Raycast (IntPtr handle, ref Urho.Vector3 start, ref Urho.Vector3 end, ref Urho.Vector3 extents, dtQueryFilter* filter, Vector3* hitNormal);
  389. /// <summary>
  390. /// Perform a walkability raycast on the navigation mesh between start and end and return the point where a wall was hit, or the end point if no walls.
  391. /// </summary>
  392. public Vector3 Raycast (Urho.Vector3 start, Urho.Vector3 end, Urho.Vector3 extents, dtQueryFilter* filter = null, Vector3* hitNormal = null)
  393. {
  394. Runtime.ValidateRefCounted (this);
  395. return NavigationMesh_Raycast (handle, ref start, ref end, ref extents, filter, hitNormal);
  396. }
  397. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  398. internal static extern void NavigationMesh_DrawDebugGeometry2 (IntPtr handle, bool depthTest);
  399. /// <summary>
  400. /// Add debug geometry to the debug renderer.
  401. /// </summary>
  402. public virtual void DrawDebugGeometry (bool depthTest)
  403. {
  404. Runtime.ValidateRefCounted (this);
  405. NavigationMesh_DrawDebugGeometry2 (handle, depthTest);
  406. }
  407. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  408. internal static extern IntPtr NavigationMesh_GetMeshName (IntPtr handle);
  409. /// <summary>
  410. /// Return the given name of this navigation mesh.
  411. /// </summary>
  412. private string GetMeshName ()
  413. {
  414. Runtime.ValidateRefCounted (this);
  415. return Marshal.PtrToStringAnsi (NavigationMesh_GetMeshName (handle));
  416. }
  417. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  418. internal static extern void NavigationMesh_SetMeshName (IntPtr handle, string newName);
  419. /// <summary>
  420. /// Set the name of this navigation mesh.
  421. /// </summary>
  422. public void SetMeshName (string newName)
  423. {
  424. Runtime.ValidateRefCounted (this);
  425. NavigationMesh_SetMeshName (handle, newName);
  426. }
  427. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  428. internal static extern int NavigationMesh_GetTileSize (IntPtr handle);
  429. /// <summary>
  430. /// Return tile size.
  431. /// </summary>
  432. private int GetTileSize ()
  433. {
  434. Runtime.ValidateRefCounted (this);
  435. return NavigationMesh_GetTileSize (handle);
  436. }
  437. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  438. internal static extern float NavigationMesh_GetCellSize (IntPtr handle);
  439. /// <summary>
  440. /// Return cell size.
  441. /// </summary>
  442. private float GetCellSize ()
  443. {
  444. Runtime.ValidateRefCounted (this);
  445. return NavigationMesh_GetCellSize (handle);
  446. }
  447. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  448. internal static extern float NavigationMesh_GetCellHeight (IntPtr handle);
  449. /// <summary>
  450. /// Return cell height.
  451. /// </summary>
  452. private float GetCellHeight ()
  453. {
  454. Runtime.ValidateRefCounted (this);
  455. return NavigationMesh_GetCellHeight (handle);
  456. }
  457. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  458. internal static extern float NavigationMesh_GetAgentHeight (IntPtr handle);
  459. /// <summary>
  460. /// Return navigation agent height.
  461. /// </summary>
  462. private float GetAgentHeight ()
  463. {
  464. Runtime.ValidateRefCounted (this);
  465. return NavigationMesh_GetAgentHeight (handle);
  466. }
  467. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  468. internal static extern float NavigationMesh_GetAgentRadius (IntPtr handle);
  469. /// <summary>
  470. /// Return navigation agent radius.
  471. /// </summary>
  472. private float GetAgentRadius ()
  473. {
  474. Runtime.ValidateRefCounted (this);
  475. return NavigationMesh_GetAgentRadius (handle);
  476. }
  477. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  478. internal static extern float NavigationMesh_GetAgentMaxClimb (IntPtr handle);
  479. /// <summary>
  480. /// Return navigation agent max vertical climb.
  481. /// </summary>
  482. private float GetAgentMaxClimb ()
  483. {
  484. Runtime.ValidateRefCounted (this);
  485. return NavigationMesh_GetAgentMaxClimb (handle);
  486. }
  487. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  488. internal static extern float NavigationMesh_GetAgentMaxSlope (IntPtr handle);
  489. /// <summary>
  490. /// Return navigation agent max slope.
  491. /// </summary>
  492. private float GetAgentMaxSlope ()
  493. {
  494. Runtime.ValidateRefCounted (this);
  495. return NavigationMesh_GetAgentMaxSlope (handle);
  496. }
  497. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  498. internal static extern float NavigationMesh_GetRegionMinSize (IntPtr handle);
  499. /// <summary>
  500. /// Return region minimum size.
  501. /// </summary>
  502. private float GetRegionMinSize ()
  503. {
  504. Runtime.ValidateRefCounted (this);
  505. return NavigationMesh_GetRegionMinSize (handle);
  506. }
  507. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  508. internal static extern float NavigationMesh_GetRegionMergeSize (IntPtr handle);
  509. /// <summary>
  510. /// Return region merge size.
  511. /// </summary>
  512. private float GetRegionMergeSize ()
  513. {
  514. Runtime.ValidateRefCounted (this);
  515. return NavigationMesh_GetRegionMergeSize (handle);
  516. }
  517. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  518. internal static extern float NavigationMesh_GetEdgeMaxLength (IntPtr handle);
  519. /// <summary>
  520. /// Return edge max length.
  521. /// </summary>
  522. private float GetEdgeMaxLength ()
  523. {
  524. Runtime.ValidateRefCounted (this);
  525. return NavigationMesh_GetEdgeMaxLength (handle);
  526. }
  527. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  528. internal static extern float NavigationMesh_GetEdgeMaxError (IntPtr handle);
  529. /// <summary>
  530. /// Return edge max error.
  531. /// </summary>
  532. private float GetEdgeMaxError ()
  533. {
  534. Runtime.ValidateRefCounted (this);
  535. return NavigationMesh_GetEdgeMaxError (handle);
  536. }
  537. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  538. internal static extern float NavigationMesh_GetDetailSampleDistance (IntPtr handle);
  539. /// <summary>
  540. /// Return detail sampling distance.
  541. /// </summary>
  542. private float GetDetailSampleDistance ()
  543. {
  544. Runtime.ValidateRefCounted (this);
  545. return NavigationMesh_GetDetailSampleDistance (handle);
  546. }
  547. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  548. internal static extern float NavigationMesh_GetDetailSampleMaxError (IntPtr handle);
  549. /// <summary>
  550. /// Return detail sampling maximum error.
  551. /// </summary>
  552. private float GetDetailSampleMaxError ()
  553. {
  554. Runtime.ValidateRefCounted (this);
  555. return NavigationMesh_GetDetailSampleMaxError (handle);
  556. }
  557. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  558. internal static extern Urho.Vector3 NavigationMesh_GetPadding (IntPtr handle);
  559. /// <summary>
  560. /// Return navigation mesh bounding box padding.
  561. /// </summary>
  562. private Urho.Vector3 GetPadding ()
  563. {
  564. Runtime.ValidateRefCounted (this);
  565. return NavigationMesh_GetPadding (handle);
  566. }
  567. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  568. internal static extern float NavigationMesh_GetAreaCost (IntPtr handle, uint areaID);
  569. /// <summary>
  570. /// Get the current cost of an area
  571. /// </summary>
  572. public float GetAreaCost (uint areaID)
  573. {
  574. Runtime.ValidateRefCounted (this);
  575. return NavigationMesh_GetAreaCost (handle, areaID);
  576. }
  577. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  578. internal static extern bool NavigationMesh_IsInitialized (IntPtr handle);
  579. /// <summary>
  580. /// Return whether has been initialized with valid navigation data.
  581. /// </summary>
  582. private bool IsInitialized ()
  583. {
  584. Runtime.ValidateRefCounted (this);
  585. return NavigationMesh_IsInitialized (handle);
  586. }
  587. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  588. internal static extern Urho.BoundingBox NavigationMesh_GetBoundingBox (IntPtr handle);
  589. /// <summary>
  590. /// Return local space bounding box of the navigation mesh.
  591. /// </summary>
  592. private Urho.BoundingBox GetBoundingBox ()
  593. {
  594. Runtime.ValidateRefCounted (this);
  595. return NavigationMesh_GetBoundingBox (handle);
  596. }
  597. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  598. internal static extern BoundingBox NavigationMesh_GetWorldBoundingBox (IntPtr handle);
  599. /// <summary>
  600. /// Return world space bounding box of the navigation mesh.
  601. /// </summary>
  602. private BoundingBox GetWorldBoundingBox ()
  603. {
  604. Runtime.ValidateRefCounted (this);
  605. return NavigationMesh_GetWorldBoundingBox (handle);
  606. }
  607. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  608. internal static extern Urho.IntVector2 NavigationMesh_GetNumTiles (IntPtr handle);
  609. /// <summary>
  610. /// Return number of tiles.
  611. /// </summary>
  612. private Urho.IntVector2 GetNumTiles ()
  613. {
  614. Runtime.ValidateRefCounted (this);
  615. return NavigationMesh_GetNumTiles (handle);
  616. }
  617. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  618. internal static extern void NavigationMesh_SetPartitionType (IntPtr handle, NavmeshPartitionType aType);
  619. /// <summary>
  620. /// Set the partition type used for polygon generation.
  621. /// </summary>
  622. private void SetPartitionType (NavmeshPartitionType aType)
  623. {
  624. Runtime.ValidateRefCounted (this);
  625. NavigationMesh_SetPartitionType (handle, aType);
  626. }
  627. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  628. internal static extern NavmeshPartitionType NavigationMesh_GetPartitionType (IntPtr handle);
  629. /// <summary>
  630. /// Return Partition Type.
  631. /// </summary>
  632. private NavmeshPartitionType GetPartitionType ()
  633. {
  634. Runtime.ValidateRefCounted (this);
  635. return NavigationMesh_GetPartitionType (handle);
  636. }
  637. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  638. internal static extern void NavigationMesh_SetDrawOffMeshConnections (IntPtr handle, bool enable);
  639. /// <summary>
  640. /// Draw debug geometry for OffMeshConnection components.
  641. /// </summary>
  642. private void SetDrawOffMeshConnections (bool enable)
  643. {
  644. Runtime.ValidateRefCounted (this);
  645. NavigationMesh_SetDrawOffMeshConnections (handle, enable);
  646. }
  647. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  648. internal static extern bool NavigationMesh_GetDrawOffMeshConnections (IntPtr handle);
  649. /// <summary>
  650. /// Return whether to draw OffMeshConnection components.
  651. /// </summary>
  652. private bool GetDrawOffMeshConnections ()
  653. {
  654. Runtime.ValidateRefCounted (this);
  655. return NavigationMesh_GetDrawOffMeshConnections (handle);
  656. }
  657. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  658. internal static extern void NavigationMesh_SetDrawNavAreas (IntPtr handle, bool enable);
  659. /// <summary>
  660. /// Draw debug geometry for NavArea components.
  661. /// </summary>
  662. private void SetDrawNavAreas (bool enable)
  663. {
  664. Runtime.ValidateRefCounted (this);
  665. NavigationMesh_SetDrawNavAreas (handle, enable);
  666. }
  667. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  668. internal static extern bool NavigationMesh_GetDrawNavAreas (IntPtr handle);
  669. /// <summary>
  670. /// Return whether to draw NavArea components.
  671. /// </summary>
  672. private bool GetDrawNavAreas ()
  673. {
  674. Runtime.ValidateRefCounted (this);
  675. return NavigationMesh_GetDrawNavAreas (handle);
  676. }
  677. public override StringHash Type {
  678. get {
  679. return UrhoGetType ();
  680. }
  681. }
  682. public override string TypeName {
  683. get {
  684. return GetTypeName ();
  685. }
  686. }
  687. [Preserve]
  688. public new static StringHash TypeStatic {
  689. get {
  690. return GetTypeStatic ();
  691. }
  692. }
  693. public new static string TypeNameStatic {
  694. get {
  695. return GetTypeNameStatic ();
  696. }
  697. }
  698. /// <summary>
  699. /// Return tile size.
  700. /// Or
  701. /// Set tile size.
  702. /// </summary>
  703. public int TileSize {
  704. get {
  705. return GetTileSize ();
  706. }
  707. set {
  708. SetTileSize (value);
  709. }
  710. }
  711. /// <summary>
  712. /// Return cell size.
  713. /// Or
  714. /// Set cell size.
  715. /// </summary>
  716. public float CellSize {
  717. get {
  718. return GetCellSize ();
  719. }
  720. set {
  721. SetCellSize (value);
  722. }
  723. }
  724. /// <summary>
  725. /// Return cell height.
  726. /// Or
  727. /// Set cell height.
  728. /// </summary>
  729. public float CellHeight {
  730. get {
  731. return GetCellHeight ();
  732. }
  733. set {
  734. SetCellHeight (value);
  735. }
  736. }
  737. /// <summary>
  738. /// Return navigation agent height.
  739. /// Or
  740. /// Set navigation agent height.
  741. /// </summary>
  742. public float AgentHeight {
  743. get {
  744. return GetAgentHeight ();
  745. }
  746. set {
  747. SetAgentHeight (value);
  748. }
  749. }
  750. /// <summary>
  751. /// Return navigation agent radius.
  752. /// Or
  753. /// Set navigation agent radius.
  754. /// </summary>
  755. public float AgentRadius {
  756. get {
  757. return GetAgentRadius ();
  758. }
  759. set {
  760. SetAgentRadius (value);
  761. }
  762. }
  763. /// <summary>
  764. /// Return navigation agent max vertical climb.
  765. /// Or
  766. /// Set navigation agent max vertical climb.
  767. /// </summary>
  768. public float AgentMaxClimb {
  769. get {
  770. return GetAgentMaxClimb ();
  771. }
  772. set {
  773. SetAgentMaxClimb (value);
  774. }
  775. }
  776. /// <summary>
  777. /// Return navigation agent max slope.
  778. /// Or
  779. /// Set navigation agent max slope.
  780. /// </summary>
  781. public float AgentMaxSlope {
  782. get {
  783. return GetAgentMaxSlope ();
  784. }
  785. set {
  786. SetAgentMaxSlope (value);
  787. }
  788. }
  789. /// <summary>
  790. /// Return region minimum size.
  791. /// Or
  792. /// Set region minimum size.
  793. /// </summary>
  794. public float RegionMinSize {
  795. get {
  796. return GetRegionMinSize ();
  797. }
  798. set {
  799. SetRegionMinSize (value);
  800. }
  801. }
  802. /// <summary>
  803. /// Return region merge size.
  804. /// Or
  805. /// Set region merge size.
  806. /// </summary>
  807. public float RegionMergeSize {
  808. get {
  809. return GetRegionMergeSize ();
  810. }
  811. set {
  812. SetRegionMergeSize (value);
  813. }
  814. }
  815. /// <summary>
  816. /// Return edge max length.
  817. /// Or
  818. /// Set edge max length.
  819. /// </summary>
  820. public float EdgeMaxLength {
  821. get {
  822. return GetEdgeMaxLength ();
  823. }
  824. set {
  825. SetEdgeMaxLength (value);
  826. }
  827. }
  828. /// <summary>
  829. /// Return edge max error.
  830. /// Or
  831. /// Set edge max error.
  832. /// </summary>
  833. public float EdgeMaxError {
  834. get {
  835. return GetEdgeMaxError ();
  836. }
  837. set {
  838. SetEdgeMaxError (value);
  839. }
  840. }
  841. /// <summary>
  842. /// Return detail sampling distance.
  843. /// Or
  844. /// Set detail sampling distance.
  845. /// </summary>
  846. public float DetailSampleDistance {
  847. get {
  848. return GetDetailSampleDistance ();
  849. }
  850. set {
  851. SetDetailSampleDistance (value);
  852. }
  853. }
  854. /// <summary>
  855. /// Return detail sampling maximum error.
  856. /// Or
  857. /// Set detail sampling maximum error.
  858. /// </summary>
  859. public float DetailSampleMaxError {
  860. get {
  861. return GetDetailSampleMaxError ();
  862. }
  863. set {
  864. SetDetailSampleMaxError (value);
  865. }
  866. }
  867. /// <summary>
  868. /// Return navigation mesh bounding box padding.
  869. /// Or
  870. /// Set padding of the navigation mesh bounding box. Having enough padding allows to add geometry on the extremities of the navigation mesh when doing partial rebuilds.
  871. /// </summary>
  872. public Urho.Vector3 Padding {
  873. get {
  874. return GetPadding ();
  875. }
  876. set {
  877. SetPadding (value);
  878. }
  879. }
  880. /// <summary>
  881. /// Return the given name of this navigation mesh.
  882. /// </summary>
  883. public string MeshName {
  884. get {
  885. return GetMeshName ();
  886. }
  887. }
  888. /// <summary>
  889. /// Return whether has been initialized with valid navigation data.
  890. /// </summary>
  891. public bool Initialized {
  892. get {
  893. return IsInitialized ();
  894. }
  895. }
  896. /// <summary>
  897. /// Return local space bounding box of the navigation mesh.
  898. /// </summary>
  899. public Urho.BoundingBox BoundingBox {
  900. get {
  901. return GetBoundingBox ();
  902. }
  903. }
  904. /// <summary>
  905. /// Return world space bounding box of the navigation mesh.
  906. /// </summary>
  907. public BoundingBox WorldBoundingBox {
  908. get {
  909. return GetWorldBoundingBox ();
  910. }
  911. }
  912. /// <summary>
  913. /// Return number of tiles.
  914. /// </summary>
  915. public Urho.IntVector2 NumTiles {
  916. get {
  917. return GetNumTiles ();
  918. }
  919. }
  920. /// <summary>
  921. /// Return Partition Type.
  922. /// Or
  923. /// Set the partition type used for polygon generation.
  924. /// </summary>
  925. public NavmeshPartitionType PartitionType {
  926. get {
  927. return GetPartitionType ();
  928. }
  929. set {
  930. SetPartitionType (value);
  931. }
  932. }
  933. /// <summary>
  934. /// Return whether to draw OffMeshConnection components.
  935. /// Or
  936. /// Draw debug geometry for OffMeshConnection components.
  937. /// </summary>
  938. public bool DrawOffMeshConnections {
  939. get {
  940. return GetDrawOffMeshConnections ();
  941. }
  942. set {
  943. SetDrawOffMeshConnections (value);
  944. }
  945. }
  946. /// <summary>
  947. /// Return whether to draw NavArea components.
  948. /// Or
  949. /// Draw debug geometry for NavArea components.
  950. /// </summary>
  951. public bool DrawNavAreas {
  952. get {
  953. return GetDrawNavAreas ();
  954. }
  955. set {
  956. SetDrawNavAreas (value);
  957. }
  958. }
  959. }
  960. }