File tree Expand file tree Collapse file tree 3 files changed +11
-1
lines changed
Expand file tree Collapse file tree 3 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -32,6 +32,9 @@ Demo at [jons.website/projects/reaction-diffusion](https://jons.website/projects
3232 - This is a float value greater than 0. Higher numbers mean the peaks are closer together.
3333 - If you don't set this value, a circular non-random seed is used instead.
3434 - A good way to debug this is to set the time scale to 0. That way, the simulation will stay with whatever the initial seed is.
35+ * For speed, you can force half-precision float precision by setting `force-half-precision="true"`.
36+ - `<div class="reaction-diffusion-container" force-half-precision="true"></div>`
37+ - Valid values are "true" or "false". If you don't specify, it'll default to "false".
3538
3639## Building
3740
Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ export class ReactionDiffusionRenderer {
4343 this . CheckWebGLSupport ( ) ;
4444
4545 // Configure renderer based on available texture float precision
46- if ( this . DetectTextureFloat ( ) ) {
46+ if ( this . DetectTextureFloat ( ) && ! this . forceHalfPrecision ) {
4747 console . log ( "Using full-precision float textures" ) ;
4848 this . imageType = THREE . FloatType ;
4949
@@ -110,6 +110,10 @@ export class ReactionDiffusionRenderer {
110110 this . allowInteraction = optionalParams . allowInteraction ;
111111 console . log ( `Using allow-interaction value from HTML attributes = ${ optionalParams . allowInteraction } ` ) ;
112112 }
113+ if ( optionalParams . forceHalfPrecision != null ) {
114+ this . forceHalfPrecision = optionalParams . forceHalfPrecision
115+ console . log ( `Using force-half-precision value from HTML attributes = ${ optionalParams . forceHalfPrecision } ` ) ;
116+ }
113117
114118 this . ReformRenderTargets ( width , height ) ;
115119 this . Reset ( ) ;
Original file line number Diff line number Diff line change @@ -86,6 +86,9 @@ export class ReactionDiffusion {
8686 let allowInteraction = container . getAttribute ( "allow-interaction" ) ;
8787 if ( allowInteraction ) params [ "allowInteraction" ] = allowInteraction == "true" ;
8888
89+ let forceHalfPrecision = container . getAttribute ( "force-half-precision" ) ;
90+ if ( forceHalfPrecision ) params [ "forceHalfPrecision" ] = forceHalfPrecision == "true" ;
91+
8992 return params ;
9093 }
9194
You can’t perform that action at this time.
0 commit comments