import { AppObjectEntity } from "@vived/core";
import { Matrix } from "@vived/core";
import { Transform3D } from "../../Transform3D";
export var ZSpaceViewType;
(function (ZSpaceViewType) {
    ZSpaceViewType["CENTER"] = "Center";
    ZSpaceViewType["LEFT"] = "Left";
    ZSpaceViewType["RIGHT"] = "Right";
})(ZSpaceViewType || (ZSpaceViewType = {}));
export class ZSpaceViewEntity extends AppObjectEntity {
}
ZSpaceViewEntity.type = "ZSpaceViewEntity";
export function makeZSpaceView(appObj, viewType) {
    const transform = 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 = Matrix.Identity();
        this.viewType = viewType;
        this.transform = transform;
        this.transform.addChangeObserver(this.notifyOnChange);
    }
}
//# sourceMappingURL=ZSpaceViewEntity.js.map