How to use luma - 10 common examples

To help you get started, we’ve selected a few luma 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 uber / luma.gl / test / webgl / context-state.spec.js View on Github external
[GL.STENCIL_VALUE_MASK]: 0xBBBBBBBB,
    [GL.STENCIL_BACK_FUNC]: GL.LEQUAL,
    [GL.STENCIL_BACK_REF]: 0.5,
    [GL.STENCIL_BACK_VALUE_MASK]: 0xBBBBBBBB,
    // stencilOp
    [GL.STENCIL_FAIL]: GL.REPLACE,
    [GL.STENCIL_PASS_DEPTH_FAIL]: GL.INCR,
    [GL.STENCIL_PASS_DEPTH_PASS]: GL.DECR,
    [GL.STENCIL_BACK_FAIL]: GL.REPLACE,
    [GL.STENCIL_BACK_PASS_DEPTH_FAIL]: GL.INCR,
    [GL.STENCIL_BACK_PASS_DEPTH_PASS]: GL.DECR
  };

  resetParameters(gl);

  setParameters(gl, parameters);

  for (const key in expectedValues) {
    const value = getParameter(gl, key);
    t.deepEqual(value, expectedValues[key],
      `got expected value ${stringifyTypedArray(value)} for key: ${getKey(GL, key)}`);
  }
  t.end();
});
github uber / deck.gl / src / react / webgl-renderer.js View on Github external
_renderFrame() {
    const {width, height, useDevicePixelRatio} = this.props;
    const {gl} = this;

    // Check for reasons not to draw
    if (!gl || !(width > 0) || !(height > 0)) {
      return;
    }

    this._resizeDrawingBuffer(gl.canvas, {useDevicePixelRatio});

    // Updates WebGL viewport to latest props
    setParameters(gl, {
      viewport: [0, 0, gl.canvas.width, gl.canvas.height]
    });

    // Call render callback
    this.props.onRenderFrame({gl});

    this.props.onAfterRender(this.refs.overlay);

  }
github uber / deck.gl / showcases / wind / src / layers / elevation-layer / elevation-layer.js View on Github external
const vsShader = shaders.vs;
    const fsSource = shaders.fs;

    const fsShader = `\
precision highp float;
${fsSource}`;

    const {lngResolution, latResolution, boundingBox} = this.props;

    const geometry = new GridGeometry({
      xResolution: lngResolution,
      yResolution: latResolution,
      boundingBox
    });

    return new Model(gl, {
      id: this.props.id,
      vs: vsShader,
      fs: fsShader,
      geometry,
      // FIXME - isIndexed should be set in "GridGeometry"
      isIndexed: true,
      modules: ['lighting']
    });
  }
}
github uber / deck.gl / modules / experimental-layers / src / bitmap-layer / bitmap-layer.js View on Github external
getModel(gl) {
    // Two triangles making up a square to render the bitmap texture on
    const verts = [[1, 1, 0], [-1, 1, 0], [1, -1, 0], [-1, 1, 0], [1, -1, 0], [-1, -1, 0]];
    const positions = [];
    const texCoords = [];
    verts.forEach(vertex => {
      // geometry: unit square centered on origin
      positions.push(vertex[0] / 2, vertex[1] / 2, vertex[2] / 2);
      // texture: unit square with bottom left in origin
      texCoords.push(vertex[0] / 2 + 0.5, -vertex[1] / 2 + 0.5);
    });

    const model = new Model(gl, {
      id: this.props.id,
      vs: BITMAP_VERTEX_SHADER,
      fs: BITMAP_FRAGMENT_SHADER,
      shaderCache: this.context.shaderCache,
      geometry: new Geometry({
        drawMode: GL.TRIANGLES,
        vertexCount: 6,
        attributes: {
          positions: new Float32Array(positions),
          texCoords: new Float32Array(texCoords)
        }
      }),
      isInstanced: true
    });

    return model;
github uber / deck.gl / modules / experimental-layers / src / trips-layer / trips-layer.js View on Github external
getModel(gl) {
    return new Model(gl, {
      id: this.props.id,
      vs: tripsVertex,
      fs: tripsFragment,
      geometry: new Geometry({
        id: this.props.id,
        drawMode: 'LINES'
      }),
      vertexCount: 0,
      isIndexed: true,
      // TODO-state-management: onBeforeRender can go to settings, onAfterRender, we should
      // move this settings of corresponding draw.
      onBeforeRender: () => {
        gl.enable(gl.BLEND);
        gl.enable(gl.POLYGON_OFFSET_FILL);
        gl.polygonOffset(2.0, 1.0);
        gl.blendFunc(gl.SRC_ALPHA, gl.ONE);
github uber / deck.gl / src / layers / samples / enhanced-hexagon-layer / enhanced-hexagon-layer.js View on Github external
getModel(gl) {
    return new Model({
      gl,
      id: this.props.id,
      ...assembleShaders(gl, {
        vs: VERTEX_SHADER,
        fs: FRAGMENT_SHADER
      }),
      geometry: new Geometry({
        drawMode: GL.TRIANGLE_FAN,
        positions: this.getPositions()
      }),
      isInstanced: true
    });
  }
github uber / deck.gl / src / deprecated-layers / choropleth-layer / choropleth-layer.js View on Github external
getModel(gl) {
    return new Model(gl, Object.assign({}, this.getShaders(), {
      id: this.props.id,
      geometry: new Geometry({
        drawMode: this.props.drawContour ? GL.LINES : GL.TRIANGLES
      }),
      vertexCount: 0,
      isIndexed: true,
      shaderCache: this.context.shaderCache
    }));
  }
github uber / deck.gl / modules / experimental-layers / src / gpu-screen-grid-layer / gpu-screen-grid-layer.js View on Github external
_getModel(gl) {
    return new Model(
      gl,
      Object.assign({}, this.getShaders(), {
        id: this.props.id,
        geometry: new Geometry({
          drawMode: GL.TRIANGLE_FAN,
          attributes: {
            vertices: new Float32Array([0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0])
          }
        }),
        isInstanced: true,
        shaderCache: this.context.shaderCache
      })
    );
  }
github uber / deck.gl / src / layers / samples / point-cloud-layer / point-cloud-layer.js View on Github external
getModel(gl) {
    return new Model({
      gl,
      id: this.props.id,
      ...assembleShaders(gl, {
        vs: VERTEX_SHADER,
        fs: FRAGMENT_SHADER
      }),
      geometry: new Geometry({drawMode: GL.POINTS})
    });
  }
github uber / deck.gl / src / layers / core / reflection-layer / reflection-layer.js View on Github external
getModel(gl) {
    return new Model({
      gl,
      id: this.props.id,
      ...assembleShaders(gl, {
        vs: glslify('./reflection-layer-vertex.glsl'),
        fs: glslify('./reflection-layer-fragment.glsl')
      }),
      geometry: new Geometry({
        drawMode: this.props.drawContour ? GL.LINES : GL.TRIANGLES
      }),
      vertexCount: 0,
      isIndexed: true
    });
  }

luma

A library for creating unified, beautiful shadows.

MIT
Latest version published 3 years ago

Package Health Score

67 / 100
Full package analysis