@@ -2807,6 +2807,9 @@ JSROOT.define(['d3', 'three', 'geobase', 'painter', 'base3d'], (d3, THREE, geo,
28072807 } else if ( obj . _typename === 'TGeoTrack' ) {
28082808 if ( ! add_objects || this . addExtra ( obj , itemname ) )
28092809 promise = this . drawGeoTrack ( obj , itemname ) ;
2810+ } else if ( obj . _typename === 'TPolyLine3D' ) {
2811+ if ( ! add_objects || this . addExtra ( obj , itemname ) )
2812+ promise = this . drawPolyLine ( obj , itemname ) ;
28102813 } else if ( ( obj . _typename === 'TEveTrack' ) || ( obj . _typename === 'ROOT::Experimental::TEveTrack' ) ) {
28112814 if ( ! add_objects || this . addExtra ( obj , itemname ) )
28122815 promise = this . drawEveTrack ( obj , itemname ) ;
@@ -2920,6 +2923,56 @@ JSROOT.define(['d3', 'three', 'geobase', 'painter', 'base3d'], (d3, THREE, geo,
29202923 return true ;
29212924 }
29222925
2926+ /** @summary drawing TPolyLine3D */
2927+ TGeoPainter . prototype . drawPolyLine = function ( line , itemname ) {
2928+ if ( ! line ) return false ;
2929+
2930+ let track_width = line . fLineWidth || 1 ,
2931+ track_color = jsrp . getColor ( line . fLineColor ) || "#ff00ff" ;
2932+
2933+ if ( JSROOT . browser . isWin ) track_width = 1 ; // not supported on windows
2934+
2935+ let fN , fP ;
2936+
2937+ if ( line . _blob && ( line . _blob . length == 4 ) ) {
2938+ // workaround for custom streamer for JSON, should be resolved
2939+ fN = line . _blob [ 1 ] ;
2940+ fP = line . _blob [ 2 ] ;
2941+ } else {
2942+ fN = line . fN ;
2943+ fP = line . fP ;
2944+ }
2945+
2946+ let npoints = fN ,
2947+ buf = new Float32Array ( ( npoints - 1 ) * 6 ) ,
2948+ pos = 0 , projv = this . ctrl . projectPos ,
2949+ projx = ( this . ctrl . project === "x" ) ,
2950+ projy = ( this . ctrl . project === "y" ) ,
2951+ projz = ( this . ctrl . project === "z" ) ;
2952+
2953+ for ( let k = 0 ; k < npoints - 1 ; ++ k ) {
2954+ buf [ pos ] = projx ? projv : fP [ k * 3 ] ;
2955+ buf [ pos + 1 ] = projy ? projv : fP [ k * 3 + 1 ] ;
2956+ buf [ pos + 2 ] = projz ? projv : fP [ k * 3 + 2 ] ;
2957+ buf [ pos + 3 ] = projx ? projv : fP [ k * 3 + 3 ] ;
2958+ buf [ pos + 4 ] = projy ? projv : fP [ k * 3 + 4 ] ;
2959+ buf [ pos + 5 ] = projz ? projv : fP [ k * 3 + 5 ] ;
2960+ pos += 6 ;
2961+ }
2962+
2963+ let lineMaterial = new THREE . LineBasicMaterial ( { color : track_color , linewidth : track_width } ) ,
2964+ line3d = jsrp . createLineSegments ( buf , lineMaterial ) ;
2965+
2966+ line3d . renderOrder = 1000000 ; // to bring line to the front
2967+ line3d . geo_name = itemname ;
2968+ line3d . geo_object = line ;
2969+ line3d . hightlightWidthScale = 2 ;
2970+
2971+ this . addToExtrasContainer ( line3d ) ;
2972+
2973+ return true ;
2974+ }
2975+
29232976 /** @summary Drawing TEveTrack */
29242977 TGeoPainter . prototype . drawEveTrack = function ( track , itemname ) {
29252978 if ( ! track || ( track . fN <= 0 ) ) return false ;
0 commit comments