Skip to content

Commit

Permalink
Should work now
Browse files Browse the repository at this point in the history
  • Loading branch information
DraTeots committed Sep 13, 2024
1 parent 4c571f2 commit 4369cb2
Showing 1 changed file with 30 additions and 14 deletions.
44 changes: 30 additions & 14 deletions firebird-ng/src/app/geometry-tree/geometry-tree.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ import {MatIcon, MatIconModule} from '@angular/material/icon';
import {MatButtonModule, MatIconButton} from '@angular/material/button';
import {GeometryService} from "../geometry.service";
import {Object3D} from "three";
import {EventDisplayService} from "phoenix-ui-components";
import {GameControllerService} from "../game-controller.service";
import {ActivatedRoute} from "@angular/router";
import {UserConfigService} from "../user-config.service";
import {MatSnackBar} from "@angular/material/snack-bar";
import {PhoenixThreeFacade} from "../utils/phoenix-three-facade";

/**
* Food data with nested structure.
Expand Down Expand Up @@ -100,24 +106,34 @@ export class GeometryTreeComponent implements OnInit{


hasChild = (_: number, node: ExampleFlatNode) => node.expandable;
private threeFacade: PhoenixThreeFacade;

constructor(private geomService: GeometryService,
private eventDisplay: EventDisplayService) {
//this.dataSource.data = TREE_DATA;
this.threeFacade = new PhoenixThreeFacade(this.eventDisplay);


constructor(private geomService: GeometryService) {
//this.dataSource.data = TREE_DATA;
}

ngOnInit(): void {
if(!this.geomService.geometry) this.geomService.loadGeometry().then(result => {
if(result.threeGeometry) {
this.dataSource.data = result.threeGeometry.children;
}
else {
console.error("this.geomService.loadGeometry() ! result.threeGeometry");
}
}).catch(reason=>{
console.error("ERROR LOADING GEOMETRY");
console.log(reason);
});
}

// if (!this.geomService.geometry) {
// this.geomService.loadGeometry()
// .then(result => {
// if (result.threeGeometry) {
// this.dataSource.data = result.threeGeometry.children;
// } else {
// console.error("this.geomService.loadGeometry() ! result.threeGeometry");
// }
// })
// .catch(reason => {
// console.error("ERROR LOADING GEOMETRY");
// console.log(reason);
// });
// }
this.dataSource.data = this.threeFacade.scene.children;
}

toggleVisibility(node: ExampleFlatNode) {
this.geomService.toggleVisibility(node.object3D);
Expand Down

0 comments on commit 4369cb2

Please sign in to comment.