Public
Edited
Dec 28, 2024
Importers
30 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
// The object being shown at the moment
mutable obj = cube
Insert cell
function setObj (mesh) {
mutable obj = mesh;
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
mutable view = mat4.lookAt([],[0,0,5],[0,0,0],[0,1,0])
Insert cell
mutable projection = mat4.perspective ([], 45 * Math.PI/180, 1, 0.01, 100)
Insert cell
mutable model = mat4.identity([])
Insert cell
Insert cell
Insert cell
refresh = {
let triMesh = triangleMesh(obj,displayConfig.flatShading);
let drawFaces = makeTriMeshDraw(triMesh);
let drawEdges = makeMeshEdgeDraw(obj);
let scaleFactor = displayConfig.autoSize ? Math.sqrt(3)/obj.radius : 1;
return function (model,view,projection) {
regl.clear({
color: toWebGLColor(displayConfig.background).concat([1]),
depth: 1
})
let conf = {modelview: mat4.mul([],view,model), projection, scaleFactor};
drawFaces(conf);
if (displayConfig.showEdges) drawEdges(conf)
}
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
demoImg = [FileAttachment("demo1.png"), FileAttachment("demo2.png"), FileAttachment("demo3.png"), FileAttachment("demo4.png"),FileAttachment("demo5.png")]
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
import {tabbed,paged,combo} from "@esperanc/aggregated-inputs"
Insert cell
import {select,checkbox,button,slider, color} from "@jashkenas/inputs"
Insert cell
createRegl = require('regl@1.4.2/dist/regl.js')
Insert cell
regl = createRegl({gl:canvas.getContext('webgl', {
antialias: true,
preserveDrawingBuffer: true
})})

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