Skip to content

Commit ed5e3de

Browse files
authored
Examples: Always use FloatType in GPGPU examples with WebGL 2. (#23337)
1 parent 3a41724 commit ed5e3de

File tree

4 files changed

+4
-28
lines changed

4 files changed

+4
-28
lines changed

examples/webgl_gpgpu_birds.html

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,7 @@
502502

503503
gpuCompute = new GPUComputationRenderer( WIDTH, WIDTH, renderer );
504504

505-
if ( isSafari() ) {
505+
if ( renderer.capabilities.isWebGL2 === false ) {
506506

507507
gpuCompute.setDataType( THREE.HalfFloatType );
508508

@@ -549,12 +549,6 @@
549549

550550
}
551551

552-
function isSafari() {
553-
554-
return !! navigator.userAgent.match( /Safari/i ) && ! navigator.userAgent.match( /Chrome/i );
555-
556-
}
557-
558552
function initBirds() {
559553

560554
const geometry = new BirdGeometry();

examples/webgl_gpgpu_birds_gltf.html

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@
446446

447447
gpuCompute = new GPUComputationRenderer( WIDTH, WIDTH, renderer );
448448

449-
if ( isSafari() ) {
449+
if ( renderer.capabilities.isWebGL2 === false ) {
450450

451451
gpuCompute.setDataType( THREE.HalfFloatType );
452452

@@ -493,12 +493,6 @@
493493

494494
}
495495

496-
function isSafari() {
497-
498-
return !! navigator.userAgent.match( /Safari/i ) && ! navigator.userAgent.match( /Chrome/i );
499-
500-
}
501-
502496
function initBirds( effectController ) {
503497

504498
const geometry = BirdGeometry;

examples/webgl_gpgpu_protoplanet.html

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@
322322

323323
gpuCompute = new GPUComputationRenderer( WIDTH, WIDTH, renderer );
324324

325-
if ( isSafari() ) {
325+
if ( renderer.capabilities.isWebGL2 === false ) {
326326

327327
gpuCompute.setDataType( THREE.HalfFloatType );
328328

@@ -354,12 +354,6 @@
354354

355355
}
356356

357-
function isSafari() {
358-
359-
return !! navigator.userAgent.match( /Safari/i ) && ! navigator.userAgent.match( /Chrome/i );
360-
361-
}
362-
363357
function restartSimulation() {
364358

365359
const dtPosition = gpuCompute.createTexture();

examples/webgl_gpgpu_water.html

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@
451451

452452
gpuCompute = new GPUComputationRenderer( WIDTH, WIDTH, renderer );
453453

454-
if ( isSafari() ) {
454+
if ( renderer.capabilities.isWebGL2 === false ) {
455455

456456
gpuCompute.setDataType( THREE.HalfFloatType );
457457

@@ -504,12 +504,6 @@
504504

505505
}
506506

507-
function isSafari() {
508-
509-
return !! navigator.userAgent.match( /Safari/i ) && ! navigator.userAgent.match( /Chrome/i );
510-
511-
}
512-
513507
function fillTexture( texture ) {
514508

515509
const waterMaxHeight = 10;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy