@@ -1389,7 +1389,10 @@ export function shaderCodeWithPropertyPreprocessing(
13891389 }
13901390 }
13911391 for ( const [ i , property ] of numericalProperties . entries ( ) ) {
1392- code = code . replaceAll ( `prop("${ property . id } ")` , `uSegmentNumericalProperty${ i } ` ) ;
1392+ code = code . replaceAll (
1393+ `prop("${ property . id } ")` ,
1394+ `uSegmentNumericalProperty${ i } ` ,
1395+ ) ;
13931396 }
13941397 return code ;
13951398}
@@ -1425,31 +1428,34 @@ export const setSegmentPropertyUniforms = (
14251428 id : bigint ,
14261429) => {
14271430 const index = segmentPropertyMap . getSegmentInlineIndex ( id ) ;
1431+ const {
1432+ labels,
1433+ tags : tagsProperty ,
1434+ numericalProperties,
1435+ } = segmentPropertyMap ;
1436+ labels ; // TODO, support labels
14281437
1429- if ( index !== - 1 ) {
1430- const {
1431- labels,
1432- tags : tagsProperty ,
1433- numericalProperties,
1434- } = segmentPropertyMap ;
1435- labels ; // TODO, support labels
1438+ for ( const [ i , property ] of numericalProperties . entries ( ) ) {
1439+ const value = index !== - 1 ? property . values [ index ] : 0 ;
1440+ const uniformSetter = getShaderUniformValueSetter ( gl , property . dataType ) ;
1441+ uniformSetter . call (
1442+ gl ,
1443+ shader . uniform ( `uSegmentNumericalProperty${ i } ` ) ,
1444+ value ,
1445+ ) ;
1446+ }
14361447
1437- for ( const [ i , property ] of numericalProperties . entries ( ) ) {
1438- const value = property . values [ index ] ;
1439- const uniformSetter = getShaderUniformValueSetter ( gl , property . dataType ) ;
1440- uniformSetter . call ( gl , shader . uniform ( `uSegmentNumericalProperty ${ i } ` ) , value ) ;
1448+ if ( tagsProperty !== undefined ) {
1449+ const { values , tags } = tagsProperty ;
1450+ for ( let i = 0 ; i < tags . length ; ++ i ) {
1451+ gl . uniform1ui ( shader . uniform ( `uSegmentTagProperty ${ i } ` ) , 0 ) ;
14411452 }
1453+ const tagIndices = index !== - 1 ? values [ index ] : "" ;
1454+ for ( let i = 0 , length = tagIndices . length ; i < length ; ++ i ) {
1455+ const tagIdx = tagIndices . charCodeAt ( i ) ;
14421456
1443- if ( tagsProperty !== undefined ) {
1444- const { values, tags } = tagsProperty ;
1445- const tagIndices = values [ index ] ;
1446- for ( let i = 0 ; i < tags . length ; ++ i ) {
1447- gl . uniform1ui ( shader . uniform ( `uSegmentTagProperty${ i } ` ) , 0 ) ;
1448- }
1449- for ( let i = 0 , length = tagIndices . length ; i < length ; ++ i ) {
1450- const tagIdx = tagIndices . charCodeAt ( i ) ;
1451- gl . uniform1ui ( shader . uniform ( `uSegmentTagProperty${ tagIdx } ` ) , 1 ) ;
1452- }
1457+ console . log ( "enable tag property" , tagIdx ) ;
1458+ gl . uniform1ui ( shader . uniform ( `uSegmentTagProperty${ tagIdx } ` ) , 1 ) ;
14531459 }
14541460 }
14551461} ;
0 commit comments