-
Notifications
You must be signed in to change notification settings - Fork 213
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
Obtain Base Url for Texture Requests within Reality Tile Loader #7450
base: master
Are you sure you want to change the base?
Conversation
does this need to be backported to 4.10? or can it go in 4.11? |
const treeId = tile.tree.id; | ||
const split = treeId.split(":"); | ||
|
||
/* Splitting with ":" will end up splitting up our base url as well as the id. |
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.
all of this seems very fragile,
please add unit test for these
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.
@aruniverse does the added unit test suffice?
No backport is needed, 4.11 is fine, thanks. |
…twinjs-core into andremig/texture-baseurl
An update on this PR - Due to the fragility of the tree id parsing method, the methods of obtaining the base url for this PR have changed. Now, all tree id parsing has been removed, and instead, the id has been passed down through the creation of the Tests have been added to a new file, Finally, we were able to test the case where a base url is passed in to the gltf reader for a tileset with full texture urls - the case discussed in my comment above. The texture requests worked as expected with no issues, so that edge case is a non-issue. |
/** Returns the source's tileset url if the source is an instance of RealityDataSourceTilesetUrlImpl. | ||
* @internal | ||
*/ | ||
export function getTilesetUrlFromTilesetUrlImpl(rdSource: RealityDataSource): string | undefined { |
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.
Delete this, add an optional method on the RealityDataSource
interface, and implement it in RealityDataSourceTilesetUrlImpl
. That will allow any other implementations of RealityDataSource
to implement it themselves if they so choose.
return glbFromChunks(chunks, header); | ||
} | ||
|
||
describe("createReaderPropsWithBaseUrl", () => { |
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.
These tests don't prove much. A much more valuable test would confirm that you successfully resolve a resource inside the glTF with a relative URL where prior to your change you would have failed to do so.
Co-authored-by: Paul Connelly <22944042+pmconne@users.noreply.github.com>
Currently, there is a bug attaching a 3dTiles tileset to the itwin viewer using
attachRealityModel
where if that model has textures, and the tileset has relative URIs for those textures, they will not be requested. This is because the base url for those requests was not being passed along to the gltf reader, and so an attempt to resolve the images for these textures would fail. This PR addresses that issue by creating the new optionalbaseUrl
parameter passed down through the creation of theRealityTileTree
.baseUrl
is created using the newgetTilesetUrlFromTilesetUrlImpl
inRealityDataSource
, which obtains the tileset url from a source which is an instance ofRealityDataSourceTilesetUrlImpl
. InRealityTileLoader.ts
, the url is checked to determine if it's a valid url, and if so, it is passed in to the creation of theGltfReaderProps
, and therefore, to the gltf reader.