From 57cbb70c63de5b924c0e4eec393a9461c96ae822 Mon Sep 17 00:00:00 2001 From: lindsay Date: Wed, 2 Aug 2023 18:33:09 +0200 Subject: [PATCH] Fixed VBOSceneModel "triangles" default primitive type --- .../scene/models/VBOSceneModel/VBOSceneModel.js | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/viewer/scene/models/VBOSceneModel/VBOSceneModel.js b/src/viewer/scene/models/VBOSceneModel/VBOSceneModel.js index cd1ae2fbcd..f64288e905 100644 --- a/src/viewer/scene/models/VBOSceneModel/VBOSceneModel.js +++ b/src/viewer/scene/models/VBOSceneModel/VBOSceneModel.js @@ -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; } @@ -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);