-
Notifications
You must be signed in to change notification settings - Fork 216
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
base: master
Are you sure you want to change the base?
Conversation
/azp run iTwin.js |
/azp run iTwin.js Docs - YAML |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run iTwin.js Integration - GitHub |
Azure Pipelines successfully started running 1 pipeline(s). |
1 similar comment
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. |
There was a problem hiding this comment.
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.
This PR addresses this issue: #7454
When calling
ReadGltf()
,ReadGltfGraphics()
, orReadGltfTemplate()
, there is currently no option to specify theyAxisUp
option of theGltfGraphicsReader
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 toReadGltfTemplate()
may create misplaced graphics due to axis orientation issues. To solve this, an optionalyAxisUp
flag was added toReadGltfGraphicsArgs
, and can now be passed in to any of the above function calls if desired. IfReadGltfGraphicsArgs.yAxisUp
isundefined
, the flag defaults to true.