@@ -197,9 +197,19 @@ sub PDL::Graphics::TriD::Lattice::gdraw {
197197 $this -> _lattice_lines($points ,$this -> {Colors });
198198 } else {
199199 glShadeModel($shading == 1 ? GL_FLAT : GL_SMOOTH);
200- _lattice_slice(\&PDL::gl_triangles, $points , $this -> {Colors });
200+ my $f = ' PDL::gl_triangles' ;
201+ $f .= ' _' . ($this -> {Options }{Smooth } ? ' w' : ' ' ) . ' n_mat' if $shading > 2;
202+ { no strict ' refs' ; $f = \&$f ; }
203+ _lattice_slice($f , $points , $this -> {Options }{Smooth } ? $this -> {Normals } : (), $this -> {Colors });
201204 $this -> _lattice_lines($points ) if $this -> {Options }{Lines };
202205 }
206+ if ($this -> {Options }{ShowNormals }) {
207+ die " No normals to show!" if !defined $this -> {Normals };
208+ my $arrows = $points -> append($points + $this -> {Normals }*0.1)-> splitdim(0,3);
209+ glDisable(GL_LIGHTING);
210+ glColor3d(1,1,1);
211+ PDL::Graphics::OpenGLQ::gl_arrows($arrows , 0, 1, 0.5, 0.02);
212+ }
203213}
204214
205215sub PDL ::Graphics::TriD::LineStrip::gdraw {
@@ -235,29 +245,6 @@ sub PDL::Graphics::TriD::Contours::gdraw {
235245 }
236246}
237247
238- sub PDL ::Graphics::TriD::SLattice_S::gdraw {
239- my ($this ,$points ) = @_ ;
240- barf " Need 3D points"
241- if grep $_ -> ndims < 3, $points ;
242- glShadeModel(GL_SMOOTH); # By-vertex doesn't make sense otherwise.
243- my $f = ' PDL::gl_triangles_' ;
244- $f .= ' w' if $this -> {Options }{Smooth };
245- $f .= ' n_mat' ;
246- { no strict ' refs' ; $f = \&$f ; }
247- my @pdls = $points ;
248- push @pdls , $this -> {Normals } if $this -> {Options }{Smooth };
249- push @pdls , $this -> {Colors };
250- _lattice_slice($f , @pdls );
251- $this -> _lattice_lines($points ) if $this -> {Options }{Lines };
252- if ($this -> {Options }{ShowNormals }) {
253- die " No normals to show!" if !defined $this -> {Normals };
254- my $arrows = $points -> append($points + $this -> {Normals }*0.1)-> splitdim(0,3);
255- glDisable(GL_LIGHTING);
256- glColor3d(1,1,1);
257- PDL::Graphics::OpenGLQ::gl_arrows($arrows , 0, 1, 0.5, 0.02);
258- }
259- }
260-
261248sub PDL ::Graphics::TriD::Trigrid::gdraw {
262249 my ($this ,$points ) = @_ ;
263250 my $faces = $points -> dice_axis(1,$this -> {Faceidx }-> flat)-> splitdim(1,3);
0 commit comments