소스 검색

Examples: Avoid NaN values in data textures in webgl_gpgpu_birds_gltf.

Mugen87 5 년 전
부모
커밋
b901758a00
1개의 변경된 파일17개의 추가작업 그리고 4개의 파일을 삭제
  1. 17 4
      examples/webgl_gpgpu_birds_gltf.html

+ 17 - 4
examples/webgl_gpgpu_birds_gltf.html

@@ -261,13 +261,26 @@
 
 						if ( j < durationAnimation ) {
 
-							tData[ offset + i * 3 ] = Math.lerp( morphAttributes[ curMorph ].array[ i * 3 ], morphAttributes[ nextMorph ].array[ i * 3 ], lerpAmount );
-							tData[ offset + i * 3 + 1 ] = Math.lerp( morphAttributes[ curMorph ].array[ i * 3 + 1 ], morphAttributes[ nextMorph ].array[ i * 3 + 1 ], lerpAmount );
-							tData[ offset + i * 3 + 2 ] = Math.lerp( morphAttributes[ curMorph ].array[ i * 3 + 2 ], morphAttributes[ nextMorph ].array[ i * 3 + 2 ], lerpAmount );
+							var d0, d1;
+
+							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 );
+
+							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 );
+
+							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 );
 
 						}
 
-		}
+					}
 
 				}