Răsfoiți Sursa

Updated examples to change Data Type on Safari Browsers

Jono 5 ani în urmă
părinte
comite
666a4efec6

+ 8 - 0
examples/webgl_gpgpu_birds.html

@@ -483,6 +483,10 @@
 
 				gpuCompute = new GPUComputationRenderer( WIDTH, WIDTH, renderer );
 
+				if ( isSafari() ) {
+					gpuCompute.setDataType( THREE.HalfFloatType );
+				}
+
 				var dtPosition = gpuCompute.createTexture();
 				var dtVelocity = gpuCompute.createTexture();
 				fillPositionTexture( dtPosition );
@@ -523,6 +527,10 @@
 
 			}
 
+			function isSafari() {
+				return !!navigator.userAgent.match(/Safari/i) && !navigator.userAgent.match(/Chrome/i);
+			}
+
 			function initBirds() {
 
 				var geometry = new BirdGeometry();

+ 8 - 0
examples/webgl_gpgpu_birds_gltf.html

@@ -431,6 +431,10 @@
 
 				gpuCompute = new GPUComputationRenderer( WIDTH, WIDTH, renderer );
 
+				if ( isSafari() ) {
+					gpuCompute.setDataType( THREE.HalfFloatType );
+				}
+
 				var dtPosition = gpuCompute.createTexture();
 				var dtVelocity = gpuCompute.createTexture();
 				fillPositionTexture( dtPosition );
@@ -472,6 +476,10 @@
 
 			}
 
+			function isSafari() {
+				return !!navigator.userAgent.match(/Safari/i) && !navigator.userAgent.match(/Chrome/i);
+			}
+
 			function initBirds() {
 
 				var geometry = BirdGeometry;

+ 8 - 0
examples/webgl_gpgpu_protoplanet.html

@@ -316,6 +316,10 @@
 
 				gpuCompute = new GPUComputationRenderer( WIDTH, WIDTH, renderer );
 
+				if ( isSafari() ) {
+					gpuCompute.setDataType( THREE.HalfFloatType );
+				}
+
 				var dtPosition = gpuCompute.createTexture();
 				var dtVelocity = gpuCompute.createTexture();
 
@@ -342,6 +346,10 @@
 
 			}
 
+			function isSafari() {
+				return !!navigator.userAgent.match(/Safari/i) && !navigator.userAgent.match(/Chrome/i);
+			}
+
 			function restartSimulation() {
 
 				var dtPosition = gpuCompute.createTexture();

+ 8 - 0
examples/webgl_gpgpu_water.html

@@ -444,6 +444,10 @@
 
 				gpuCompute = new GPUComputationRenderer( WIDTH, WIDTH, renderer );
 
+				if ( isSafari() ) {
+					gpuCompute.setDataType( THREE.HalfFloatType );
+				}
+
 				var heightmap0 = gpuCompute.createTexture();
 
 				fillTexture( heightmap0 );
@@ -492,6 +496,10 @@
 
 			}
 
+			function isSafari() {
+				return !!navigator.userAgent.match(/Safari/i) && !navigator.userAgent.match(/Chrome/i);
+			}
+
 			function fillTexture( texture ) {
 
 				var waterMaxHeight = 10;