feature (3d): handle mesh files

This commit is contained in:
MickaelK 2025-04-29 13:42:41 +10:00
parent aed0f414c8
commit 73bab4a2e3
4 changed files with 28 additions and 0 deletions

View file

@ -100,6 +100,7 @@
"md": "text/markdown",
"mdc": "image/x-minolta-mdc",
"mef": "image/x-mamiya-mef",
"mesh": "model/mesh",
"mid": "audio/midi",
"midi": "application/x-midi",
"mjs": "application/javascript",

View file

@ -4,3 +4,7 @@ all:
install:
zip -r application_3d.zip .
mv application_3d.zip ../../../dist/data/state/plugins/application_3d.zip
deps_mesh:
[ -d vendor ] || mkdir vendor
curl https://gist.githubusercontent.com/mickael-kerjean/9a517f95112410fcacaad8563c1ba314/raw/ab483b38aebb7048832aad7b342f9161dd928e49/gistfile1.txt > vendor/MeshLoader.js

View file

@ -0,0 +1,17 @@
export default async function(I3D, { THREE }) {
const module = await import("./vendor/MeshLoader.js");
return class Impl extends I3D {
constructor() {
super();
}
load(url, onLoad, onProgress, onError) {
return (new module.MeshLoader()).load(url, onLoad, onProgress, onError);
}
transform(obj) {
return obj;
}
}
}

View file

@ -37,6 +37,12 @@
"mime": "model/step",
"entrypoint": "/index_step.js",
"application": "3d"
},
{
"type": "xdg-open",
"mime": "model/mesh",
"entrypoint": "/index_mesh.js",
"application": "3d"
}
]
}