How to use the expo-three.createARCamera function in expo-three

To help you get started, we’ve selected a few expo-three 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 EvanBacon / expo-three-demo / Scenes / STLLoaderDemo.js View on Github external
innerHeight: height,
      devicePixelRatio: scale,
    } = window;

    // scene
    this.scene = new THREE.Scene();

    if (this.AR) {
      // AR Background Texture
      this.scene.background = ExpoTHREE.createARBackgroundTexture(
        arSession,
        this.renderer
      );

      /// AR Camera
      this.camera = ExpoTHREE.createARCamera(
        arSession,
        width,
        height,
        0.01,
        1000
      );
    } else {
      // Standard Background
      this.scene.background = new THREE.Color(0x999999);
      this.scene.fog = new THREE.FogExp2(0xcccccc, 0.002);

      /// Standard Camera
      this.camera = new THREE.PerspectiveCamera(35, width / height, 1, 15);
      this.camera.position.set(3, 0.15, 3);

      // controls
github EvanBacon / expo-three-demo / Scenes / Toxic.js View on Github external
this.renderer = ExpoTHREE.createRenderer({ gl });
    this.renderer.setPixelRatio(scale);
    this.renderer.setSize(width, height);
    this.renderer.setClearColor(0x000000, 1.0);

    // scene
    this.scene = new THREE.Scene();
    this.scene.background = ExpoTHREE.createARBackgroundTexture(
      arSession,
      this.renderer
    );

    // camera

    this.camera = ExpoTHREE.createARCamera(
      arSession,
      width,
      height,
      0.01,
      1000
    );

    // custom scene

    this._setupScene();

    // resize listener

    window.addEventListener('resize', this._onWindowResize, false);
  };
