Skip to content

Commit e5cb1b9

Browse files
Merge pull request #79 from ynnob/fix/missing_ifc_bcf_topic_list
fix: Replace loading of small.ifc with the new fragment model #78
2 parents dfe8c7e + 76e9961 commit e5cb1b9

File tree

1 file changed

+17
-22
lines changed
  • packages/obc/src/components/tables/TopicsList

1 file changed

+17
-22
lines changed

packages/obc/src/components/tables/TopicsList/example.ts

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ world.renderer = rendererComponent;
3939

4040
const cameraComponent = new OBC.SimpleCamera(components);
4141
world.camera = cameraComponent;
42-
cameraComponent.controls.setLookAt(10, 5.5, 5, -4, -1, -6.5);
42+
await world.camera.controls.setLookAt(68, 23, -8.5, 21.5, -5.5, 23);
4343

4444
viewport.addEventListener("resize", () => {
4545
rendererComponent.resize();
@@ -77,23 +77,19 @@ fragments.list.onItemSet.add(async ({ value: model }) => {
7777
await fragments.core.update(true);
7878
});
7979

80-
const ifcLoader = components.get(OBC.IfcLoader);
81-
await ifcLoader.setup({
82-
autoSetWasm: false,
83-
wasm: {
84-
path: "https://unpkg.com/[email protected]/",
85-
absolute: true,
86-
},
87-
});
88-
89-
const file = await fetch(
90-
"https://thatopen.github.io/engine_ui-components/resources/small.ifc",
91-
);
80+
const fragPaths = [
81+
"https://thatopen.github.io/engine_components/resources/frags/school_arq.frag",
82+
"https://thatopen.github.io/engine_components/resources/frags/school_str.frag",
83+
];
9284

93-
const buffer = await file.arrayBuffer();
94-
const typedArray = new Uint8Array(buffer);
95-
await ifcLoader.load(typedArray, true, "small");
96-
// world.scene.three.add(model.object);
85+
await Promise.all(
86+
fragPaths.map(async (path) => {
87+
const modelId = path.split("/").pop()?.split(".").shift();
88+
if (!modelId) return null;
89+
const file = await fetch(path);
90+
const buffer = await file.arrayBuffer();
91+
return fragments.core.load(buffer, { modelId });
92+
});
9793

9894
/* MD
9995
:::tip
@@ -318,15 +314,14 @@ const [topicPanel, updateTopicPanel] = BUI.Component.create<
318314
</bim-panel-section>
319315
<!-- This is a custom section where you can add any functionality you like -->
320316
<bim-panel-section label="Communication" icon="tabler:link">
321-
${
322-
topic.assignedTo
323-
? BUI.html`
317+
${topic.assignedTo
318+
? BUI.html`
324319
<bim-button @click=${onReminderClick} label="Send Mail Reminder" icon="mingcute:send-fill"></bim-button>
325320
`
326-
: BUI.html`
321+
: BUI.html`
327322
<bim-label style="white-space: normal">The topic must have an assignee to use the communication tools. Update the topic with a new assignee!</bim-label>
328323
`
329-
}
324+
}
330325
</bim-panel-section>
331326
`;
332327
} else {

0 commit comments

Comments
 (0)