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 metadata parsing in the case of parent TransformNodes. #195

Merged
merged 3 commits into from
Oct 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/modules/entity/components/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//

export { KeyLightComponent } from "./KeyLightComponent.js";
export { HazeComponent } from "./HazeComponent.js";
export { SkyboxComponent } from "./SkyboxComponent.js";
export { ModelComponent } from "./ModelComponent.js";
export { ImageComponent } from "./ImageComponent.js";
export { MaterialComponent } from "./MaterialComponent.js";
export { ShapeComponent } from "./ShapeComponent.js";
export { LightEntityComponent } from "./LightComponent.js";
export { KeyLightComponent } from "./KeyLightComponent";
export { HazeComponent } from "./HazeComponent";
export { SkyboxComponent } from "./SkyboxComponent";
export { ModelComponent } from "./ModelComponent";
export { ImageComponent } from "./ImageComponent";
export { MaterialComponent } from "./MaterialComponent";
export { ShapeComponent } from "./ShapeComponent";
export { LightEntityComponent } from "./LightComponent";
33 changes: 26 additions & 7 deletions src/modules/scene/LODManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,15 +124,34 @@
}

private static getMetadataFromMesh(mesh: AbstractMesh | Mesh | InstancedMesh) {
const metadata: Nullable<MeshMetadata> = mesh.metadata?.gltf?.extras;
const meshExtras = mesh.metadata?.gltf?.extras;

Check warning on line 127 in src/modules/scene/LODManager.ts

View workflow job for this annotation

GitHub Actions / ⚒️ Build

Unsafe assignment of an `any` value

Check warning on line 127 in src/modules/scene/LODManager.ts

View workflow job for this annotation

GitHub Actions / ⚒️ Build

Unsafe member access .gltf on an `any` value

Check warning on line 127 in src/modules/scene/LODManager.ts

View workflow job for this annotation

GitHub Actions / ⚒️ Build

Unsafe assignment of an `any` value

Check warning on line 127 in src/modules/scene/LODManager.ts

View workflow job for this annotation

GitHub Actions / ⚒️ Build

Unsafe member access .gltf on an `any` value

Check warning on line 127 in src/modules/scene/LODManager.ts

View workflow job for this annotation

GitHub Actions / 🎉 Deploy

Unsafe assignment of an `any` value

Check warning on line 127 in src/modules/scene/LODManager.ts

View workflow job for this annotation

GitHub Actions / 🎉 Deploy

Unsafe member access .gltf on an `any` value
const parentExtras = mesh.parent?.metadata?.gltf?.extras;

Check warning on line 128 in src/modules/scene/LODManager.ts

View workflow job for this annotation

GitHub Actions / ⚒️ Build

Unsafe assignment of an `any` value

Check warning on line 128 in src/modules/scene/LODManager.ts

View workflow job for this annotation

GitHub Actions / ⚒️ Build

Unsafe member access .gltf on an `any` value

Check warning on line 128 in src/modules/scene/LODManager.ts

View workflow job for this annotation

GitHub Actions / ⚒️ Build

Unsafe assignment of an `any` value

Check warning on line 128 in src/modules/scene/LODManager.ts

View workflow job for this annotation

GitHub Actions / ⚒️ Build

Unsafe member access .gltf on an `any` value

Check warning on line 128 in src/modules/scene/LODManager.ts

View workflow job for this annotation

GitHub Actions / 🎉 Deploy

Unsafe assignment of an `any` value

Check warning on line 128 in src/modules/scene/LODManager.ts

View workflow job for this annotation

GitHub Actions / 🎉 Deploy

Unsafe member access .gltf on an `any` value

const meshMetadata: MeshMetadata = {
vircadia_lod_mode: metadata?.vircadia_lod_mode,
vircadia_lod_auto: metadata?.vircadia_lod_auto,
vircadia_lod_distance: metadata?.vircadia_lod_distance,
vircadia_lod_size: metadata?.vircadia_lod_size,
vircadia_lod_hide: metadata?.vircadia_lod_hide,
vircadia_billboard_mode: metadata?.vircadia_billboard_mode,
vircadia_lod_mode: undefined,
vircadia_lod_auto: undefined,
vircadia_lod_distance: undefined,
vircadia_lod_size: undefined,
vircadia_lod_hide: undefined,
vircadia_billboard_mode: undefined
};

if (meshExtras === null || meshExtras === undefined && parentExtras !== null || parentExtras !== undefined) {
meshMetadata.vircadia_lod_mode = parentExtras?.vircadia_lod_mode;

Check warning on line 140 in src/modules/scene/LODManager.ts

View workflow job for this annotation

GitHub Actions / ⚒️ Build

Unsafe assignment of an `any` value

Check warning on line 140 in src/modules/scene/LODManager.ts

View workflow job for this annotation

GitHub Actions / ⚒️ Build

Unsafe member access .vircadia_lod_mode on an `any` value

Check warning on line 140 in src/modules/scene/LODManager.ts

View workflow job for this annotation

GitHub Actions / ⚒️ Build

Unsafe assignment of an `any` value

Check warning on line 140 in src/modules/scene/LODManager.ts

View workflow job for this annotation

GitHub Actions / ⚒️ Build

Unsafe member access .vircadia_lod_mode on an `any` value

Check warning on line 140 in src/modules/scene/LODManager.ts

View workflow job for this annotation

GitHub Actions / 🎉 Deploy

Unsafe assignment of an `any` value

Check warning on line 140 in src/modules/scene/LODManager.ts

View workflow job for this annotation

GitHub Actions / 🎉 Deploy

Unsafe member access .vircadia_lod_mode on an `any` value
meshMetadata.vircadia_lod_auto = parentExtras?.vircadia_lod_auto;

Check warning on line 141 in src/modules/scene/LODManager.ts

View workflow job for this annotation

GitHub Actions / ⚒️ Build

Unsafe assignment of an `any` value

Check warning on line 141 in src/modules/scene/LODManager.ts

View workflow job for this annotation

GitHub Actions / ⚒️ Build

Unsafe member access .vircadia_lod_auto on an `any` value

Check warning on line 141 in src/modules/scene/LODManager.ts

View workflow job for this annotation

GitHub Actions / ⚒️ Build

Unsafe assignment of an `any` value

Check warning on line 141 in src/modules/scene/LODManager.ts

View workflow job for this annotation

GitHub Actions / ⚒️ Build

Unsafe member access .vircadia_lod_auto on an `any` value

Check warning on line 141 in src/modules/scene/LODManager.ts

View workflow job for this annotation

GitHub Actions / 🎉 Deploy

Unsafe assignment of an `any` value

Check warning on line 141 in src/modules/scene/LODManager.ts

View workflow job for this annotation

GitHub Actions / 🎉 Deploy

Unsafe member access .vircadia_lod_auto on an `any` value
meshMetadata.vircadia_lod_distance = parentExtras?.vircadia_lod_distance;

Check warning on line 142 in src/modules/scene/LODManager.ts

View workflow job for this annotation

GitHub Actions / ⚒️ Build

Unsafe assignment of an `any` value

Check warning on line 142 in src/modules/scene/LODManager.ts

View workflow job for this annotation

GitHub Actions / ⚒️ Build

Unsafe member access .vircadia_lod_distance on an `any` value

Check warning on line 142 in src/modules/scene/LODManager.ts

View workflow job for this annotation

GitHub Actions / ⚒️ Build

Unsafe assignment of an `any` value

Check warning on line 142 in src/modules/scene/LODManager.ts

View workflow job for this annotation

GitHub Actions / ⚒️ Build

Unsafe member access .vircadia_lod_distance on an `any` value

Check warning on line 142 in src/modules/scene/LODManager.ts

View workflow job for this annotation

GitHub Actions / 🎉 Deploy

Unsafe assignment of an `any` value

Check warning on line 142 in src/modules/scene/LODManager.ts

View workflow job for this annotation

GitHub Actions / 🎉 Deploy

Unsafe member access .vircadia_lod_distance on an `any` value
meshMetadata.vircadia_lod_size = parentExtras?.vircadia_lod_size;
meshMetadata.vircadia_lod_hide = parentExtras?.vircadia_lod_hide;
meshMetadata.vircadia_billboard_mode = parentExtras?.vircadia_billboard_mode;
} else {
meshMetadata.vircadia_lod_mode = meshExtras?.vircadia_lod_mode;
meshMetadata.vircadia_lod_auto = meshExtras?.vircadia_lod_auto;
meshMetadata.vircadia_lod_distance = meshExtras?.vircadia_lod_distance;
meshMetadata.vircadia_lod_size = meshExtras?.vircadia_lod_size;
meshMetadata.vircadia_lod_hide = meshExtras?.vircadia_lod_hide;
meshMetadata.vircadia_billboard_mode = meshExtras?.vircadia_billboard_mode;
}

return meshMetadata;
}

Expand Down
Loading