import { AppObjectEntity, getSingletonComponent, MemoizedBoolean, MemoizedNumber } from "@vived/core";
import { makeZSpaceDisplayEntity } from "./ZSpaceDisplayEntity";
import { makeZSpaceView, ZSpaceViewType } from "./ZSpaceViewEntity";
export const INSPIRE_WIDTH = 0.344;
export class ZSpaceEntity extends AppObjectEntity {
    static get(appObjects) {
        return getSingletonComponent(ZSpaceEntity.type, appObjects);
    }
}
ZSpaceEntity.type = "ZSpaceEntity";
export function makeZSpaceEntity(appObj) {
    return new ZSpaceImp(appObj);
}
export const tempScaleCoef = 1; // 1 for Inspire, 1.52 for AIO
class ZSpaceImp extends ZSpaceEntity {
    get viewerScale() {
        return this.memoizedViewerScale.val;
    }
    set viewerScale(val) {
        this.memoizedViewerScale.val = val;
    }
    get isSupported() {
        return this.memoizedIsSupported.val;
    }
    set isSupported(val) {
        this.memoizedIsSupported.val = val;
    }
    get enabled() {
        return this.memoizedEnabled.val;
    }
    set enabled(val) {
        this.memoizedEnabled.val = val;
    }
    get emulate() {
        return this.memoizedEmulate.val;
    }
    set emulate(val) {
        this.memoizedEmulate.val = val;
    }
    get isRendering() {
        return this.memoizedIsRendering.val;
    }
    set isRendering(val) {
        this.memoizedIsRendering.val = val;
    }
    constructor(appObj) {
        super(appObj, ZSpaceEntity.type);
        this.memoizedViewerScale = new MemoizedNumber(1, this.notifyOnChange); // 1 for Inspire, .65 for AIO
        this.memoizedIsSupported = new MemoizedBoolean(false, this.notifyOnChange);
        this.memoizedEnabled = new MemoizedBoolean(false, this.notifyOnChange);
        this.memoizedEmulate = new MemoizedBoolean(false, this.notifyOnChange);
        this.memoizedIsRendering = new MemoizedBoolean(false, this.notifyOnChange);
        const headView = appObj.appObjectRepo.getOrCreate("zSpaceHeadView");
        this.headView = makeZSpaceView(headView, ZSpaceViewType.CENTER);
        const leftEye = appObj.appObjectRepo.getOrCreate("zSpaceLeftEyeView");
        this.leftEyeView = makeZSpaceView(leftEye, ZSpaceViewType.LEFT);
        const rightEye = appObj.appObjectRepo.getOrCreate("zSpaceRightEyeView");
        this.rightEyeView = makeZSpaceView(rightEye, ZSpaceViewType.RIGHT);
        const displayAO = appObj.appObjectRepo.getOrCreate("zSpaceDisplay");
        this.display = makeZSpaceDisplayEntity(displayAO);
    }
}
//# sourceMappingURL=ZSpaceEntity.js.map