浏览代码

Examples: Always use FloatType in GPGPU examples with WebGL 2. (#23337)

Michael Herzog 3 年之前
父节点
当前提交
ed5e3decf0

+ 1 - 7
examples/webgl_gpgpu_birds.html

@@ -502,7 +502,7 @@
 
 				gpuCompute = new GPUComputationRenderer( WIDTH, WIDTH, renderer );
 
-				if ( isSafari() ) {
+				if ( renderer.capabilities.isWebGL2 === false ) {
 
 					gpuCompute.setDataType( THREE.HalfFloatType );
 
@@ -549,12 +549,6 @@
 
 			}
 
-			function isSafari() {
-
-				return !! navigator.userAgent.match( /Safari/i ) && ! navigator.userAgent.match( /Chrome/i );
-
-			}
-
 			function initBirds() {
 
 				const geometry = new BirdGeometry();

+ 1 - 7
examples/webgl_gpgpu_birds_gltf.html

@@ -446,7 +446,7 @@
 
 				gpuCompute = new GPUComputationRenderer( WIDTH, WIDTH, renderer );
 
-				if ( isSafari() ) {
+				if ( renderer.capabilities.isWebGL2 === false ) {
 
 					gpuCompute.setDataType( THREE.HalfFloatType );
 
@@ -493,12 +493,6 @@
 
 			}
 
-			function isSafari() {
-
-				return !! navigator.userAgent.match( /Safari/i ) && ! navigator.userAgent.match( /Chrome/i );
-
-			}
-
 			function initBirds( effectController ) {
 
 				const geometry = BirdGeometry;

+ 1 - 7
examples/webgl_gpgpu_protoplanet.html

@@ -322,7 +322,7 @@
 
 				gpuCompute = new GPUComputationRenderer( WIDTH, WIDTH, renderer );
 
-				if ( isSafari() ) {
+				if ( renderer.capabilities.isWebGL2 === false ) {
 
 					gpuCompute.setDataType( THREE.HalfFloatType );
 
@@ -354,12 +354,6 @@
 
 			}
 
-			function isSafari() {
-
-				return !! navigator.userAgent.match( /Safari/i ) && ! navigator.userAgent.match( /Chrome/i );
-
-			}
-
 			function restartSimulation() {
 
 				const dtPosition = gpuCompute.createTexture();

+ 1 - 7
examples/webgl_gpgpu_water.html

@@ -451,7 +451,7 @@
 
 				gpuCompute = new GPUComputationRenderer( WIDTH, WIDTH, renderer );
 
-				if ( isSafari() ) {
+				if ( renderer.capabilities.isWebGL2 === false ) {
 
 					gpuCompute.setDataType( THREE.HalfFloatType );
 
@@ -504,12 +504,6 @@
 
 			}
 
-			function isSafari() {
-
-				return !! navigator.userAgent.match( /Safari/i ) && ! navigator.userAgent.match( /Chrome/i );
-
-			}
-
 			function fillTexture( texture ) {
 
 				const waterMaxHeight = 10;