@@ -32,46 +32,29 @@ properly. All the points used by the object must be in the member
3232=head2 PDL::Graphics::TriD::GObject
3333
3434Inherits from base PDL::Graphics::TriD::Object and adds fields Points,
35- Colors and Options.
35+ and Colors.
36+ It is for primitive objects rather than containers.
3637
3738=cut
3839
3940package PDL::Graphics::TriD::GObject ;
4041use strict;
4142use warnings;
4243use base qw/ PDL::Graphics::TriD::Object/ ;
43- use fields qw/ Points Colors Options / ;
44+ use fields qw/ Points Colors/ ;
4445
4546$PDL::Graphics::TriD::verbose //= 0;
4647
4748sub new {
4849 my $options = ref ($_ [-1]) eq ' HASH' ? pop : {};
4950 my ($type ,$points ,$colors ) = @_ ;
50- print " GObject new.. calling SUPER::new...\n " if $PDL::Graphics::TriD::verbose ;
51- my $this = $type -> SUPER::new();
52- print " GObject new - back (SUPER::new returned $this )\n " if $PDL::Graphics::TriD::verbose ;
53- $options -> {UseDefcols } = 1 if !defined $colors ; # for VRML efficiency
54- $this -> {Options } = $options ;
55- $this -> check_options;
56- print " GObject new - calling realcoords\n " if ($PDL::Graphics::TriD::verbose );
51+ my $this = $type -> SUPER::new($options );
5752 $this -> {Points } = $points = PDL::Graphics::TriD::realcoords($type -> r_type,$points );
58- print " GObject new - back from realcoords \n " if ( $PDL::Graphics::TriD::verbose );
53+ $this -> { Options }{ UseDefcols } = 1 if ! defined $colors ; # for VRML efficiency
5954 $this -> {Colors } = defined $colors
6055 ? PDL::Graphics::TriD::realcoords(" COLOR" ,$colors )
6156 : $this -> cdummies(PDL-> pdl(PDL::float(),1,1,1),$points );
62- print " GObject new - returning\n " if ($PDL::Graphics::TriD::verbose );
63- return $this ;
64- }
65-
66- sub check_options {
67- my ($this ) = @_ ;
68- my $opts = $this -> get_valid_options();
69- $this -> {Options } = $opts , return if !$this -> {Options };
70- print " FETCHOPT: $this " .(join ' ,' ,%$opts )." \n " if $PDL::Graphics::TriD::verbose ;
71- my %newopts = (%$opts , %{$this -> {Options }});
72- my @invalid = grep !exists $opts -> {$_ }, keys %newopts ;
73- die " $this : invalid options left: @invalid " if @invalid ;
74- $this -> {Options } = \%newopts ;
57+ $this ;
7558}
7659
7760sub set_colors {
0 commit comments