Material.js 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. require('Polycode/Resource')
  2. function Material(name) {
  3. if(arguments[0] != "__skip_ptr__") {
  4. this.__ptr = Polycode.Material(name)
  5. }
  6. Object.defineProperties(this, {
  7. 'fp16RenderTargets': { enumerable: true, configurable: true, get: Material.prototype.__get_fp16RenderTargets, set: Material.prototype.__set_fp16RenderTargets},
  8. 'blendingMode': { enumerable: true, configurable: true, get: Material.prototype.__get_blendingMode, set: Material.prototype.__set_blendingMode},
  9. 'screenMaterial': { enumerable: true, configurable: true, get: Material.prototype.__get_screenMaterial, set: Material.prototype.__set_screenMaterial}
  10. })
  11. }
  12. Material.prototype = Object.create(Resource.prototype)
  13. Material.prototype.__get_fp16RenderTargets = function() {
  14. return Polycode.Material__get_fp16RenderTargets(this.__ptr)
  15. }
  16. Material.prototype.__set_fp16RenderTargets = function(val) {
  17. Polycode.Material__set_fp16RenderTargets(this.__ptr, val)
  18. }
  19. Material.prototype.__get_blendingMode = function() {
  20. return Polycode.Material__get_blendingMode(this.__ptr)
  21. }
  22. Material.prototype.__set_blendingMode = function(val) {
  23. Polycode.Material__set_blendingMode(this.__ptr, val)
  24. }
  25. Material.prototype.__get_screenMaterial = function() {
  26. return Polycode.Material__get_screenMaterial(this.__ptr)
  27. }
  28. Material.prototype.__set_screenMaterial = function(val) {
  29. Polycode.Material__set_screenMaterial(this.__ptr, val)
  30. }
  31. Material.prototype.addShaderPass = function(pass) {
  32. Polycode.Material_addShaderPass(this.__ptr, pass)
  33. }
  34. Material.prototype.addShaderPassForShader = function(shader) {
  35. Polycode.Material_addShaderPassForShader(this.__ptr, shader)
  36. }
  37. Material.prototype.addShaderPassAtIndex = function(pass,shaderIndex) {
  38. Polycode.Material_addShaderPassAtIndex(this.__ptr, pass, shaderIndex)
  39. }
  40. Material.prototype.getNumShaderPasses = function() {
  41. return Polycode.Material_getNumShaderPasses(this.__ptr)
  42. }
  43. Material.prototype.removeShaderPass = function(shaderIndex) {
  44. Polycode.Material_removeShaderPass(this.__ptr, shaderIndex)
  45. }
  46. Material.prototype.getNumShaderRenderTargets = function() {
  47. return Polycode.Material_getNumShaderRenderTargets(this.__ptr)
  48. }
  49. Material.prototype.removeShaderRenderTarget = function(index) {
  50. Polycode.Material_removeShaderRenderTarget(this.__ptr, index)
  51. }
  52. Material.prototype.recreateRenderTargets = function(screenSize) {
  53. Polycode.Material_recreateRenderTargets(this.__ptr, screenSize)
  54. }
  55. Material.prototype.getName = function() {
  56. return Polycode.Material_getName(this.__ptr)
  57. }
  58. Material.prototype.getShaderPass = function(index) {
  59. var retVal = new ShaderPass("__skip_ptr__")
  60. retVal.__ptr = Polycode.Material_getShaderPass(this.__ptr, index)
  61. return retVal
  62. }
  63. Material.prototype.getShaderBinding = function(index) {
  64. var retVal = new ShaderBinding("__skip_ptr__")
  65. retVal.__ptr = Polycode.Material_getShaderBinding(this.__ptr, index)
  66. return retVal
  67. }
  68. Material.prototype.getShader = function(index) {
  69. var retVal = new Shader("__skip_ptr__")
  70. retVal.__ptr = Polycode.Material_getShader(this.__ptr, index)
  71. return retVal
  72. }
  73. Material.prototype.loadMaterial = function(fileName) {
  74. Polycode.Material_loadMaterial(this.__ptr, fileName)
  75. }
  76. Material.prototype.setName = function(name) {
  77. Polycode.Material_setName(this.__ptr, name)
  78. }
  79. Material.prototype.clearShaders = function() {
  80. Polycode.Material_clearShaders(this.__ptr)
  81. }