VRML Basic Syntax - PowerPoint PPT Presentation

1 / 37
About This Presentation
Title:

VRML Basic Syntax

Description:

Node's Body consists of any number of. field statements, IS statements, ROUTE statements, ... Building Predefined Shapes(II) Appearance Node Syntax. Appearance ... – PowerPoint PPT presentation

Number of Views:95
Avg rating:3.0/5.0
Slides: 38
Provided by: cha90
Category:
Tags: vrml | basic | syntax

less

Transcript and Presenter's Notes

Title: VRML Basic Syntax


1
VRML Basic Syntax
  • Lee, Chan Su
  • chansu_at_caip.rutgers.edu

2
File Syntax and Structure(I)
  • Component of VRML file
  • head
  • prototypesPROTO, EXTERNPROTO
  • nodes, field, script
  • DEF/USE statements
  • Route statements

Floops.wrl
Floops.txt
3
File Syntax and Structure(II)
  • Syntax Basics
  • illegal character
  • First Character - 0-9 , . \
    0x-0x20
  • All other Character , . \ 0x-0x20
  • Reserved Keywords DEF, PROTO,..

4
Head
  • Head
  • VRML V2.0 ltencoding typegt comment ltline
    terminatorgt
  • VRML V2.0 utf8

utf8Universal Character Set Transform Format
Comment to the end of the line is comment
5
Node(I)
  • Node
  • analogous to object , or function
  • If you make a scene with node, it makes object in
    the virtual environment

DEF ltnamegt ltnodeTypegt ltbodygt
6
Node(II)
  • Nodes Body consists of any number of
  • field statements,
  • IS statements,
  • ROUTE statements,
  • PROTO statements or EXTERNPROTO statements

in any order
7
Node(III)
  • Nodes are commonly supplied to fields of other
    nodes.

Node1 fieldName Node2 Node2
fields set here
8
Node(IV)
  • Group NodeAnchor, Billboard, Collision, Group,
    Inline, LOD(Level of Detail), Switch, Transform
  • nodes that can contain and manage other nodes

9
Node(V)
Group children Nodename1 node1
., Nodename2 node2 .,
...
10
Field(I)
  • 3 Kinds of Field Type
  • field A private member of the nodeno access to
    and from other node
  • eventIn An event received by the Nodeother node
    can set this field
  • eventOut An event sent by the nodeother nodes
    can receive values form this field, but not set
    them

11
Field(II)
  • Field Type-exposedField
  • A public member of the nodeother nodes are free
    to set this field and also receive them
  • eventInfieldeventOut
  • in general set_nodeName for eventIn
  • nodeName_changed for eventOut

12
Field(III)
  • Data Type
  • SF-/MF
  • -Bool/ -Int32/ -Float/ -Color/ -Node/ -String/
    -Time/ -Vec2f/ -Vec3f/ -IMage

SFFloat/ MFFloat SFString, MFVec3f
13
Field(IV)
  • class_specifier data_type field_name default
    range
  • field SFFloat radius
    1 0 to ?
  • Exception of name in exposedField
  • Boolean eventOuts isNodeName
  • SFTime exitTime, startTime

14
DEF/USE statement
  • A node given a name using DEF keyword may later
    be referenced by name with USE or ROUTE
    statements
  • The USE statement does not create a copy of the
    node

DEF ltnamegt ltnodeTypegt ltbodygt
DEF Red Material diffuseColor 1 0 0
USE ltnamegt
15
Example of Node Definition
Transform eventIn MFNode
addChildren eventIn MFNode
removeChildren exposedField SFVec3f center
0 0 0 (-,) exposedField MFNode
children exposedField
SFRotation rotation 0 0 1 0
-1,1,(-,) exposedField SFVec3f scale
1 1 1 (0,) exposedField SFRotation
scaleOrientation 0 0 1 0 -1,1,(-,)
exposedField SFVec3f translation 0 0 0
(-,) field SFVec3f bboxCenter
0 0 0 (-,) field SFVec3f
bboxSize -1 -1 -1 (0,) or -1,-1,-1
16
Coordinate System
  • Cartesian, right-handed, 3D coordinate System
  • Standard Units
  • Viewing Model-Viewport
  • define specific location of viewer

17
Building Predefined Shapes(I)
  • Shape Node Syntax

Shape exposedField SFNode appearance NULL
exposedField SFNode geometry NULL
18
Building Predefined Shapes(II)
  • Appearance Node Syntax

Appearance exposedField SFNode material
NULL exposedField SFNode texture
NULL exposedField SFNode textureTransform
NULL
19
Building Predefined Shapes(III)
  • Material Node Syntax

