Configure single-DOF machine joints and drive them from WASM axes
This commit is contained in:
@@ -26,11 +26,12 @@ export function XyzacMachineView({ importedMachine, visual, toolpath, view = "p"
|
||||
useEffect(() => {
|
||||
const element = host.current;
|
||||
if (!element) return;
|
||||
const renderer = new THREE.WebGLRenderer({ antialias: true, alpha: false, preserveDrawingBuffer: true });
|
||||
const managedJoints = Boolean(importedMachine?.scene.userData.linuxcncJointModel);
|
||||
const renderer = new THREE.WebGLRenderer({ antialias: !managedJoints, alpha: false, preserveDrawingBuffer: !managedJoints });
|
||||
renderer.setPixelRatio(Math.min(globalThis.devicePixelRatio || 1, VIEWER.pixel_ratio_limit));
|
||||
renderer.toneMapping = THREE.ACESFilmicToneMapping;
|
||||
renderer.toneMappingExposure = 1;
|
||||
renderer.shadowMap.enabled = true;
|
||||
renderer.shadowMap.enabled = !managedJoints;
|
||||
renderer.shadowMap.type = THREE.PCFShadowMap;
|
||||
renderer.domElement.dataset.engine = "three.js r185 / xyzac-trt-vismach";
|
||||
element.appendChild(renderer.domElement);
|
||||
@@ -151,6 +152,11 @@ export function XyzacMachineView({ importedMachine, visual, toolpath, view = "p"
|
||||
const render = () => {
|
||||
const state = visualRef.current, config = settings.current;
|
||||
assembly.update(state);
|
||||
if (assembly.machine.userData.linuxcncJointState) {
|
||||
element.dataset.machineJointState = JSON.stringify(assembly.machine.userData.linuxcncJointState);
|
||||
element.dataset.machineJointTick = String(state.tick);
|
||||
element.dataset.machineJointInputs = JSON.stringify(state.joints);
|
||||
}
|
||||
const paths = (config.toolpath ?? state.toolpath) as Segment[];
|
||||
pathGroup.position.copy(assembly.workOrigin.position);
|
||||
liveGroup.position.copy(assembly.workOrigin.position);
|
||||
|
||||
Reference in New Issue
Block a user