dist/ingress-model-viewer.js
/**
   * Construct a system of portal particles
   * @param  {context} gl     WebGL context
   */
Construct a system of portal particles
@param  {context} gl     WebGL context
Construct a system of portal particles @param { context } gl WebGL context
function ParticlePortalMesh(gl) {
    _classCallCheck(this, ParticlePortalMesh);
    var attributes = [];
    attributes.push(new _vertexAttribute2.default('a_position', 3));
    attributes.push(new _vertexAttribute2.default('a_texCoord0', 2));
    attributes.push(new _vertexAttribute2.default('a_scale', 1));
    attributes.push(new _vertexAttribute2.default('a_speed', 1));
    attributes.push(new _vertexAttribute2.default('a_portalIndex', 1));
    attributes.push(new _vertexAttribute2.default('a_index', 1));
    var values = new Float32Array(NUM_PARTICLES_PER_SYSTEM * NUM_VERTICES_PER_PARTICLE * TOTAL_VERTEX_SIZE);
    var seed,
        i,
        j,
        idx = 0;
    for (i = 0; i < NUM_PARTICLES_PER_SYSTEM; i++) {
      seed = seeds[i];
      for (j = 0; j < NUM_VERTICES_PER_PARTICLE; j++) {
        values[idx * TOTAL_VERTEX_SIZE + 0] = seed.x;
        values[idx * TOTAL_VERTEX_SIZE + 1] = seed.y;
        values[idx * TOTAL_VERTEX_SIZE + 2] = seed.z;
        values[idx * TOTAL_VERTEX_SIZE + 3] = U[j];
        values[idx * TOTAL_VERTEX_SIZE + 4] = V[j];
        values[idx * TOTAL_VERTEX_SIZE + 5] = seed.a_scale;
        values[idx * TOTAL_VERTEX_SIZE + 6] = seed.a_speed;
        values[idx * TOTAL_VERTEX_SIZE + 7] = 0;
        values[idx * TOTAL_VERTEX_SIZE + 8] = i;
        idx++;
      }
    }
    var faces = new Uint16Array(NUM_PARTICLES_PER_SYSTEM * NUM_INDICES_PER_FACE);
    var indices = [0, 1, 2, 1, 3, 2];
    idx = 0;
    var f = 0;
    for (i = 0; i < NUM_PARTICLES_PER_SYSTEM; i++) {
      for (j = 0; j < NUM_INDICES_PER_FACE; j++) {
        faces[f + j] = idx + indices[j];
      }
      f += 6;
      idx += 4;
    }
    return _possibleConstructorReturn(this, (ParticlePortalMesh.__proto__ || Object.getPrototypeOf(ParticlePortalMesh)).call(this, gl, new _glAttribute2.default(gl, attributes, values), new _glIndex2.default(gl, faces, gl.TRIANGLES)));
  }
function ParticlePortalMesh ( gl ) { _classCallCheck ( this , ParticlePortalMesh ) ; var attributes = [ ] ; attributes . push ( new _vertexAttribute2 . default ( 'a_position' , 3 ) ) ; attributes . push ( new _vertexAttribute2 . default ( 'a_texCoord0' , 2 ) ) ; attributes . push ( new _vertexAttribute2 . default ( 'a_scale' , 1 ) ) ; attributes . push ( new _vertexAttribute2 . default ( 'a_speed' , 1 ) ) ; attributes . push ( new _vertexAttribute2 . default ( 'a_portalIndex' , 1 ) ) ; attributes . push ( new _vertexAttribute2 . default ( 'a_index' , 1 ) ) ; var values = new Float32Array ( NUM_PARTICLES_PER_SYSTEM * NUM_VERTICES_PER_PARTICLE * TOTAL_VERTEX_SIZE ) ; var seed , i , j , idx = 0 ; for ( i = 0 ; i < NUM_PARTICLES_PER_SYSTEM ; i ++ ) { seed = seeds [ i ] ; for ( j = 0 ; j < NUM_VERTICES_PER_PARTICLE ; j ++ ) { values [ idx * TOTAL_VERTEX_SIZE + 0 ] = seed . x ; values [ idx * TOTAL_VERTEX_SIZE + 1 ] = seed . y ; values [ idx * TOTAL_VERTEX_SIZE + 2 ] = seed . z ; values [ idx * TOTAL_VERTEX_SIZE + 3 ] = U [ j ] ; values [ idx * TOTAL_VERTEX_SIZE + 4 ] = V [ j ] ; values [ idx * TOTAL_VERTEX_SIZE + 5 ] = seed . a_scale ; values [ idx * TOTAL_VERTEX_SIZE + 6 ] = seed . a_speed ; values [ idx * TOTAL_VERTEX_SIZE + 7 ] = 0 ; values [ idx * TOTAL_VERTEX_SIZE + 8 ] = i ; idx ++ ; } } var faces = new Uint16Array ( NUM_PARTICLES_PER_SYSTEM * NUM_INDICES_PER_FACE ) ; var indices = [ 0 , 1 , 2 , 1 , 3 , 2 ] ; idx = 0 ; var f = 0 ; for ( i = 0 ; i < NUM_PARTICLES_PER_SYSTEM ; i ++ ) { for ( j = 0 ; j < NUM_INDICES_PER_FACE ; j ++ ) { faces [ f + j ] = idx + indices [ j ] ; } f += 6 ; idx += 4 ; } return _possibleConstructorReturn ( this , ( ParticlePortalMesh . __proto__ || Object . getPrototypeOf ( ParticlePortalMesh ) ) . call ( this , gl , new _glAttribute2 . default ( gl , attributes , values ) , new _glIndex2 . default ( gl , faces , gl . TRIANGLES ) ) ) ; }
Construct a system of portal particles
 @param  {context} gl     WebGL context
Construct a system of portal particles @param { context } gl WebGL context