File tree Expand file tree Collapse file tree 1 file changed +12
-9
lines changed
examples/jsm/postprocessing Expand file tree Collapse file tree 1 file changed +12
-9
lines changed Original file line number Diff line number Diff line change @@ -103,7 +103,7 @@ class GTAOPass extends Pass {
103103 */
104104 this . output = 0 ;
105105 this . _renderGBuffer = true ;
106- this . _visibilityCache = new Map ( ) ;
106+ this . _visibilityCache = [ ] ;
107107
108108 /**
109109 * The AO blend intensity.
@@ -653,29 +653,32 @@ class GTAOPass extends Pass {
653653 const scene = this . scene ;
654654 const cache = this . _visibilityCache ;
655655
656+ cache . length = 0 ;
657+
656658 scene . traverse ( function ( object ) {
657659
658- cache . set ( object , object . visible ) ;
660+ if ( ( object . isPoints || object . isLine || object . isLine2 ) && object . visible ) {
661+
662+ object . visible = false ;
663+ cache . push ( object ) ;
659664
660- if ( object . isPoints || object . isLine || object . isLine2 ) object . visible = false ;
665+ }
661666
662667 } ) ;
663668
664669 }
665670
666671 _restoreVisibility ( ) {
667672
668- const scene = this . scene ;
669673 const cache = this . _visibilityCache ;
670674
671- scene . traverse ( function ( object ) {
675+ for ( let i = 0 ; i < cache . length ; i ++ ) {
672676
673- const visible = cache . get ( object ) ;
674- object . visible = visible ;
677+ cache [ i ] . visible = true ;
675678
676- } ) ;
679+ }
677680
678- cache . clear ( ) ;
681+ cache . length = 0 ;
679682
680683 }
681684
You can’t perform that action at this time.
0 commit comments