Builtin.cs 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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. /// Available builtin shader types.
  11. /// </summary>
  12. public enum BuiltinShader // Note: Must match C++ BuiltinShader enum
  13. {
  14. Custom,
  15. Standard,
  16. Transparent
  17. }
  18. /// <summary>
  19. /// Contains various builtin resources that are always available.
  20. /// </summary>
  21. public static class Builtin
  22. {
  23. /// <summary>
  24. /// Types of builtin meshes that are always available in the engine.
  25. /// </summary>
  26. private enum BuiltinMesh // Note: Must match C++ enum BuiltinMesh
  27. {
  28. Box, Sphere, Cone, Quad, Disc
  29. }
  30. /// <summary>
  31. /// Returns a pure white texture.
  32. /// </summary>
  33. public static SpriteTexture WhiteTexture
  34. {
  35. get { return Internal_GetWhiteTexture(); }
  36. }
  37. /// <summary>
  38. /// Returns one of the builtin shaders
  39. /// </summary>
  40. public static Shader GetShader(BuiltinShader shader)
  41. {
  42. if (shader == BuiltinShader.Custom)
  43. return null;
  44. return Internal_GetBuiltinShader((int)shader);
  45. }
  46. /// <summary>
  47. /// Returns a axis aligned box of unit size.
  48. /// </summary>
  49. public static Mesh Box
  50. {
  51. get { return Internal_GetMesh(BuiltinMesh.Box); }
  52. }
  53. /// <summary>
  54. /// Returns a unit sphere mesh.
  55. /// </summary>
  56. public static Mesh Sphere
  57. {
  58. get { return Internal_GetMesh(BuiltinMesh.Sphere); }
  59. }
  60. /// <summary>
  61. /// Returns a cone mesh.
  62. /// </summary>
  63. public static Mesh Cone
  64. {
  65. get { return Internal_GetMesh(BuiltinMesh.Cone); }
  66. }
  67. /// <summary>
  68. /// Returns a quad mesh with unit size edges.
  69. /// </summary>
  70. public static Mesh Quad
  71. {
  72. get { return Internal_GetMesh(BuiltinMesh.Quad); }
  73. }
  74. /// <summary>
  75. /// Returns a disc mesh with unit radius.
  76. /// </summary>
  77. public static Mesh Disc
  78. {
  79. get { return Internal_GetMesh(BuiltinMesh.Disc); }
  80. }
  81. /// <summary>
  82. /// Returns the default Font used in the engine.
  83. /// </summary>
  84. public static Font DefaultFont
  85. {
  86. get { return Internal_GetDefaultFont(); }
  87. }
  88. [MethodImpl(MethodImplOptions.InternalCall)]
  89. private static extern SpriteTexture Internal_GetWhiteTexture();
  90. [MethodImpl(MethodImplOptions.InternalCall)]
  91. private static extern Shader Internal_GetBuiltinShader(int shaderType);
  92. [MethodImpl(MethodImplOptions.InternalCall)]
  93. private static extern Mesh Internal_GetMesh(BuiltinMesh mesh);
  94. [MethodImpl(MethodImplOptions.InternalCall)]
  95. private static extern Font Internal_GetDefaultFont();
  96. }
  97. /** @} */
  98. }