MaterialAdapter.js 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  5. };
  6. var INSPECTOR;
  7. (function (INSPECTOR) {
  8. var MaterialAdapter = (function (_super) {
  9. __extends(MaterialAdapter, _super);
  10. function MaterialAdapter(obj) {
  11. _super.call(this, obj);
  12. }
  13. /** Returns the name displayed in the tree */
  14. MaterialAdapter.prototype.id = function () {
  15. var str = '';
  16. if (this._obj.name) {
  17. str = this._obj.name;
  18. } // otherwise nothing displayed
  19. return str;
  20. };
  21. /** Returns the type of this object - displayed in the tree */
  22. MaterialAdapter.prototype.type = function () {
  23. return INSPECTOR.Helpers.GET_TYPE(this._obj);
  24. };
  25. /** Returns the list of properties to be displayed for this adapter */
  26. MaterialAdapter.prototype.getProperties = function () {
  27. var propertiesLines = [];
  28. var propToDisplay = INSPECTOR.PROPERTIES[this.type()].properties;
  29. for (var _i = 0, propToDisplay_1 = propToDisplay; _i < propToDisplay_1.length; _i++) {
  30. var dirty = propToDisplay_1[_i];
  31. var infos = new INSPECTOR.Property(dirty, this._obj);
  32. propertiesLines.push(new INSPECTOR.PropertyLine(infos));
  33. }
  34. return propertiesLines;
  35. };
  36. /** No tools for a material adapter */
  37. MaterialAdapter.prototype.getTools = function () {
  38. return [];
  39. };
  40. /** Overrides super.highlight.
  41. * Highlighting a material outlines all meshes linked to this material
  42. */
  43. MaterialAdapter.prototype.highlight = function (b) {
  44. var material = this.actualObject;
  45. var meshes = material.getBindedMeshes();
  46. for (var _i = 0, meshes_1 = meshes; _i < meshes_1.length; _i++) {
  47. var mesh = meshes_1[_i];
  48. mesh.renderOutline = b;
  49. mesh.outlineWidth = 0.25;
  50. mesh.outlineColor = BABYLON.Color3.Yellow();
  51. }
  52. };
  53. return MaterialAdapter;
  54. }(INSPECTOR.Adapter));
  55. INSPECTOR.MaterialAdapter = MaterialAdapter;
  56. })(INSPECTOR || (INSPECTOR = {}));
  57. //# sourceMappingURL=MaterialAdapter.js.map