Another option is the VRML (virtual reality modeling language) module. The docs for this module are a little sketchy, and it helps to study the structure of wrl files you find on the web before you really "get it". The following example script (vrml_test.pl) draws a red cube: use strict;
use VRML;
my $vrml = new VRML(2);
$vrml->Group->Shape(
sub{$vrml->IndexedFaceSet(
sub{$vrml->Coordinate('0 0 0', '0 0 1', '0 1 0', '0 1 1', '1 0
+ 0', '1 0 1', '1 1 0', '1 1 1', )->insert('solid FALSE')},
['0 1 3 2', '0 1 5 4', '0 4 6 2', '4 5 7 6', '2 3 7 6', '1 3 7
+ 5']
)},
sub{$vrml->Appearance(
sub{$vrml->Material(
ambientIntensity => .5,
diffuseColor => '1 0 0',
emissiveColor => '.25 0 0'
)}
)}
)->back;
$vrml->print;
$vrml->save;
exec 'vrmlview /home/phil/usr/vrml_test.wrl'; #Substitute your own vie
+wer and path info here.
You need a VRML viewer to see your work. This particular app runs on Linux and uses vrmlview, available free from Systems in Motion. Windows users have a lot of choices. Just type "windows vrml-viewer" into Google to find them.
Aside from allowing you to see complex shapes that are hard to visualize otherwise, the effects of grabbing an object with your mouse and rotating it in multiple axes can be downright intoxicating! Try it because it's fun, if for no other reason!
|