@galacean/effects-plugin-model 1.0.0 → 1.1.0-alpha.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.
Files changed (40) hide show
  1. package/dist/gesture/index.d.ts +10 -10
  2. package/dist/gesture/protocol.d.ts +10 -10
  3. package/dist/gltf/loader-helper.d.ts +4 -2
  4. package/dist/index.d.ts +0 -1
  5. package/dist/index.js +291 -6275
  6. package/dist/index.js.map +1 -1
  7. package/dist/index.min.js +2 -2
  8. package/dist/index.mjs +289 -6263
  9. package/dist/index.mjs.map +1 -1
  10. package/dist/loader.mjs +110 -5941
  11. package/dist/loader.mjs.map +1 -1
  12. package/dist/plugin/model-tree-vfx-item.d.ts +2 -2
  13. package/dist/plugin/model-vfx-item.d.ts +5 -2
  14. package/dist/runtime/animation.d.ts +1 -1
  15. package/dist/runtime/camera.d.ts +6 -3
  16. package/dist/runtime/common.d.ts +5 -2
  17. package/dist/runtime/light.d.ts +1 -1
  18. package/dist/runtime/material.d.ts +1 -1
  19. package/dist/runtime/math.d.ts +8 -0
  20. package/dist/runtime/mesh.d.ts +6 -4
  21. package/dist/runtime/object.d.ts +4 -2
  22. package/dist/runtime/scene.d.ts +7 -5
  23. package/dist/runtime/shadow.d.ts +4 -1
  24. package/dist/utility/hit-test-helper.d.ts +5 -3
  25. package/dist/utility/plugin-helper.d.ts +6 -6
  26. package/dist/utility/ri-helper.d.ts +2 -2
  27. package/package.json +4 -4
  28. package/dist/math/box3.d.ts +0 -140
  29. package/dist/math/euler.d.ts +0 -139
  30. package/dist/math/index.d.ts +0 -11
  31. package/dist/math/matrix2.d.ts +0 -58
  32. package/dist/math/matrix3.d.ts +0 -113
  33. package/dist/math/matrix4.d.ts +0 -264
  34. package/dist/math/quaternion.d.ts +0 -214
  35. package/dist/math/sphere.d.ts +0 -81
  36. package/dist/math/type.d.ts +0 -29
  37. package/dist/math/utilities/index.d.ts +0 -9
  38. package/dist/math/vector2.d.ts +0 -394
  39. package/dist/math/vector3.d.ts +0 -164
  40. package/dist/math/vector4.d.ts +0 -132
