2
0

Texture.cs 3.0 KB

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