DebugRenderer.cs 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507
  1. // WARNING - AUTOGENERATED - DO NOT EDIT
  2. //
  3. // Generated using `sharpie urho`
  4. //
  5. // DebugRenderer.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. /// Debug geometry rendering component. Should be added only to the root scene node.
  21. /// </summary>
  22. public unsafe partial class DebugRenderer : Component
  23. {
  24. unsafe partial void OnDebugRendererCreated ();
  25. [Preserve]
  26. public DebugRenderer (IntPtr handle) : base (handle)
  27. {
  28. OnDebugRendererCreated ();
  29. }
  30. [Preserve]
  31. protected DebugRenderer (UrhoObjectFlag emptyFlag) : base (emptyFlag)
  32. {
  33. OnDebugRendererCreated ();
  34. }
  35. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  36. internal static extern int DebugRenderer_GetType (IntPtr handle);
  37. private StringHash UrhoGetType ()
  38. {
  39. Runtime.ValidateRefCounted (this);
  40. return new StringHash (DebugRenderer_GetType (handle));
  41. }
  42. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  43. internal static extern IntPtr DebugRenderer_GetTypeName (IntPtr handle);
  44. private string GetTypeName ()
  45. {
  46. Runtime.ValidateRefCounted (this);
  47. return Marshal.PtrToStringAnsi (DebugRenderer_GetTypeName (handle));
  48. }
  49. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  50. internal static extern int DebugRenderer_GetTypeStatic ();
  51. private static StringHash GetTypeStatic ()
  52. {
  53. Runtime.Validate (typeof(DebugRenderer));
  54. return new StringHash (DebugRenderer_GetTypeStatic ());
  55. }
  56. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  57. internal static extern IntPtr DebugRenderer_GetTypeNameStatic ();
  58. private static string GetTypeNameStatic ()
  59. {
  60. Runtime.Validate (typeof(DebugRenderer));
  61. return Marshal.PtrToStringAnsi (DebugRenderer_GetTypeNameStatic ());
  62. }
  63. [Preserve]
  64. public DebugRenderer () : this (Application.CurrentContext)
  65. {
  66. }
  67. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  68. internal static extern IntPtr DebugRenderer_DebugRenderer (IntPtr context);
  69. [Preserve]
  70. public DebugRenderer (Context context) : base (UrhoObjectFlag.Empty)
  71. {
  72. Runtime.Validate (typeof(DebugRenderer));
  73. handle = DebugRenderer_DebugRenderer ((object)context == null ? IntPtr.Zero : context.Handle);
  74. Runtime.RegisterObject (this);
  75. OnDebugRendererCreated ();
  76. }
  77. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  78. internal static extern void DebugRenderer_RegisterObject (IntPtr context);
  79. /// <summary>
  80. /// Register object factory.
  81. /// </summary>
  82. public new static void RegisterObject (Context context)
  83. {
  84. Runtime.Validate (typeof(DebugRenderer));
  85. DebugRenderer_RegisterObject ((object)context == null ? IntPtr.Zero : context.Handle);
  86. }
  87. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  88. internal static extern void DebugRenderer_SetLineAntiAlias (IntPtr handle, bool enable);
  89. /// <summary>
  90. /// Set line antialiasing on/off. Default false.
  91. /// </summary>
  92. private void SetLineAntiAlias (bool enable)
  93. {
  94. Runtime.ValidateRefCounted (this);
  95. DebugRenderer_SetLineAntiAlias (handle, enable);
  96. }
  97. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  98. internal static extern void DebugRenderer_SetView (IntPtr handle, IntPtr camera);
  99. /// <summary>
  100. /// Set the camera viewpoint. Call before rendering, or before adding geometry if you want to use culling.
  101. /// </summary>
  102. public void SetView (Camera camera)
  103. {
  104. Runtime.ValidateRefCounted (this);
  105. DebugRenderer_SetView (handle, (object)camera == null ? IntPtr.Zero : camera.Handle);
  106. }
  107. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  108. internal static extern void DebugRenderer_AddLine (IntPtr handle, ref Urho.Vector3 start, ref Urho.Vector3 end, ref Urho.Color color, bool depthTest);
  109. /// <summary>
  110. /// Add a line.
  111. /// </summary>
  112. public void AddLine (Urho.Vector3 start, Urho.Vector3 end, Urho.Color color, bool depthTest = true)
  113. {
  114. Runtime.ValidateRefCounted (this);
  115. DebugRenderer_AddLine (handle, ref start, ref end, ref color, depthTest);
  116. }
  117. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  118. internal static extern void DebugRenderer_AddLine0 (IntPtr handle, ref Urho.Vector3 start, ref Urho.Vector3 end, uint color, bool depthTest);
  119. /// <summary>
  120. /// Add a line with color already converted to unsigned.
  121. /// </summary>
  122. public void AddLine (Urho.Vector3 start, Urho.Vector3 end, uint color, bool depthTest = true)
  123. {
  124. Runtime.ValidateRefCounted (this);
  125. DebugRenderer_AddLine0 (handle, ref start, ref end, color, depthTest);
  126. }
  127. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  128. internal static extern void DebugRenderer_AddTriangle (IntPtr handle, ref Urho.Vector3 v1, ref Urho.Vector3 v2, ref Urho.Vector3 v3, ref Urho.Color color, bool depthTest);
  129. /// <summary>
  130. /// Add a solid triangle.
  131. /// </summary>
  132. public void AddTriangle (Urho.Vector3 v1, Urho.Vector3 v2, Urho.Vector3 v3, Urho.Color color, bool depthTest = true)
  133. {
  134. Runtime.ValidateRefCounted (this);
  135. DebugRenderer_AddTriangle (handle, ref v1, ref v2, ref v3, ref color, depthTest);
  136. }
  137. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  138. internal static extern void DebugRenderer_AddTriangle1 (IntPtr handle, ref Urho.Vector3 v1, ref Urho.Vector3 v2, ref Urho.Vector3 v3, uint color, bool depthTest);
  139. /// <summary>
  140. /// Add a solid triangle with color already converted to unsigned.
  141. /// </summary>
  142. public void AddTriangle (Urho.Vector3 v1, Urho.Vector3 v2, Urho.Vector3 v3, uint color, bool depthTest = true)
  143. {
  144. Runtime.ValidateRefCounted (this);
  145. DebugRenderer_AddTriangle1 (handle, ref v1, ref v2, ref v3, color, depthTest);
  146. }
  147. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  148. internal static extern void DebugRenderer_AddPolygon (IntPtr handle, ref Urho.Vector3 v1, ref Urho.Vector3 v2, ref Urho.Vector3 v3, ref Urho.Vector3 v4, ref Urho.Color color, bool depthTest);
  149. /// <summary>
  150. /// Add a solid quadrangular polygon.
  151. /// </summary>
  152. public void AddPolygon (Urho.Vector3 v1, Urho.Vector3 v2, Urho.Vector3 v3, Urho.Vector3 v4, Urho.Color color, bool depthTest = true)
  153. {
  154. Runtime.ValidateRefCounted (this);
  155. DebugRenderer_AddPolygon (handle, ref v1, ref v2, ref v3, ref v4, ref color, depthTest);
  156. }
  157. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  158. internal static extern void DebugRenderer_AddPolygon2 (IntPtr handle, ref Urho.Vector3 v1, ref Urho.Vector3 v2, ref Urho.Vector3 v3, ref Urho.Vector3 v4, uint color, bool depthTest);
  159. /// <summary>
  160. /// Add a solid quadrangular polygon with color already converted to unsigned.
  161. /// </summary>
  162. public void AddPolygon (Urho.Vector3 v1, Urho.Vector3 v2, Urho.Vector3 v3, Urho.Vector3 v4, uint color, bool depthTest = true)
  163. {
  164. Runtime.ValidateRefCounted (this);
  165. DebugRenderer_AddPolygon2 (handle, ref v1, ref v2, ref v3, ref v4, color, depthTest);
  166. }
  167. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  168. internal static extern void DebugRenderer_AddNode (IntPtr handle, IntPtr node, float scale, bool depthTest);
  169. /// <summary>
  170. /// Add a scene node represented as its coordinate axes.
  171. /// </summary>
  172. public void AddNode (Node node, float scale = 1f, bool depthTest = true)
  173. {
  174. Runtime.ValidateRefCounted (this);
  175. DebugRenderer_AddNode (handle, (object)node == null ? IntPtr.Zero : node.Handle, scale, depthTest);
  176. }
  177. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  178. internal static extern void DebugRenderer_AddBoundingBox (IntPtr handle, ref Urho.BoundingBox box, ref Urho.Color color, bool depthTest, bool solid);
  179. /// <summary>
  180. /// Add a bounding box.
  181. /// </summary>
  182. public void AddBoundingBox (Urho.BoundingBox box, Urho.Color color, bool depthTest = true, bool solid = false)
  183. {
  184. Runtime.ValidateRefCounted (this);
  185. DebugRenderer_AddBoundingBox (handle, ref box, ref color, depthTest, solid);
  186. }
  187. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  188. internal static extern void DebugRenderer_AddBoundingBox3 (IntPtr handle, ref Urho.BoundingBox box, ref Urho.Matrix3x4 transform, ref Urho.Color color, bool depthTest, bool solid);
  189. /// <summary>
  190. /// Add a bounding box with transform.
  191. /// </summary>
  192. public void AddBoundingBox (Urho.BoundingBox box, Urho.Matrix3x4 transform, Urho.Color color, bool depthTest = true, bool solid = false)
  193. {
  194. Runtime.ValidateRefCounted (this);
  195. DebugRenderer_AddBoundingBox3 (handle, ref box, ref transform, ref color, depthTest, solid);
  196. }
  197. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  198. internal static extern void DebugRenderer_AddFrustum (IntPtr handle, IntPtr frustum, ref Urho.Color color, bool depthTest);
  199. /// <summary>
  200. /// Add a frustum.
  201. /// </summary>
  202. public void AddFrustum (Frustum frustum, Urho.Color color, bool depthTest = true)
  203. {
  204. Runtime.ValidateRefCounted (this);
  205. DebugRenderer_AddFrustum (handle, (object)frustum == null ? IntPtr.Zero : frustum.Handle, ref color, depthTest);
  206. }
  207. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  208. internal static extern void DebugRenderer_AddPolyhedron (IntPtr handle, IntPtr poly, ref Urho.Color color, bool depthTest);
  209. /// <summary>
  210. /// Add a polyhedron.
  211. /// </summary>
  212. public void AddPolyhedron (Polyhedron poly, Urho.Color color, bool depthTest = true)
  213. {
  214. Runtime.ValidateRefCounted (this);
  215. DebugRenderer_AddPolyhedron (handle, (object)poly == null ? IntPtr.Zero : poly.Handle, ref color, depthTest);
  216. }
  217. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  218. internal static extern void DebugRenderer_AddSphere (IntPtr handle, IntPtr sphere, ref Urho.Color color, bool depthTest);
  219. /// <summary>
  220. /// Add a sphere.
  221. /// </summary>
  222. public void AddSphere (SphereShape sphere, Urho.Color color, bool depthTest = true)
  223. {
  224. Runtime.ValidateRefCounted (this);
  225. DebugRenderer_AddSphere (handle, (object)sphere == null ? IntPtr.Zero : sphere.Handle, ref color, depthTest);
  226. }
  227. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  228. internal static extern void DebugRenderer_AddSphereSector (IntPtr handle, IntPtr sphere, ref Urho.Quaternion rotation, float angle, bool drawLines, ref Urho.Color color, bool depthTest);
  229. /// <summary>
  230. /// Add a sphere sector.
  231. /// </summary>
  232. public void AddSphereSector (SphereShape sphere, Urho.Quaternion rotation, float angle, bool drawLines, Urho.Color color, bool depthTest = true)
  233. {
  234. Runtime.ValidateRefCounted (this);
  235. DebugRenderer_AddSphereSector (handle, (object)sphere == null ? IntPtr.Zero : sphere.Handle, ref rotation, angle, drawLines, ref color, depthTest);
  236. }
  237. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  238. internal static extern void DebugRenderer_AddCylinder (IntPtr handle, ref Urho.Vector3 position, float radius, float height, ref Urho.Color color, bool depthTest);
  239. /// <summary>
  240. /// Add a cylinder
  241. /// </summary>
  242. public void AddCylinder (Urho.Vector3 position, float radius, float height, Urho.Color color, bool depthTest = true)
  243. {
  244. Runtime.ValidateRefCounted (this);
  245. DebugRenderer_AddCylinder (handle, ref position, radius, height, ref color, depthTest);
  246. }
  247. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  248. internal static extern void DebugRenderer_AddTriangleMesh (IntPtr handle, void* vertexData, uint vertexSize, void* indexData, uint indexSize, uint indexStart, uint indexCount, ref Urho.Matrix3x4 transform, ref Urho.Color color, bool depthTest);
  249. /// <summary>
  250. /// Add a triangle mesh.
  251. /// </summary>
  252. public void AddTriangleMesh (void* vertexData, uint vertexSize, void* indexData, uint indexSize, uint indexStart, uint indexCount, Urho.Matrix3x4 transform, Urho.Color color, bool depthTest = true)
  253. {
  254. Runtime.ValidateRefCounted (this);
  255. DebugRenderer_AddTriangleMesh (handle, vertexData, vertexSize, indexData, indexSize, indexStart, indexCount, ref transform, ref color, depthTest);
  256. }
  257. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  258. internal static extern void DebugRenderer_AddTriangleMesh4 (IntPtr handle, void* vertexData, uint vertexSize, uint vertexStart, void* indexData, uint indexSize, uint indexStart, uint indexCount, ref Urho.Matrix3x4 transform, ref Urho.Color color, bool depthTest);
  259. /// <summary>
  260. /// Add a triangle mesh.
  261. /// </summary>
  262. public void AddTriangleMesh (void* vertexData, uint vertexSize, uint vertexStart, void* indexData, uint indexSize, uint indexStart, uint indexCount, Urho.Matrix3x4 transform, Urho.Color color, bool depthTest = true)
  263. {
  264. Runtime.ValidateRefCounted (this);
  265. DebugRenderer_AddTriangleMesh4 (handle, vertexData, vertexSize, vertexStart, indexData, indexSize, indexStart, indexCount, ref transform, ref color, depthTest);
  266. }
  267. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  268. internal static extern void DebugRenderer_AddCircle (IntPtr handle, ref Urho.Vector3 center, ref Urho.Vector3 normal, float radius, ref Urho.Color color, int steps, bool depthTest);
  269. /// <summary>
  270. /// Add a circle.
  271. /// </summary>
  272. public void AddCircle (Urho.Vector3 center, Urho.Vector3 normal, float radius, Urho.Color color, int steps = 64, bool depthTest = true)
  273. {
  274. Runtime.ValidateRefCounted (this);
  275. DebugRenderer_AddCircle (handle, ref center, ref normal, radius, ref color, steps, depthTest);
  276. }
  277. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  278. internal static extern void DebugRenderer_AddCross (IntPtr handle, ref Urho.Vector3 center, float size, ref Urho.Color color, bool depthTest);
  279. /// <summary>
  280. /// Add a cross.
  281. /// </summary>
  282. public void AddCross (Urho.Vector3 center, float size, Urho.Color color, bool depthTest = true)
  283. {
  284. Runtime.ValidateRefCounted (this);
  285. DebugRenderer_AddCross (handle, ref center, size, ref color, depthTest);
  286. }
  287. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  288. internal static extern void DebugRenderer_AddQuad (IntPtr handle, ref Urho.Vector3 center, float width, float height, ref Urho.Color color, bool depthTest);
  289. /// <summary>
  290. /// Add a quad on the XZ plane.
  291. /// </summary>
  292. public void AddQuad (Urho.Vector3 center, float width, float height, Urho.Color color, bool depthTest = true)
  293. {
  294. Runtime.ValidateRefCounted (this);
  295. DebugRenderer_AddQuad (handle, ref center, width, height, ref color, depthTest);
  296. }
  297. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  298. internal static extern void DebugRenderer_Render (IntPtr handle);
  299. /// <summary>
  300. /// Update vertex buffer and render all debug lines. The viewport and rendertarget should be set before.
  301. /// </summary>
  302. public void Render ()
  303. {
  304. Runtime.ValidateRefCounted (this);
  305. DebugRenderer_Render (handle);
  306. }
  307. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  308. internal static extern bool DebugRenderer_GetLineAntiAlias (IntPtr handle);
  309. /// <summary>
  310. /// Return whether line antialiasing is enabled.
  311. /// </summary>
  312. private bool GetLineAntiAlias ()
  313. {
  314. Runtime.ValidateRefCounted (this);
  315. return DebugRenderer_GetLineAntiAlias (handle);
  316. }
  317. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  318. internal static extern Urho.Matrix3x4 DebugRenderer_GetView (IntPtr handle);
  319. /// <summary>
  320. /// Return the view transform.
  321. /// </summary>
  322. private Urho.Matrix3x4 GetView ()
  323. {
  324. Runtime.ValidateRefCounted (this);
  325. return DebugRenderer_GetView (handle);
  326. }
  327. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  328. internal static extern Urho.Matrix4 DebugRenderer_GetProjection (IntPtr handle);
  329. /// <summary>
  330. /// Return the projection transform.
  331. /// </summary>
  332. private Urho.Matrix4 GetProjection ()
  333. {
  334. Runtime.ValidateRefCounted (this);
  335. return DebugRenderer_GetProjection (handle);
  336. }
  337. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  338. internal static extern IntPtr DebugRenderer_GetFrustum (IntPtr handle);
  339. /// <summary>
  340. /// Return the view frustum.
  341. /// </summary>
  342. private Frustum GetFrustum ()
  343. {
  344. Runtime.ValidateRefCounted (this);
  345. return new Frustum (DebugRenderer_GetFrustum (handle));
  346. }
  347. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  348. internal static extern bool DebugRenderer_IsInside (IntPtr handle, ref Urho.BoundingBox box);
  349. /// <summary>
  350. /// Check whether a bounding box is inside the view frustum.
  351. /// </summary>
  352. public bool IsInside (Urho.BoundingBox box)
  353. {
  354. Runtime.ValidateRefCounted (this);
  355. return DebugRenderer_IsInside (handle, ref box);
  356. }
  357. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  358. internal static extern bool DebugRenderer_HasContent (IntPtr handle);
  359. /// <summary>
  360. /// Return whether has something to render.
  361. /// </summary>
  362. public bool HasContent ()
  363. {
  364. Runtime.ValidateRefCounted (this);
  365. return DebugRenderer_HasContent (handle);
  366. }
  367. public override StringHash Type {
  368. get {
  369. return UrhoGetType ();
  370. }
  371. }
  372. public override string TypeName {
  373. get {
  374. return GetTypeName ();
  375. }
  376. }
  377. [Preserve]
  378. public new static StringHash TypeStatic {
  379. get {
  380. return GetTypeStatic ();
  381. }
  382. }
  383. public new static string TypeNameStatic {
  384. get {
  385. return GetTypeNameStatic ();
  386. }
  387. }
  388. /// <summary>
  389. /// Return whether line antialiasing is enabled.
  390. /// Or
  391. /// Set line antialiasing on/off. Default false.
  392. /// </summary>
  393. public bool LineAntiAlias {
  394. get {
  395. return GetLineAntiAlias ();
  396. }
  397. set {
  398. SetLineAntiAlias (value);
  399. }
  400. }
  401. /// <summary>
  402. /// Return the view transform.
  403. /// </summary>
  404. public Urho.Matrix3x4 View {
  405. get {
  406. return GetView ();
  407. }
  408. }
  409. /// <summary>
  410. /// Return the projection transform.
  411. /// </summary>
  412. public Urho.Matrix4 Projection {
  413. get {
  414. return GetProjection ();
  415. }
  416. }
  417. /// <summary>
  418. /// Return the view frustum.
  419. /// </summary>
  420. public Frustum Frustum {
  421. get {
  422. return GetFrustum ();
  423. }
  424. }
  425. }
  426. }