Skip to content

Commit e5970ef

Browse files
committed
put ::Window fields in Window.pm
1 parent 8ff1cfc commit e5970ef

4 files changed

Lines changed: 13 additions & 22 deletions

File tree

demos/tvrml2.p

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,9 @@ $win = PDL::Graphics::TriD::get_current_window();
4545
require PDL::Graphics::VRML::Protos;
4646
PDL::Graphics::VRML::Protos->import();
4747

48+
#$win->{Impl}->register_proto(PDL::Graphics::VRML::Protos::PDLBlockText10());
4849

49-
#$win->{VRMLTop}->register_proto(PDL::Graphics::VRML::Protos::PDLBlockText10());
50-
51-
52-
#$win->{VRMLTop}->uses('PDLBlockText10');
53-
54-
50+
#$win->{Impl}->uses('PDLBlockText10');
5551

5652
#$win->current_viewport()->add_object(PDL::Graphics::TriD::VRMLObject->new(
5753
# vrn(Transform,

lib/PDL/Graphics/TriD/GL.pm

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -768,10 +768,6 @@ use OpenGL::Modern qw/
768768
GL_COLOR_BUFFER_BIT GL_DEPTH_BUFFER_BIT
769769
/;
770770

771-
use base qw/PDL::Graphics::TriD::Object/;
772-
use fields qw/Ev Width Height Interactive
773-
_ViewPorts _CurrentViewPort /;
774-
775771
my @GL_VERSION_NEEDED = (3, 3, 1);
776772
sub gdriver {
777773
my($this, $options) = @_;

lib/PDL/Graphics/TriD/VRML.pm

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -562,9 +562,7 @@ PDL::Graphics::VRMLNode->import();
562562
PDL::Graphics::VRMLProto->import();
563563
use PDL::Core ''; # barf
564564

565-
use base qw/PDL::Graphics::TriD::Object/;
566-
use fields qw/Width Height Interactive _ViewPorts _CurrentViewPort
567-
VRMLTop DefMaterial/;
565+
use fields qw/DefMaterial/;
568566
use strict;
569567

570568
$PDL::Graphics::TriD::VRML::fontstyle = $PDL::Graphics::TriD::VRML::fontstyle;
@@ -573,17 +571,17 @@ sub gdriver {
573571

574572
require PDL if not defined $PDL::VERSION;
575573
$this->{Width} = 300; $this->{Height} = 300;
576-
$this->{VRMLTop} = PDL::Graphics::VRML->new("\"PDL::Graphics::TriD::VRML Scene\"",
574+
$this->{Impl} = PDL::Graphics::VRML->new("\"PDL::Graphics::TriD::VRML Scene\"",
577575
["\"generated by the PDL::Graphics::TriD module\"",
578576
"\"version $PDL::VERSION\""]);
579577
my $fontstyle = PDL::Graphics::VRMLNode->new('FontStyle',
580578
'size' => 0.04,
581579
'family' => "\"SANS\"",
582580
'justify' => "\"MIDDLE\"");
583581
$PDL::Graphics::TriD::VRML::fontstyle = $fontstyle;
584-
$this->{VRMLTop}->add_proto(PDL::Graphics::TriD::SimpleController->new->tovrml);
585-
$PDL::Graphics::VRML::current_window = $this->{VRMLTop};
586-
$this->{VRMLTop}->register_proto(
582+
$this->{Impl}->add_proto(PDL::Graphics::TriD::SimpleController->new->tovrml);
583+
$PDL::Graphics::VRML::current_window = $this->{Impl};
584+
$this->{Impl}->register_proto(
587585
vrp('TriDGraphText',
588586
[fv3f('position',"0 0 0"),
589587
fmstr('text')],
@@ -663,20 +661,20 @@ EOH
663661
my $vp = $this->current_viewport;
664662
$vp->tovrml;
665663
if ($vp->{Transformer}) {
666-
$this->{VRMLTop}->addview($vp->{Transformer}->tovrml)
664+
$this->{Impl}->addview($vp->{Transformer}->tovrml)
667665
}
668666

669-
$this->{VRMLTop}->ensure_protos();
667+
$this->{Impl}->ensure_protos();
670668

671669
# use Data::Dumper;
672670
# my $out = Dumper($this->{VRML});
673671
# print $out;
674672

675-
$this->{VRMLTop}->set_vrml($vp->{VRML});
673+
$this->{Impl}->set_vrml($vp->{VRML});
676674
$vrmlparam->vrmlmode();
677675
local $| = 1;
678676
print "*********starting output\n";
679-
$this->{VRMLTop}->print($vrmlparam->wfile);
677+
$this->{Impl}->print($vrmlparam->wfile);
680678
print "*********finished output\n";
681679
$vrmlparam->send_to_browser('Home'); #XXX make target selectable
682680
}

lib/PDL/Graphics/TriD/Window.pm

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ package PDL::Graphics::TriD::Window;
66
use strict;
77
use warnings;
88
use PDL::Graphics::TriD::ViewPort;
9-
use Data::Dumper;
9+
use base qw(PDL::Graphics::TriD::Object);
10+
use fields qw(Width Height Interactive _ViewPorts _CurrentViewPort);
1011

1112
$PDL::Graphics::TriD::verbose //= 0;
1213
our ($DEFAULT_WIDTH, $DEFAULT_HEIGHT) = (600, 600);

0 commit comments

Comments
 (0)