vrml 2 0 scene graph structure n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
VRML 2.0 Scene Graph Structure PowerPoint Presentation
Download Presentation
VRML 2.0 Scene Graph Structure

Loading in 2 Seconds...

play fullscreen
1 / 33

VRML 2.0 Scene Graph Structure - PowerPoint PPT Presentation


  • 118 Views
  • Uploaded on

VRML 2.0 Scene Graph Structure. Nodes. Group. Transformation. Shape. Shape Node: Contained Nodes. Shape. appearance. Appearance. geometry. Box Cone Cylinder Sphere Extrusion. material. textureTransform. texture. Image, Movie PixelTexture. Texture Transform. Material. Indexed

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'VRML 2.0 Scene Graph Structure' - lazar


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
vrml 2 0 scene graph structure
VRML 2.0 Scene Graph Structure

Nodes

Group

Transformation

Shape

shape node contained nodes
Shape Node:Contained Nodes

Shape

appearance

Appearance

geometry

Box

Cone

Cylinder

Sphere

Extrusion

material

textureTransform

texture

Image, Movie

PixelTexture

Texture

Transform

Material

Indexed

Face

Set

Point

Set

Indexed

Line

Set

Elevation

Grid

Text

color

coord

color

coord

fontStyle

texCoord

normal

coord

color

color

texCoord

normal

Texture

Coordinate

FontStyle

Coordinate

Color

Normal

text node definition fontstyle node definition
Text Node DefinitionfontStyle Node Definition

Text {

exposedField MFString string[]

exposedField SFNode fontStyle NULL

exposedField MFFloat length []

exposedField SFFloat maxExtent 0.0

}

FontStyle {

field MFString family “SERIF”

field SFBool horizontal TRUE

field MFString justify “BEGIN”

field SFSring language ““

field SFFloat size 1.0

field SFFloat spacing 1.0

field SFString style “PLAIN”

field SFBool topToBottom TRUE

field SFBool leftToRight TRUE

}

appearance material nodes
Appearance & Material Nodes

Appearance {

exposedField SFNode material NULL

exposedField SFNode texture NULL

exposedField SFNode textureTransform NULL

}

Material {

exposedField SFFloat ambientIntensity 0.2

exposedField SFColor diffuseColor 0.8 0.8 0.8

exposedField SFColor emissiveColor 0 0 0

exposedField SFFloat shininess 0.2

exposedField SFColor specularColor 0 0 0

exposedField SFFloat transparency 0

}

texture node definitions
Texture Node Definitions

ImageTexture {

exposedField MFString url []

field SFBool repeatS TRUE

feild SFBool repeatT TRUE

}

PixelTexture {

exposedField SFImage image 0 0 0

field SFBool repeatS TRUE

feild SFBool repeatT TRUE

}

texture node definitions continued
Texture Node Definitions,Continued

MovieTexture {

exposedField SFBool loop FALSE

exposedField SFFloat speed 1

exposedField SFTime startTime 0

exposedField SFTime stopTime 0

exposedField MFString url []

field SFBool repeatS TRUE

field SFBool repeatT TRUE

eventOut SFFloat duration_changed

eventOut SFBool isActive

}

lighting in vrml 2 0 directional light source
Lighting in VRML 2.0Directional Light Source

DirectionalLight {

exposedField SFFloat ambientIntensity 0

exposedField SFColor color 1 1 1

exposedField SFVec3f direction 0 0 -1

exposedField SFFloat intensity 1

exposedField SFBool on TRUE

}

Directional lights are “scoped” to illuminate only objects in

their group.

lighting in vrml 2 0 point light sources
Lighting in VRML 2.0Point Light Sources

PointLight {

exposedField SFFloat ambientIntensity 0

exposedField SFVec3f attenuation 1 0 0

exposedField SFColor color 1 1 1

exposedField SFFloat intensity 1

exposedField SFVec3f location 0 0 0

exposedField SFBool on TRUE

exposedField SFFloat radius 100

}

Scoping for the PointLight is given by the radius field,

beyond which no objects are illuminated

lighting in vrml 2 0 spotlights
Lighting in VRML 2.0Spotlights

