|
@@ -20,16 +20,16 @@ THREE.Skeleton = function ( bones, boneInverses, useVertexTexture ) {
|
|
|
// create a bone texture or an array of floats
|
|
|
|
|
|
if ( this.useVertexTexture ) {
|
|
|
-
|
|
|
+
|
|
|
// layout (1 matrix = 4 pixels)
|
|
|
// RGBA RGBA RGBA RGBA (=> column1, column2, column3, column4)
|
|
|
// with 8x8 pixel texture max 16 bones * 4 pixels = (8 * 8)
|
|
|
// 16x16 pixel texture max 64 bones * 4 pixels = (16 * 16)
|
|
|
// 32x32 pixel texture max 256 bones * 4 pixels = (32 * 32)
|
|
|
// 64x64 pixel texture max 1024 bones * 4 pixels = (64 * 64)
|
|
|
-
|
|
|
+
|
|
|
var size = THREE.Math.nextPowerOfTwo( Math.sqrt( this.bones.length * 4 ) ); // 4 pixels needed for 1 matrix
|
|
|
-
|
|
|
+
|
|
|
this.boneTextureWidth = size;
|
|
|
this.boneTextureHeight = size;
|
|
|
|
|
@@ -144,7 +144,7 @@ THREE.Skeleton.prototype.pose = function () {
|
|
|
THREE.Skeleton.prototype.update = ( function () {
|
|
|
|
|
|
var offsetMatrix = new THREE.Matrix4();
|
|
|
-
|
|
|
+
|
|
|
return function () {
|
|
|
|
|
|
// flatten bone matrices to array
|
|
@@ -165,15 +165,13 @@ THREE.Skeleton.prototype.update = ( function () {
|
|
|
this.boneTexture.needsUpdate = true;
|
|
|
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
};
|
|
|
|
|
|
} )();
|
|
|
|
|
|
-THREE.Skeleton.prototype.clone = function ( ) {
|
|
|
+THREE.Skeleton.prototype.clone = function () {
|
|
|
|
|
|
- var object = new THREE.Skeleton(this.bones, this.boneInverses, this.useVertexTexture);
|
|
|
-
|
|
|
- return object;
|
|
|
+ return new THREE.Skeleton( this.bones, this.boneInverses, this.useVertexTexture );
|
|
|
|
|
|
-};
|
|
|
+};
|