@shapediver/viewer.rendering-engine.animation-engine
Advanced tools
Comparing version 2.10.1-rc.0 to 2.11.0
@@ -1,8 +0,11 @@ | ||
import { mat4, quat, vec3, vec4 } from 'gl-matrix'; | ||
import { Tree } from '@shapediver/viewer.shared.node-tree'; | ||
import { AnimationData, GeometryData } from '@shapediver/viewer.shared.types'; | ||
export class AnimationEngine { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.AnimationEngine = void 0; | ||
const gl_matrix_1 = require("gl-matrix"); | ||
const viewer_shared_node_tree_1 = require("@shapediver/viewer.shared.node-tree"); | ||
const viewer_shared_types_1 = require("@shapediver/viewer.shared.types"); | ||
class AnimationEngine { | ||
constructor() { | ||
// #region Properties (3) | ||
this._tree = Tree.instance; | ||
this._tree = viewer_shared_node_tree_1.Tree.instance; | ||
this._animations = {}; | ||
@@ -64,3 +67,3 @@ // #endregion Private Methods (1) | ||
id: 'gltf_matrix_translation', | ||
matrix: mat4.create() | ||
matrix: gl_matrix_1.mat4.create() | ||
}; | ||
@@ -73,3 +76,3 @@ track.node.transformations.push(translationTransformation); | ||
id: 'gltf_matrix_rotation', | ||
matrix: mat4.create() | ||
matrix: gl_matrix_1.mat4.create() | ||
}; | ||
@@ -82,3 +85,3 @@ track.node.transformations.push(rotationTransformation); | ||
id: 'gltf_matrix_scale', | ||
matrix: mat4.create() | ||
matrix: gl_matrix_1.mat4.create() | ||
}; | ||
@@ -90,15 +93,15 @@ track.node.transformations.push(scaleTransformation); | ||
if (track.pivot) { | ||
pivotMatrix = mat4.fromTranslation(mat4.create(), vec3.fromValues(track.pivot[0], track.pivot[1], track.pivot[2])); | ||
pivotMatrixInverse = mat4.fromTranslation(mat4.create(), vec3.fromValues(-track.pivot[0], -track.pivot[1], -track.pivot[2])); | ||
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])); | ||
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])); | ||
} | ||
let quaternion; | ||
if (track.interpolation === 'step') { | ||
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]); | ||
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]); | ||
} | ||
else { | ||
quaternion = quat.slerp(vec4.create(), 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]), vec4.fromValues(track.values[(k) * 4 + 0], track.values[(k) * 4 + 1], track.values[(k) * 4 + 2], track.values[(k) * 4 + 3]), factor); | ||
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); | ||
} | ||
const rotationMatrix = mat4.fromQuat(mat4.create(), quaternion); | ||
const rotationMatrix = gl_matrix_1.mat4.fromQuat(gl_matrix_1.mat4.create(), quaternion); | ||
if (pivotMatrix && pivotMatrixInverse) { | ||
rotationTransformation.matrix = mat4.multiply(mat4.create(), mat4.multiply(mat4.create(), pivotMatrix, rotationMatrix), pivotMatrixInverse); | ||
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); | ||
} | ||
@@ -112,8 +115,8 @@ else { | ||
if (track.interpolation === 'step') { | ||
vector = vec3.fromValues(track.values[(k - 1) * 3 + 0], track.values[(k - 1) * 3 + 1], track.values[(k - 1) * 3 + 2]); | ||
vector = gl_matrix_1.vec3.fromValues(track.values[(k - 1) * 3 + 0], track.values[(k - 1) * 3 + 1], track.values[(k - 1) * 3 + 2]); | ||
} | ||
else { | ||
vector = vec3.lerp(vec3.create(), vec3.fromValues(track.values[(k - 1) * 3 + 0], track.values[(k - 1) * 3 + 1], track.values[(k - 1) * 3 + 2]), vec3.fromValues(track.values[(k) * 3 + 0], track.values[(k) * 3 + 1], track.values[(k) * 3 + 2]), factor); | ||
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); | ||
} | ||
translationTransformation.matrix = mat4.fromTranslation(mat4.create(), vector); | ||
translationTransformation.matrix = gl_matrix_1.mat4.fromTranslation(gl_matrix_1.mat4.create(), vector); | ||
} | ||
@@ -123,15 +126,15 @@ else if (track.path === 'scale') { | ||
if (track.pivot) { | ||
pivotMatrix = mat4.fromTranslation(mat4.create(), vec3.fromValues(track.pivot[0], track.pivot[1], track.pivot[2])); | ||
pivotMatrixInverse = mat4.fromTranslation(mat4.create(), vec3.fromValues(-track.pivot[0], -track.pivot[1], -track.pivot[2])); | ||
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])); | ||
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])); | ||
} | ||
let vector; | ||
if (track.interpolation === 'step') { | ||
vector = vec3.fromValues(track.values[(k - 1) * 3 + 0], track.values[(k - 1) * 3 + 1], track.values[(k - 1) * 3 + 2]); | ||
vector = gl_matrix_1.vec3.fromValues(track.values[(k - 1) * 3 + 0], track.values[(k - 1) * 3 + 1], track.values[(k - 1) * 3 + 2]); | ||
} | ||
else { | ||
vector = vec3.lerp(vec3.create(), vec3.fromValues(track.values[(k - 1) * 3 + 0], track.values[(k - 1) * 3 + 1], track.values[(k - 1) * 3 + 2]), vec3.fromValues(track.values[(k) * 3 + 0], track.values[(k) * 3 + 1], track.values[(k) * 3 + 2]), factor); | ||
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); | ||
} | ||
const scalingMatrix = mat4.fromScaling(mat4.create(), vector); | ||
const scalingMatrix = gl_matrix_1.mat4.fromScaling(gl_matrix_1.mat4.create(), vector); | ||
if (pivotMatrix && pivotMatrixInverse) { | ||
scaleTransformation.matrix = mat4.multiply(mat4.create(), mat4.multiply(mat4.create(), pivotMatrix, scalingMatrix), pivotMatrixInverse); | ||
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); | ||
} | ||
@@ -155,3 +158,3 @@ else { | ||
for (let l = 0; l < node.data.length; l++) | ||
if (node.data[l] instanceof GeometryData && node.data[l].morphWeights.length === weightCount) | ||
if (node.data[l] instanceof viewer_shared_types_1.GeometryData && node.data[l].morphWeights.length === weightCount) | ||
node.data[l].morphWeights = weights; | ||
@@ -196,3 +199,3 @@ for (let l = 0; l < node.children.length; l++) | ||
for (let i = 0, len = node.data.length; i < len; i++) | ||
if (node.data[i] instanceof AnimationData) | ||
if (node.data[i] instanceof viewer_shared_types_1.AnimationData) | ||
out.push(node.data[i]); | ||
@@ -204,2 +207,3 @@ for (let i = 0, len = node.children.length; i < len; i++) | ||
} | ||
exports.AnimationEngine = AnimationEngine; | ||
//# sourceMappingURL=AnimationEngine.js.map |
@@ -1,3 +0,6 @@ | ||
import { AnimationEngine } from "./implementation/AnimationEngine"; | ||
export { AnimationEngine }; | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.AnimationEngine = void 0; | ||
const AnimationEngine_1 = require("./implementation/AnimationEngine"); | ||
Object.defineProperty(exports, "AnimationEngine", { enumerable: true, get: function () { return AnimationEngine_1.AnimationEngine; } }); | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,3 @@ | ||
export {}; | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=IAnimationEngine.js.map |
{ | ||
"name": "@shapediver/viewer.rendering-engine.animation-engine", | ||
"version": "2.10.1-rc.0", | ||
"version": "2.11.0", | ||
"description": "", | ||
@@ -42,10 +42,10 @@ "keywords": [], | ||
"dependencies": { | ||
"@shapediver/viewer.rendering-engine.rendering-engine": "2.10.1-rc.0", | ||
"@shapediver/viewer.shared.node-tree": "2.10.1-rc.0", | ||
"@shapediver/viewer.shared.services": "2.10.1-rc.0", | ||
"@shapediver/viewer.shared.types": "2.10.1-rc.0", | ||
"@shapediver/viewer.rendering-engine.rendering-engine": "2.11.0", | ||
"@shapediver/viewer.shared.node-tree": "2.11.0", | ||
"@shapediver/viewer.shared.services": "2.11.0", | ||
"@shapediver/viewer.shared.types": "2.11.0", | ||
"@tweenjs/tween.js": "^18.6.4", | ||
"gl-matrix": "3.3.0" | ||
}, | ||
"gitHead": "7d6e75b740536d82351b9f4d1c2b0722bbde5a87" | ||
"gitHead": "abc828ee5f772bc79b737c994716b8ec372503ef" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
46640
488
1
+ Added@shapediver/viewer.rendering-engine.rendering-engine@2.11.0(transitive)
+ Added@shapediver/viewer.settings@0.5.7(transitive)
+ Added@shapediver/viewer.shared.build-data@2.11.0(transitive)
+ Added@shapediver/viewer.shared.math@2.11.0(transitive)
+ Added@shapediver/viewer.shared.node-tree@2.11.0(transitive)
+ Added@shapediver/viewer.shared.services@2.11.0(transitive)
+ Added@shapediver/viewer.shared.types@2.11.0(transitive)
- Removed@shapediver/viewer.rendering-engine.rendering-engine@2.10.1-rc.0(transitive)
- Removed@shapediver/viewer.settings@0.5.5(transitive)
- Removed@shapediver/viewer.shared.build-data@2.10.1-rc.0(transitive)
- Removed@shapediver/viewer.shared.math@2.10.1-rc.0(transitive)
- Removed@shapediver/viewer.shared.node-tree@2.10.1-rc.0(transitive)
- Removed@shapediver/viewer.shared.services@2.10.1-rc.0(transitive)
- Removed@shapediver/viewer.shared.types@2.10.1-rc.0(transitive)
Updated@shapediver/viewer.rendering-engine.rendering-engine@2.11.0