xxxxxxxxxx
let m;
function setup() {
createCanvas(400, 400, WEBGL);
m = createModel();
}
function draw() {
background(100);
orbitControl(2, 1, 0.05);
model(m);
}
function createModel() {
return new p5.Geometry(
// detailX and detailY are not used in this example
1, 1,
// The callback must be an anonymous funciton, not an arrow function in
// order for "this" to be bound correctly.
function createGeometry() {
this.vertices.push(
new p5.Vector(-27, -56, 10),
new p5.Vector(33, -12, 5),
new p5.Vector(7, 46, 2)
);
this.faces.push([0, 1, 2]);
this.gid = 'my-example-geometry';
}
);
}