Texture.cs 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. using System;
  2. using System.Runtime.CompilerServices;
  3. namespace BansheeEngine
  4. {
  5. public class Texture : Resource
  6. {
  7. public PixelFormat PixelFormat
  8. {
  9. get
  10. {
  11. PixelFormat value;
  12. Internal_GetPixelFormat(mCachedPtr, out value);
  13. return value;
  14. }
  15. }
  16. public TextureUsage Usage
  17. {
  18. get
  19. {
  20. TextureUsage value;
  21. Internal_GetUsage(mCachedPtr, out value);
  22. return value;
  23. }
  24. }
  25. public int Width
  26. {
  27. get
  28. {
  29. int value;
  30. Internal_GetWidth(mCachedPtr, out value);
  31. return value;
  32. }
  33. }
  34. public int Height
  35. {
  36. get
  37. {
  38. int value;
  39. Internal_GetHeight(mCachedPtr, out value);
  40. return value;
  41. }
  42. }
  43. public bool GammaCorrection
  44. {
  45. get
  46. {
  47. bool value;
  48. Internal_GetGammaCorrection(mCachedPtr, out value);
  49. return value;
  50. }
  51. }
  52. public int SampleCount
  53. {
  54. get
  55. {
  56. int value;
  57. Internal_GetSampleCount(mCachedPtr, out value);
  58. return value;
  59. }
  60. }
  61. public int MipmapCount
  62. {
  63. get
  64. {
  65. int value;
  66. Internal_GetMipmapCount(mCachedPtr, out value);
  67. return value;
  68. }
  69. }
  70. [MethodImpl(MethodImplOptions.InternalCall)]
  71. private static extern void Internal_GetPixelFormat(IntPtr thisPtr, out PixelFormat value);
  72. [MethodImpl(MethodImplOptions.InternalCall)]
  73. private static extern void Internal_GetUsage(IntPtr thisPtr, out TextureUsage value);
  74. [MethodImpl(MethodImplOptions.InternalCall)]
  75. private static extern void Internal_GetWidth(IntPtr thisPtr, out int value);
  76. [MethodImpl(MethodImplOptions.InternalCall)]
  77. private static extern void Internal_GetHeight(IntPtr thisPtr, out int value);
  78. [MethodImpl(MethodImplOptions.InternalCall)]
  79. private static extern void Internal_GetGammaCorrection(IntPtr thisPtr, out bool value);
  80. [MethodImpl(MethodImplOptions.InternalCall)]
  81. private static extern void Internal_GetSampleCount(IntPtr thisPtr, out int value);
  82. [MethodImpl(MethodImplOptions.InternalCall)]
  83. private static extern void Internal_GetMipmapCount(IntPtr thisPtr, out int value);
  84. }
  85. // Note: Do not modify IDs as they must match TextureUsage C++ enum
  86. public enum TextureUsage
  87. {
  88. Default = 0x1,
  89. Dynamic = 0x2,
  90. Render = 0x200,
  91. DepthStencil = 0x400,
  92. LoadStore = 0x800,
  93. CPUCached = 0x1000
  94. }
  95. }