Material exposedField SFFloat
ambientIntensity 0.2 0,1
exposedField SFColor diffuseColor 0.8 0.8
0.8 0,1 exposedField SFColor emissiveColor
0 0 0 0,1 exposedField SFFloat
shininess 0.2 0,1
exposedField SFColor specularColor 0 0 0
0,1 exposedField SFFloat transparency
0 0,1
20
Building Predefined Shapes(IV)
  • Primitive Geometry node
  • Box, Cone, Cylinder, Sphere
  • Syntax for Box node

Box field SFVec3f size 2 2 2
(0, )
21
Building Predefined Shapes(V)
  • Syntax for Cone

Cone field SFFloat bottomRadius 1
(0,) field SFFloat height 2
(0,) field SFBool side
TRUE field SFBool bottom TRUE
22
Building Predefined Shapes(VI)
  • Syntax for Cylinder

Cylinder field SFBool bottom TRUE
field SFFloat height 2 (0,)
field SFFloat radius 1 (0,)
field SFBool side TRUE field SFBool
top TRUE
23
Example of VRML File(I)
  • Simple VRML File
  • Cone.txt
  • Cone.wrl
  • If you change the field, the scene will be changed

24
Route/Sensors
  • Lee, Chan Su
  • chansu_at_caip.rutgers.edu

25
Event Route(I)
  • Event
  • allow objects to have and express
  • more realistic and life like virtual experience

26
Event Route(II)
  • Route
  • The connection between the node generating the
    event and the node receiving the event
  • Routes are not nodes, but merely a syntactic
    construct to field naming conventions

Type Matching In eventIn and eventOut
27
Event Route(III)
ROUTE NodeName.eventOutName TO NodeName.eventInNam
e
28
Sensor Nodes(I)
  • Change of the State of an Input Device
  • Anchor
  • TouchSensor
  • CylinderSensor
  • PlaneSensor
  • SphereSensor

29
Sensor Nodes(II)
  • Change of Viewer or Object
  • ProximitySensor
  • VisibilitySensor
  • Collision Group
  • Change in Time
  • TimeSensor

30
Execution Model
ROUTE A.touchTime TO B.toggleNow ROUTE
A.touchTime TO C.set_startTime ROUTE
B.toggle_changed TO C.set_enabled
Event Cascade, Fan-in and Fan-out
31
Sensing Viewer Actions(I)
  • Touch Sensor

TouchSensor exposedField SFBool enabled
TRUE eventOut SFVec3f hitNormal_changed
eventOut SFVec3f hitPoint_changed eventOut
SFVec2f hitTexCoord_changed eventOut
SFBool isActive eventOut SFBool isOver
eventOut SFTime touchTime
32
Sensing Viewer Actions(I)
  • Touch Sensor

TouchSensor exposedField SFBool enabled
TRUE eventOut SFVec3f hitNormal_changed
eventOut SFVec3f hitPoint_changed eventOut
SFVec2f hitTexCoord_changed eventOut
SFBool isActive eventOut SFBool isOver
eventOut SFTime touchTime
33
Sensing Viewer Actions(II)
  • PlaneSensor

PlaneSensor exposedField SFBool autoOffset
TRUE exposedField SFBool enabled
TRUE exposedField SFVec2f maxPosition
-1 -1 (-,) exposedField SFVec2f
minPosition 0 0 (-,)
exposedField SFVec3f offset 0 0 0
(-,) eventOut SFBool isActive
eventOut SFVec3f trackPoint_changed
eventOut SFVec3f translation_changed
34
Sensing Viewer Actions(III)
  • SphereSensor

SphereSensor exposedField SFBool
autoOffset TRUE exposedField SFBool
enabled TRUE exposedField SFRotation
offset 0 1 0 0 -1,1,(-,)
eventOut SFBool isActive eventOut
SFRotation rotation_changed eventOut
SFVec3f trackPoint_changed
35
Sensing Viewer Actions(IV)
  • CylinderSensor

CylinderSensor exposedField SFBool
autoOffset TRUE exposedField SFFloat
diskAngle 0.262 (0,/2) exposedField
SFBool enabled TRUE exposedField SFFloat
maxAngle -1 -2,2 exposedField
SFFloat minAngle 0 -2,2
exposedField SFFloat offset 0
(-,) eventOut SFBool isActive
eventOut SFRotation rotation_changed
eventOut SFVec3f trackPoint_changed
36
Sensor Route Example
route_test.txt
route_test.wrl
ROUTE Shape1Sensor.rotation_changed TO
Shape1.set_rotation ROUTE Shape2Sensor.rotation_ch
anged TO Shape2.set_rotation
37
Program Project I
  • interaction in VRML
  • using Sensor
  • using ROUTE
  • using primitive geometry
  • changing according to user action
  • Email to each person
Write a Comment
User Comments (0)
About PowerShow.com