github ethantran / react-native-examples / src / screens / ARExample / ARExample.js View on Github external
_onGLContextCreate = async (gl, arSession) => {
        const { drawingBufferWidth, drawingBufferHeight } = gl;
        const scale = PixelRatio.get();
        const width = drawingBufferWidth / scale;
        const height = drawingBufferHeight / scale;

        const renderer = ExpoTHREE.createRenderer({ gl });
        renderer.setSize(width, height);
        renderer.setPixelRatio(scale);

        const scene = new THREE.Scene();
        const camera = ExpoTHREE.createARCamera(
            arSession,
            width,
            height,
            0.01,
            1000
        );
        // need to add camera to scene to make attached objects visible
        scene.add(camera);

        scene.background = ExpoTHREE.createARBackgroundTexture(
            arSession,
            renderer
        );
        ExpoTHREE.setIsLightEstimationEnabled(arSession, true);
        ExpoTHREE.setIsPlaneDetectionEnabled(arSession, true);
github EvanBacon / expo-three-demo / Scenes / PLYLoaderDemo.js View on Github external
innerHeight: height,
      devicePixelRatio: scale,
    } = window;

    // scene
    this.scene = new THREE.Scene();

    if (this.AR) {
      // AR Background Texture
      this.scene.background = ExpoTHREE.createARBackgroundTexture(
        arSession,
        this.renderer
      );

      /// AR Camera
      this.camera = ExpoTHREE.createARCamera(
        arSession,
        width,
        height,
        0.01,
        1000
      );
    } else {
      // Standard Background
      this.scene.background = new THREE.Color(0x999999);
      this.scene.fog = new THREE.FogExp2(0xcccccc, 0.002);

      /// Standard Camera
      this.camera = new THREE.PerspectiveCamera(50, width / height, 0.1, 500);

      this.camera.position.set(0, -4, 0);
github EvanBacon / expo-three-demo / Scenes / ThreeMFLoaderDemo.js View on Github external
innerHeight: height,
      devicePixelRatio: scale,
    } = window;

    // scene
    this.scene = new THREE.Scene();

    if (this.AR) {
      // AR Background Texture
      this.scene.background = ExpoTHREE.createARBackgroundTexture(
        arSession,
        this.renderer
      );

      /// AR Camera
      this.camera = ExpoTHREE.createARCamera(
        arSession,
        width,
        height,
        0.01,
        1000
      );
    } else {
      // Standard Background
      this.scene.background = new THREE.Color(0x999999);
      this.scene.fog = new THREE.FogExp2(0xcccccc, 0.002);

      /// Standard Camera
      this.camera = new THREE.PerspectiveCamera(50, width / height, 1, 500);

      this.camera.up.set(0, 0, 1);
      this.camera.position.set(0, -12, 6);
github EvanBacon / expo-three-demo / Scenes / AssimpLoaderDemo.js View on Github external
innerHeight: height,
      devicePixelRatio: scale,
    } = window;

    // scene
    this.scene = new THREE.Scene();

    if (this.AR) {
      // AR Background Texture
      this.scene.background = ExpoTHREE.createARBackgroundTexture(
        arSession,
        this.renderer
      );

      /// AR Camera
      this.camera = ExpoTHREE.createARCamera(
        arSession,
        width,
        height,
        0.01,
        1000
      );
    } else {
      // Standard Background
      this.scene.background = new THREE.Color(0x999999);
      this.scene.fog = new THREE.FogExp2(0xcccccc, 0.002);

      /// Standard Camera
      this.camera = new THREE.PerspectiveCamera(25, width / height, 1, 10000);
      this.camera.position.set(600, 1150, 5);
      this.camera.up.set(0, 0, 1);
      this.camera.lookAt(new THREE.Vector3(-100, 0, 0));
github EvanBacon / expo-three-demo / Scenes / MMDLoaderDemo.js View on Github external
innerHeight: height,
      devicePixelRatio: scale,
    } = window;

    // scene
    this.scene = new THREE.Scene();

    if (this.AR) {
      // AR Background Texture
      this.scene.background = ExpoTHREE.createARBackgroundTexture(
        arSession,
        this.renderer
      );

      /// AR Camera
      this.camera = ExpoTHREE.createARCamera(
        arSession,
        width,
        height,
        0.01,
        1000
      );
    } else {
      // Standard Background
      this.scene.background = new THREE.Color(0x999999);
      this.scene.fog = new THREE.FogExp2(0xcccccc, 0.002);

      /// Standard Camera
      this.camera = new THREE.PerspectiveCamera(50, width / height, 1, 500);

      this.camera.up.set(0, 0, 1);
      this.camera.position.set(0, -12, 6);
github EvanBacon / expo-three-demo / Scenes / Sea3DLoaderDemo.js View on Github external
innerHeight: height,
      devicePixelRatio: scale,
    } = window;

    // scene
    this.scene = new THREE.Scene();

    if (this.AR) {
      // AR Background Texture
      this.scene.background = ExpoTHREE.createARBackgroundTexture(
        arSession,
        this.renderer
      );

      /// AR Camera
      this.camera = ExpoTHREE.createARCamera(
        arSession,
        width,
        height,
        0.01,
        1000
      );
    } else {
      // Standard Background
      this.scene.background = new THREE.Color(0x999999);
      this.scene.fog = new THREE.FogExp2(0xcccccc, 0.002);

      /// Standard Camera
      this.camera = new THREE.PerspectiveCamera(45, width / height, 1, 10000);
      this.camera.position.set(1000, -300, 1000);

      // controls
github expo / expo-three / examples / ar / App.js View on Github external
}
    this.arSession = arSession;
    /// Enable ARKit light estimation
    ExpoTHREE.setIsLightEstimationEnabled(arSession, true);

    ExpoTHREE.setIsPlaneDetectionEnabled(arSession, true);

    this.renderer = ExpoTHREE.createRenderer({ gl, canvas });
    this.renderer.setPixelRatio(scale);
    this.renderer.setSize(width, height);
    this.renderer.setClearColor(0x000000, 1.0);

    this.scene = new THREE.Scene();
    this.scene.background = ExpoTHREE.createARBackgroundTexture(arSession, this.renderer);
    this.scene.size = { width, height };
    this.camera = ExpoTHREE.createARCamera(arSession, width, height, 0.01, 1000);

    this.setupLights();

    this.setupARUtils();
    this.setupBall();
  };
github EvanBacon / expo-three-demo / Scenes / Trees.js View on Github external
this.renderer.setPixelRatio(scale);
    this.renderer.setSize(width, height);
    this.renderer.setClearColor(0x000000, 1.0);

    // scene
    this.scene = new THREE.Scene();

    if (AR) {
      // AR Background Texture
      this.scene.background = ExpoTHREE.createARBackgroundTexture(
        arSession,
        this.renderer
      );

      /// AR Camera
      this.camera = ExpoTHREE.createARCamera(
        arSession,
        width,
        height,
        0.01,
        1000
      );
    } else {
      // Standard Background
      this.scene.background = new THREE.Color(0xcccccc);
      this.scene.fog = new THREE.FogExp2(0x222222, 0.0001);

      /// Standard Camera
      this.camera = new THREE.PerspectiveCamera(80, width / height, 50, 10000);

      this.camera.position.x = 2500;
      this.camera.position.y = 2500;