@@ -544,13 +544,16 @@ class SegmentationUserLayerDisplayState implements SegmentationDisplayState {
544544
545545 // so 2d/3d share GL context
546546 // the offscreen canvas is a separate context that doesn't share textures
547- this . segmentationColorUserShader = new SegmentationColorUserShaderManager ( this , this . layer . manager . chunkManager . chunkQueueManager . gl ) ;
548-
547+ this . segmentationColorUserShader = new SegmentationColorUserShaderManager (
548+ this ,
549+ this . layer . manager . chunkManager . chunkQueueManager . gl ,
550+ ) ;
551+
549552 this . offscreenGL = initializeWebGL ( new OffscreenCanvas ( 1 , 1 ) ) ;
550- this . offscreenSegmentationColorUserShader = new SegmentationColorUserShaderManager ( this , this . offscreenGL ) ;
553+ this . offscreenSegmentationColorUserShader =
554+ new SegmentationColorUserShaderManager ( this , this . offscreenGL ) ;
551555 this . getSegmentColorShader = this . makeSegmentColorShaderGetter ( ) ;
552-
553- } ;
556+ }
554557
555558 offscreenGL ;
556559 offscreenSegmentationColorUserShader ;
@@ -597,29 +600,36 @@ class SegmentationUserLayerDisplayState implements SegmentationDisplayState {
597600 segmentProperties : this . segmentationGroupState . value . segmentPropertyMap ,
598601 } ) ) ,
599602 ) ;
600- return parameterizedEmitterDependentShaderGetter ( this . layer , this . offscreenGL , {
601- memoizeKey : `segmentColorShaderTODO` ,
602- parameters,
603- encodeParameters : ( p ) => {
604- return `${ p . shaderBuilderState . parseResult . code } /${ p . segmentProperties ?. numericalProperties . length } ` ;
605- } ,
606- shaderError : this . layer . displayState . shaderError , // TODO can I reuse this?
607- defineShader : ( builder , { } ) => {
608- this . offscreenSegmentationColorUserShader . defineShader ( builder , /*fragment=*/ false ) ;
609- builder . addAttribute ( "highp vec4" , "aVertexPosition" ) ;
610- builder . addUniform ( "highp vec4" , "uColor" ) ;
611- builder . addUniform ( "highp uvec2" , "uID" ) ;
612- builder . addVarying ( "highp vec4" , "vColor" ) ;
613- let vertexMain = `
603+ return parameterizedEmitterDependentShaderGetter (
604+ this . layer ,
605+ this . offscreenGL ,
606+ {
607+ memoizeKey : `segmentColorShaderTODO` ,
608+ parameters,
609+ encodeParameters : ( p ) => {
610+ return `${ p . shaderBuilderState . parseResult . code } /${ p . segmentProperties ?. numericalProperties . length } ` ;
611+ } ,
612+ shaderError : this . layer . displayState . shaderError , // TODO can I reuse this?
613+ defineShader : ( builder ) => {
614+ this . offscreenSegmentationColorUserShader . defineShader (
615+ builder ,
616+ /*fragment=*/ false ,
617+ ) ;
618+ builder . addAttribute ( "highp vec4" , "aVertexPosition" ) ;
619+ builder . addUniform ( "highp vec4" , "uColor" ) ;
620+ builder . addUniform ( "highp uvec2" , "uID" ) ;
621+ builder . addVarying ( "highp vec4" , "vColor" ) ;
622+ const vertexMain = `
614623gl_Position = aVertexPosition;
615624loadSegmentProperties(uint64_t(uID));
616625vColor = segmentColor(uColor);
617626` ;
618- builder . addVertexMain ( vertexMain ) ;
619- builder . addOutputBuffer ( "vec4" , "out_fragColor" , 0 ) ;
620- builder . setFragmentMain ( "out_fragColor = vColor;" ) ;
627+ builder . addVertexMain ( vertexMain ) ;
628+ builder . addOutputBuffer ( "vec4" , "out_fragColor" , 0 ) ;
629+ builder . setFragmentMain ( "out_fragColor = vColor;" ) ;
630+ } ,
621631 } ,
622- } ) ;
632+ ) ;
623633 } ;
624634
625635 context = ( ) => { } ; // TEMP how to get rid of this?
0 commit comments