start on drill mesh changes
This commit is contained in:
parent
b8ea098a11
commit
b95b58dd7e
1 changed files with 15 additions and 9 deletions
|
|
@ -7,6 +7,9 @@ import { lastTrace, setLastTrace } from './cl-trace.js';
|
||||||
|
|
||||||
export let holeSelOn = false;
|
export let holeSelOn = false;
|
||||||
export let lastSelHoles;
|
export let lastSelHoles;
|
||||||
|
let holeGeo = new THREE.CylinderGeometry(diam/2,diam/2,depth,20);
|
||||||
|
let holeMaterial = new THREE.MeshPhongMaterial( { color } );
|
||||||
|
let holeMesh;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Client side function to select holes in widgets for CAM operations.
|
* Client side function to select holes in widgets for CAM operations.
|
||||||
|
|
@ -36,12 +39,17 @@ export async function selectHoles(individual) {
|
||||||
* @param {Object} drill - {depth,selected} object of the hole
|
* @param {Object} drill - {depth,selected} object of the hole
|
||||||
* @returns {Mesh} the created mesh
|
* @returns {Mesh} the created mesh
|
||||||
*/
|
*/
|
||||||
function createHoleMesh(widget, drill) {
|
function createHoleMesh(widget,drills){
|
||||||
let { depth, selected, diam } = drill
|
if(holeMesh) holeMesh.dispose()
|
||||||
let color = selected ? 0xFF0000 : 0x39e366
|
holeMesh = new THREE.instancedMesh(holeGeo, holeMaterial,drills.length);
|
||||||
let geo = new THREE.CylinderGeometry(diam / 2, diam / 2, depth, 20);
|
|
||||||
const material = new THREE.MeshPhongMaterial({ color });
|
|
||||||
let mesh = new THREE.Mesh(geo, material);
|
for(let drill of drills){
|
||||||
|
let { depth, selected, diam } = drill
|
||||||
|
let color = selected ? 0xFF0000 : 0x39e366
|
||||||
|
let mx = new THREE.Matrix4();
|
||||||
|
}
|
||||||
|
|
||||||
mesh.position.copy(drill)
|
mesh.position.copy(drill)
|
||||||
mesh.position.z -= depth / 2
|
mesh.position.z -= depth / 2
|
||||||
mesh.rotation.x = Math.PI / 2
|
mesh.rotation.x = Math.PI / 2
|
||||||
|
|
@ -71,9 +79,7 @@ export async function selectHoles(individual) {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
drills.forEach(drill => {
|
createHoleMesh(widget, drills);
|
||||||
createHoleMesh(widget, drill);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue