@shapediver/viewer.rendering-engine.animation-engine 2.7.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/LICENSE +73 -0
- package/README.md +3 -0
- package/dist/implementation/AnimationEngine.d.ts +15 -0
- package/dist/implementation/AnimationEngine.d.ts.map +1 -0
- package/dist/implementation/AnimationEngine.js +205 -0
- package/dist/implementation/AnimationEngine.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/interfaces/IAnimationEngine.d.ts +19 -0
- package/dist/interfaces/IAnimationEngine.d.ts.map +1 -0
- package/dist/interfaces/IAnimationEngine.js +3 -0
- package/dist/interfaces/IAnimationEngine.js.map +1 -0
- package/package.json +51 -0
- package/src/implementation/AnimationEngine.ts +237 -0
- package/src/index.ts +7 -0
- package/src/interfaces/IAnimationEngine.ts +28 -0
- package/tsconfig.json +17 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
Required Notice: Copyright 2023 ShapeDiver GmbH (https://www.shapediver.com)
|
|
2
|
+
|
|
3
|
+
https://polyformproject.org/licenses/noncommercial/1.0.0
|
|
4
|
+
|
|
5
|
+
Acceptance
|
|
6
|
+
|
|
7
|
+
In order to get any license under these terms, you must agree to them as both strict obligations and conditions to all your licenses.
|
|
8
|
+
|
|
9
|
+
Copyright License
|
|
10
|
+
|
|
11
|
+
The licensor grants you a copyright license for the software to do everything you might do with the software that would otherwise infringe the licensor’s copyright in it for any permitted purpose. However, you may only distribute the software according to Distribution License and make changes or new works based on the software according to Changes and New Works License.
|
|
12
|
+
|
|
13
|
+
Distribution License
|
|
14
|
+
|
|
15
|
+
The licensor grants you an additional copyright license to distribute copies of the software. Your license to distribute covers distributing the software with changes and new works permitted by Changes and New Works License.
|
|
16
|
+
|
|
17
|
+
Notices
|
|
18
|
+
|
|
19
|
+
You must ensure that anyone who gets a copy of any part of the software from you also gets a copy of these terms or the URL for them above, as well as copies of any plain-text lines beginning with Required Notice: that the licensor provided with the software. For example:
|
|
20
|
+
|
|
21
|
+
Required Notice: Copyright 2023 ShapeDiver GmbH (https://www.shapediver.com)
|
|
22
|
+
|
|
23
|
+
Changes and New Works License
|
|
24
|
+
|
|
25
|
+
The licensor grants you an additional copyright license to make changes and new works based on the software for any permitted purpose.
|
|
26
|
+
|
|
27
|
+
Patent License
|
|
28
|
+
|
|
29
|
+
The licensor grants you a patent license for the software that covers patent claims the licensor can license, or becomes able to license, that you would infringe by using the software.
|
|
30
|
+
|
|
31
|
+
Noncommercial Purposes
|
|
32
|
+
|
|
33
|
+
Any noncommercial purpose is a permitted purpose.
|
|
34
|
+
|
|
35
|
+
Personal Uses
|
|
36
|
+
|
|
37
|
+
Personal use for research, experiment, and testing for the benefit of public knowledge, personal study, private entertainment, hobby projects, amateur pursuits, or religious observance, without any anticipated commercial application, is use for a permitted purpose.
|
|
38
|
+
|
|
39
|
+
Noncommercial Organizations
|
|
40
|
+
|
|
41
|
+
Use by any charitable organization, educational institution, public research organization, public safety or health organization, environmental protection organization, or government institution is use for a permitted purpose regardless of the source of funding or obligations resulting from the funding.
|
|
42
|
+
|
|
43
|
+
Fair Use
|
|
44
|
+
|
|
45
|
+
You may have “fair use” rights for the software under the law. These terms do not limit them.
|
|
46
|
+
|
|
47
|
+
No Other Rights
|
|
48
|
+
|
|
49
|
+
These terms do not allow you to sublicense or transfer any of your licenses to anyone else, or prevent the licensor from granting licenses to anyone else. These terms do not imply any other licenses.
|
|
50
|
+
|
|
51
|
+
Patent Defense
|
|
52
|
+
|
|
53
|
+
If you make any written claim that the software infringes or contributes to infringement of any patent, your patent license for the software granted under these terms ends immediately. If your company makes such a claim, your patent license ends immediately for work on behalf of your company.
|
|
54
|
+
|
|
55
|
+
Violations
|
|
56
|
+
|
|
57
|
+
The first time you are notified in writing that you have violated any of these terms, or done anything with the software not covered by your licenses, your licenses can nonetheless continue if you come into full compliance with these terms, and take practical steps to correct past violations, within 32 days of receiving notice. Otherwise, all your licenses end immediately.
|
|
58
|
+
|
|
59
|
+
No Liability
|
|
60
|
+
|
|
61
|
+
As far as the law allows, the software comes as is, without any warranty or condition, and the licensor will not be liable to you for any damages arising out of these terms or the use or nature of the software, under any kind of legal claim.
|
|
62
|
+
|
|
63
|
+
Definitions
|
|
64
|
+
|
|
65
|
+
The licensor is the individual or entity offering these terms, and the software is the software the licensor makes available under these terms.
|
|
66
|
+
|
|
67
|
+
You refers to the individual or entity agreeing to these terms.
|
|
68
|
+
|
|
69
|
+
Your company is any legal entity, sole proprietorship, or other kind of organization that you work for, plus all organizations that have control over, are under the control of, or are under common control with that organization. Control means ownership of substantially all the assets of an entity, or the power to direct its management and policies by vote, contract, or otherwise. Control can be direct or indirect.
|
|
70
|
+
|
|
71
|
+
Your licenses are all the licenses granted to you for the software under these terms.
|
|
72
|
+
|
|
73
|
+
Use means anything you do with the software requiring one of your licenses.
|
package/README.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { IAnimationData } from '@shapediver/viewer.shared.types';
|
|
2
|
+
import { IManager } from '@shapediver/viewer.rendering-engine.rendering-engine';
|
|
3
|
+
import { IAnimationEngine } from '../interfaces/IAnimationEngine';
|
|
4
|
+
export declare class AnimationEngine implements IManager, IAnimationEngine {
|
|
5
|
+
private readonly _tree;
|
|
6
|
+
private _animations;
|
|
7
|
+
get animations(): {
|
|
8
|
+
[key: string]: IAnimationData;
|
|
9
|
+
};
|
|
10
|
+
init(): void;
|
|
11
|
+
update(deltaTime: number): boolean;
|
|
12
|
+
updateAnimationData(): void;
|
|
13
|
+
private gatherAnimations;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=AnimationEngine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AnimationEngine.d.ts","sourceRoot":"","sources":["../../src/implementation/AnimationEngine.ts"],"names":[],"mappings":"AAIA,OAAO,EAA+B,cAAc,EAAE,MAAM,iCAAiC,CAAA;AAC7F,OAAO,EAAE,QAAQ,EAAE,MAAM,sDAAsD,CAAC;AAChF,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAElE,qBACa,eAAgB,YAAW,QAAQ,EAAE,gBAAgB;IAG9D,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAyC;IAE/D,OAAO,CAAC,WAAW,CAEZ;IAMP,IAAW,UAAU,IAAI;QACrB,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,CAAA;KAChC,CAGA;IAMM,IAAI,IAAI,IAAI;IAEZ,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO;IA6JlC,mBAAmB,IAAI,IAAI;IA+BlC,OAAO,CAAC,gBAAgB;CAa3B"}
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.AnimationEngine = void 0;
|
|
10
|
+
const tsyringe_1 = require("tsyringe");
|
|
11
|
+
const gl_matrix_1 = require("gl-matrix");
|
|
12
|
+
const viewer_shared_node_tree_1 = require("@shapediver/viewer.shared.node-tree");
|
|
13
|
+
const viewer_shared_types_1 = require("@shapediver/viewer.shared.types");
|
|
14
|
+
let AnimationEngine = class AnimationEngine {
|
|
15
|
+
constructor() {
|
|
16
|
+
// #region Properties (2)
|
|
17
|
+
this._tree = tsyringe_1.container.resolve(viewer_shared_node_tree_1.Tree);
|
|
18
|
+
this._animations = {};
|
|
19
|
+
// #endregion Private Methods (1)
|
|
20
|
+
}
|
|
21
|
+
// #endregion Properties (2)
|
|
22
|
+
// #region Public Accessors (1)
|
|
23
|
+
get animations() {
|
|
24
|
+
return this._animations;
|
|
25
|
+
}
|
|
26
|
+
// #endregion Public Accessors (1)
|
|
27
|
+
// #region Public Methods (3)
|
|
28
|
+
init() { }
|
|
29
|
+
update(deltaTime) {
|
|
30
|
+
const animations = Object.values(this._animations);
|
|
31
|
+
let running = false;
|
|
32
|
+
for (let i = 0; i < animations.length; i++) {
|
|
33
|
+
const animation = animations[i];
|
|
34
|
+
if (animation.animationTime === -1) {
|
|
35
|
+
// if we just stopped we need to render one more time
|
|
36
|
+
running = true;
|
|
37
|
+
animation.animationTime = 0;
|
|
38
|
+
}
|
|
39
|
+
if (!animation.animate)
|
|
40
|
+
continue;
|
|
41
|
+
running = true;
|
|
42
|
+
animation.animationTime += deltaTime;
|
|
43
|
+
if (animation.animationTime / 1000.0 > animation.duration) {
|
|
44
|
+
if (animation.repeat) {
|
|
45
|
+
animation.startAnimation();
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
animation.stopAnimation();
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
const animationDuration = animation.duration;
|
|
52
|
+
const currentAnimationDeltaTime = (animation.animationTime / 1000.0) % animationDuration;
|
|
53
|
+
for (let j = 0; j < animation.tracks.length; j++) {
|
|
54
|
+
const track = animation.tracks[j];
|
|
55
|
+
const id = animation.id + '_' + j;
|
|
56
|
+
if (currentAnimationDeltaTime < track.times[0] || currentAnimationDeltaTime > track.times[track.times.length - 1])
|
|
57
|
+
continue;
|
|
58
|
+
for (let k = 1; k < track.times.length; k++) {
|
|
59
|
+
if (currentAnimationDeltaTime < track.times[k] && currentAnimationDeltaTime > track.times[k - 1]) {
|
|
60
|
+
const prevAnimation = track.node.transformations.filter(t => t.id === id);
|
|
61
|
+
track.node.transformations = track.node.transformations.filter((el) => {
|
|
62
|
+
return !prevAnimation.includes(el);
|
|
63
|
+
});
|
|
64
|
+
const factor = (currentAnimationDeltaTime - track.times[k - 1]) / (track.times[k] - track.times[k - 1]);
|
|
65
|
+
let translationTransformation = track.node.transformations.find(t => t.id === 'gltf_matrix_translation');
|
|
66
|
+
if (!translationTransformation) {
|
|
67
|
+
translationTransformation = {
|
|
68
|
+
id: 'gltf_matrix_translation',
|
|
69
|
+
matrix: gl_matrix_1.mat4.create()
|
|
70
|
+
};
|
|
71
|
+
track.node.transformations.push(translationTransformation);
|
|
72
|
+
}
|
|
73
|
+
let rotationTransformation = track.node.transformations.find(t => t.id === 'gltf_matrix_rotation');
|
|
74
|
+
if (!rotationTransformation) {
|
|
75
|
+
rotationTransformation = {
|
|
76
|
+
id: 'gltf_matrix_rotation',
|
|
77
|
+
matrix: gl_matrix_1.mat4.create()
|
|
78
|
+
};
|
|
79
|
+
track.node.transformations.push(rotationTransformation);
|
|
80
|
+
}
|
|
81
|
+
let scaleTransformation = track.node.transformations.find(t => t.id === 'gltf_matrix_scale');
|
|
82
|
+
if (!scaleTransformation) {
|
|
83
|
+
scaleTransformation = {
|
|
84
|
+
id: 'gltf_matrix_scale',
|
|
85
|
+
matrix: gl_matrix_1.mat4.create()
|
|
86
|
+
};
|
|
87
|
+
track.node.transformations.push(scaleTransformation);
|
|
88
|
+
}
|
|
89
|
+
if (track.path === 'rotation') {
|
|
90
|
+
let pivotMatrix, pivotMatrixInverse;
|
|
91
|
+
if (track.pivot) {
|
|
92
|
+
pivotMatrix = gl_matrix_1.mat4.fromTranslation(gl_matrix_1.mat4.create(), gl_matrix_1.vec3.fromValues(track.pivot[0], track.pivot[1], track.pivot[2]));
|
|
93
|
+
pivotMatrixInverse = gl_matrix_1.mat4.fromTranslation(gl_matrix_1.mat4.create(), gl_matrix_1.vec3.fromValues(-track.pivot[0], -track.pivot[1], -track.pivot[2]));
|
|
94
|
+
}
|
|
95
|
+
let quaternion;
|
|
96
|
+
if (track.interpolation === 'step') {
|
|
97
|
+
quaternion = gl_matrix_1.quat.fromValues(track.values[(k - 1) * 4 + 0], track.values[(k - 1) * 4 + 1], track.values[(k - 1) * 4 + 2], track.values[(k - 1) * 4 + 3]);
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
quaternion = gl_matrix_1.quat.slerp(gl_matrix_1.vec4.create(), gl_matrix_1.vec4.fromValues(track.values[(k - 1) * 4 + 0], track.values[(k - 1) * 4 + 1], track.values[(k - 1) * 4 + 2], track.values[(k - 1) * 4 + 3]), gl_matrix_1.vec4.fromValues(track.values[(k) * 4 + 0], track.values[(k) * 4 + 1], track.values[(k) * 4 + 2], track.values[(k) * 4 + 3]), factor);
|
|
101
|
+
}
|
|
102
|
+
const rotationMatrix = gl_matrix_1.mat4.fromQuat(gl_matrix_1.mat4.create(), quaternion);
|
|
103
|
+
if (pivotMatrix && pivotMatrixInverse) {
|
|
104
|
+
rotationTransformation.matrix = gl_matrix_1.mat4.multiply(gl_matrix_1.mat4.create(), gl_matrix_1.mat4.multiply(gl_matrix_1.mat4.create(), pivotMatrix, rotationMatrix), pivotMatrixInverse);
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
rotationTransformation.matrix = rotationMatrix;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
else if (track.path === 'translation') {
|
|
111
|
+
let vector;
|
|
112
|
+
if (track.interpolation === 'step') {
|
|
113
|
+
vector = gl_matrix_1.vec3.fromValues(track.values[(k - 1) * 3 + 0], track.values[(k - 1) * 3 + 1], track.values[(k - 1) * 3 + 2]);
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
vector = gl_matrix_1.vec3.lerp(gl_matrix_1.vec3.create(), gl_matrix_1.vec3.fromValues(track.values[(k - 1) * 3 + 0], track.values[(k - 1) * 3 + 1], track.values[(k - 1) * 3 + 2]), gl_matrix_1.vec3.fromValues(track.values[(k) * 3 + 0], track.values[(k) * 3 + 1], track.values[(k) * 3 + 2]), factor);
|
|
117
|
+
}
|
|
118
|
+
translationTransformation.matrix = gl_matrix_1.mat4.fromTranslation(gl_matrix_1.mat4.create(), vector);
|
|
119
|
+
}
|
|
120
|
+
else if (track.path === 'scale') {
|
|
121
|
+
let pivotMatrix, pivotMatrixInverse;
|
|
122
|
+
if (track.pivot) {
|
|
123
|
+
pivotMatrix = gl_matrix_1.mat4.fromTranslation(gl_matrix_1.mat4.create(), gl_matrix_1.vec3.fromValues(track.pivot[0], track.pivot[1], track.pivot[2]));
|
|
124
|
+
pivotMatrixInverse = gl_matrix_1.mat4.fromTranslation(gl_matrix_1.mat4.create(), gl_matrix_1.vec3.fromValues(-track.pivot[0], -track.pivot[1], -track.pivot[2]));
|
|
125
|
+
}
|
|
126
|
+
let vector;
|
|
127
|
+
if (track.interpolation === 'step') {
|
|
128
|
+
vector = gl_matrix_1.vec3.fromValues(track.values[(k - 1) * 3 + 0], track.values[(k - 1) * 3 + 1], track.values[(k - 1) * 3 + 2]);
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
vector = gl_matrix_1.vec3.lerp(gl_matrix_1.vec3.create(), gl_matrix_1.vec3.fromValues(track.values[(k - 1) * 3 + 0], track.values[(k - 1) * 3 + 1], track.values[(k - 1) * 3 + 2]), gl_matrix_1.vec3.fromValues(track.values[(k) * 3 + 0], track.values[(k) * 3 + 1], track.values[(k) * 3 + 2]), factor);
|
|
132
|
+
}
|
|
133
|
+
const scalingMatrix = gl_matrix_1.mat4.fromScaling(gl_matrix_1.mat4.create(), vector);
|
|
134
|
+
if (pivotMatrix && pivotMatrixInverse) {
|
|
135
|
+
scaleTransformation.matrix = gl_matrix_1.mat4.multiply(gl_matrix_1.mat4.create(), gl_matrix_1.mat4.multiply(gl_matrix_1.mat4.create(), pivotMatrix, scalingMatrix), pivotMatrixInverse);
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
scaleTransformation.matrix = scalingMatrix;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
else if (track.path === 'weights') {
|
|
142
|
+
let weights = [];
|
|
143
|
+
const weightCount = track.values.length / track.times.length;
|
|
144
|
+
if (track.interpolation === 'step') {
|
|
145
|
+
for (let l = 0; l < weightCount; l++)
|
|
146
|
+
weights.push(track.values[(k - 1) * weightCount + l]);
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
for (let l = 0; l < weightCount; l++)
|
|
150
|
+
weights.push(track.values[(k - 1) * weightCount + l] * (1.0 - factor) + (factor) * track.values[(k - 1) * weightCount + l]);
|
|
151
|
+
}
|
|
152
|
+
const applyWeights = (node) => {
|
|
153
|
+
for (let l = 0; l < node.data.length; l++)
|
|
154
|
+
if (node.data[l] instanceof viewer_shared_types_1.GeometryData && node.data[l].morphWeights.length === weightCount)
|
|
155
|
+
node.data[l].morphWeights = weights;
|
|
156
|
+
for (let l = 0; l < node.children.length; l++)
|
|
157
|
+
applyWeights(node.children[l]);
|
|
158
|
+
};
|
|
159
|
+
applyWeights(track.node);
|
|
160
|
+
}
|
|
161
|
+
break;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
return running;
|
|
167
|
+
}
|
|
168
|
+
updateAnimationData() {
|
|
169
|
+
this._animations = {};
|
|
170
|
+
const animationArray = this.gatherAnimations();
|
|
171
|
+
const names = animationArray.map(a => a.name);
|
|
172
|
+
for (let i = 0; i < animationArray.length; i++) {
|
|
173
|
+
const animationName = animationArray[i].name;
|
|
174
|
+
const nameIndices = [];
|
|
175
|
+
for (let j = 0; j < names.length; j++)
|
|
176
|
+
if (animationName === names[j])
|
|
177
|
+
nameIndices.push(j);
|
|
178
|
+
let animationNameAdjusted = animationName;
|
|
179
|
+
// name adjustement if the name occurs multiple times
|
|
180
|
+
if (nameIndices.length > 1) {
|
|
181
|
+
animationNameAdjusted = animationName + '_' + nameIndices.indexOf(i);
|
|
182
|
+
// even further name adjustement if the name is even then the same after adjustements (probably will never happen)
|
|
183
|
+
while (names.includes(animationNameAdjusted))
|
|
184
|
+
animationNameAdjusted += "_0";
|
|
185
|
+
}
|
|
186
|
+
this._animations[animationNameAdjusted] = animationArray[i];
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
// #endregion Public Methods (3)
|
|
190
|
+
// #region Private Methods (1)
|
|
191
|
+
gatherAnimations(node = this._tree.root) {
|
|
192
|
+
let out = [];
|
|
193
|
+
for (let i = 0, len = node.data.length; i < len; i++)
|
|
194
|
+
if (node.data[i] instanceof viewer_shared_types_1.AnimationData)
|
|
195
|
+
out.push(node.data[i]);
|
|
196
|
+
for (let i = 0, len = node.children.length; i < len; i++)
|
|
197
|
+
out = out.concat(this.gatherAnimations(node.children[i]));
|
|
198
|
+
return out;
|
|
199
|
+
}
|
|
200
|
+
};
|
|
201
|
+
AnimationEngine = __decorate([
|
|
202
|
+
(0, tsyringe_1.singleton)()
|
|
203
|
+
], AnimationEngine);
|
|
204
|
+
exports.AnimationEngine = AnimationEngine;
|
|
205
|
+
//# sourceMappingURL=AnimationEngine.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AnimationEngine.js","sourceRoot":"","sources":["../../src/implementation/AnimationEngine.ts"],"names":[],"mappings":";;;;;;;;;AAAA,uCAA+C;AAE/C,yCAAkD;AAClD,iFAA4E;AAC5E,yEAA6F;AAK7F,IAAa,eAAe,GAA5B,MAAa,eAAe;IAA5B;QACI,yBAAyB;QAER,UAAK,GAAiB,oBAAS,CAAC,OAAO,CAAC,8BAAI,CAAC,CAAC;QAEvD,gBAAW,GAEf,EAAE,CAAC;QA2NP,iCAAiC;IACrC,CAAC;IA1NG,4BAA4B;IAE5B,+BAA+B;IAE/B,IAAW,UAAU;QAIjB,OAAO,IAAI,CAAC,WAAW,CAAC;IAC5B,CAAC;IAED,kCAAkC;IAElC,6BAA6B;IAEtB,IAAI,KAAW,CAAC;IAEhB,MAAM,CAAC,SAA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|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEjE,OAAO,EACH,gBAAgB,EAChB,eAAe,EAClB,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AnimationEngine = void 0;
|
|
4
|
+
const AnimationEngine_1 = require("./implementation/AnimationEngine");
|
|
5
|
+
Object.defineProperty(exports, "AnimationEngine", { enumerable: true, get: function () { return AnimationEngine_1.AnimationEngine; } });
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,sEAAmE;AAK/D,gGALK,iCAAe,OAKL"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { IAnimationData } from "@shapediver/viewer.shared.types";
|
|
2
|
+
export interface IAnimationEngine {
|
|
3
|
+
animations: {
|
|
4
|
+
[key: string]: IAnimationData;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Update all animations and progress them according to the specified delta time.
|
|
8
|
+
*
|
|
9
|
+
* returns true, if at least one animation is running
|
|
10
|
+
*
|
|
11
|
+
* @param deltaTime
|
|
12
|
+
*/
|
|
13
|
+
update(deltaTime: number): boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Traverse the scene tree and gather all the animation data present in it.
|
|
16
|
+
*/
|
|
17
|
+
updateAnimationData(): void;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=IAnimationEngine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IAnimationEngine.d.ts","sourceRoot":"","sources":["../../src/interfaces/IAnimationEngine.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAEjE,MAAM,WAAW,gBAAgB;IAG7B,UAAU,EAAE;QACR,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,CAAA;KAChC,CAAA;IAMD;;;;;;OAMG;IACH,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC;IACnC;;OAEG;IACH,mBAAmB,IAAI,IAAI,CAAC;CAG/B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IAnimationEngine.js","sourceRoot":"","sources":["../../src/interfaces/IAnimationEngine.ts"],"names":[],"mappings":""}
|
package/package.json
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@shapediver/viewer.rendering-engine.animation-engine",
|
|
3
|
+
"version": "2.7.0",
|
|
4
|
+
"description": "",
|
|
5
|
+
"keywords": [],
|
|
6
|
+
"author": "Michael Oppitz <michael@shapediver.com>",
|
|
7
|
+
"license": "polyform-noncommercial-1.0.0",
|
|
8
|
+
"main": "dist/index.js",
|
|
9
|
+
"directories": {
|
|
10
|
+
"test": "__tests__"
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
"dist",
|
|
14
|
+
"src",
|
|
15
|
+
"package.json",
|
|
16
|
+
"README.md",
|
|
17
|
+
"tsconfig.json"
|
|
18
|
+
],
|
|
19
|
+
"publishConfig": {
|
|
20
|
+
"access": "public"
|
|
21
|
+
},
|
|
22
|
+
"repository": {
|
|
23
|
+
"type": "git",
|
|
24
|
+
"url": "git+https://github.com/shapediver/Viewer.git"
|
|
25
|
+
},
|
|
26
|
+
"scripts": {
|
|
27
|
+
"check": "tsc --noEmit",
|
|
28
|
+
"build": "bash ../../scripts/building/build.sh",
|
|
29
|
+
"build-watch": "bash ../../scripts/building/build-watch.sh",
|
|
30
|
+
"build-dep": "bash ../../scripts/building/build-dep.sh"
|
|
31
|
+
},
|
|
32
|
+
"bugs": {
|
|
33
|
+
"url": "https://github.com/shapediver/Viewer/issues"
|
|
34
|
+
},
|
|
35
|
+
"homepage": "https://github.com/shapediver/Viewer#readme",
|
|
36
|
+
"typings": "dist/index.d.ts",
|
|
37
|
+
"jest": {
|
|
38
|
+
"preset": "ts-jest",
|
|
39
|
+
"testEnvironment": "node"
|
|
40
|
+
},
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"@shapediver/viewer.rendering-engine.rendering-engine": "2.7.0",
|
|
43
|
+
"@shapediver/viewer.shared.node-tree": "2.7.0",
|
|
44
|
+
"@shapediver/viewer.shared.services": "2.7.0",
|
|
45
|
+
"@shapediver/viewer.shared.types": "2.7.0",
|
|
46
|
+
"@tweenjs/tween.js": "^18.6.4",
|
|
47
|
+
"gl-matrix": "3.3.0",
|
|
48
|
+
"tsyringe": "^4.5.0"
|
|
49
|
+
},
|
|
50
|
+
"gitHead": "3fcd319e1a6c41609a0e50d871d17811d36bffe8"
|
|
51
|
+
}
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
import { container, singleton } from 'tsyringe'
|
|
2
|
+
|
|
3
|
+
import { mat4, quat, vec3, vec4 } from 'gl-matrix'
|
|
4
|
+
import { ITree, ITreeNode, Tree } from '@shapediver/viewer.shared.node-tree'
|
|
5
|
+
import { AnimationData, GeometryData, IAnimationData } from '@shapediver/viewer.shared.types'
|
|
6
|
+
import { IManager } from '@shapediver/viewer.rendering-engine.rendering-engine';
|
|
7
|
+
import { IAnimationEngine } from '../interfaces/IAnimationEngine';
|
|
8
|
+
|
|
9
|
+
@singleton()
|
|
10
|
+
export class AnimationEngine implements IManager, IAnimationEngine {
|
|
11
|
+
// #region Properties (2)
|
|
12
|
+
|
|
13
|
+
private readonly _tree: ITree = <ITree>container.resolve(Tree);
|
|
14
|
+
|
|
15
|
+
private _animations: {
|
|
16
|
+
[key: string]: IAnimationData
|
|
17
|
+
} = {};
|
|
18
|
+
|
|
19
|
+
// #endregion Properties (2)
|
|
20
|
+
|
|
21
|
+
// #region Public Accessors (1)
|
|
22
|
+
|
|
23
|
+
public get animations(): {
|
|
24
|
+
[key: string]: IAnimationData
|
|
25
|
+
}
|
|
26
|
+
{
|
|
27
|
+
return this._animations;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// #endregion Public Accessors (1)
|
|
31
|
+
|
|
32
|
+
// #region Public Methods (3)
|
|
33
|
+
|
|
34
|
+
public init(): void { }
|
|
35
|
+
|
|
36
|
+
public update(deltaTime: number): boolean {
|
|
37
|
+
const animations = Object.values(this._animations);
|
|
38
|
+
let running = false;
|
|
39
|
+
|
|
40
|
+
for (let i = 0; i < animations.length; i++) {
|
|
41
|
+
const animation = animations[i];
|
|
42
|
+
if (animation.animationTime === -1) {
|
|
43
|
+
// if we just stopped we need to render one more time
|
|
44
|
+
running = true;
|
|
45
|
+
animation.animationTime = 0;
|
|
46
|
+
}
|
|
47
|
+
if (!animation.animate) continue;
|
|
48
|
+
running = true;
|
|
49
|
+
|
|
50
|
+
animation.animationTime += deltaTime;
|
|
51
|
+
if (animation.animationTime / 1000.0 > animation.duration) {
|
|
52
|
+
if (animation.repeat) {
|
|
53
|
+
animation.startAnimation();
|
|
54
|
+
} else {
|
|
55
|
+
animation.stopAnimation();
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const animationDuration = animation.duration!;
|
|
60
|
+
const currentAnimationDeltaTime = (animation.animationTime / 1000.0) % animationDuration;
|
|
61
|
+
|
|
62
|
+
for (let j = 0; j < animation.tracks.length; j++) {
|
|
63
|
+
const track = animation.tracks[j];
|
|
64
|
+
const id = animation.id + '_' + j;
|
|
65
|
+
if (currentAnimationDeltaTime < track.times[0] || currentAnimationDeltaTime > track.times[track.times.length - 1]) continue;
|
|
66
|
+
|
|
67
|
+
for (let k = 1; k < track.times.length; k++) {
|
|
68
|
+
if (currentAnimationDeltaTime < track.times[k] && currentAnimationDeltaTime > track.times[k - 1]) {
|
|
69
|
+
const prevAnimation = track.node.transformations.filter(t => t.id === id);
|
|
70
|
+
track.node.transformations = track.node.transformations.filter((el) => {
|
|
71
|
+
return !prevAnimation.includes(el);
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
const factor = (currentAnimationDeltaTime - track.times[k - 1]) / (track.times[k] - track.times[k - 1]);
|
|
75
|
+
|
|
76
|
+
let translationTransformation = track.node.transformations.find(t => t.id === 'gltf_matrix_translation');
|
|
77
|
+
if (!translationTransformation) {
|
|
78
|
+
translationTransformation = {
|
|
79
|
+
id: 'gltf_matrix_translation',
|
|
80
|
+
matrix: mat4.create()
|
|
81
|
+
}
|
|
82
|
+
track.node.transformations.push(translationTransformation)
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
let rotationTransformation = track.node.transformations.find(t => t.id === 'gltf_matrix_rotation');
|
|
86
|
+
if (!rotationTransformation) {
|
|
87
|
+
rotationTransformation = {
|
|
88
|
+
id: 'gltf_matrix_rotation',
|
|
89
|
+
matrix: mat4.create()
|
|
90
|
+
}
|
|
91
|
+
track.node.transformations.push(rotationTransformation)
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
let scaleTransformation = track.node.transformations.find(t => t.id === 'gltf_matrix_scale');
|
|
95
|
+
if (!scaleTransformation) {
|
|
96
|
+
scaleTransformation = {
|
|
97
|
+
id: 'gltf_matrix_scale',
|
|
98
|
+
matrix: mat4.create()
|
|
99
|
+
}
|
|
100
|
+
track.node.transformations.push(scaleTransformation)
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
if (track.path === 'rotation') {
|
|
104
|
+
let pivotMatrix: mat4 | undefined, pivotMatrixInverse: mat4 | undefined;
|
|
105
|
+
if (track.pivot) {
|
|
106
|
+
pivotMatrix = mat4.fromTranslation(mat4.create(), vec3.fromValues(track.pivot[0], track.pivot[1], track.pivot[2]));
|
|
107
|
+
pivotMatrixInverse = mat4.fromTranslation(mat4.create(), vec3.fromValues(-track.pivot[0], -track.pivot[1], -track.pivot[2]));
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
let quaternion: quat;
|
|
111
|
+
if (track.interpolation === 'step') {
|
|
112
|
+
quaternion = quat.fromValues(track.values[(k - 1) * 4 + 0], track.values[(k - 1) * 4 + 1], track.values[(k - 1) * 4 + 2], track.values[(k - 1) * 4 + 3]);
|
|
113
|
+
} else {
|
|
114
|
+
quaternion = quat.slerp(
|
|
115
|
+
vec4.create(),
|
|
116
|
+
vec4.fromValues(track.values[(k - 1) * 4 + 0], track.values[(k - 1) * 4 + 1], track.values[(k - 1) * 4 + 2], track.values[(k - 1) * 4 + 3]),
|
|
117
|
+
vec4.fromValues(track.values[(k) * 4 + 0], track.values[(k) * 4 + 1], track.values[(k) * 4 + 2], track.values[(k) * 4 + 3]),
|
|
118
|
+
factor)
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
const rotationMatrix = mat4.fromQuat(mat4.create(), quaternion);
|
|
122
|
+
if (pivotMatrix && pivotMatrixInverse) {
|
|
123
|
+
rotationTransformation.matrix = mat4.multiply(mat4.create(), mat4.multiply(mat4.create(), pivotMatrix, rotationMatrix), pivotMatrixInverse);
|
|
124
|
+
} else {
|
|
125
|
+
rotationTransformation.matrix = rotationMatrix;
|
|
126
|
+
}
|
|
127
|
+
} else if (track.path === 'translation') {
|
|
128
|
+
let vector: vec3;
|
|
129
|
+
if (track.interpolation === 'step') {
|
|
130
|
+
vector = vec3.fromValues(track.values[(k - 1) * 3 + 0], track.values[(k - 1) * 3 + 1], track.values[(k - 1) * 3 + 2]);
|
|
131
|
+
} else {
|
|
132
|
+
vector = vec3.lerp(
|
|
133
|
+
vec3.create(),
|
|
134
|
+
vec3.fromValues(track.values[(k - 1) * 3 + 0], track.values[(k - 1) * 3 + 1], track.values[(k - 1) * 3 + 2]),
|
|
135
|
+
vec3.fromValues(track.values[(k) * 3 + 0], track.values[(k) * 3 + 1], track.values[(k) * 3 + 2]),
|
|
136
|
+
factor)
|
|
137
|
+
}
|
|
138
|
+
translationTransformation.matrix = mat4.fromTranslation(mat4.create(), vector);
|
|
139
|
+
} else if (track.path === 'scale') {
|
|
140
|
+
let pivotMatrix: mat4 | undefined, pivotMatrixInverse: mat4 | undefined;
|
|
141
|
+
if (track.pivot) {
|
|
142
|
+
pivotMatrix = mat4.fromTranslation(mat4.create(), vec3.fromValues(track.pivot[0], track.pivot[1], track.pivot[2]));
|
|
143
|
+
pivotMatrixInverse = mat4.fromTranslation(mat4.create(), vec3.fromValues(-track.pivot[0], -track.pivot[1], -track.pivot[2]));
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
let vector: vec3;
|
|
147
|
+
if (track.interpolation === 'step') {
|
|
148
|
+
vector = vec3.fromValues(track.values[(k - 1) * 3 + 0], track.values[(k - 1) * 3 + 1], track.values[(k - 1) * 3 + 2]);
|
|
149
|
+
} else {
|
|
150
|
+
vector = vec3.lerp(
|
|
151
|
+
vec3.create(),
|
|
152
|
+
vec3.fromValues(track.values[(k - 1) * 3 + 0], track.values[(k - 1) * 3 + 1], track.values[(k - 1) * 3 + 2]),
|
|
153
|
+
vec3.fromValues(track.values[(k) * 3 + 0], track.values[(k) * 3 + 1], track.values[(k) * 3 + 2]),
|
|
154
|
+
factor)
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
const scalingMatrix = mat4.fromScaling(mat4.create(), vector);
|
|
158
|
+
if (pivotMatrix && pivotMatrixInverse) {
|
|
159
|
+
scaleTransformation.matrix = mat4.multiply(mat4.create(), mat4.multiply(mat4.create(), pivotMatrix, scalingMatrix), pivotMatrixInverse);
|
|
160
|
+
} else {
|
|
161
|
+
scaleTransformation.matrix = scalingMatrix;
|
|
162
|
+
}
|
|
163
|
+
} else if (track.path === 'weights') {
|
|
164
|
+
let weights: number[] = [];
|
|
165
|
+
const weightCount = track.values.length / track.times.length;
|
|
166
|
+
|
|
167
|
+
if (track.interpolation === 'step') {
|
|
168
|
+
for (let l = 0; l < weightCount; l++)
|
|
169
|
+
weights.push(track.values[(k - 1) * weightCount + l])
|
|
170
|
+
} else {
|
|
171
|
+
for (let l = 0; l < weightCount; l++)
|
|
172
|
+
weights.push(track.values[(k - 1) * weightCount + l] * (1.0 - factor) + (factor) * track.values[(k - 1) * weightCount + l]);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
const applyWeights = (node: ITreeNode) => {
|
|
176
|
+
for (let l = 0; l < node.data.length; l++)
|
|
177
|
+
if (node.data[l] instanceof GeometryData && (<GeometryData>node.data[l]).morphWeights.length === weightCount)
|
|
178
|
+
(<GeometryData>node.data[l]).morphWeights = weights;
|
|
179
|
+
|
|
180
|
+
for (let l = 0; l < node.children.length; l++)
|
|
181
|
+
applyWeights(node.children[l])
|
|
182
|
+
}
|
|
183
|
+
applyWeights(track.node);
|
|
184
|
+
}
|
|
185
|
+
break;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
return running;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
public updateAnimationData(): void {
|
|
194
|
+
this._animations = {};
|
|
195
|
+
|
|
196
|
+
const animationArray = this.gatherAnimations();
|
|
197
|
+
const names = animationArray.map(a => a.name);
|
|
198
|
+
|
|
199
|
+
for (let i = 0; i < animationArray.length; i++) {
|
|
200
|
+
const animationName = animationArray[i].name;
|
|
201
|
+
|
|
202
|
+
const nameIndices = [];
|
|
203
|
+
for (let j = 0; j < names.length; j++)
|
|
204
|
+
if (animationName === names[j])
|
|
205
|
+
nameIndices.push(j);
|
|
206
|
+
|
|
207
|
+
let animationNameAdjusted = animationName;
|
|
208
|
+
// name adjustement if the name occurs multiple times
|
|
209
|
+
if (nameIndices.length > 1) {
|
|
210
|
+
animationNameAdjusted = animationName + '_' + nameIndices.indexOf(i);
|
|
211
|
+
// even further name adjustement if the name is even then the same after adjustements (probably will never happen)
|
|
212
|
+
while (names.includes(animationNameAdjusted))
|
|
213
|
+
animationNameAdjusted += "_0";
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
this._animations[animationNameAdjusted] = animationArray[i];
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
// #endregion Public Methods (3)
|
|
221
|
+
|
|
222
|
+
// #region Private Methods (1)
|
|
223
|
+
|
|
224
|
+
private gatherAnimations(node: ITreeNode = this._tree.root): AnimationData[] {
|
|
225
|
+
let out: AnimationData[] = [];
|
|
226
|
+
for (let i = 0, len = node.data.length; i < len; i++)
|
|
227
|
+
if (node.data[i] instanceof AnimationData)
|
|
228
|
+
out.push(<AnimationData>node.data[i])
|
|
229
|
+
|
|
230
|
+
for (let i = 0, len = node.children.length; i < len; i++)
|
|
231
|
+
out = out.concat(this.gatherAnimations(node.children[i]))
|
|
232
|
+
|
|
233
|
+
return out;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
// #endregion Private Methods (1)
|
|
237
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { IAnimationData } from "@shapediver/viewer.shared.types";
|
|
2
|
+
|
|
3
|
+
export interface IAnimationEngine {
|
|
4
|
+
// #region Properties (1)
|
|
5
|
+
|
|
6
|
+
animations: {
|
|
7
|
+
[key: string]: IAnimationData
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
// #endregion Properties (1)
|
|
11
|
+
|
|
12
|
+
// #region Public Methods (2)
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Update all animations and progress them according to the specified delta time.
|
|
16
|
+
*
|
|
17
|
+
* returns true, if at least one animation is running
|
|
18
|
+
*
|
|
19
|
+
* @param deltaTime
|
|
20
|
+
*/
|
|
21
|
+
update(deltaTime: number): boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Traverse the scene tree and gather all the animation data present in it.
|
|
24
|
+
*/
|
|
25
|
+
updateAnimationData(): void;
|
|
26
|
+
|
|
27
|
+
// #endregion Public Methods (2)
|
|
28
|
+
}
|
package/tsconfig.json
ADDED