File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -704,25 +704,54 @@ function Loader( editor ) {
704704 group . scale . multiplyScalar ( 0.1 ) ;
705705 group . scale . y *= - 1 ;
706706
707+ let renderOrder = 0 ;
708+
707709 for ( let i = 0 ; i < paths . length ; i ++ ) {
708710
709711 const path = paths [ i ] ;
710712
711- const material = new THREE . MeshBasicMaterial ( {
712- color : path . color ,
713- depthWrite : false
714- } ) ;
713+ // fill
714+
715+ const fillMaterial = SVGLoader . createFillMaterial ( path ) ;
716+
717+ if ( fillMaterial ) {
718+
719+ const shapes = SVGLoader . createShapes ( path ) ;
715720
716- const shapes = SVGLoader . createShapes ( path ) ;
721+ for ( let j = 0 ; j < shapes . length ; j ++ ) {
717722
718- for ( let j = 0 ; j < shapes . length ; j ++ ) {
723+ const shape = shapes [ j ] ;
719724
720- const shape = shapes [ j ] ;
725+ const geometry = new THREE . ShapeGeometry ( shape ) ;
726+ const mesh = new THREE . Mesh ( geometry , fillMaterial ) ;
727+ mesh . renderOrder = renderOrder ++ ;
728+
729+ group . add ( mesh ) ;
730+
731+ }
732+
733+ }
721734
722- const geometry = new THREE . ShapeGeometry ( shape ) ;
723- const mesh = new THREE . Mesh ( geometry , material ) ;
735+ // stroke
724736
725- group . add ( mesh ) ;
737+ const strokeMaterial = SVGLoader . createStrokeMaterial ( path ) ;
738+
739+ if ( strokeMaterial ) {
740+
741+ for ( const subPath of path . subPaths ) {
742+
743+ const geometry = SVGLoader . pointsToStroke ( subPath . getPoints ( ) , path . userData . style ) ;
744+
745+ if ( geometry ) {
746+
747+ const mesh = new THREE . Mesh ( geometry , strokeMaterial ) ;
748+ mesh . renderOrder = renderOrder ++ ;
749+
750+ group . add ( mesh ) ;
751+
752+ }
753+
754+ }
726755
727756 }
728757
You can’t perform that action at this time.
0 commit comments