Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion src/nodes/accessors/SkinningNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,20 @@ class SkinningNode extends Node {

_frameId.set( skeleton, frame.frameId );

if ( this.previousBoneMatricesNode !== null ) skeleton.previousBoneMatrices.set( skeleton.boneMatrices );
if ( this.previousBoneMatricesNode !== null ) {

if ( skeleton.previousBoneMatrices === null ) {

// cloned skeletons miss "previousBoneMatrices" in their first updated

skeleton.previousBoneMatrices = new Float32Array( skeleton.boneMatrices );

}

skeleton.previousBoneMatrices.set( skeleton.boneMatrices );


}

skeleton.update();

Expand Down
9 changes: 9 additions & 0 deletions src/objects/Skeleton.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,15 @@ class Skeleton {
*/
this.boneMatrices = null;

/**
* An array buffer holding the bone data of the previous frame.
* Required for computing velocity. Maintained in {@link SkinningNode}.
*
* @type {?Float32Array}
* @default null
*/
this.previousBoneMatrices = null;

/**
* A texture holding the bone data for use
* in the vertex shader.
Expand Down
2 changes: 1 addition & 1 deletion src/renderers/webgpu/utils/WebGPUTextureUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,7 @@ class WebGPUTextureUtils {
*/
_getDefaultCubeTextureGPU( format ) {

let defaultCubeTexture = this.defaultTexture[ format ];
let defaultCubeTexture = this.defaultCubeTexture[ format ];

if ( defaultCubeTexture === undefined ) {

Expand Down