knight-web 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,31 @@
1
+ /** 文件工具 */
2
+ export declare namespace FileUtility {
3
+ /** 路径工具 */
4
+ class Path {
5
+ /** 根据URL获取拓展名 */
6
+ static ExtName(_url: string): string;
7
+ /** 根据URL获取拓展名 */
8
+ static ExtNameWithoutPoint(_url: string): string;
9
+ /** 根据URL获取文件名(包含拓展名) */
10
+ static Name(_url: string): string;
11
+ /** 根据URL获取文件名(不包含拓展名) */
12
+ static OnlyName(_url: string): string;
13
+ /** 根据URL获取文件路径 */
14
+ static DirName(_url: string): string;
15
+ }
16
+ /** 文件工具 */
17
+ class File {
18
+ /** 加载Script脚本(动态加载指定的本地 JavaScript 文件) */
19
+ static LoadScript(_src: string, _callback: (_error: Error, _script?: HTMLScriptElement) => void): void;
20
+ /** 加载进制文件 */
21
+ static LoadBinaryFile(_url: string): Promise<Uint8Array>;
22
+ /** 将字节数组转为Hex16进制数组 */
23
+ static ByteArrayToHex(_binaryArray: Uint8Array, _bit: number): Array<string>;
24
+ /** 读取文件 */
25
+ static ReadFile<T extends {}>(_blob: Blob): Promise<Uint8Array>;
26
+ /** 读取文件执行函数 */
27
+ private static OnExecutorReadFile;
28
+ /** 解析Excel的XLSX数据 */
29
+ static ParseXLSXData<T extends {}>(_arrayData: Uint8Array): Array<T[]>;
30
+ }
31
+ }
@@ -0,0 +1,20 @@
1
+ import { EnumUtility } from "./EnumUtility";
2
+ import { InterfaceUtility } from "./InterfaceUtility";
3
+ /** 输入工具 */
4
+ export declare namespace InputUtility {
5
+ /** 输入类 */
6
+ class Input {
7
+ /** 构造函数 */
8
+ constructor();
9
+ /** 注册 */
10
+ RegistGlobalEvent(_eType: EnumUtility.E_EventType, _eventCallBack: InterfaceUtility.IEvent<Event>, _options?: boolean | AddEventListenerOptions): void;
11
+ /** 注销 */
12
+ DegistGlobalEvent(_eType: EnumUtility.E_EventType, _eventCallBack: InterfaceUtility.IEvent<Event>, _options?: boolean | AddEventListenerOptions): void;
13
+ /** 注册 */
14
+ RegistTargetEvent(_target: HTMLElement, _eType: EnumUtility.E_EventType, _eventCallBack: InterfaceUtility.IEvent<Event>, _options?: boolean | AddEventListenerOptions): void;
15
+ /** 注销 */
16
+ DegistTargetEvent(_target: HTMLElement, _eType: EnumUtility.E_EventType, _eventCallBack: InterfaceUtility.IEvent<Event>, _options?: boolean | AddEventListenerOptions): void;
17
+ /** 事件回调函数 */
18
+ private OnEventCallBack;
19
+ }
20
+ }
@@ -0,0 +1,13 @@
1
+ /** 接口模块 */
2
+ export declare namespace InterfaceUtility {
3
+ /** 类型泛型接口(构造器签名接口) */
4
+ type IType<T> = new (...args: any[]) => T;
5
+ /** 行为类型泛型接口(类似于C#中的Action使用方法) */
6
+ interface IAction<T = any, K = any, M = any, N = any, Q = any, U = any, V = any, W = any> {
7
+ (t?: T, k?: K, m?: M, n?: N, q?: Q, u?: U, v?: V, w?: W): any;
8
+ }
9
+ /** 事件类型泛型接口(类似于C#中的Event使用方法) */
10
+ interface IEvent<T = any, K = any, M = any, N = any, Q = any, U = any, V = any, W = any> {
11
+ (t?: T, k?: K, m?: M, n?: N, q?: Q, u?: U, v?: V, w?: W): any;
12
+ }
13
+ }
@@ -0,0 +1,44 @@
1
+ /*********************************************************************************
2
+ * FileName : LogUtility
3
+ * FileBasename : LogUtility.ts
4
+ * Description : 日志工具
5
+ * Version : V1.0.0
6
+ * Date : Wed Mar 02 2022 17:03:42 GMT+0800 (中国标准时间)
7
+ * Path : db://assets/Script/Utility/LogUtility.ts
8
+ * Author : Seven_9t
9
+ * Others : 修改默认TS脚本模板路径 C:\CocosDashboard_1.0.12\resources\.editors\Creator\<Version>\resources\resources\3d\engine\editor\assets\default_file_content\ts
10
+ * ManualUrl : <指南手册> https://docs.cocos.com/creator/3.4/manual/zh/
11
+ * : <脚本手册> https://docs.cocos.com/creator/3.4/manual/zh/scripting/
12
+ * : <CC类手册> https://docs.cocos.com/creator/3.4/manual/zh/scripting/decorator.html
13
+ * : <生命周期手册>https://docs.cocos.com/creator/3.4/manual/zh/scripting/life-cycle-callbacks.html
14
+
15
+ **********************************************************************************/
16
+ /** 日志工具 */
17
+ export declare namespace LogUtility {
18
+ /** 是否开启日志 */
19
+ const Switch: boolean;
20
+ /** 是否显示堆栈信息 */
21
+ const Stack: boolean;
22
+ /** 系统名称 */
23
+ const Name: string;
24
+ /** 日志标签 */
25
+ const Flag: string;
26
+ /** 设置日志开关 */
27
+ function SetSwitch(_value: boolean): void;
28
+ /** 提示日志 */
29
+ function LogTip(..._message: any[]): void;
30
+ /** 信息日志*/
31
+ function LogInfo(..._message: any[]): void;
32
+ /** 警告日志 */
33
+ function LogWarning(..._message: any[]): void;
34
+ /** 错误日志 */
35
+ function LogError(..._message: any[]): void;
36
+ /** 系统日志 */
37
+ function LogSystem(..._message: any[]): void;
38
+ /** 输出日志 */
39
+ function Print(_head: string, _color: string, ..._message: any[]): void;
40
+ /** 获取日期字符串 */
41
+ function getDateString(): string;
42
+ /** 调用堆栈 */
43
+ function OnStack(): string;
44
+ }
@@ -0,0 +1,559 @@
1
+ import { InterfaceUtility } from "./InterfaceUtility";
2
+ /** 数学工具 */
3
+ export declare namespace MathUtility {
4
+ /** UUID工具 */
5
+ class UUID {
6
+ /** 字符集 */
7
+ private static _unicodes;
8
+ /** 创建新UUID */
9
+ static NewUUID(): string;
10
+ /** 时间ID */
11
+ static TimeID(): string;
12
+ /** 创建新GUID */
13
+ static NewGuid(): number;
14
+ static GetHash(key: string): number;
15
+ /** 创建GUID */
16
+ private static CreatGuid;
17
+ /** 获取一个唯一标识的字符串 */
18
+ static GetGUID(): string;
19
+ }
20
+ /** 时间工具 */
21
+ class Time {
22
+ /** 获取时间戳 */
23
+ static TimeStemp(): number;
24
+ /** 格式化时间 */
25
+ static CurTimeFormat(value?: number): string;
26
+ /** 时间日期(格式化) */
27
+ static TimeFormat(_time: string | number | Date, _format?: string): string;
28
+ /** 时间日期(格式化传入秒) */
29
+ static SecondsTimeFormat(_seconds: number): string;
30
+ /**
31
+ * 随时间变化进度值
32
+ * @param start 初始值
33
+ * @param end 结束值
34
+ * @param t 时间
35
+ */
36
+ static progress(start: number, end: number, t: number): number;
37
+ }
38
+ /** 时间类 */
39
+ class Timer {
40
+ /** 开始时间戳(ms) */
41
+ private _startTimeStemp;
42
+ /** 游戏帧间隔(ms) */
43
+ private _deltaTime;
44
+ /** 游戏帧率(ms) */
45
+ get frameRate(): number;
46
+ set frameRate(_value: number);
47
+ private _frameRate;
48
+ /** 逝去时间 */
49
+ get elapsedTime(): number;
50
+ private _elapsedTime;
51
+ /** 累积时间 */
52
+ get totalTime(): number;
53
+ private _totalTime;
54
+ /** 进度 */
55
+ get progress(): number;
56
+ /** 开始开关 */
57
+ private _switch;
58
+ /** 定时触发回调 */
59
+ Evt_Timeout: InterfaceUtility.IEvent;
60
+ /**
61
+ * 构造函数
62
+ * @param _frameRate 帧率
63
+ */
64
+ constructor(_frameRate: number);
65
+ /** 游戏引擎的cc.Component组件的update方法调用 */
66
+ update(_deltaTime: number): boolean;
67
+ /** 启动 */
68
+ OnLaunch(): void;
69
+ /** 重置 */
70
+ OnReset(): void;
71
+ /** 获取时间格式字符串 */
72
+ OnTimeFormat(): string;
73
+ }
74
+ /** 数学工具 */
75
+ class MathEx {
76
+ /** 种子 */
77
+ private static _seed;
78
+ /** 角度转弧度 */
79
+ private static Deg2Rad;
80
+ /** 弧度转角度 */
81
+ private static Rad2Deg;
82
+ /**
83
+ * 获得随机方向
84
+ * @param x -1为左,1为右
85
+ * @returns
86
+ */
87
+ static sign(x: number): 0 | 1 | -1;
88
+ /**
89
+ * 获得一个值的概率
90
+ * @param value 值
91
+ */
92
+ static probability(value: number): boolean;
93
+ /** 数字限制 */
94
+ static clamp(value: number, min: number, max: number): number;
95
+ /** 数字精度(保留一个数字的总有效数字位数,包括小数点前和小数点后的数字) */
96
+ static toPrecision(_value: number, _count: number): number;
97
+ /** 数字精度(保留一个数字的总有效数字位数,包括小数点前和小数点后的数字) */
98
+ static toFixed(_value: number, _count: number): number;
99
+ /** 计算m % n的欧氏模(https://en.wikipedia.org/wiki/Modulo_operation) */
100
+ static euclideanModulo(n: number, m: number): number;
101
+ /** 从range <a1, a2>到range <b1, b2>的线性映射 */
102
+ static mapLinear(x: number, a1: number, a2: number, b1: number, b2: number): number;
103
+ /** 逆向插值(https://www.gamedev.net/tutorials/programming/general-and-gameplay-programming/inverse-lerp-a-super-useful-yet-often-overlooked-function-r5230/) */
104
+ static inverseLerp(x: number, y: number, value: number): number;
105
+ /** 插值(https://en.wikipedia.org/wiki/Linear_interpolation) */
106
+ static lerp(x: number, y: number, t: number): number;
107
+ /**
108
+ * 角度插值
109
+ * @param angle1 角度1
110
+ * @param angle2 角度2
111
+ * @param t 时间
112
+ */
113
+ static lerpAngle(current: number, target: number, t: number): number;
114
+ /**
115
+ * 按一定的速度从一个角度转向令一个角度
116
+ * @param current 当前角度
117
+ * @param target 目标角度
118
+ * @param speed 速度
119
+ */
120
+ static angleTowards(current: number, target: number, speed: number): number;
121
+ /** 阻尼(http://www.rorydriscoll.com/2016/03/07/frame-rate-independent-damping-using-lerp/) */
122
+ static damp(x: number, y: number, lambda: number, dt: number): number;
123
+ /** 乒乓(https://www.desmos.com/calculator/vcsjnyz7x4) */
124
+ static pingpong(x: number, length?: number): number;
125
+ /** 缓动(http://en.wikipedia.org/wiki/Smoothstep) */
126
+ static smoothstep(x: number, min: number, max: number): number;
127
+ /** 缓动 */
128
+ static smootherstep(x: number, min: number, max: number): number;
129
+ /** 随机整数[最小、最大] */
130
+ static RandomInt(low: number, high: number): number;
131
+ /** 随机浮点数 */
132
+ static randFloat(low: number, high: number): number;
133
+ /** 随机区间浮点数<-range/2, range/2> */
134
+ static randFloatSpread(range: number): number;
135
+ /** 区间[0,1]的确定性伪随机浮点数 */
136
+ static SeededRandom(s: number): number;
137
+ /** 高精度随机种子随机数 [min, max] */
138
+ static HighRandom(min: number, max: number, _isInt?: boolean): number;
139
+ /** 角度转弧度 */
140
+ static degToRad(degrees: number): number;
141
+ /** 弧度转角度 */
142
+ static radToDeg(radians: number): number;
143
+ /** 检测数字是否是2的平方数 */
144
+ static isPowerOfTwo(value: number): boolean;
145
+ /** 向2的近似指数幂上趋近 */
146
+ static ceilPowerOfTwo(value: number): number;
147
+ /** 向2的近似指数幂下趋近 */
148
+ static floorPowerOfTwo(value: number): number;
149
+ /** 使非规一化 */
150
+ static denormalize(value: number, array: any): number;
151
+ /** 归一化 */
152
+ static normalize(value: number, array: any): number;
153
+ /** 值类型限制 */
154
+ static Clamp01(_value: number): number;
155
+ /** 值限制(包含最大最小值) */
156
+ static Clamp(_value: number, _minValue: number, _maxValue: number): number;
157
+ /** 产生多个随机整数(排序),包含下限值,但不包含上限值
158
+ * @params _minNumber 下限值
159
+ * @params _maxNumber 上限值
160
+ * @params _count 筛选数量
161
+ * @params _exclude 排除数据
162
+ */
163
+ static Randoms(_minNumber: number, _maxNumber: number, _count: number, _exclude?: number[]): number[];
164
+ /** 产生随机整数,包含下限值,但不包含上限值 */
165
+ static RandomCMin(_minNumber: number, _maxNumber: number): number;
166
+ /** 产生随机整数,包含下限值,也包含上限值 */
167
+ static RandomA(_minNumber: number, _maxNumber: number): number;
168
+ /** 产生随机整数,不包含下限值,但包含上限值 */
169
+ static RandomCMax(_minNumber: number, _maxNumber: number): number;
170
+ /** 产生随机整数,不包含下限值,也不包含上限值 */
171
+ static RandomN(_minNumber: number, _maxNumber: number): number;
172
+ /** 随机生成RGB值,每个颜色值在0 - 255之间 */
173
+ static RandomColor(): string;
174
+ /** 绝对值 */
175
+ static Abs(_number: number): number;
176
+ /** 取整函数:返回小于等于数字参数的最大整数,对数字进行下舍入 */
177
+ static FloorToInt(_value: number): number;
178
+ /** 取整函数:返回大于等于数字参数的最小整数,对数字进行上舍入 */
179
+ static CeilToInt(_value: number): number;
180
+ /** 取整函数:返回数字最接近的整数,四舍五入 */
181
+ static RoundToInt(_value: number): number;
182
+ }
183
+ /** 数组工具 */
184
+ class ArrayEx {
185
+ /**
186
+ * 数组交集
187
+ * @introduce 两个数组中共有元素集合
188
+ * @param _array1 A数组
189
+ * @param _array2 B数组
190
+ * @returns 交集数组
191
+ */
192
+ static Intersection<T>(_array1: Array<T>, _array2: Array<T>): Array<T>;
193
+ /**
194
+ * 数组并集
195
+ * @introduce 两个数组中所有有不同元素集合
196
+ * @param _array1 A数组
197
+ * @param _array2 B数组
198
+ * @returns 并集数组
199
+ */
200
+ static Union<T>(_array1: Array<T>, _array2: Array<T>): Array<T>;
201
+ /**
202
+ * 数组差集
203
+ * @introduce 第一个数组中有,第二个数组中没有的元素
204
+ * @param _array1 A数组
205
+ * @param _array2 B数组
206
+ * @returns 并集数组
207
+ */
208
+ static Difference<T>(_array1: Array<T>, _array2: Array<T>): Array<T>;
209
+ /**
210
+ * 数组补集
211
+ * @introduce 在全集中有但在指定数组中没有的元素。其中全集是指两个数组的并集
212
+ * @param _array1 A数组
213
+ * @param _array2 B数组
214
+ * @returns 补集数组
215
+ */
216
+ static Complement<T>(_array1: Array<T>, _array2: Array<T>): Array<T>;
217
+ /**
218
+ * 数组去重,并创建一个新数组返回
219
+ * @param arr 源数组
220
+ */
221
+ static NoRepeated(arr: any[]): any[];
222
+ /**
223
+ * 复制二维数组
224
+ * @param array 目标数组
225
+ */
226
+ static Copy2DArray(array: any[][]): any[][];
227
+ /**
228
+ * Fisher-Yates Shuffle 随机置乱算法
229
+ * @param array 目标数组
230
+ */
231
+ static FisherYatesShuffle(array: any[]): any[];
232
+ /**
233
+ * 混淆数组
234
+ * @param array 目标数组
235
+ */
236
+ static Confound(array: []): any[];
237
+ /**
238
+ * 数组扁平化
239
+ * @param array 目标数组
240
+ */
241
+ static Flattening(array: any[]): any[];
242
+ /** 删除数组中指定项 */
243
+ static RemoveItem(array: any[], item: any): void;
244
+ /**
245
+ * 合并数组
246
+ * @param array1 目标数组1
247
+ * @param array2 目标数组2
248
+ */
249
+ static CombineArrays(array1: any[], array2: any[]): any[];
250
+ /**
251
+ * 获取随机数组成员
252
+ * @param array 目标数组
253
+ */
254
+ static GetRandomValueInArray(array: any[]): any;
255
+ }
256
+ /** 颜色 */
257
+ class Color {
258
+ r: number;
259
+ g: number;
260
+ b: number;
261
+ a: number;
262
+ constructor(_r?: number, _g?: number, _b?: number, _a?: number);
263
+ /** 设置标量 */
264
+ SetScalar(_scalar: number): void;
265
+ /** 设置HEX */
266
+ SetHex(_hex: number): void;
267
+ /** 设置RGB */
268
+ SetRGB(_r: number, _g: number, _b: number): void;
269
+ /** 设置HSL */
270
+ SetHSL(_h: number, _s: number, _l: number): void;
271
+ private hue2rgb;
272
+ /** 克隆颜色 */
273
+ Clone(): Color;
274
+ /** 拷贝颜色 */
275
+ Copy(_color: Color): Color;
276
+ /** 将HEX颜色转换成RGB(0~1)颜色 */
277
+ static HEX2RGB(_hex: string): {
278
+ _r: number;
279
+ _g: number;
280
+ _b: number;
281
+ _a: number;
282
+ };
283
+ /** 将RGB(0~1)颜色转换成HEX颜色 */
284
+ static RGB2HEX(_r: number, _g: number, _b: number, _a: number): string;
285
+ }
286
+ /** 平面 */
287
+ class Plane {
288
+ /**
289
+ * Normal of the plane (a,b,c)
290
+ */
291
+ normal: Vector3;
292
+ /**
293
+ * d component of the plane
294
+ */
295
+ d: number;
296
+ /**
297
+ * Creates a Plane object according to the given floats a, b, c, d and the plane equation : ax + by + cz + d = 0
298
+ * @param a a component of the plane
299
+ * @param b b component of the plane
300
+ * @param c c component of the plane
301
+ * @param d d component of the plane
302
+ */
303
+ constructor(a: number, b: number, c: number, d: number);
304
+ /**
305
+ * @returns the plane coordinates as a new array of 4 elements [a, b, c, d].
306
+ */
307
+ asArray(): number[];
308
+ /**
309
+ * @returns a new plane copied from the current Plane.
310
+ */
311
+ clone(): Plane;
312
+ /**
313
+ * @returns the string "Plane".
314
+ */
315
+ getClassName(): string;
316
+ /**
317
+ * @returns the Plane hash code.
318
+ */
319
+ getHashCode(): number;
320
+ /**
321
+ * Normalize the current Plane in place.
322
+ * @returns the updated Plane.
323
+ */
324
+ normalize(): Plane;
325
+ /**
326
+ * Applies a transformation the plane and returns the result
327
+ * @param transformation the transformation matrix to be applied to the plane
328
+ * @returns a new Plane as the result of the transformation of the current Plane by the given matrix.
329
+ */
330
+ /**
331
+ * Compute the dot product between the point and the plane normal
332
+ * @param point point to calculate the dot product with
333
+ * @returns the dot product (float) of the point coordinates and the plane normal.
334
+ */
335
+ dotCoordinate(point: Vector3): number;
336
+ /**
337
+ * Updates the current Plane from the plane defined by the three given points.
338
+ * @param point1 one of the points used to construct the plane
339
+ * @param point2 one of the points used to construct the plane
340
+ * @param point3 one of the points used to construct the plane
341
+ * @returns the updated Plane.
342
+ */
343
+ copyFromPoints(point1: Vector3, point2: Vector3, point3: Vector3): Plane;
344
+ /**
345
+ * Checks if the plane is facing a given direction (meaning if the plane's normal is pointing in the opposite direction of the given vector).
346
+ * Note that for this function to work as expected you should make sure that:
347
+ * - direction and the plane normal are normalized
348
+ * - epsilon is a number just bigger than -1, something like -0.99 for eg
349
+ * @param direction the direction to check if the plane is facing
350
+ * @param epsilon value the dot product is compared against (returns true if dot <= epsilon)
351
+ * @returns True if the plane is facing the given direction
352
+ */
353
+ isFrontFacingTo(direction: Vector3, epsilon: number): boolean;
354
+ /**
355
+ * Calculates the distance to a point
356
+ * @param point point to calculate distance to
357
+ * @returns the signed distance (float) from the given point to the Plane.
358
+ */
359
+ signedDistanceTo(point: Vector3): number;
360
+ /**
361
+ * Creates a plane from an array
362
+ * @param array the array to create a plane from
363
+ * @returns a new Plane from the given array.
364
+ */
365
+ static FromArray(array: ArrayLike<number>): Plane;
366
+ /**
367
+ * Creates a plane from three points
368
+ * @param point1 point used to create the plane
369
+ * @param point2 point used to create the plane
370
+ * @param point3 point used to create the plane
371
+ * @returns a new Plane defined by the three given points.
372
+ */
373
+ static FromPoints(point1: Vector3, point2: Vector3, point3: Vector3): Plane;
374
+ /**
375
+ * Creates a plane from an origin point and a normal
376
+ * @param origin origin of the plane to be constructed
377
+ * @param normal normal of the plane to be constructed
378
+ * @returns a new Plane the normal vector to this plane at the given origin point.
379
+ * Note : the vector "normal" is updated because normalized.
380
+ */
381
+ static FromPositionAndNormal(origin: Vector3, normal: Vector3): Plane;
382
+ /**
383
+ * Calculates the distance from a plane and a point
384
+ * @param origin origin of the plane to be constructed
385
+ * @param normal normal of the plane to be constructed
386
+ * @param point point to calculate distance to
387
+ * @returns the signed distance between the plane defined by the normal vector at the "origin"" point and the given other point.
388
+ */
389
+ static SignedDistanceToPlaneFromPositionAndNormal(origin: Vector3, normal: Vector3, point: Vector3): number;
390
+ }
391
+ /** 二维向量 */
392
+ class Vector2 {
393
+ private static _ZeroReadOnly;
394
+ x: number;
395
+ y: number;
396
+ constructor(_x?: number, _y?: number);
397
+ toString(): string;
398
+ getHashCode(): number;
399
+ toArray(): number[];
400
+ fromArray(array: number[]): void;
401
+ copyFrom(source: Vector2): void;
402
+ set(x: number, y: number): void;
403
+ add(otherVector: Vector2): this;
404
+ addVector3(otherVector: Vector3): this;
405
+ subtract(otherVector: Vector2): this;
406
+ multiply(otherVector: Vector2): this;
407
+ multiplyByFloats(x: number, y: number): Vector2;
408
+ divide(otherVector: Vector2): this;
409
+ negate(): this;
410
+ scale(scale: number): this;
411
+ equals(otherVector: Vector2): boolean;
412
+ floor(): Vector2;
413
+ fract(): Vector2;
414
+ rotate(angle: number): Vector2;
415
+ length(): number;
416
+ lengthSquared(): number;
417
+ normalize(): this;
418
+ clone(): Vector2;
419
+ static Zero(): Vector2;
420
+ static One(): Vector2;
421
+ static Random(min?: number, max?: number): Vector2;
422
+ static get ZeroReadOnly(): Vector2;
423
+ static FromArray(array: ArrayLike<number>, offset?: number): Vector2;
424
+ static FromArrayToRef<T extends Vector2>(array: ArrayLike<number>, offset: number, result: T): T;
425
+ static CatmullRomVector2(value1: Vector2, value2: Vector2, value3: Vector2, value4: Vector2, amount: number): Vector2;
426
+ static Clamp(value: Vector2, min: Vector2, max: Vector2): Vector2;
427
+ static Hermite(value1: Vector2, tangent1: Vector2, value2: Vector2, tangent2: Vector2, amount: number): Vector2;
428
+ static Hermite1stDerivative(value1: Vector2, tangent1: Vector2, value2: Vector2, tangent2: Vector2, time: number): Vector2;
429
+ static Lerp(start: Vector2, end: Vector2, amount: number): Vector2;
430
+ static Dot(left: Vector2, right: Vector2): number;
431
+ static Normalize(vector: Vector2): Vector2;
432
+ static Minimize(left: Vector2, right: Vector2): Vector2;
433
+ static Maximize(left: Vector2, right: Vector2): Vector2;
434
+ static PointInTriangle(p: Vector2, p0: Vector2, p1: Vector2, p2: Vector2): boolean;
435
+ static Distance(value1: Vector2, value2: Vector2): number;
436
+ static DistanceSquared(value1: Vector2, value2: Vector2): number;
437
+ static Center(value1: Vector2, value2: Vector2): Vector2;
438
+ static DistanceOfPointFromSegment(p: Vector2, segA: Vector2, segB: Vector2): number;
439
+ }
440
+ /** 三维向量 */
441
+ class Vector3 {
442
+ private static _UpReadOnly;
443
+ private static _DownReadOnly;
444
+ private static _LeftHandedForwardReadOnly;
445
+ private static _RightHandedForwardReadOnly;
446
+ private static _LeftHandedBackwardReadOnly;
447
+ private static _RightHandedBackwardReadOnly;
448
+ private static _RightReadOnly;
449
+ private static _LeftReadOnly;
450
+ private static _ZeroReadOnly;
451
+ private _x;
452
+ private _y;
453
+ private _z;
454
+ private _isDirty;
455
+ get x(): number;
456
+ set x(value: number);
457
+ get y(): number;
458
+ set y(value: number);
459
+ get z(): number;
460
+ set z(value: number);
461
+ constructor(x?: number, y?: number, z?: number);
462
+ toString(): string;
463
+ getHashCode(): number;
464
+ asArray(): number[];
465
+ toArray(array: number[], index?: number): this;
466
+ fromArray(array: ArrayLike<number>, offset: number): this;
467
+ add(otherVector: Vector3): this;
468
+ addFromFloats(x: number, y: number, z: number): this;
469
+ addToRef(otherVector: Vector3): Vector3;
470
+ subtract(otherVector: Vector3): this;
471
+ subtractToRef(otherVector: Vector3): Vector3;
472
+ subtractFromFloats(x: number, y: number, z: number): this;
473
+ negate(): this;
474
+ scale(scale: number): this;
475
+ scaleToRef(scale: number): Vector3;
476
+ getNormalToRef(): Vector3;
477
+ projectOnPlane(plane: Plane, origin: Vector3): Vector3;
478
+ equals(otherVector: Vector3): boolean;
479
+ equalsToFloats(x: number, y: number, z: number): boolean;
480
+ multiplyInPlace(otherVector: Vector3): this;
481
+ multiply(otherVector: Vector3): Vector3;
482
+ multiplyToRef(otherVector: Vector3): Vector3;
483
+ multiplyByFloats(x: number, y: number, z: number): Vector3;
484
+ divide(otherVector: Vector3): Vector3;
485
+ divideToRef(otherVector: Vector3): Vector3;
486
+ divideInPlace(otherVector: Vector3): Vector3;
487
+ minimizeInPlace(other: Vector3): this;
488
+ maximizeInPlace(other: Vector3): this;
489
+ minimizeInPlaceFromFloats(x: number, y: number, z: number): this;
490
+ maximizeInPlaceFromFloats(x: number, y: number, z: number): this;
491
+ get isNonUniform(): boolean;
492
+ floor(): Vector3;
493
+ fract(): Vector3;
494
+ length(): number;
495
+ lengthSquared(): number;
496
+ get hasAZeroComponent(): boolean;
497
+ normalize(): this;
498
+ cross(other: Vector3): Vector3;
499
+ normalizeFromLength(len: number): this;
500
+ normalizeToNew(): Vector3;
501
+ normalizeToRef(): Vector3;
502
+ clone(): Vector3;
503
+ copyFrom(source: Vector3): this;
504
+ copyFromFloats(x: number, y: number, z: number): this;
505
+ set(x: number, y: number, z: number): this;
506
+ setAll(v: number): this;
507
+ static GetClipFactor(vector0: Vector3, vector1: Vector3, axis: Vector3, size: number): number;
508
+ static GetAngleBetweenVectors(vector0: Vector3, vector1: Vector3, normal: Vector3): number;
509
+ static GetAngleBetweenVectorsOnPlane(vector0: Vector3, vector1: Vector3, normal: Vector3): number;
510
+ static PitchYawRollToMoveBetweenPointsToRef(start: Vector3, target: Vector3): Vector3;
511
+ static PitchYawRollToMoveBetweenPoints(start: Vector3, target: Vector3): Vector3;
512
+ static SlerpToRef(vector0: Vector3, vector1: Vector3, slerp: number): Vector3;
513
+ static SmoothToRef<T extends Vector3 = Vector3>(source: Vector3, goal: Vector3, deltaTime: number, lerpTime: number): Vector3;
514
+ static FromArray(array: ArrayLike<number>, offset?: number): Vector3;
515
+ static FromFloatArray(array: Float32Array, offset?: number): Vector3;
516
+ static FromArrayToRef(array: ArrayLike<number>, offset: number): Vector3;
517
+ static FromFloatArrayToRef(array: Float32Array, offset: number): Vector3;
518
+ static FromFloatsToRef(x: number, y: number, z: number): Vector3;
519
+ static Zero(): Vector3;
520
+ static One(): Vector3;
521
+ static Up(): Vector3;
522
+ static get UpReadOnly(): Vector3;
523
+ static get DownReadOnly(): Vector3;
524
+ static get RightReadOnly(): Vector3;
525
+ static get LeftReadOnly(): Vector3;
526
+ static get LeftHandedForwardReadOnly(): Vector3;
527
+ static get RightHandedForwardReadOnly(): Vector3;
528
+ static get LeftHandedBackwardReadOnly(): Vector3;
529
+ static get RightHandedBackwardReadOnly(): Vector3;
530
+ static get ZeroReadOnly(): Vector3;
531
+ static Down(): Vector3;
532
+ static Forward(rightHandedSystem?: boolean): Vector3;
533
+ static Backward(rightHandedSystem?: boolean): Vector3;
534
+ static Right(): Vector3;
535
+ static Left(): Vector3;
536
+ static Random(min?: number, max?: number): Vector3;
537
+ static CatmullRom(value1: Vector3, value2: Vector3, value3: Vector3, value4: Vector3, amount: number): Vector3;
538
+ static Clamp(value: Vector3, min: Vector3, max: Vector3): Vector3;
539
+ static ClampToRef(value: Vector3, min: Vector3, max: Vector3): Vector3;
540
+ static CheckExtends(v: Vector3, min: Vector3, max: Vector3): void;
541
+ static Hermite(value1: Vector3, tangent1: Vector3, value2: Vector3, tangent2: Vector3, amount: number): Vector3;
542
+ static Hermite1stDerivative(value1: Vector3, tangent1: Vector3, value2: Vector3, tangent2: Vector3, time: number): Vector3;
543
+ static Hermite1stDerivativeToRef(value1: Vector3, tangent1: Vector3, value2: Vector3, tangent2: Vector3, time: number): Vector3;
544
+ static Lerp(start: Vector3, end: Vector3, amount: number): Vector3;
545
+ static LerpToRef(start: Vector3, end: Vector3, amount: number): Vector3;
546
+ static Dot(left: Vector3, right: Vector3): number;
547
+ static Cross(left: Vector3, right: Vector3): Vector3;
548
+ static CrossToRef(left: Vector3, right: Vector3): Vector3;
549
+ static Normalize(vector: Vector3): Vector3;
550
+ static NormalizeToRef(vector: Vector3): Vector3;
551
+ static Reflect(inDirection: Vector3, normal: Vector3): Vector3;
552
+ static ReflectToRef(inDirection: Vector3, normal: Vector3): Vector3;
553
+ static Distance(value1: Vector3, value2: Vector3): number;
554
+ static DistanceSquared(value1: Vector3, value2: Vector3): number;
555
+ static ProjectOnTriangleToRef(vector: Vector3, p0: Vector3, p1: Vector3, p2: Vector3, ref: Vector3): number;
556
+ static Center(value1: Vector3, value2: Vector3): Vector3;
557
+ static CenterToRef(value1: Vector3, value2: Vector3): Vector3;
558
+ }
559
+ }