@@ -1,11 +0,0 @@
1
- export * from './type';
2
- export * from './vector2';
3
- export * from './vector3';
4
- export * from './vector4';
5
- export * from './matrix2';
6
- export * from './matrix3';
7
- export * from './matrix4';
8
- export * from './quaternion';
9
- export * from './euler';
10
- export * from './box3';
11
- export * from './sphere';
@@ -1,58 +0,0 @@
1
- import type { Mat2DataType } from './type';
2
- import { Vector2 } from './vector2';
3
- /**
4
- * 2x2 矩阵内部按照列主序存储数据
5
- */
6
- declare class Matrix2 {
7
- private _data;
8
- /**
9
- * 按照行主序传入矩阵数据
10
- * @param column0Row0 - 第0行0列
11
- * @param column1Row0 - 第0行1列
12
- * @param column0Row1
13
- * @param column1Row1
14
- */
15
- constructor(column0Row0?: number, column1Row0?: number, column0Row1?: number, column1Row1?: number);
16
- getData(): Float32Array;
17
- static pack(value: Matrix2, array: Mat2DataType, startingIndex?: number): Mat2DataType;
18
- static unpack(array: Mat2DataType, startingIndex: number, result: Matrix2): Matrix2;
19
- static packArray(array: Matrix2[], result: Mat2DataType): Mat2DataType;
20
- static unpackArray(array: Mat2DataType, result: Matrix2[]): Matrix2[];
21
- static clone(matrix: Matrix2): Matrix2;
22
- static fromArray(array: Mat2DataType): Matrix2;
23
- static fromColumnMajorArray(values: Mat2DataType, result: Matrix2): Matrix2;
24
- static fromRowMajorArray(values: Mat2DataType, result: Matrix2): Matrix2;
25
- static fromScale(scale: Vector2, result: Matrix2): Matrix2;
26
- static fromUniformScale(scale: number, result: Matrix2): Matrix2;
27
- static fromRotation(angle: number, result: Matrix2): Matrix2;
28
- static toArray(matrix: Matrix2, result: Mat2DataType): Mat2DataType;
29
- static getElement(matrix: Matrix2, column: number, row: number): number;
30
- static getColumn(matrix: Matrix2, index: number, result: Vector2): Vector2;
31
- static setColumn(matrix: Matrix2, index: number, cartesian: Vector2, result: Matrix2): Matrix2;
32
- static getRow(matrix: Matrix2, index: number, result?: Vector2): Vector2;
33
- static setRow(matrix: Matrix2, index: number, cartesian: Vector2, result: Matrix2): Matrix2;
34
- static scale(matrix: Matrix2, scale: Vector2, result?: Matrix2): Matrix2;
35
- static setUniformScale(matrix: Matrix2, scale: number, result?: Matrix2): Matrix2;
36
- static getScale(matrix: Matrix2, result: Vector2): Vector2;
37
- static getMaximumScale(matrix: Matrix2): number;
38
- static setRotation(matrix: Matrix2, rotation: Matrix2, result: Matrix2): Matrix2;
39
- static getRotation(matrix: Matrix2, result: Matrix2): Matrix2;
40
- static multiply(left: Matrix2, right: Matrix2, result: Matrix2): Matrix2;
41
- static add(left: Matrix2, right: Matrix2, result: Matrix2): Matrix2;
42
- static subtract(left: Matrix2, right: Matrix2, result: Matrix2): Matrix2;
43
- static multiplyByVector(matrix: Matrix2, cartesian: Vector2, result: Vector2): Vector2;
44
- static multiplyByScalar(matrix: Matrix2, scalar: number, result: Matrix2): Matrix2;
45
- static multiplyByScale(matrix: Matrix2, scale: Vector2, result: Matrix2): Matrix2;
46
- static multiplyByUniformScale(matrix: Matrix2, scale: number, result: Matrix2): Matrix2;
47
- static negate(matrix: Matrix2, result: Matrix2): Matrix2;
48
- static transpose(matrix: Matrix2, result: Matrix2): Matrix2;
49
- static abs(matrix: Matrix2, result: Matrix2): Matrix2;
50
- static equals(left: Matrix2, right: Matrix2): boolean;
51
- static equalsArray(matrix: Matrix2, array: Mat2DataType, offset?: number): boolean;
52
- static equalsEpsilon(left: Matrix2, right: Matrix2, epsilon: number): boolean;
53
- copyTo(result: Matrix2): Matrix2;
54
- copyFrom(source: Matrix2): this;
55
- static IDENTITY: Readonly<Matrix2>;
56
- static ZERO: Readonly<Matrix2>;
57
- }
58
- export { Matrix2 };
@@ -1,113 +0,0 @@
1
- import { Vector3 } from './vector3';
2
- import type { Quaternion } from './quaternion';
3
- import type { Mat3DataType } from './type';
4
- declare class Matrix3 {
5
- private _data;
6
- constructor(column0Row0?: number, column1Row0?: number, column2Row0?: number, column0Row1?: number, column1Row1?: number, column2Row1?: number, column0Row2?: number, column1Row2?: number, column2Row2?: number);
7
- getData(): Float32Array;
8
- static pack(value: Matrix3, array: Mat3DataType, startingIndex?: number): Mat3DataType;
9
- static unpack(array: Mat3DataType, startingIndex: number, result: Matrix3): Matrix3;
10
- static packArray(array: Matrix3[], result: Mat3DataType): Mat3DataType;
11
- static unpackArray(array: Mat3DataType, result: Matrix3[]): Matrix3[];
12
- static clone(matrix: Matrix3): Matrix3;
13
- static copyTo(matrix: Matrix3, result: Matrix3): Matrix3;
14
- static fromArray(array: Mat3DataType): Matrix3;
15
- static fromColumnMajorArray(values: Mat3DataType, result: Matrix3): Matrix3;
16
- static fromRowMajorArray(values: Mat3DataType, result: Matrix3): Matrix3;
17
- static fromQuaternion(quaternion: Quaternion, result: Matrix3): Matrix3;
18
- static fromHeadingPitchRoll(headingPitchRoll: {
19
- heading: number;
20
- pitch: number;
21
- roll: number;
22
- }, result: Matrix3): Matrix3;
23
- static fromScale(scale: Vector3, result: Matrix3): Matrix3;
24
- static fromUniformScale(scale: number, result: Matrix3): Matrix3;
25
- static fromCrossProduct(vector: Vector3, result: Matrix3): Matrix3;
26
- static fromRotationX(angle: number, result: Matrix3): Matrix3;
27
- static fromRotationY(angle: number, result: Matrix3): Matrix3;
28
- static fromRotationZ(angle: number, result: Matrix3): Matrix3;
29
- static toArray(matrix: Matrix3, result: Mat3DataType): Mat3DataType;
30
- static getElement(matrix: Matrix3, column: number, row: number): number;
31
- static getColumn(matrix: Matrix3, index: number, result: Vector3): Vector3;
32
- static setColumn(matrix: Matrix3, index: number, cartesian: Vector3, result: Matrix3): Matrix3;
33
- static getRow(matrix: Matrix3, index: number, result: Vector3): Vector3;
34
- static setRow(matrix: Matrix3, index: number, cartesian: Vector3, result: Matrix3): Matrix3;
35
- static scale(matrix: Matrix3, scale: Vector3, result: Matrix3): Matrix3;
36
- static setUniformScale(matrix: Matrix3, scale: number, result: Matrix3): Matrix3;
37
- static getScale(matrix: Matrix3, result: Vector3): Vector3;
38
- static getMaximumScale(matrix: Matrix3): number;
39
- static setRotation(matrix: Matrix3, rotation: Matrix3, result: Matrix3): Matrix3;
40
- static getRotation(matrix: Matrix3, result: Matrix3): Matrix3;
41
- static multiply(left: Matrix3, right: Matrix3, result: Matrix3): Matrix3;
42
- static add(left: Matrix3, right: Matrix3, result: Matrix3): Matrix3;
43
- static subtract(left: Matrix3, right: Matrix3, result: Matrix3): Matrix3;
44
- static multiplyByVector(matrix: Matrix3, cartesian: Vector3, result: Vector3): Vector3;
45
- static multiplyByScalar(matrix: Matrix3, scalar: number, result: Matrix3): Matrix3;
46
- static multiplyByScale(matrix: Matrix3, scale: Vector3, result: Matrix3): Matrix3;
47
- static multiplyByUniformScale(matrix: Matrix3, scale: number, result: Matrix3): Matrix3;
48
- static negate(matrix: Matrix3, result: Matrix3): Matrix3;
49
- static transpose(matrix: Matrix3, result: Matrix3): Matrix3;
50
- static abs(matrix: Matrix3, result: Matrix3): Matrix3;
51
- static determinant(matrix: Matrix3): number;
52
- static inverse(matrix: Matrix3, result: Matrix3): Matrix3;
53
- static inverseTranspose(matrix: Matrix3, result: Matrix3): Matrix3;
54
- static equals(left: Matrix3, right: Matrix3): boolean;
55
- static equalsEpsilon(left: Matrix3, right: Matrix3, epsilon: number): boolean;
56
- static getElementIndex(column: number, row: number): number;
57
- getElement(column: number, row: number): number;
58
- clone(): Matrix3;
59
- copyTo(result: Matrix3): Matrix3;
60
- copyFrom(source: Matrix3): this;
61
- scale(vector: Vector3): Matrix3;
62
- multiply(matrix: Matrix3): Matrix3;
63
- /**
64
- * 将矩阵数据按照列主序导出为number[]对象。
65
- * @returns
66
- */
67
- toArray(): number[];
68
- /**
69
- * 将矩阵按照列主序方式导出为Float32Array对象。
70
- * @returns
71
- */
72
- toFloat32Array(): Float32Array;
73
- /**
74
- * 矩阵与四维向量相乘。
75
- * @param vector
76
- * @returns
77
- */
78
- multiplyByVector3(vector: Vector3): Vector3;
79
- /**
80
- * 返回矩阵中指定索引位置数据
81
- * @param index
82
- * @returns
83
- */
84
- at(index: number): number;
85
- /**
86
- * 矩阵乘一个旋转矩阵,矩阵乘一个绕axis轴旋转angle角度的旋转矩阵
87
- * @param angle
88
- * @param axis
89
- * @returns
90
- */
91
- rotate(angle: number, axis: Vector3): Matrix3 | undefined;
92
- /**
93
- * 计算矩阵的逆矩阵,会修改矩阵数据
94
- */
95
- inverse(): Matrix3;
96
- /**
97
- * 计算矩阵的转置,结果保存在原矩阵中(会修改矩阵数据)
98
- * @returns
99
- */
100
- transpose(): Matrix3;
101
- static IDENTITY: Readonly<Matrix3>;
102
- static ZERO: Readonly<Matrix3>;
103
- static COLUMN0ROW0: number;
104
- static COLUMN0ROW1: number;
105
- static COLUMN0ROW2: number;
106
- static COLUMN1ROW0: number;
107
- static COLUMN1ROW1: number;
108
- static COLUMN1ROW2: number;
109
- static COLUMN2ROW0: number;
110
- static COLUMN2ROW1: number;
111
- static COLUMN2ROW2: number;
112
- }
113
- export { Matrix3 };
@@ -1,264 +0,0 @@
1
- import { Vector3 } from './vector3';
2
- import { Vector4 } from './vector4';
3
- import { Matrix3 } from './matrix3';
4
- import { Quaternion } from './quaternion';
5
- import type { Mat4DataType } from './type';
6
- /**
7
- * 表示一个 4x4 矩阵
8
- */
9
- declare class Matrix4 {
10
- private _data;
11
- constructor(column0Row0?: number, column1Row0?: number, column2Row0?: number, column3Row0?: number, column0Row1?: number, column1Row1?: number, column2Row1?: number, column3Row1?: number, column0Row2?: number, column1Row2?: number, column2Row2?: number, column3Row2?: number, column0Row3?: number, column1Row3?: number, column2Row3?: number, column3Row3?: number);
12
- /**
13
- * 获取矩阵内部存储数据的Float32Array对象。
14
- * @returns
15
- */
16
- getData(): Float32Array;
17
- setData(data: Float32Array): void;
18
- get data(): Float32Array;
19
- lookAt(position: Vector3, target: Vector3, up: Vector3): Matrix4;
20
- perspective(fovY: number, aspect: number, near: number, far: number, reverse: boolean): Matrix4;
21
- orth2d(left: number, right: number, bottom: number, top: number, near: number, far: number): Matrix4;
22
- compose(translation: Vector3, rotation: Quaternion, scale: Vector3): Matrix4;
23
- decompose(): {
24
- translation: Vector3;
25
- rotation: Quaternion;
26
- scale: Vector3;
27
- };
28
- multiplyByPoint3(result: Vector3): Vector3;
29
- setZero(): void;
30
- setIdentity(): void;
31
- /**
32
- * 打包矩阵数据,将矩阵内部数据从数组指定索引位置打包到数组中。
33
- * @param value
34
- * @param array
35
- * @param startingIndex
36
- * @returns
37
- */
38
- static pack(value: Matrix4, array: Mat4DataType, startingIndex?: number): Mat4DataType;
39
- /**
40
- * 解包矩阵数据,从数组指定索引位置开始解包矩阵数据。
41
- * @param array
42
- * @param startingIndex
43
- * @param result
44
- * @returns
45
- */
46
- static unpack(array: Mat4DataType, startingIndex: number, result: Matrix4): Matrix4;
47
- static packArray(array: Matrix4[], result: Mat4DataType): Mat4DataType;
48
- static unpackArray(array: Mat4DataType, result: Matrix4[]): Matrix4[];
49
- static clone(matrix: Matrix4 | Readonly<Matrix4>): Matrix4;
50
- static copyTo(matrix: Matrix4, result: Matrix4): Matrix4;
51
- static fromArray(array: Mat4DataType): Matrix4;
52
- static fromColumnMajorArray(values: Mat4DataType, result: Matrix4): Matrix4;
53
- static fromRowMajorArray(values: Mat4DataType, result: Matrix4): Matrix4;
54
- static fromRotationTranslation(rotation: Matrix3 | Readonly<Matrix3>, translation: Vector3, result: Matrix4): Matrix4;
55
- static fromTranslationQuaternionRotationScale(translation: Vector3, rotation: Quaternion, scale: Vector3, result: Matrix4): Matrix4;
56
- static fromTranslationRotationScale(translationRotationScale: {
57
- translation: Vector3;
58
- rotation: Quaternion;
59
- scale: Vector3;
60
- }, result: Matrix4): Matrix4;
61
- static fromTranslation(translation: Vector3, result: Matrix4): Matrix4;
62
- static fromScale(scale: Vector3, result: Matrix4): Matrix4;
63
- static fromUniformScale(scale: number, result: Matrix4): Matrix4;
64
- static fromRotation(rotation: Matrix3, result: Matrix4): Matrix4;
65
- static fromCamera(camera: {
66
- position: Vector3;
67
- direction: Vector3;
68
- up: Vector3;
69
- }, result: Matrix4): Matrix4;
70
- static computePerspectiveFieldOfView(fov: number, aspectRatio: number, near: number, far: number, reverse: boolean, result: Matrix4): Matrix4;
71
- static computeOrthographicOffCenter(left: number, right: number, bottom: number, top: number, near: number, far: number, result: Matrix4): Matrix4;
72
- static computePerspectiveOffCenter(left: number, right: number, bottom: number, top: number, near: number, far: number, result: Matrix4): Matrix4;
73
- static computeInfinitePerspectiveOffCenter(left: number, right: number, bottom: number, top: number, near: number, result: Matrix4): Matrix4;
74
- static computeViewportTransformation(viewport: {
75
- x: number;
76
- y: number;
77
- width: number;
78
- height: number;
79
- }, nearDepthRange: number, farDepthRange: number, result: Matrix4): Matrix4;
80
- static computeView(position: Vector3, direction: Vector3, up: Vector3, right: Vector3, result: Matrix4): Matrix4;
81
- static toArray(matrix: Matrix4, result: Mat4DataType): Mat4DataType;
82
- static getElement(matrix: Matrix4, column: number, row: number): number;
83
- static getColumn(matrix: Matrix4, index: number, result: Vector4): Vector4;
84
- static setColumn(matrix: Matrix4, index: number, cartesian: Vector4, result: Matrix4): Matrix4;
85
- static getRow(matrix: Matrix4, index: number, result: Vector4): Vector4;
86
- static setRow(matrix: Matrix4, index: number, cartesian: Vector4, result: Matrix4): Matrix4;
87
- static setTranslation(matrix: Matrix4, translation: Vector3, result: Matrix4): Matrix4;
88
- static scale(matrix: Matrix4, scale: Vector3, result: Matrix4): Matrix4;
89
- static setUniformScale(matrix: Matrix4, scale: number, result: Matrix4): Matrix4;
90
- static getScale(matrix: Matrix4, result: Vector3): Vector3;
91
- static getMaximumScale(matrix: Matrix4): number;
92
- static setRotation(matrix: Matrix4, rotation: Matrix4, result: Matrix4): Matrix4;
93
- static getRotation(matrix: Matrix4, result: Matrix4): Matrix4;
94
- static getRotationMatrix3(matrix: Matrix4, result: Matrix3): Matrix3;
95
- static getRotationQuaternion(matrix: Matrix4, result: Quaternion): Quaternion;
96
- static multiply(leftM: Matrix4, rightM: Matrix4, result: Matrix4): Matrix4;
97
- static mulScalerAddMatrix(leftM: Matrix4, rightM: Matrix4, rightS: number, result: Matrix4): Matrix4;
98
- static add(left: Matrix4, right: Matrix4, result: Matrix4): Matrix4;
99
- static subtract(left: Matrix4, right: Matrix4, result: Matrix4): Matrix4;
100
- static multiplyTransformation(leftM: Matrix4, rightM: Matrix4, result: Matrix4): Matrix4;
101
- static multiplyByMatrix3(matrix: Matrix4, rotation: Matrix3, result: Matrix4): Matrix4;
102
- static multiplyByTranslation(matrix: Matrix4, translation: Vector3, result: Matrix4): Matrix4;
103
- static multiplyByScale(matrix: Matrix4, scale: Vector3, result: Matrix4): Matrix4;
104
- static multiplyByUniformScale(matrix: Matrix4, scale: number, result: Matrix4): Matrix4;
105
- static multiplyByVector(matrix: Matrix4, cartesian: Vector4, result: Vector4): Vector4;
106
- static multiplyByPointAsVector(matrix: Matrix4, cartesian: Vector3, result: Vector3): Vector3;
107
- /**
108
- * 矩阵与三维点/向量相乘,三维点/向量第四个分量 W 为 1 处理
109
- * @param matrix
110
- * @param cartesian
111
- * @param result
112
- * @returns
113
- */
114
- static multiplyByPoint(matrix: Matrix4, cartesian: Vector3, result: Vector3): Vector3;
115
- static multiplyByScalar(matrix: Matrix4, scalar: number, result: Matrix4): Matrix4;
116
- static negate(matrix: Matrix4, result: Matrix4): Matrix4;
117
- static transpose(matrix: Matrix4, result: Matrix4): Matrix4;
118
- static abs(matrix: Matrix4, result: Matrix4): Matrix4;
119
- static equals(left: Matrix4, right: Matrix4): boolean;
120
- static equalsEpsilon(left: Matrix4, right: Matrix4, epsilon: number): boolean;
121
- static getTranslation(matrix: Matrix4, result: Vector3): Vector3;
122
- static getMatrix3(matrix: Matrix4, result: Matrix3): Matrix3;
123
- static inverse(matrix: Matrix4, result: Matrix4): Matrix4;
124
- static inverseTransformation(matrix: Matrix4, result: Matrix4): Matrix4;
125
- static inverseTranspose(matrix: Matrix4, result: Matrix4): Matrix4;
126
- static equalsArray(matrix: Matrix4, array: Mat4DataType, offset?: number): boolean;
127
- determinant(): number;
128
- /**
129
- * 分解矩阵,将矩阵分解为平移、旋转、缩放三部分
130
- * @param m - 待分解的矩阵
131
- * @returns
132
- */
133
- static decompose(m: Matrix4): {
134
- translation: Vector3;
135
- rotation: Quaternion;
136
- scale: Vector3;
137
- };
138
- /**
139
- * 从平移、旋转、缩放合成一个新变换矩阵
140
- * @param translation - 平移向量
141
- * @param rotation - 旋转量,使用四元数表示
142
- * @param scale - 缩放向量
143
- * @returns
144
- */
145
- static compose(translation: Vector3, rotation: Quaternion, scale: Vector3, result: Matrix4): Matrix4;
146
- /**
147
- * 计算透视投影矩阵
148
- * @param fovY
149
- * @param aspect
150
- * @param near
151
- * @param far
152
- * @returns
153
- */
154
- static computePerspective(fovY: number, aspect: number, near: number, far: number, reverse: boolean, result: Matrix4): Matrix4;
155
- /**
156
- * 计算正交投影矩阵
157
- * @param left
158
- * @param right
159
- * @param bottom
160
- * @param top
161
- * @param near
162
- * @param far
163
- * @param result
164
- * @returns
165
- */
166
- static computeOrthographic(left: number, right: number, bottom: number, top: number, near: number, far: number, result: Matrix4): Matrix4;
167
- /**
168
- * 通过 LookAt 参数计算相机的视图矩阵
169
- * @param position
170
- * @param target
171
- * @param up
172
- * @param result
173
- * @returns
174
- */
175
- static computeLookAt(position: Vector3, target: Vector3, up: Vector3, result: Matrix4): Matrix4;
176
- /**
177
- * 使用矩阵内部数据构造一个新矩阵
178
- * @returns
179
- */
180
- clone(): Matrix4;
181
- /**
182
- * 将矩阵数据拷贝到 result 中
183
- * @param result
184
- * @returns
185
- */
186
- copyTo(result: Matrix4): Matrix4;
187
- /**
188
- * 将矩阵数据从 source 拷贝回来
189
- * @param source
190
- * @returns
191
- */
192
- copyFrom(source: Matrix4): this;
193
- /**
194
- * 平移矩阵,相当于该矩阵与使用 vector 构造的平移矩阵相乘
195
- * @param vector
196
- * @returns 🎯计算结果将保存在调用矩阵中,并作为函数返回值返回。
197
- */
198
- translate(vector: Vector3): Matrix4;
199
- /**
200
- * 使用 vector 缩放矩阵,相当于该矩阵与使用 vector 构造的缩放矩阵相乘。
201
- * @param vector
202
- * @returns 🎯计算结果将保存在调用矩阵中,并作为函数返回值返回。
203
- */
204
- scale(vector: Vector3): Matrix4;
205
- /**
206
- * 计算矩阵与输入矩阵相乘的结果。
207
- * @param matrix
208
- * @returns 🎯计算结果将保存在调用矩阵中,并作为函数返回值返回。
209
- */
210
- multiply(matrix: Matrix4): Matrix4;
211
- /**
212
- * 将矩阵数据按照列主序导出为 number[] 对象。
213
- * @returns
214
- */
215
- toArray(): number[];
216
- /**
217
- * 将矩阵按照列主序方式导出为 Float32Array 对象。
218
- * @returns
219
- */
220
- toFloat32Array(): Float32Array;
221
- /**
222
- * 矩阵与四维向量相乘。
223
- * @param vector
224
- * @returns
225
- */
226
- multiplyByVector4(vector: Vector4): Vector4;
227
- /**
228
- * 矩阵与三维向量相乘,内部将三维向量第四个分量当作 1 来处理。
229
- * @param vector
230
- * @returns
231
- */
232
- multiplyByVector3(vector: Vector3): Vector3;
233
- /**
234
- * 返回矩阵中指定索引位置数据
235
- * @param index
236
- * @returns
237
- */
238
- at(index: number): number;
239
- /**
240
- * 矩阵乘一个旋转矩阵,矩阵乘一个绕 axis 轴旋转 angle 角度的旋转矩阵
241
- * @param angle
242
- * @param axis
243
- * @returns
244
- */
245
- rotate(angle: number, axis: Vector3): Matrix4 | undefined;
246
- /**
247
- * 计算矩阵的逆矩阵,会修改矩阵数据
248
- */
249
- inverse(): Matrix4;
250
- /**
251
- * 计算矩阵的转置,结果保存在原矩阵中(会修改矩阵数据)
252
- * @returns
253
- */
254
- transpose(): Matrix4;
255
- /**
256
- * 4x4 单位矩阵
257
- */
258
- static IDENTITY: Readonly<Matrix4>;
259
- /**
260
- * 数据都为 0 的矩阵
261
- */
262
- static ZERO: Readonly<Matrix4>;
263
- }
264
- export { Matrix4 };
@@ -1,214 +0,0 @@
1
- import { Matrix4 } from './matrix4';
2
- import { Matrix3 } from './matrix3';
3
- import type { Vec4DataType } from './type';
4
- import { Vector3 } from './vector3';
5
- import type { Euler } from './euler';
6
- /**
7
- * 使用四元数表示一个旋转
8
- */
9
- declare class Quaternion {
10
- private _data;
11
- constructor(x?: number, y?: number, z?: number, w?: number);
12
- get x(): number;
13
- set x(value: number);
14
- getX(): number;
15
- setX(value: number): void;
16
- get y(): number;
17
- set y(value: number);
18
- getY(): number;
19
- setY(value: number): void;
20
- get z(): number;
21
- set z(value: number);
22
- getZ(): number;
23
- setZ(value: number): void;
24
- get w(): number;
25
- set w(value: number);
26
- getW(): number;
27
- setW(value: number): void;
28
- /**
29
- * 构造一个四元素表示绕 axis 轴旋转 angle 角度
30
- * @param axis
31
- * @param angle
32
- * @param result
33
- * @returns
34
- */
35
- static fromAxisAngle(axis: Vector3 | Readonly<Vector3>, angle: number, result: Quaternion): Quaternion;
36
- /**
37
- * 从旋转矩阵构造一个四元数
38
- * @param matrix
39
- * @param result
40
- * @returns
41
- */
42
- static fromRotationMatrix(matrix: Matrix3, result: Quaternion): Quaternion;
43
- /**
44
- * 从相机 heading、pitch、roll 构造一个四元数。heading 表示绕 z 轴旋转角度、pitch 表示绕 y 轴旋转角度、roll 表示绕 x 轴旋转角度
45
- * @param headingPitchRoll
46
- * @param result
47
- * @returns
48
- */
49
- static fromHeadingPitchRoll(headingPitchRoll: {
50
- heading: number;
51
- pitch: number;
52
- roll: number;
53
- }, result: Quaternion): Quaternion;
54
- /**
55
- * 将欧拉角转成四元数
56
- * @param euler
57
- * @param result
58
- * @returns
59
- */
60
- static setFromEuler(euler: Euler, result: Quaternion): Quaternion;
61
- /**
62
- * 四元数打包成数组
63
- * @param value
64
- * @param array
65
- * @param startingIndex
66
- * @returns
67
- */
68
- static pack(value: Quaternion, array: Vec4DataType, startingIndex?: number): Vec4DataType;
69
- /**
70
- * 从数组中解包四元数
71
- * @param array
72
- * @param startingIndex
73
- * @param result
74
- * @returns
75
- */
76
- static unpack(array: Vec4DataType, startingIndex: number, result: Quaternion): Quaternion;
77
- /**
78
- * 从数组构造一个四元数
79
- * @param array
80
- * @param startingIndex
81
- * @param result
82
- * @returns
83
- */
84
- static fromArray(array: Vec4DataType): Quaternion;
85
- /**
86
- * 两个四元数相乘
87
- * @param left
88
- * @param right
89
- * @param result
90
- * @returns
91
- */
92
- static multiply(left: Quaternion, right: Quaternion, result: Quaternion): Quaternion;
93
- /**
94
- * 从输入四元数克隆一个四元数
95
- * @param quaternion
96
- * @param result
97
- * @returns
98
- */
99
- static clone(quaternion: Quaternion | Readonly<Quaternion>): Quaternion;
100
- static copyTo(quaternion: Quaternion | Readonly<Quaternion>, result: Quaternion): Quaternion;
101
- /**
102
- * 四元数的共轭
103
- * @param quaternion
104
- * @param result
105
- * @returns
106
- */
107
- static conjugate(quaternion: Quaternion, result: Quaternion): Quaternion;
108
- /**
109
- * 四元数的模的平方
110
- * @param quaternion
111
- * @returns
112
- */
113
- static magnitudeSquared(quaternion: Quaternion): number;
114
- /**
115
- * 四元数的模
116
- * @param quaternion
117
- * @returns
118
- */
119
- static magnitude(quaternion: Quaternion): number;
120
- /**
121
- * 单位化四元数
122
- * @param quaternion
123
- * @param result
124
- * @returns
125
- */
126
- static normalize(quaternion: Quaternion, result: Quaternion): Quaternion;
127
- /**
128
- * 四元数求逆
129
- * @param quaternion
130
- * @param result
131
- * @returns
132
- */
133
- static inverse(quaternion: Quaternion, result: Quaternion): Quaternion;
134
- static add(left: Quaternion, right: Quaternion, result: Quaternion): Quaternion;
135
- static subtract(left: Quaternion, right: Quaternion, result: Quaternion): Quaternion;
136
- static negate(quaternion: Quaternion, result: Quaternion): Quaternion;
137
- static dot(left: Quaternion, right: Quaternion): number;
138
- static multiplyByScalar(quaternion: Quaternion, scalar: number, result: Quaternion): Quaternion;
139
- static computeAxis(quaternion: Quaternion, result: Vector3): Vector3;
140
- /**
141
- * 计算旋转角度
142
- * @param quaternion
143
- * @returns
144
- */
145
- static computeAngle(quaternion: Quaternion): number;
146
- /**
147
- * 线性插值
148
- * @param start
149
- * @param end
150
- * @param t
151
- * @param result
152
- * @returns
153
- */
154
- static lerp(start: Quaternion, end: Quaternion, t: number, result: Quaternion): Quaternion;
155
- /**
156
- * 球面线性插值
157
- * @param start
158
- * @param end
159
- * @param t
160
- * @param result
161
- * @returns
162
- */
163
- static slerp(start: Quaternion, end: Quaternion, t: number, result: Quaternion): Quaternion;
164
- static equals(left: Quaternion, right: Quaternion): boolean;
165
- static equalsEpsilon(left: Quaternion, right: Quaternion, epsilon?: number): boolean;
166
- /**
167
- * 将四元数转变为一个 4x4 矩阵
168
- * @param result
169
- * @returns
170
- */
171
- toMatrix4(result: Matrix4): Matrix4;
172
- /**
173
- * 使用四元数内部数据克隆出一个新的四元数
174
- * @returns
175
- */
176
- clone(): Quaternion;
177
- /**
178
- * 将四元数数据拷贝给 result
179
- * @param result
180
- */
181
- copyTo(result: Quaternion): Quaternion;
182
- /**
183
- * 将四元数数据从 source 拷贝回来
184
- * @param source
185
- */
186
- copyFrom(source: Quaternion): this;
187
- /**
188
- * 绕 x 轴旋转角度分量
189
- * @returns
190
- */
191
- roll(): number;
192
- /**
193
- * 绕 y 轴旋转分量
194
- * @returns
195
- */
196
- pitch(): number;
197
- /**
198
- * 绕 z 轴旋转分量
199
- * @returns
200
- */
201
- yaw(): number;
202
- inverse(): Quaternion;
203
- conjugate(): Quaternion;
204
- length(): number;
205
- normalize(): Quaternion;
206
- add(other: Quaternion): Quaternion;
207
- multiply(other: Quaternion): Quaternion;
208
- set(x: number, y: number, z: number, w: number): Quaternion;
209
- setFromEuler(euler: Euler): Quaternion;
210
- toArray(): number[];
211
- static IDENTITY: Readonly<Quaternion>;
212
- static ZERO: Readonly<Quaternion>;
213
- }
214
- export { Quaternion };