Skip to content

ECS Framework API v2.1.50


ECS Framework API / TypeInference

Class: TypeInference

Defined in: ECS/Core/SoAStorage.ts:213

自动类型推断器 根据数值类型和范围自动选择最优的TypedArray类型

Constructors

Constructor

new TypeInference(): TypeInference

Returns

TypeInference

Methods

inferOptimalType()

static inferOptimalType(value, options): string

Defined in: ECS/Core/SoAStorage.ts:217

根据数值范围推断最优的TypedArray类型

Parameters

value

any

options
minValue?

number

maxValue?

number

precision?

boolean

signed?

boolean

Returns

string


getTypedArrayConstructor()

static getTypedArrayConstructor(typeName): Float32ArrayConstructor | Float64ArrayConstructor | Int32ArrayConstructor | Uint32ArrayConstructor | Int16ArrayConstructor | Uint16ArrayConstructor | Int8ArrayConstructor | Uint8ArrayConstructor | Uint8ClampedArrayConstructor

Defined in: ECS/Core/SoAStorage.ts:302

根据推断的类型名创建对应的TypedArray构造函数

Parameters

typeName

string

Returns

Float32ArrayConstructor | Float64ArrayConstructor | Int32ArrayConstructor | Uint32ArrayConstructor | Int16ArrayConstructor | Uint16ArrayConstructor | Int8ArrayConstructor | Uint8ArrayConstructor | Uint8ClampedArrayConstructor

Released under the MIT License.