SpotLight {

exposedField SFFloat ambientIntensity 0

exposedField SFVec3f attenuation 1 0 0

exposedField SFFloat beamwidth 1.570796

exposedField SFColor color 1 1 1

exposedField SFFloat cutOffAngle 0.785398

exposedField SFVec3f direction 0 0 -1

exposedField SFFloat intensity 1

exposedField SFVec3f location 0 0 0

exposedField SFBool on TRUE

exposedField SFFloat radius 100

}

transform node definition
Transform Node Definition

Transform {

enventIn MFNode addChildren

eventIn MFNode removeChildren

exposedField SFVec3f center 0 0 0

exposedField MFNode children []

exposedField SFRotation rotation 0 0 1 0

exposedField SFVec3f scale 1 1 1

exposedField SFRotation scaleOrientation 0 0 1 0

exposedField SFVec3f translation 0 0 0

field SFVec3f bboxCenter 0 0 0

field SFVec3f bboxSize -1 -1 -1

}

Order of application:

T(translation) • T(rotation) • T(scale) {children}

groupnode definition
GroupNode Definition

Transform {

enventIn MFNode addChildren

eventIn MFNode removeChildren

exposedField MFNode children []

field SFVec3f bboxCenter 0 0 0

field SFVec3f bboxSize -1 -1 -1

}

viewing in vrml 2 0
Viewing in VRML 2.0

Viewpoint {

eventIn SFBool set_bind

exposedField SFFloat fieldOfView 0.785396

exposedField SFBool jump TRUE

exposedField SFRotation orientation 0 0 1 0

exposedField SFVec3f position 0 0 10

field SFString description ““

eventOut SFTime bindTime

eventOut SFBool isBound

}

sound in vrml 2 0 definition of sound node
Sound in VRML 2.0Definition of Sound Node

Sound {

exposedField SFVec3f direction 0 0 1

exposedField SFFloat intensity 1

exposedField SFVec3f location 0 0 0

exposedField SFFloat maxBack 10

exposedField SFFloat maxFront 10

exposedField SFFloat minBack 1

exposedField SFFloat minFront 1

exposedField SFFloat priority 0

exposedField SFNode source NULL

field SFBool spatialize TRUE

}

sound in vrml2 0 definition of audioclip node
Sound in VRML2.0Definition of AudioClip Node

AudioClip {

exposedField SFString description ““

exposedField SFBool loop FALSE

exposedField SFFloat pitch 1.0

exposedField SFTime startTime 0

exposedField SFTime stopTime 0

exposedField MFString url []

eventOut duration_changed

eventOut isActive

}

spatial sound pattern in vrml 2 0
Spatial Sound Pattern in VRML 2.0

Constant intensity

location

Linear Attenuation

direction

minBack

minFront

maxFront

maxBack

internode communication events
Internode Communication:Events

eventOut

Node A

Node B

Node C

eventIn

Connection by a ROUTE

internode communication node field classes

field Private node member

exposedField Public node member

eventIn Event received by node

eventOut Event sent by node

set_<fieldNname> Event received by node

<fieldName>_changed Event sent by node

Internode CommunicationNode Field Classes

Type and value of events correspond to type and value of node fields.

internode communication route syntax
Internode CommunicationRoute Syntax

DEF T1 Transform { . . . }

DEF T2 Transform { . . . }

DEF T3 Transform { . . . }

. . .

ROUTE T1.translation_changed TO T2.set_translation

ROUTE T2.translation_changed TO T3.set_translation

T1

T2

T3

translation

translation

translation

event generators touch sensor1
Event Generators: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

}

touch sensor example
Touch SensorExample

Group {

children [

DEF TS TouchSensor { }

Shape {

appearance Appearance {

material Material {

diffuseColor 0 0.5 0

}

}

geometry Sphere {}

}

DEF Highlight DirectionalLight {

color 1 0 0

on FALSE

}

DEF ActiveLight DirectionalLight {

color 0 0 1

on FALSE

}

]

ROUTE TS.isOver TO Highlight.set_on

ROUTE TS.isActive TO ActiveLight.set_on

}

touch sensor example1
Touch SensorExample

Group {

children [

DEF TS TouchSensor { }

Shape {

appearance Appearance {

material Material {

diffuseColor 0 0.5 0

}

}

geometry Sphere {}

}

Sound {

maxBack 1000

maxFront 1000

source DEF Audio AudioClip {

url “horse.wav”

}

}

]

ROUTE TS.touchTime TO Audio.startTime

}

