A Geometry3D, or a pixi Geometry whose attributes give a format,
and a stride and offset when they share a buffer
Shader attribute name, such as aPosition, aNormal, aUV or aTangent
Components per vertex to read, at most what the format holds: 3 for positions and normals, 2 for UVs, 4 for tangents
Optionalout: Float32Array<ArrayBufferLike>
Array to fill from index 0, at least size floats per vertex; a new one is allocated
when omitted
out, or the new array
const normals = getAttributeData(geometry, 'aNormal', 3);
const normal = new Vector3().fromArray(normals, vertexIndex * 3);
const merged = new Float32Array((first.vertexCount + second.vertexCount) * 3);
getAttributeData(first, 'aPosition', 3, merged);
getAttributeData(second, 'aPosition', 3, merged.subarray(first.vertexCount * 3));
Reads a vertex attribute as floats,
sizeper vertex, however the geometry stores itUse it for maths on a mesh on the CPU, such as merging, welding or sampling its surface. Getters such as Geometry3D#normals return data as stored, which can be quantized integers or a whole interleaved buffer; this decodes either.
Values come out as the vertex shader reads them:
snormformats as -1 to 1,unormas 0 to 1, and float and raw integer (sint,uint) formats as stored, so raw integer positions read in the same space as Geometry3D#bounds3D, and the mesh's transform scales them. Morph targets and skinning aren't applied.It copies on every call, so read once and keep the result, or pass
outto reuse an array.