@kiberon-labs/behave-graph-scene 1.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.
- package/package.json +34 -0
- package/src/Abstractions/Drivers/DummyScene.ts +79 -0
- package/src/Abstractions/IScene.ts +18 -0
- package/src/GLTFJson.ts +34 -0
- package/src/Nodes/Actions/EaseSceneProperty.ts +162 -0
- package/src/Nodes/Actions/SetSceneProperty.ts +35 -0
- package/src/Nodes/Events/OnSceneNodeClick.ts +66 -0
- package/src/Nodes/Logic/ColorNodes.ts +121 -0
- package/src/Nodes/Logic/EulerNodes.ts +115 -0
- package/src/Nodes/Logic/Mat3Nodes.ts +202 -0
- package/src/Nodes/Logic/Mat4Nodes.ts +257 -0
- package/src/Nodes/Logic/QuatNodes.ts +178 -0
- package/src/Nodes/Logic/Vec2Nodes.ts +111 -0
- package/src/Nodes/Logic/Vec3Nodes.ts +121 -0
- package/src/Nodes/Logic/Vec4Nodes.ts +112 -0
- package/src/Nodes/Logic/VecElements.ts +34 -0
- package/src/Nodes/Queries/GetSceneProperty.ts +35 -0
- package/src/Values/ColorValue.ts +22 -0
- package/src/Values/EulerValue.ts +22 -0
- package/src/Values/Internal/Mat2.ts +214 -0
- package/src/Values/Internal/Mat3.ts +422 -0
- package/src/Values/Internal/Mat4.ts +831 -0
- package/src/Values/Internal/Vec2.ts +97 -0
- package/src/Values/Internal/Vec3.ts +244 -0
- package/src/Values/Internal/Vec4.ts +350 -0
- package/src/Values/Mat3Value.ts +20 -0
- package/src/Values/Mat4Value.ts +20 -0
- package/src/Values/QuatValue.ts +22 -0
- package/src/Values/Vec2Value.ts +14 -0
- package/src/Values/Vec3Value.ts +22 -0
- package/src/Values/Vec4Value.ts +21 -0
- package/src/buildScene.ts +479 -0
- package/src/index.ts +38 -0
- package/src/loadScene.ts +81 -0
- package/src/registerSceneProfile.ts +105 -0
- package/tests/graphs/logic/Color.json +53 -0
- package/tests/graphs/logic/Euler.json +53 -0
- package/tests/graphs/logic/Quaternion.json +56 -0
- package/tests/graphs/logic/Vector2.json +50 -0
- package/tests/graphs/logic/Vector3.json +53 -0
- package/tests/graphs/logic/Vector4.json +56 -0
- package/tests/readSceneGraphs.test.ts +57 -0
- package/tests/registerSceneProfile.test.ts +62 -0
- package/tests/tsconfig.json +11 -0
- package/tests/values/internal/Vec2.test.ts +74 -0
- package/tests/values/internal/Vec3.test.ts +83 -0
- package/tests/values/internal/Vec4.test.ts +91 -0
- package/tsconfig.json +55 -0
- package/tsdown.config.ts +13 -0
- package/vitest.config.ts +15 -0
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import { makeInNOutFunctionDesc } from '@kiberon-labs/behave-graph';
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
column3ToMat3,
|
|
5
|
+
eulerToMat3,
|
|
6
|
+
Mat3,
|
|
7
|
+
mat3Add,
|
|
8
|
+
mat3Determinant,
|
|
9
|
+
mat3Equals,
|
|
10
|
+
mat3Inverse,
|
|
11
|
+
mat3Mix,
|
|
12
|
+
mat3Multiply,
|
|
13
|
+
mat3MultiplyByScalar,
|
|
14
|
+
mat3Negate,
|
|
15
|
+
mat3SetColumn3,
|
|
16
|
+
mat3SetRow3,
|
|
17
|
+
mat3Subtract,
|
|
18
|
+
mat3ToScale2,
|
|
19
|
+
mat3ToTranslation2,
|
|
20
|
+
mat3Transpose,
|
|
21
|
+
mat4ToMat3,
|
|
22
|
+
scale2ToMat3,
|
|
23
|
+
translation2ToMat3
|
|
24
|
+
} from '../../Values/Internal/Mat3.js';
|
|
25
|
+
|
|
26
|
+
export const Constant = makeInNOutFunctionDesc({
|
|
27
|
+
name: 'math/mat3',
|
|
28
|
+
label: 'Mat3',
|
|
29
|
+
in: ['mat3'],
|
|
30
|
+
out: 'mat3',
|
|
31
|
+
exec: (a: Mat3) => a
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
export const Column3ToMat3 = makeInNOutFunctionDesc({
|
|
35
|
+
name: 'math/toMat3/column3',
|
|
36
|
+
label: 'Columns to Mat3',
|
|
37
|
+
in: ['vec3', 'vec3', 'vec3'],
|
|
38
|
+
out: 'mat3',
|
|
39
|
+
exec: column3ToMat3
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
export const SetColumn = makeInNOutFunctionDesc({
|
|
43
|
+
name: 'math/setColumn/mat3',
|
|
44
|
+
label: 'Set Column',
|
|
45
|
+
in: ['mat3', 'integer', 'vec3'],
|
|
46
|
+
out: 'mat3',
|
|
47
|
+
exec: mat3SetColumn3
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
export const SetRow = makeInNOutFunctionDesc({
|
|
51
|
+
name: 'math/setRow/mat3',
|
|
52
|
+
label: 'Set Row',
|
|
53
|
+
in: ['mat3', 'integer', 'vec3'],
|
|
54
|
+
out: 'mat3',
|
|
55
|
+
exec: mat3SetRow3
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
export const Elements = makeInNOutFunctionDesc({
|
|
59
|
+
name: 'math/toVec3/mat3',
|
|
60
|
+
label: 'Mat3 To Vec3',
|
|
61
|
+
in: ['mat3'],
|
|
62
|
+
out: [{ x: 'vec3' }, { y: 'vec3' }, { z: 'vec3' }],
|
|
63
|
+
exec: (a: Mat3) => {
|
|
64
|
+
throw new Error('not implemented');
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
export const Add = makeInNOutFunctionDesc({
|
|
69
|
+
name: 'math/add/mat3',
|
|
70
|
+
label: '+',
|
|
71
|
+
in: ['mat3', 'mat3'],
|
|
72
|
+
out: 'mat3',
|
|
73
|
+
exec: mat3Add
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
export const Subtract = makeInNOutFunctionDesc({
|
|
77
|
+
name: 'math/subtract/mat3',
|
|
78
|
+
label: '-',
|
|
79
|
+
in: ['mat3', 'mat3'],
|
|
80
|
+
out: 'mat3',
|
|
81
|
+
exec: mat3Subtract
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
export const Negate = makeInNOutFunctionDesc({
|
|
85
|
+
name: 'math/negate/mat3',
|
|
86
|
+
label: '-',
|
|
87
|
+
in: ['mat3'],
|
|
88
|
+
out: 'mat3',
|
|
89
|
+
exec: mat3Negate
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
export const Scale = makeInNOutFunctionDesc({
|
|
93
|
+
name: 'math/scale/mat3',
|
|
94
|
+
label: '×',
|
|
95
|
+
in: ['mat3', 'float'],
|
|
96
|
+
out: 'mat3',
|
|
97
|
+
exec: mat3MultiplyByScalar
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
export const Determinant = makeInNOutFunctionDesc({
|
|
101
|
+
name: 'math/determinant/mat3',
|
|
102
|
+
label: 'Determinant',
|
|
103
|
+
in: ['mat3'],
|
|
104
|
+
out: 'float',
|
|
105
|
+
exec: mat3Determinant
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
export const Inverse = makeInNOutFunctionDesc({
|
|
109
|
+
name: 'math/inverse/mat3',
|
|
110
|
+
label: 'Inverse',
|
|
111
|
+
in: ['mat3'],
|
|
112
|
+
out: 'mat3',
|
|
113
|
+
exec: mat3Inverse
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
export const Mat4ToMat3 = makeInNOutFunctionDesc({
|
|
117
|
+
name: 'math/toMat3/mat4',
|
|
118
|
+
label: 'Mat4 To Mat3',
|
|
119
|
+
in: ['mat4'],
|
|
120
|
+
out: 'mat3',
|
|
121
|
+
exec: mat4ToMat3
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
export const Transpose = makeInNOutFunctionDesc({
|
|
125
|
+
name: 'math/transpose/mat3',
|
|
126
|
+
label: 'Transpose',
|
|
127
|
+
in: ['mat3'],
|
|
128
|
+
out: 'mat3',
|
|
129
|
+
exec: mat3Transpose
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
export const Multiply = makeInNOutFunctionDesc({
|
|
133
|
+
name: 'math/multiply/mat3',
|
|
134
|
+
label: 'Cross',
|
|
135
|
+
in: ['mat3', 'mat3'],
|
|
136
|
+
out: 'mat3',
|
|
137
|
+
exec: mat3Multiply
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
export const Mix = makeInNOutFunctionDesc({
|
|
141
|
+
name: 'math/mix/mat3',
|
|
142
|
+
label: '÷',
|
|
143
|
+
in: [{ a: 'mat3' }, { b: 'mat3' }, { t: 'float' }],
|
|
144
|
+
out: 'mat3',
|
|
145
|
+
exec: mat3Mix
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
export const Equal = makeInNOutFunctionDesc({
|
|
149
|
+
name: 'math/equal/mat3',
|
|
150
|
+
label: '=',
|
|
151
|
+
in: [{ a: 'mat3' }, { b: 'mat3' }, { tolerance: 'float' }],
|
|
152
|
+
out: 'boolean',
|
|
153
|
+
exec: mat3Equals
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
export const EulerToMat3 = makeInNOutFunctionDesc({
|
|
157
|
+
name: 'math/toMat3/euler',
|
|
158
|
+
label: 'To Mat3',
|
|
159
|
+
in: ['euler'],
|
|
160
|
+
out: 'mat3',
|
|
161
|
+
exec: eulerToMat3
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
export const QuatToMat3 = makeInNOutFunctionDesc({
|
|
165
|
+
name: 'math/toMat3/quat',
|
|
166
|
+
label: 'To Mat3',
|
|
167
|
+
in: ['quat'],
|
|
168
|
+
out: 'mat3',
|
|
169
|
+
exec: eulerToMat3
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
export const Scale2ToMat3 = makeInNOutFunctionDesc({
|
|
173
|
+
name: 'math/toMat3/scale2',
|
|
174
|
+
label: 'Scale2 To Mat3',
|
|
175
|
+
in: ['vec2'],
|
|
176
|
+
out: 'mat3',
|
|
177
|
+
exec: scale2ToMat3
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
export const Mat3ToScale2 = makeInNOutFunctionDesc({
|
|
181
|
+
name: 'math/toScale2/mat3',
|
|
182
|
+
label: 'Mat3 to Scale2',
|
|
183
|
+
in: ['mat3'],
|
|
184
|
+
out: 'vec2',
|
|
185
|
+
exec: mat3ToScale2
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
export const Translation2ToMat3 = makeInNOutFunctionDesc({
|
|
189
|
+
name: 'math/toMat3/translation2',
|
|
190
|
+
label: 'Translation2 To Mat3',
|
|
191
|
+
in: ['vec2'],
|
|
192
|
+
out: 'mat3',
|
|
193
|
+
exec: translation2ToMat3
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
export const Mat3ToTranslation3 = makeInNOutFunctionDesc({
|
|
197
|
+
name: 'math/toTranslation2/mat3',
|
|
198
|
+
label: 'Mat3 to Translation2',
|
|
199
|
+
in: ['mat3'],
|
|
200
|
+
out: 'vec2',
|
|
201
|
+
exec: mat3ToTranslation2
|
|
202
|
+
});
|
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
import { makeInNOutFunctionDesc } from '@kiberon-labs/behave-graph';
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
column4ToMat4,
|
|
5
|
+
eulerToMat4,
|
|
6
|
+
mat3ToMat4,
|
|
7
|
+
Mat4,
|
|
8
|
+
mat4Add,
|
|
9
|
+
mat4Adjoint,
|
|
10
|
+
mat4Determinant,
|
|
11
|
+
mat4Equals,
|
|
12
|
+
mat4Inverse,
|
|
13
|
+
mat4LookAt,
|
|
14
|
+
mat4Mix,
|
|
15
|
+
mat4Multiply,
|
|
16
|
+
mat4MultiplyByScalar,
|
|
17
|
+
mat4Negate,
|
|
18
|
+
mat4RotateByEuler,
|
|
19
|
+
mat4RotateByQuat,
|
|
20
|
+
mat4Scale,
|
|
21
|
+
mat4SetColumn4,
|
|
22
|
+
mat4SetRow4,
|
|
23
|
+
mat4Subtract,
|
|
24
|
+
mat4TransformNormal3,
|
|
25
|
+
mat4TransformPoint3,
|
|
26
|
+
mat4Translate,
|
|
27
|
+
mat4Transpose,
|
|
28
|
+
quatToMat4,
|
|
29
|
+
scale3ToMat4,
|
|
30
|
+
translation3ToMat4
|
|
31
|
+
} from '../../Values/Internal/Mat4.js';
|
|
32
|
+
|
|
33
|
+
export const Constant = makeInNOutFunctionDesc({
|
|
34
|
+
name: 'math/mat4',
|
|
35
|
+
label: 'Mat4',
|
|
36
|
+
in: ['mat4'],
|
|
37
|
+
out: 'mat4',
|
|
38
|
+
exec: (a: Mat4) => a
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
export const Column4ToMat4 = makeInNOutFunctionDesc({
|
|
42
|
+
name: 'math/toMat4/column4',
|
|
43
|
+
label: 'Columns to Mat4',
|
|
44
|
+
in: [{ x: 'vec4' }, { y: 'vec4' }, { z: 'vec4' }, { w: 'vec4' }],
|
|
45
|
+
out: 'mat4',
|
|
46
|
+
exec: column4ToMat4
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
export const SetColumn = makeInNOutFunctionDesc({
|
|
50
|
+
name: 'math/setColumn/mat4',
|
|
51
|
+
label: 'Set Column',
|
|
52
|
+
in: ['mat4', 'integer', 'vec4'],
|
|
53
|
+
out: 'mat4',
|
|
54
|
+
exec: mat4SetColumn4
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
export const SetRow = makeInNOutFunctionDesc({
|
|
58
|
+
name: 'math/setRow/mat4',
|
|
59
|
+
label: 'Set Row',
|
|
60
|
+
in: ['mat4', 'integer', 'vec4'],
|
|
61
|
+
out: 'mat4',
|
|
62
|
+
exec: mat4SetRow4
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
export const Elements = makeInNOutFunctionDesc({
|
|
66
|
+
name: 'math/toVec4/mat4', // should include columns4 in the name?
|
|
67
|
+
label: 'Mat4 To Vec4',
|
|
68
|
+
in: ['mat4'],
|
|
69
|
+
out: [{ x: 'vec4' }, { y: 'vec4' }, { z: 'vec4' }, { w: 'vec4' }],
|
|
70
|
+
exec: () => {
|
|
71
|
+
throw new Error('not implemented');
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
export const Add = makeInNOutFunctionDesc({
|
|
76
|
+
name: 'math/add/mat4',
|
|
77
|
+
label: '+',
|
|
78
|
+
in: ['mat4', 'mat4'],
|
|
79
|
+
out: 'mat4',
|
|
80
|
+
exec: mat4Add
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
export const Subtract = makeInNOutFunctionDesc({
|
|
84
|
+
name: 'math/subtract/mat4',
|
|
85
|
+
label: '-',
|
|
86
|
+
in: ['mat4', 'mat4'],
|
|
87
|
+
out: 'mat4',
|
|
88
|
+
exec: mat4Subtract
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
export const Negate = makeInNOutFunctionDesc({
|
|
92
|
+
name: 'math/negate/mat4',
|
|
93
|
+
label: '-',
|
|
94
|
+
in: ['mat4'],
|
|
95
|
+
out: 'mat4',
|
|
96
|
+
exec: mat4Negate
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
export const MultiplyByScalar = makeInNOutFunctionDesc({
|
|
100
|
+
name: 'math/multiplyByScalar/mat4',
|
|
101
|
+
label: '×',
|
|
102
|
+
in: ['mat4', 'float'],
|
|
103
|
+
out: 'mat4',
|
|
104
|
+
exec: mat4MultiplyByScalar
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
export const Determinant = makeInNOutFunctionDesc({
|
|
108
|
+
name: 'math/determinant/mat4',
|
|
109
|
+
label: 'Determinant',
|
|
110
|
+
in: ['mat4'],
|
|
111
|
+
out: 'float',
|
|
112
|
+
exec: mat4Determinant
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
export const Adjoint = makeInNOutFunctionDesc({
|
|
116
|
+
name: 'math/adjoint/mat4',
|
|
117
|
+
label: 'Adjoint',
|
|
118
|
+
in: ['mat4'],
|
|
119
|
+
out: 'mat4',
|
|
120
|
+
exec: mat4Adjoint
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
export const Inverse = makeInNOutFunctionDesc({
|
|
124
|
+
name: 'math/inverse/mat4',
|
|
125
|
+
label: 'Inverse',
|
|
126
|
+
in: ['mat4'],
|
|
127
|
+
out: 'mat4',
|
|
128
|
+
exec: mat4Inverse
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
export const Transpose = makeInNOutFunctionDesc({
|
|
132
|
+
name: 'math/transpose/mat4',
|
|
133
|
+
label: 'Transpose',
|
|
134
|
+
in: ['mat4'],
|
|
135
|
+
out: 'mat4',
|
|
136
|
+
exec: mat4Transpose
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
export const Mat3ToMat4 = makeInNOutFunctionDesc({
|
|
140
|
+
name: 'math/toMat4/mat3',
|
|
141
|
+
label: 'Mat3 To Mat4',
|
|
142
|
+
in: ['mat3'],
|
|
143
|
+
out: 'mat4',
|
|
144
|
+
exec: mat3ToMat4
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
export const Scale3ToMat4 = makeInNOutFunctionDesc({
|
|
148
|
+
name: 'math/toMat4/scale3',
|
|
149
|
+
label: 'Scale3 To Mat4',
|
|
150
|
+
in: ['vec3'],
|
|
151
|
+
out: 'mat4',
|
|
152
|
+
exec: scale3ToMat4
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
export const Translate3ToMat4 = makeInNOutFunctionDesc({
|
|
156
|
+
name: 'math/toMat4/translate3',
|
|
157
|
+
label: 'Translate3 To Mat4',
|
|
158
|
+
in: ['vec3'],
|
|
159
|
+
out: 'mat4',
|
|
160
|
+
exec: translation3ToMat4
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
export const QuatToMat4 = makeInNOutFunctionDesc({
|
|
164
|
+
name: 'math/toMat4/quat',
|
|
165
|
+
label: 'Quat To Mat4',
|
|
166
|
+
in: ['quat'],
|
|
167
|
+
out: 'mat4',
|
|
168
|
+
exec: quatToMat4
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
export const EulerToMat4 = makeInNOutFunctionDesc({
|
|
172
|
+
name: 'math/toMat4/euler',
|
|
173
|
+
label: 'Euler To Mat4',
|
|
174
|
+
in: ['euler'],
|
|
175
|
+
out: 'mat4',
|
|
176
|
+
exec: eulerToMat4
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
export const Translate = makeInNOutFunctionDesc({
|
|
180
|
+
name: 'math/translate/mat4',
|
|
181
|
+
label: 'Translate',
|
|
182
|
+
in: ['mat4', 'vec3'],
|
|
183
|
+
out: 'mat4',
|
|
184
|
+
exec: mat4Translate
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
export const Scale = makeInNOutFunctionDesc({
|
|
188
|
+
name: 'math/scale/mat4',
|
|
189
|
+
label: 'Scale',
|
|
190
|
+
in: ['mat4', 'vec3'],
|
|
191
|
+
out: 'mat4',
|
|
192
|
+
exec: mat4Scale
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
export const RotateByQuat = makeInNOutFunctionDesc({
|
|
196
|
+
name: 'math/rotateByQuat/mat4',
|
|
197
|
+
label: 'Rotate',
|
|
198
|
+
in: ['mat4', 'quat'],
|
|
199
|
+
out: 'mat4',
|
|
200
|
+
exec: mat4RotateByQuat
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
export const RotateByEuler = makeInNOutFunctionDesc({
|
|
204
|
+
name: 'math/rotateByEuler/mat4',
|
|
205
|
+
label: 'Rotate',
|
|
206
|
+
in: ['mat4', 'euler'],
|
|
207
|
+
out: 'mat4',
|
|
208
|
+
exec: mat4RotateByEuler
|
|
209
|
+
});
|
|
210
|
+
|
|
211
|
+
export const Multiply = makeInNOutFunctionDesc({
|
|
212
|
+
name: 'math/multiply/mat4',
|
|
213
|
+
label: 'Cross',
|
|
214
|
+
in: ['mat4', 'mat4'],
|
|
215
|
+
out: 'mat4',
|
|
216
|
+
exec: mat4Multiply
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
export const Mix = makeInNOutFunctionDesc({
|
|
220
|
+
name: 'math/mix/mat4',
|
|
221
|
+
label: '÷',
|
|
222
|
+
in: [{ a: 'mat4' }, { b: 'mat4' }, { t: 'float' }],
|
|
223
|
+
out: 'mat4',
|
|
224
|
+
exec: mat4Mix
|
|
225
|
+
});
|
|
226
|
+
|
|
227
|
+
export const Equal = makeInNOutFunctionDesc({
|
|
228
|
+
name: 'math/equal/mat4',
|
|
229
|
+
label: '=',
|
|
230
|
+
in: [{ a: 'mat4' }, { b: 'mat4' }, { tolerance: 'float' }],
|
|
231
|
+
out: 'boolean',
|
|
232
|
+
exec: mat4Equals
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
export const TransformPoint3 = makeInNOutFunctionDesc({
|
|
236
|
+
name: 'math/transformPoint3/mat4',
|
|
237
|
+
label: 'Transform Point3',
|
|
238
|
+
in: ['mat4', 'vec3'],
|
|
239
|
+
out: 'vec3',
|
|
240
|
+
exec: mat4TransformPoint3
|
|
241
|
+
});
|
|
242
|
+
|
|
243
|
+
export const TransformNormal3 = makeInNOutFunctionDesc({
|
|
244
|
+
name: 'math/transformNormal3/mat4',
|
|
245
|
+
label: 'Transform Normal',
|
|
246
|
+
in: ['mat4', 'vec3'],
|
|
247
|
+
out: 'vec3',
|
|
248
|
+
exec: mat4TransformNormal3
|
|
249
|
+
});
|
|
250
|
+
|
|
251
|
+
export const LookAt = makeInNOutFunctionDesc({
|
|
252
|
+
name: 'math/lookAt/mat4',
|
|
253
|
+
label: 'Look At',
|
|
254
|
+
in: [{ eye: 'vec3' }, { target: 'vec3' }, { up: 'vec3' }],
|
|
255
|
+
out: 'mat4',
|
|
256
|
+
exec: mat4LookAt
|
|
257
|
+
});
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import { makeInNOutFunctionDesc } from '@kiberon-labs/behave-graph';
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
angleAxisToQuat,
|
|
5
|
+
eulerToQuat,
|
|
6
|
+
mat3ToQuat,
|
|
7
|
+
mat4ToQuat,
|
|
8
|
+
quatConjugate,
|
|
9
|
+
quatExp,
|
|
10
|
+
quatLn,
|
|
11
|
+
quatMultiply,
|
|
12
|
+
quatPow,
|
|
13
|
+
quatSlerp,
|
|
14
|
+
Vec4,
|
|
15
|
+
vec4Dot,
|
|
16
|
+
vec4Equals,
|
|
17
|
+
vec4Length,
|
|
18
|
+
vec4MultiplyByScalar,
|
|
19
|
+
vec4Normalize,
|
|
20
|
+
vec4ToArray
|
|
21
|
+
} from '../../Values/Internal/Vec4.js';
|
|
22
|
+
|
|
23
|
+
/*
|
|
24
|
+
- from Angle Axis
|
|
25
|
+
- from Euler
|
|
26
|
+
- to Angle Axis
|
|
27
|
+
- to Euler
|
|
28
|
+
- Conjugate
|
|
29
|
+
- Multiply
|
|
30
|
+
- Slerp
|
|
31
|
+
- Squad
|
|
32
|
+
- Scale
|
|
33
|
+
-
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
export const Constant = makeInNOutFunctionDesc({
|
|
37
|
+
name: 'math/quat',
|
|
38
|
+
label: 'Quaternion',
|
|
39
|
+
in: ['quat'],
|
|
40
|
+
out: 'quat',
|
|
41
|
+
exec: (a: Vec4) => a
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
export const Create = makeInNOutFunctionDesc({
|
|
45
|
+
name: 'math/toQuat/float',
|
|
46
|
+
label: 'Float to Quat',
|
|
47
|
+
in: [{ x: 'float' }, { y: 'float' }, { z: 'float' }, { w: 'float' }],
|
|
48
|
+
out: 'quat',
|
|
49
|
+
exec: (x: number, y: number, z: number, w: number) => new Vec4(x, y, z, w)
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
export const Elements = makeInNOutFunctionDesc({
|
|
53
|
+
name: 'math/toFloat/quat',
|
|
54
|
+
label: 'Quat to Float',
|
|
55
|
+
in: ['quat'],
|
|
56
|
+
out: [{ x: 'float' }, { y: 'float' }, { z: 'float' }, { w: 'float' }],
|
|
57
|
+
exec: vec4ToArray
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
export const Negate = makeInNOutFunctionDesc({
|
|
61
|
+
name: 'math/conjugate/quat',
|
|
62
|
+
label: 'Conjugate',
|
|
63
|
+
in: ['quat'],
|
|
64
|
+
out: 'quat',
|
|
65
|
+
exec: quatConjugate
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
export const Multiply = makeInNOutFunctionDesc({
|
|
69
|
+
name: 'math/multiply/quat',
|
|
70
|
+
label: '×',
|
|
71
|
+
in: ['quat', 'quat'],
|
|
72
|
+
out: 'quat',
|
|
73
|
+
exec: quatMultiply
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
export const Scale = makeInNOutFunctionDesc({
|
|
77
|
+
name: 'math/scale/quat',
|
|
78
|
+
label: '×',
|
|
79
|
+
in: ['quat', 'float'],
|
|
80
|
+
out: 'quat',
|
|
81
|
+
exec: vec4MultiplyByScalar
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
export const Length = makeInNOutFunctionDesc({
|
|
85
|
+
name: 'math/length/quat',
|
|
86
|
+
label: 'Length',
|
|
87
|
+
in: ['quat'],
|
|
88
|
+
out: 'float',
|
|
89
|
+
exec: vec4Length
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
export const Normalize = makeInNOutFunctionDesc({
|
|
93
|
+
name: 'math/normalize/quat',
|
|
94
|
+
label: 'Normalize',
|
|
95
|
+
in: ['quat'],
|
|
96
|
+
out: 'quat',
|
|
97
|
+
exec: vec4Normalize
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
export const Dot = makeInNOutFunctionDesc({
|
|
101
|
+
name: 'math/dot/quat',
|
|
102
|
+
label: 'Dot Product',
|
|
103
|
+
in: ['quat', 'quat'],
|
|
104
|
+
out: 'float',
|
|
105
|
+
exec: vec4Dot
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
export const Ln = makeInNOutFunctionDesc({
|
|
109
|
+
name: 'math/ln/quat',
|
|
110
|
+
label: 'Ln',
|
|
111
|
+
in: ['quat'],
|
|
112
|
+
out: 'quat',
|
|
113
|
+
exec: quatLn
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
export const Exp = makeInNOutFunctionDesc({
|
|
117
|
+
name: 'math/exp/quat',
|
|
118
|
+
label: 'Exp',
|
|
119
|
+
in: ['quat'],
|
|
120
|
+
out: 'quat',
|
|
121
|
+
exec: quatExp
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
export const Pow = makeInNOutFunctionDesc({
|
|
125
|
+
name: 'math/pow/quat',
|
|
126
|
+
label: 'Pow',
|
|
127
|
+
in: ['quat', 'float'],
|
|
128
|
+
out: 'quat',
|
|
129
|
+
exec: quatPow
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
export const Mat3ToQuat = makeInNOutFunctionDesc({
|
|
133
|
+
name: 'math/toQuat/mat3',
|
|
134
|
+
label: 'To Quat',
|
|
135
|
+
in: ['mat3'],
|
|
136
|
+
out: 'quat',
|
|
137
|
+
exec: mat3ToQuat
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
export const Mat4ToQuat = makeInNOutFunctionDesc({
|
|
141
|
+
name: 'math/toQuat/mat4',
|
|
142
|
+
label: 'To Quat',
|
|
143
|
+
in: ['mat4'],
|
|
144
|
+
out: 'quat',
|
|
145
|
+
exec: mat4ToQuat
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
export const EulerToQuat = makeInNOutFunctionDesc({
|
|
149
|
+
name: 'math/toQuat/euler',
|
|
150
|
+
label: '÷',
|
|
151
|
+
in: ['euler'],
|
|
152
|
+
out: 'quat',
|
|
153
|
+
exec: eulerToQuat
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
export const AngleAxisToQuat = makeInNOutFunctionDesc({
|
|
157
|
+
name: 'math/toQuat/angleAxis',
|
|
158
|
+
label: 'Angle Axis to Quat',
|
|
159
|
+
in: ['float', 'vec3'],
|
|
160
|
+
out: 'quat',
|
|
161
|
+
exec: angleAxisToQuat
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
export const Slerp = makeInNOutFunctionDesc({
|
|
165
|
+
name: 'math/slerp/quat',
|
|
166
|
+
label: 'Slerp',
|
|
167
|
+
in: [{ a: 'quat' }, { b: 'quat' }, { t: 'float' }],
|
|
168
|
+
out: 'quat',
|
|
169
|
+
exec: quatSlerp
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
export const Equal = makeInNOutFunctionDesc({
|
|
173
|
+
name: 'math/equal/quat',
|
|
174
|
+
label: '=',
|
|
175
|
+
in: [{ a: 'quat' }, { b: 'quat' }, { tolerance: 'float' }],
|
|
176
|
+
out: 'boolean',
|
|
177
|
+
exec: vec4Equals
|
|
178
|
+
});
|