|
@@ -9884,6 +9884,16 @@ class BufferGeometry extends EventDispatcher {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ applyQuaternion( q ) {
|
|
|
+
|
|
|
+ _m1.makeRotationFromQuaternion( q );
|
|
|
+
|
|
|
+ this.applyMatrix4( _m1 );
|
|
|
+
|
|
|
+ return this;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
rotateX( angle ) {
|
|
|
|
|
|
// rotate geometry around world x-axis
|
|
@@ -12262,29 +12272,6 @@ class WebGLCubeRenderTarget extends WebGLRenderTarget {
|
|
|
|
|
|
WebGLCubeRenderTarget.prototype.isWebGLCubeRenderTarget = true;
|
|
|
|
|
|
-class DataTexture extends Texture {
|
|
|
-
|
|
|
- constructor( data, width, height, format, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy, encoding ) {
|
|
|
-
|
|
|
- super( null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, encoding );
|
|
|
-
|
|
|
- this.image = { data: data || null, width: width || 1, height: height || 1 };
|
|
|
-
|
|
|
- this.magFilter = magFilter !== undefined ? magFilter : NearestFilter;
|
|
|
- this.minFilter = minFilter !== undefined ? minFilter : NearestFilter;
|
|
|
-
|
|
|
- this.generateMipmaps = false;
|
|
|
- this.flipY = false;
|
|
|
- this.unpackAlignment = 1;
|
|
|
-
|
|
|
- this.needsUpdate = true;
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
-}
|
|
|
-
|
|
|
-DataTexture.prototype.isDataTexture = true;
|
|
|
-
|
|
|
const _sphere$2 = /*@__PURE__*/ new Sphere();
|
|
|
const _vector$7 = /*@__PURE__*/ new Vector3();
|
|
|
|
|
@@ -25053,34 +25040,9 @@ function WebGLRenderer( parameters ) {
|
|
|
|
|
|
if ( skeleton ) {
|
|
|
|
|
|
- const bones = skeleton.bones;
|
|
|
-
|
|
|
if ( capabilities.floatVertexTextures ) {
|
|
|
|
|
|
- if ( skeleton.boneTexture === null ) {
|
|
|
-
|
|
|
- // 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)
|
|
|
-
|
|
|
-
|
|
|
- let size = Math.sqrt( bones.length * 4 ); // 4 pixels needed for 1 matrix
|
|
|
- size = ceilPowerOfTwo( size );
|
|
|
- size = Math.max( size, 4 );
|
|
|
-
|
|
|
- const boneMatrices = new Float32Array( size * size * 4 ); // 4 floats per RGBA pixel
|
|
|
- boneMatrices.set( skeleton.boneMatrices ); // copy current values
|
|
|
-
|
|
|
- const boneTexture = new DataTexture( boneMatrices, size, size, RGBAFormat, FloatType );
|
|
|
-
|
|
|
- skeleton.boneMatrices = boneMatrices;
|
|
|
- skeleton.boneTexture = boneTexture;
|
|
|
- skeleton.boneTextureSize = size;
|
|
|
-
|
|
|
- }
|
|
|
+ if ( skeleton.boneTexture === null ) skeleton.computeBoneTexture();
|
|
|
|
|
|
p_uniforms.setValue( _gl, 'boneTexture', skeleton.boneTexture, textures );
|
|
|
p_uniforms.setValue( _gl, 'boneTextureSize', skeleton.boneTextureSize );
|
|
@@ -26702,6 +26664,29 @@ class Bone extends Object3D {
|
|
|
|
|
|
Bone.prototype.isBone = true;
|
|
|
|
|
|
+class DataTexture extends Texture {
|
|
|
+
|
|
|
+ constructor( data, width, height, format, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy, encoding ) {
|
|
|
+
|
|
|
+ super( null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, encoding );
|
|
|
+
|
|
|
+ this.image = { data: data || null, width: width || 1, height: height || 1 };
|
|
|
+
|
|
|
+ this.magFilter = magFilter !== undefined ? magFilter : NearestFilter;
|
|
|
+ this.minFilter = minFilter !== undefined ? minFilter : NearestFilter;
|
|
|
+
|
|
|
+ this.generateMipmaps = false;
|
|
|
+ this.flipY = false;
|
|
|
+ this.unpackAlignment = 1;
|
|
|
+
|
|
|
+ this.needsUpdate = true;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+DataTexture.prototype.isDataTexture = true;
|
|
|
+
|
|
|
const _offsetMatrix = /*@__PURE__*/ new Matrix4();
|
|
|
const _identityMatrix = /*@__PURE__*/ new Matrix4();
|
|
|
|
|
@@ -26856,6 +26841,32 @@ class Skeleton {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ computeBoneTexture() {
|
|
|
+
|
|
|
+ // 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)
|
|
|
+
|
|
|
+ let size = Math.sqrt( this.bones.length * 4 ); // 4 pixels needed for 1 matrix
|
|
|
+ size = ceilPowerOfTwo( size );
|
|
|
+ size = Math.max( size, 4 );
|
|
|
+
|
|
|
+ const boneMatrices = new Float32Array( size * size * 4 ); // 4 floats per RGBA pixel
|
|
|
+ boneMatrices.set( this.boneMatrices ); // copy current values
|
|
|
+
|
|
|
+ const boneTexture = new DataTexture( boneMatrices, size, size, RGBAFormat, FloatType );
|
|
|
+
|
|
|
+ this.boneMatrices = boneMatrices;
|
|
|
+ this.boneTexture = boneTexture;
|
|
|
+ this.boneTextureSize = size;
|
|
|
+
|
|
|
+ return this;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
getBoneByName( name ) {
|
|
|
|
|
|
for ( let i = 0, il = this.bones.length; i < il; i ++ ) {
|