fix cam index stock toggle, add path toggle
This commit is contained in:
parent
9be915071c
commit
0d10fb7dfc
3 changed files with 33 additions and 6 deletions
|
|
@ -39,7 +39,7 @@ export function init(worker) {
|
||||||
const print = worker.current.print;
|
const print = worker.current.print;
|
||||||
const density = parseInt(settings.controller.animesh) * 1000;
|
const density = parseInt(settings.controller.animesh) * 1000;
|
||||||
const isIndexed = process.camStockIndexed;
|
const isIndexed = process.camStockIndexed;
|
||||||
console.log({ controller });
|
|
||||||
pathIndex = 0;
|
pathIndex = 0;
|
||||||
path = print.output.flat();
|
path = print.output.flat();
|
||||||
tools = settings.tools;
|
tools = settings.tools;
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ let meshes = {},
|
||||||
origin,
|
origin,
|
||||||
color = 0,
|
color = 0,
|
||||||
dark = false,
|
dark = false,
|
||||||
|
manifold = false,
|
||||||
A2R = Math.PI / 180;
|
A2R = Math.PI / 180;
|
||||||
|
|
||||||
export function animate_clear2(api) {
|
export function animate_clear2(api) {
|
||||||
|
|
@ -37,6 +38,7 @@ export function animate2(api, delay) {
|
||||||
let alert = api.alerts.show("building animation");
|
let alert = api.alerts.show("building animation");
|
||||||
let settings = api.conf.get();
|
let settings = api.conf.get();
|
||||||
dark = settings.controller.dark;
|
dark = settings.controller.dark;
|
||||||
|
manifold = settings.controller.manifold;
|
||||||
client.animate_setup2(settings, data => {
|
client.animate_setup2(settings, data => {
|
||||||
handleUpdate(data);
|
handleUpdate(data);
|
||||||
if (data) {
|
if (data) {
|
||||||
|
|
@ -52,7 +54,8 @@ export function animate2(api, delay) {
|
||||||
speed: anim.speed,
|
speed: anim.speed,
|
||||||
trans: anim.trans,
|
trans: anim.trans,
|
||||||
model: anim.model,
|
model: anim.model,
|
||||||
shade: anim.shade
|
shade: anim.shade,
|
||||||
|
path: anim.path
|
||||||
});
|
});
|
||||||
Object.assign(label, {
|
Object.assign(label, {
|
||||||
progress: anim.progress,
|
progress: anim.progress,
|
||||||
|
|
@ -63,6 +66,14 @@ export function animate2(api, delay) {
|
||||||
a: anim.vala
|
a: anim.vala
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (manifold) {
|
||||||
|
anim.trans.classList.remove('hide');
|
||||||
|
// anim.shade.classList.remove('hide');
|
||||||
|
} else {
|
||||||
|
anim.trans.classList.add('hide');
|
||||||
|
// anim.shade.classList.add('hide');
|
||||||
|
}
|
||||||
|
|
||||||
updateSpeed(0);
|
updateSpeed(0);
|
||||||
setTimeout(step, delay || 0);
|
setTimeout(step, delay || 0);
|
||||||
toggleTrans(undefined, false);
|
toggleTrans(undefined, false);
|
||||||
|
|
@ -76,6 +87,7 @@ export function animate2(api, delay) {
|
||||||
button.trans.onclick = toggleTrans;
|
button.trans.onclick = toggleTrans;
|
||||||
button.model.onclick = toggleModel;
|
button.model.onclick = toggleModel;
|
||||||
button.shade.onclick = toggleStock;
|
button.shade.onclick = toggleStock;
|
||||||
|
button.path.onclick = togglePath;
|
||||||
button.play.style.display = '';
|
button.play.style.display = '';
|
||||||
button.pause.style.display = 'none';
|
button.pause.style.display = 'none';
|
||||||
|
|
||||||
|
|
@ -119,7 +131,8 @@ function initPathMesh() {
|
||||||
pos = new Float32Array(max * 6),
|
pos = new Float32Array(max * 6),
|
||||||
lines = new THREE.LineSegments(geo, mat),
|
lines = new THREE.LineSegments(geo, mat),
|
||||||
vec = new THREE.Vector3(0,0,0),
|
vec = new THREE.Vector3(0,0,0),
|
||||||
ang = new THREE.Vector3(1,0,0);
|
ang = new THREE.Vector3(1,0,0),
|
||||||
|
show = api.local.get('cam.anim.path') ?? true;
|
||||||
geo.setAttribute('position', new THREE.BufferAttribute(pos, 3));
|
geo.setAttribute('position', new THREE.BufferAttribute(pos, 3));
|
||||||
let track = lineTracker = {
|
let track = lineTracker = {
|
||||||
xro(p) {
|
xro(p) {
|
||||||
|
|
@ -159,9 +172,15 @@ function initPathMesh() {
|
||||||
lines.setRotationFromEuler(rot);
|
lines.setRotationFromEuler(rot);
|
||||||
},
|
},
|
||||||
visible(bool) {
|
visible(bool) {
|
||||||
if (bool !== lines.visible) {
|
if (show && bool !== lines.visible) {
|
||||||
lines.visible = bool;
|
lines.visible = bool;
|
||||||
|
} else if (!show) {
|
||||||
|
lines.visible = false;
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
show(bool) {
|
||||||
|
show = bool;
|
||||||
|
lines.visible = bool;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
space.world.add(lines);
|
space.world.add(lines);
|
||||||
|
|
@ -207,8 +226,15 @@ function toggleModel(ev, bool) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function toggleStock(ev, bool, set) {
|
function toggleStock(ev, bool, set) {
|
||||||
set !== false && api.local.toggle('cam.anim.stock', bool);
|
bool = api.local.toggle('cam.anim.stock', bool);
|
||||||
return api.event.emit('cam.stock.toggle', bool ?? undefined);
|
for (let [ id, mesh ] of Object.entries(meshes)) {
|
||||||
|
if (id >= 0) mesh.visible = bool;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function togglePath(ev, bool, set) {
|
||||||
|
bool = api.local.toggle('cam.anim.path', bool);
|
||||||
|
lineTracker?.show(bool);
|
||||||
}
|
}
|
||||||
|
|
||||||
function toggleTrans(ev, bool) {
|
function toggleTrans(ev, bool) {
|
||||||
|
|
|
||||||
|
|
@ -58,6 +58,7 @@ export function menu() {
|
||||||
anim.trans = newButton(null,null,{icon:'<i class="fa-solid fa-border-none"></i>',title:"transparency",class:"padleft"}),
|
anim.trans = newButton(null,null,{icon:'<i class="fa-solid fa-border-none"></i>',title:"transparency",class:"padleft"}),
|
||||||
anim.model = newButton(null,null,{icon:'<i class="fa-solid fa-eye"></i>',title:"show model"}),
|
anim.model = newButton(null,null,{icon:'<i class="fa-solid fa-eye"></i>',title:"show model"}),
|
||||||
anim.shade = newButton(null,null,{icon:'<i class="fa-solid fa-cube"></i>',title:"stock box"}),
|
anim.shade = newButton(null,null,{icon:'<i class="fa-solid fa-cube"></i>',title:"stock box"}),
|
||||||
|
anim.path = newButton(null,null,{icon:'<i class="fa-solid fa-draw-polygon"></i>',title:"path"}),
|
||||||
])
|
])
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue