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

Function createPrimitive

packages/functions/test/transform-mesh.test.ts:146–194  ·  view source on GitHub ↗
(document: Document)

Source from the content-addressed store, hash-verified

144}
145
146function createPrimitive(document: Document): Primitive {
147 const prim = document
148 .createPrimitive()
149 .setMode(Primitive.Mode.POINTS)
150 .setAttribute(
151 'POSITION',
152 // biome-ignore format: Readability.
153 document
154 .createAccessor('POSITION')
155 .setType('VEC3')
156 .setArray(new Float32Array([
157 0.5, 10, 0.5,
158 0.5, 10, -0.5,
159 -0.5, 10, -0.5,
160 -0.5, 10, 0.5,
161 ])),
162 )
163 .setAttribute(
164 'NORMAL',
165 // biome-ignore format: Readability.
166 document
167 .createAccessor('NORMAL')
168 .setType('VEC3')
169 .setArray(
170 new Float32Array([
171 0, 1, 0,
172 0, 1, 0,
173 0, 1, 0,
174 0, 1, 0,
175 ])
176 ),
177 )
178 .setAttribute(
179 'TANGENT',
180 // biome-ignore format: Readability.
181 document
182 .createAccessor('TANGENT')
183 .setType('VEC4')
184 .setArray(
185 new Float32Array([
186 1, 0, 0, 1,
187 1, 0, 0, 1,
188 1, 0, 0, 1,
189 1, 0, 0, 1,
190 ])
191 ),
192 );
193 return prim;
194}

Callers 1

Calls 6

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

Tested by

no test coverage detected