examples/experimental/webgl-2d.js
function getNormalizedPrimitive2D ({ positions, cells, normals, uvs }, opt = {}) {
    // Default to assuming the positions are a unit circle/box/etc
    normals = normals ? expandVectorList(normals) : positions.map(p => vec3.normalize([], expandVector(p)));
    // Planar UV across bounding box of mesh
    uvs = uvs || get2DUV(positions);
    // Assume 2D primitives are centered in -1..1 space, recenter to 0..1
    positions = opt.center ? recenter(positions) : positions;
    // Expand to 3D
    positions = expandVectorList(positions);
    return {
      positions,
      uvs,
      normals,
      cells
    };
  }
function getNormalizedPrimitive2D ({ positions, cells, normals, uvs }, opt = {}) {
    // Default to assuming the positions are a unit circle/box/etc
    normals = normals ? expandVectorList(normals) : positions.map(p => vec3.normalize([], expandVector(p)));
    // Planar UV across bounding box of mesh
    uvs = uvs || get2DUV(positions);
    // Assume 2D primitives are centered in -1..1 space, recenter to 0..1
    positions = opt.center ? recenter(positions) : positions;
    // Expand to 3D
    positions = expandVectorList(positions);
    return {
      positions,
      uvs,
      normals,
      cells
    };
  }
function getNormalizedPrimitive2D ( { positions , cells , normals , uvs } , opt = { } ) { // Default to assuming the positions are a unit circle/box/etc normals = normals ? expandVectorList ( normals ) : positions . map ( p => vec3 . normalize ( [ ] , expandVector ( p ) ) ) ; // Planar UV across bounding box of mesh uvs = uvs || get2DUV ( positions ) ; // Assume 2D primitives are centered in -1..1 space, recenter to 0..1 positions = opt . center ? recenter ( positions ) : positions ; // Expand to 3D positions = expandVectorList ( positions ) ; return { positions , uvs , normals , cells } ; }
A unit 2D rectangle, circle, etc
A unit 2D rectangle circle etc