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

Function createScene

packages/functions/test/dequantize.test.ts:55–84  ·  view source on GitHub ↗
(doc: Document)

Source from the content-addressed store, hash-verified

53}
54
55function createScene(doc: Document): Scene {
56 const prim = doc
57 .createPrimitive()
58 .setMode(Primitive.Mode.TRIANGLES)
59 .setAttribute(
60 'POSITION',
61 doc
62 .createAccessor('POSITION')
63 .setType('VEC3')
64 .setArray(new Uint16Array([0, 0, 0, 10, 15, 8, 50, 50, 50, 15, 15, 0, 10, 10, 0])),
65 )
66 .setAttribute(
67 'JOINTS_0',
68 doc
69 .createAccessor('JOINTS_0')
70 .setType('VEC4')
71 .setArray(new Uint8Array([0, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 0, 4, 0, 0, 0])),
72 )
73 .setAttribute(
74 'WEIGHTS_0',
75 doc
76 .createAccessor('WEIGHTS_0')
77 .setType('VEC4')
78 .setArray(new Uint8Array([255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0])),
79 );
80
81 const scene = doc.createScene();
82 scene.addChild(doc.createNode().setMesh(doc.createMesh().addPrimitive(prim)));
83 return scene;
84}

Callers 1

dequantize.test.tsFile · 0.70

Calls 12

setModeMethod · 0.80
createPrimitiveMethod · 0.80
createAccessorMethod · 0.80
createSceneMethod · 0.80
setMeshMethod · 0.80
createNodeMethod · 0.80
addPrimitiveMethod · 0.80
createMeshMethod · 0.80
setAttributeMethod · 0.45
setArrayMethod · 0.45
setTypeMethod · 0.45
addChildMethod · 0.45

Tested by

no test coverage detected