MCPcopy
hub / github.com/donmccurdy/glTF-Transform / createFloatAttribute

Function createFloatAttribute

packages/functions/test/reorder.test.ts:144–149  ·  view source on GitHub ↗

Builds a new float32 attribute for given type and data.

(doc: Document, semantic: string, type: GLTF.AccessorType, array: Float32Array)

Source from the content-addressed store, hash-verified

142
143/** Builds a new float32 attribute for given type and data. */
144function createFloatAttribute(doc: Document, semantic: string, type: GLTF.AccessorType, array: Float32Array): Accessor {
145 const attribute = doc.createAccessor().setType(type).setArray(array);
146 const prim = doc.createPrimitive().setAttribute(semantic, attribute).setMode(Primitive.Mode.TRIANGLES);
147 doc.createMesh().addPrimitive(prim);
148 return attribute;
149}

Callers 1

reorder.test.tsFile · 0.85

Calls 8

createAccessorMethod · 0.80
setModeMethod · 0.80
createPrimitiveMethod · 0.80
addPrimitiveMethod · 0.80
createMeshMethod · 0.80
setArrayMethod · 0.45
setTypeMethod · 0.45
setAttributeMethod · 0.45

Tested by

no test coverage detected