Skip to content

Commit 17885c6

Browse files
committed
gl_triangles take vertices as single param
1 parent 6b3cfab commit 17885c6

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

lib/PDL/Graphics/OpenGLQ.pd

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -123,26 +123,26 @@ pp_def(
123123
for(
124124
{Name => 'gl_triangles'},
125125
{Name => 'gl_triangles_wn',
126-
NormalArgs => 'norm(tri,trivert=3); ',
126+
NormalArgs => 'norm(tri,trivert); ',
127127
(map +("NormalCode$_"=>NORMAL(\$_)), 0..2),
128128
}) {
129129
# This may be suboptimal but should still be fast enough..
130130
# We only do triangles with this.
131131
pp_def(
132132
$_->{Name},
133133
GenericTypes => $F,
134-
Pars => 'coordsa(tri=3); coordsb(tri); coordsc(tri);'.
134+
Pars => 'coords(tri=3,trivert=3); '.
135135
($_->{NormalArgs}//'').
136-
'colors(tri,trivert=3)',
136+
'colors(tri,trivert)',
137137
Code => '
138138
glBegin(GL_TRIANGLES);
139139
broadcastloop %{'.
140140
($_->{NormalCode0}//'').
141-
COLOR(\0).VERTEX("a").
141+
COLOR(\0).VERTEX(\0).
142142
($_->{NormalCode1}//'').
143-
COLOR(\1).VERTEX("b").
143+
COLOR(\1).VERTEX(\1).
144144
($_->{NormalCode2}//'').
145-
COLOR(\2).VERTEX("c").'
145+
COLOR(\2).VERTEX(\2).'
146146
%}
147147
glEnd();',
148148
@internal

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->($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->($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)