Professional Documents
Culture Documents
Group
Transformation
Shape
UML
08/06/09 13:29 2
tex
ry
tu
et
l reT
Box ria
texture
om
at e ran
ge
m sfo
Cone rm
Cylinder
Sphere Image, Movie Texture
Extrusion Material
PixelTexture Transform
rd xC
co
al
coo
tSty
ord
rd
oo
lor
norm
or
r
coo
olo rd
col
fon
texCo
c
al
rm
no
Texture
FontStyle Coordinate Color Normal
Coordinate
UML
08/06/09 13:29 3
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
}
UML
08/06/09 13:29 4
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
}
UML
08/06/09 13:29 5
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
}
UML
08/06/09 13:29 6
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
}
UML
08/06/09 13:29 7
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
}
UML
08/06/09 13:29 8
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
}
UML
08/06/09 13:29 9
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
}
UML
08/06/09 13:29 10
Order of application:
UML
08/06/09 13:29 11
GroupNode Definition
Transform {
enventIn MFNode addChildren
eventIn MFNode removeChildren
exposedField MFNode children []
field SFVec3f bboxCenter 0 0 0
field SFVec3f bboxSize -1 -1 -1
}
UML
08/06/09 13:29 12
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
}
UML
08/06/09 13:29 13
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
}
UML
08/06/09 13:29 14
Sound in VRML2.0
Definition 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
}
UML
08/06/09 13:29 15
Constant intensity
direction
minBack minFront
maxFront
maxBack
UML
08/06/09 13:29 16
Internode Communication:
Events
eventOut
Node A Node B
Node C
eventIn
Connection by a ROUTE
UML
08/06/09 13:29 17
Internode Communication
Node Field Classes
Type and value of events correspond to type and value of node fields.
UML
08/06/09 13:29 18
Internode Communication
Route 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
UML
08/06/09 13:29 19
Event Generators:
Touch Sensor
= Shapes Sensed
UML
08/06/09 13:29 20
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
}
UML
08/06/09 13:29 21
Touch Sensor
Example
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
}
UML
08/06/09 13:29 22
Touch Sensor
Example
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
}
UML
08/06/09 13:29 23
ScalarInterpolator
PositionInterpolator
OrientationInterpolator
CoordinateInterpolator
ColorInterpolator
UML
08/06/09 13:29 24
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
Position Interpolator
PositionInterpolator {
eventIn SFFloat set_fraction
exposedField MFFloat key []
exposedField MFVec3f keyValue []
eventOut SFVec3f value_changed
}
y
Input: [ 0 1]
z
UML
08/06/09 13:29 26
Position Animation
Example
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
UML
08/06/09 13:29 27
Java 3D:
Class Hierarchy
UML
08/06/09 13:29 28
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
UML
08/06/09 13:29 29
Java 3D:
Sample Code to Build Scene Graph
UML
08/06/09 13:29 30
Java 3D:
Scene Graph Built
UML
08/06/09 13:29 31
Java 3D;
Node Class Hierarchy
UML
08/06/09 13:29 32
Java 3D
“Hello Universe” Program
public class HelloUniverse extends Applet {
public BranchGroup createSceneGraph() {
// Create the root of the branch graph
objTrans.addChild(new ColorCube(0.4));
UML
08/06/09 13:29 33
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);
return objRoot;
}
public HelloUniverse() {
<set layout of applet, construct canvas3d, add canvas3d>
UML