How to use the aframe-atlas-uvs-component.getGridUvs function in aframe-atlas-uvs-component

To help you get started, we’ve selected a few aframe-atlas-uvs-component 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 supermedium / beatsaver-viewer / src / components / fake-glow.js View on Github external
const geometries = cylinders.map((cylinderData, i) => {
    const cylinder = new THREE.CylinderBufferGeometry(
      cylinderData.radius,
      cylinderData.radius,
      cylinderData.height
    );

    const colorArray = [];
    for (i = 0; i < cylinder.attributes.position.array.length; i += 3) {
      colorArray[i] = colorHelper.r;
      colorArray[i + 1] = colorHelper.g;
      colorArray[i + 2] = colorHelper.b;
    }
    cylinder.addAttribute('color', new THREE.Float32BufferAttribute(colorArray, 3));

    const alphaUvs = getGridUvs(0, i, 1, 4);
    const uvs = cylinder.attributes.uv.array;
    for (i = 0; i < uvs.length; i += 6) {
      uvs[i] = alphaUvs[0].x;
      uvs[i + 1] = alphaUvs[0].y;

      uvs[i + 2] = alphaUvs[1].x;
      uvs[i + 3] = alphaUvs[1].y;

      uvs[i + 4] = alphaUvs[2].x;
      uvs[i + 5] = alphaUvs[2].y;
    }
    cylinder.attributes.uv.needsUpdate = true;

    return cylinder;
  });

aframe-atlas-uvs-component

An A-Frame component to set UVs onto a plane geometry given a gridded texture atlas.

MIT
Latest version published 3 years ago

Package Health Score

59 / 100
Full package analysis

Popular aframe-atlas-uvs-component functions