From 7d80ed29040ccf189c3dccead3b57598e86fa11d Mon Sep 17 00:00:00 2001 From: Stewart Allen Date: Fri, 14 Jan 2022 14:30:07 -0500 Subject: [PATCH] stub in menu for normals inversion --- src/mesh/api.js | 6 ++++++ src/mesh/build.js | 1 + src/mesh/model.js | 12 ++++++++++++ 3 files changed, 19 insertions(+) diff --git a/src/mesh/api.js b/src/mesh/api.js index 8a85f20a..ef571edf 100644 --- a/src/mesh/api.js +++ b/src/mesh/api.js @@ -313,6 +313,12 @@ let tool = { } }, + invert() { + for (let m of selection.models(true)) { + m.invert(api.mode.get()); + } + }, + analyze(models) { models = fallback(models); api.log.emit('analyzing mesh(es)...').pin(); diff --git a/src/mesh/build.js b/src/mesh/build.js index cf986615..77b6ca12 100644 --- a/src/mesh/build.js +++ b/src/mesh/build.js @@ -242,6 +242,7 @@ function ui_build() { h.div({ class: "vsep" }), h.button({ _: 'duplicate', onclick: tool.duplicate }), h.button({ _: 'merge', onclick: tool.merge }), + h.button({ _: 'invert', onclick: tool.invert }), h.div({ class: "vsep" }), h.button({ _: 'analyze', onclick: tool.analyze }), h.button({ _: 'repair', onclick: tool.repair }), diff --git a/src/mesh/model.js b/src/mesh/model.js index b348ad34..51561e79 100644 --- a/src/mesh/model.js +++ b/src/mesh/model.js @@ -303,6 +303,18 @@ mesh.model = class MeshModel extends mesh.object { } } + // invert normals for entire mesh or selected faces depending on mod + invert(mode) { + let { modes } = mesh.api; + switch (mode) { + case modes.object: + break; + case modes.face: + break; + } + } + + // remove model from group and space remove() { if (arguments.length === 0) { // direct call requires pass through group