use VRML;
$vrml = new VRML(2); $vrml->browser('Cosmo Player 2.0','Netscape'); $vrml->at('-15 0 20'); $vrml->box('5 3 1','yellow'); $vrml->back; $vrml->print; $vrml->save;
OR with the same result
use VRML;
VRML->new(2) ->browser('Cosmo Player 2.0','Netscape') ->at('-15 0 20')->box('5 3 1','yellow')->back ->print->save;
Contains for example $in{VRML} '1' or '2' (e.g. via CGI), then only the following line at the start of the Perl script must be inserted.
new VRML($in{'VRML'})
new
, print
or save
are in the module VRML::Base described.
If a method does the same like its VRML pedant then it has the same name but in lowercase (e.g. box). The open part of a group method ends with a _begin (e.g. anchor_begin). The closing part ends with an _end (e.g. anchor_end). For a detailed description how the generated node works, take a look at the VRML 2.0 specification on VAG.
Following methods are currently implemented. (Values in '...' must be strings!)
Before you use an geometry or transform method please call this method. It's necessary to calculate something at the end.
Example:
new VRML ->begin ->at('0 0.1 -0.3') ->sphere(1,'red') ->back ->end ->print;
After end there should no geometry or transformation. This method completes the calculations of viewpoints etc.
Example:
$vrml ->at('0 2 0') ->sphere(0.5,'red') ->back
url MFString [] description SFString "" parameter MFString [] bboxSize SFVec3f undef bboxCenter SFVec3f '0 0 0'
Example:
$vrml ->anchor_begin('http://www.gfz-potsdam.de/~palm/vrmlperl/', 'VRML-Perl Moduls', 'target=_blank') ->sphere(1,'blue') ->anchor_end;
axisOfRotation SFVec3f '0 1 0' bboxSize SFVec3f undef bboxCenter SFVec3f '0 0 0'
collide SFBool 1 proxy SFNode NULL bboxSize SFVec3f undef bboxCenter SFVec3f '0 0 0'
Example:
$vrml ->collision_begin(1, sub{$vrml->box('5 1 0.01')}) ->text('collide','yellow',1,'MIDDLE') ->collision_end
$vrml ->group_begin ->sphere(1,'red') ->group_end
range MFFloat [] center SFVec3f '0 0 0'
Example:
$vrml ->lod_begin('30') ->text('gut lesbar') ->group_begin->group_end # leere Gruppe ->lod_end
whichChoice SFInt32 -1
transform_begin('type=value','type=value',
...)
Where type can be:
t = translation r = rotation c = center s = scale so = scaleOrientation bbs = bboxSize bbc = bboxCenter
Example:
$vrml ->transform_begin('t=0 1 0','r=180') ->cone('0.5 2','red') ->transform_end
url MFString [] bboxSize SFVec3f undef bboxCenter SFVec3f '0 0 0'
frontUrl MFString [] leftUrl MFString [] rightUrl MFString [] backUrl MFString [] bottomUrl MFString [] topUrl MFString [] skyColor MFColor ['0 0 0'] skyAngle MFFloat [] groundColor MFColor [] groundAngle MFFloat []
This is a parameter hash. Only use the parts you need.
Example:
$vrml->background(skyColor => 'lightblue', frontUrl => 'http://www.yourdomain.de/bg/berge.gif');
skyColor SFColor '0 0 0' groundColor SFColor '0 0 0'
is the short version of background. It specifies only colors.
Example:
$vrml->backgroundcolor('lightblue');
url SFString ""
is the short version of background. It needs only one image. The given Url will assigned to all parts of the background cube.
Example:
$vrml->backgroundimage('http://www.yourdomain.de/bg/sterne.gif');
string SFString ""
Example:
$vrml->title('Meine virtuelle Welt');
string MFString []
Example:
$vrml->info('letzte Änderung: 8.05.1997');
title SFString "" info MFString []
type MFEnum ['WALK', 'ANY'] # ANY, WALK, FLY, EXAMINE, NONE speed SFFloat 1.0 headlight SFBool 1 visibilityLimit SFFloat 0.0 avatarSize MFFloat [0.25, 1.6, 0.75]
Example:
$vrml->navigationinfo('WALK', 1.5, 0, 1000);
description SFString "" position SFVec3f 0 0 10 orientation SFRotation/SFEnum 0 0 1 0 # FRONT, LEFT, BACK, RIGHT, TOP, BOTTOM fieldOfView SFFloat 45 # Grad jump SFBool 1
Example:
$vrml->viewpoint('Start','0 0 0','0 0 -1 0',60);
is the same like
$vrml->viewpoint('Start',undef,'FRONT',60);
center SFVec3f '0 0 0' distance SFFloat 10 fieldOfView SFFloat 45 # Grad avatarSize MFFloat [0.25, 1.6, 0.75]
places six viewpoints around the center.
size SFVec3f '2 2 2' # width height depth appearance SFString "" # see Appearance
bottomRadius height SFVec2f '1 2' appearance SFString "" # see Appearance
radius height SFVec2f '1 2' appearance SFString "" # see Appearance
from SFVec3f "" to SFVec3f "" radius SFFloat 0 # 0 = haarline appearance SFString "" path SFEnum "" # XYZ, XZY, YXZ, YZX, ZXY, ZYX
draws a line (cylinder) between two points with a given radius. If radius is '0' only a hairline will be printed. The last parameter specifies the devolution along the axes. An empty stands for direct connection.
Example:
new VRML(2) ->begin ->line('1 -1 1', '-3 2 2', 0.03, 'red', 'XZY') ->line('1 -1 1', '-3 2 2', 0.03, 'white') ->end ->print;
size SFVec3f '2 2 2' # width height depth appearance SFString "" # see Appearance
Example:
$vrml->pyramid('1 1 1','blue,green,red,yellow,white');
radius SFFloat 1 appearance SFString "" # see Appearance
height MFFloat [] color MFColor [] # resp. material and color xDimension SFInt32 0 zDimension SFInt32 0 xSpacing SFFloat 1.0 zSpacing SFFloat 1.0 creaseAngle SFFloat 0 colorPerVertex SFBool 1 solid SFBool 0
If color is not a reference of an ARRAY it would be assumed that color is the appearance.
Example:
open(FILE,"<height.txt"); my @height = <FILE>; open(COL,"<color.txt"); my @color = <COL>; $vrml->navigationinfo(["EXAMINE","FLY"],200) ->viewpoint("Top","1900 6000 1900","TOP") ->elevationgrid(\@height, \@color, undef, undef, 250, undef, 0) ->print;
string MFString [] appearance SFString "" # see Appearance font SFString '1 SERIF PLAIN' align SFEnum 'BEGIN' # BEGIN, MIDDLE, END
string MFString [] appearance SFString "" # see Appearance font SFString '1 SERIF PLAIN' align SFEnum 'BEGIN' # BEGIN, MIDDLE, END
does the same like method text, but the text better readable.
The appearance method specifies the visual properties of geometry by defining the material and texture. If more than one type is needed separate the types by semicolon. The types can choosen from the following list.
Note: one character mnemonic are colors two characters mnemonic are values in range of [0..1] more characters are strings like file names or labels
d = diffuseColor e = emissiveColor s = specularColor ai = ambientIntensity sh = shininess tr = transparency tex = texture filename,wrapS,wrapT name = names the MovieTexture node (for a later route)
The color values can be strings (X11 color names) or RGB-triples. It is possible to reduce the intensity of colors (names) by appending a two digit value (percent). This value must be separated by an underscore (_) or a percent symbol (%). Note: Do not use a percent symbol in URL's. It would be decoded in an ascii character.
Sample (valid color values): '1 1 0' # VRML standard 'FFFF00' or 'ffff00', '255 255 0', 'yellow'
or reduced to 50% '.5 .5 .5' # VRML standard '808080', '128 128 0', 'yellow%50' or 'yellow_50'
For a list of X11 color names take a look at VRML::Color
direction SFVec3f '0 0 -1' intensity SFFloat 1 ambientIntensity SFFloat 1 color SFColor '1 1 1' #weiß on SFBool 1
Example:
$vrml->directionallight("0 0 -1", 0.3);
url MFString [] description SFString "" location SFVec3f '0 0 0' direction SFVec3f '0 0 1' intensity SFFloat 1.0 loop SFBool 0 pitch SFFloat 1.0
name SFString ""
Example:
$vrml->def('RedSphere')->sphere(1,'red')
name SFString ""
Example:
$vrml->use('RedSphere')
FROM.feldname SFString "" TO.feldname SFString ""
name SFString "" type SFEnum "" # Color, Coordinate, Normal, Orientation, # Position und Scalar keys MFFloat [] # [0,1] keyValues MF... [] # Type of Interpolator
name SFString "" maxAngle SFFloat undef minAngle SFFloat 0 diskAngle SFFloat 15 offset SFFloat 0 autoOffset SFBool 1 enabled SFBool 1
name SFString "" maxPosition SFVec2f undef minPosition SFVec2f '0 0' offset SFVec3f '0 0 0' autoOffset SFBool 1 enabled SFBool 1
name SFString "" size SFVec3f '0 0 0' center SFVec3f '0 0 0' enabled SFBool 1
name SFString "" offset SFRotation '0 1 0 0' autoOffset SFBool 1 enabled SFBool 1
name SFString "" cycleInterval SFFloat 1 loop SFBool 0 startTime SFFloat 0 stopTime SFFloat 0 enabled SFBool 1
name SFString "" enabled SFBool 1
Example:
$vrml ->begin ->touchsensor('Switch') ->sphere(1,'white') ->def('Light')->directionallight("", 1, 0, 'red', 0) ->route('Switch.isActive', 'Light.on') ->end ->print->save;
name SFString "" size SFVec3f '0 0 0' center SFVec3f '0 0 0' enabled SFBool 1
VRML::VRML2::Standard
VRML::Base
http://www.gfz-potsdam.de/~palm/vrmlperl/ for a description of VRML-modules and how to obtain it.
Homepage http://www.gfz-potsdam.de/~palm/