From a852b97060727428b8be55717b9dca4149f4368a Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Tue, 29 Jan 2019 20:39:26 +0100 Subject: add modal --- client/splash/face/markers.js | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'client/splash/face/markers.js') diff --git a/client/splash/face/markers.js b/client/splash/face/markers.js index 20a96fb6..354ed68c 100644 --- a/client/splash/face/markers.js +++ b/client/splash/face/markers.js @@ -42,7 +42,11 @@ export function build(points) { quaternion.setFromEuler(rotation, false) matrix.compose(position.clone(), quaternion, boxScale) geometry.applyMatrix(matrix) - let material = new THREE.MeshBasicMaterial({ color: boxColor }) + let material = new THREE.MeshBasicMaterial({ + color: boxColor, + opacity: 1, + transparent: true, + }) let cube = new THREE.Mesh(geometry, material) group.add(cube) return cube @@ -52,6 +56,9 @@ export function build(points) { const color = new THREE.Color() const material = new MeshLineMaterial({ color: color.setHex(MARKER_COLORS[i % MARKER_COLORS.length]), + alphaTest: 0.01, + opacity: 1.0, + transparent: true, }) const line = new MeshLine() line.setGeometry(geometry, () => LINE_THICKNESS) @@ -60,13 +67,23 @@ export function build(points) { group.add(mesh) return [line, mesh] }) - + window.meshes = meshes group.frustumCulled = false scene.add(group) updateFace(scaledPoints, cubes, meshes) } +export function fadePointsTo(opacity) { + cubes.forEach(cube => cube.material.opacity = opacity) +} +export function fadeLinesTo(opacity) { + meshes.forEach((pair) => { + pair[1].material.uniforms.visibility.value = opacity + pair[1].material.uniformsNeedUpdate = true + }) +} + function scalePoints(points) { const bbox = getBboxForPoints(points) let { scale, midX, midY, midZ } = getBboxScaleAndCentroid(bbox) -- cgit v1.2.3-70-g09d2