Skip to content

Commit

Permalink
add ply support
Browse files Browse the repository at this point in the history
  • Loading branch information
amrita-shrestha committed Nov 11, 2024
1 parent 5507203 commit 180729c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader'
import { STLLoader } from 'three/examples/jsm/loaders/STLLoader'
import { FBXLoader } from 'three/examples/jsm/loaders/FBXLoader'
import { OBJLoader } from 'three/examples/jsm/loaders/OBJLoader'
import { PLYLoader } from 'three/examples/jsm/loaders/PLYLoader'
import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls'
import {
AppLoadingSpinner,
Expand Down Expand Up @@ -216,7 +217,8 @@ const LoaderMap = {
glb: GLTFLoader,
stl: STLLoader,
fbx: FBXLoader,
obj: OBJLoader
obj: OBJLoader,
ply: PLYLoader
}
const materialParams = {
Expand Down Expand Up @@ -250,7 +252,7 @@ async function renderModel(extension: string) {
}
const box = new Box3()
if (!model.hasOwnProperty('scene') && extension === 'stl') {
if (!model.hasOwnProperty('scene') && (extension === 'stl' || extension === 'ply')) {
const mesh = new Mesh(model, defaultMaterial())
scene.add(mesh)
box.setFromBufferAttribute(model.attributes.position)
Expand Down
3 changes: 2 additions & 1 deletion src/mimeTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ export const mimeTypes = {
fbx: 'application/octet-stream',
stl: 'application/vnd.ms-pki.stl',
obj: 'application/x-tgif',
glb: 'model/gltf-binary'
glb: 'model/gltf-binary',
ply: 'application/octet-stream'
// gltf: 'model/gltf+json'
}

Expand Down

0 comments on commit 180729c

Please sign in to comment.