Builtin.cs 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
  3. using System.Runtime.CompilerServices;
  4. namespace BansheeEngine
  5. {
  6. /** @addtogroup Utility
  7. * @{
  8. */
  9. /// <summary>
  10. /// Contains various builtin resources that are always available.
  11. /// </summary>
  12. public static class Builtin
  13. {
  14. /// <summary>
  15. /// Types of builtin meshes that are always available in the engine.
  16. /// </summary>
  17. private enum BuiltinMesh // Note: Must match C++ enum BuiltinMesh
  18. {
  19. Box, Sphere, Cone, Quad, Disc
  20. }
  21. /// <summary>
  22. /// Returns a pure white texture.
  23. /// </summary>
  24. public static SpriteTexture WhiteTexture
  25. {
  26. get { return Internal_GetWhiteTexture(); }
  27. }
  28. /// <summary>
  29. /// Returns the default shader to be used with renderables.
  30. /// </summary>
  31. public static Shader DiffuseShader
  32. {
  33. get { return Internal_GetDiffuseShader(); }
  34. }
  35. /// <summary>
  36. /// Returns a axis aligned box of unit size.
  37. /// </summary>
  38. public static Mesh Box
  39. {
  40. get { return Internal_GetMesh(BuiltinMesh.Box); }
  41. }
  42. /// <summary>
  43. /// Returns a unit sphere mesh.
  44. /// </summary>
  45. public static Mesh Sphere
  46. {
  47. get { return Internal_GetMesh(BuiltinMesh.Sphere); }
  48. }
  49. /// <summary>
  50. /// Returns a cone mesh.
  51. /// </summary>
  52. public static Mesh Cone
  53. {
  54. get { return Internal_GetMesh(BuiltinMesh.Cone); }
  55. }
  56. /// <summary>
  57. /// Returns a quad mesh with unit size edges.
  58. /// </summary>
  59. public static Mesh Quad
  60. {
  61. get { return Internal_GetMesh(BuiltinMesh.Quad); }
  62. }
  63. /// <summary>
  64. /// Returns a disc mesh with unit radius.
  65. /// </summary>
  66. public static Mesh Disc
  67. {
  68. get { return Internal_GetMesh(BuiltinMesh.Disc); }
  69. }
  70. /// <summary>
  71. /// Returns the default Font used in the engine.
  72. /// </summary>
  73. public static Font DefaultFont
  74. {
  75. get { return Internal_GetDefaultFont(); }
  76. }
  77. [MethodImpl(MethodImplOptions.InternalCall)]
  78. private static extern SpriteTexture Internal_GetWhiteTexture();
  79. [MethodImpl(MethodImplOptions.InternalCall)]
  80. private static extern Shader Internal_GetDiffuseShader();
  81. [MethodImpl(MethodImplOptions.InternalCall)]
  82. private static extern Mesh Internal_GetMesh(BuiltinMesh mesh);
  83. [MethodImpl(MethodImplOptions.InternalCall)]
  84. private static extern Font Internal_GetDefaultFont();
  85. }
  86. /** @} */
  87. }