Skip to content

Commit 55da558

Browse files
committed
GLTFs contain multiple files, so we cannot just import a GLB.
1 parent f94efc7 commit 55da558

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
<span>Upload</span>
6464
</span>
6565
</label>
66-
<input id="model-upload" type="file" name="file-upload" accept=".glb, .gltf, .fbx" />
66+
<input id="model-upload" type="file" name="file-upload" accept=".glb, .zip, .fbx" />
6767

6868
<div style="text-align: center; font-size: 1.5rem">or</div>
6969

src/lib/processes/load-model/StepLoadModel.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ export class StepLoadModel extends EventTarget {
3030
triangle_count = 0
3131
objects_count = 0
3232

33-
3433
// function that goes through all our geometry data and calculates how many triangles we have
3534
private calculate_mesh_metrics (): void {
3635
let triangle_count = 0
@@ -155,13 +154,15 @@ export class StepLoadModel extends EventTarget {
155154
loaded_scene.add(fbx)
156155
this.process_loaded_scene(loaded_scene)
157156
})
158-
} else if (file_extension === 'gltf' || file_extension === 'glb') {
157+
} else if (file_extension === 'glb') {
159158
this.gltf_loader.load(model_file_path, (gltf) => {
160159
const loaded_scene: Scene = gltf.scene
161160
this.process_loaded_scene(loaded_scene)
162161
})
162+
} else if (file_extension === 'zip') {
163+
console.log('try to load a GLTF file with separate BIN file from ZIP')
163164
} else {
164-
console.error('Unsupported file format to load. Only acccepts FBX, GLTF, GLB:', model_file_path)
165+
console.error('Unsupported file format to load. Only acccepts FBX, (ZIP)GLTF+BIN, GLB:', model_file_path)
165166
}
166167
}
167168

@@ -310,12 +311,11 @@ export class StepLoadModel extends EventTarget {
310311
return this.material_list
311312
}
312313

313-
314314
/**
315315
* Rotate all geometry data in the model by the given angle (in degrees) around the specified axis.
316316
* This directly modifies the geometry vertices.
317317
*/
318-
public rotate_model_geometry(axis: 'x' | 'y' | 'z', angle: number): void {
318+
public rotate_model_geometry (axis: 'x' | 'y' | 'z', angle: number): void {
319319
const radians = MathUtils.degToRad(angle)
320320
this.final_mesh_data.traverse((obj: Object3D) => {
321321
if (obj.type === 'Mesh') {
50.1 KB
Binary file not shown.

0 commit comments

Comments
 (0)