From d8ff4ff13203e68c578aebbf9605003d3ac5dc68 Mon Sep 17 00:00:00 2001 From: Nisha Date: Fri, 20 Oct 2023 23:17:06 +0530 Subject: [PATCH 1/2] new PR for issue #6383 --- src/webgl/3d_primitives.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/webgl/3d_primitives.js b/src/webgl/3d_primitives.js index 39d7509461..997433c83c 100644 --- a/src/webgl/3d_primitives.js +++ b/src/webgl/3d_primitives.js @@ -1573,10 +1573,15 @@ p5.RendererGL.prototype.quad = function(x1, y1, z1, x2, y2, z2, x3, y3, z3, x4, quadGeom.faces.push([pt0, pt2, pt3]); } } - quadGeom - .computeNormals() - ._makeTriangleEdges() - ._edgesToVertices(); + quadGeom.computeNormals() + quadGeom.edges.length = 0; + const vertexOrder = [0, 2, 3, 1]; + for (let i = 0; i < vertexOrder.length; i++) { + const startVertex = vertexOrder[i]; + const endVertex = vertexOrder[(i + 1) % vertexOrder.length]; + quadGeom.edges.push([startVertex, endVertex]); + } + quadGeom._edgesToVertices(); this.createBuffers(gId, quadGeom); } this.drawBuffers(gId); From dd2d3a062266e2fb5b4cbfeb09c8aa27277a8c1a Mon Sep 17 00:00:00 2001 From: Dave Pagurek Date: Fri, 20 Oct 2023 14:51:23 -0400 Subject: [PATCH 2/2] Update src/webgl/3d_primitives.js --- src/webgl/3d_primitives.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/webgl/3d_primitives.js b/src/webgl/3d_primitives.js index 997433c83c..376231c5ab 100644 --- a/src/webgl/3d_primitives.js +++ b/src/webgl/3d_primitives.js @@ -1573,7 +1573,7 @@ p5.RendererGL.prototype.quad = function(x1, y1, z1, x2, y2, z2, x3, y3, z3, x4, quadGeom.faces.push([pt0, pt2, pt3]); } } - quadGeom.computeNormals() + quadGeom.computeNormals(); quadGeom.edges.length = 0; const vertexOrder = [0, 2, 3, 1]; for (let i = 0; i < vertexOrder.length; i++) {