Builtin.cs 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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. /// <summary>
  7. /// Contains various builtin resources that are always available.
  8. /// </summary>
  9. public static class Builtin
  10. {
  11. /// <summary>
  12. /// Types of builtin meshes that are always available in the engine.
  13. /// </summary>
  14. private enum BuiltinMesh // Note: Must match C++ enum BuiltinMesh
  15. {
  16. Box, Sphere, Cone, Quad, Disc
  17. }
  18. /// <summary>
  19. /// Returns a pure white texture.
  20. /// </summary>
  21. public static SpriteTexture WhiteTexture
  22. {
  23. get { return Internal_GetWhiteTexture(); }
  24. }
  25. /// <summary>
  26. /// Returns the default shader to be used with renderables.
  27. /// </summary>
  28. public static Shader DiffuseShader
  29. {
  30. get { return Internal_GetDiffuseShader(); }
  31. }
  32. /// <summary>
  33. /// Returns a axis aligned box of unit size.
  34. /// </summary>
  35. public static Mesh Box
  36. {
  37. get { return Internal_GetMesh(BuiltinMesh.Box); }
  38. }
  39. /// <summary>
  40. /// Returns a unit sphere mesh.
  41. /// </summary>
  42. public static Mesh Sphere
  43. {
  44. get { return Internal_GetMesh(BuiltinMesh.Sphere); }
  45. }
  46. /// <summary>
  47. /// Returns a cone mesh.
  48. /// </summary>
  49. public static Mesh Cone
  50. {
  51. get { return Internal_GetMesh(BuiltinMesh.Cone); }
  52. }
  53. /// <summary>
  54. /// Returns a quad mesh with unit size edges.
  55. /// </summary>
  56. public static Mesh Quad
  57. {
  58. get { return Internal_GetMesh(BuiltinMesh.Quad); }
  59. }
  60. /// <summary>
  61. /// Returns a disc mesh with unit radius.
  62. /// </summary>
  63. public static Mesh Disc
  64. {
  65. get { return Internal_GetMesh(BuiltinMesh.Disc); }
  66. }
  67. [MethodImpl(MethodImplOptions.InternalCall)]
  68. private static extern SpriteTexture Internal_GetWhiteTexture();
  69. [MethodImpl(MethodImplOptions.InternalCall)]
  70. private static extern Shader Internal_GetDiffuseShader();
  71. [MethodImpl(MethodImplOptions.InternalCall)]
  72. private static extern Mesh Internal_GetMesh(BuiltinMesh mesh);
  73. }
  74. }