3d v1.0.0 release (#4746)

* optimize deconstruction

* optimize data copy
This commit is contained in:
Weiliang Wang
2019-06-28 11:51:43 +08:00
committed by GitHub
parent b540c3d728
commit 4e1875ae0c
2 changed files with 9 additions and 12 deletions
+7 -8
View File
@@ -612,27 +612,26 @@ export class AnimationState extends Playable {
}
for (const curveInstace of samplerSharedGroup.curves) {
const { curve, blendTarget, target, propertyName } = curveInstace;
if (curve.empty()) {
if (curveInstace.curve.empty()) {
continue;
}
let value: any;
if (!lerpRequired) {
value = curve.valueAt(index);
value = curveInstace.curve.valueAt(index);
} else {
value = curve.valueBetween(
value = curveInstace.curve.valueBetween(
ratio,
samplerResultCache.from,
samplerResultCache.fromRatio,
samplerResultCache.to,
samplerResultCache.toRatio);
}
if (!curve._blendFunction || !blendTarget || blendTarget.refCount <= 1) {
target[propertyName] = value;
if (!curveInstace.curve._blendFunction || !curveInstace.blendTarget || curveInstace.blendTarget.refCount <= 1) {
curveInstace.target[curveInstace.propertyName] = value;
} else {
const { weight } = this;
blendTarget.value = curve._blendFunction(value, weight, blendTarget);
blendTarget.weight += weight;
curveInstace.blendTarget.value = curveInstace.curve._blendFunction(value, weight, curveInstace.blendTarget);
curveInstace.blendTarget.weight += weight;
}
}
}
+2 -4
View File
@@ -223,11 +223,9 @@ export class Model {
this._uboUpdated = true;
// @ts-ignore
const worldMatrix = this._transform._mat;
mat4.array(f32_1, worldMatrix);
this._uboLocal.view.set(f32_1, UBOLocal.MAT_WORLD_OFFSET);
mat4.array(this._uboLocal.view, worldMatrix, UBOLocal.MAT_WORLD_OFFSET);
mat4.inverseTranspose(m4_1, worldMatrix);
mat4.array(f32_1, m4_1);
this._uboLocal.view.set(f32_1, UBOLocal.MAT_WORLD_IT_OFFSET);
mat4.array(this._uboLocal.view, m4_1, UBOLocal.MAT_WORLD_IT_OFFSET);
const commonLocal = this._localBindings.get(UBOLocal.BLOCK.name);
if (commonLocal && commonLocal.buffer) {