debug
This commit is contained in:
parent
53fe9bf51a
commit
81238c5182
74 changed files with 8646 additions and 52 deletions
37
ui/src/core/repository/babylon_repository.ts
Normal file
37
ui/src/core/repository/babylon_repository.ts
Normal file
|
@ -0,0 +1,37 @@
|
|||
import { Scene, Engine, MeshBuilder, FreeCamera, HemisphericLight, Vector3, SceneLoader } from 'babylonjs';
|
||||
import { GLTFFileLoader, STLFileLoader } from 'babylonjs-loaders';
|
||||
|
||||
|
||||
export class BabylonRepository {
|
||||
engine: Engine;
|
||||
canvas: HTMLCanvasElement;
|
||||
scene: Scene;
|
||||
constructor(canvas: HTMLCanvasElement) {
|
||||
this.engine = new Engine(canvas, true);
|
||||
this.scene = this.CreateScene();
|
||||
this.engine.runRenderLoop(() => {
|
||||
this.scene.render();
|
||||
});
|
||||
const Camera = new FreeCamera("camera", new Vector3(0, 1, -5), this.scene);
|
||||
Camera.attachControl();
|
||||
const light = new HemisphericLight("light", new Vector3(0, 1, 0), this.scene);
|
||||
light.intensity = 0.5;
|
||||
//3D Object
|
||||
// const ground = MeshBuilder.CreateGround("ground", { width: 10, height: 10 }, this.scene);
|
||||
// const sphereball = MeshBuilder.CreateSphere("sphereball", { diameter: 1 }, this.scene);
|
||||
// sphereball.position = new Vector3(0, 1, 0)
|
||||
|
||||
SceneLoader.RegisterPlugin(new GLTFFileLoader())
|
||||
SceneLoader.RegisterPlugin(new STLFileLoader());
|
||||
|
||||
}
|
||||
CreateScene(): Scene {
|
||||
const scene = new Scene(this.engine);
|
||||
return scene;
|
||||
}
|
||||
load = (url: string) => {
|
||||
|
||||
SceneLoader.LoadAssetContainer(url)
|
||||
|
||||
}
|
||||
}
|
|
@ -22,7 +22,8 @@ import {
|
|||
MeshBasicMaterial,
|
||||
PlaneGeometry,
|
||||
BoxGeometry,
|
||||
AxesHelper
|
||||
AxesHelper,
|
||||
MeshStandardMaterial
|
||||
} from "three";
|
||||
import { TypedEvent } from "../helper/typed_event";
|
||||
import { Result } from "../helper/result";
|
||||
|
@ -187,6 +188,15 @@ export class CoreThreeRepository extends TypedEvent<BaseSceneItemModel> {
|
|||
new Quaternion(0, 0, 0, 0)
|
||||
);
|
||||
}
|
||||
load(path: string, name: string, loadCallback?: Function) {
|
||||
|
||||
this.loader(
|
||||
'http://localhost:4001/1dfc4e1a-9c1a-4fa2-96b2-19c86acb6ea4/assets/libs/objects/untitled.glb',
|
||||
loadCallback ? loadCallback : () => { },
|
||||
name,
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
setTransformMode(mode?: SceneMode) {
|
||||
switch (mode) {
|
||||
|
@ -347,7 +357,10 @@ export class CoreThreeRepository extends TypedEvent<BaseSceneItemModel> {
|
|||
case "glb":
|
||||
this.glbLoader.load(
|
||||
url,
|
||||
(result) => { },
|
||||
(result) => {
|
||||
this.scene.add(result.scene)
|
||||
|
||||
},
|
||||
(err) => { }
|
||||
);
|
||||
break;
|
||||
|
@ -373,14 +386,28 @@ export class CoreThreeRepository extends TypedEvent<BaseSceneItemModel> {
|
|||
case "dae":
|
||||
this.daeLoader.load(
|
||||
url,
|
||||
(result) => { },
|
||||
(result) => {
|
||||
this.scene.add(result.scene.children[0])
|
||||
},
|
||||
(err) => { }
|
||||
);
|
||||
break;
|
||||
case "stl":
|
||||
this.stlLoader.load(
|
||||
url,
|
||||
(result) => { },
|
||||
(result) => {
|
||||
const material = new MeshStandardMaterial({
|
||||
color: 'red',
|
||||
metalness: 0.35,
|
||||
roughness: 1,
|
||||
opacity: 1.0,
|
||||
transparent: false,
|
||||
});
|
||||
|
||||
const mesh = new Mesh(result, material);
|
||||
this.scene.add(mesh);
|
||||
|
||||
},
|
||||
|
||||
(err) => { }
|
||||
);
|
||||
|
|
BIN
ui/src/core/repository/sol_gear.glb
Normal file
BIN
ui/src/core/repository/sol_gear.glb
Normal file
Binary file not shown.
|
@ -17,11 +17,11 @@ import {
|
|||
StickObjectsMarkingScreenPath,
|
||||
} from "../../features/_stick_objects_marking/stick_objects_marking_screen";
|
||||
import { DataSetScreen, DatasetsScreenPath } from "../../features/dataset/dataset_screen";
|
||||
import DetailsScreen, { DetailsScreenPath } from "../../features/details/details_screen";
|
||||
import { AssemblesScreen, AssemblesScreenPath } from "../../features/assembles/assembles_screen";
|
||||
import { SimulationScreen, SimulationScreenPath } from "../../features/simulations/simulations_screen";
|
||||
import { EstimateScreen, EstimateScreenPath } from "../../features/estimate/estimate_screen";
|
||||
import { SkillPath, SkillScreen } from "../../features/skils/skills_screen";
|
||||
import { DetailsScreenPath, DetailsScreen } from "../../features/details/details_screen";
|
||||
|
||||
const idURL = ":id";
|
||||
|
||||
|
|
|
@ -6,12 +6,12 @@ import { LoadingOutlined } from "@ant-design/icons";
|
|||
import React from "react";
|
||||
import { SceneManagerPath } from "../../../features/scene_manager/presentation/scene_manager";
|
||||
import { AssemblesScreenPath } from "../../../features/assembles/assembles_screen";
|
||||
import { DetailsScreenPath } from "../../../features/details/details_screen";
|
||||
import { SimulationScreenPath } from "../../../features/simulations/simulations_screen";
|
||||
import { EstimateScreenPath } from "../../../features/estimate/estimate_screen";
|
||||
import { BehaviorTreeBuilderPath } from "../../../features/behavior_tree_builder/presentation/behavior_tree_builder_screen";
|
||||
import { SkillPath as SkillScreenPath } from "../../../features/skils/skills_screen";
|
||||
import { UiBaseError } from "../../model/ui_base_error";
|
||||
import { DetailsScreenPath } from "../../../features/details/details_screen";
|
||||
export interface IBlockProps {
|
||||
name: string;
|
||||
isActive: boolean;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue