Builtin.cs 2.3 KB

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