MCPcopy Create free account
hub / github.com/esengine/esengine / toNumberArray

Method toNumberArray

packages/asset-system/src/loaders/FBXLoader.ts:740–755  ·  view source on GitHub ↗

* Convert FBX property to number array * 将 FBX 属性转换为数字数组 * * Handles all typed arrays (Int32Array, Float64Array, etc.) and regular arrays * 处理所有类型数组(Int32Array、Float64Array 等)和普通数组

(prop: FBXProperty)

Source from the content-addressed store, hash-verified

738 * 处理所有类型数组(Int32Array、Float64Array 等)和普通数组
739 */
740 private toNumberArray(prop: FBXProperty): number[] {
741 if (prop instanceof Float64Array || prop instanceof Float32Array) {
742 return Array.from(prop);
743 } else if (prop instanceof Int32Array || prop instanceof Uint32Array) {
744 return Array.from(prop);
745 } else if (prop instanceof Uint8Array || prop instanceof Int8Array) {
746 return Array.from(prop);
747 } else if (prop instanceof Int16Array || prop instanceof Uint16Array) {
748 return Array.from(prop);
749 } else if (prop instanceof BigInt64Array) {
750 return Array.from(prop, v => Number(v));
751 } else if (Array.isArray(prop)) {
752 return prop.map(Number);
753 }
754 return [];
755 }
756
757 /**
758 * Extract layer element data (normals, UVs, etc.)

Callers 4

extractGeometryMethod · 0.95
extractLayerElementMethod · 0.95
extractAnimationCurveMethod · 0.95
extractDeformerMethod · 0.95

Calls 3

isArrayMethod · 0.80
fromMethod · 0.45
mapMethod · 0.45

Tested by

no test coverage detected