Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function setupCube ({center, fbo}, block) {
mat4.perspective(
cubeProps.projection,
Math.PI / 2.0,
1.0,
0.25,
1000.0)
cubeProps.cubeFBO = fbo
cubeProps.center = center
// execute `setupCubeFace` 6 times, where each time will be
// a different batch, and the batchIds of the 6 batches will be
// 0, 1, 2, 3, 4, 5
setupCubeFace.call(cubeProps, 6, block)
}
return ({ width, height }) => {
camera.tick()
rico.clear(1, 1, 1, 1)
const drawUniforms = {
view: camera.matrix,
projection: mat4.perspective([], Math.PI / 8, width / height, 0.01, 1000),
ptA: [settings.ptAX, settings.ptAY, settings.ptAZ],
ptB: ptB,
ptC: ptC
}
draw({ primitive: 'lines', uniforms: drawUniforms })
draw({ primitive: 'points', uniforms: drawUniforms })
}
}
invProj: ({viewportWidth, viewportHeight}) =>
mat4.invert([], mat4.perspective([],
Math.PI / 3,
viewportWidth / viewportHeight,
0.01,
1000)
),
invView: ({view}) => {
projection: ({viewportWidth, viewportHeight}) =>
mat4.perspective(projectionMatrix,
Math.PI / 4,
viewportWidth / viewportHeight,
0.01,
1000)
}
shell.on('gl-render', function () {
if (viewer) {
viewer.transparency = state.transparency
viewer.intensity = state.intensity
viewer.step = state.step
viewer.projection = mat4.perspective(
new Float32Array(16),
Math.PI / 4.0,
shell.width / shell.height,
0.1,
1000.0)
viewer.view = camera.view()
viewer.draw()
}
})