MaterialManager.js 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. function MaterialManager() {
  2. Object.defineProperties(this, {
  3. 'premultiplyAlphaOnLoad': { enumerable: true, configurable: true, get: MaterialManager.prototype.__get_premultiplyAlphaOnLoad, set: MaterialManager.prototype.__set_premultiplyAlphaOnLoad},
  4. 'clampDefault': { enumerable: true, configurable: true, get: MaterialManager.prototype.__get_clampDefault, set: MaterialManager.prototype.__set_clampDefault},
  5. 'mipmapsDefault': { enumerable: true, configurable: true, get: MaterialManager.prototype.__get_mipmapsDefault, set: MaterialManager.prototype.__set_mipmapsDefault},
  6. 'keepTextureData': { enumerable: true, configurable: true, get: MaterialManager.prototype.__get_keepTextureData, set: MaterialManager.prototype.__set_keepTextureData}
  7. })
  8. }
  9. MaterialManager.prototype.__get_premultiplyAlphaOnLoad = function() {
  10. return Polycode.MaterialManager__get_premultiplyAlphaOnLoad(this.__ptr)
  11. }
  12. MaterialManager.prototype.__set_premultiplyAlphaOnLoad = function(val) {
  13. Polycode.MaterialManager__set_premultiplyAlphaOnLoad(this.__ptr, val)
  14. }
  15. MaterialManager.prototype.__get_clampDefault = function() {
  16. return Polycode.MaterialManager__get_clampDefault(this.__ptr)
  17. }
  18. MaterialManager.prototype.__set_clampDefault = function(val) {
  19. Polycode.MaterialManager__set_clampDefault(this.__ptr, val)
  20. }
  21. MaterialManager.prototype.__get_mipmapsDefault = function() {
  22. return Polycode.MaterialManager__get_mipmapsDefault(this.__ptr)
  23. }
  24. MaterialManager.prototype.__set_mipmapsDefault = function(val) {
  25. Polycode.MaterialManager__set_mipmapsDefault(this.__ptr, val)
  26. }
  27. MaterialManager.prototype.__get_keepTextureData = function() {
  28. return Polycode.MaterialManager__get_keepTextureData(this.__ptr)
  29. }
  30. MaterialManager.prototype.__set_keepTextureData = function(val) {
  31. Polycode.MaterialManager__set_keepTextureData(this.__ptr, val)
  32. }
  33. MaterialManager.prototype.Update = function(elapsed) {
  34. Polycode.MaterialManager_Update(this.__ptr, elapsed)
  35. }
  36. MaterialManager.prototype.createTexture = function(width,height,imageData,clamp,createMipmaps,type) {
  37. var retVal = new Texture()
  38. retVal.__ptr = Polycode.MaterialManager_createTexture(this.__ptr, width,height,imageData,clamp,createMipmaps,type)
  39. return retVal
  40. }
  41. MaterialManager.prototype.createNewTexture = function(width,height,clamp,createMipmaps,type) {
  42. var retVal = new Texture()
  43. retVal.__ptr = Polycode.MaterialManager_createNewTexture(this.__ptr, width,height,clamp,createMipmaps,type)
  44. return retVal
  45. }
  46. MaterialManager.prototype.createTextureFromImage = function(image,clamp,createMipmaps) {
  47. var retVal = new Texture()
  48. retVal.__ptr = Polycode.MaterialManager_createTextureFromImage(this.__ptr, image,clamp,createMipmaps)
  49. return retVal
  50. }
  51. MaterialManager.prototype.createTextureFromFile = function(fileName,clamp,createMipmaps,resourcePool) {
  52. var retVal = new Texture()
  53. retVal.__ptr = Polycode.MaterialManager_createTextureFromFile(this.__ptr, fileName,clamp,createMipmaps,resourcePool)
  54. return retVal
  55. }
  56. MaterialManager.prototype.deleteTexture = function(texture) {
  57. Polycode.MaterialManager_deleteTexture(this.__ptr, texture)
  58. }
  59. MaterialManager.prototype.reloadTextures = function() {
  60. Polycode.MaterialManager_reloadTextures(this.__ptr)
  61. }
  62. MaterialManager.prototype.reloadProgramsAndTextures = function() {
  63. Polycode.MaterialManager_reloadProgramsAndTextures(this.__ptr)
  64. }
  65. MaterialManager.prototype.reloadPrograms = function() {
  66. Polycode.MaterialManager_reloadPrograms(this.__ptr)
  67. }
  68. MaterialManager.prototype.getTextureByResourcePath = function(resourcePath) {
  69. var retVal = new Texture()
  70. retVal.__ptr = Polycode.MaterialManager_getTextureByResourcePath(this.__ptr, resourcePath)
  71. return retVal
  72. }
  73. MaterialManager.prototype.createProgramFromFile = function(programPath) {
  74. var retVal = new ShaderProgram()
  75. retVal.__ptr = Polycode.MaterialManager_createProgramFromFile(this.__ptr, programPath)
  76. return retVal
  77. }
  78. MaterialManager.prototype.loadMaterialLibraryIntoPool = function(pool,materialFile) {
  79. Polycode.MaterialManager_loadMaterialLibraryIntoPool(this.__ptr, pool,materialFile)
  80. }
  81. MaterialManager.prototype.cubemapFromXMLNode = function(node) {
  82. var retVal = new Cubemap()
  83. retVal.__ptr = Polycode.MaterialManager_cubemapFromXMLNode(this.__ptr, node)
  84. return retVal
  85. }
  86. MaterialManager.prototype.materialFromXMLNode = function(resourcePool,node) {
  87. var retVal = new Material()
  88. retVal.__ptr = Polycode.MaterialManager_materialFromXMLNode(this.__ptr, resourcePool,node)
  89. return retVal
  90. }
  91. MaterialManager.prototype.createMaterial = function(resourcePool,materialName,shaderName) {
  92. var retVal = new Material()
  93. retVal.__ptr = Polycode.MaterialManager_createMaterial(this.__ptr, resourcePool,materialName,shaderName)
  94. return retVal
  95. }
  96. MaterialManager.prototype.setShaderFromXMLNode = function(resourcePool,node) {
  97. var retVal = new Shader()
  98. retVal.__ptr = Polycode.MaterialManager_setShaderFromXMLNode(this.__ptr, resourcePool,node)
  99. return retVal
  100. }
  101. MaterialManager.prototype.createShaderFromXMLNode = function(resourcePool,node) {
  102. var retVal = new Shader()
  103. retVal.__ptr = Polycode.MaterialManager_createShaderFromXMLNode(this.__ptr, resourcePool,node)
  104. return retVal
  105. }
  106. MaterialManager.prototype.createShader = function(resourcePool,shaderType,name,vpName,fpName,screenShader) {
  107. var retVal = new Shader()
  108. retVal.__ptr = Polycode.MaterialManager_createShader(this.__ptr, resourcePool,shaderType,name,vpName,fpName,screenShader)
  109. return retVal
  110. }
  111. MaterialManager.prototype.loadMaterialsFromFile = function(resourcePool,fileName) {
  112. Polycode.MaterialManager_loadMaterialsFromFile(this.__ptr, resourcePool,fileName)
  113. }
  114. MaterialManager.prototype.loadShadersFromFile = function(resourcePool,fileName) {
  115. Polycode.MaterialManager_loadShadersFromFile(this.__ptr, resourcePool,fileName)
  116. }
  117. MaterialManager.prototype.loadCubemapsFromFile = function(fileName) {
  118. Polycode.MaterialManager_loadCubemapsFromFile(this.__ptr, fileName)
  119. }
  120. MaterialManager.prototype.setAnisotropyAmount = function(anisotropy) {
  121. Polycode.MaterialManager_setAnisotropyAmount(this.__ptr, anisotropy)
  122. }
  123. MaterialManager.prototype.setTextureFilteringMode = function(textureFilteringMode) {
  124. Polycode.MaterialManager_setTextureFilteringMode(this.__ptr, textureFilteringMode)
  125. }
  126. MaterialManager.prototype.getTextureFilteringMode = function() {
  127. return Polycode.MaterialManager_getTextureFilteringMode(this.__ptr)
  128. }
  129. MaterialManager.prototype.addMaterial = function(material) {
  130. Polycode.MaterialManager_addMaterial(this.__ptr, material)
  131. }
  132. MaterialManager.prototype.addShader = function(shader) {
  133. Polycode.MaterialManager_addShader(this.__ptr, shader)
  134. }
  135. MaterialManager.prototype.getNumShaders = function() {
  136. return Polycode.MaterialManager_getNumShaders(this.__ptr)
  137. }
  138. MaterialManager.prototype.getShaderByIndex = function(index) {
  139. var retVal = new Shader()
  140. retVal.__ptr = Polycode.MaterialManager_getShaderByIndex(this.__ptr, index)
  141. return retVal
  142. }