Published
Edited
May 2, 2019
1 fork
Insert cell
Insert cell
Insert cell
{
var geometry = new THREE.BufferGeometry();
var vertices = new Float32Array( [
0, 0, 0,
0, 1, 0,
1, 1, 0,
0, 0, 0,
1, 0, 0,
1, 0, 1,
]);
geometry.addAttribute( 'position', new THREE.BufferAttribute( vertices, 3 ) );
// We now use a shader material so that we can add shaders
var material = new THREE.ShaderMaterial( {
color: 0xff0000, // red! (even though we set it to red here, it should be green as our fragment shader is making it green)
side: THREE.DoubleSide, // double sided as otherwise it might not show up if you are looking from the wrong side.
} );
window.geometry = geometry;
const mesh = new THREE.Mesh( geometry, material );
return renderMesh(mesh)
}
Insert cell
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