|
@@ -249,13 +249,13 @@
|
|
|
const tHeight = nextPowerOf2( durationAnimation );
|
|
|
const tWidth = nextPowerOf2( birdGeo.getAttribute( 'position' ).count );
|
|
|
vertexPerBird = birdGeo.getAttribute( 'position' ).count;
|
|
|
- const tData = new Float32Array( 3 * tWidth * tHeight );
|
|
|
+ const tData = new Float32Array( 4 * tWidth * tHeight );
|
|
|
|
|
|
for ( let i = 0; i < tWidth; i ++ ) {
|
|
|
|
|
|
for ( let j = 0; j < tHeight; j ++ ) {
|
|
|
|
|
|
- const offset = j * tWidth * 3;
|
|
|
+ const offset = j * tWidth * 4;
|
|
|
|
|
|
const curMorph = Math.floor( j / durationAnimation * morphAttributes.length );
|
|
|
const nextMorph = ( Math.floor( j / durationAnimation * morphAttributes.length ) + 1 ) % morphAttributes.length;
|
|
@@ -268,17 +268,19 @@
|
|
|
d0 = morphAttributes[ curMorph ].array[ i * 3 ];
|
|
|
d1 = morphAttributes[ nextMorph ].array[ i * 3 ];
|
|
|
|
|
|
- if ( d0 !== undefined && d1 !== undefined ) tData[ offset + i * 3 ] = Math.lerp( d0, d1, lerpAmount );
|
|
|
+ if ( d0 !== undefined && d1 !== undefined ) tData[ offset + i * 4 ] = Math.lerp( d0, d1, lerpAmount );
|
|
|
|
|
|
d0 = morphAttributes[ curMorph ].array[ i * 3 + 1 ];
|
|
|
d1 = morphAttributes[ nextMorph ].array[ i * 3 + 1 ];
|
|
|
|
|
|
- if ( d0 !== undefined && d1 !== undefined ) tData[ offset + i * 3 + 1 ] = Math.lerp( d0, d1, lerpAmount );
|
|
|
+ if ( d0 !== undefined && d1 !== undefined ) tData[ offset + i * 4 + 1 ] = Math.lerp( d0, d1, lerpAmount );
|
|
|
|
|
|
d0 = morphAttributes[ curMorph ].array[ i * 3 + 2 ];
|
|
|
d1 = morphAttributes[ nextMorph ].array[ i * 3 + 2 ];
|
|
|
|
|
|
- if ( d0 !== undefined && d1 !== undefined ) tData[ offset + i * 3 + 2 ] = Math.lerp( d0, d1, lerpAmount );
|
|
|
+ if ( d0 !== undefined && d1 !== undefined ) tData[ offset + i * 4 + 2 ] = Math.lerp( d0, d1, lerpAmount );
|
|
|
+
|
|
|
+ tData[ offset + i * 4 + 3 ] = 1;
|
|
|
|
|
|
}
|
|
|
|
|
@@ -286,7 +288,7 @@
|
|
|
|
|
|
}
|
|
|
|
|
|
- textureAnimation = new THREE.DataTexture( tData, tWidth, tHeight, THREE.RGBFormat, THREE.FloatType );
|
|
|
+ textureAnimation = new THREE.DataTexture( tData, tWidth, tHeight, THREE.RGBAFormat, THREE.FloatType );
|
|
|
textureAnimation.needsUpdate = true;
|
|
|
|
|
|
const vertices = [], color = [], reference = [], seeds = [], indices = [];
|