progress
This commit is contained in:
parent
d8b5018cb2
commit
318d0a7893
60 changed files with 746 additions and 524 deletions
|
@ -9,8 +9,10 @@ import { ZoneModel } from "./zone_model";
|
|||
import { CoreThreeRepository } from "../repository/core_three_repository";
|
||||
import { LightModel } from "./light_model";
|
||||
import { Vector3 } from "three";
|
||||
import { SceneItems } from "../../features/scene_manager/presentation/scene_manager_store";
|
||||
|
||||
export abstract class Instance {
|
||||
type: string;
|
||||
abstract icon: string;
|
||||
@Type(() => Vector3)
|
||||
vector3: Vector3;
|
||||
|
@ -21,6 +23,7 @@ export abstract class Instance {
|
|||
}
|
||||
|
||||
export class SceneAsset {
|
||||
name: string;
|
||||
@IsArray()
|
||||
@Type(() => Instance, {
|
||||
discriminator: {
|
||||
|
@ -37,4 +40,27 @@ export class SceneAsset {
|
|||
keepDiscriminatorProperty: true,
|
||||
})
|
||||
scene: (Instance | SolidModel | CameraModel | RobotModel | PointModel | ZoneModel)[];
|
||||
toSceneItems = (): SceneItems[] => {
|
||||
return this.scene.map((el) => {
|
||||
return {
|
||||
fn: () => {},
|
||||
name: el.name,
|
||||
icon: el.icon,
|
||||
isSelected: false,
|
||||
};
|
||||
});
|
||||
};
|
||||
getElementByName = <T>(name: string) => this.scene.filter((el) => el.name.isEqual(name)).at(0) as T;
|
||||
getAllRobotsTopics = () => this.scene.filter((el) => el.type.isEqual(SceneModelsTypes.ROBOT)).map((el) => el.name);
|
||||
getAllCameraTopics = () => {};
|
||||
getAllPoints = () => this.scene.filter((el) => el.type.isEqual(SceneModelsTypes.POINT)).map((el) => el.name);
|
||||
static newScene = (
|
||||
scene: (Instance | SolidModel | CameraModel | RobotModel | PointModel | ZoneModel)[],
|
||||
name: string
|
||||
) => {
|
||||
const sceneAsset = new SceneAsset();
|
||||
sceneAsset.scene = scene;
|
||||
sceneAsset.name = name;
|
||||
return sceneAsset;
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue