Skip to content

Commit c522e07

Browse files
add ply support (#29)
1 parent 5507203 commit c522e07

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/App.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader'
6565
import { STLLoader } from 'three/examples/jsm/loaders/STLLoader'
6666
import { FBXLoader } from 'three/examples/jsm/loaders/FBXLoader'
6767
import { OBJLoader } from 'three/examples/jsm/loaders/OBJLoader'
68+
import { PLYLoader } from 'three/examples/jsm/loaders/PLYLoader'
6869
import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls'
6970
import {
7071
AppLoadingSpinner,
@@ -216,7 +217,8 @@ const LoaderMap = {
216217
glb: GLTFLoader,
217218
stl: STLLoader,
218219
fbx: FBXLoader,
219-
obj: OBJLoader
220+
obj: OBJLoader,
221+
ply: PLYLoader
220222
}
221223
222224
const materialParams = {
@@ -250,7 +252,7 @@ async function renderModel(extension: string) {
250252
}
251253
252254
const box = new Box3()
253-
if (!model.hasOwnProperty('scene') && extension === 'stl') {
255+
if (!model.hasOwnProperty('scene') && ['stl', 'ply'].includes(extension)) {
254256
const mesh = new Mesh(model, defaultMaterial())
255257
scene.add(mesh)
256258
box.setFromBufferAttribute(model.attributes.position)

src/mimeTypes.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ export const mimeTypes = {
22
fbx: 'application/octet-stream',
33
stl: 'application/vnd.ms-pki.stl',
44
obj: 'application/x-tgif',
5-
glb: 'model/gltf-binary'
5+
glb: 'model/gltf-binary',
6+
ply: 'application/octet-stream'
67
// gltf: 'model/gltf+json'
78
}
89

0 commit comments

Comments
 (0)