Skip to content

3D renderer only has a 2D implementation of quad #3328

@unjust

Description

@unjust

Trying to pass z coordinates to quad for 3d rendering doesn't work, there is no implementation for 12 args (which would contain z)

p5.RendererGL.prototype.quad = function(x1, y1, x2, y2, x3, y3, x4, y4) {
var gId =
'quad|' +
x1 +
'|' +
y1 +
'|' +
x2 +
'|' +
y2 +
'|' +
x3 +
'|' +
y3 +
'|' +
x4 +
'|' +
y4;
if (!this.geometryInHash(gId)) {
var _quad = function() {
this.vertices.push(new p5.Vector(x1, y1, 0));
this.vertices.push(new p5.Vector(x2, y2, 0));
this.vertices.push(new p5.Vector(x3, y3, 0));
this.vertices.push(new p5.Vector(x4, y4, 0));
this.uvs.push(0, 0, 1, 0, 1, 1, 0, 1);
this.strokeIndices = [[0, 1], [1, 2], [2, 3], [3, 0]];
};
var quadGeom = new p5.Geometry(2, 2, _quad);
quadGeom
.computeNormals()
._makeTriangleEdges()
._edgesToVertices();
quadGeom.faces = [[0, 1, 2], [2, 3, 0]];
this.createBuffers(gId, quadGeom);
}
this.drawBuffers(gId);
return this;
};

Originally posted by @meiamsome in https://github.com/_render_node/MDExOlB1bGxSZXF1ZXN0MjMyMDgxNzM4/pull_requests/unread_timeline#issuecomment-440012991

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions