"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CameraEntity = void 0;
exports.makeCameraEntity = makeCameraEntity;
const core_1 = require("@vived/core");
const Transform3D_1 = require("../../Transform3D");
class CameraEntity extends core_1.AppObjectEntity {
}
exports.CameraEntity = CameraEntity;
CameraEntity.type = "CAMERA_ENTITY";
CameraEntity.get = (appObjects) => (0, core_1.getSingletonComponent)(CameraEntity.type, appObjects);
function makeCameraEntity(appObject) {
    return new CameraEntityImp(appObject);
}
class CameraEntityImp extends CameraEntity {
    get nearClip() {
        return this.memoizedNearClip.val;
    }
    set nearClip(val) {
        this.memoizedNearClip.val = val;
    }
    get farClip() {
        return this.memoizedFarClip.val;
    }
    set farClip(val) {
        this.memoizedFarClip.val = val;
    }
    get fov() {
        return this.memoizedFOV.val;
    }
    set fov(val) {
        this.memoizedFOV.val = val;
    }
    constructor(appObject) {
        super(appObject, CameraEntity.type);
        this.memoizedNearClip = new core_1.MemoizedNumber(0.01, this.notifyOnChange);
        this.memoizedFarClip = new core_1.MemoizedNumber(10, this.notifyOnChange);
        this.memoizedFOV = new core_1.MemoizedAngle(core_1.Angle.FromRadians(0.26), this.notifyOnChange);
        this.transform = Transform3D_1.Transform3D.addIfMissing(appObject);
        this.transform.addChangeObserver(this.notifyOnChange);
    }
}
//# sourceMappingURL=CameraEntity.js.map