-
Notifications
You must be signed in to change notification settings - Fork 195
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
fix(tile-converter): skip failing content #2576
Conversation
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.
Please take another look at the Symbol.species
usage.
@@ -147,6 +147,11 @@ export default class Tiles3DConverter { | |||
if (sourceChild.contentUrl) { | |||
const content = await loadI3SContent(this.sourceTileset, sourceChild, this.loaderOptions); | |||
|
|||
if (!content) { |
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.
Maybe a comment?
@@ -5,12 +5,13 @@ import {Matrix4, Vector3} from '@math.gl/core'; | |||
import {Ellipsoid} from '@math.gl/geospatial'; | |||
import {convertTextureAtlas} from './texture-atlas'; | |||
import {generateSyntheticIndices} from '../../lib/utils/geometry-utils'; | |||
import {I3STileContent} from '@loaders.gl/i3s'; |
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.
import type
?
@@ -1,12 +1,14 @@ | |||
import {TypedArray} from '@loaders.gl/loader-utils'; |
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.
import type
?
export function convertTextureAtlas(texCoords: Float32Array, uvRegions: Uint16Array): Float32Array { | ||
const convertedTexCoords = new Float32Array(texCoords.length); | ||
export function convertTextureAtlas(texCoords: TypedArray, uvRegions: TypedArray): Float32Array { | ||
const convertedTexCoords = new texCoords[Symbol.species](texCoords.length); |
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.
Hmm, I have never needed to use Symbol.species
. Do we need this or can we get away with a simpler constructor. This feature seems to be for overriding default constructor when subclassing built in types? https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/species.
Also do we still need the original texCoords after conversion? If not consider converting "in place" and avoid an allocation?
Finally an unrelated comment: In the algorithm below there are lots of little arrays being created for each iteration. I would recommend creating a few scratch arrays before the loop and reusing those, to reduce memory pressure and improve performance.
No description provided.