spacer

Webref WebRef   Sitemap · Experts · Tools · Services · Newsletters · About i.com

home / experts / 3d / lesson31

Lesson 31 - VRML 97--Magical Mystery Tour - Part 2

Developer News
Google Chrome Playing Catch-Up on Extensions
Open Solutions Alliance Gets New Leadership
Red Hat Spacewalk Expands Linux Management

The following code has added two named Viewpoint nodes.

    #VRML V2.0 utf8 DEF Front Viewpoint {   position 0, 0, 30   description "Front" } DEF Slant Viewpoint {   position -10, 0, 30   orientation 0 1 0 -.5   description "Slant" } DEF World Transform {   translation 0 0 0   children  [     DEF Center Transform {       translation 0 0 0       children  [         Shape  {           geometry Sphere {}           appearance Appearance {             material Material { diffuseColor 1 1 1 }           }         }       ]     }# end of Center transform--white     DEF Right Transform {       translation 10 0 0       children  [         Shape  {           geometry Box {}           appearance Appearance {             material Material { diffuseColor 0 1 0 }           }         }       ]     }# end of Right transform--green     DEF Left Transform {       translation -10 0 0       children  [         Shape  {           geometry Box {}           appearance Appearance {             material Material { diffuseColor 1 0 0 }           }         }       ]     }# end of Left transform--red     DEF Front Transform {       translation 0 0 10       children  [         Shape  {           geometry Box {}           appearance Appearance {             material Material { diffuseColor 1 0 1 }           }         }       ]     }# end of Front transform--magenta     DEF Back Transform {       translation 0 0 -10       children  [         Shape  {           geometry Box {}           appearance Appearance {             material Material { diffuseColor 0 1 1 }           }         }       ]     }# end of Back transform--cyan     DEF Top Transform {       translation 0 10 0       children  [         Shape  {           geometry Box {}           appearance Appearance {             material Material { diffuseColor 1 1 0 }           }         }       ]     }# end of Top transform--yellow     DEF Bottom Transform {       translation 0 -10 0       children  [         Shape  {           geometry Box {}           appearance Appearance {             material Material { diffuseColor 0 0 1 }           }         }       ]     }# end of Bottom transform--blue   ] }# end of World Transform

In previous lessons, we saw how naming nodes using the DEF tag allows us to both instance them for multiple use and to reference them in ROUTE statements. Here we name the two Viewpoint nodes for a different reason. When the browser reads the file, the first Viewpoint node it encounters is "bound." That means it's sent to the top of the stack of Viewpoints kept by the browser and used as the viewer's interface. Thus, in our file, the Viewpoint named Front is first presented to the viewer. This is the same face-on view we used in the first example. But now the browser presents a list of Viewpoints on the control panel. If we select the Slant view from this list, we move to the new location. Like so!

CLICK HERE to view example if you have a VRML browser.

Bounce back and forth between the views in your VRML browser. Now this is really fun! Even the simplest scene is exciting when we get the feeling of motion. Creating different Viewpoints introduces your viewer to the space and invites exploration. In some large spaces, many different Viewpoints can be essential. Movement between Viewpoints is halfway toward interactive navigation with the browser controls. Now try navigating using the browser controls, and then reselecting the Viewpoint to return to your starting point. Neat, huh?

Notice in the code how the Slant Viewpoint has both a new location and a new orientation. It's moved 10 meters to the left (in front of the red cube), but has also been rotated so that it is facing toward the center of the world. The code for this is undoubtedly confusing. The rotation value 0 1 0 .5 means that the rotation is around the vertical axis (y) and that the angle of rotation is .5 radians (about 29 degrees). This rotation keeps the viewer facing roughly toward the world origin.

To Continue to Part 3, or Return to Part 1, Use Arrow Buttons


internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info

Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers

Whitepapers and eBooks

Symantec Whitepaper: Converging System and Data Protection for Complete Disaster Recovery
Intel Whitepaper: Comparing Two- and Four-Socket Platforms for Server Virtualization
IBM Solutions Brief: Go Green With IBM System xTM And Intel
HP eBook: Simplifying SQL Server Management
IBM Contest: Are You the Next Superstar? Join the "Search for the XML Superstar" Contest to Find Out
Intel PDF: Quad-Core Impacts More Than the Data Center
Intel PDF: Virtualization Delivers Data Center Efficiency
Go Parallel Article: PDC 2008 in Review
Avaya Article: Communication-Enabled Mashups: Empowering Both Business Owners and IT
Intel Whitepaper: Building a Real-World Model to Assess Virtualization Platforms
PDF: Intel Centrino Duo Processor Technology with Intel Core2 Duo Processor
Microsoft Article: Build and Run Virtual Machines with Hyper-V Server 2008
  Go Parallel Article: Q&A with a TBB Junkie
IBM Whitepaper: Innovative Collaboration to Advance Your Business
Internet.com eBook: Real Life Rails
IBM eBook: The Pros and Cons of Outsourcing
Internet.com eBook: Best Practices for Developing a Web Site
IBM CXO Whitepaper: The 2008 Global CEO Study "The Enterprise of the Future"
Avaya Article: Call Control XML in Action - A CCXML Auto Attendant
IBM CXO Whitepaper: Unlocking the DNA of the Adaptable Workforce--The Global Human Capital Study 2008
Adobe Acrobat Connect Pro: Web Conferencing and eLearning Whitepapers
Symantec Whitepaper: Comprehensive Backup and Recovery of VMware Virtual Infrastructure
MORE WHITEPAPERS, EBOOKS, AND ARTICLES
webref The latest from WebReference.com Browse >
Popular JavaScript Framework Libraries: An Overview - Part 3 · Accessing Your MySQL Database from the Web with PHP · Working with the DOM Stylesheets Collection
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Review: Lenovo ThinkPad SL300 · OCZ PC3-10666 Gold 2x1GB Review · Apple Recommends Antivirus for Macs

Created: January 5, 1997
Revised: January 5, 1997

URL: http://webreference.com/3d/lesson31/part2.html