Builtin.cs 3.2 KB

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