import { AppObjectPM, getSingletonComponent, } from "@vived/core";
import { EnvironmentEntity } from "../Entities/Environment";
export class TexturalEnvironmentPM extends AppObjectPM {
}
TexturalEnvironmentPM.type = "TexturalEnvironmentPM";
TexturalEnvironmentPM.get = (appObjects) => getSingletonComponent(TexturalEnvironmentPM.type, appObjects);
export function makeTexturalEnvironmentPM(appObject) {
    return new TexturalEnvironmentPMImp(appObject);
}
class TexturalEnvironmentPMImp extends TexturalEnvironmentPM {
    vmsAreEqual(a, b) {
        return a === b;
    }
    get entity() {
        return this.getCachedSingleton(EnvironmentEntity.type);
    }
    constructor(appObject) {
        super(appObject, TexturalEnvironmentPM.type);
        this.onEntityChange = () => {
            if (!this.entity)
                return;
            this.doUpdateView(this.entity.currentEnvironment);
        };
        this.entity?.addChangeObserver(this.onEntityChange);
        this.onEntityChange();
        this.appObjects.registerSingleton(this);
    }
}
//# sourceMappingURL=TexturalEnvironmentPM.js.map