Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Examples: Refactor webgl_loader_ifc to external demo. #25440

Merged
merged 7 commits into from
Feb 20, 2023
Merged

Examples: Refactor webgl_loader_ifc to external demo. #25440

merged 7 commits into from
Feb 20, 2023

Conversation

agviegas
Copy link
Contributor

@agviegas agviegas commented Feb 5, 2023

Description

As asked here, remove the code of the IFCLoader from the library to keep it here as the single source of truth. Leave the example import it using source maps, like it does with three-mesh-bvh.

@agviegas agviegas mentioned this pull request Feb 5, 2023
"three/addons/": "./jsm/"
"three/addons/": "./jsm/",
"three/examples/jsm/utils/BufferGeometryUtils": "./jsm/utils/BufferGeometryUtils.js",
"three-mesh-bvh": "https://unpkg.com/three-mesh-bvh@^0.5.21/build/index.module.js",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the other examples we used fixed releases to avoid inadvertant breakage from package updates.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, is a import of three-mesh-bvh needed here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @gkjohnson are you suggesting to import a fixed version of three?

@LeviPesin yes, the IFCLoader needs it!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @gkjohnson are you suggesting to import a fixed version of three?

I should have been more specific - the ^ version specifier means the version of three-mesh-bvh is not fixed. It would be
best to just lock the version at the current latest without the caret. See #23907 (comment).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it, done!

@@ -25,7 +25,11 @@
{
"imports": {
"three": "../build/three.module.js",
"three/addons/": "./jsm/"
"three/addons/": "./jsm/",
"three/examples/jsm/utils/BufferGeometryUtils": "./jsm/utils/BufferGeometryUtils.js",
Copy link
Contributor

@LeviPesin LeviPesin Feb 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why you are separately importing BufferGeometryUtils? Both three/examples/jsm/utils/BufferGeometryUtils.js and three/addons/utils/BufferGeometryUtils.js (preferred) imports should work -- not sure about extensionless import.

Copy link
Contributor Author

@agviegas agviegas Feb 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because the IFCLoader needs it to work without bundling 🤔 Should I change this?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you're specifying the three/addons path in the import map you can import from three/addons/utils/BufferGeometryUtils.js instead of adding another import map entry.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. The current bundle of web-ifc-three imports from three/examples/jsm/utils/, so to get rid of this entry in the import map, I would need to update all the imports in the library. Is the three/examples/ route deprecated? If not, maybe I can change the imports in the web-ifc-three library and get rid of this entry of the importmaps in another PR?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the three/examples/ route deprecated?

No, it isn't. We just prefer to use the "addons" term since it's more appropriate than "examples".

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If not, maybe I can change the imports in the web-ifc-three library and get rid of this entry of the importmaps in another PR?

👍

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I use the /examples/jsm folder in three-mesh-bvh, as well, so the import maps in the path tracer example list both three/addons/ and three/examples/, too. At the moment I'm not planning to change the bvh project imports:

<script type="importmap">
{
"imports": {
"three": "../build/three.module.js",
"three/addons/": "./jsm/",
"three/examples/": "./",
"three-gpu-pathtracer": "https://unpkg.com/three-gpu-pathtracer@0.0.11/build/index.module.js",
"three-mesh-bvh": "https://unpkg.com/three-mesh-bvh@^0.5.21/build/index.module.js"
}
}
</script>

@mrdoob mrdoob added this to the r150 milestone Feb 6, 2023
@LeviPesin
Copy link
Contributor

Seems like the screenshot requires updating.

@mrdoob
Copy link
Owner

mrdoob commented Feb 14, 2023

Is the screenshot the only thing missing here?

@agviegas
Copy link
Contributor Author

Sorry, should I just upload an image?

@LeviPesin
Copy link
Contributor

Just use npm run make-screenshot webgl_loader_ifc.

@agviegas
Copy link
Contributor Author

I run the command npm run make-screenshot webgl_loader_ifc (after npm i) and it starts a process that doesn't end. Should I wait (screenshot below)? Btw, I just checked and although the version of IFC.js was updated, the screenshot should be pretty much the same. Does it really need to be updated?

image

@LeviPesin
Copy link
Contributor

LeviPesin commented Feb 16, 2023

I run the command npm run make-screenshot webgl_loader_ifc (after npm i) and it starts a process that doesn't end.

Because of a (fixed) bug there -- you can merge the dev branch into this one and it will start to work.

Btw, I just checked and although the version of IFC.js was updated, the screenshot should be pretty much the same. Does it really need to be updated?

The E2E test sees that it is not the same.

@agviegas
Copy link
Contributor Author

Hum, strange. I merged the changes from dev and did it, and the new screenshot looks black 🤔 But if I execute the viewer, it shows correctly.

image

@gkjohnson
Copy link
Collaborator

I went ahead and updated the screenshot in the branch for you so this should be ready to merge.

It's hard to say why the screenshot would render black on your machine 🤔.

@LeviPesin
Copy link
Contributor

the new screenshot looks black

@agviegas What OS you are using? Does npm run make-screenshot webgl_loader_ifc output anything?

@agviegas
Copy link
Contributor Author

I'm on windows. I've no idea why, but now the screenshot is correct. I just re-run the command again 🤔 Thanks a lot for the help!

@Mugen87 Mugen87 merged commit ce383d9 into mrdoob:dev Feb 20, 2023
@Mugen87 Mugen87 changed the title Update IFCLoader example Examples: Refactor webgl_loader_ifc to external demo. Feb 20, 2023
This was referenced Apr 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants