babylon.multiMaterial.js 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. var __extends = (this && this.__extends) || function (d, b) {
  2. for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
  3. function __() { this.constructor = d; }
  4. __.prototype = b.prototype;
  5. d.prototype = new __();
  6. };
  7. var BABYLON;
  8. (function (BABYLON) {
  9. var MultiMaterial = (function (_super) {
  10. __extends(MultiMaterial, _super);
  11. function MultiMaterial(name, scene) {
  12. _super.call(this, name, scene, true);
  13. this.subMaterials = new Array();
  14. scene.multiMaterials.push(this);
  15. }
  16. // Properties
  17. MultiMaterial.prototype.getSubMaterial = function (index) {
  18. if (index < 0 || index >= this.subMaterials.length) {
  19. return this.getScene().defaultMaterial;
  20. }
  21. return this.subMaterials[index];
  22. };
  23. // Methods
  24. MultiMaterial.prototype.isReady = function (mesh) {
  25. for (var index = 0; index < this.subMaterials.length; index++) {
  26. var subMaterial = this.subMaterials[index];
  27. if (subMaterial) {
  28. if (!this.subMaterials[index].isReady(mesh)) {
  29. return false;
  30. }
  31. }
  32. }
  33. return true;
  34. };
  35. MultiMaterial.prototype.clone = function (name) {
  36. var newMultiMaterial = new MultiMaterial(name, this.getScene());
  37. for (var index = 0; index < this.subMaterials.length; index++) {
  38. var subMaterial = this.subMaterials[index];
  39. newMultiMaterial.subMaterials.push(subMaterial);
  40. }
  41. return newMultiMaterial;
  42. };
  43. return MultiMaterial;
  44. })(BABYLON.Material);
  45. BABYLON.MultiMaterial = MultiMaterial;
  46. })(BABYLON || (BABYLON = {}));
  47. //# sourceMappingURL=babylon.multiMaterial.js.map