VRML/VRML2/Standard.pm

filter: Statementstmt 16.1% 163 / 1012 Branchbran 7.4% 33 / 444 Conditioncond 0.0% 0 / 18 MC/DCmcdc 0.0% 0 / 12 Subroutinesub 20.0% 12 / 60 Podpod 98.2% 56 / 57 totaltotal 16.4% 264 / 1603 CC 231 SCAR 41.8
CC
231
Cov
13%
IndexedFaceSet
306.0
Sound
156.0
IndexedLineSet
156.0
CRAP 65.3
« VRML/Color.pm ↑ Summary VRML/Base.pm »
1 package VRML::VRML2::Standard;
2  
3 ############################## Copyright ##############################
4 # #
5 # This program is Copyright 1996,1998 by Hartmut Palm. #
6 # This program is free software; you can redistribute it and/or #
7 # modify it under the terms of the GNU General Public License #
8 # as published by the Free Software Foundation; either version 2 #
9 # of the License, or (at your option) any later version. #
10 # #
11 # This program is distributed in the hope that it will be useful, #
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
14 # GNU General Public License for more details. #
15 # #
16 # If you do not have a copy of the GNU General Public License write #
17 # to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, #
18 # MA 02139, USA. #
19 # #
20 #######################################################################
21  
22 1 require 5.000;
23 1 require VRML::Base;
24 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
25 1 ▶use vars qw(@ISA $VERSION $AUTOLOAD);
Subroutine BEGIN: called CC=1 SCAR=0.0
26 1 @ISA = qw(VRML::Base);
27 1 $VERSION = "1.07";
28  
29 =head1 NAME
30  
31 VRML::VRML2::Standard.pm - implements VRML 2.0/97 standard nodes
32  
33 =head1 SYNOPSIS
34  
35 use VRML::VRML2::Standard;
36  
37 =head1 DESCRIPTION
38  
39 Following nodes are currently implemented.
40  
41 [C<Grouping Nodes>]
42 [C<Special Groups>]
43 [C<Common Nodes>]
44  
45 [C<Geometry>]
46 [C<Geometric Properties>]
47 [C<Appearance>]
48  
49 [C<Sensors>]
50 [C<Interpolators>]
51 [C<Bindable Nodes>]
52  
53 =cut
54  
55 6 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod documented
56 6 my $class = shift;
57 6 my $self = new VRML::Base;
58 6 $self->{'Content-type'} = "model/vrml";
59 6 $self->{'VRML'} = ["#VRML V2.0 utf8\n"];
60 6 return bless $self, $class;
61 }
62  
63 #####################################################################
64 # VRML Implementation #
65 #####################################################################
66  
67 =head2 Grouping Nodes
68  
69 These nodes B<NEED> B<End> if the $children parameter is empty !
70  
71 =over 4
72  
73 =cut
74  
75 #--------------------------------------------------------------------
76  
77 =item Anchor
78  
79 C<Anchor($url, $description, $parameter, $bboxSize, $bboxCenter, $children)>
80  
81 Currently only the first part of I<$parameter> is supported.
82  
83 =cut
84  
85 0 ▶sub Anchor {
Subroutine Anchor: not called CC=7 SCAR=40.3
Pod documented
86 0 my $self = shift;
87 0 my ($url, $description, $parameter, $bboxSize, $bboxCenter, $children) = @_;
88 0 my $vrml = "";
89 0 $vrml = $self->{'TAB'}."Anchor {\n";
90 0 $vrml .= $self->{'TAB'}." url \"".$self->escape($url)."\"\n";
91 0 ▶ $vrml .= $self->{'TAB'}." description \"".$self->utf8($description)."\"\n" if defined $description;
Branch: 1 branch
BranchTrueFalseTotal
if defined $description 0 0 0
92 0 ▶ $vrml .= $self->{'TAB'}." parameter \"$parameter\"\n" if $parameter;
Branch: 1 branch
BranchTrueFalseTotal
if $parameter 0 0 0
93 0 ▶ $vrml .= $self->{'TAB'}." bboxSize $bboxSize\n" if $bboxSize;
Branch: 1 branch
BranchTrueFalseTotal
if $bboxSize 0 0 0
94 0 ▶ $vrml .= $self->{'TAB'}." bboxCenter $bboxCenter\n" if $bboxCenter;
Branch: 1 branch
BranchTrueFalseTotal
if $bboxCenter 0 0 0
95 0 $vrml .= $self->{'TAB'}." children [\n";
96 0 $self->{'TAB'} .= "\t";
97 0 push @{$self->{'VRML'}}, $vrml;
98 0 ▶ if (defined $children) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $children) 0 0 0
99 0 $vrml = "";
100 0 ▶ if (ref($children) eq "CODE") {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $children eq 'CODE') { } 0 0 0
101 0 &$children;
102 } else {
103 0 $vrml .= $self->{'TAB'}."$children\n";
104 }
105 0 chop($self->{'TAB'});
106 0 $vrml .= $self->{'TAB'}." ]\n";
107 0 $vrml .= $self->{'TAB'}."}\n";
108 0 push @{$self->{'VRML'}}, $vrml;
109 }
110 0 return $self;
111 }
112  
113 =item Billboard
114  
115 C<Billboard($axisOfRotation, $children)>
116  
117 =cut
118  
119 0 ▶sub Billboard {
Subroutine Billboard: not called CC=3 SCAR=24.8
Pod documented
120 0 my $self = shift;
121 0 my ($axisOfRotation,$children) = @_;
122 0 my $vrml = "";
123 0 $vrml = $self->{'TAB'}."Billboard {\n";
124 0 $vrml .= $self->{'TAB'}." axisOfRotation $axisOfRotation\n";
125 0 $vrml .= $self->{'TAB'}." children [\n";
126 0 $self->{'TAB'} .= "\t";
127 0 push @{$self->{'VRML'}}, $vrml;
128 0 ▶ if (defined $children) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $children) 0 0 0
129 0 $vrml = "";
130 0 ▶ if (ref($children) eq "CODE") {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $children eq 'CODE') { } 0 0 0
131 0 &$children;
132 } else {
133 0 $vrml .= $self->{'TAB'}."$children\n";
134 }
135 0 chop($self->{'TAB'});
136 0 $vrml .= $self->{'TAB'}." ]\n";
137 0 $vrml .= $self->{'TAB'}."}\n";
138 0 push @{$self->{'VRML'}}, $vrml;
139 }
140 0 return $self;
141 }
142  
143 =item Collision
144  
145 C<Collision($collide, $proxy, $children)>
146  
147 =cut
148  
149 0 ▶sub Collision {
Subroutine Collision: not called CC=5 SCAR=34.0
Pod documented
150 0 my $self = shift;
151 0 my ($collide, $proxy, $children) = @_;
152 0 my $vrml = "";
153 0 $vrml = $self->{'TAB'}."Collision {\n";
154 0 $vrml .= $self->{'TAB'}." collide $collide\n";
155 0 ▶ if (defined $proxy) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $proxy) 0 0 0
156 0 $vrml .= $self->{'TAB'}." proxy \n";
157 0 push @{$self->{'VRML'}}, $vrml;
158 0 $vrml = "";
159 0 $self->{'TAB'} .= "\t";
160 0 ▶ if (ref($proxy) eq "CODE") {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $proxy eq 'CODE') { } 0 0 0
161 0 &$proxy;
162 } else {
163 0 $vrml .= $self->{'TAB'}."$proxy\n";
164 }
165 0 chop($self->{'TAB'});
166 }
167 0 $vrml .= $self->{'TAB'}." children [\n";
168 0 push @{$self->{'VRML'}}, $vrml;
169 0 $self->{'TAB'} .= "\t";
170 0 ▶ if (defined $children) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $children) 0 0 0
171 0 $vrml = "";
172 0 ▶ if (ref($children) eq "CODE") {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $children eq 'CODE') { } 0 0 0
173 0 &$children;
174 } else {
175 0 $vrml .= $self->{'TAB'}."$children\n";
176 }
177 0 chop($self->{'TAB'});
178 0 $vrml .= $self->{'TAB'}." ]\n";
179 0 $vrml .= $self->{'TAB'}."}\n";
180 0 push @{$self->{'VRML'}}, $vrml;
181 }
182 0 return $self;
183 }
184  
185 =item Group
186  
187 C<Group($bboxSize, $bboxCenter)>
188  
189 =cut
190  
191 0 ▶sub Group {
Subroutine Group: not called CC=5 SCAR=34.0
Pod documented
192 0 my $self = shift;
193 0 my ($bboxSize, $bboxCenter, $children) = @_;
194 0 my $vrml = "";
195 0 $vrml = $self->{'TAB'}."Group {\n";
196 0 ▶ $vrml .= $self->{'TAB'}." bboxSize $bboxSize\n" if $bboxSize;
Branch: 1 branch
BranchTrueFalseTotal
if $bboxSize 0 0 0
197 0 ▶ $vrml .= $self->{'TAB'}." bboxCenter $bboxCenter\n" if $bboxCenter;
Branch: 1 branch
BranchTrueFalseTotal
if $bboxCenter 0 0 0
198 0 $vrml .= $self->{'TAB'}." children [\n";
199 0 $self->{'TAB'} .= "\t";
200 0 push @{$self->{'VRML'}}, $vrml;
201 0 ▶ if (defined $children) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $children) 0 0 0
202 0 $vrml = "";
203 0 ▶ if (ref($children) eq "CODE") {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $children eq 'CODE') { } 0 0 0
204 0 &$children;
205 } else {
206 0 $vrml .= $self->{'TAB'}."$children\n";
207 }
208 0 chop($self->{'TAB'});
209 0 $vrml .= $self->{'TAB'}." ]\n";
210 0 $vrml .= $self->{'TAB'}."}\n";
211 0 push @{$self->{'VRML'}}, $vrml;
212 }
213 0 return $self;
214 }
215  
216 =item Transform
217  
218 C<Transform($translation, $rotation, $scale, $scaleOrientation, $center, $bboxSize, $bboxCenter)>
219  
220 $translation is a SFVec3f
221  
222 $rotation is a SFRotation
223  
224 $scale is a SFVec3f
225  
226 $scaleOrientation is a SFRotation
227  
228 $center is a SFVec3f
229  
230 =cut
231  
232 0 ▶sub Transform {
Subroutine Transform: not called CC=10 SCAR=47.0
Pod documented
233 0 my $self = shift;
234 0 my ($translation, $rotation, $scale, $scaleOrientation, $center, $bboxSize, $bboxCenter) = @_;
235 0 ▶ unless ($self->{'XYZ'}[0]) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'XYZ'}[0]) { } 0 0 0
236 0 $self->_row("# To many end's !\n");
237 } else {
238 0 unshift @{$self->{'XYZ'}}, [@{$self->{'XYZ'}[0]}];
239 0 ▶ $self->xyz($self->string_to_array($translation)) if (defined $translation);
Branch: 1 branch
BranchTrueFalseTotal
if defined $translation 0 0 0
240 }
241 0 my $vrml = "";
242 0 $vrml = $self->{'TAB'}."Transform {\n";
243 0 ▶ $vrml .= $self->{'TAB'}." translation $translation\n" if $translation;
Branch: 1 branch
BranchTrueFalseTotal
if $translation 0 0 0
244 0 ▶ $vrml .= $self->{'TAB'}." rotation $rotation\n" if $rotation;
Branch: 1 branch
BranchTrueFalseTotal
if $rotation 0 0 0
245 0 ▶ $vrml .= $self->{'TAB'}." scale $scale\n" if $scale;
Branch: 1 branch
BranchTrueFalseTotal
if $scale 0 0 0
246 0 ▶ $vrml .= $self->{'TAB'}." scaleOrientation $scaleOrientation\n" if $scaleOrientation;
Branch: 1 branch
BranchTrueFalseTotal
if $scaleOrientation 0 0 0
247 0 ▶ $vrml .= $self->{'TAB'}." center $center\n" if $center;
Branch: 1 branch
BranchTrueFalseTotal
if $center 0 0 0
248 0 ▶ $vrml .= $self->{'TAB'}." bboxSize $bboxSize\n" if $bboxSize;
Branch: 1 branch
BranchTrueFalseTotal
if $bboxSize 0 0 0
249 0 ▶ $vrml .= $self->{'TAB'}." bboxCenter $bboxCenter\n" if $bboxCenter;
Branch: 1 branch
BranchTrueFalseTotal
if $bboxCenter 0 0 0
250 0 $vrml .= $self->{'TAB'}." children [\n";
251 0 $self->{'TAB'} .= "\t";
252 0 push @{$self->{'VRML'}}, $vrml;
253 0 return $self;
254 }
255  
256 #--------------------------------------------------------------------
257  
258 =back
259  
260 =head2 Special Groups
261  
262 =over 4
263  
264 =cut
265  
266 #--------------------------------------------------------------------
267  
268 =item Inline
269  
270 C<Inline($url, $bboxSize, $bboxCenter)>
271  
272 =cut
273  
274 0 ▶sub Inline {
Subroutine Inline: not called CC=3 SCAR=24.8
Pod documented
275 0 my $self = shift;
276 0 my $vrml = "";
277 0 my ($url, $bboxSize, $bboxCenter) = @_;
278 0 $vrml = $self->{'TAB'}."Inline {\n";
279 0 $vrml .= $self->{'TAB'}." url \"".$self->escape($url)."\"\n";
280 0 ▶ $vrml .= $self->{'TAB'}." bboxSize $bboxSize\n" if $bboxSize;
Branch: 1 branch
BranchTrueFalseTotal
if $bboxSize 0 0 0
281 0 ▶ $vrml .= $self->{'TAB'}." bboxCenter $bboxCenter\n" if $bboxCenter;
Branch: 1 branch
BranchTrueFalseTotal
if $bboxCenter 0 0 0
282 0 $vrml .= $self->{'TAB'}."}\n";
283 0 push @{$self->{'VRML'}}, $vrml;
284 0 return $self;
285 }
286  
287 =item LOD
288  
289 C<LOD($range, $center)>
290  
291 $range is a MFFloat
292  
293 $center is a SFVec3f
294  
295 Example: C<LOD([1, 2, 5], '0 0 0')>
296  
297 =cut
298  
299 0 ▶sub LOD {
Subroutine LOD: not called CC=4 SCAR=30.0
Pod documented
300 0 my $self = shift;
301 0 my ($range, $center) = @_;
302 0 my $vrml = "";
303 0 $vrml = $self->{'TAB'}."LOD {\n";
304 0 ▶ if ($range) {
Branch: 1 branch
BranchTrueFalseTotal
if ($range) 0 0 0
305 0 ▶ if (ref($range) eq "ARRAY") {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $range eq 'ARRAY') { } 0 0 0
306 0 $vrml .= $self->{'TAB'}." range [".join(',',@$range)."]\n";
307 } else {
308 0 $vrml .= $self->{'TAB'}." range [$range]\n";
309 }
310 }
311 0 ▶ $vrml .= $self->{'TAB'}." center $center\n" if $center;
Branch: 1 branch
BranchTrueFalseTotal
if $center 0 0 0
312 0 $vrml .= $self->{'TAB'}." level [\n";
313 0 $self->{'TAB'} .= "\t";
314 0 push @{$self->{'VRML'}}, $vrml;
315 0 return $self;
316 }
317  
318 =item Switch
319  
320 C<Switch($whichChoice)>
321  
322 =cut
323  
324 0 ▶sub Switch {
Subroutine Switch: not called CC=2 SCAR=17.9
Pod documented
325 0 my $self = shift;
326 0 my ($whichChoice) = @_;
327 0 my $vrml = "";
328 0 $vrml = $self->{'TAB'}."Switch {\n";
329 0 ▶ $vrml .= $self->{'TAB'}." whichChoice $whichChoice\n" if defined $whichChoice;
Branch: 1 branch
BranchTrueFalseTotal
if defined $whichChoice 0 0 0
330 0 $vrml .= $self->{'TAB'}." choice [\n";
331 0 $self->{'TAB'} .= "\t";
332 0 push @{$self->{'VRML'}}, $vrml;
333 0 return $self;
334 }
335  
336 #--------------------------------------------------------------------
337  
338 =back
339  
340 =head2 Common Nodes
341  
342 =over 4
343  
344 =cut
345  
346 #--------------------------------------------------------------------
347  
348 =item DirectionalLight
349  
350 C<DirectionalLight($direction, $intensity, $ambientIntensity, $color, $on)>
351  
352 =cut
353  
354 0 ▶sub DirectionalLight {
Subroutine DirectionalLight: not called CC=6 SCAR=37.4
Pod documented
355 0 my $self = shift;
356 0 my ($direction, $intensity, $ambientIntensity, $color, $on) = @_;
357 0 my $vrml = "";
358 0 $vrml = $self->{'TAB'}."DirectionalLight {\n";
359 0 ▶ $vrml .= $self->{'TAB'}." direction $direction\n" if $direction;
Branch: 1 branch
BranchTrueFalseTotal
if $direction 0 0 0
360 0 ▶ $vrml .= $self->{'TAB'}." intensity $intensity\n" if $intensity;
Branch: 1 branch
BranchTrueFalseTotal
if $intensity 0 0 0
361 0 ▶ $vrml .= $self->{'TAB'}." ambientIntensity $ambientIntensity\n" if $ambientIntensity;
Branch: 1 branch
BranchTrueFalseTotal
if $ambientIntensity 0 0 0
362 0 ▶ $vrml .= $self->{'TAB'}." color $color\n" if $color;
Branch: 1 branch
BranchTrueFalseTotal
if $color 0 0 0
363 0 ▶ $vrml .= $self->{'TAB'}." on $on\n" if $on;
Branch: 1 branch
BranchTrueFalseTotal
if $on 0 0 0
364 0 $vrml .= $self->{'TAB'}."}\n";
365 0 push @{$self->{'VRML'}}, $vrml;
366 0 return $self;
367 }
368  
369 =item PointLight
370  
371 C<PointLight($location, $intensity, $ambientIntensity, $color, $on)>
372  
373 =cut
374  
375 0 ▶sub PointLight {
Subroutine PointLight: not called CC=6 SCAR=37.4
Pod documented
376 0 my $self = shift;
377 0 my ($location, $intensity, $ambientIntensity, $color, $on) = @_;
378 0 my $vrml = "";
379 0 $vrml = $self->{'TAB'}."PointLight {\n";
380 0 ▶ $vrml .= $self->{'TAB'}." location $location\n" if $location;
Branch: 1 branch
BranchTrueFalseTotal
if $location 0 0 0
381 0 ▶ $vrml .= $self->{'TAB'}." intensity $intensity\n" if $intensity;
Branch: 1 branch
BranchTrueFalseTotal
if $intensity 0 0 0
382 0 ▶ $vrml .= $self->{'TAB'}." ambientIntensity $ambientIntensity\n" if $ambientIntensity;
Branch: 1 branch
BranchTrueFalseTotal
if $ambientIntensity 0 0 0
383 0 ▶ $vrml .= $self->{'TAB'}." color $color\n" if $color;
Branch: 1 branch
BranchTrueFalseTotal
if $color 0 0 0
384 0 ▶ $vrml .= $self->{'TAB'}." on $on\n" if $on;
Branch: 1 branch
BranchTrueFalseTotal
if $on 0 0 0
385 0 $vrml .= $self->{'TAB'}."}\n";
386 0 push @{$self->{'VRML'}}, $vrml;
387 0 return $self;
388 }
389  
390 =item SpotLight
391  
392 C<SpotLight($location, $direction, $intensity, $color, $on)>
393  
394 =cut
395  
396 0 ▶sub SpotLight {
Subroutine SpotLight: not called CC=6 SCAR=37.4
Pod documented
397 0 my $self = shift;
398 0 my ($location, $direction, $intensity, $color, $on) = @_;
399 0 my $vrml = "";
400 0 $vrml = $self->{'TAB'}."SpotLight {\n";
401 0 ▶ $vrml .= $self->{'TAB'}." location $location\n" if $location;
Branch: 1 branch
BranchTrueFalseTotal
if $location 0 0 0
402 0 ▶ $vrml .= $self->{'TAB'}." direction $direction\n" if $direction;
Branch: 1 branch
BranchTrueFalseTotal
if $direction 0 0 0
403 0 ▶ $vrml .= $self->{'TAB'}." intensity $intensity\n" if $intensity;
Branch: 1 branch
BranchTrueFalseTotal
if $intensity 0 0 0
404 0 ▶ $vrml .= $self->{'TAB'}." color $color\n" if $color;
Branch: 1 branch
BranchTrueFalseTotal
if $color 0 0 0
405 0 ▶ $vrml .= $self->{'TAB'}." on $on\n" if $on;
Branch: 1 branch
BranchTrueFalseTotal
if $on 0 0 0
406 0 $vrml .= $self->{'TAB'}."}\n";
407 0 push @{$self->{'VRML'}}, $vrml;
408 0 return $self;
409 }
410  
411 =item Sound
412  
413 C<Sound($source, $location, $direction, $intensity, $maxFront, $maxBack, $minFront, $minBack, $priority, $spatialize)>
414  
415 =cut
416  
417 0 ▶sub Sound {
Subroutine Sound: not called CC=12 SCAR=50.5
Pod documented
418 0 my $self = shift;
419 0 my ($source, $location, $direction, $intensity, $maxFront, $maxBack, $minFront, $minBack, $priority, $spatialize) = @_;
420 0 my $vrml = $self->{'TAB'}."Sound {\n";
421 0 ▶ $vrml .= $self->{'TAB'}." location $location\n" if $location;
Branch: 1 branch
BranchTrueFalseTotal
if $location 0 0 0
422 0 ▶ $vrml .= $self->{'TAB'}." direction $direction\n" if $direction;
Branch: 1 branch
BranchTrueFalseTotal
if $direction 0 0 0
423 0 ▶ $vrml .= $self->{'TAB'}." intensity $intensity\n" if $intensity;
Branch: 1 branch
BranchTrueFalseTotal
if $intensity 0 0 0
424 0 ▶ $vrml .= $self->{'TAB'}." maxFront $maxFront\n" if $maxFront;
Branch: 1 branch
BranchTrueFalseTotal
if $maxFront 0 0 0
425 0 ▶ $vrml .= $self->{'TAB'}." maxBack $maxBack\n" if $maxBack;
Branch: 1 branch
BranchTrueFalseTotal
if $maxBack 0 0 0
426 0 ▶ $vrml .= $self->{'TAB'}." minFront $minFront\n" if $minFront;
Branch: 1 branch
BranchTrueFalseTotal
if $minFront 0 0 0
427 0 ▶ $vrml .= $self->{'TAB'}." minBack $minBack\n" if $minBack;
Branch: 1 branch
BranchTrueFalseTotal
if $minBack 0 0 0
428 0 ▶ $vrml .= $self->{'TAB'}." priority $priority\n" if $priority;
Branch: 1 branch
BranchTrueFalseTotal
if $priority 0 0 0
429 0 ▶ $vrml .= $self->{'TAB'}." spatialize $spatialize\n" if $spatialize;
Branch: 1 branch
BranchTrueFalseTotal
if $spatialize 0 0 0
430 0 ▶ if (defined $source) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $source) 0 0 0
431 0 ▶ if (ref($source) eq "CODE") {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $source eq 'CODE') { } 0 0 0
432 0 $vrml .= $self->{'TAB'}." source ";
433 0 push @{$self->{'VRML'}}, $vrml;
434 0 $self->{'TAB'} .= "\t";
435 0 my $pos = $#{$self->{'VRML'}}+1;
436 0 &$source;
437 0 $self->_trim($pos);
438 0 chop($self->{'TAB'});
439 0 $vrml = "";
440 } else {
441 0 $vrml .= $self->{'TAB'}." source $source\n";
442 }
443 }
444 0 $vrml .= $self->{'TAB'}."}\n";
445 0 push @{$self->{'VRML'}}, $vrml;
446 0 return $self;
447 }
448  
449 =item AudioClip
450  
451 C<AudioClip($url, $description, $loop, $pitch, $startTime, $stopTime)>
452  
453 =cut
454  
455 0 ▶sub AudioClip {
Subroutine AudioClip: not called CC=7 SCAR=40.3
Pod documented
456 0 my $self = shift;
457 0 my $vrml = "";
458 0 my ($url, $description, $loop, $pitch, $startTime, $stopTime) = @_;
459 0 $vrml = $self->{'TAB'}."AudioClip {\n";
460 0 ▶ $vrml .= $self->{'TAB'}." url \"".$self->escape($url)."\"\n" if $url;
Branch: 1 branch
BranchTrueFalseTotal
if $url 0 0 0
461 0 ▶ $vrml .= $self->{'TAB'}." description \"".$self->utf8($description)."\"\n" if defined $description;
Branch: 1 branch
BranchTrueFalseTotal
if defined $description 0 0 0
462 0 ▶ $vrml .= $self->{'TAB'}." loop $loop\n" if $loop;
Branch: 1 branch
BranchTrueFalseTotal
if $loop 0 0 0
463 0 ▶ $vrml .= $self->{'TAB'}." pitch $pitch\n" if $pitch;
Branch: 1 branch
BranchTrueFalseTotal
if $pitch 0 0 0
464 0 ▶ $vrml .= $self->{'TAB'}." startTime $startTime\n" if defined $startTime;
Branch: 1 branch
BranchTrueFalseTotal
if defined $startTime 0 0 0
465 0 ▶ $vrml .= $self->{'TAB'}." stopTime $stopTime\n" if defined $stopTime;
Branch: 1 branch
BranchTrueFalseTotal
if defined $stopTime 0 0 0
466 0 $vrml .= $self->{'TAB'}."}\n";
467 0 push @{$self->{'VRML'}}, $vrml;
468 0 return $self;
469 }
470  
471 =item WorldInfo
472  
473 C<WorldInfo($title, $info)>
474  
475 =cut
476  
477 0 ▶sub WorldInfo {
Subroutine WorldInfo: not called CC=4 SCAR=30.0
Pod documented
478 0 my $self = shift;
479 0 my ($title, $info) = @_;
480 0 my $vrml = "";
481 0 $vrml = $self->{'TAB'}."WorldInfo {\n";
482 0 ▶ $vrml .= $self->{'TAB'}." title \"".$self->utf8($title)."\"\n" if $title;
Branch: 1 branch
BranchTrueFalseTotal
if $title 0 0 0
483 0 ▶ if (defined $info) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $info) 0 0 0
484 0 ▶ if (ref($info) eq "ARRAY") {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $info eq 'ARRAY') { } 0 0 0
485 0 $info = "[\"".join("\",\n$self->{'TAB'} \"",@$info)."\"]";
486 } else {
487 0 $info = qq{"$info"};
488 }
489 0 $vrml .= $self->{'TAB'}." info ".$self->utf8($info)."\n";
490 }
491 0 $vrml .= $self->{'TAB'}."}\n";
492 0 push @{$self->{'VRML'}}, $vrml;
493 0 return $self;
494 }
495  
496 =item Shape
497  
498 C<Shape($geometry, $appearance)>
499  
500 =cut
501  
502 6 ▶sub Shape {
Subroutine Shape: called CC=6 SCAR=18.1
Pod documented
503 6 my $self = shift;
504 6 my ($geometry, $appearance) = @_;
505 6 my $vrml = "";
506 6 $vrml = $self->{'TAB'}."Shape {\n";
507 6 ▶ if (defined $appearance) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $appearance) 6 0 6
508 6 ▶ if (ref($appearance) eq "CODE") {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $appearance eq 'CODE') { } 6 0 6
509 6 $vrml .= $self->{'TAB'}." appearance ";
510 6 push @{$self->{'VRML'}}, $vrml;
511 6 $self->{'TAB'} .= "\t";
512 6 my $pos = $#{$self->{'VRML'}}+1;
513 6 &$appearance;
514 6 $self->_trim($pos);
515 6 chop($self->{'TAB'});
516 6 $vrml = "";
517 } else {
518 0 $vrml .= $self->{'TAB'}." appearance $appearance\n";
519 }
520 }
521 6 ▶ if (defined $geometry) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $geometry) 6 0 6
522 6 ▶ if (ref($geometry) eq "CODE") {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $geometry eq 'CODE') { } 6 0 6
523 6 $vrml .= $self->{'TAB'}." geometry ";
524 6 push @{$self->{'VRML'}}, $vrml;
525 6 $self->{'TAB'} .= "\t";
526 6 my $pos = $#{$self->{'VRML'}}+1;
527 6 &$geometry;
528 6 $self->_trim($pos);
529 6 chop($self->{'TAB'});
530 6 $vrml = "";
531 } else {
532 0 $vrml .= $self->{'TAB'}." geometry $geometry\n";
533 }
534 }
535 6 $vrml .= $self->{'TAB'}."}";
536 6 ▶ $vrml .= "# Shape" if $self->{'DEBUG'};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"DEBUG"} 0 6 6
537 6 $vrml .= "\n";
538 6 push @{$self->{'VRML'}}, $vrml;
539 6 return $self;
540 }
541  
542 #--------------------------------------------------------------------
543  
544 =back
545  
546 =head2 Geometry
547  
548 =over 4
549  
550 =cut
551  
552 #--------------------------------------------------------------------
553  
554 =item Box
555  
556 C<Box($size)>
557  
558 =cut
559  
560 2 ▶sub Box {
Subroutine Box: called CC=2 SCAR=6.9
Pod documented
561 2 my $self = shift;
562 2 my ($size) = @_;
563 2 my $vrml = "";
564 2 $vrml = $self->{'TAB'}."Box {\n";
565 2 ▶ $vrml .= $self->{'TAB'}." size $size\n" if $size;
Branch: 1 branch
BranchTrueFalseTotal
if $size 2 0 2
566 2 $vrml .= $self->{'TAB'}."}\n";
567 2 push @{$self->{'VRML'}}, $vrml;
568 2 return $self;
569 }
570  
571 =item Cone
572  
573 C<Cone($radius, $height, $side, $bottom)>
574  
575 =cut
576  
577 1 ▶sub Cone {
Subroutine Cone: called CC=5 SCAR=16.5
Pod documented
578 1 my $self = shift;
579 1 my ($radius, $height, $side, $bottom) = @_;
580 1 my $vrml = "";
581 1 $vrml = $self->{'TAB'}."Cone {\n";
582 1 ▶ $vrml .= $self->{'TAB'}." bottomRadius $radius\n" if $radius;
Branch: 1 branch
BranchTrueFalseTotal
if $radius 1 0 1
583 1 ▶ $vrml .= $self->{'TAB'}." height $height\n" if $height;
Branch: 1 branch
BranchTrueFalseTotal
if $height 1 0 1
584 1 ▶ $vrml .= $self->{'TAB'}." side $side\n" if $side;
Branch: 1 branch
BranchTrueFalseTotal
if $side 0 1 1
585 1 ▶ $vrml .= $self->{'TAB'}." bottom $bottom\n" if $bottom;
Branch: 1 branch
BranchTrueFalseTotal
if $bottom 0 1 1
586 1 $vrml .= $self->{'TAB'}."}\n";
587 1 push @{$self->{'VRML'}}, $vrml;
588 1 return $self;
589 }
590  
591 =item Cylinder
592  
593 C<Cylinder($radius, $height, $top, $side, $bottom)>
594  
595 =cut
596  
597 1 ▶sub Cylinder {
Subroutine Cylinder: called CC=6 SCAR=18.5
Pod documented
598 1 my $self = shift;
599 1 my ($radius, $height, $top, $side, $bottom) = @_;
600 1 my $vrml = "";
601 1 $vrml = $self->{'TAB'}."Cylinder {\n";
602 1 ▶ $vrml .= $self->{'TAB'}." radius $radius\n" if defined $radius;
Branch: 1 branch
BranchTrueFalseTotal
if defined $radius 1 0 1
603 1 ▶ $vrml .= $self->{'TAB'}." height $height\n" if defined $height;
Branch: 1 branch
BranchTrueFalseTotal
if defined $height 1 0 1
604 1 ▶ $vrml .= $self->{'TAB'}." top $top\n" if $top;
Branch: 1 branch
BranchTrueFalseTotal
if $top 0 1 1
605 1 ▶ $vrml .= $self->{'TAB'}." side $side\n" if $side;
Branch: 1 branch
BranchTrueFalseTotal
if $side 0 1 1
606 1 ▶ $vrml .= $self->{'TAB'}." bottom $bottom\n" if $bottom;
Branch: 1 branch
BranchTrueFalseTotal
if $bottom 0 1 1
607 1 $vrml .= $self->{'TAB'}."}\n";
608 1 push @{$self->{'VRML'}}, $vrml;
609 1 return $self;
610 }
611  
612 =item ElevationGrid
613  
614 C<ElevationGrid($xDimension, $zDimension, $xSpacing, $zSpacing, $height, $creaseAngle, $color, $colorPerVertex, $solid)>
615  
616 $height should be a reference of a list of height values
617 like C<['0 1 3 2', '2 3 5 4', ...]>
618  
619 $color can be a reference to a subroutine or list of color values
620  
621 =cut
622  
623 0 ▶sub ElevationGrid {
Subroutine ElevationGrid: not called CC=9 SCAR=45.0
Pod documented
624 0 my $self = shift;
625 0 my ($xDimension, $zDimension, $xSpacing, $zSpacing, $height, $creaseAngle, $color, $colorPerVertex, $solid) = @_;
626 0 my $vrml = "";
627 0 $vrml = $self->{'TAB'}."ElevationGrid {\n";
628 0 $vrml .= $self->{'TAB'}." xDimension $xDimension\n";
629 0 $vrml .= $self->{'TAB'}." zDimension $zDimension\n";
630 0 ▶ $vrml .= $self->{'TAB'}." xSpacing $xSpacing\n" if defined $xSpacing;
Branch: 1 branch
BranchTrueFalseTotal
if defined $xSpacing 0 0 0
631 0 ▶ $vrml .= $self->{'TAB'}." zSpacing $zSpacing\n" if defined $zSpacing;
Branch: 1 branch
BranchTrueFalseTotal
if defined $zSpacing 0 0 0
632 0 ▶ $vrml .= $self->{'TAB'}." solid $solid\n" if defined $solid;
Branch: 1 branch
BranchTrueFalseTotal
if defined $solid 0 0 0
633 0 ▶ $vrml .= $self->{'TAB'}." creaseAngle $creaseAngle\n" if defined $creaseAngle;
Branch: 1 branch
BranchTrueFalseTotal
if defined $creaseAngle 0 0 0
634 0 ▶ if (ref($height) eq "ARRAY") {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $height eq "ARRAY") 0 0 0
635 0 $vrml .= $self->{'TAB'}." height [\n";
636 0 $vrml .= $self->{'TAB'}."\t\t";
637 0 $vrml .= join("$self->{'TAB'}\t\t",@$height);
638 0 $vrml .= $self->{'TAB'}." ]\n";
639 }
640 0 ▶ if (defined $color) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $color) 0 0 0
641 0 ▶ if (ref($color) eq "ARRAY") {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $color eq 'ARRAY') { } 0 0 0
642 0 $vrml .= $self->{'TAB'}." color Color { color [\n";
643 0 $vrml .= $self->{'TAB'}."\t\t";
644 0 $vrml .= join("$self->{'TAB'}\t\t",@$color);
645 0 $vrml .= $self->{'TAB'}." ] }\n";
646 } else {
647 0 $vrml .= $self->{'TAB'}." color $color\n";
648 }
649 0 ▶ $vrml .= $self->{'TAB'}." colorPerVertex $colorPerVertex\n" if $colorPerVertex;
Branch: 1 branch
BranchTrueFalseTotal
if $colorPerVertex 0 0 0
650 }
651 0 $vrml .= $self->{'TAB'}."}\n";
652 0 push @{$self->{'VRML'}}, $vrml;
653 0 return $self;
654 }
655  
656 =item Extrusion
657  
658 C<Extrusion($crossSection, $spine, $scale, $orientation, $beginCap, $endCap, $creaseAngle, $solid, $convex, $ccw)>
659  
660 $crossSection must be a reference of a list of XY values
661 like C<[ '1 1', '1 -1', '-1 -1', '-1 1', '1 1' ]>
662  
663 $spine must be a reference of a list of spine values
664 like C<['0 0 0', '0 1 0', ...]>
665  
666 =cut
667  
668 0 ▶sub Extrusion {
Subroutine Extrusion: not called CC=11 SCAR=48.8
Pod documented
669 0 my $self = shift;
670 0 my ($crossSection, $spine, $scale, $orientation, $beginCap, $endCap, $creaseAngle, $solid, $convex, $ccw) = @_;
671 0 my $vrml = "";
672 0 $vrml = $self->{'TAB'}."Extrusion {\n";
673 0 ▶ $vrml .= $self->{'TAB'}." beginCap $beginCap\n" if defined $beginCap;
Branch: 1 branch
BranchTrueFalseTotal
if defined $beginCap 0 0 0
674 0 ▶ $vrml .= $self->{'TAB'}." endCap $endCap\n" if defined $endCap;
Branch: 1 branch
BranchTrueFalseTotal
if defined $endCap 0 0 0
675 0 ▶ $vrml .= $self->{'TAB'}." creaseAngle $creaseAngle\n" if defined $creaseAngle;
Branch: 1 branch
BranchTrueFalseTotal
if defined $creaseAngle 0 0 0
676 0 ▶ $vrml .= $self->{'TAB'}." solid $solid\n" if defined $solid;
Branch: 1 branch
BranchTrueFalseTotal
if defined $solid 0 0 0
677 0 ▶ $vrml .= $self->{'TAB'}." convex $convex\n" if defined $convex;
Branch: 1 branch
BranchTrueFalseTotal
if defined $convex 0 0 0
678 0 ▶ $vrml .= $self->{'TAB'}." ccw $ccw\n" if defined $ccw;
Branch: 1 branch
BranchTrueFalseTotal
if defined $ccw 0 0 0
679 0 ▶ if ($crossSection) {
Branch: 1 branch
BranchTrueFalseTotal
if ($crossSection) 0 0 0
680 0 $vrml .= $self->{'TAB'}." crossSection [\n";
681 0 $vrml .= $self->{'TAB'}."\t\t";
682 0 $vrml .= join("\n$self->{'TAB'}\t\t",@$crossSection);
683 0 $vrml .= "\n".$self->{'TAB'}." ]\n";
684 }
685 0 ▶ if ($spine) {
Branch: 1 branch
BranchTrueFalseTotal
if ($spine) 0 0 0
686 0 $vrml .= $self->{'TAB'}." spine [\n";
687 0 $vrml .= $self->{'TAB'}."\t\t";
688 0 $vrml .= join("\n$self->{'TAB'}\t\t",@$spine);
689 0 $vrml .= "\n".$self->{'TAB'}." ]\n";
690 }
691 0 ▶ if ($scale) {
Branch: 1 branch
BranchTrueFalseTotal
if ($scale) 0 0 0
692 0 $vrml .= $self->{'TAB'}." scale [\n";
693 0 $vrml .= $self->{'TAB'}."\t\t";
694 0 $vrml .= join("\n$self->{'TAB'}\t\t",@$scale);
695 0 $vrml .= "\n".$self->{'TAB'}." ]\n";
696 }
697 0 ▶ if ($orientation) {
Branch: 1 branch
BranchTrueFalseTotal
if ($orientation) 0 0 0
698 0 $vrml .= $self->{'TAB'}." orientation [\n";
699 0 $vrml .= $self->{'TAB'}."\t\t";
700 0 $vrml .= join("\n$self->{'TAB'}\t\t",@$orientation);
701 0 $vrml .= "\n".$self->{'TAB'}." ]\n";
702 }
703 0 $vrml .= $self->{'TAB'}."}\n";
704 0 push @{$self->{'VRML'}}, $vrml;
705 0 return $self;
706 }
707  
708 =item IndexedFaceSet
709  
710 C<IndexedFaceSet($coord, $coordIndex, $color, $colorIndex, $colorPerVertex, $normal, $normalIndex, $texCoord, $texCoordIndex)>
711  
712 $coordIndex can be a string with a list of point index
713 like C<'0 1 3 2', '2 3 5 4', ...> or a reference of list of point index
714  
715 $coordIndex can be a string or a reference of a list of colors index
716  
717 $normalIndex can be a string or a reference of a list of normals index
718  
719 $texCoordIndex can be a string or a reference of a list of textures index
720  
721 =cut
722  
723 0 ▶sub IndexedFaceSet {
Subroutine IndexedFaceSet: not called CC=17 SCAR=57.2
Pod documented
724 0 my $self = shift;
725 0 my ($coord, $coordIndex, $color, $colorIndex, $colorPerVertex, $normal, $normalIndex, $texCoord, $texCoordIndex) = @_;
726 0 my $vrml = "";
727 0 $vrml = $self->{'TAB'}."IndexedFaceSet {\n";
728 0 ▶ if (defined $coord) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $coord) 0 0 0
729 0 ▶ if (ref($coord) eq "CODE") {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $coord eq 'CODE') { } 0 0 0
730 0 $vrml .= $self->{'TAB'}." coord ";
731 0 push @{$self->{'VRML'}}, $vrml;
732 0 $self->{'TAB'} .= "\t";
733 0 my $pos = $#{$self->{'VRML'}}+1;
734 0 &$coord;
735 0 $self->_trim($pos);
736 0 chop($self->{'TAB'});
737 0 $vrml = "";
738 } else {
739 0 $vrml .= $self->{'TAB'}." coord $coord\n";
740 }
741 }
742 0 ▶ if ($coordIndex) {
Branch: 1 branch
BranchTrueFalseTotal
if ($coordIndex) 0 0 0
743 0 ▶ if (ref($coordIndex) eq "ARRAY") {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $coordIndex eq 'ARRAY') { } 0 0 0
744 0 $vrml .= $self->{'TAB'}." coordIndex [\n";
745 0 $vrml .= $self->{'TAB'}."\t\t";
746 0 $vrml .= join(", -1,\n$self->{'TAB'}\t\t",@$coordIndex);
747 0 $vrml .= ", -1\n".$self->{'TAB'}." ]\n";
748 } else {
749 0 $vrml .= $self->{'TAB'}." coordIndex [ $coordIndex ]\n";
750 }
751 }
752 0 ▶ if (defined $color) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $color) 0 0 0
753 0 ▶ if (ref($color) eq "CODE") { # Color Node
Branch: 2 branches
BranchTrueFalseTotal
if (ref $color eq 'CODE') { } 0 0 0
elsif (ref $colorIndex eq 'ARRAY') { } 0 0 0
754 0 $vrml .= $self->{'TAB'}." color ";
755 0 push @{$self->{'VRML'}}, $vrml;
756 0 $self->{'TAB'} .= "\t";
757 0 my $pos = $#{$self->{'VRML'}}+1;
758 0 &$color;
759 0 $self->_trim($pos);
760 0 chop($self->{'TAB'});
761 0 $vrml = "";
762 } elsif (ref($colorIndex) eq "ARRAY") {
763 0 $vrml .= $self->{'TAB'}." color Color { color [\n";
764 0 $vrml .= $self->{'TAB'}."\t\t";
765 0 $vrml .= join(",\n$self->{'TAB'}\t\t",@$colorIndex);
766 0 $vrml .= "\n".$self->{'TAB'}." ] }\n";
767 } else {
768 0 $vrml .= $self->{'TAB'}." color $color\n";
769 }
770 0 ▶ if ($colorIndex) {
Branch: 1 branch
BranchTrueFalseTotal
if ($colorIndex) 0 0 0
771 0 $vrml .= $self->{'TAB'}." colorIndex [\n";
772 0 ▶ if (ref($colorIndex) eq "ARRAY") {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $colorIndex eq 'ARRAY') { } 0 0 0
773 0 $vrml .= $self->{'TAB'}."\t\t";
774 0 ▶ if (defined $colorPerVertex && $colorPerVertex eq "FALSE") {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $colorPerVertex and $colorPerVertex eq 'FALSE') { } 0 0 0
Condition0%0/3
defined $colorPerVertex and $colorPerVertex eq "FALSE"
!ll&&!rl&&r
000
MC/DC0%0/2
defined $colorPerVertex and $colorPerVertex eq "FALSE"
defined $colorPerVertex $colorPerVertex eq "FALSE"
Truth table0%0/3
A and B
A= defined $colorPerVertexB= $colorPerVertex eq "FALSE"
ABresult
0X0
100
111
775 0 $vrml .= join(",\n$self->{'TAB'}\t\t",@$colorIndex);
776 } else {
777 0 $vrml .= join(", -1\n$self->{'TAB'}\t\t",@$colorIndex);
778 }
779 } else {
780 0 $vrml .= $colorIndex;
781 }
782 0 $vrml .= "\n".$self->{'TAB'}." ]\n";
783 }
784 0 ▶ $vrml .= $self->{'TAB'}." colorPerVertex $colorPerVertex\n" if $colorPerVertex;
Branch: 1 branch
BranchTrueFalseTotal
if $colorPerVertex 0 0 0
785 }
786 0 ▶ if ($normalIndex) {
Branch: 1 branch
BranchTrueFalseTotal
if ($normalIndex) 0 0 0
787 0 ▶ if (ref($normalIndex) eq "ARRAY") {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $normalIndex eq 'ARRAY') { } 0 0 0
788 0 $vrml .= $self->{'TAB'}." normalIndex [\n";
789 0 $vrml .= $self->{'TAB'}."\t\t";
790 0 $vrml .= join(", -1,\n$self->{'TAB'}\t\t",@$normalIndex);
791 0 $vrml .= ", -1\n".$self->{'TAB'}." ]\n";
792 } else {
793 0 $vrml .= $self->{'TAB'}." normalIndex [ $normalIndex ]\n";
794 }
795 }
796 0 ▶ if ($texCoordIndex) {
Branch: 1 branch
BranchTrueFalseTotal
if ($texCoordIndex) 0 0 0
797 0 ▶ if (ref($texCoordIndex) eq "ARRAY") {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $texCoordIndex eq 'ARRAY') { } 0 0 0
798 0 $vrml .= $self->{'TAB'}." texCoordIndex [\n";
799 0 $vrml .= $self->{'TAB'}."\t\t";
800 0 $vrml .= join(", -1,\n$self->{'TAB'}\t\t",@$texCoordIndex);
801 0 $vrml .= ", -1\n".$self->{'TAB'}." ]\n";
802 } else {
803 0 $vrml .= $self->{'TAB'}." texCoordIndex [ $texCoordIndex ]\n";
804 }
805 }
806 0 $vrml .= $self->{'TAB'}."}\n";
807 0 push @{$self->{'VRML'}}, $vrml;
808 0 return $self;
809 }
810  
811 =item IndexedLineSet
812  
813 C<IndexedLineSet($coord, $coordIndex, $color, $colorIndex, $colorPerVertex)>
814  
815 $coord can be a string with the C<Coordinate> node or a reference to a
816 C<Coordinate> method
817  
818 $coordIndex can be a string or a reference of a list of point index
819 like C<'0, 1, 3, 2', '2, 3, 5, 4', ...>
820  
821 $color can be a string with the <Color> node or a reference of a <Color> method
822  
823 $colorIndex can be a string or a reference of a list of color index
824  
825 =cut
826  
827 0 ▶sub IndexedLineSet {
Subroutine IndexedLineSet: not called CC=12 SCAR=50.5
Pod documented
828 0 my $self = shift;
829 0 my ($coord, $coordIndex, $color, $colorIndex, $colorPerVertex) = @_;
830 0 my $vrml = "";
831 0 $vrml = $self->{'TAB'}."IndexedLineSet {\n";
832 0 ▶ if (defined $coord) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $coord) 0 0 0
833 0 ▶ if (ref($coord) eq "CODE") {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $coord eq 'CODE') { } 0 0 0
834 0 $vrml .= $self->{'TAB'}." coord ";
835 0 push @{$self->{'VRML'}}, $vrml;
836 0 $self->{'TAB'} .= "\t";
837 0 my $pos = $#{$self->{'VRML'}}+1;
838 0 &$coord;
839 0 $self->_trim($pos);
840 0 chop($self->{'TAB'});
841 0 $vrml = "";
842 } else {
843 0 $vrml .= $self->{'TAB'}." coord $coord\n";
844 }
845 }
846 0 ▶ if ($coordIndex) {
Branch: 1 branch
BranchTrueFalseTotal
if ($coordIndex) 0 0 0
847 0 ▶ if (ref($coordIndex) eq "ARRAY") {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $coordIndex eq 'ARRAY') { } 0 0 0
848 0 $vrml .= $self->{'TAB'}." coordIndex [\n";
849 0 $vrml .= $self->{'TAB'}."\t\t";
850 0 $vrml .= join(", -1,\n$self->{'TAB'}\t\t",@$coordIndex);
851 0 $vrml .= ", -1\n".$self->{'TAB'}." ]\n";
852 } else {
853 0 $vrml .= $self->{'TAB'}." coordIndex [ $coordIndex ]\n";
854 }
855 }
856 0 ▶ if (defined $color) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $color) 0 0 0
857 0 ▶ if (ref($color) eq "CODE") {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $color eq 'CODE') { } 0 0 0
858 0 $vrml .= $self->{'TAB'}." color ";
859 0 push @{$self->{'VRML'}}, $vrml;
860 0 $self->{'TAB'} .= "\t";
861 0 my $pos = $#{$self->{'VRML'}}+1;
862 0 &$color;
863 0 $self->_trim($pos);
864 0 chop($self->{'TAB'});
865 0 $vrml = "";
866 } else {
867 0 $vrml .= $self->{'TAB'}." color $color\n";
868 }
869 0 ▶ if ($colorIndex) {
Branch: 1 branch
BranchTrueFalseTotal
if ($colorIndex) 0 0 0
870 0 $vrml .= $self->{'TAB'}." colorIndex [\n";
871 0 ▶ if (ref($colorIndex) eq "ARRAY") {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $colorIndex eq 'ARRAY') { } 0 0 0
872 0 $vrml .= $self->{'TAB'}."\t\t";
873 0 ▶ if (defined $colorPerVertex && $colorPerVertex eq "FALSE") {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $colorPerVertex and $colorPerVertex eq 'FALSE') { } 0 0 0
Condition0%0/3
defined $colorPerVertex and $colorPerVertex eq "FALSE"
!ll&&!rl&&r
000
MC/DC0%0/2
defined $colorPerVertex and $colorPerVertex eq "FALSE"
defined $colorPerVertex $colorPerVertex eq "FALSE"
Truth table0%0/3
A and B
A= defined $colorPerVertexB= $colorPerVertex eq "FALSE"
ABresult
0X0
100
111
874 0 $vrml .= join(",\n$self->{'TAB'}\t\t",@$colorIndex);
875 } else {
876 0 $vrml .= join(", -1\n$self->{'TAB'}\t\t",@$colorIndex);
877 }
878 } else {
879 0 $vrml .= $colorIndex;
880 }
881 0 $vrml .= "\n".$self->{'TAB'}." ]\n";
882 }
883 0 ▶ $vrml .= $self->{'TAB'}." colorPerVertex $colorPerVertex\n" if $colorPerVertex;
Branch: 1 branch
BranchTrueFalseTotal
if $colorPerVertex 0 0 0
884 }
885 0 $vrml .= $self->{'TAB'}."}\n";
886 0 push @{$self->{'VRML'}}, $vrml;
887 0 return $self;
888 }
889  
890 =item PointSet
891  
892 C<PointSet($coord, $color)>
893  
894 =cut
895  
896 0 ▶sub PointSet {
Subroutine PointSet: not called CC=5 SCAR=34.0
Pod documented
897 0 my $self = shift;
898 0 my ($coord, $color) = @_;
899 0 my $vrml = "";
900 0 $vrml = $self->{'TAB'}."PointSet {\n";
901 0 ▶ if (defined $coord) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $coord) 0 0 0
902 0 ▶ if (ref($coord) eq "CODE") {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $coord eq 'CODE') { } 0 0 0
903 0 $vrml .= $self->{'TAB'}." coord ";
904 0 push @{$self->{'VRML'}}, $vrml;
905 0 $self->{'TAB'} .= "\t";
906 0 my $pos = $#{$self->{'VRML'}}+1;
907 0 &$coord;
908 0 $self->_trim($pos);
909 0 chop($self->{'TAB'});
910 0 $vrml = "";
911 } else {
912 0 $vrml .= $self->{'TAB'}." coord $coord\n";
913 }
914 }
915 0 ▶ if (defined $color) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $color) 0 0 0
916 0 ▶ if (ref($color) eq "CODE") {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $color eq 'CODE') { } 0 0 0
917 0 $vrml .= $self->{'TAB'}." color ";
918 0 push @{$self->{'VRML'}}, $vrml;
919 0 $self->{'TAB'} .= "\t";
920 0 my $pos = $#{$self->{'VRML'}}+1;
921 0 &$color;
922 0 $self->_trim($pos);
923 0 chop($self->{'TAB'});
924 0 $vrml = "";
925 } else {
926 0 $vrml .= $self->{'TAB'}." color $color\n";
927 }
928 }
929 0 $vrml .= $self->{'TAB'}."}\n";
930 0 push @{$self->{'VRML'}}, $vrml;
931 0 return $self;
932 }
933  
934 =item Sphere
935  
936 C<Sphere($radius)>
937  
938 $radius have to be > 0
939  
940 =cut
941  
942 1 ▶sub Sphere {
Subroutine Sphere: called CC=2 SCAR=6.9
Pod documented
943 1 my $self = shift;
944 1 my ($radius) = @_;
945 1 my $vrml = "";
946 1 $vrml = $self->{'TAB'}."Sphere {\n";
947 1 ▶ $vrml .= $self->{'TAB'}." radius $radius\n" if $radius;
Branch: 1 branch
BranchTrueFalseTotal
if $radius 1 0 1
948 1 $vrml .= $self->{'TAB'}."}\n";
949 1 push @{$self->{'VRML'}}, $vrml;
950 1 return $self;
951 }
952  
953 =item Text
954  
955 C<Text($string, $fontStyle, $length, $maxExtent)>
956  
957 =cut
958  
959 1 ▶sub Text {
Subroutine Text: called CC=6 SCAR=18.2
Pod documented
960 1 my $self = shift;
961 1 my ($string, $fontStyle, $length, $maxExtent) = @_;
962 1 ▶ return unless $string;
Branch: 1 branch
BranchTrueFalseTotal
unless $string 0 1 1
963 1 my $vrml = $self->{'TAB'}."Text {\n";
964 1 $vrml .= $self->{'TAB'}." string ".$self->utf8($string)."\n";
965 1 ▶ if (defined $fontStyle) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $fontStyle) 1 0 1
966 1 ▶ if (ref($fontStyle) eq "CODE") { # FontStyle Node
Branch: 1 branch
BranchTrueFalseTotal
if (ref $fontStyle eq 'CODE') { } 1 0 1
967 1 $vrml .= $self->{'TAB'}." fontStyle ";
968 1 push @{$self->{'VRML'}}, $vrml;
969 1 $self->{'TAB'} .= "\t";
970 1 my $pos = $#{$self->{'VRML'}}+1;
971 1 &$fontStyle;
972 1 $self->_trim($pos);
973 1 chop($self->{'TAB'});
974 1 $vrml = "";
975 } else {
976 0 $vrml .= $self->{'TAB'}." fontStyle $fontStyle\n";
977 }
978 }
979 1 ▶ $vrml .= $self->{'TAB'}." length $length\n" if $length;
Branch: 1 branch
BranchTrueFalseTotal
if $length 0 1 1
980 1 ▶ $vrml .= $self->{'TAB'}." maxExtent $maxExtent\n" if $maxExtent;
Branch: 1 branch
BranchTrueFalseTotal
if $maxExtent 0 1 1
981 1 $vrml .= $self->{'TAB'}."}\n";
982 1 push @{$self->{'VRML'}}, $vrml;
983 1 return $self;
984 }
985  
986 #--------------------------------------------------------------------
987  
988 =back
989  
990 =head2 Geometric Properties
991  
992 =over 4
993  
994 =cut
995  
996 #--------------------------------------------------------------------
997  
998 =item Coordinate
999  
1000 C<Coordinate(@point)>
1001  
1002 @point should be a list of points with strings like C<'1.0 0.0 0.0', '-1 2 0'>
1003  
1004 =cut
1005  
1006 0 ▶sub Coordinate {
Subroutine Coordinate: not called CC=1 SCAR=6.9
Pod documented
1007 0 my $self = shift;
1008 0 my (@point) = @_;
1009 0 my $vrml = "";
1010 0 $vrml = $self->{'TAB'}."Coordinate {\n";
1011 0 $vrml .= $self->{'TAB'}." point [\n";
1012 0 $vrml .= $self->{'TAB'}."\t\t";
1013 0 $vrml .= join(",\n$self->{'TAB'}\t\t",@point);
1014 0 $vrml .= "\n".$self->{'TAB'}." ]\n";
1015 0 $vrml .= $self->{'TAB'}."}\n";
1016 0 push @{$self->{'VRML'}}, $vrml;
1017 0 return $self;
1018 }
1019  
1020 =item Color
1021  
1022 C<Color(@color)>
1023  
1024 @color should be a list of colors with strings like C<'1.0 0.0 0.0', '.3 .2 .1'>
1025  
1026 =cut
1027  
1028 0 ▶sub Color {
Subroutine Color: not called CC=1 SCAR=6.9
Pod documented
1029 0 my $self = shift;
1030 0 my (@color) = @_;
1031 0 my $vrml = "";
1032 0 $vrml = $self->{'TAB'}."Color {\n";
1033 0 $vrml .= $self->{'TAB'}." color [\n";
1034 0 $vrml .= $self->{'TAB'}."\t\t";
1035 0 $vrml .= join(",\n$self->{'TAB'}\t\t",@color);
1036 0 $vrml .= "\n".$self->{'TAB'}." ]\n";
1037 0 $vrml .= $self->{'TAB'}."}\n";
1038 0 push @{$self->{'VRML'}}, $vrml;
1039 0 return $self;
1040 }
1041  
1042 =item Normal
1043  
1044 C<Normal(@vector)>
1045  
1046 @vector should be a list of vectors with strings like C<'1.0 0.0 0.0', '.4 .2 0'>
1047  
1048 =cut
1049  
1050 0 ▶sub Normal {
Subroutine Normal: not called CC=1 SCAR=6.9
Pod documented
1051 0 my $self = shift;
1052 0 my (@vector) = @_;
1053 0 my $vrml = "";
1054 0 $vrml = $self->{'TAB'}."Normal {\n";
1055 0 $vrml .= $self->{'TAB'}." vector [\n$self->{'TAB'}\t\t";
1056 0 $vrml .= join(",\n$self->{'TAB'}\t\t",@vector);
1057 0 $vrml .= "\n".$self->{'TAB'}."\t]\n";
1058 0 $vrml .= $self->{'TAB'}."}\n";
1059 0 push @{$self->{'VRML'}}, $vrml;
1060 0 return $self;
1061 }
1062  
1063  
1064 #--------------------------------------------------------------------
1065  
1066 =back
1067  
1068 =head2 Appearance
1069  
1070 =over 4
1071  
1072 =cut
1073  
1074 #--------------------------------------------------------------------
1075  
1076 =item Appearance
1077  
1078 C<Appearance($material, $texture, $textureTransform)>
1079  
1080 =cut
1081  
1082 6 ▶sub Appearance {
Subroutine Appearance: called CC=10 SCAR=34.1
Pod documented
1083 6 my $self = shift;
1084 6 my ($material, $texture, $textureTransform) = @_;
1085 6 my $vrml = "";
1086 6 $vrml = $self->{'TAB'}."Appearance {\n";
1087 6 ▶ if (defined $material) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $material) 6 0 6
1088 6 $vrml .= $self->{'TAB'}." material ";
1089 6 ▶ if (ref($material)) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $material) { } 6 0 6
1090 6 push @{$self->{'VRML'}}, $vrml;
1091 6 $vrml = "";
1092 6 $self->{'TAB'} .= "\t";
1093 6 my $pos = $#{$self->{'VRML'}}+1;
1094 6 ▶ if (ref($material) eq "CODE") { # Material Node
Branch: 3 branches
BranchTrueFalseTotal
if (ref $material eq 'CODE') { } 6 0 6
elsif (ref $material eq 'ARRAY') { } 0 0 0
elsif (ref $material eq 'HASH') { } 0 0 0
1095 6 &$material;
1096 } elsif (ref($material) eq "ARRAY") {
1097 0 $self->Material(@$material);
1098 } elsif (ref($material) eq "HASH") {
1099 0 $self->Material(%$material);
1100 }
1101 6 $self->_trim($pos);
1102 6 chop($self->{'TAB'});
1103 } else {
1104 0 $vrml .= "Material {$material}\n";
1105 }
1106 }
1107 6 ▶ if (defined $texture) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $texture) 0 6 6
1108 0 ▶ if (ref($texture) eq "CODE") {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $texture eq 'CODE') { } 0 0 0
1109 0 $vrml .= $self->{'TAB'}." texture ";
1110 0 push @{$self->{'VRML'}}, $vrml;
1111 0 $self->{'TAB'} .= "\t";
1112 0 my $pos = $#{$self->{'VRML'}}+1;
1113 0 &$texture;
1114 0 $self->_trim($pos);
1115 0 chop($self->{'TAB'});
1116 0 $vrml = "";
1117 } else {
1118 0 $vrml .= $self->{'TAB'}." texture $texture\n";
1119 }
1120 }
1121 6 ▶ if (defined $textureTransform) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $textureTransform) 0 6 6
1122 0 ▶ if (ref($textureTransform) eq "CODE") {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $textureTransform eq 'CODE') { } 0 0 0
1123 0 $vrml .= $self->{'TAB'}." textureTransform ";
1124 0 push @{$self->{'VRML'}}, $vrml;
1125 0 $self->{'TAB'} .= "\t";
1126 0 my $pos = $#{$self->{'VRML'}}+1;
1127 0 &$textureTransform;
1128 0 $self->_trim($pos);
1129 0 chop($self->{'TAB'});
1130 0 $vrml = "";
1131 } else {
1132 0 $vrml .= $self->{'TAB'}." textureTransform $textureTransform\n";
1133 }
1134 }
1135 6 $vrml .= $self->{'TAB'}."}\n";
1136 6 push @{$self->{'VRML'}}, $vrml;
1137 6 return $self;
1138 }
1139  
1140 =item Fontstyle
1141  
1142 C<FontStyle($size, $family, $style, $justify, $language)>
1143 defines the current font style for the current C<Text> Nodes
1144  
1145  
1146 $style can be 'PLAIN','BOLD','ITALIC','BOLD ITALIC'
1147  
1148 $familiy can be 'SERIF','SANS','TYPEWRITER'
1149  
1150 $justify can be 'BEGIN', 'MIDDLE', 'END'
1151  
1152 =cut
1153  
1154 1 ▶sub FontStyle {
Subroutine FontStyle: called CC=6 SCAR=18.5
Pod undocumented
1155 1 my $self = shift;
1156 1 my ($size, $family, $style, $justify, $language) = @_;
1157 1 my $vrml = "";
1158 1 $vrml = $self->{'TAB'}."FontStyle {\n";
1159 1 ▶ $vrml .= $self->{'TAB'}." size $size\n" if $size;
Branch: 1 branch
BranchTrueFalseTotal
if $size 1 0 1
1160 1 ▶ $vrml .= $self->{'TAB'}." family \"$family\"\n" if $family;
Branch: 1 branch
BranchTrueFalseTotal
if $family 1 0 1
1161 1 ▶ $vrml .= $self->{'TAB'}." style \"$style\"\n" if $style;
Branch: 1 branch
BranchTrueFalseTotal
if $style 1 0 1
1162 1 ▶ $vrml .= $self->{'TAB'}." justify \"$justify\"\n" if $justify;
Branch: 1 branch
BranchTrueFalseTotal
if $justify 0 1 1
1163 1 ▶ $vrml .= $self->{'TAB'}." language \"$language\"\n" if $language;
Branch: 1 branch
BranchTrueFalseTotal
if $language 0 1 1
1164 1 $vrml .= $self->{'TAB'}."}\n";
1165 1 push @{$self->{'VRML'}}, $vrml;
1166 1 return $self;
1167 }
1168  
1169 =item Material
1170  
1171 C<Material(%materials)>
1172  
1173 =cut
1174  
1175 6 ▶sub Material {
Subroutine Material: called CC=2 SCAR=6.9
Pod documented
1176 6 my $self = shift;
1177 6 my (%materials) = @_;
1178 6 my $vrml = "";
1179 6 my ($key, $value);
1180 6 $vrml = $self->{'TAB'}."Material {\n";
1181 6 ▶ while(($key,$value) = each %materials) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %materials) 6 6 12
1182 6 $vrml .= $self->{'TAB'}." $key $value\n";
1183 }
1184 6 $vrml .= $self->{'TAB'}."}\n";
1185 6 push @{$self->{'VRML'}}, $vrml;
1186 6 return $self;
1187 }
1188  
1189 =item ImageTexture
1190  
1191 C<ImageTexture($url)>
1192  
1193 =cut
1194  
1195 0 ▶sub ImageTexture {
Subroutine ImageTexture: not called CC=3 SCAR=24.8
Pod documented
1196 0 my $self = shift;
1197 0 my ($url, $repeatS, $repeatT) = @_;
1198 0 my $vrml = "";
1199 0 $vrml = $self->{'TAB'}."ImageTexture {\n";
1200 0 $vrml .= $self->{'TAB'}." url \"".$self->escape($url)."\"\n";
1201 0 ▶ $vrml .= $self->{'TAB'}." repeatS $repeatS\n" if $repeatS;
Branch: 1 branch
BranchTrueFalseTotal
if $repeatS 0 0 0
1202 0 ▶ $vrml .= $self->{'TAB'}." repeatT $repeatT\n" if $repeatT;
Branch: 1 branch
BranchTrueFalseTotal
if $repeatT 0 0 0
1203 0 $vrml .= $self->{'TAB'}."}\n";
1204 0 push @{$self->{'VRML'}}, $vrml;
1205 0 return $self;
1206 }
1207  
1208 =item MovieTexture
1209  
1210 C<MovieTexture($url)>
1211  
1212 =cut
1213  
1214 0 ▶sub MovieTexture {
Subroutine MovieTexture: not called CC=6 SCAR=37.4
Pod documented
1215 0 my $self = shift;
1216 0 my ($url, $loop, $startTime, $stopTime, $repeatS, $repeatT) = @_;
1217 0 my $vrml = "";
1218 0 $vrml = $self->{'TAB'}."MovieTexture {\n";
1219 0 $vrml .= $self->{'TAB'}." url \"".$self->escape($url)."\"\n";
1220 0 ▶ $vrml .= $self->{'TAB'}." loop $loop\n" if $loop;
Branch: 1 branch
BranchTrueFalseTotal
if $loop 0 0 0
1221 0 ▶ $vrml .= $self->{'TAB'}." startTime $startTime\n" if $startTime;
Branch: 1 branch
BranchTrueFalseTotal
if $startTime 0 0 0
1222 0 ▶ $vrml .= $self->{'TAB'}." stopTime $stopTime\n" if $stopTime;
Branch: 1 branch
BranchTrueFalseTotal
if $stopTime 0 0 0
1223 0 ▶ $vrml .= $self->{'TAB'}." repeatS $repeatS\n" if $repeatS;
Branch: 1 branch
BranchTrueFalseTotal
if $repeatS 0 0 0
1224 0 ▶ $vrml .= $self->{'TAB'}." repeatT $repeatT\n" if $repeatT;
Branch: 1 branch
BranchTrueFalseTotal
if $repeatT 0 0 0
1225 0 $vrml .= $self->{'TAB'}."}\n";
1226 0 push @{$self->{'VRML'}}, $vrml;
1227 0 return $self;
1228 }
1229  
1230 #--------------------------------------------------------------------
1231  
1232 =back
1233  
1234 =head2 Sensors
1235  
1236 =over 4
1237  
1238 =cut
1239  
1240 #--------------------------------------------------------------------
1241  
1242 =item CylinderSensor
1243  
1244 C<CylinderSensor($maxAngle, $minAngle, $diskAngle, $offset, $autoOffset, $enabled)>
1245  
1246 =cut
1247  
1248 0 ▶sub CylinderSensor {
Subroutine CylinderSensor: not called CC=7 SCAR=40.3
Pod documented
1249 0 my $self = shift;
1250 0 my ($maxAngle, $minAngle, $diskAngle, $offset, $autoOffset, $enabled) = @_;
1251 0 my $vrml = "";
1252 0 $vrml = $self->{'TAB'}."CylinderSensor {\n";
1253 0 ▶ $vrml .= $self->{'TAB'}." maxAngle $maxAngle\n" if defined $maxAngle;
Branch: 1 branch
BranchTrueFalseTotal
if defined $maxAngle 0 0 0
1254 0 ▶ $vrml .= $self->{'TAB'}." minAngle $minAngle\n" if defined $minAngle;
Branch: 1 branch
BranchTrueFalseTotal
if defined $minAngle 0 0 0
1255 0 ▶ $vrml .= $self->{'TAB'}." diskAngle $diskAngle\n" if defined $diskAngle;
Branch: 1 branch
BranchTrueFalseTotal
if defined $diskAngle 0 0 0
1256 0 ▶ $vrml .= $self->{'TAB'}." offset $offset\n" if $offset;
Branch: 1 branch
BranchTrueFalseTotal
if $offset 0 0 0
1257 0 ▶ $vrml .= $self->{'TAB'}." autoOffset $autoOffset\n" if $autoOffset;
Branch: 1 branch
BranchTrueFalseTotal
if $autoOffset 0 0 0
1258 0 ▶ $vrml .= $self->{'TAB'}." enabled $enabled\n" if $enabled;
Branch: 1 branch
BranchTrueFalseTotal
if $enabled 0 0 0
1259 0 $vrml .= $self->{'TAB'}."}\n";
1260 0 push @{$self->{'VRML'}}, $vrml;
1261 0 return $self;
1262 }
1263  
1264 =item PlaneSensor
1265  
1266 C<PlaneSensor($maxPosition, $minPosition, $offset, $autoOffset, $enabled)>
1267  
1268 =cut
1269  
1270 0 ▶sub PlaneSensor {
Subroutine PlaneSensor: not called CC=6 SCAR=37.4
Pod documented
1271 0 my $self = shift;
1272 0 my ($maxPosition, $minPosition, $offset, $autoOffset, $enabled) = @_;
1273 0 my $vrml = "";
1274 0 $vrml = $self->{'TAB'}."PlaneSensor {\n";
1275 0 ▶ $vrml .= $self->{'TAB'}." maxPosition $maxPosition\n" if $maxPosition;
Branch: 1 branch
BranchTrueFalseTotal
if $maxPosition 0 0 0
1276 0 ▶ $vrml .= $self->{'TAB'}." minPosition $minPosition\n" if $minPosition;
Branch: 1 branch
BranchTrueFalseTotal
if $minPosition 0 0 0
1277 0 ▶ $vrml .= $self->{'TAB'}." offset $offset\n" if defined $offset;
Branch: 1 branch
BranchTrueFalseTotal
if defined $offset 0 0 0
1278 0 ▶ $vrml .= $self->{'TAB'}." autoOffset $autoOffset\n" if $autoOffset;
Branch: 1 branch
BranchTrueFalseTotal
if $autoOffset 0 0 0
1279 0 ▶ $vrml .= $self->{'TAB'}." enabled $enabled\n" if $enabled;
Branch: 1 branch
BranchTrueFalseTotal
if $enabled 0 0 0
1280 0 $vrml .= $self->{'TAB'}."}\n";
1281 0 push @{$self->{'VRML'}}, $vrml;
1282 0 return $self;
1283 }
1284  
1285 =item ProximitySensor
1286  
1287 C<ProximitySensor($size, $center, $enabled)>
1288  
1289 =cut
1290  
1291 0 ▶sub ProximitySensor {
Subroutine ProximitySensor: not called CC=4 SCAR=30.0
Pod documented
1292 0 my $self = shift;
1293 0 my ($size, $center, $enabled) = @_;
1294 0 my $vrml = "";
1295 0 $vrml = $self->{'TAB'}."ProximitySensor {\n";
1296 0 ▶ $vrml .= $self->{'TAB'}." size $size\n" if $size;
Branch: 1 branch
BranchTrueFalseTotal
if $size 0 0 0
1297 0 ▶ $vrml .= $self->{'TAB'}." center $center\n" if $center;
Branch: 1 branch
BranchTrueFalseTotal
if $center 0 0 0
1298 0 ▶ $vrml .= $self->{'TAB'}." enabled $enabled\n" if $enabled;
Branch: 1 branch
BranchTrueFalseTotal
if $enabled 0 0 0
1299 0 $vrml .= $self->{'TAB'}."}\n";
1300 0 push @{$self->{'VRML'}}, $vrml;
1301 0 return $self;
1302 }
1303  
1304 =item SphereSensor
1305  
1306 C<SphereSensor($offset, $autoOffset, $enabled)>
1307  
1308 =cut
1309  
1310 0 ▶sub SphereSensor {
Subroutine SphereSensor: not called CC=4 SCAR=30.0
Pod documented
1311 0 my $self = shift;
1312 0 my ($offset, $autoOffset, $enabled) = @_;
1313 0 my $vrml = "";
1314 0 $vrml = $self->{'TAB'}."SphereSensor {\n";
1315 0 ▶ $vrml .= $self->{'TAB'}." offset $offset\n" if $offset;
Branch: 1 branch
BranchTrueFalseTotal
if $offset 0 0 0
1316 0 ▶ $vrml .= $self->{'TAB'}." autoOffset $autoOffset\n" if $autoOffset;
Branch: 1 branch
BranchTrueFalseTotal
if $autoOffset 0 0 0
1317 0 ▶ $vrml .= $self->{'TAB'}." enabled $enabled\n" if $enabled;
Branch: 1 branch
BranchTrueFalseTotal
if $enabled 0 0 0
1318 0 $vrml .= $self->{'TAB'}."}\n";
1319 0 push @{$self->{'VRML'}}, $vrml;
1320 0 return $self;
1321 }
1322  
1323 =item TimeSensor
1324  
1325 C<TimeSensor($cycleInterval, $loop, $startTime, $stopTime, $enabled)>
1326  
1327 =cut
1328  
1329 0 ▶sub TimeSensor {
Subroutine TimeSensor: not called CC=6 SCAR=37.4
Pod documented
1330 0 my $self = shift;
1331 0 my ($cycleInterval, $loop, $startTime, $stopTime, $enabled) = @_;
1332 0 my $vrml = "";
1333 0 $vrml = $self->{'TAB'}."TimeSensor {\n";
1334 0 ▶ $vrml .= $self->{'TAB'}." cycleInterval $cycleInterval\n" if $cycleInterval;
Branch: 1 branch
BranchTrueFalseTotal
if $cycleInterval 0 0 0
1335 0 ▶ $vrml .= $self->{'TAB'}." loop $loop\n" if $loop;
Branch: 1 branch
BranchTrueFalseTotal
if $loop 0 0 0
1336 0 ▶ $vrml .= $self->{'TAB'}." startTime $startTime\n" if $startTime;
Branch: 1 branch
BranchTrueFalseTotal
if $startTime 0 0 0
1337 0 ▶ $vrml .= $self->{'TAB'}." stopTime $stopTime\n" if $stopTime;
Branch: 1 branch
BranchTrueFalseTotal
if $stopTime 0 0 0
1338 0 ▶ $vrml .= $self->{'TAB'}." enabled $enabled\n" if $enabled;
Branch: 1 branch
BranchTrueFalseTotal
if $enabled 0 0 0
1339 0 $vrml .= $self->{'TAB'}."}\n";
1340 0 push @{$self->{'VRML'}}, $vrml;
1341 0 return $self;
1342 }
1343  
1344 =item TouchSensor
1345  
1346 C<TouchSensor($enabled)>
1347  
1348 =cut
1349  
1350 0 ▶sub TouchSensor {
Subroutine TouchSensor: not called CC=2 SCAR=17.9
Pod documented
1351 0 my $self = shift;
1352 0 my ($enabled) = @_;
1353 0 my $vrml = "";
1354 0 $vrml = $self->{'TAB'}."TouchSensor {";
1355 0 ▶ $vrml .= $self->{'TAB'}." enabled $enabled\n" if $enabled;
Branch: 1 branch
BranchTrueFalseTotal
if $enabled 0 0 0
1356 0 $vrml .= "}\n";
1357 0 push @{$self->{'VRML'}}, $vrml;
1358 0 return $self;
1359 }
1360  
1361 =item VisibilitySensor
1362  
1363 C<VisibilitySensor($size, $center, $enabled)>
1364  
1365 =cut
1366  
1367 0 ▶sub VisibilitySensor {
Subroutine VisibilitySensor: not called CC=4 SCAR=30.0
Pod documented
1368 0 my $self = shift;
1369 0 my ($size, $center, $enabled) = @_;
1370 0 my $vrml = "";
1371 0 $vrml = $self->{'TAB'}."VisibilitySensor {\n";
1372 0 ▶ $vrml .= $self->{'TAB'}." size $size\n" if $size;
Branch: 1 branch
BranchTrueFalseTotal
if $size 0 0 0
1373 0 ▶ $vrml .= $self->{'TAB'}." center $center\n" if $center;
Branch: 1 branch
BranchTrueFalseTotal
if $center 0 0 0
1374 0 ▶ $vrml .= $self->{'TAB'}." enabled $enabled\n" if $enabled;
Branch: 1 branch
BranchTrueFalseTotal
if $enabled 0 0 0
1375 0 $vrml .= $self->{'TAB'}."}\n";
1376 0 push @{$self->{'VRML'}}, $vrml;
1377 0 return $self;
1378 }
1379  
1380 #--------------------------------------------------------------------
1381  
1382 =back
1383  
1384 =head2 Interpolators
1385  
1386 =over 4
1387  
1388 =cut
1389  
1390 #--------------------------------------------------------------------
1391  
1392 =item ColorInterpolator
1393  
1394 C<ColorInterpolator($key, $keyValue)>
1395  
1396 =cut
1397  
1398 0 ▶sub ColorInterpolator {
Subroutine ColorInterpolator: not called CC=3 SCAR=24.8
Pod documented
1399 0 my $self = shift;
1400 0 my ($key, $keyValue) = @_;
1401 0 my $vrml = "";
1402 0 $vrml = $self->{'TAB'}."ColorInterpolator {\n";
1403 0 ▶ if (ref($key) eq "ARRAY") {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $key eq 'ARRAY') { } 0 0 0
1404 0 $vrml .= $self->{'TAB'}." key [\n$self->{'TAB'}\t\t".join(",\n$self->{'TAB'}\t\t",@$key)."\n$self->{'TAB'}\t]\n";
1405 } else {
1406 0 $vrml .= $self->{'TAB'}." key [$key]\n";
1407 }
1408 0 ▶ if (ref($keyValue) eq "ARRAY") {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $keyValue eq 'ARRAY') { } 0 0 0
1409 0 $vrml .= $self->{'TAB'}." keyValue [\n$self->{'TAB'}\t\t".join(",\n$self->{'TAB'}\t\t",@$keyValue)."\n$self->{'TAB'}\t]\n";
1410 } else {
1411 0 $vrml .= $self->{'TAB'}." keyValue [$keyValue]\n";
1412 }
1413 0 $vrml .= $self->{'TAB'}."}\n";
1414 0 push @{$self->{'VRML'}}, $vrml;
1415 0 return $self;
1416 }
1417  
1418 =item CoordinateInterpolator
1419  
1420 C<CoordinateInterpolator($key, $keyValue)>
1421  
1422 =cut
1423  
1424 0 ▶sub CoordinateInterpolator {
Subroutine CoordinateInterpolator: not called CC=3 SCAR=24.8
Pod documented
1425 0 my $self = shift;
1426 0 my ($key, $keyValue) = @_;
1427 0 my $vrml = "";
1428 0 $vrml = $self->{'TAB'}."CoordinateInterpolator {\n";
1429 0 ▶ if (ref($key) eq "ARRAY") {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $key eq 'ARRAY') { } 0 0 0
1430 0 $vrml .= $self->{'TAB'}." key [\n$self->{'TAB'}\t\t".join(",\n$self->{'TAB'}\t\t",@$key)."\n$self->{'TAB'}\t]\n";
1431 } else {
1432 0 $vrml .= $self->{'TAB'}." key [$key]\n";
1433 }
1434 0 ▶ if (ref($keyValue) eq "ARRAY") {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $keyValue eq 'ARRAY') { } 0 0 0
1435 0 $vrml .= $self->{'TAB'}." keyValue [\n$self->{'TAB'}\t\t".join(",\n$self->{'TAB'}\t\t",@$keyValue)."\n$self->{'TAB'}\t]\n";
1436 } else {
1437 0 $vrml .= $self->{'TAB'}." keyValue [$keyValue]\n";
1438 }
1439 0 $vrml .= $self->{'TAB'}."}\n";
1440 0 push @{$self->{'VRML'}}, $vrml;
1441 0 return $self;
1442 }
1443  
1444 =item OrientationInterpolator
1445  
1446 C<OrientationInterpolator($key, $keyValue)>
1447  
1448 =cut
1449  
1450 0 ▶sub OrientationInterpolator {
Subroutine OrientationInterpolator: not called CC=3 SCAR=24.8
Pod documented
1451 0 my $self = shift;
1452 0 my ($key, $keyValue) = @_;
1453 0 my $vrml = "";
1454 0 $vrml = $self->{'TAB'}."OrientationInterpolator {\n";
1455 0 ▶ if (ref($key) eq "ARRAY") {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $key eq 'ARRAY') { } 0 0 0
1456 0 $vrml .= $self->{'TAB'}." key [\n$self->{'TAB'}\t\t".join(",\n$self->{'TAB'}\t\t",@$key)."\n$self->{'TAB'}\t]\n";
1457 } else {
1458 0 $vrml .= $self->{'TAB'}." key [$key]\n";
1459 }
1460 0 ▶ if (ref($keyValue) eq "ARRAY") {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $keyValue eq 'ARRAY') { } 0 0 0
1461 0 $vrml .= $self->{'TAB'}." keyValue [\n$self->{'TAB'}\t\t".join(",\n$self->{'TAB'}\t\t",@$keyValue)."\n$self->{'TAB'}\t]\n";
1462 } else {
1463 0 $vrml .= $self->{'TAB'}." keyValue [$keyValue]\n";
1464 }
1465 0 $vrml .= $self->{'TAB'}."}\n";
1466 0 push @{$self->{'VRML'}}, $vrml;
1467 0 return $self;
1468 }
1469  
1470 =item NormalInterpolator
1471  
1472 C<NormalInterpolator($key, $keyValue)>
1473  
1474 =cut
1475  
1476 0 ▶sub NormalInterpolator {
Subroutine NormalInterpolator: not called CC=3 SCAR=24.8
Pod documented
1477 0 my $self = shift;
1478 0 my ($key, $keyValue) = @_;
1479 0 my $vrml = "";
1480 0 $vrml = $self->{'TAB'}."NormalInterpolator {\n";
1481 0 ▶ if (ref($key) eq "ARRAY") {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $key eq 'ARRAY') { } 0 0 0
1482 0 $vrml .= $self->{'TAB'}." key [\n$self->{'TAB'}\t\t".join(",\n$self->{'TAB'}\t\t",@$key)."\n$self->{'TAB'}\t]\n";
1483 } else {
1484 0 $vrml .= $self->{'TAB'}." key [$key]\n";
1485 }
1486 0 ▶ if (ref($keyValue) eq "ARRAY") {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $keyValue eq 'ARRAY') { } 0 0 0
1487 0 $vrml .= $self->{'TAB'}." keyValue [\n$self->{'TAB'}\t\t".join(",\n$self->{'TAB'}\t\t",@$keyValue)."\n$self->{'TAB'}\t]\n";
1488 } else {
1489 0 $vrml .= $self->{'TAB'}." keyValue [$keyValue]\n";
1490 }
1491 0 $vrml .= $self->{'TAB'}."}\n";
1492 0 push @{$self->{'VRML'}}, $vrml;
1493 0 return $self;
1494 }
1495  
1496 =item PositionInterpolator
1497  
1498 C<PositionInterpolator($key, $keyValue)>
1499  
1500 =cut
1501  
1502 0 ▶sub PositionInterpolator {
Subroutine PositionInterpolator: not called CC=3 SCAR=24.8
Pod documented
1503 0 my $self = shift;
1504 0 my ($key, $keyValue) = @_;
1505 0 my $vrml = "";
1506 0 $vrml = $self->{'TAB'}."PositionInterpolator {\n";
1507 0 ▶ if (ref($key) eq "ARRAY") {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $key eq 'ARRAY') { } 0 0 0
1508 0 $vrml .= $self->{'TAB'}." key [\n$self->{'TAB'}\t\t".join(",\n$self->{'TAB'}\t\t",@$key)."\n$self->{'TAB'}\t]\n";
1509 } else {
1510 0 $vrml .= $self->{'TAB'}." key [$key]\n";
1511 }
1512 0 ▶ if (ref($keyValue) eq "ARRAY") {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $keyValue eq 'ARRAY') { } 0 0 0
1513 0 $vrml .= $self->{'TAB'}." keyValue [\n$self->{'TAB'}\t\t".join(",\n$self->{'TAB'}\t\t",@$keyValue)."\n$self->{'TAB'}\t]\n";
1514 } else {
1515 0 $vrml .= $self->{'TAB'}." keyValue [$keyValue]\n";
1516 }
1517 0 $vrml .= $self->{'TAB'}."}\n";
1518 0 push @{$self->{'VRML'}}, $vrml;
1519 0 return $self;
1520 }
1521  
1522 =item ScalarInterpolator
1523  
1524 C<ScalarInterpolator($key, $keyValue)>
1525  
1526 $key MFFloat
1527 $keyValue MFFloat
1528  
1529 =cut
1530  
1531 0 ▶sub ScalarInterpolator {
Subroutine ScalarInterpolator: not called CC=3 SCAR=24.8
Pod documented
1532 0 my $self = shift;
1533 0 my ($key, $keyValue) = @_;
1534 0 my $vrml = "";
1535 0 $vrml = $self->{'TAB'}."ScalarInterpolator {\n";
1536 0 ▶ if (ref($key) eq "ARRAY") {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $key eq 'ARRAY') { } 0 0 0
1537 0 $vrml .= $self->{'TAB'}." key [\n$self->{'TAB'}\t\t".join(",\n$self->{'TAB'}\t\t",@$key)."\n$self->{'TAB'}\t]\n";
1538 } else {
1539 0 $vrml .= $self->{'TAB'}." key [$key]\n";
1540 }
1541 0 ▶ if (ref($keyValue) eq "ARRAY") {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $keyValue eq 'ARRAY') { } 0 0 0
1542 0 $vrml .= $self->{'TAB'}." keyValue [\n$self->{'TAB'}\t\t".join(",\n$self->{'TAB'}\t\t",@$keyValue)."\n$self->{'TAB'}\t]\n";
1543 } else {
1544 0 $vrml .= $self->{'TAB'}." keyValue [$keyValue]\n";
1545 }
1546 0 $vrml .= $self->{'TAB'}."}\n";
1547 0 push @{$self->{'VRML'}}, $vrml;
1548 0 return $self;
1549 }
1550  
1551 #--------------------------------------------------------------------
1552  
1553 =back
1554  
1555 =head2 Bindable Nodes
1556  
1557 =over 4
1558  
1559 =cut
1560  
1561 #--------------------------------------------------------------------
1562  
1563 =item Background
1564  
1565 C<Background($hash)>
1566  
1567 You only can use a hash. Parameter see VRML Spec
1568  
1569 =cut
1570  
1571 0 ▶sub Background {
Subroutine Background: not called CC=4 SCAR=30.0
Pod documented
1572 0 my $self = shift;
1573 0 my (%hash) = @_;
1574 0 ▶ return unless %hash;
Branch: 1 branch
BranchTrueFalseTotal
unless %hash 0 0 0
1575 0 my $key;
1576 0 my $vrml = "";
1577 0 $vrml = $self->{'TAB'}."Background {\n";
1578 0 foreach $key (keys %hash) {
1579 0 ▶ $vrml .= $self->{'TAB'}." $key $hash{$key}\n" if defined $hash{$key};
Branch: 1 branch
BranchTrueFalseTotal
if defined $hash{$key} 0 0 0
1580 }
1581 0 $vrml .= $self->{'TAB'}."}\n";
1582 0 push @{$self->{'VRML'}}, $vrml;
1583 0 return $self;
1584 }
1585  
1586 =item NavigationInfo
1587  
1588 C<NavigationInfo($type, $speed, $headlight, $visibilityLimit, $avatarSize)>
1589  
1590 You can use a hash reference or all parameter in the same order above
1591  
1592 =cut
1593  
1594 0 ▶sub NavigationInfo {
Subroutine NavigationInfo: not called CC=11 SCAR=48.8
Pod documented
1595 0 my $self = shift;
1596 0 my ($type, $speed, $headlight, $visibilityLimit, $avatarSize) = @_;
1597 0 my $key;
1598 0 my $vrml = "";
1599 0 $vrml = $self->{'TAB'}."NavigationInfo {\n";
1600 0 ▶ if (ref($type) eq "HASH") {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $type eq 'HASH') { } 0 0 0
1601 0 foreach $key (keys %$type) {
1602 0 ▶ if (ref($type->{$key}) eq "ARRAY") {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $type->{$key} eq 'ARRAY') { } 0 0 0
1603 0 $vrml .= $self->{'TAB'}." $key [".join('","',@{$type->{$key}})."]\n";
1604 } else {
1605 0 $vrml .= $self->{'TAB'}." $key $type->{$key}\n";
1606 }
1607 }
1608 } else {
1609 0 ▶ $type = join('","',@$type) if ref($type) eq "ARRAY";
Branch: 1 branch
BranchTrueFalseTotal
if ref $type eq "ARRAY" 0 0 0
1610 0 ▶ $vrml .= $self->{'TAB'}." type [\"$type\"]\n" if $type;
Branch: 1 branch
BranchTrueFalseTotal
if $type 0 0 0
1611 0 ▶ $vrml .= $self->{'TAB'}." speed $speed\n" if defined $speed;
Branch: 1 branch
BranchTrueFalseTotal
if defined $speed 0 0 0
1612 0 ▶ $vrml .= $self->{'TAB'}." headlight $headlight\n" if $headlight;
Branch: 1 branch
BranchTrueFalseTotal
if $headlight 0 0 0
1613 0 ▶ $vrml .= $self->{'TAB'}." visibilityLimit $visibilityLimit\n" if defined $visibilityLimit;
Branch: 1 branch
BranchTrueFalseTotal
if defined $visibilityLimit 0 0 0
1614 0 ▶ $avatarSize = join(', ',@$avatarSize) if ref($avatarSize) eq "ARRAY";
Branch: 1 branch
BranchTrueFalseTotal
if ref $avatarSize eq "ARRAY" 0 0 0
1615 0 ▶ $vrml .= $self->{'TAB'}." avatarSize [$avatarSize]\n" if $avatarSize;
Branch: 1 branch
BranchTrueFalseTotal
if $avatarSize 0 0 0
1616 }
1617 0 $vrml .= $self->{'TAB'}."}\n";
1618 0 push @{$self->{'VRML'}}, $vrml;
1619 0 return $self;
1620 }
1621  
1622 =item Viewpoint
1623  
1624 C<Viewpoint($description, $position, $orientation, $fieldOfView, $jump)>
1625  
1626 =cut
1627  
1628 0 ▶sub Viewpoint {
Subroutine Viewpoint: not called CC=6 SCAR=37.4
Pod documented
1629 0 my $self = shift;
1630 0 my ($description, $position, $orientation, $fieldOfView, $jump) = @_;
1631 0 my $vrml = "";
1632 0 $vrml = $self->{'TAB_VIEW'}."Viewpoint {\n";
1633 0 ▶ $vrml .= $self->{'TAB_VIEW'}." description \"".$self->utf8($description)."\"\n" if $description;
Branch: 1 branch
BranchTrueFalseTotal
if $description 0 0 0
1634 0 ▶ $vrml .= $self->{'TAB_VIEW'}." position $position\n" if $position;
Branch: 1 branch
BranchTrueFalseTotal
if $position 0 0 0
1635 0 ▶ $vrml .= $self->{'TAB_VIEW'}." orientation $orientation\n" if $orientation;
Branch: 1 branch
BranchTrueFalseTotal
if $orientation 0 0 0
1636 0 ▶ $vrml .= $self->{'TAB_VIEW'}." fieldOfView $fieldOfView\n" if $fieldOfView;
Branch: 1 branch
BranchTrueFalseTotal
if $fieldOfView 0 0 0
1637 0 ▶ $vrml .= $self->{'TAB_VIEW'}." jump $jump\n" if $jump;
Branch: 1 branch
BranchTrueFalseTotal
if $jump 0 0 0
1638 0 $vrml .= $self->{'TAB_VIEW'}."}\n";
1639 0 push @{$self->{'VRML'}}, $vrml;
1640 0 return $self;
1641 }
1642  
1643 =item PROTO
1644  
1645 C<PROTO($name, $declaration, $definition)>
1646  
1647 =cut
1648  
1649 0 ▶sub PROTO {
Subroutine PROTO: not called CC=5 SCAR=34.0
Pod documented
1650 0 my $self = shift;
1651 0 my ($name, $declaration, $definition) = @_;
1652 0 $self->{'PROTO'}{$name} = $#{$self->{'VRML'}};
1653 0 my $vrml = $self->{'TAB'}."PROTO $name ";
1654 0 $self->{'TAB'} .= "\t";
1655 0 push @{$self->{'VRML'}}, $vrml;
1656 0 $vrml = "";
1657 0 ▶ if (defined $declaration) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $declaration) 0 0 0
1658 0 ▶ if (ref($declaration) eq "ARRAY") {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $declaration eq 'ARRAY') { } 0 0 0
1659 0 $vrml .= "[\n$self->{'TAB'}".join("\n$self->{'TAB'}",@{$declaration})."\n]\n{\n";
1660 } else {
1661 0 $vrml .= "[$declaration]\n{\n";
1662 }
1663 }
1664 0 ▶ if (defined $definition) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $definition) 0 0 0
1665 0 ▶ if (ref($definition) eq "CODE") {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $definition eq 'CODE') { } 0 0 0
1666 0 &$definition;
1667 } else {
1668 0 $vrml .= "$definition\n";
1669 }
1670 }
1671 0 chop($self->{'TAB'});
1672 0 $vrml .= $self->{'TAB'}."}\n";
1673 0 push @{$self->{'VRML'}}, $vrml;
1674 0 return $self;
1675 }
1676  
1677 #--------------------------------------------------------------------
1678  
1679 =back
1680  
1681 =head2 other
1682  
1683 =over 4
1684  
1685 =cut
1686  
1687 #--------------------------------------------------------------------
1688  
1689 =item USE
1690  
1691 C<USE($name)>
1692  
1693 =cut
1694  
1695 0 ▶sub USE {
Subroutine USE: not called CC=1 SCAR=6.9
Pod documented
1696 0 my $self = shift;
1697 0 my ($name) = @_;
1698 0 my $vrml = "";
1699 0 $vrml = $self->{'TAB'}."USE $name\n";
1700 0 push @{$self->{'VRML'}}, $vrml;
1701 0 return $self;
1702 }
1703  
1704 =item DEF
1705  
1706 C<DEF($name)>
1707  
1708 =cut
1709  
1710 0 ▶sub DEF {
Subroutine DEF: not called CC=1 SCAR=6.9
Pod documented
1711 0 my $self = shift;
1712 0 my ($name) = @_;
1713 0 my $vrml = $self->{'TAB'}."DEF $name\n";
1714 0 push @{$self->{'VRML'}}, $vrml;
1715 0 $self->{'DEF'}{$name} = $#{$self->{'VRML'}};
1716 0 return $self;
1717 }
1718  
1719 =item ROUTE
1720  
1721 C<ROUTE($from, $to)>
1722  
1723 =cut
1724  
1725 0 ▶sub ROUTE {
Subroutine ROUTE: not called CC=3 SCAR=24.8
Pod documented
1726 0 my $self = shift;
1727 0 my ($from, $to) = @_;
1728 0 ▶ return $self unless $from && $to;
Branch: 1 branch
BranchTrueFalseTotal
unless $from and $to 0 0 0
Condition0%0/3
$from and $to
!ll&&!rl&&r
000
MC/DC0%0/2
$from and $to
$from $to
Truth table0%0/3
A and B
A= $fromB= $to
ABresult
0X0
100
111
1729 0 my $vrml = $self->{'TAB'}."ROUTE $from TO $to\n";
1730 0 push @{$self->{'VRML'}}, $vrml;
1731 0 return $self;
1732 }
1733  
1734 =item End
1735  
1736 C<End($comment)>
1737  
1738 Close an open node with }
1739  
1740 =cut
1741  
1742 0 ▶sub End {
Subroutine End: not called CC=3 SCAR=24.8
Pod documented
1743 0 my $self = shift;
1744 0 my ($comment) = @_;
1745 0 my $vrml = "";
1746 0 ▶ $comment = $comment && $self->{'DEBUG'} ? " # $comment" : "";
Branch: 1 branch
BranchTrueFalseTotal
$comment && $self->{'DEBUG'} ? : 0 0 0
Condition0%0/3
$comment and $self->{"DEBUG"}
!ll&&!rl&&r
000
MC/DC0%0/2
$comment and $self->{"DEBUG"}
$comment $self->{"DEBUG"}
Truth table0%0/3
A and B
A= $commentB= $self->{"DEBUG"}
ABresult
0X0
100
111
1747 0 $vrml .= $self->{'TAB'}."}$comment\n";
1748 0 push @{$self->{'VRML'}}, $vrml;
1749 0 return $self;
1750 }
1751  
1752 =item EndChildren
1753  
1754 C<EndChildren($comment)>
1755  
1756 Close an open children part with ]
1757  
1758 =cut
1759  
1760 0 ▶sub EndChildren {
Subroutine EndChildren: not called CC=4 SCAR=30.0
Pod documented
1761 0 my $self = shift;
1762 0 my ($comment) = @_;
1763 0 my $vrml = "";
1764 0 ▶ return $self->_put("# ERROR: Too many Ends !\n") unless $self->{'TAB'};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"TAB"} 0 0 0
1765 0 chop($self->{'TAB'});
1766 0 ▶ $comment = $comment && $self->{'DEBUG'} ? " # $comment" : "";
Branch: 1 branch
BranchTrueFalseTotal
$comment && $self->{'DEBUG'} ? : 0 0 0
Condition0%0/3
$comment and $self->{"DEBUG"}
!ll&&!rl&&r
000
MC/DC0%0/2
$comment and $self->{"DEBUG"}
$comment $self->{"DEBUG"}
Truth table0%0/3
A and B
A= $commentB= $self->{"DEBUG"}
ABresult
0X0
100
111
1767 0 $vrml .= $self->{'TAB'}." ]$comment\n";
1768 0 push @{$self->{'VRML'}}, $vrml;
1769 0 return $self;
1770 }
1771  
1772 =item EndTransform
1773  
1774 C<EndTransform($comment)>
1775  
1776 Close an open children part with ] and the node with }
1777  
1778 =cut
1779  
1780 0 ▶sub EndTransform {
Subroutine EndTransform: not called CC=5 SCAR=34.0
Pod documented
1781 0 my $self = shift;
1782 0 my ($comment) = @_;
1783 0 ▶ return $self->_put("# ERROR: Too many Ends !\n") unless $self->{'TAB'};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"TAB"} 0 0 0
1784 0 chop($self->{'TAB'});
1785 0 ▶ $comment = $comment && $self->{'DEBUG'} ? " # $comment" : "";
Branch: 1 branch
BranchTrueFalseTotal
$comment && $self->{'DEBUG'} ? : 0 0 0
Condition0%0/3
$comment and $self->{"DEBUG"}
!ll&&!rl&&r
000
MC/DC0%0/2
$comment and $self->{"DEBUG"}
$comment $self->{"DEBUG"}
Truth table0%0/3
A and B
A= $commentB= $self->{"DEBUG"}
ABresult
0X0
100
111
1786 0 my $vrml = $self->{'TAB'}." ]\n";
1787 0 $vrml .= $self->{'TAB'}."}$comment\n";
1788 0 push @{$self->{'VRML'}}, $vrml;
1789 0 shift @{$self->{'XYZ'}};
1790 0 ▶ $self->_put("# EndTransform ".join(', ',@{$self->{'XYZ'}[0]})."\n") if $self->{'DEBUG'};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"DEBUG"} 0 0 0
1791 0 return $self;
1792 }
1793  
1794 0 ▶sub AUTOLOAD {
Subroutine AUTOLOAD: not called CC=2 SCAR=17.9
1795 0 my $self = shift;
1796 0 $AUTOLOAD =~ s/.*:://g;
1797 0 ▶ unless (exists $self->{'PROTO'}{$AUTOLOAD}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $self->{"PROTO"}{$VRML::VRML2::Standard::AUTOLOAD}) 0 0 0
1798 0 my ($package, $filename, $line) = caller;
1799 0 die qq{Unknown method "$AUTOLOAD" at $filename line $line.\n};
1800 }
1801 0 return $self->_row(qq#$AUTOLOAD { @_ } \n#);
1802 }
1803  
1804 1 1;
1805  
1806 __END__
« VRML/Color.pm ↑ Summary VRML/Base.pm »