adding behavior to objects
Adding Behavior to Objects

TimeSensor

Interpolator

General Node

Generates

time vary-

ing scalar

in range

[0,1]

Maps [0,1]

to field

data type

values.

[0,1]

ScalarInterpolator

PositionInterpolator

OrientationInterpolator

CoordinateInterpolator

ColorInterpolator

time sensor
Time Sensor

TimeSensor {

exposedField SFTime cycleInterval 1

exposedField SFBool enabled TRUE

exposedField SFBool loop FALSE

exposedField SFTime startTime 0

exposedField SFTime stopTime 0

eventOut SFTime cycleTime

eventOut SFFloat fraction_changed

eventOut SFBool isActive

eventOut SFTime time

}

loop=TRUE

loop=FALSE

startTime

cycleInterval

stopTime

position interpolator
Position Interpolator

PositionInterpolator {

eventIn SFFloat set_fraction

exposedField MFFloat key []

exposedField MFVec3f keyValue []

eventOut SFVec3f value_changed

}

y

x

Input: [ 0 1 ]

z

position animation example
Position AnimationExample

Def T Transform {

translation 0 5 0

children [

Shape {

geometry Cone {}

appearance Appearance {

material Material {

diffuseColor 1 0 0

}

}

}

]

}

Def P PositionInterpolator {

key [0, 0.5, 1]

keyValue [ 0 0 0, 4 0 0, 0 0 0]

}

Def TS TimeSensor {

stopTime -1

loop TRUE

}

ROUTE TS.fraction_changed TO P.set_fraction

ROUTE P.value_changed TO T.set_translation

java 3d viewing classes
Java 3D:Viewing Classes

Contains information

about physical screen

Contains most of

view state

Locates a view

within scene

3D version of

Abstract Windowing

Toolkit

java 3d sample code to build scene graph
Java 3D:Sample Code to Build Scene Graph

Shape3D myShape1 = new Shape3D(myGeometry1, myAppearance1);

Shape3D myShape2 = new Shape3D(myGeometry2, myAppearance2);

BranchGroup myBranch = new BranchGroup();

myBranch.addChild(myShape1);

myBranch.addChild(myShape2);

myBranch.compile();

VirtualUniverse myUniverse = new VirtualUniverse();

Locale myLocale = new Locale(myUniverse);

myLocale.addBranchGraph(myBranch);

java 3d hello universe program
Java 3D “Hello Universe” Program

public class HelloUniverse extends Applet {

public BranchGroup createSceneGraph() {

// Create the root of the branch graph

BranchGroup objRoot = new BranchGroup();

// Create the TransformGroup node and initialize it to the

// identity. Enable the TRANSFORM_WRITE capability so that

// our behavior code can modify it at run time. Add it to

// the root of the subgraph.

TransformGroup objTrans = new TransformGroup();

objTrans.setCapability(

TransformGroup.ALLOW_TRANSFORM_WRITE);

objRoot.addChild(objTrans);

// Create a simple Shape3D node; add it to the scene graph.

objTrans.addChild(new ColorCube(0.4));

// Create a new Behavior object that will perform the

// desired operation on the specified transform and add

// it into the scene graph.

java 3d hello universe program contd
Java 3D“Hello Universe” Program, contd.

Transform3D yAxis = new Transform3D();

Alpha rotationAlpha = new Alpha(-1, 4000);

RotationInterpolator rotator = new RotationInterpolator(

rotationAlpha, objTrans, yAxis,

0.0f, (float) Math.PI*2.0f);

BoundingSphere bounds =

new BoundingSphere(new Point3d(0.0,0.0,0.0), 100.0);

rotator.setSchedulingBounds(bounds);

objRoot.addChild(rotator);

// Have Java 3D perform optimizations on this scene graph.

objRoot.compile();

return objRoot;

}

public HelloUniverse() {

<set layout of applet, construct canvas3d, add canvas3d>

// Create the scene; attach it to the virtual universe

BranchGroup scene = createSceneGraph();

SimpleUniverse u = new SimpleUniverse(canvas3d);

u.getViewingPlatform().setNominalViewingTransform();

u.addBranchGraph(scene);

}

}