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

Method getElementSize

packages/core/src/properties/accessor.ts:165–184  ·  view source on GitHub ↗

Returns size of a given element type, in components.

(type: GLTF.AccessorType)

Source from the content-addressed store, hash-verified

163
164 /** Returns size of a given element type, in components. */
165 public static getElementSize(type: GLTF.AccessorType): number {
166 switch (type) {
167 case Accessor.Type.SCALAR:
168 return 1;
169 case Accessor.Type.VEC2:
170 return 2;
171 case Accessor.Type.VEC3:
172 return 3;
173 case Accessor.Type.VEC4:
174 return 4;
175 case Accessor.Type.MAT2:
176 return 4;
177 case Accessor.Type.MAT3:
178 return 9;
179 case Accessor.Type.MAT4:
180 return 16;
181 default:
182 throw new Error('Unexpected type: ' + type);
183 }
184 }
185
186 /** Returns size of a given component type, in bytes. */
187 public static getComponentSize(componentType: GLTF.AccessorComponentType): number {

Callers 15

getMinNormalizedMethod · 0.95
getMinMethod · 0.95
getMaxNormalizedMethod · 0.95
getMaxMethod · 0.95
getCountMethod · 0.95
getScalarMethod · 0.95
setScalarMethod · 0.95
getElementMethod · 0.95
setElementMethod · 0.95
accessor.test.tsFile · 0.80
getInterleavedArrayFunction · 0.80
getAccessorArrayFunction · 0.80

Calls 1

getMethod · 0.80

Tested by 1

createUniqueAttributeFunction · 0.64