Skip to content

Commit

Permalink
Fixed VBOSceneModel "triangles" default primitive type
Browse files Browse the repository at this point in the history
  • Loading branch information
xeolabs committed Aug 2, 2023
1 parent 6674ba3 commit 57cbb70
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/viewer/scene/models/VBOSceneModel/VBOSceneModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -2050,12 +2050,8 @@ class VBOSceneModel extends Component {
this.error("Geometry already created: " + geometryId);
return;
}
const primitive = cfg.primitive;
if (primitive === undefined || primitive === null) {
this.error("Param expected: primitive");
return;
}
if (primitive !== "points" && primitive !== "lines" && primitive !== "triangles" && primitive !== "solid" && primitive !== "surface") {
cfg.primitive = cfg.primitive || "triangles";
if (cfg.primitive !== "points" && cfg.primitive !== "lines" && cfg.primitive !== "triangles" && cfg.primitive !== "solid" && cfg.primitive !== "surface") {
this.error(`Unsupported value for 'primitive': '${primitive}' - supported values are 'points', 'lines', 'triangles', 'solid' and 'surface'. Defaulting to 'triangles'.`);
return;
}
Expand All @@ -2071,8 +2067,8 @@ class VBOSceneModel extends Component {
this.error("Param expected: `uvDecodeMatrix` (required for `uvCompressed')");
return null;
}
if (!cfg.indices && primitive !== "points") {
this.error(`Param expected: indices (required for '${primitive}' primitive type)`);
if (!cfg.indices && cfg.primitive !== "points") {
this.error(`Param expected: indices (required for '${cfg.primitive}' primitive type)`);
return null;
}
const geometry = new VBOSceneModelGeometry(geometryId, this, cfg);
Expand Down

0 comments on commit 57cbb70

Please sign in to comment.