added scene manager
This commit is contained in:
parent
2adb939f37
commit
9028186a74
34 changed files with 962 additions and 281 deletions
|
@ -100,12 +100,14 @@ export class CoreThereRepository extends TypedEvent<BaseSceneItemModel> {
|
|||
|
||||
loadInstances(robossemblerAssets: RobossemblerAssets) {
|
||||
robossemblerAssets.instances.forEach(async (el) => {
|
||||
console.log(el);
|
||||
if (el instanceof InstanceRgbCamera) {
|
||||
const cameraModel = CameraViewModel.fromInstanceRgbCamera(el);
|
||||
cameraModel.mapPerspectiveCamera(this.htmlSceneWidth, this.htmlSceneHeight).forEach((el) => this.scene.add(el));
|
||||
this.emit(cameraModel);
|
||||
}
|
||||
if (el instanceof SceneSimpleObject) {
|
||||
console.log(el);
|
||||
const asset = robossemblerAssets.getAssetAtInstance(el.instanceAt as string);
|
||||
this.loader([asset.meshPath], () => {}, asset.name);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
// TODO(IDONTSUDO): нужно переписать все запросы под BaseStore
|
||||
|
||||
import { NavigateFunction } from "react-router-dom";
|
||||
import { Result } from "../helper/result";
|
||||
import { UiBaseError } from "../model/ui_base_error";
|
||||
import { HttpError } from "../repository/http_repository";
|
||||
|
@ -8,7 +9,7 @@ export type CoreError = HttpError | Error;
|
|||
|
||||
export abstract class UiLoader {
|
||||
isLoading = false;
|
||||
async loadingHelper<T>(callBack: Promise<Result<any, T>>) {
|
||||
async httpHelper<T>(callBack: Promise<Result<any, T>>) {
|
||||
this.isLoading = true;
|
||||
|
||||
const result = await callBack;
|
||||
|
@ -25,7 +26,7 @@ export abstract class UiLoader {
|
|||
|
||||
mapOk = async <T>(property: string, callBack: Promise<Result<CoreError, T>>) => {
|
||||
return (
|
||||
(await this.loadingHelper(callBack))
|
||||
(await this.httpHelper(callBack))
|
||||
// eslint-disable-next-line array-callback-return
|
||||
.map((el) => {
|
||||
// @ts-ignore
|
||||
|
@ -43,7 +44,7 @@ export class SimpleErrorState extends UiLoader {
|
|||
|
||||
export abstract class UiErrorState<T> extends UiLoader {
|
||||
abstract errorHandingStrategy: (error: T) => void;
|
||||
abstract init(): Promise<any>;
|
||||
abstract init(navigate?: NavigateFunction): Promise<any>;
|
||||
dispose() {}
|
||||
errors: UiBaseError[] = [];
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue