How to use three-dev - 3 common examples

To help you get started, we’ve selected a few three-dev 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 aframevr / aframe / lib / vendor / VREffect.js View on Github external
function fovPortToProjection( fov, rightHanded, zNear, zFar ) {

    rightHanded = rightHanded === undefined ? true : rightHanded;
    zNear = zNear === undefined ? 0.01 : zNear;
    zFar = zFar === undefined ? 10000.0 : zFar;

    var handednessScale = rightHanded ? - 1.0 : 1.0;

    // start with an identity matrix
    var mobj = new THREE.Matrix4();
    var m = mobj.elements;

    // and with scale/offset info for normalized device coords
    var scaleAndOffset = fovToNDCScaleOffset( fov );

    // X result, map clip edges to [-w,+w]
    m[ 0 * 4 + 0 ] = scaleAndOffset.scale[ 0 ];
    m[ 0 * 4 + 1 ] = 0.0;
    m[ 0 * 4 + 2 ] = scaleAndOffset.offset[ 0 ] * handednessScale;
    m[ 0 * 4 + 3 ] = 0.0;

    // Y result, map clip edges to [-w,+w]
    // Y offset is negated because this proj matrix transforms from world coords with Y=up,
    // but the NDC scaling has Y=down (thanks D3D?)
    m[ 1 * 4 + 0 ] = 0.0;
    m[ 1 * 4 + 1 ] = scaleAndOffset.scale[ 1 ];
github aframevr / aframe / lib / vendor / VREffect.js View on Github external
if ( canvas.mozRequestFullScreen ) {

      canvas.mozRequestFullScreen( { vrDisplay: vrHMD } );

    } else if ( canvas.webkitRequestFullscreen ) {

      canvas.webkitRequestFullscreen( { vrDisplay: vrHMD } );

    }

  };

  // render

  var cameraL = new THREE.PerspectiveCamera();
  var cameraR = new THREE.PerspectiveCamera();

  this.render = function ( scene, camera ) {

    if ( vrHMD ) {

      var sceneL, sceneR;

      if ( Array.isArray( scene ) ) {

        sceneL = scene[ 0 ];
        sceneR = scene[ 1 ];

      } else {

        sceneL = scene;
        sceneR = scene;
github aframevr / aframe / lib / vendor / VREffect.js View on Github external
if ( canvas.mozRequestFullScreen ) {

      canvas.mozRequestFullScreen( { vrDisplay: vrHMD } );

    } else if ( canvas.webkitRequestFullscreen ) {

      canvas.webkitRequestFullscreen( { vrDisplay: vrHMD } );

    }

  };

  // render

  var cameraL = new THREE.PerspectiveCamera();
  var cameraR = new THREE.PerspectiveCamera();

  this.render = function ( scene, camera ) {

    if ( vrHMD ) {

      var sceneL, sceneR;

      if ( Array.isArray( scene ) ) {

        sceneL = scene[ 0 ];
        sceneR = scene[ 1 ];

      } else {

        sceneL = scene;

three-dev

JavaScript 3D library

MIT
Latest version published 9 years ago

Package Health Score

69 / 100
Full package analysis