function (cameraEl) {
    var cameraData;
    var sceneEl = this.el.sceneEl;
    this.numUserCamerasChecked++;

    // Already found one.
    if (this.initialCameraFound) { return; }

    // Check if camera is appropriate for being the initial camera.
    cameraData = cameraEl.getAttribute('camera');
    if (!cameraData.active || cameraData.spectator) {
      // No user cameras eligible, create default camera.
      if (this.numUserCamerasChecked === this.numUserCameras) {
        this.createDefaultCamera();
      }
      return;
    }

    this.initialCameraFound = true;
    sceneEl.camera = cameraEl.getObject3D('camera');
    sceneEl.emit('cameraready', {cameraEl: cameraEl});
  }
function (cameraEl) {
    var cameraData;
    var sceneEl = this.el.sceneEl;
    this.numUserCamerasChecked++;

    // Already found one.
    if (this.initialCameraFound) { return; }

    // Check if camera is appropriate for being the initial camera.
    cameraData = cameraEl.getAttribute('camera');
    if (!cameraData.active || cameraData.spectator) {
      // No user cameras eligible, create default camera.
      if (this.numUserCamerasChecked === this.numUserCameras) {
        this.createDefaultCamera();
      }
      return;
    }

    this.initialCameraFound = true;
    sceneEl.camera = cameraEl.getObject3D('camera');
    sceneEl.emit('cameraready', {cameraEl: cameraEl});
  }
function ( cameraEl ) { var cameraData ; var sceneEl = this . el . sceneEl ; this . numUserCamerasChecked ++ ; // Already found one. if ( this . initialCameraFound ) { return ; } // Check if camera is appropriate for being the initial camera. cameraData = cameraEl . getAttribute ( 'camera' ) ; if ( ! cameraData . active || cameraData . spectator ) { // No user cameras eligible, create default camera. if ( this . numUserCamerasChecked === this . numUserCameras ) { this . createDefaultCamera ( ) ; } return ; } this . initialCameraFound = true ; sceneEl . camera = cameraEl . getObject3D ( 'camera' ) ; sceneEl . emit ( 'cameraready' , { cameraEl : cameraEl } ) ; }
Check if a user-defined camera entity is appropriate to be initial camera.
(active + non-spectator).

Keep track of the number of cameras we checked and whether we found one.
Check if a user - defined camera entity is appropriate to be initial camera . ( active + non - spectator ) .
Find the camera element that is appropriate for the user.