Skip to content

Commit f7a5571

Browse files
committed
gl_triangles take normals as single param
1 parent ca3d977 commit f7a5571

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/PDL/Graphics/OpenGLQ.pd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,8 @@ pp_def(
123123
for(
124124
{Name => 'gl_triangles'},
125125
{Name => 'gl_triangles_wn',
126-
NormalArgs => 'norma(tri); normb(tri); normc(tri);',
127-
(map +("NormalCode$_"=>NORMAL(lc $_)), 'A'..'C'),
126+
NormalArgs => 'norm(tri,trivert=3); ',
127+
(map +("NormalCode$_"=>NORMAL(\$_)), 0..2),
128128
}) {
129129
# This may be suboptimal but should still be fast enough..
130130
# We only do triangles with this.

lib/PDL/Graphics/TriD/GL.pm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ sub PDL::Graphics::TriD::Lattice::gdraw {
207207
my $tmpn = $shading <= 2 ? undef : $options->{Smooth}
208208
? $this->{VertexNormals}->dice_axis(1,$this->{Faceidx}->flat)
209209
->splitdim(1,$this->{Faceidx}->dim(0)) : $this->{FaceNormals}->dummy(1,3);
210-
$f->((map $_->mv(1,-1)->dog, $faces, $shading > 2 ? $tmpn : ()), $colours);
210+
$f->((map $_->mv(1,-1)->dog, $faces), $shading > 2 ? $tmpn : (), $colours);
211211
if ($shading > 2) { glDisable(GL_COLOR_MATERIAL); }
212212
$this->_lattice_lines($points) if $options->{Lines};
213213
}
@@ -276,7 +276,7 @@ sub PDL::Graphics::TriD::Trigrid::gdraw {
276276
? $this->{VertexNormals}->dice_axis(1,$this->{Faceidx}->flat)
277277
->splitdim(1,$this->{Faceidx}->dim(0)) : $this->{FaceNormals}->dummy(1,3);
278278
if ($options->{Shading}) { glColorMaterial(GL_FRONT_AND_BACK,GL_DIFFUSE); glEnable(GL_COLOR_MATERIAL); }
279-
$f->((map $_->mv(1,-1)->dog, $faces, $options->{Shading} ? $tmpn : ()), $colours);
279+
$f->((map $_->mv(1,-1)->dog, $faces), $options->{Shading} ? $tmpn : (), $colours);
280280
if ($options->{Shading}) { glDisable(GL_COLOR_MATERIAL); }
281281
if ($options->{ShowNormals}) {
282282
die "No normals to show!" if !grep defined $this->{$_}, qw(FaceNormals VertexNormals);

0 commit comments

Comments
 (0)