Builtin.cs 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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. [MethodImpl(MethodImplOptions.InternalCall)]
  71. private static extern SpriteTexture Internal_GetWhiteTexture();
  72. [MethodImpl(MethodImplOptions.InternalCall)]
  73. private static extern Shader Internal_GetDiffuseShader();
  74. [MethodImpl(MethodImplOptions.InternalCall)]
  75. private static extern Mesh Internal_GetMesh(BuiltinMesh mesh);
  76. }
  77. /** @} */
  78. }