"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _Layer = _interopRequireDefault(require("./Layer"));
var _LayeredMaterialNodeProcessing = require("../Process/LayeredMaterialNodeProcessing");
var _textureConverter = _interopRequireDefault(require("../Converter/textureConverter"));
var _Cache = require("../Core/Scheduler/Cache");
class RasterLayer extends _Layer.default {
  constructor(id, config) {
    config.cacheLifeTime = config.cacheLifeTime ?? _Cache.CACHE_POLICIES.TEXTURE;
    super(id, config);
  }
  convert(data, extentDestination) {
    return _textureConverter.default.convert(data, extentDestination, this);
  }

  /**
  * All layer's textures are removed from scene and disposed from video device.
  * @param {boolean} [clearCache=false] Whether to clear the layer cache or not
  */
  delete(clearCache) {
    if (clearCache) {
      this.cache.clear();
    }
    for (const root of this.parent.level0Nodes) {
      root.traverse((0, _LayeredMaterialNodeProcessing.removeLayeredMaterialNodeLayer)(this.id));
    }
  }
}
var _default = RasterLayer;
exports.default = _default;