Public
Edited
May 1, 2023
1 fork
Importers
Insert cell
Insert cell
Insert cell
md`Usage:
*import {loadModelFromURL} from "@spattana/model-loaders-using-threejs" *
*loadModelFromURL(model_URL_name, model_type)*
Any model URL can be fetched in Javascript via *fetch URL_name* can be used. If it can not be fetched then you may download the model to your local folder and attach it to your notebook page. 
Once attached you may use statement *FileAttachment(attached_filename).url()* to get the local URL for the attached file and use.
model_type can be: "collada", "obj", "stl", "gltf", or "tds"
`
Insert cell
Insert cell
loadModelFromURL(rayman_url, "obj")
Insert cell
Insert cell
cameraSCs = createSCs(cameraObject)
Insert cell
cameraObject = loadObjObject(camera_url)
Insert cell
camera_url = await FileAttachment("video_camera.obj").url()
Insert cell
flamingoObject = loadGLTFobject(Flamingo_url);
Insert cell
Flamingo_url = await FileAttachment("Flamingo.glb").url()
Insert cell
Insert cell
Insert cell
Insert cell
elfSCs = createSCs(elfObject )
Insert cell
Insert cell
elf_url = "https://raw.githubusercontent.com/mrdoob/three.js/dev/examples/models/collada/elf/elf.dae"
Insert cell
arterySCs = createSCs(arteryObject)
Insert cell
arteryObject = loadSTLobject(artery_url)
Insert cell
artery_url = await FileAttachment("artery-model2.stl").url()
Insert cell
Insert cell
loadTDSObject = (url)=> loadObject(url, new THREE.TDSLoader())
Insert cell
Insert cell
mtls = loadMaterial(await FileAttachment("rayman_2_mdl.mtl").url())
Insert cell
loadObjObject(await FileAttachment("rayman_2_mdl.obj").url())
Insert cell
Insert cell
Insert cell
Insert cell
loadGLTFobject = (url)=> loadObject(url, new THREE.GLTFLoader())
Insert cell
ModelSupported = ({
collada: loadCOLLADAobject,
obj: loadObjObject,
stl: loadSTLobject,
gltf: loadGLTFobject,
tds: loadTDSObject
})
Insert cell
Insert cell
//computeMatrix(arteryObject)
Insert cell
Insert cell
Insert cell
Insert cell
test = computeModelExtent(raymanSCs)
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more