@@ -99,22 +99,21 @@ const settings = {
9999*/
100100
101101const workerUrl = "../../src/multithreading/fragments-thread.ts" ;
102- const fragments = new FRAGS . FragmentsModels ( workerUrl ) ;
103- const fragmentsManager = components . get ( OBC . FragmentsManager ) ;
102+ const fragments = components . get ( OBC . FragmentsManager ) ;
103+ fragments . init ( workerUrl ) ;
104104
105105// Temp until we publish the libraries, to be able to use postproduction
106106// @ts -ignore
107- fragmentsManager . _core = fragments ;
108107
109108fragments . settings . graphicsQuality = 1 ;
110109
111110world . camera . controls . addEventListener ( "control" , ( ) => {
112- fragments . update ( ) ;
111+ fragments . core . update ( ) ;
113112} ) ;
114113
115114// Once a model is available in the list, we can tell it
116115// to use shadows and to use the clipping planes we are using
117- fragments . models . list . onItemSet . add ( ( { value : model } ) => {
116+ fragments . core . models . list . onItemSet . add ( ( { value : model } ) => {
118117 model . tiles . onItemSet . add ( ( { value : mesh } ) => {
119118 if ( "isMesh" in mesh ) {
120119 const mat = mesh . material as THREE . MeshStandardMaterial [ ] ;
@@ -210,14 +209,14 @@ const updateClipPlane = () => {
210209*/
211210
212211const bytes = FRAGS . EditUtils . newModel ( { raw : true } ) ;
213- const model = await fragments . load ( bytes , {
212+ const model = await fragments . core . load ( bytes , {
214213 modelId : "example" ,
215214 camera : world . camera . three ,
216215 raw : true ,
217216} ) ;
218217
219218world . scene . three . add ( model . object ) ;
220- await fragments . update ( true ) ;
219+ await fragments . core . update ( true ) ;
221220
222221/* MD
223222 ### 🧊 Setting up the Geometry Engine
@@ -294,7 +293,7 @@ const staircaseHoleMesh = new THREE.Mesh(staircaseHoleGeometry);
294293const regenerateFragments = async ( ) => {
295294 const elementsData : FRAGS . NewElementData [ ] = [ ] ;
296295
297- await fragments . editor . reset ( model . modelId ) ;
296+ await fragments . core . editor . reset ( model . modelId ) ;
298297
299298 // Create floor
300299
@@ -323,15 +322,15 @@ const regenerateFragments = async () => {
323322
324323 // Create base items
325324
326- const matId = fragments . editor . createMaterial (
325+ const matId = fragments . core . editor . createMaterial (
327326 model . modelId ,
328327 new THREE . MeshLambertMaterial ( {
329328 color : new THREE . Color ( 1 , 1 , 1 ) ,
330329 side : THREE . DoubleSide ,
331330 } ) ,
332331 ) ;
333332
334- const ltId = fragments . editor . createLocalTransform (
333+ const ltId = fragments . core . editor . createLocalTransform (
335334 model . modelId ,
336335 new THREE . Matrix4 ( ) . identity ( ) ,
337336 ) ;
@@ -381,7 +380,7 @@ const regenerateFragments = async () => {
381380 length : settings . floorHeight ,
382381 } ) ;
383382
384- const extColumnGeoId = fragments . editor . createShell (
383+ const extColumnGeoId = fragments . core . editor . createShell (
385384 model . modelId ,
386385 exteriorColumnGeometry ,
387386 ) ;
@@ -406,7 +405,7 @@ const regenerateFragments = async () => {
406405 length : settings . floorHeight ,
407406 } ) ;
408407
409- const cornerWallGeoId = fragments . editor . createShell (
408+ const cornerWallGeoId = fragments . core . editor . createShell (
410409 model . modelId ,
411410 cornerWallGeometry ,
412411 ) ;
@@ -433,7 +432,7 @@ const regenerateFragments = async () => {
433432 length : settings . floorHeight - settings . floorThickness ,
434433 } ) ;
435434
436- const intColumnGeoId = fragments . editor . createShell (
435+ const intColumnGeoId = fragments . core . editor . createShell (
437436 model . modelId ,
438437 interiorColumnGeometry ,
439438 ) ;
@@ -474,7 +473,7 @@ const regenerateFragments = async () => {
474473 height : settings . floorHeight - settings . floorThickness ,
475474 } ) ;
476475
477- const staircaseWall1GeoId = fragments . editor . createShell (
476+ const staircaseWall1GeoId = fragments . core . editor . createShell (
478477 model . modelId ,
479478 staircaseWallGeometry1 ,
480479 ) ;
@@ -492,7 +491,7 @@ const regenerateFragments = async () => {
492491 height : settings . floorHeight - settings . floorThickness ,
493492 } ) ;
494493
495- const staircaseWall2GeoId = fragments . editor . createShell (
494+ const staircaseWall2GeoId = fragments . core . editor . createShell (
496495 model . modelId ,
497496 staircaseWallGeometry2 ,
498497 ) ;
@@ -540,7 +539,7 @@ const regenerateFragments = async () => {
540539 world . scene . three . add ( tempMesh6 ) ;
541540 tempMesh6 . position . y += 10 ;
542541
543- const floorGeoId = fragments . editor . createShell (
542+ const floorGeoId = fragments . core . editor . createShell (
544543 model . modelId ,
545544 cutFloorGeometry ,
546545 ) ;
@@ -565,7 +564,7 @@ const regenerateFragments = async () => {
565564 ] ,
566565 } ) ;
567566
568- const windowFrameGeoId = fragments . editor . createShell (
567+ const windowFrameGeoId = fragments . core . editor . createShell (
569568 model . modelId ,
570569 windowFrameGeometry ,
571570 ) ;
@@ -587,7 +586,7 @@ const regenerateFragments = async () => {
587586 length : settings . floorThickness ,
588587 } ) ;
589588
590- const windowTopGeoId = fragments . editor . createShell (
589+ const windowTopGeoId = fragments . core . editor . createShell (
591590 model . modelId ,
592591 windowTopGeometry ,
593592 ) ;
@@ -614,7 +613,7 @@ const regenerateFragments = async () => {
614613 ] ,
615614 } ) ;
616615
617- const roofTopGeoId = fragments . editor . createShell (
616+ const roofTopGeoId = fragments . core . editor . createShell (
618617 model . modelId ,
619618 roofTopGeometry ,
620619 ) ;
@@ -988,11 +987,11 @@ const regenerateFragments = async () => {
988987 }
989988 }
990989
991- await fragments . editor . createElements ( model . modelId , elementsData ) ;
990+ await fragments . core . editor . createElements ( model . modelId , elementsData ) ;
992991
993992 clearEdges ( ) ;
994993
995- await fragments . update ( true ) ;
994+ await fragments . core . update ( true ) ;
996995
997996 processing = false ;
998997} ;
@@ -1043,7 +1042,7 @@ const viewModes: [ViewMode, string][] = [
10431042const updateCamera = (
10441043 camera : THREE . PerspectiveCamera | THREE . OrthographicCamera ,
10451044) => {
1046- for ( const [ , model ] of fragments . models . list ) {
1045+ for ( const [ , model ] of fragments . core . models . list ) {
10471046 model . useCamera ( camera ) ;
10481047 }
10491048 world . renderer ! . postproduction . updateCamera ( ) ;
0 commit comments