How to use the gl-mat4.perspective function in gl-mat4

To help you get started, we’ve selected a few gl-mat4 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github regl-project / regl / example / cube-fbo.js View on Github external
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)
}
github rolyatmax / sketches / sketches / 2019.10.09-10.48.06.js View on Github external
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 })
  }
}
github nicknikolov / cubemap-sh / example / example.js View on Github external
invProj: ({viewportWidth, viewportHeight}) =>
      mat4.invert([], mat4.perspective([],
        Math.PI / 3,
        viewportWidth / viewportHeight,
        0.01,
        1000)
      ),
    invView: ({view}) => {
github regl-project / regl / example / raycast.js View on Github external
projection: ({viewportWidth, viewportHeight}) =>
      mat4.perspective(projectionMatrix,
                       Math.PI / 4,
                       viewportWidth / viewportHeight,
                       0.01,
                       1000)
  }
github mikolalysenko / 3d-neuron-viewer / index.js View on Github external
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()
  }
})

gl-mat4

gl-matrix's mat4, split into smaller pieces

Zlib
Latest version published 7 years ago

Package Health Score

56 / 100
Full package analysis