add orthographic display preference. fixes #31

This commit is contained in:
Stewart Allen 2021-03-04 13:22:53 -05:00
commit 3edf74f027
5 changed files with 30 additions and 13 deletions

View file

@ -7,8 +7,8 @@
* `P` duplicate objects should share same slice data unless rotated or scaled * `P` duplicate objects should share same slice data unless rotated or scaled
* `P` allow selection to me decimated on demand (context menu?) * `P` allow selection to me decimated on demand (context menu?)
* `P` improve decimation speed: omit point conversion or use wasm * `P` improve decimation speed: omit point conversion or use wasm
* `P` client/worker interface normalization * `P` client/worker message interface normalization
* `P` explore widget vertex reloading / replacing (Onshape primarily) * `P` explore widget vertex reloading / replacing (Onshape) (issue #48)
* `F` show slider range values in workspace units (on hover?) * `F` show slider range values in workspace units (on hover?)
* `F` allow select of a range by typing in values in slices or workspace units * `F` allow select of a range by typing in values in slices or workspace units
@ -73,6 +73,7 @@
* `B` climb vs conventional not fully consistent after refactor * `B` climb vs conventional not fully consistent after refactor
* `B` outside cutting direction in roughing mode inverted * `B` outside cutting direction in roughing mode inverted
* `F` user-selectable origin (issue #28)
* `F` import SVG into a path that can be overlaid onto a 3D mesh (laser?) * `F` import SVG into a path that can be overlaid onto a 3D mesh (laser?)
* `F` intelligently turn circle hole pocket clear into spiral down * `F` intelligently turn circle hole pocket clear into spiral down
* `F` trace follow hole that matches endmill should turn into a drill op * `F` trace follow hole that matches endmill should turn into a drill op
@ -97,7 +98,6 @@
* `F` support lathe mode / A-axis / rotary * `F` support lathe mode / A-axis / rotary
* `F` gcode output option as zip for multiple or flip ops or tool change * `F` gcode output option as zip for multiple or flip ops or tool change
* `F` ease-down should be engaged in all descending cutting operations * `F` ease-down should be engaged in all descending cutting operations
* `F` entirely user-selectable origin
* `F` maintain several part orientations + op chains in a single profile * `F` maintain several part orientations + op chains in a single profile
* `P` common part pre-analyze to speed up 'slice' and improve shadow (overhangs) * `P` common part pre-analyze to speed up 'slice' and improve shadow (overhangs)

View file

@ -658,7 +658,8 @@
decimate: true, decimate: true,
detail: "good", detail: "good",
animesh: "200", animesh: "200",
healMesh: false healMesh: false,
ortho: false
}, },
// label state preferences // label state preferences
labels: { labels: {

View file

@ -138,6 +138,7 @@
function booleanSave() { function booleanSave() {
let control = settings().controller; let control = settings().controller;
let isDark = control.dark; let isDark = control.dark;
let doAlert = UI.ortho.checked !== control.ortho;
control.decals = UI.decals.checked; control.decals = UI.decals.checked;
control.danger = UI.danger.checked; control.danger = UI.danger.checked;
control.showOrigin = UI.showOrigin.checked; control.showOrigin = UI.showOrigin.checked;
@ -153,6 +154,7 @@
control.exportPreview = UI.exportPreview.checked; control.exportPreview = UI.exportPreview.checked;
control.decimate = UI.decimate.checked; control.decimate = UI.decimate.checked;
control.healMesh = UI.healMesh.checked; control.healMesh = UI.healMesh.checked;
control.ortho = UI.ortho.checked;
SPACE.view.setZoom(control.reverseZoom, control.zoomSpeed); SPACE.view.setZoom(control.reverseZoom, control.zoomSpeed);
// platform.layout(); // platform.layout();
API.conf.save(); API.conf.save();
@ -168,6 +170,9 @@
clearDeviceTexture(); clearDeviceTexture();
} }
API.event.emit('boolean.update'); API.event.emit('boolean.update');
if (doAlert) {
API.show.alert("change requires page refresh");
}
} }
function updateFPS() { function updateFPS() {
@ -1396,7 +1401,7 @@
SPACE.setSkyColor(controller.dark ? 0 : 0xffffff); SPACE.setSkyColor(controller.dark ? 0 : 0xffffff);
SPACE.init(container, function (delta) { SPACE.init(container, function (delta) {
if (API.var.layer_max === 0 || !delta) return; if (API.var.layer_max === 0 || !delta) return;
if (settings().controller.reverseZoom) delta = -delta; if (controller.reverseZoom) delta = -delta;
let same = API.var.layer_hi === API.var.layer_lo; let same = API.var.layer_hi === API.var.layer_lo;
let track = API.var.layer_lo > 0; let track = API.var.layer_lo > 0;
if (delta > 0) { if (delta > 0) {
@ -1415,7 +1420,7 @@
} }
API.view.update_slider(); API.view.update_slider();
API.show.slices(); API.show.slices();
}); }, controller.ortho);
SPACE.platform.onMove(API.conf.save); SPACE.platform.onMove(API.conf.save);
SPACE.platform.setRound(true); SPACE.platform.setRound(true);
SPACE.useDefaultKeys(API.feature.on_key === undefined || API.feature.on_key_defaults); SPACE.useDefaultKeys(API.feature.on_key === undefined || API.feature.on_key_defaults);
@ -1585,6 +1590,7 @@
lprefs: UC.newGroup(LANG.op_menu, $('prefs-gen1'), {inline: true}), lprefs: UC.newGroup(LANG.op_menu, $('prefs-gen1'), {inline: true}),
reverseZoom: UC.newBoolean(LANG.op_invr_s, booleanSave, {title:LANG.op_invr_l}), reverseZoom: UC.newBoolean(LANG.op_invr_s, booleanSave, {title:LANG.op_invr_l}),
ortho: UC.newBoolean(LANG.op_orth_s, booleanSave, {title:LANG.op_orth_l}),
dark: UC.newBoolean(LANG.op_dark_s, booleanSave, {title:LANG.op_dark_l}), dark: UC.newBoolean(LANG.op_dark_s, booleanSave, {title:LANG.op_dark_l}),
decals: UC.newBoolean(LANG.op_decl_s, booleanSave, {title:LANG.op_decl_s}), decals: UC.newBoolean(LANG.op_decl_s, booleanSave, {title:LANG.op_decl_s}),
danger: UC.newBoolean(LANG.op_dang_s, booleanSave, {title:LANG.op_dang_l}), danger: UC.newBoolean(LANG.op_dang_s, booleanSave, {title:LANG.op_dang_l}),
@ -2356,6 +2362,7 @@
UI.autoSave.checked = control.autoSave; UI.autoSave.checked = control.autoSave;
UI.decimate.checked = control.decimate; UI.decimate.checked = control.decimate;
UI.healMesh.checked = control.healMesh; UI.healMesh.checked = control.healMesh;
UI.ortho.checked = control.ortho;
lineTypeSave(); lineTypeSave();
detailSave(); detailSave();
updateFPS(); updateFPS();

View file

@ -97,6 +97,7 @@
camera, camera,
renderer, renderer,
container, container,
raycaster,
freezeTo, freezeTo,
freeze, freeze,
isRound = false, isRound = false,
@ -699,9 +700,7 @@
} }
function intersect(objects, recurse) { function intersect(objects, recurse) {
let lookAt = new THREE.Vector3(mouse.x, mouse.y, 0.0).unproject(camera); return raycaster.intersectObjects(objects, recurse);
let ray = new THREE.Raycaster(camera.position, lookAt.sub(camera.position).normalize());
return ray.intersectObjects(objects, recurse);
} }
/** ****************************************************************** /** ******************************************************************
@ -809,6 +808,11 @@
updateLastAction(); updateLastAction();
let int, vis; let int, vis;
const mv = new THREE.Vector2();
mv.x = ( event.clientX / window.innerWidth ) * 2 - 1;
mv.y = - ( event.clientY / window.innerHeight ) * 2 + 1;
raycaster.setFromCamera( mv, camera );
if (viewControl.enabled) { if (viewControl.enabled) {
event.preventDefault(); event.preventDefault();
let selection = mouseHover ? mouseHover() : null; let selection = mouseHover ? mouseHover() : null;
@ -854,6 +858,7 @@
onEnterKey: onEnterKey, onEnterKey: onEnterKey,
onResize: onResize, onResize: onResize,
update: requestRefresh, update: requestRefresh,
raycast: intersect,
refresh: refresh, refresh: refresh,
showSkyGrid: function(b) { showSkyGrid: function(b) {
@ -1025,7 +1030,7 @@
return { renderer, camera, platform }; return { renderer, camera, platform };
}, },
init: function(domelement, slider) { init: function(domelement, slider, ortho) {
container = domelement; container = domelement;
WORLD.rotation.x = -PI2; WORLD.rotation.x = -PI2;
@ -1038,14 +1043,16 @@
antialias: true, antialias: true,
preserveDrawingBuffer: true preserveDrawingBuffer: true
}); });
camera = perspective ? camera = ortho ?
new THREE.PerspectiveCamera(perspective, aspect(), 5, 100000) : new THREE.OrthographicCamera(-100 * aspect(), 100 * aspect(), 100, -100, 0.1, 100000) :
new THREE.OrthographicCamera(-100 * aspect(), 100 * aspect(), 100, -100, 0.1, 100000); new THREE.PerspectiveCamera(perspective, aspect(), 5, 100000);
camera.position.set(0, 200, 340); camera.position.set(0, 200, 340);
renderer.setSize(width(), height()); renderer.setSize(width(), height());
domelement.appendChild(renderer.domElement); domelement.appendChild(renderer.domElement);
raycaster = new THREE.Raycaster();
viewControl = new MOTO.CTRL(camera, domelement, function (position, moved) { viewControl = new MOTO.CTRL(camera, domelement, function (position, moved) {
if (platform) { if (platform) {
platform.visible = hidePlatformBelow ? platform.visible = hidePlatformBelow ?

View file

@ -213,6 +213,8 @@ kiri.lang['en-us'] = {
op_free_l: ["permit dragable layout","no effect in laser mode"], op_free_l: ["permit dragable layout","no effect in laser mode"],
op_spcr_s: "spacing", op_spcr_s: "spacing",
op_spcr_l: ["spacing between objects","during auto layout","in workspace units"], op_spcr_l: ["spacing between objects","during auto layout","in workspace units"],
op_orth_s: "orthographic",
op_orth_l: ["orthographic display","requires page refresh"],
op_invr_s: "invert zoom", op_invr_s: "invert zoom",
op_invr_l: ["invert mouse wheel","scroll zoom"], op_invr_l: ["invert mouse wheel","scroll zoom"],
op_save_s: "auto save", op_save_s: "auto save",