Texture.js 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. require('Polycode/Resource')
  2. function Texture() {
  3. Object.defineProperties(this, {
  4. 'clamp': { enumerable: true, configurable: true, get: Texture.prototype.__get_clamp, set: Texture.prototype.__set_clamp},
  5. 'textureData': { enumerable: true, configurable: true, get: Texture.prototype.__get_textureData, set: Texture.prototype.__set_textureData},
  6. 'type': { enumerable: true, configurable: true, get: Texture.prototype.__get_type, set: Texture.prototype.__set_type},
  7. 'filteringMode': { enumerable: true, configurable: true, get: Texture.prototype.__get_filteringMode, set: Texture.prototype.__set_filteringMode},
  8. 'createMipmaps': { enumerable: true, configurable: true, get: Texture.prototype.__get_createMipmaps, set: Texture.prototype.__set_createMipmaps},
  9. 'anisotropy': { enumerable: true, configurable: true, get: Texture.prototype.__get_anisotropy, set: Texture.prototype.__set_anisotropy},
  10. 'framebufferTexture': { enumerable: true, configurable: true, get: Texture.prototype.__get_framebufferTexture, set: Texture.prototype.__set_framebufferTexture},
  11. 'depthTexture': { enumerable: true, configurable: true, get: Texture.prototype.__get_depthTexture, set: Texture.prototype.__set_depthTexture}
  12. })
  13. }
  14. Texture.FILTERING_NEAREST = 0
  15. Texture.FILTERING_LINEAR = 1
  16. Texture.prototype = Object.create(Resource.prototype)
  17. Texture.prototype.__get_clamp = function() {
  18. return Polycode.Texture__get_clamp(this.__ptr)
  19. }
  20. Texture.prototype.__set_clamp = function(val) {
  21. Polycode.Texture__set_clamp(this.__ptr, val)
  22. }
  23. Texture.prototype.__get_textureData = function() {
  24. var retVal = new char()
  25. retVal.__ptr = Polycode.Texture__get_textureData(this.__ptr)
  26. return retVal
  27. }
  28. Texture.prototype.__set_textureData = function(val) {
  29. Polycode.Texture__set_textureData(this.__ptr, val.__ptr)
  30. }
  31. Texture.prototype.__get_type = function() {
  32. return Polycode.Texture__get_type(this.__ptr)
  33. }
  34. Texture.prototype.__set_type = function(val) {
  35. Polycode.Texture__set_type(this.__ptr, val)
  36. }
  37. Texture.prototype.__get_filteringMode = function() {
  38. return Polycode.Texture__get_filteringMode(this.__ptr)
  39. }
  40. Texture.prototype.__set_filteringMode = function(val) {
  41. Polycode.Texture__set_filteringMode(this.__ptr, val)
  42. }
  43. Texture.prototype.__get_createMipmaps = function() {
  44. return Polycode.Texture__get_createMipmaps(this.__ptr)
  45. }
  46. Texture.prototype.__set_createMipmaps = function(val) {
  47. Polycode.Texture__set_createMipmaps(this.__ptr, val)
  48. }
  49. Texture.prototype.__get_anisotropy = function() {
  50. return Polycode.Texture__get_anisotropy(this.__ptr)
  51. }
  52. Texture.prototype.__set_anisotropy = function(val) {
  53. Polycode.Texture__set_anisotropy(this.__ptr, val)
  54. }
  55. Texture.prototype.__get_framebufferTexture = function() {
  56. return Polycode.Texture__get_framebufferTexture(this.__ptr)
  57. }
  58. Texture.prototype.__set_framebufferTexture = function(val) {
  59. Polycode.Texture__set_framebufferTexture(this.__ptr, val)
  60. }
  61. Texture.prototype.__get_depthTexture = function() {
  62. return Polycode.Texture__get_depthTexture(this.__ptr)
  63. }
  64. Texture.prototype.__set_depthTexture = function(val) {
  65. Polycode.Texture__set_depthTexture(this.__ptr, val)
  66. }
  67. Texture.prototype.reloadResource = function() {
  68. Polycode.Texture_reloadResource(this.__ptr)
  69. }
  70. Texture.prototype.setImageData = function(data) {
  71. Polycode.Texture_setImageData(this.__ptr, data.__ptr)
  72. }
  73. Texture.prototype.getTextureData = function() {
  74. var retVal = new char()
  75. retVal.__ptr = Polycode.Texture_getTextureData(this.__ptr)
  76. return retVal
  77. }
  78. Texture.prototype.getWidth = function() {
  79. return Polycode.Texture_getWidth(this.__ptr)
  80. }
  81. Texture.prototype.getHeight = function() {
  82. return Polycode.Texture_getHeight(this.__ptr)
  83. }
  84. Texture.prototype.setCreateMipmaps = function(createMipmapsIn) {
  85. Polycode.Texture_setCreateMipmaps(this.__ptr, createMipmapsIn)
  86. }
  87. Texture.prototype.getCreateMipmaps = function() {
  88. return Polycode.Texture_getCreateMipmaps(this.__ptr)
  89. }