@@ -253,12 +253,14 @@ sub PDL::Graphics::TriD::Trigrid::gdraw {
253253 my $idx = [0,1,2,0]; # for lines, below
254254 if (!$this -> {Options }{Shading }) {
255255 PDL::gl_triangles(map $_ -> mv(1,-1)-> dog, $faces , $colours );
256- } elsif ($this -> {Options }{Smooth }) {
257- my $tmpn =$this -> {VertexNormals }-> dice_axis(1,$this -> {Faceidx }-> flat)
258- -> splitdim(1,$this -> {Faceidx }-> dim(0));
259- PDL::gl_triangles_wn_mat(map $_ -> mv(1,-1)-> dog, $faces , $tmpn , $colours );
260256 } else {
261- PDL::gl_triangles_n_mat(map $_ -> mv(1,-1)-> dog, $faces , $colours );
257+ my $f = ' PDL::gl_triangles' ;
258+ $f .= ' _' . ($this -> {Options }{Smooth } ? ' w' : ' ' ) . ' n_mat' ;
259+ { no strict ' refs' ; $f = \&$f ; }
260+ my $tmpn = $this -> {Options }{Smooth }
261+ ? $this -> {VertexNormals }-> dice_axis(1,$this -> {Faceidx }-> flat)
262+ -> splitdim(1,$this -> {Faceidx }-> dim(0)) : undef ;
263+ $f -> (map $_ -> mv(1,-1)-> dog, $faces , $this -> {Options }{Smooth } ? $tmpn : (), $colours );
262264 }
263265 if ($this -> {Options }{ShowNormals }) {
264266 die " No normals to show!" if !grep defined $this -> {$_ }, qw( FaceNormals VertexNormals) ;
0 commit comments