@@ -170,27 +170,33 @@ class BaseGrinGlass extends BaseGlass {
170170 }
171171
172172 getGrinMapCache ( canvasRenderer ) {
173- this . _grinMapCache = this . buildGrinMapCache (
174- this . _grinMapCache ,
175- canvasRenderer ,
176- {
177- glassColorR : this . scene . theme . glass . color . r ,
178- glassColorG : this . scene . theme . glass . color . g ,
179- glassColorB : this . scene . theme . glass . color . b ,
180- glassAbsorptionColorR : this . scene . theme . glassAbsorption . color . r ,
181- glassAbsorptionColorG : this . scene . theme . glassAbsorption . color . g ,
182- glassAbsorptionColorB : this . scene . theme . glassAbsorption . color . b ,
183- absorptionIsZero : this . absorptionIsZero
184- } ,
185- ( sceneX , sceneY ) => {
186- const refIndexAppearance = this . getGrinRefIndexAppearance ( this . fn_p ( { x : sceneX , y : sceneY , z : Simulator . GREEN_WAVELENGTH } ) ) ;
187- const absorptionAppearance = this . absorptionIsZero || ! this . fn_alpha
188- ? null
189- : this . getGrinAbsorptionAppearance ( this . fn_alpha ( { x : sceneX , y : sceneY , z : Simulator . GREEN_WAVELENGTH } ) ) ;
190- return this . combineGrinAppearances ( refIndexAppearance , absorptionAppearance ) ;
191- }
192- ) ;
193- return this . _grinMapCache ;
173+ try {
174+ this . _grinMapCache = this . buildGrinMapCache (
175+ this . _grinMapCache ,
176+ canvasRenderer ,
177+ {
178+ glassColorR : this . scene . theme . glass . color . r ,
179+ glassColorG : this . scene . theme . glass . color . g ,
180+ glassColorB : this . scene . theme . glass . color . b ,
181+ glassAbsorptionColorR : this . scene . theme . glassAbsorption . color . r ,
182+ glassAbsorptionColorG : this . scene . theme . glassAbsorption . color . g ,
183+ glassAbsorptionColorB : this . scene . theme . glassAbsorption . color . b ,
184+ absorptionIsZero : this . absorptionIsZero
185+ } ,
186+ ( sceneX , sceneY ) => {
187+ const refIndexAppearance = this . getGrinRefIndexAppearance ( this . fn_p ( { x : sceneX , y : sceneY , z : Simulator . GREEN_WAVELENGTH } ) ) ;
188+ const absorptionAppearance = this . absorptionIsZero || ! this . fn_alpha
189+ ? null
190+ : this . getGrinAbsorptionAppearance ( this . fn_alpha ( { x : sceneX , y : sceneY , z : Simulator . GREEN_WAVELENGTH } ) ) ;
191+ return this . combineGrinAppearances ( refIndexAppearance , absorptionAppearance ) ;
192+ }
193+ ) ;
194+ return this . _grinMapCache ;
195+ } catch ( e ) {
196+ this . _grinMapCache = null ;
197+ this . error = e . toString ( ) ;
198+ return null ;
199+ }
194200 }
195201
196202 buildGrinMapCache ( existingCache , canvasRenderer , cacheData , sampleToAppearance ) {
0 commit comments