Skip to content

Commit f54069c

Browse files
authored
Merge pull request #7287 from davepagurek/model-perf
Performance improvements for WebGL shape drawing
2 parents 98d8394 + 2b76432 commit f54069c

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

src/webgl/loading.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -474,6 +474,7 @@ p5.prototype.loadModel = function(path,options) {
474474
if (flipV) {
475475
model.flipV();
476476
}
477+
model._makeTriangleEdges();
477478

478479
self._decrementPreload();
479480
if (typeof successCallback === 'function') {
@@ -1117,11 +1118,6 @@ p5.prototype.model = function(model) {
11171118
p5._validateParameters('model', arguments);
11181119
if (model.vertices.length > 0) {
11191120
if (!this._renderer.geometryInHash(model.gid)) {
1120-
1121-
if (model.edges.length === 0) {
1122-
model._makeTriangleEdges();
1123-
}
1124-
11251121
model._edgesToVertices();
11261122
this._renderer.createBuffers(model.gid, model);
11271123
}
@@ -1293,6 +1289,8 @@ p5.prototype.createModel = function(modelString, fileType=' ', options) {
12931289
model.flipV();
12941290
}
12951291

1292+
model._makeTriangleEdges();
1293+
12961294
if (typeof successCallback === 'function') {
12971295
successCallback(model);
12981296
}
@@ -1301,4 +1299,4 @@ p5.prototype.createModel = function(modelString, fileType=' ', options) {
13011299
};
13021300

13031301

1304-
export default p5;
1302+
export default p5;

src/webgl/p5.RendererGL.Immediate.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ p5.RendererGL.prototype.endShape = function(
214214
if (this.immediateMode.geometry.vertices.length === 3 &&
215215
this.immediateMode.shapeMode === constants.TESS
216216
) {
217-
this.immediateMode.shapeMode === constants.TRIANGLES;
217+
this.immediateMode.shapeMode = constants.TRIANGLES;
218218
}
219219

220220
this.isProcessingVertices = true;

0 commit comments

Comments
 (0)