|
@@ -18227,6 +18227,7 @@ var BABYLON;
|
|
_this._buffer = buffer;
|
|
_this._buffer = buffer;
|
|
_this._deleteBuffer = deleteBuffer;
|
|
_this._deleteBuffer = deleteBuffer;
|
|
_this._format = format;
|
|
_this._format = format;
|
|
|
|
+ scene = _this.getScene();
|
|
if (!url) {
|
|
if (!url) {
|
|
return _this;
|
|
return _this;
|
|
}
|
|
}
|
|
@@ -18895,6 +18896,7 @@ var BABYLON;
|
|
/**
|
|
/**
|
|
* Returns an array of integers or floats, or a Float32Array, depending on the requested `kind` (positions, indices, normals, etc).
|
|
* Returns an array of integers or floats, or a Float32Array, depending on the requested `kind` (positions, indices, normals, etc).
|
|
* If `copywhenShared` is true (default false) and if the mesh geometry is shared among some other meshes, the returned array is a copy of the internal one.
|
|
* If `copywhenShared` is true (default false) and if the mesh geometry is shared among some other meshes, the returned array is a copy of the internal one.
|
|
|
|
+ * You can force the copy with forceCopy === true
|
|
* Returns null if the mesh has no geometry or no vertex buffer.
|
|
* Returns null if the mesh has no geometry or no vertex buffer.
|
|
* Possible `kind` values :
|
|
* Possible `kind` values :
|
|
* - BABYLON.VertexBuffer.PositionKind
|
|
* - BABYLON.VertexBuffer.PositionKind
|
|
@@ -18910,11 +18912,11 @@ var BABYLON;
|
|
* - BABYLON.VertexBuffer.MatricesWeightsKind
|
|
* - BABYLON.VertexBuffer.MatricesWeightsKind
|
|
* - BABYLON.VertexBuffer.MatricesWeightsExtraKind
|
|
* - BABYLON.VertexBuffer.MatricesWeightsExtraKind
|
|
*/
|
|
*/
|
|
- Mesh.prototype.getVerticesData = function (kind, copyWhenShared) {
|
|
|
|
|
|
+ Mesh.prototype.getVerticesData = function (kind, copyWhenShared, forceCopy) {
|
|
if (!this._geometry) {
|
|
if (!this._geometry) {
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
- return this._geometry.getVerticesData(kind, copyWhenShared);
|
|
|
|
|
|
+ return this._geometry.getVerticesData(kind, copyWhenShared, forceCopy);
|
|
};
|
|
};
|
|
/**
|
|
/**
|
|
* Returns the mesh VertexBuffer object from the requested `kind` : positions, indices, normals, etc.
|
|
* Returns the mesh VertexBuffer object from the requested `kind` : positions, indices, normals, etc.
|
|
@@ -21188,7 +21190,7 @@ var BABYLON;
|
|
for (index = 0; index < meshes.length; index++) {
|
|
for (index = 0; index < meshes.length; index++) {
|
|
if (meshes[index]) {
|
|
if (meshes[index]) {
|
|
meshes[index].computeWorldMatrix(true);
|
|
meshes[index].computeWorldMatrix(true);
|
|
- otherVertexData = BABYLON.VertexData.ExtractFromMesh(meshes[index], true);
|
|
|
|
|
|
+ otherVertexData = BABYLON.VertexData.ExtractFromMesh(meshes[index], false, true);
|
|
otherVertexData.transform(meshes[index].getWorldMatrix());
|
|
otherVertexData.transform(meshes[index].getWorldMatrix());
|
|
if (vertexData) {
|
|
if (vertexData) {
|
|
vertexData.merge(otherVertexData);
|
|
vertexData.merge(otherVertexData);
|
|
@@ -24163,58 +24165,58 @@ var BABYLON;
|
|
/**
|
|
/**
|
|
* Returns the object VertexData associated to the passed mesh.
|
|
* Returns the object VertexData associated to the passed mesh.
|
|
*/
|
|
*/
|
|
- VertexData.ExtractFromMesh = function (mesh, copyWhenShared) {
|
|
|
|
- return VertexData._ExtractFrom(mesh, copyWhenShared);
|
|
|
|
|
|
+ VertexData.ExtractFromMesh = function (mesh, copyWhenShared, forceCopy) {
|
|
|
|
+ return VertexData._ExtractFrom(mesh, copyWhenShared, forceCopy);
|
|
};
|
|
};
|
|
/**
|
|
/**
|
|
* Returns the object VertexData associated to the passed geometry.
|
|
* Returns the object VertexData associated to the passed geometry.
|
|
*/
|
|
*/
|
|
- VertexData.ExtractFromGeometry = function (geometry, copyWhenShared) {
|
|
|
|
- return VertexData._ExtractFrom(geometry, copyWhenShared);
|
|
|
|
|
|
+ VertexData.ExtractFromGeometry = function (geometry, copyWhenShared, forceCopy) {
|
|
|
|
+ return VertexData._ExtractFrom(geometry, copyWhenShared, forceCopy);
|
|
};
|
|
};
|
|
- VertexData._ExtractFrom = function (meshOrGeometry, copyWhenShared) {
|
|
|
|
|
|
+ VertexData._ExtractFrom = function (meshOrGeometry, copyWhenShared, forceCopy) {
|
|
var result = new VertexData();
|
|
var result = new VertexData();
|
|
if (meshOrGeometry.isVerticesDataPresent(BABYLON.VertexBuffer.PositionKind)) {
|
|
if (meshOrGeometry.isVerticesDataPresent(BABYLON.VertexBuffer.PositionKind)) {
|
|
- result.positions = meshOrGeometry.getVerticesData(BABYLON.VertexBuffer.PositionKind, copyWhenShared);
|
|
|
|
|
|
+ result.positions = meshOrGeometry.getVerticesData(BABYLON.VertexBuffer.PositionKind, copyWhenShared, forceCopy);
|
|
}
|
|
}
|
|
if (meshOrGeometry.isVerticesDataPresent(BABYLON.VertexBuffer.NormalKind)) {
|
|
if (meshOrGeometry.isVerticesDataPresent(BABYLON.VertexBuffer.NormalKind)) {
|
|
- result.normals = meshOrGeometry.getVerticesData(BABYLON.VertexBuffer.NormalKind, copyWhenShared);
|
|
|
|
|
|
+ result.normals = meshOrGeometry.getVerticesData(BABYLON.VertexBuffer.NormalKind, copyWhenShared, forceCopy);
|
|
}
|
|
}
|
|
if (meshOrGeometry.isVerticesDataPresent(BABYLON.VertexBuffer.TangentKind)) {
|
|
if (meshOrGeometry.isVerticesDataPresent(BABYLON.VertexBuffer.TangentKind)) {
|
|
- result.tangents = meshOrGeometry.getVerticesData(BABYLON.VertexBuffer.TangentKind, copyWhenShared);
|
|
|
|
|
|
+ result.tangents = meshOrGeometry.getVerticesData(BABYLON.VertexBuffer.TangentKind, copyWhenShared, forceCopy);
|
|
}
|
|
}
|
|
if (meshOrGeometry.isVerticesDataPresent(BABYLON.VertexBuffer.UVKind)) {
|
|
if (meshOrGeometry.isVerticesDataPresent(BABYLON.VertexBuffer.UVKind)) {
|
|
- result.uvs = meshOrGeometry.getVerticesData(BABYLON.VertexBuffer.UVKind, copyWhenShared);
|
|
|
|
|
|
+ result.uvs = meshOrGeometry.getVerticesData(BABYLON.VertexBuffer.UVKind, copyWhenShared, forceCopy);
|
|
}
|
|
}
|
|
if (meshOrGeometry.isVerticesDataPresent(BABYLON.VertexBuffer.UV2Kind)) {
|
|
if (meshOrGeometry.isVerticesDataPresent(BABYLON.VertexBuffer.UV2Kind)) {
|
|
- result.uvs2 = meshOrGeometry.getVerticesData(BABYLON.VertexBuffer.UV2Kind, copyWhenShared);
|
|
|
|
|
|
+ result.uvs2 = meshOrGeometry.getVerticesData(BABYLON.VertexBuffer.UV2Kind, copyWhenShared, forceCopy);
|
|
}
|
|
}
|
|
if (meshOrGeometry.isVerticesDataPresent(BABYLON.VertexBuffer.UV3Kind)) {
|
|
if (meshOrGeometry.isVerticesDataPresent(BABYLON.VertexBuffer.UV3Kind)) {
|
|
- result.uvs3 = meshOrGeometry.getVerticesData(BABYLON.VertexBuffer.UV3Kind, copyWhenShared);
|
|
|
|
|
|
+ result.uvs3 = meshOrGeometry.getVerticesData(BABYLON.VertexBuffer.UV3Kind, copyWhenShared, forceCopy);
|
|
}
|
|
}
|
|
if (meshOrGeometry.isVerticesDataPresent(BABYLON.VertexBuffer.UV4Kind)) {
|
|
if (meshOrGeometry.isVerticesDataPresent(BABYLON.VertexBuffer.UV4Kind)) {
|
|
- result.uvs4 = meshOrGeometry.getVerticesData(BABYLON.VertexBuffer.UV4Kind, copyWhenShared);
|
|
|
|
|
|
+ result.uvs4 = meshOrGeometry.getVerticesData(BABYLON.VertexBuffer.UV4Kind, copyWhenShared, forceCopy);
|
|
}
|
|
}
|
|
if (meshOrGeometry.isVerticesDataPresent(BABYLON.VertexBuffer.UV5Kind)) {
|
|
if (meshOrGeometry.isVerticesDataPresent(BABYLON.VertexBuffer.UV5Kind)) {
|
|
- result.uvs5 = meshOrGeometry.getVerticesData(BABYLON.VertexBuffer.UV5Kind, copyWhenShared);
|
|
|
|
|
|
+ result.uvs5 = meshOrGeometry.getVerticesData(BABYLON.VertexBuffer.UV5Kind, copyWhenShared, forceCopy);
|
|
}
|
|
}
|
|
if (meshOrGeometry.isVerticesDataPresent(BABYLON.VertexBuffer.UV6Kind)) {
|
|
if (meshOrGeometry.isVerticesDataPresent(BABYLON.VertexBuffer.UV6Kind)) {
|
|
- result.uvs6 = meshOrGeometry.getVerticesData(BABYLON.VertexBuffer.UV6Kind, copyWhenShared);
|
|
|
|
|
|
+ result.uvs6 = meshOrGeometry.getVerticesData(BABYLON.VertexBuffer.UV6Kind, copyWhenShared, forceCopy);
|
|
}
|
|
}
|
|
if (meshOrGeometry.isVerticesDataPresent(BABYLON.VertexBuffer.ColorKind)) {
|
|
if (meshOrGeometry.isVerticesDataPresent(BABYLON.VertexBuffer.ColorKind)) {
|
|
- result.colors = meshOrGeometry.getVerticesData(BABYLON.VertexBuffer.ColorKind, copyWhenShared);
|
|
|
|
|
|
+ result.colors = meshOrGeometry.getVerticesData(BABYLON.VertexBuffer.ColorKind, copyWhenShared, forceCopy);
|
|
}
|
|
}
|
|
if (meshOrGeometry.isVerticesDataPresent(BABYLON.VertexBuffer.MatricesIndicesKind)) {
|
|
if (meshOrGeometry.isVerticesDataPresent(BABYLON.VertexBuffer.MatricesIndicesKind)) {
|
|
- result.matricesIndices = meshOrGeometry.getVerticesData(BABYLON.VertexBuffer.MatricesIndicesKind, copyWhenShared);
|
|
|
|
|
|
+ result.matricesIndices = meshOrGeometry.getVerticesData(BABYLON.VertexBuffer.MatricesIndicesKind, copyWhenShared, forceCopy);
|
|
}
|
|
}
|
|
if (meshOrGeometry.isVerticesDataPresent(BABYLON.VertexBuffer.MatricesWeightsKind)) {
|
|
if (meshOrGeometry.isVerticesDataPresent(BABYLON.VertexBuffer.MatricesWeightsKind)) {
|
|
- result.matricesWeights = meshOrGeometry.getVerticesData(BABYLON.VertexBuffer.MatricesWeightsKind, copyWhenShared);
|
|
|
|
|
|
+ result.matricesWeights = meshOrGeometry.getVerticesData(BABYLON.VertexBuffer.MatricesWeightsKind, copyWhenShared, forceCopy);
|
|
}
|
|
}
|
|
if (meshOrGeometry.isVerticesDataPresent(BABYLON.VertexBuffer.MatricesIndicesExtraKind)) {
|
|
if (meshOrGeometry.isVerticesDataPresent(BABYLON.VertexBuffer.MatricesIndicesExtraKind)) {
|
|
- result.matricesIndicesExtra = meshOrGeometry.getVerticesData(BABYLON.VertexBuffer.MatricesIndicesExtraKind, copyWhenShared);
|
|
|
|
|
|
+ result.matricesIndicesExtra = meshOrGeometry.getVerticesData(BABYLON.VertexBuffer.MatricesIndicesExtraKind, copyWhenShared, forceCopy);
|
|
}
|
|
}
|
|
if (meshOrGeometry.isVerticesDataPresent(BABYLON.VertexBuffer.MatricesWeightsExtraKind)) {
|
|
if (meshOrGeometry.isVerticesDataPresent(BABYLON.VertexBuffer.MatricesWeightsExtraKind)) {
|
|
- result.matricesWeightsExtra = meshOrGeometry.getVerticesData(BABYLON.VertexBuffer.MatricesWeightsExtraKind, copyWhenShared);
|
|
|
|
|
|
+ result.matricesWeightsExtra = meshOrGeometry.getVerticesData(BABYLON.VertexBuffer.MatricesWeightsExtraKind, copyWhenShared, forceCopy);
|
|
}
|
|
}
|
|
result.indices = meshOrGeometry.getIndices(copyWhenShared);
|
|
result.indices = meshOrGeometry.getIndices(copyWhenShared);
|
|
return result;
|
|
return result;
|
|
@@ -26100,13 +26102,13 @@ var BABYLON;
|
|
}
|
|
}
|
|
return this._totalVertices;
|
|
return this._totalVertices;
|
|
};
|
|
};
|
|
- Geometry.prototype.getVerticesData = function (kind, copyWhenShared) {
|
|
|
|
|
|
+ Geometry.prototype.getVerticesData = function (kind, copyWhenShared, forceCopy) {
|
|
var vertexBuffer = this.getVertexBuffer(kind);
|
|
var vertexBuffer = this.getVertexBuffer(kind);
|
|
if (!vertexBuffer) {
|
|
if (!vertexBuffer) {
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
var orig = vertexBuffer.getData();
|
|
var orig = vertexBuffer.getData();
|
|
- if (!copyWhenShared || this._meshes.length === 1) {
|
|
|
|
|
|
+ if (!forceCopy && (!copyWhenShared || this._meshes.length === 1)) {
|
|
return orig;
|
|
return orig;
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
@@ -32727,7 +32729,7 @@ var BABYLON;
|
|
return BABYLON.Quaternion.Slerp(startValue, endValue, gradient);
|
|
return BABYLON.Quaternion.Slerp(startValue, endValue, gradient);
|
|
};
|
|
};
|
|
Animation.prototype.quaternionInterpolateFunctionWithTangents = function (startValue, outTangent, endValue, inTangent, gradient) {
|
|
Animation.prototype.quaternionInterpolateFunctionWithTangents = function (startValue, outTangent, endValue, inTangent, gradient) {
|
|
- return BABYLON.Quaternion.Hermite(startValue, outTangent, endValue, inTangent, gradient);
|
|
|
|
|
|
+ return BABYLON.Quaternion.Hermite(startValue, outTangent, endValue, inTangent, gradient).normalize();
|
|
};
|
|
};
|
|
Animation.prototype.vector3InterpolateFunction = function (startValue, endValue, gradient) {
|
|
Animation.prototype.vector3InterpolateFunction = function (startValue, endValue, gradient) {
|
|
return BABYLON.Vector3.Lerp(startValue, endValue, gradient);
|
|
return BABYLON.Vector3.Lerp(startValue, endValue, gradient);
|
|
@@ -32795,8 +32797,9 @@ var BABYLON;
|
|
var startValue = this._getKeyValue(startKey.value);
|
|
var startValue = this._getKeyValue(startKey.value);
|
|
var endValue = this._getKeyValue(endKey.value);
|
|
var endValue = this._getKeyValue(endKey.value);
|
|
var useTangent = startKey.outTangent && endKey.inTangent;
|
|
var useTangent = startKey.outTangent && endKey.inTangent;
|
|
|
|
+ var frameDelta = endKey.frame - startKey.frame;
|
|
// gradient : percent of currentFrame between the frame inf and the frame sup
|
|
// gradient : percent of currentFrame between the frame inf and the frame sup
|
|
- var gradient = (currentFrame - startKey.frame) / (endKey.frame - startKey.frame);
|
|
|
|
|
|
+ var gradient = (currentFrame - startKey.frame) / frameDelta;
|
|
// check for easingFunction and correction of gradient
|
|
// check for easingFunction and correction of gradient
|
|
if (this._easingFunction != null) {
|
|
if (this._easingFunction != null) {
|
|
gradient = this._easingFunction.ease(gradient);
|
|
gradient = this._easingFunction.ease(gradient);
|
|
@@ -32814,7 +32817,7 @@ var BABYLON;
|
|
break;
|
|
break;
|
|
// Quaternion
|
|
// Quaternion
|
|
case Animation.ANIMATIONTYPE_QUATERNION:
|
|
case Animation.ANIMATIONTYPE_QUATERNION:
|
|
- var quaternion = useTangent ? this.quaternionInterpolateFunctionWithTangents(startValue, startKey.outTangent, endValue, endKey.inTangent, gradient) : this.quaternionInterpolateFunction(startValue, endValue, gradient);
|
|
|
|
|
|
+ var quaternion = useTangent ? this.quaternionInterpolateFunctionWithTangents(startValue, startKey.outTangent.scale(frameDelta), endValue, endKey.inTangent.scale(frameDelta), gradient) : this.quaternionInterpolateFunction(startValue, endValue, gradient);
|
|
switch (loopMode) {
|
|
switch (loopMode) {
|
|
case Animation.ANIMATIONLOOPMODE_CYCLE:
|
|
case Animation.ANIMATIONLOOPMODE_CYCLE:
|
|
case Animation.ANIMATIONLOOPMODE_CONSTANT:
|
|
case Animation.ANIMATIONLOOPMODE_CONSTANT:
|
|
@@ -32825,7 +32828,7 @@ var BABYLON;
|
|
return quaternion;
|
|
return quaternion;
|
|
// Vector3
|
|
// Vector3
|
|
case Animation.ANIMATIONTYPE_VECTOR3:
|
|
case Animation.ANIMATIONTYPE_VECTOR3:
|
|
- var vec3Value = useTangent ? this.vector3InterpolateFunctionWithTangents(startValue, startKey.outTangent, endValue, endKey.inTangent, gradient) : this.vector3InterpolateFunction(startValue, endValue, gradient);
|
|
|
|
|
|
+ var vec3Value = useTangent ? this.vector3InterpolateFunctionWithTangents(startValue, startKey.outTangent.scale(frameDelta), endValue, endKey.inTangent.scale(frameDelta), gradient) : this.vector3InterpolateFunction(startValue, endValue, gradient);
|
|
switch (loopMode) {
|
|
switch (loopMode) {
|
|
case Animation.ANIMATIONLOOPMODE_CYCLE:
|
|
case Animation.ANIMATIONLOOPMODE_CYCLE:
|
|
case Animation.ANIMATIONLOOPMODE_CONSTANT:
|
|
case Animation.ANIMATIONLOOPMODE_CONSTANT:
|
|
@@ -32835,7 +32838,7 @@ var BABYLON;
|
|
}
|
|
}
|
|
// Vector2
|
|
// Vector2
|
|
case Animation.ANIMATIONTYPE_VECTOR2:
|
|
case Animation.ANIMATIONTYPE_VECTOR2:
|
|
- var vec2Value = useTangent ? this.vector2InterpolateFunctionWithTangents(startValue, startKey.outTangent, endValue, endKey.inTangent, gradient) : this.vector2InterpolateFunction(startValue, endValue, gradient);
|
|
|
|
|
|
+ var vec2Value = useTangent ? this.vector2InterpolateFunctionWithTangents(startValue, startKey.outTangent.scale(frameDelta), endValue, endKey.inTangent.scale(frameDelta), gradient) : this.vector2InterpolateFunction(startValue, endValue, gradient);
|
|
switch (loopMode) {
|
|
switch (loopMode) {
|
|
case Animation.ANIMATIONLOOPMODE_CYCLE:
|
|
case Animation.ANIMATIONLOOPMODE_CYCLE:
|
|
case Animation.ANIMATIONLOOPMODE_CONSTANT:
|
|
case Animation.ANIMATIONLOOPMODE_CONSTANT:
|