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

fix(tile-converter): skip failing content #2576

Merged
merged 3 commits into from
Aug 11, 2023

Conversation

belom88
Copy link
Collaborator

@belom88 belom88 commented Aug 4, 2023

No description provided.

@belom88 belom88 requested a review from ibgreen August 4, 2023 10:09
Copy link
Collaborator

@ibgreen ibgreen left a 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) {
Copy link
Collaborator

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';
Copy link
Collaborator

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';
Copy link
Collaborator

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);
Copy link
Collaborator

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.

@belom88 belom88 merged commit d92fa35 into master Aug 11, 2023
@belom88 belom88 deleted the vb/fix-3d-tiles-converter-failing-content branch August 11, 2023 10:00
@dsavinov-actionengine dsavinov-actionengine added the ActionEngine The issue is on ActionEngine controll label Sep 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ActionEngine The issue is on ActionEngine controll
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants