| 1 | package VRML::VRML1::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); | ||||||||||||||||||||||||||
|
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::VRML1::Standard.pm - implements the VRML 1.x standard nodes | ||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | use VRML::VRML1::Standard; | ||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | Following nodes are currently implemented. | ||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||
| 41 | [C<Group Nodes>] | ||||||||||||||||||||||||||||
| 42 | [C<Geometry Nodes>] | ||||||||||||||||||||||||||||
| 43 | [C<Property Nodes>] | ||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | [C<Appearance Nodes>] | ||||||||||||||||||||||||||||
| 46 | [C<Transform Nodes>] | ||||||||||||||||||||||||||||
| 47 | [C<Common Nodes>] | ||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | =cut | ||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | 6 | ▶ | sub new { | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 52 | 6 | my $class = shift; | |||||||||||||||||||||||||||
| 53 | 6 | my $self = new VRML::Base; | |||||||||||||||||||||||||||
| 54 | 6 | $self->{'Content-type'} = "x-world/x-vrml"; | |||||||||||||||||||||||||||
| 55 | 6 | $self->{'VRML'} = ["#VRML V1.0 ascii\n"]; | |||||||||||||||||||||||||||
| 56 | 6 | return bless $self, $class; | |||||||||||||||||||||||||||
| 57 | } | ||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||
| 59 | ##################################################################### | ||||||||||||||||||||||||||||
| 60 | # VRML Implementation # | ||||||||||||||||||||||||||||
| 61 | ##################################################################### | ||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | =head2 Group Nodes | ||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||
| 65 | I<These nodes NEED> C<End> ! | ||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||
| 67 | =over 4 | ||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||
| 69 | =item Group | ||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||
| 71 | C<Group()> | ||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||
| 73 | =cut | ||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||
| 75 | 6 | ▶ | sub Group { | ||||||||||||||||||||||||||
|
Subroutine
Group: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 76 | 6 | my $self = shift; | |||||||||||||||||||||||||||
| 77 | 6 | my $vrml = ""; | |||||||||||||||||||||||||||
| 78 | 6 | $vrml = $self->{'TAB'}."Group {\n"; | |||||||||||||||||||||||||||
| 79 | 6 | $self->{'TAB'} .= "\t"; | |||||||||||||||||||||||||||
| 80 | 6 | unshift @{$self->{'XYZ'}}, [@{$self->{'XYZ'}[0]}]; | |||||||||||||||||||||||||||
| 81 | 6 | push @{$self->{'VRML'}}, $vrml; | |||||||||||||||||||||||||||
| 82 | 6 | return $self; | |||||||||||||||||||||||||||
| 83 | } | ||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||
| 85 | =item Separator | ||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||
| 87 | C<Separator()> | ||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||
| 89 | =cut | ||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||
| 91 | 0 | ▶ | sub Separator { | ||||||||||||||||||||||||||
|
Subroutine
Separator: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 92 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 93 | 0 | my $vrml = ""; | |||||||||||||||||||||||||||
| 94 | 0 | $vrml = $self->{'TAB'}."Separator {\n"; | |||||||||||||||||||||||||||
| 95 | 0 | $self->{'TAB'} .= "\t"; | |||||||||||||||||||||||||||
| 96 | 0 | unshift @{$self->{'XYZ'}}, [@{$self->{'XYZ'}[0]}]; | |||||||||||||||||||||||||||
| 97 | 0 | push @{$self->{'VRML'}}, $vrml; | |||||||||||||||||||||||||||
| 98 | 0 | return $self; | |||||||||||||||||||||||||||
| 99 | } | ||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||
| 101 | =item Switch | ||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||
| 103 | C<Switch($whichChild)> | ||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||
| 105 | =cut | ||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||
| 107 | 0 | ▶ | sub Switch { | ||||||||||||||||||||||||||
|
Subroutine
Switch: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 108 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 109 | 0 | my ($whichChild) = @_; | |||||||||||||||||||||||||||
| 110 | 0 | my $vrml = ""; | |||||||||||||||||||||||||||
| 111 | 0 | $vrml = $self->{'TAB'}."Switch {\n"; | |||||||||||||||||||||||||||
| 112 | 0 | ▶ | $vrml .= $self->{'TAB'}." whichChild $whichChild\n" if defined $whichChild; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 113 | 0 | $self->{'TAB'} .= "\t"; | |||||||||||||||||||||||||||
| 114 | 0 | unshift @{$self->{'XYZ'}}, [@{$self->{'XYZ'}[0]}]; | |||||||||||||||||||||||||||
| 115 | 0 | push @{$self->{'VRML'}}, $vrml; | |||||||||||||||||||||||||||
| 116 | 0 | return $self; | |||||||||||||||||||||||||||
| 117 | } | ||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||
| 119 | =item WWWAnchor | ||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||
| 121 | C<WWWAnchor($url, $description, $target)> | ||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||
| 124 | $target works only with I<some> browsers | ||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||
| 126 | =cut | ||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||
| 128 | 0 | ▶ | sub WWWAnchor { | ||||||||||||||||||||||||||
|
Subroutine
WWWAnchor: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 129 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 130 | 0 | my ($url, $description, $target) = @_; | |||||||||||||||||||||||||||
| 131 | 0 | my $vrml = ""; | |||||||||||||||||||||||||||
| 132 | 0 | $vrml = $self->{'TAB'}."WWWAnchor {\n"; | |||||||||||||||||||||||||||
| 133 | 0 | $vrml .= $self->{'TAB'}." name \"".$self->escape($url)."\"\n"; | |||||||||||||||||||||||||||
| 134 | 0 | ▶ | $vrml .= $self->{'TAB'}." description \"".$self->ascii($description)."\"\n" if defined $description; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 135 | 0 | ▶ | $vrml .= $self->{'TAB'}." target \"$target\"\n" if defined $target; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 136 | 0 | $self->{'TAB'} .= "\t"; | |||||||||||||||||||||||||||
| 137 | 0 | unshift @{$self->{'XYZ'}}, [@{$self->{'XYZ'}[0]}]; | |||||||||||||||||||||||||||
| 138 | 0 | push @{$self->{'VRML'}}, $vrml; | |||||||||||||||||||||||||||
| 139 | 0 | return $self; | |||||||||||||||||||||||||||
| 140 | } | ||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||
| 142 | =item LOD | ||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||
| 144 | C<LOD($range, $center)> | ||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||
| 146 | $range = MFFloat | ||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||
| 148 | $center = SFVec3f | ||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||
| 150 | example: C<LOD([1, 2, 5], '0 0 0')> | ||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||
| 152 | =cut | ||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||
| 154 | 0 | ▶ | sub LOD { | ||||||||||||||||||||||||||
|
Subroutine
LOD: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||
| 155 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 156 | 0 | my ($range, $center) = @_; | |||||||||||||||||||||||||||
| 157 | 0 | my $vrml = ""; | |||||||||||||||||||||||||||
| 158 | 0 | $vrml = $self->{'TAB'}."LOD {\n"; | |||||||||||||||||||||||||||
| 159 | 0 | ▶ | if ($range) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 160 | 0 | ▶ | if (ref($range) eq "ARRAY") { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 161 | 0 | $vrml .= $self->{'TAB'}." range [".join(',',@$range)."]\n"; | |||||||||||||||||||||||||||
| 162 | } else { | ||||||||||||||||||||||||||||
| 163 | 0 | $vrml .= $self->{'TAB'}." range [$range]\n"; | |||||||||||||||||||||||||||
| 164 | } | ||||||||||||||||||||||||||||
| 165 | } | ||||||||||||||||||||||||||||
| 166 | 0 | ▶ | $vrml .= $self->{'TAB'}." center $center\n" if $center; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 167 | 0 | $self->{'TAB'} .= "\t"; | |||||||||||||||||||||||||||
| 168 | 0 | unshift @{$self->{'XYZ'}}, [@{$self->{'XYZ'}[0]}]; | |||||||||||||||||||||||||||
| 169 | 0 | push @{$self->{'VRML'}}, $vrml; | |||||||||||||||||||||||||||
| 170 | 0 | return $self; | |||||||||||||||||||||||||||
| 171 | } | ||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||
| 173 | =item SpinGroup | ||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||
| 175 | C<SpinGroup($rotation, $local)> is supported only by I<some> browsers | ||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||
| 177 | =cut | ||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||
| 179 | 0 | ▶ | sub SpinGroup { | ||||||||||||||||||||||||||
|
Subroutine
SpinGroup: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 180 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 181 | 0 | my ($rotation, $local) = @_; | |||||||||||||||||||||||||||
| 182 | 0 | my $vrml = ""; | |||||||||||||||||||||||||||
| 183 | 0 | $vrml = $self->{'TAB'}."SpinGroup {\n"; | |||||||||||||||||||||||||||
| 184 | 0 | $vrml .= $self->{'TAB'}." rotation $rotation\n"; | |||||||||||||||||||||||||||
| 185 | 0 | ▶ | $vrml .= $self->{'TAB'}." local $local\n" if defined $local; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 186 | 0 | $self->{'TAB'} .= "\t"; | |||||||||||||||||||||||||||
| 187 | 0 | unshift @{$self->{'XYZ'}}, [@{$self->{'XYZ'}[0]}]; | |||||||||||||||||||||||||||
| 188 | 0 | push @{$self->{'VRML'}}, $vrml; | |||||||||||||||||||||||||||
| 189 | 0 | return $self; | |||||||||||||||||||||||||||
| 190 | } | ||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||
| 192 | =back | ||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||
| 194 | =head2 Geometry Nodes | ||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||
| 196 | =over 4 | ||||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||
| 198 | =item AsciiText | ||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||
| 200 | C<AsciiText($string, $width, $justification, $spacing)> | ||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||
| 202 | $justification is a string ('LEFT','CENTER','RIGHT') | ||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||
| 204 | =cut | ||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||
| 206 | 1 | ▶ | sub AsciiText { | ||||||||||||||||||||||||||
|
Subroutine
AsciiText: called CC=5 SCAR=16.5
Pod
documented
| |||||||||||||||||||||||||||||
| 207 | 1 | my $self = shift; | |||||||||||||||||||||||||||
| 208 | 1 | my ($string, $width, $justification, $spacing) = @_; | |||||||||||||||||||||||||||
| 209 | 1 | my $vrml = ""; | |||||||||||||||||||||||||||
| 210 | 1 | $vrml = $self->{'TAB'}."AsciiText {\n"; | |||||||||||||||||||||||||||
| 211 | 1 | ▶ | $vrml .= $self->{'TAB'}." string ".$self->ascii($string)."\n" if $string; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 212 | 1 | ▶ | $vrml .= $self->{'TAB'}." width $width\n" if $width; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 213 | 1 | ▶ | $vrml .= $self->{'TAB'}." justification $justification\n" if $justification; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 214 | 1 | ▶ | $vrml .= $self->{'TAB'}." spacing $spacing\n" if $spacing; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 215 | 1 | $vrml .= $self->{'TAB'}."}\n"; | |||||||||||||||||||||||||||
| 216 | 1 | push @{$self->{'VRML'}}, $vrml; | |||||||||||||||||||||||||||
| 217 | 1 | return $self; | |||||||||||||||||||||||||||
| 218 | } | ||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||
| 220 | =item Cone | ||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||
| 222 | C<Cone($radius, $height, @parts)> | ||||||||||||||||||||||||||||
| 223 | |||||||||||||||||||||||||||||
| 224 | @parts is an array of strings ('SIDES', 'BOTTOM', 'ALL') | ||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||
| 226 | =cut | ||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||
| 228 | 1 | ▶ | sub Cone { | ||||||||||||||||||||||||||
|
Subroutine
Cone: called CC=4 SCAR=14.1
Pod
documented
| |||||||||||||||||||||||||||||
| 229 | 1 | my $self = shift; | |||||||||||||||||||||||||||
| 230 | 1 | my ($radius, $height, @parts) = @_; | |||||||||||||||||||||||||||
| 231 | 1 | my $vrml = ""; | |||||||||||||||||||||||||||
| 232 | 1 | $vrml = $self->{'TAB'}."Cone {\n"; | |||||||||||||||||||||||||||
| 233 | 1 | ▶ | $vrml .= $self->{'TAB'}." bottomRadius $radius\n" if $radius; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 234 | 1 | ▶ | $vrml .= $self->{'TAB'}." height $height\n" if $height; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 235 | 1 | ▶ | $vrml .= $self->{'TAB'}." parts (".join("|",@parts).")\n" if @parts; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 236 | 1 | $vrml .= $self->{'TAB'}."}\n"; | |||||||||||||||||||||||||||
| 237 | 1 | push @{$self->{'VRML'}}, $vrml; | |||||||||||||||||||||||||||
| 238 | 1 | return $self; | |||||||||||||||||||||||||||
| 239 | } | ||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||
| 241 | =item Cube | ||||||||||||||||||||||||||||
| 242 | |||||||||||||||||||||||||||||
| 243 | C<Cube($width, $height, $depth)> | ||||||||||||||||||||||||||||
| 244 | |||||||||||||||||||||||||||||
| 245 | =cut | ||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||
| 247 | 2 | ▶ | sub Cube { | ||||||||||||||||||||||||||
|
Subroutine
Cube: called CC=4 SCAR=14.1
Pod
documented
| |||||||||||||||||||||||||||||
| 248 | 2 | my $self = shift; | |||||||||||||||||||||||||||
| 249 | 2 | my ($width, $height, $depth) = @_; | |||||||||||||||||||||||||||
| 250 | 2 | my $vrml = ""; | |||||||||||||||||||||||||||
| 251 | 2 | $vrml = $self->{'TAB'}."Cube {\n"; | |||||||||||||||||||||||||||
| 252 | 2 | ▶ | $vrml .= $self->{'TAB'}." width $width\n" if $width; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 253 | 2 | ▶ | $vrml .= $self->{'TAB'}." height $height\n" if $height; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 254 | 2 | ▶ | $vrml .= $self->{'TAB'}." depth $depth\n" if $depth; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 255 | 2 | $vrml .= $self->{'TAB'}."}\n"; | |||||||||||||||||||||||||||
| 256 | 2 | push @{$self->{'VRML'}}, $vrml; | |||||||||||||||||||||||||||
| 257 | 2 | return $self; | |||||||||||||||||||||||||||
| 258 | } | ||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||
| 260 | =item Cylinder | ||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||
| 262 | C<Cylinder($radius, $height, @parts)> | ||||||||||||||||||||||||||||
| 263 | |||||||||||||||||||||||||||||
| 264 | @parts is a list of strings ('SIDES', 'TOP', 'BOTTOM', 'ALL') | ||||||||||||||||||||||||||||
| 265 | |||||||||||||||||||||||||||||
| 266 | =cut | ||||||||||||||||||||||||||||
| 267 | |||||||||||||||||||||||||||||
| 268 | 1 | ▶ | sub Cylinder { | ||||||||||||||||||||||||||
|
Subroutine
Cylinder: called CC=4 SCAR=14.1
Pod
documented
| |||||||||||||||||||||||||||||
| 269 | 1 | my $self = shift; | |||||||||||||||||||||||||||
| 270 | 1 | my ($radius, $height, @parts) = @_; # parts = SIDES|TOP|BOTTOM|ALL | |||||||||||||||||||||||||||
| 271 | 1 | my $vrml = ""; | |||||||||||||||||||||||||||
| 272 | 1 | $vrml = $self->{'TAB'}."Cylinder {\n"; | |||||||||||||||||||||||||||
| 273 | 1 | ▶ | $vrml .= $self->{'TAB'}." radius $radius\n" if defined $radius; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 274 | 1 | ▶ | $vrml .= $self->{'TAB'}." height $height\n" if defined $height; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 275 | 1 | ▶ | $vrml .= $self->{'TAB'}." parts (".join("|",@parts).")\n" if @parts; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 276 | 1 | $vrml .= $self->{'TAB'}."}\n"; | |||||||||||||||||||||||||||
| 277 | 1 | push @{$self->{'VRML'}}, $vrml; | |||||||||||||||||||||||||||
| 278 | 1 | return $self; | |||||||||||||||||||||||||||
| 279 | } | ||||||||||||||||||||||||||||
| 280 | |||||||||||||||||||||||||||||
| 281 | =item IndexedFaceSet | ||||||||||||||||||||||||||||
| 282 | |||||||||||||||||||||||||||||
| 283 | C<IndexedFaceSet($coordIndex_ref, $materialIndex_ref, $normalIndex_ref, $textureCoordIndex_ref)> | ||||||||||||||||||||||||||||
| 284 | |||||||||||||||||||||||||||||
| 285 | $coordIndex_ref is a reference of a list of point index strings | ||||||||||||||||||||||||||||
| 286 | like C<['0 1 3 2', '2 3 5 4', ...]> | ||||||||||||||||||||||||||||
| 287 | |||||||||||||||||||||||||||||
| 288 | $materialIndex_ref is a reference of a list of materials | ||||||||||||||||||||||||||||
| 289 | |||||||||||||||||||||||||||||
| 290 | $normalIndex_ref is a reference of a list of normals | ||||||||||||||||||||||||||||
| 291 | |||||||||||||||||||||||||||||
| 292 | $textureCoordIndex_ref is a reference of a list of textures | ||||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||
| 294 | =cut | ||||||||||||||||||||||||||||
| 295 | |||||||||||||||||||||||||||||
| 296 | 0 | ▶ | sub IndexedFaceSet { | ||||||||||||||||||||||||||
|
Subroutine
IndexedFaceSet: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||
| 297 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 298 | 0 | my ($coordIndex_ref, $materialIndex_ref, $normalIndex_ref, $textureCoordIndex_ref) = @_; | |||||||||||||||||||||||||||
| 299 | 0 | my $vrml = ""; | |||||||||||||||||||||||||||
| 300 | 0 | $vrml = $self->{'TAB'}."IndexedFaceSet {\n"; | |||||||||||||||||||||||||||
| 301 | 0 | ▶ | if ($coordIndex_ref) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 302 | 0 | $vrml .= $self->{'TAB'}." coordIndex [\n"; | |||||||||||||||||||||||||||
| 303 | 0 | $vrml .= $self->{'TAB'}."\t\t"; | |||||||||||||||||||||||||||
| 304 | 0 | $vrml .= join(", -1,\n$self->{'TAB'}\t\t",@$coordIndex_ref); | |||||||||||||||||||||||||||
| 305 | 0 | $vrml .= ", -1\n".$self->{'TAB'}." ]\n"; | |||||||||||||||||||||||||||
| 306 | } | ||||||||||||||||||||||||||||
| 307 | 0 | ▶ | if ($materialIndex_ref) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 308 | 0 | $vrml .= $self->{'TAB'}." materialIndex [\n"; | |||||||||||||||||||||||||||
| 309 | 0 | $vrml .= $self->{'TAB'}."\t\t"; | |||||||||||||||||||||||||||
| 310 | 0 | $vrml .= join(",\n$self->{'TAB'}\t\t",@$materialIndex_ref); | |||||||||||||||||||||||||||
| 311 | 0 | $vrml .= "\n".$self->{'TAB'}." ]\n"; | |||||||||||||||||||||||||||
| 312 | } | ||||||||||||||||||||||||||||
| 313 | 0 | ▶ | if ($normalIndex_ref) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 314 | 0 | $vrml .= $self->{'TAB'}." normalIndex [\n"; | |||||||||||||||||||||||||||
| 315 | 0 | $vrml .= $self->{'TAB'}."\t\t"; | |||||||||||||||||||||||||||
| 316 | 0 | $vrml .= join(", -1,\n$self->{'TAB'}\t\t",@$normalIndex_ref); | |||||||||||||||||||||||||||
| 317 | 0 | $vrml .= ", -1\n".$self->{'TAB'}." ]\n"; | |||||||||||||||||||||||||||
| 318 | } | ||||||||||||||||||||||||||||
| 319 | 0 | ▶ | if ($textureCoordIndex_ref) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 320 | 0 | $vrml .= $self->{'TAB'}." textureCoordIndex [\n"; | |||||||||||||||||||||||||||
| 321 | 0 | $vrml .= $self->{'TAB'}."\t\t"; | |||||||||||||||||||||||||||
| 322 | 0 | $vrml .= join(", -1,\n$self->{'TAB'}\t\t",@$textureCoordIndex_ref); | |||||||||||||||||||||||||||
| 323 | 0 | $vrml .= ", -1\n".$self->{'TAB'}." ]\n"; | |||||||||||||||||||||||||||
| 324 | } | ||||||||||||||||||||||||||||
| 325 | 0 | $vrml .= $self->{'TAB'}."}\n"; | |||||||||||||||||||||||||||
| 326 | 0 | push @{$self->{'VRML'}}, $vrml; | |||||||||||||||||||||||||||
| 327 | 0 | return $self; | |||||||||||||||||||||||||||
| 328 | } | ||||||||||||||||||||||||||||
| 329 | |||||||||||||||||||||||||||||
| 330 | =item IndexedLineSet | ||||||||||||||||||||||||||||
| 331 | |||||||||||||||||||||||||||||
| 332 | C<IndexedLineSet($coordIndex_ref, $materialIndex_ref, $normalIndex_ref, $textureCoordIndex_ref)> | ||||||||||||||||||||||||||||
| 333 | |||||||||||||||||||||||||||||
| 334 | $coordIndex_ref is a reference of a list of point index strings | ||||||||||||||||||||||||||||
| 335 | like C<['0 1 3 2', '2 3 5 4', ...]> | ||||||||||||||||||||||||||||
| 336 | |||||||||||||||||||||||||||||
| 337 | $materialIndex_ref is a reference of a list of materials | ||||||||||||||||||||||||||||
| 338 | |||||||||||||||||||||||||||||
| 339 | $normalIndex_ref is a reference of a list of normals | ||||||||||||||||||||||||||||
| 340 | |||||||||||||||||||||||||||||
| 341 | $textureCoordIndex_ref is a reference of a list of textures | ||||||||||||||||||||||||||||
| 342 | |||||||||||||||||||||||||||||
| 343 | =cut | ||||||||||||||||||||||||||||
| 344 | |||||||||||||||||||||||||||||
| 345 | 0 | ▶ | sub IndexedLineSet { | ||||||||||||||||||||||||||
|
Subroutine
IndexedLineSet: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||
| 346 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 347 | 0 | my ($coordIndex_ref, $materialIndex_ref, $normalIndex_ref, $textureCoordIndex_ref) = @_; | |||||||||||||||||||||||||||
| 348 | 0 | my $vrml = ""; | |||||||||||||||||||||||||||
| 349 | 0 | $vrml = $self->{'TAB'}."IndexedLineSet {\n"; | |||||||||||||||||||||||||||
| 350 | 0 | ▶ | if ($coordIndex_ref) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 351 | 0 | $vrml .= $self->{'TAB'}." coordIndex [\n"; | |||||||||||||||||||||||||||
| 352 | 0 | $vrml .= $self->{'TAB'}."\t\t"; | |||||||||||||||||||||||||||
| 353 | 0 | $vrml .= join(", -1,\n$self->{'TAB'}\t\t",@$coordIndex_ref); | |||||||||||||||||||||||||||
| 354 | 0 | $vrml .= ", -1\n".$self->{'TAB'}." ]\n"; | |||||||||||||||||||||||||||
| 355 | } | ||||||||||||||||||||||||||||
| 356 | 0 | ▶ | if ($materialIndex_ref) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 357 | 0 | $vrml .= $self->{'TAB'}." materialIndex [\n"; | |||||||||||||||||||||||||||
| 358 | 0 | $vrml .= $self->{'TAB'}."\t\t"; | |||||||||||||||||||||||||||
| 359 | 0 | $vrml .= join(", -1,\n$self->{'TAB'}\t\t",@$materialIndex_ref); | |||||||||||||||||||||||||||
| 360 | 0 | $vrml .= "\n".$self->{'TAB'}." ]\n"; | |||||||||||||||||||||||||||
| 361 | } | ||||||||||||||||||||||||||||
| 362 | 0 | ▶ | if ($normalIndex_ref) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 363 | 0 | $vrml .= $self->{'TAB'}." normalIndex [\n"; | |||||||||||||||||||||||||||
| 364 | 0 | $vrml .= $self->{'TAB'}."\t\t"; | |||||||||||||||||||||||||||
| 365 | 0 | $vrml .= join(", -1,\n$self->{'TAB'}\t\t",@$normalIndex_ref); | |||||||||||||||||||||||||||
| 366 | 0 | $vrml .= ", -1\n".$self->{'TAB'}." ]\n"; | |||||||||||||||||||||||||||
| 367 | } | ||||||||||||||||||||||||||||
| 368 | 0 | ▶ | if ($textureCoordIndex_ref) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 369 | 0 | $vrml .= $self->{'TAB'}." textureCoordIndex [\n"; | |||||||||||||||||||||||||||
| 370 | 0 | $vrml .= $self->{'TAB'}."\t\t"; | |||||||||||||||||||||||||||
| 371 | 0 | $vrml .= join(", -1,\n$self->{'TAB'}\t\t",@$textureCoordIndex_ref); | |||||||||||||||||||||||||||
| 372 | 0 | $vrml .= ", -1\n".$self->{'TAB'}." ]\n"; | |||||||||||||||||||||||||||
| 373 | } | ||||||||||||||||||||||||||||
| 374 | 0 | $vrml .= $self->{'TAB'}."}\n"; | |||||||||||||||||||||||||||
| 375 | 0 | push @{$self->{'VRML'}}, $vrml; | |||||||||||||||||||||||||||
| 376 | 0 | return $self; | |||||||||||||||||||||||||||
| 377 | } | ||||||||||||||||||||||||||||
| 378 | |||||||||||||||||||||||||||||
| 379 | =item PointSet | ||||||||||||||||||||||||||||
| 380 | |||||||||||||||||||||||||||||
| 381 | C<PointSet($numPoints, $startIndex)> | ||||||||||||||||||||||||||||
| 382 | |||||||||||||||||||||||||||||
| 383 | =cut | ||||||||||||||||||||||||||||
| 384 | |||||||||||||||||||||||||||||
| 385 | 0 | ▶ | sub PointSet { | ||||||||||||||||||||||||||
|
Subroutine
PointSet: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||
| 386 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 387 | 0 | my ($numPoints, $startIndex) = @_; | |||||||||||||||||||||||||||
| 388 | 0 | ▶ | $startIndex = 0 unless defined $startIndex; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 389 | 0 | my $vrml = ""; | |||||||||||||||||||||||||||
| 390 | 0 | $vrml = $self->{'TAB'}."PointSet {\n"; | |||||||||||||||||||||||||||
| 391 | 0 | ▶ | $vrml .= $self->{'TAB'}." startIndex $startIndex\n" if $startIndex; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 392 | 0 | ▶ | $vrml .= $self->{'TAB'}." numPoints $numPoints\n" if $numPoints; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 393 | 0 | $vrml .= $self->{'TAB'}."}\n"; | |||||||||||||||||||||||||||
| 394 | 0 | push @{$self->{'VRML'}}, $vrml; | |||||||||||||||||||||||||||
| 395 | 0 | return $self; | |||||||||||||||||||||||||||
| 396 | } | ||||||||||||||||||||||||||||
| 397 | |||||||||||||||||||||||||||||
| 398 | =item Sphere | ||||||||||||||||||||||||||||
| 399 | |||||||||||||||||||||||||||||
| 400 | C<Sphere($radius)> | ||||||||||||||||||||||||||||
| 401 | |||||||||||||||||||||||||||||
| 402 | $radius must be > 0 | ||||||||||||||||||||||||||||
| 403 | |||||||||||||||||||||||||||||
| 404 | =cut | ||||||||||||||||||||||||||||
| 405 | |||||||||||||||||||||||||||||
| 406 | 1 | ▶ | sub Sphere { | ||||||||||||||||||||||||||
|
Subroutine
Sphere: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 407 | 1 | my $self = shift; | |||||||||||||||||||||||||||
| 408 | 1 | my ($radius) = @_; | |||||||||||||||||||||||||||
| 409 | 1 | my $vrml = ""; | |||||||||||||||||||||||||||
| 410 | 1 | $vrml = $self->{'TAB'}."Sphere {\n"; | |||||||||||||||||||||||||||
| 411 | 1 | ▶ | $vrml .= $self->{'TAB'}." radius $radius\n" if $radius; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 412 | 1 | $vrml .= $self->{'TAB'}."}\n"; | |||||||||||||||||||||||||||
| 413 | 1 | push @{$self->{'VRML'}}, $vrml; | |||||||||||||||||||||||||||
| 414 | 1 | return $self; | |||||||||||||||||||||||||||
| 415 | } | ||||||||||||||||||||||||||||
| 416 | |||||||||||||||||||||||||||||
| 417 | #-------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 418 | |||||||||||||||||||||||||||||
| 419 | =back | ||||||||||||||||||||||||||||
| 420 | |||||||||||||||||||||||||||||
| 421 | =head2 Property Nodes | ||||||||||||||||||||||||||||
| 422 | |||||||||||||||||||||||||||||
| 423 | =over 4 | ||||||||||||||||||||||||||||
| 424 | |||||||||||||||||||||||||||||
| 425 | =cut | ||||||||||||||||||||||||||||
| 426 | |||||||||||||||||||||||||||||
| 427 | #-------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 428 | |||||||||||||||||||||||||||||
| 429 | =item Coordinate3 | ||||||||||||||||||||||||||||
| 430 | |||||||||||||||||||||||||||||
| 431 | C<Coordinate3(@points)> | ||||||||||||||||||||||||||||
| 432 | |||||||||||||||||||||||||||||
| 433 | @points is a list of points with strings like C<'1.0 0.0 0.0', '-1 2 0'> | ||||||||||||||||||||||||||||
| 434 | |||||||||||||||||||||||||||||
| 435 | =cut | ||||||||||||||||||||||||||||
| 436 | |||||||||||||||||||||||||||||
| 437 | 0 | ▶ | sub Coordinate3 { | ||||||||||||||||||||||||||
|
Subroutine
Coordinate3: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 438 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 439 | 0 | my (@points) = @_; | |||||||||||||||||||||||||||
| 440 | 0 | my $vrml = ""; | |||||||||||||||||||||||||||
| 441 | 0 | $vrml = $self->{'TAB'}."Coordinate3 {\n"; | |||||||||||||||||||||||||||
| 442 | 0 | $vrml .= $self->{'TAB'}." point [\n"; | |||||||||||||||||||||||||||
| 443 | 0 | $vrml .= $self->{'TAB'}."\t\t"; | |||||||||||||||||||||||||||
| 444 | 0 | $vrml .= join(",\n$self->{'TAB'}\t\t",@points); | |||||||||||||||||||||||||||
| 445 | 0 | $vrml .= "\n".$self->{'TAB'}." ]\n"; | |||||||||||||||||||||||||||
| 446 | 0 | $vrml .= $self->{'TAB'}."}\n"; | |||||||||||||||||||||||||||
| 447 | 0 | push @{$self->{'VRML'}}, $vrml; | |||||||||||||||||||||||||||
| 448 | 0 | return $self; | |||||||||||||||||||||||||||
| 449 | } | ||||||||||||||||||||||||||||
| 450 | |||||||||||||||||||||||||||||
| 451 | =item Fontstyle | ||||||||||||||||||||||||||||
| 452 | |||||||||||||||||||||||||||||
| 453 | C<FontStyle($size, $family, $style)> | ||||||||||||||||||||||||||||
| 454 | defines the current font style for all subsequent C<AsciiText> Nodes | ||||||||||||||||||||||||||||
| 455 | |||||||||||||||||||||||||||||
| 456 | $familiy can be 'SERIF','SANS','TYPEWRITER' | ||||||||||||||||||||||||||||
| 457 | |||||||||||||||||||||||||||||
| 458 | $style can be 'NONE','BOLD','ITALIC' | ||||||||||||||||||||||||||||
| 459 | |||||||||||||||||||||||||||||
| 460 | =cut | ||||||||||||||||||||||||||||
| 461 | |||||||||||||||||||||||||||||
| 462 | 1 | ▶ | sub FontStyle { | ||||||||||||||||||||||||||
|
Subroutine
FontStyle: called CC=4 SCAR=14.1
Pod
undocumented
| |||||||||||||||||||||||||||||
| 463 | 1 | my $self = shift; | |||||||||||||||||||||||||||
| 464 | 1 | my ($size, $family, $style) = @_; | |||||||||||||||||||||||||||
| 465 | 1 | my $vrml = ""; | |||||||||||||||||||||||||||
| 466 | 1 | $vrml = $self->{'TAB'}."FontStyle {\n"; | |||||||||||||||||||||||||||
| 467 | 1 | ▶ | $vrml .= $self->{'TAB'}." size $size\n" if $size; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 468 | 1 | ▶ | $vrml .= $self->{'TAB'}." family $family\n" if $family; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 469 | 1 | ▶ | $vrml .= $self->{'TAB'}." style $style\n" if $style; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 470 | 1 | $vrml .= $self->{'TAB'}."}\n"; | |||||||||||||||||||||||||||
| 471 | 1 | push @{$self->{'VRML'}}, $vrml; | |||||||||||||||||||||||||||
| 472 | 1 | return $self; | |||||||||||||||||||||||||||
| 473 | } | ||||||||||||||||||||||||||||
| 474 | |||||||||||||||||||||||||||||
| 475 | #-------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 476 | |||||||||||||||||||||||||||||
| 477 | =back | ||||||||||||||||||||||||||||
| 478 | |||||||||||||||||||||||||||||
| 479 | =head2 Appearance Nodes | ||||||||||||||||||||||||||||
| 480 | |||||||||||||||||||||||||||||
| 481 | =over 4 | ||||||||||||||||||||||||||||
| 482 | |||||||||||||||||||||||||||||
| 483 | =cut | ||||||||||||||||||||||||||||
| 484 | |||||||||||||||||||||||||||||
| 485 | #-------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 486 | |||||||||||||||||||||||||||||
| 487 | =item Material | ||||||||||||||||||||||||||||
| 488 | |||||||||||||||||||||||||||||
| 489 | C<Material(%materials)> | ||||||||||||||||||||||||||||
| 490 | |||||||||||||||||||||||||||||
| 491 | =cut | ||||||||||||||||||||||||||||
| 492 | |||||||||||||||||||||||||||||
| 493 | 6 | ▶ | sub Material { | ||||||||||||||||||||||||||
|
Subroutine
Material: called CC=6 SCAR=23.9
Pod
documented
| |||||||||||||||||||||||||||||
| 494 | 6 | my $self = shift; | |||||||||||||||||||||||||||
| 495 | 6 | my (%materials) = @_; | |||||||||||||||||||||||||||
| 496 | 6 | my $vrml = ""; | |||||||||||||||||||||||||||
| 497 | 6 | my ($key, $value, $i, $l); | |||||||||||||||||||||||||||
| 498 | 6 | my $c = ","; | |||||||||||||||||||||||||||
| 499 | 6 | $vrml = $self->{'TAB'}."Material {\n"; | |||||||||||||||||||||||||||
| 500 | 6 | ▶ | while(($key,$value) = each %materials) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 501 | 6 | $vrml .= $self->{'TAB'}." $key"; | |||||||||||||||||||||||||||
| 502 | 6 | ▶ | if (ref($value)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 503 | 0 | $l = $#{$value}; | |||||||||||||||||||||||||||
| 504 | 0 | $vrml .= " ["; | |||||||||||||||||||||||||||
| 505 | 0 | ▶ | for ($i=0; $i<=$l; $i++) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 506 | 0 | ▶ | if ($i == $l) { $c = ""; } | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 507 | 0 | $vrml .= "\n$self->{'TAB'}\t\t"; | |||||||||||||||||||||||||||
| 508 | 0 | ▶ | if (ref($value->[$i])) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 509 | 0 | $vrml .= "$value->[$i][0]$c # $value->[$i][1]"; | |||||||||||||||||||||||||||
| 510 | } else { | ||||||||||||||||||||||||||||
| 511 | 0 | $vrml .= "$value->[$i]$c"; | |||||||||||||||||||||||||||
| 512 | } | ||||||||||||||||||||||||||||
| 513 | } | ||||||||||||||||||||||||||||
| 514 | 0 | $vrml .= "\n".$self->{'TAB'}."\t]\n"; | |||||||||||||||||||||||||||
| 515 | } else { | ||||||||||||||||||||||||||||
| 516 | 6 | $vrml .= " $value\n"; | |||||||||||||||||||||||||||
| 517 | } | ||||||||||||||||||||||||||||
| 518 | } | ||||||||||||||||||||||||||||
| 519 | 6 | $vrml .= $self->{'TAB'}."}\n"; | |||||||||||||||||||||||||||
| 520 | 6 | push @{$self->{'VRML'}}, $vrml; | |||||||||||||||||||||||||||
| 521 | 6 | return $self; | |||||||||||||||||||||||||||
| 522 | } | ||||||||||||||||||||||||||||
| 523 | |||||||||||||||||||||||||||||
| 524 | =item MaterialBinding | ||||||||||||||||||||||||||||
| 525 | |||||||||||||||||||||||||||||
| 526 | C<MaterialBinding($value)> | ||||||||||||||||||||||||||||
| 527 | |||||||||||||||||||||||||||||
| 528 | |||||||||||||||||||||||||||||
| 529 | $value can be | ||||||||||||||||||||||||||||
| 530 | |||||||||||||||||||||||||||||
| 531 | DEFAULT Use default bindng | ||||||||||||||||||||||||||||
| 532 | OVERALL Whole object has same material | ||||||||||||||||||||||||||||
| 533 | PER_PART One material for each part of object | ||||||||||||||||||||||||||||
| 534 | PER_PART_INDEXED One material for each part, indexed | ||||||||||||||||||||||||||||
| 535 | PER_FACE One material for each face of object | ||||||||||||||||||||||||||||
| 536 | PER_FACE_INDEXED One material for each face, indexed | ||||||||||||||||||||||||||||
| 537 | PER_VERTEX One material for each vertex of object | ||||||||||||||||||||||||||||
| 538 | PER_VERTEX_INDEXED One material for each vertex, indexed | ||||||||||||||||||||||||||||
| 539 | |||||||||||||||||||||||||||||
| 540 | =cut | ||||||||||||||||||||||||||||
| 541 | |||||||||||||||||||||||||||||
| 542 | 0 | ▶ | sub MaterialBinding { | ||||||||||||||||||||||||||
|
Subroutine
MaterialBinding: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 543 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 544 | 0 | my $vrml = ""; | |||||||||||||||||||||||||||
| 545 | 0 | $vrml = $self->{'TAB'}."MaterialBinding {\n"; | |||||||||||||||||||||||||||
| 546 | 0 | $vrml .= $self->{'TAB'}." value @_\n"; | |||||||||||||||||||||||||||
| 547 | 0 | $vrml .= $self->{'TAB'}."}\n"; | |||||||||||||||||||||||||||
| 548 | 0 | push @{$self->{'VRML'}}, $vrml; | |||||||||||||||||||||||||||
| 549 | 0 | return $self; | |||||||||||||||||||||||||||
| 550 | } | ||||||||||||||||||||||||||||
| 551 | |||||||||||||||||||||||||||||
| 552 | =item Normal | ||||||||||||||||||||||||||||
| 553 | |||||||||||||||||||||||||||||
| 554 | C<Normal(@vector)> | ||||||||||||||||||||||||||||
| 555 | |||||||||||||||||||||||||||||
| 556 | @vector is a list of vectors with strings like C<'1.0 0.0 0.0', '.5 .2 0'> | ||||||||||||||||||||||||||||
| 557 | |||||||||||||||||||||||||||||
| 558 | =cut | ||||||||||||||||||||||||||||
| 559 | |||||||||||||||||||||||||||||
| 560 | 0 | ▶ | sub Normal { | ||||||||||||||||||||||||||
|
Subroutine
Normal: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 561 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 562 | 0 | my (@vector) = @_; | |||||||||||||||||||||||||||
| 563 | 0 | my $vrml = ""; | |||||||||||||||||||||||||||
| 564 | 0 | $vrml = $self->{'TAB'}."Normal {\n"; | |||||||||||||||||||||||||||
| 565 | 0 | $vrml .= $self->{'TAB'}."\tvector [\n$self->{'TAB'}\t\t"; | |||||||||||||||||||||||||||
| 566 | 0 | $vrml .= join(",\n$self->{'TAB'}\t\t",@vector); | |||||||||||||||||||||||||||
| 567 | 0 | $vrml .= "\n".$self->{'TAB'}."\t]\n"; | |||||||||||||||||||||||||||
| 568 | 0 | $vrml .= $self->{'TAB'}."}\n"; | |||||||||||||||||||||||||||
| 569 | 0 | push @{$self->{'VRML'}}, $vrml; | |||||||||||||||||||||||||||
| 570 | 0 | return $self; | |||||||||||||||||||||||||||
| 571 | } | ||||||||||||||||||||||||||||
| 572 | |||||||||||||||||||||||||||||
| 573 | =item NormalBinding | ||||||||||||||||||||||||||||
| 574 | |||||||||||||||||||||||||||||
| 575 | C<NormalBinding($value)> | ||||||||||||||||||||||||||||
| 576 | |||||||||||||||||||||||||||||
| 577 | $value is the same as C<MaterialBinding> | ||||||||||||||||||||||||||||
| 578 | |||||||||||||||||||||||||||||
| 579 | =cut | ||||||||||||||||||||||||||||
| 580 | |||||||||||||||||||||||||||||
| 581 | 0 | ▶ | sub NormalBinding { | ||||||||||||||||||||||||||
|
Subroutine
NormalBinding: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 582 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 583 | 0 | my $vrml = ""; | |||||||||||||||||||||||||||
| 584 | 0 | $vrml = $self->{'TAB'}."NormalBinding {\n"; | |||||||||||||||||||||||||||
| 585 | 0 | $vrml .= $self->{'TAB'}." value @_\n"; | |||||||||||||||||||||||||||
| 586 | 0 | $vrml .= $self->{'TAB'}."}\n"; | |||||||||||||||||||||||||||
| 587 | 0 | push @{$self->{'VRML'}}, $vrml; | |||||||||||||||||||||||||||
| 588 | 0 | return $self; | |||||||||||||||||||||||||||
| 589 | } | ||||||||||||||||||||||||||||
| 590 | |||||||||||||||||||||||||||||
| 591 | =item Texture2 | ||||||||||||||||||||||||||||
| 592 | |||||||||||||||||||||||||||||
| 593 | C<Texture2($value)> | ||||||||||||||||||||||||||||
| 594 | |||||||||||||||||||||||||||||
| 595 | =cut | ||||||||||||||||||||||||||||
| 596 | |||||||||||||||||||||||||||||
| 597 | 0 | ▶ | sub Texture2 { | ||||||||||||||||||||||||||
|
Subroutine
Texture2: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 598 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 599 | 0 | my ($filename, $wrapS, $wrapT) = @_; | |||||||||||||||||||||||||||
| 600 | 0 | my $vrml = ""; | |||||||||||||||||||||||||||
| 601 | 0 | $vrml = $self->{'TAB'}."Texture2 {\n"; | |||||||||||||||||||||||||||
| 602 | 0 | $vrml .= $self->{'TAB'}." filename \"".$self->escape($filename)."\"\n"; | |||||||||||||||||||||||||||
| 603 | 0 | ▶ | $vrml .= $self->{'TAB'}." wrapS CLAMP\n" if $wrapS; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 604 | 0 | ▶ | $vrml .= $self->{'TAB'}." wrapT CLAMP\n" if $wrapT; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 605 | 0 | $vrml .= $self->{'TAB'}."}\n"; | |||||||||||||||||||||||||||
| 606 | 0 | push @{$self->{'VRML'}}, $vrml; | |||||||||||||||||||||||||||
| 607 | 0 | return $self; | |||||||||||||||||||||||||||
| 608 | } | ||||||||||||||||||||||||||||
| 609 | |||||||||||||||||||||||||||||
| 610 | #-------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 611 | |||||||||||||||||||||||||||||
| 612 | =back | ||||||||||||||||||||||||||||
| 613 | |||||||||||||||||||||||||||||
| 614 | =head2 Transform Nodes | ||||||||||||||||||||||||||||
| 615 | |||||||||||||||||||||||||||||
| 616 | =over 4 | ||||||||||||||||||||||||||||
| 617 | |||||||||||||||||||||||||||||
| 618 | =cut | ||||||||||||||||||||||||||||
| 619 | |||||||||||||||||||||||||||||
| 620 | #-------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 621 | |||||||||||||||||||||||||||||
| 622 | =item Transform | ||||||||||||||||||||||||||||
| 623 | |||||||||||||||||||||||||||||
| 624 | C<Transform($translation, $rotation, $scaleFactor, $scaleOrientation, $center)> | ||||||||||||||||||||||||||||
| 625 | |||||||||||||||||||||||||||||
| 626 | $translation is a string like "0 1 -2" | ||||||||||||||||||||||||||||
| 627 | |||||||||||||||||||||||||||||
| 628 | $rotation is a string like "0 0 1 1.57" | ||||||||||||||||||||||||||||
| 629 | |||||||||||||||||||||||||||||
| 630 | $scaleFactor is a string like "1 1 1" | ||||||||||||||||||||||||||||
| 631 | |||||||||||||||||||||||||||||
| 632 | $scaleOrientation is a string like "0 0 1 0" | ||||||||||||||||||||||||||||
| 633 | |||||||||||||||||||||||||||||
| 634 | $center is a string like "0 0 0" | ||||||||||||||||||||||||||||
| 635 | |||||||||||||||||||||||||||||
| 636 | =cut | ||||||||||||||||||||||||||||
| 637 | |||||||||||||||||||||||||||||
| 638 | 0 | ▶ | sub Transform { | ||||||||||||||||||||||||||
|
Subroutine
Transform: not called CC=8 SCAR=42.8
Pod
documented
| |||||||||||||||||||||||||||||
| 639 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 640 | 0 | my ($translation, $rotation, $scaleFactor, $scaleOrientation, $center) = @_; | |||||||||||||||||||||||||||
| 641 | 0 | ▶ | unless (@_) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 642 | 0 | return $self; | |||||||||||||||||||||||||||
| 643 | 0 | return ""; | |||||||||||||||||||||||||||
| 644 | } | ||||||||||||||||||||||||||||
| 645 | 0 | ▶ | $self->xyz($self->string_to_array($translation)) if defined $translation; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 646 | 0 | my $vrml = ""; | |||||||||||||||||||||||||||
| 647 | 0 | $vrml = $self->{'TAB'}."Transform {\n"; | |||||||||||||||||||||||||||
| 648 | 0 | ▶ | $vrml .= $self->{'TAB'}." translation $translation\n" if $translation; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 649 | 0 | ▶ | $vrml .= $self->{'TAB'}." rotation $rotation\n" if $rotation; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 650 | 0 | ▶ | $vrml .= $self->{'TAB'}." scaleFactor $scaleFactor\n" if $scaleFactor; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 651 | 0 | ▶ | $vrml .= $self->{'TAB'}." scaleOrientation $scaleOrientation\n" if $scaleOrientation; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 652 | 0 | ▶ | $vrml .= $self->{'TAB'}." center $center\n" if $center; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 653 | 0 | $vrml .= $self->{'TAB'}."}\n"; | |||||||||||||||||||||||||||
| 654 | 0 | push @{$self->{'VRML'}}, $vrml; | |||||||||||||||||||||||||||
| 655 | 0 | return $self; | |||||||||||||||||||||||||||
| 656 | } | ||||||||||||||||||||||||||||
| 657 | |||||||||||||||||||||||||||||
| 658 | =item Rotation | ||||||||||||||||||||||||||||
| 659 | |||||||||||||||||||||||||||||
| 660 | C<Rotation($rotation)> | ||||||||||||||||||||||||||||
| 661 | |||||||||||||||||||||||||||||
| 662 | $rotation is a string like "0 0 1 1.57" | ||||||||||||||||||||||||||||
| 663 | |||||||||||||||||||||||||||||
| 664 | C<This node is not supported under VRML 2.0. Use Transform> | ||||||||||||||||||||||||||||
| 665 | |||||||||||||||||||||||||||||
| 666 | =cut | ||||||||||||||||||||||||||||
| 667 | |||||||||||||||||||||||||||||
| 668 | 0 | ▶ | sub Rotation { | ||||||||||||||||||||||||||
|
Subroutine
Rotation: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 669 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 670 | 0 | my $vrml = ""; | |||||||||||||||||||||||||||
| 671 | 0 | $vrml = $self->{'TAB'}."Rotation {\n"; | |||||||||||||||||||||||||||
| 672 | 0 | $vrml .= $self->{'TAB'}." rotation @_\n"; | |||||||||||||||||||||||||||
| 673 | 0 | $vrml .= $self->{'TAB'}."}\n"; | |||||||||||||||||||||||||||
| 674 | 0 | push @{$self->{'VRML'}}, $vrml; | |||||||||||||||||||||||||||
| 675 | 0 | return $self; | |||||||||||||||||||||||||||
| 676 | } | ||||||||||||||||||||||||||||
| 677 | |||||||||||||||||||||||||||||
| 678 | =item Scale | ||||||||||||||||||||||||||||
| 679 | |||||||||||||||||||||||||||||
| 680 | C<Scale($scaleFactor)> | ||||||||||||||||||||||||||||
| 681 | |||||||||||||||||||||||||||||
| 682 | $scaleFactor is a string like "1 1 1" | ||||||||||||||||||||||||||||
| 683 | |||||||||||||||||||||||||||||
| 684 | C<This node is not supported under VRML 2.0. Use Transform> | ||||||||||||||||||||||||||||
| 685 | |||||||||||||||||||||||||||||
| 686 | =cut | ||||||||||||||||||||||||||||
| 687 | |||||||||||||||||||||||||||||
| 688 | 0 | ▶ | sub Scale { | ||||||||||||||||||||||||||
|
Subroutine
Scale: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 689 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 690 | 0 | my $vrml = ""; | |||||||||||||||||||||||||||
| 691 | 0 | $vrml = $self->{'TAB'}."Scale {\n"; | |||||||||||||||||||||||||||
| 692 | 0 | $vrml .= $self->{'TAB'}." scaleFactor @_\n"; | |||||||||||||||||||||||||||
| 693 | 0 | $vrml .= $self->{'TAB'}."}\n"; | |||||||||||||||||||||||||||
| 694 | 0 | push @{$self->{'VRML'}}, $vrml; | |||||||||||||||||||||||||||
| 695 | 0 | return $self; | |||||||||||||||||||||||||||
| 696 | } | ||||||||||||||||||||||||||||
| 697 | |||||||||||||||||||||||||||||
| 698 | =item Translation | ||||||||||||||||||||||||||||
| 699 | |||||||||||||||||||||||||||||
| 700 | C<Translation($translation)> | ||||||||||||||||||||||||||||
| 701 | |||||||||||||||||||||||||||||
| 702 | $translation is a string like "0 1 -2" | ||||||||||||||||||||||||||||
| 703 | |||||||||||||||||||||||||||||
| 704 | C<This node is not supported under VRML 2.0. Use Transform> | ||||||||||||||||||||||||||||
| 705 | |||||||||||||||||||||||||||||
| 706 | =cut | ||||||||||||||||||||||||||||
| 707 | |||||||||||||||||||||||||||||
| 708 | 0 | ▶ | sub Translation { | ||||||||||||||||||||||||||
|
Subroutine
Translation: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 709 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 710 | 0 | my ($translation) = @_; | |||||||||||||||||||||||||||
| 711 | 0 | ▶ | $self->xyz($self->string_to_array($translation)) if defined $translation; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 712 | 0 | my $vrml = ""; | |||||||||||||||||||||||||||
| 713 | 0 | $vrml = $self->{'TAB'}."Translation {\n"; | |||||||||||||||||||||||||||
| 714 | 0 | $vrml .= $self->{'TAB'}." translation $translation\n"; | |||||||||||||||||||||||||||
| 715 | 0 | $vrml .= $self->{'TAB'}."}\n"; | |||||||||||||||||||||||||||
| 716 | 0 | push @{$self->{'VRML'}}, $vrml; | |||||||||||||||||||||||||||
| 717 | 0 | return $self; | |||||||||||||||||||||||||||
| 718 | } | ||||||||||||||||||||||||||||
| 719 | |||||||||||||||||||||||||||||
| 720 | #-------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 721 | |||||||||||||||||||||||||||||
| 722 | =back | ||||||||||||||||||||||||||||
| 723 | |||||||||||||||||||||||||||||
| 724 | =head2 Common Nodes | ||||||||||||||||||||||||||||
| 725 | |||||||||||||||||||||||||||||
| 726 | =over 4 | ||||||||||||||||||||||||||||
| 727 | |||||||||||||||||||||||||||||
| 728 | =cut | ||||||||||||||||||||||||||||
| 729 | |||||||||||||||||||||||||||||
| 730 | #-------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 731 | |||||||||||||||||||||||||||||
| 732 | =item PerspectiveCamera | ||||||||||||||||||||||||||||
| 733 | |||||||||||||||||||||||||||||
| 734 | C<PerspectiveCamera($position, $orientation, $heightAngle, $focalDistance, $nearDistance, $farDistance)> | ||||||||||||||||||||||||||||
| 735 | |||||||||||||||||||||||||||||
| 736 | =cut | ||||||||||||||||||||||||||||
| 737 | |||||||||||||||||||||||||||||
| 738 | 0 | ▶ | sub PerspectiveCamera { | ||||||||||||||||||||||||||
|
Subroutine
PerspectiveCamera: not called CC=7 SCAR=40.3
Pod
documented
| |||||||||||||||||||||||||||||
| 739 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 740 | 0 | my ($position, $orientation, $heightAngle, | |||||||||||||||||||||||||||
| 741 | $focalDistance, $nearDistance, $farDistance) = @_; | ||||||||||||||||||||||||||||
| 742 | 0 | my $vrml = ""; | |||||||||||||||||||||||||||
| 743 | 0 | $vrml = $self->{'TAB_VIEW'}."PerspectiveCamera {\n"; | |||||||||||||||||||||||||||
| 744 | 0 | ▶ | $vrml .= $self->{'TAB_VIEW'}." position $position\n" if $position; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 745 | 0 | ▶ | $vrml .= $self->{'TAB_VIEW'}." orientation $orientation\n" if $orientation; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 746 | 0 | ▶ | $vrml .= $self->{'TAB_VIEW'}." heightAngle $heightAngle\n" if $heightAngle; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 747 | 0 | ▶ | $vrml .= $self->{'TAB_VIEW'}." focalDistance $focalDistance\n" if $focalDistance; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 748 | 0 | ▶ | $vrml .= $self->{'TAB_VIEW'}." nearDistance $nearDistance\n" if $nearDistance; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 749 | 0 | ▶ | $vrml .= $self->{'TAB_VIEW'}." farDistance $farDistance\n" if $farDistance; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 750 | 0 | $vrml .= $self->{'TAB_VIEW'}."}\n"; | |||||||||||||||||||||||||||
| 751 | 0 | push @{$self->{'VRML'}}, $vrml; | |||||||||||||||||||||||||||
| 752 | 0 | return $self; | |||||||||||||||||||||||||||
| 753 | } | ||||||||||||||||||||||||||||
| 754 | |||||||||||||||||||||||||||||
| 755 | =item OrthographicCamera | ||||||||||||||||||||||||||||
| 756 | |||||||||||||||||||||||||||||
| 757 | C<OrthographicCamera($position, $orientation, $height, $focalDistance, $nearDistance, $farDistance)> | ||||||||||||||||||||||||||||
| 758 | |||||||||||||||||||||||||||||
| 759 | =cut | ||||||||||||||||||||||||||||
| 760 | |||||||||||||||||||||||||||||
| 761 | 0 | ▶ | sub OrthographicCamera { | ||||||||||||||||||||||||||
|
Subroutine
OrthographicCamera: not called CC=7 SCAR=40.3
Pod
documented
| |||||||||||||||||||||||||||||
| 762 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 763 | 0 | my ($position, $orientation, $height, | |||||||||||||||||||||||||||
| 764 | $focalDistance, $nearDistance, $farDistance) = @_; | ||||||||||||||||||||||||||||
| 765 | 0 | my $vrml = ""; | |||||||||||||||||||||||||||
| 766 | 0 | $vrml = $self->{'TAB_VIEW'}."OrthographicCamera {\n"; | |||||||||||||||||||||||||||
| 767 | 0 | ▶ | $vrml .= $self->{'TAB_VIEW'}." position $position\n" if $position; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 768 | 0 | ▶ | $vrml .= $self->{'TAB_VIEW'}." orientation $orientation\n" if $orientation; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 769 | 0 | ▶ | $vrml .= $self->{'TAB_VIEW'}." height $height\n" if $height; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 770 | 0 | ▶ | $vrml .= $self->{'TAB_VIEW'}." focalDistance $focalDistance\n" if $focalDistance; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 771 | 0 | ▶ | $vrml .= $self->{'TAB_VIEW'}." nearDistance $nearDistance\n" if $nearDistance; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 772 | 0 | ▶ | $vrml .= $self->{'TAB_VIEW'}." farDistance $farDistance\n" if $farDistance; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 773 | 0 | $vrml .= $self->{'TAB_VIEW'}."}\n"; | |||||||||||||||||||||||||||
| 774 | 0 | push @{$self->{'VRML'}}, $vrml; | |||||||||||||||||||||||||||
| 775 | 0 | return $self; | |||||||||||||||||||||||||||
| 776 | } | ||||||||||||||||||||||||||||
| 777 | |||||||||||||||||||||||||||||
| 778 | =item DirectionalLight | ||||||||||||||||||||||||||||
| 779 | |||||||||||||||||||||||||||||
| 780 | C<DirectionalLight($direction, $intensity, $color, $on)> | ||||||||||||||||||||||||||||
| 781 | |||||||||||||||||||||||||||||
| 782 | =cut | ||||||||||||||||||||||||||||
| 783 | |||||||||||||||||||||||||||||
| 784 | 0 | ▶ | sub DirectionalLight { | ||||||||||||||||||||||||||
|
Subroutine
DirectionalLight: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||
| 785 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 786 | 0 | my ($direction, $intensity, $color, $on) = @_; | |||||||||||||||||||||||||||
| 787 | 0 | my $vrml = ""; | |||||||||||||||||||||||||||
| 788 | 0 | $vrml = $self->{'TAB'}."DirectionalLight {\n"; | |||||||||||||||||||||||||||
| 789 | 0 | ▶ | $vrml .= $self->{'TAB'}." direction $direction\n" if $direction; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 790 | 0 | ▶ | $vrml .= $self->{'TAB'}." intensity $intensity\n" if $intensity; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 791 | 0 | ▶ | $vrml .= $self->{'TAB'}." color $color\n" if $color; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 792 | 0 | ▶ | $vrml .= $self->{'TAB'}." on $on\n" if $on; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 793 | 0 | $vrml .= $self->{'TAB'}."}\n"; | |||||||||||||||||||||||||||
| 794 | 0 | push @{$self->{'VRML'}}, $vrml; | |||||||||||||||||||||||||||
| 795 | 0 | return $self; | |||||||||||||||||||||||||||
| 796 | } | ||||||||||||||||||||||||||||
| 797 | |||||||||||||||||||||||||||||
| 798 | =item PointLight | ||||||||||||||||||||||||||||
| 799 | |||||||||||||||||||||||||||||
| 800 | C<PointLight($location, $intensity, $color, $on)> | ||||||||||||||||||||||||||||
| 801 | |||||||||||||||||||||||||||||
| 802 | =cut | ||||||||||||||||||||||||||||
| 803 | |||||||||||||||||||||||||||||
| 804 | 0 | ▶ | sub PointLight { | ||||||||||||||||||||||||||
|
Subroutine
PointLight: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||
| 805 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 806 | 0 | my ($location, $intensity, $color, $on) = @_; | |||||||||||||||||||||||||||
| 807 | 0 | my $vrml = ""; | |||||||||||||||||||||||||||
| 808 | 0 | $vrml = $self->{'TAB'}."PointLight {\n"; | |||||||||||||||||||||||||||
| 809 | 0 | ▶ | $vrml .= $self->{'TAB'}." location $location\n" if $location; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 810 | 0 | ▶ | $vrml .= $self->{'TAB'}." intensity $intensity\n" if $intensity; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 811 | 0 | ▶ | $vrml .= $self->{'TAB'}." color $color\n" if $color; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 812 | 0 | ▶ | $vrml .= $self->{'TAB'}." on $on\n" if $on; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 813 | 0 | $vrml .= $self->{'TAB'}."}\n"; | |||||||||||||||||||||||||||
| 814 | 0 | push @{$self->{'VRML'}}, $vrml; | |||||||||||||||||||||||||||
| 815 | 0 | return $self; | |||||||||||||||||||||||||||
| 816 | } | ||||||||||||||||||||||||||||
| 817 | |||||||||||||||||||||||||||||
| 818 | =item SpotLight | ||||||||||||||||||||||||||||
| 819 | |||||||||||||||||||||||||||||
| 820 | C<SpotLight($location, $direction, $intensity, $color, $on)> | ||||||||||||||||||||||||||||
| 821 | |||||||||||||||||||||||||||||
| 822 | =cut | ||||||||||||||||||||||||||||
| 823 | |||||||||||||||||||||||||||||
| 824 | 0 | ▶ | sub SpotLight { | ||||||||||||||||||||||||||
|
Subroutine
SpotLight: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||||||||||||||||||||
| 825 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 826 | 0 | my ($location, $direction, $intensity, $color, $on) = @_; | |||||||||||||||||||||||||||
| 827 | 0 | my $vrml = ""; | |||||||||||||||||||||||||||
| 828 | 0 | $vrml = $self->{'TAB'}."SpotLight {\n"; | |||||||||||||||||||||||||||
| 829 | 0 | ▶ | $vrml .= $self->{'TAB'}." location $location\n" if $location; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 830 | 0 | ▶ | $vrml .= $self->{'TAB'}." direction $direction\n" if $direction; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 831 | 0 | ▶ | $vrml .= $self->{'TAB'}." intensity $intensity\n" if $intensity; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 832 | 0 | ▶ | $vrml .= $self->{'TAB'}." color $color\n" if $color; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 833 | 0 | ▶ | $vrml .= $self->{'TAB'}." on $on\n" if $on; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 834 | 0 | $vrml .= $self->{'TAB'}."}\n"; | |||||||||||||||||||||||||||
| 835 | 0 | push @{$self->{'VRML'}}, $vrml; | |||||||||||||||||||||||||||
| 836 | 0 | return $self; | |||||||||||||||||||||||||||
| 837 | } | ||||||||||||||||||||||||||||
| 838 | |||||||||||||||||||||||||||||
| 839 | =item DirectedSound | ||||||||||||||||||||||||||||
| 840 | |||||||||||||||||||||||||||||
| 841 | C<DirectedSound($name, $description, $location, $direction, $intensity, $maxFrontRange, $maxBackRange, $minFrontRange, $minBackRange, $loop, $pause)> | ||||||||||||||||||||||||||||
| 842 | |||||||||||||||||||||||||||||
| 843 | =cut | ||||||||||||||||||||||||||||
| 844 | |||||||||||||||||||||||||||||
| 845 | 0 | ▶ | sub DirectedSound { | ||||||||||||||||||||||||||
|
Subroutine
DirectedSound: not called CC=11 SCAR=48.8
Pod
documented
| |||||||||||||||||||||||||||||
| 846 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 847 | 0 | my ($name, $description, $location, $direction, $intensity, $maxFrontRange, $maxBackRange, $minFrontRange, $minBackRange, $loop, $pause) = @_; | |||||||||||||||||||||||||||
| 848 | 0 | my $vrml = $self->{'TAB'}."DirectedSound {\n"; | |||||||||||||||||||||||||||
| 849 | 0 | $vrml .= $self->{'TAB'}." name \"".$self->escape($name)."\"\n"; | |||||||||||||||||||||||||||
| 850 | 0 | ▶ | $vrml .= $self->{'TAB'}." description \"".$self->ascii($description)."\"\n" if defined $description; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 851 | 0 | ▶ | $vrml .= $self->{'TAB'}." location $location\n" if $location; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 852 | 0 | ▶ | $vrml .= $self->{'TAB'}." direction $direction\n" if $direction; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 853 | 0 | ▶ | $vrml .= $self->{'TAB'}." intensity $intensity\n" if $intensity; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 854 | 0 | ▶ | $vrml .= $self->{'TAB'}." maxFrontRange $maxFrontRange\n" if $maxFrontRange; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 855 | 0 | ▶ | $vrml .= $self->{'TAB'}." maxBackRange $maxBackRange\n" if $maxBackRange; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 856 | 0 | ▶ | $vrml .= $self->{'TAB'}." minFrontRange $minFrontRange\n" if $minFrontRange; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 857 | 0 | ▶ | $vrml .= $self->{'TAB'}." minBackRange $minBackRange\n" if $minBackRange; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 858 | 0 | ▶ | $vrml .= $self->{'TAB'}." loop $loop\n" if defined $loop; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 859 | 0 | ▶ | $vrml .= $self->{'TAB'}." pause $pause\n" if $pause; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 860 | 0 | $vrml .= $self->{'TAB'}."}\n"; | |||||||||||||||||||||||||||
| 861 | 0 | push @{$self->{'VRML'}}, $vrml; | |||||||||||||||||||||||||||
| 862 | 0 | return $self; | |||||||||||||||||||||||||||
| 863 | } | ||||||||||||||||||||||||||||
| 864 | |||||||||||||||||||||||||||||
| 865 | #-------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 866 | |||||||||||||||||||||||||||||
| 867 | =back | ||||||||||||||||||||||||||||
| 868 | |||||||||||||||||||||||||||||
| 869 | =head2 other | ||||||||||||||||||||||||||||
| 870 | |||||||||||||||||||||||||||||
| 871 | =over 4 | ||||||||||||||||||||||||||||
| 872 | |||||||||||||||||||||||||||||
| 873 | =item WWWInline | ||||||||||||||||||||||||||||
| 874 | |||||||||||||||||||||||||||||
| 875 | C<WWWInline($name, $bboxSize, $bboxCenter)> | ||||||||||||||||||||||||||||
| 876 | |||||||||||||||||||||||||||||
| 877 | =cut | ||||||||||||||||||||||||||||
| 878 | |||||||||||||||||||||||||||||
| 879 | 0 | ▶ | sub WWWInline { | ||||||||||||||||||||||||||
|
Subroutine
WWWInline: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 880 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 881 | 0 | my $vrml = ""; | |||||||||||||||||||||||||||
| 882 | 0 | my ($name, $bboxSize, $bboxCenter) = @_; | |||||||||||||||||||||||||||
| 883 | 0 | $vrml = $self->{'TAB'}."WWWInline {\n"; | |||||||||||||||||||||||||||
| 884 | 0 | $vrml .= $self->{'TAB'}." name \"".$self->escape($name)."\"\n"; | |||||||||||||||||||||||||||
| 885 | 0 | ▶ | $vrml .= $self->{'TAB'}." bboxSize $bboxSize\n" if $bboxSize; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 886 | 0 | ▶ | $vrml .= $self->{'TAB'}." bboxCenter $bboxCenter\n" if $bboxCenter; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 887 | 0 | $vrml .= $self->{'TAB'}."}\n"; | |||||||||||||||||||||||||||
| 888 | 0 | push @{$self->{'VRML'}}, $vrml; | |||||||||||||||||||||||||||
| 889 | 0 | return $self; | |||||||||||||||||||||||||||
| 890 | } | ||||||||||||||||||||||||||||
| 891 | |||||||||||||||||||||||||||||
| 892 | =item Info | ||||||||||||||||||||||||||||
| 893 | |||||||||||||||||||||||||||||
| 894 | C<Info($string)> | ||||||||||||||||||||||||||||
| 895 | |||||||||||||||||||||||||||||
| 896 | =cut | ||||||||||||||||||||||||||||
| 897 | |||||||||||||||||||||||||||||
| 898 | 0 | ▶ | sub Info { | ||||||||||||||||||||||||||
|
Subroutine
Info: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 899 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 900 | 0 | my ($string) = @_; | |||||||||||||||||||||||||||
| 901 | 0 | my $vrml = ""; | |||||||||||||||||||||||||||
| 902 | 0 | $vrml = $self->{'TAB'}."Info {\n"; | |||||||||||||||||||||||||||
| 903 | 0 | $vrml .= $self->{'TAB'}." string \"".$self->ascii($string)."\"\n"; | |||||||||||||||||||||||||||
| 904 | 0 | $vrml .= $self->{'TAB'}."}\n"; | |||||||||||||||||||||||||||
| 905 | 0 | push @{$self->{'VRML'}}, $vrml; | |||||||||||||||||||||||||||
| 906 | 0 | return $self; | |||||||||||||||||||||||||||
| 907 | } | ||||||||||||||||||||||||||||
| 908 | |||||||||||||||||||||||||||||
| 909 | =item NavigationInfo | ||||||||||||||||||||||||||||
| 910 | |||||||||||||||||||||||||||||
| 911 | C<NavigationInfo($type, $speed, $headlight)> | ||||||||||||||||||||||||||||
| 912 | |||||||||||||||||||||||||||||
| 913 | Works only with Live3D and WebFX | ||||||||||||||||||||||||||||
| 914 | |||||||||||||||||||||||||||||
| 915 | =cut | ||||||||||||||||||||||||||||
| 916 | |||||||||||||||||||||||||||||
| 917 | 0 | ▶ | sub NavigationInfo { | ||||||||||||||||||||||||||
|
Subroutine
NavigationInfo: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||||||||||||||||||||
| 918 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 919 | 0 | my ($type, $speed, $headlight) = @_; | |||||||||||||||||||||||||||
| 920 | 0 | my $key; | |||||||||||||||||||||||||||
| 921 | 0 | my $vrml = ""; | |||||||||||||||||||||||||||
| 922 | 0 | $vrml = $self->{'TAB'}."NavigationInfo {\n"; | |||||||||||||||||||||||||||
| 923 | 0 | ▶ | if (ref($type) eq "HASH") { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 924 | 0 | foreach $key (keys %$type) { | |||||||||||||||||||||||||||
| 925 | 0 | $vrml .= $self->{'TAB'}." $key \"$type->{$key}\"\n"; | |||||||||||||||||||||||||||
| 926 | } | ||||||||||||||||||||||||||||
| 927 | } else { | ||||||||||||||||||||||||||||
| 928 | 0 | ▶ | $vrml .= $self->{'TAB'}." type \"$type\"\n" if defined $type; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 929 | 0 | ▶ | $vrml .= $self->{'TAB'}." speed $speed\n" if defined $speed; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 930 | 0 | ▶ | $vrml .= $self->{'TAB'}." headlight $type\n" if $type; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 931 | 0 | $vrml .= $self->{'TAB'}."}\n"; | |||||||||||||||||||||||||||
| 932 | } | ||||||||||||||||||||||||||||
| 933 | 0 | push @{$self->{'VRML'}}, $vrml; | |||||||||||||||||||||||||||
| 934 | 0 | return $self; | |||||||||||||||||||||||||||
| 935 | } | ||||||||||||||||||||||||||||
| 936 | |||||||||||||||||||||||||||||
| 937 | 6 | ▶ | sub End { | ||||||||||||||||||||||||||
|
Subroutine
End: called CC=4 SCAR=14.3
Pod
undocumented
| |||||||||||||||||||||||||||||
| 938 | 6 | my $self = shift; | |||||||||||||||||||||||||||
| 939 | 6 | my ($comment) = @_; | |||||||||||||||||||||||||||
| 940 | 6 | ▶ | return $self->_put("# ERROR: TAB < 0 !\n") unless $self->{'TAB'}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 941 | 6 | chop($self->{'TAB'}); | |||||||||||||||||||||||||||
| 942 | 6 | ▶ | $comment = $comment && $self->{'DEBUG'} ? " # $comment" : ""; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$comment and $self->{"DEBUG"}
MC/DC0%0/2
$comment and $self->{"DEBUG"}
$comment
$self->{"DEBUG"}
Truth table33%1/3
A and B
A= $commentB= $self->{"DEBUG"}
| |||||||||||||||||||||||||||||
| 943 | 6 | my $vrml = $self->{'TAB'}."}$comment\n"; | |||||||||||||||||||||||||||
| 944 | 6 | push @{$self->{'VRML'}}, $vrml; | |||||||||||||||||||||||||||
| 945 | 6 | shift @{$self->{'XYZ'}}; | |||||||||||||||||||||||||||
| 946 | 6 | return $self; | |||||||||||||||||||||||||||
| 947 | } | ||||||||||||||||||||||||||||
| 948 | |||||||||||||||||||||||||||||
| 949 | =item USE | ||||||||||||||||||||||||||||
| 950 | |||||||||||||||||||||||||||||
| 951 | C<USE($name)> | ||||||||||||||||||||||||||||
| 952 | |||||||||||||||||||||||||||||
| 953 | =cut | ||||||||||||||||||||||||||||
| 954 | |||||||||||||||||||||||||||||
| 955 | 0 | ▶ | sub USE { | ||||||||||||||||||||||||||
|
Subroutine
USE: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 956 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 957 | 0 | my ($name) = @_; | |||||||||||||||||||||||||||
| 958 | 0 | my $vrml = ""; | |||||||||||||||||||||||||||
| 959 | 0 | $vrml = $self->{'TAB'}."USE $name\n"; | |||||||||||||||||||||||||||
| 960 | 0 | push @{$self->{'VRML'}}, $vrml; | |||||||||||||||||||||||||||
| 961 | 0 | return $self; | |||||||||||||||||||||||||||
| 962 | } | ||||||||||||||||||||||||||||
| 963 | |||||||||||||||||||||||||||||
| 964 | =item DEF | ||||||||||||||||||||||||||||
| 965 | |||||||||||||||||||||||||||||
| 966 | C<DEF($name)> | ||||||||||||||||||||||||||||
| 967 | |||||||||||||||||||||||||||||
| 968 | =cut | ||||||||||||||||||||||||||||
| 969 | |||||||||||||||||||||||||||||
| 970 | 0 | ▶ | sub DEF { | ||||||||||||||||||||||||||
|
Subroutine
DEF: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 971 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 972 | 0 | my ($name) = @_; | |||||||||||||||||||||||||||
| 973 | 0 | my $vrml = $self->{'TAB'}."DEF $name\n"; | |||||||||||||||||||||||||||
| 974 | 0 | push @{$self->{'VRML'}}, $vrml; | |||||||||||||||||||||||||||
| 975 | 0 | $self->{'DEF'}{$name} = $#{$self->{'VRML'}}; | |||||||||||||||||||||||||||
| 976 | 0 | return $self; | |||||||||||||||||||||||||||
| 977 | } | ||||||||||||||||||||||||||||
| 978 | |||||||||||||||||||||||||||||
| 979 | 1 | 1; | |||||||||||||||||||||||||||
| 980 | |||||||||||||||||||||||||||||
| 981 | __END__ | ||||||||||||||||||||||||||||