"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ZSpaceViewEntity = exports.ZSpaceViewType = void 0;
exports.makeZSpaceView = makeZSpaceView;
const core_1 = require("@vived/core");
const core_2 = require("@vived/core");
const Transform3D_1 = require("../../Transform3D");
var ZSpaceViewType;
(function (ZSpaceViewType) {
    ZSpaceViewType["CENTER"] = "Center";
    ZSpaceViewType["LEFT"] = "Left";
    ZSpaceViewType["RIGHT"] = "Right";
})(ZSpaceViewType || (exports.ZSpaceViewType = ZSpaceViewType = {}));
class ZSpaceViewEntity extends core_1.AppObjectEntity {
}
exports.ZSpaceViewEntity = ZSpaceViewEntity;
ZSpaceViewEntity.type = "ZSpaceViewEntity";
function makeZSpaceView(appObj, viewType) {
    const transform = Transform3D_1.Transform3D.addIfMissing(appObj);
    return new ZSpaceViewImp(appObj, viewType, transform);
}
class ZSpaceViewImp extends ZSpaceViewEntity {
    update(data) {
        this.transform.localPosition = data.position;
        this.transform.localRotation = data.rotation;
        this._projectionMatrix = data.projectionMatrix;
        this._view = data.view;
        this.notifyOnChange();
    }
    get view() {
        return this._view;
    }
    submitView(view) {
        this._view = view;
        this.notifyOnChange();
    }
    get projectionMatrix() {
        return this._projectionMatrix;
    }
    constructor(appObject, viewType, transform) {
        super(appObject, ZSpaceViewEntity.type);
        this._projectionMatrix = core_2.Matrix.Identity();
        this.viewType = viewType;
        this.transform = transform;
        this.transform.addChangeObserver(this.notifyOnChange);
    }
}
//# sourceMappingURL=ZSpaceViewEntity.js.map