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

Add yAxisUp to ReadGltfGraphicsArgs #7653

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

Conversation

andremig-bentley
Copy link
Contributor

This PR addresses this issue: #7454

When calling ReadGltf(), ReadGltfGraphics(), or ReadGltfTemplate(), there is currently no option to specify the yAxisUp option of the GltfGraphicsReader when it is created as a part of these functions. Instead, yAxisUp is forced true. This leads to situations like the one outlined in the above issue, where a call to ReadGltfTemplate() may create misplaced graphics due to axis orientation issues. To solve this, an optional yAxisUp flag was added to ReadGltfGraphicsArgs, and can now be passed in to any of the above function calls if desired. If ReadGltfGraphicsArgs.yAxisUp is undefined, the flag defaults to true.

@andremig-bentley andremig-bentley marked this pull request as ready for review February 4, 2025 17:31
@andremig-bentley
Copy link
Contributor Author

/azp run iTwin.js

@andremig-bentley
Copy link
Contributor Author

/azp run iTwin.js Docs - YAML

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@andremig-bentley
Copy link
Contributor Author

/azp run iTwin.js Integration - GitHub

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

1 similar comment
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@@ -2178,7 +2180,8 @@ export async function readGltfGraphics(args: ReadGltfGraphicsArgs): Promise<Rend
*/
export async function readGltfTemplate(args: ReadGltfGraphicsArgs): Promise<GltfTemplate | undefined> {
const baseUrl = typeof args.baseUrl === "string" ? new URL(args.baseUrl) : args.baseUrl;
const props = GltfReaderProps.create(args.gltf, true, baseUrl); // glTF supports exactly one coordinate system with y axis up.
const yAxisUp = args.yAxisUp ?? true; // default to true
const props = GltfReaderProps.create(args.gltf, yAxisUp, baseUrl); // glTF supports exactly one coordinate system with y axis up.
Copy link
Member

@pmconne pmconne Feb 4, 2025

Choose a reason for hiding this comment

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

// glTF supports exactly one coordinate system with y axis up.

Per the comment, y is always up in glTF. Presumably the problem is in our attempt to align it to our z-up coordinate system. Caller should not have to fix that for us.

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.

2 participants