"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.BabylonEntity = void 0;
exports.makeBabylonEntity = makeBabylonEntity;
const core_1 = require("@vived/core");
class BabylonEntity extends core_1.AppObjectEntity {
}
exports.BabylonEntity = BabylonEntity;
BabylonEntity.type = "BabylonEntity";
BabylonEntity.get = (appObjects) => (0, core_1.getSingletonComponent)(BabylonEntity.type, appObjects);
function makeBabylonEntity(appObject) {
    return new BabylonEntityImp(appObject);
}
class BabylonEntityImp extends BabylonEntity {
    get workingCanvas() {
        return this._workingCanvas;
    }
    set workingCanvas(canvas) {
        if (canvas === this._workingCanvas)
            return;
        this._workingCanvas = canvas;
        this.notifyOnChange();
    }
    get renderCanvas() {
        return this._renderCanvas;
    }
    set renderCanvas(canvas) {
        if (canvas === this._renderCanvas)
            return;
        this._renderCanvas = canvas;
        this.notifyOnChange();
    }
    get showInspector() {
        return this.memoizedShowInspector.val;
    }
    set showInspector(val) {
        this.memoizedShowInspector.val = val;
    }
    get canvasSize() {
        return this.memoizedCanvasSize.val;
    }
    set canvasSize(val) {
        this.memoizedCanvasSize.val = val;
    }
    get isRendering() {
        return this.memoizedIsRendering.val;
    }
    set isRendering(val) {
        this.memoizedIsRendering.val = val;
    }
    constructor(appObject) {
        super(appObject, BabylonEntity.type);
        this.memoizedShowInspector = new core_1.MemoizedBoolean(false, this.notifyOnChange);
        this.memoizedCanvasSize = new core_1.MemoizedVector2(core_1.Vector2.One(), this.notifyOnChange);
        this.memoizedIsRendering = new core_1.MemoizedBoolean(false, this.notifyOnChange);
        this.makeAppObjectMeta = (id) => {
            return { appObjectID: id };
        };
        this.getAppObjectIDFromMeta = (meta) => {
            if (meta?.hasOwnProperty("appObjectID")) {
                return meta.appObjectID;
            }
            else {
                return;
            }
        };
    }
}
//# sourceMappingURL=BabylonEntity.js.map