Skip to content

Commit

Permalink
made the nesscary changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Gaurav-1306 committed Oct 2, 2023
1 parent ba54027 commit 617e16e
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/webgl/p5.RendererGL.Immediate.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,16 +201,19 @@ p5.RendererGL.prototype.endShape = function(
);
return this;
}
// When we are drawing a shape then the shape mode is TESS,
// but in case of triangle we can skip the breaking into small triangle
// this can optimize performance by skipping the step of breaking it into triangles
if (this.immediateMode.geometry.vertices.length === 3 &&
this.immediateMode.shapeMode === constants.TESS
) {
this.immediateMode.shapeMode === constants.TRIANGLES;
}

this.isProcessingVertices = true;
this._processVertices(...arguments);
this.isProcessingVertices = false;

// Check the number of vertices and if equal to 3
// Change the shapemode to traingle
if (this.immediateMode.geometry.vertices.length === 3) {
this.immediateMode.shapeMode === constants.TRIANGLES;
}

// LINE_STRIP and LINES are not used for rendering, instead
// they only indicate a way to modify vertices during the _processVertices() step
if (
Expand Down

0 comments on commit 617e16e

Please sign in to comment.