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(Glb): load a glb on 3D map #2155

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Conversation

Exareyn
Copy link

@Exareyn Exareyn commented Jul 25, 2023

Description

Add an example demonstrating how to load a glb (glTF binary) model on a 3D Map

Motivation and Context
I needed a way to load any glb into a 3D Map and the only existing example merged recently that i found didn't really worked with any glb. So I made this example that should work with every glb. Hope it helps other people who need something like this too.
#2129 (comment)

This is what I got using the example I found after using it with different glb :
bim2

Changes Made
Created a new example file named "itowns_glb.html".

The example should load a glb like in the next screen :
bim4

If something is wrong or need to be updated let me know. I'm also working on a glTFLayer to make it easier to create and load a glb anywhere but it is not ready yet.

And I don't know where I should push my glb asset used on the screens for testing if it's needed.

This was made during an intership at Futurmap

Copy link
Contributor

@jailln jailln left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution :)

You can upload your glb asset to the following repository by opening a new PR: https://github.com/iTowns/iTowns2-sample-data (along with a license file and if its license allows it).

Can you add a functional test in test/functional please? (all itowns examples are tested in functional tests so we easily detect issues). A minimal test is to check that it runs (like here). Other ideas of tests are to check if the model has been correctly added in the scene and to pick into the scene to check if the model is displayed at the correct coordinates.

examples/itowns_GLB.html Outdated Show resolved Hide resolved
examples/itowns_GLB.html Outdated Show resolved Hide resolved
@mgermerie
Copy link
Contributor

Hi, thanks for this new example.
Could you update the initial placement so that the initial viewer is zoomed a bit more on your model ?

Also, if that's ok for @LoicUTC and @PhilippeMarc-IGN, could you rename your example to something like misc_gltf_model.html and add it in examples/config.json under Miscellaneous section ?

Comment on lines +73 to +80
object = model;
const boundingBox = new THREE.Box3();
boundingBox.setFromObject(object);
const center = boundingBox.getCenter(new THREE.Vector3());

object.position.x += object.position.x - center.x;
object.position.y += object.position.y - center.y;
object.position.z += object.position.z - center.z;
Copy link
Contributor

@jailln jailln Jul 31, 2023

Choose a reason for hiding this comment

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

I think you can remove these lines.

@jailln
Copy link
Contributor

jailln commented Sep 20, 2023

Hi @Exareyn, are you still active on this subject? Are you able to implement the last modifications asked in the review? Can we help you in any way for doing them?

@jailln jailln self-assigned this Sep 20, 2023
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.

3 participants