6.8.5
- Múltiplos Interpolatores
Exemplo
70: Translação, rotação e escalonamento.
Background {
skyColor 0.3 0.5 0
}
DEF tr Transform {
children [
DEF No1 Shape {
appearance DEF Verd Appearance {
material DEF mat1 Material {
diffuseColor .286 .502 .675
specularColor .235 .298 .196
emissiveColor .357 .325 .725
}
}
geometry Cylinder {
radius 0.1
height 3.2
}
}
DEF No2 Shape {
appearance DEF Azul Appearance {
material DEF mat2 Material {
diffuseColor 0 0 .965
specularColor .831 .592 .349
emissiveColor .216 .267 .592
}
texture ImageTexture {
url "C:/Meu Site/Imagens/Imagem96.jpg"
}
}
geometry Sphere {
radius 0.1
}
}
DEF No3 Shape {
appearance DEF Verm Appearance {
material DEF mat3 Material {
diffuseColor 1 .275 .118
specularColor .157 .471 .784
emissiveColor .0745 .353 .588
}
texture ImageTexture {
url "C:/Meu Site/Imagens/SarahBrightman.JPG"
}
}
geometry Sphere {
radius 0.2
}
}
Transform {
rotation 0 0 1 1.57
children USE No1
}
Transform {
rotation 1 0 0 1.57
children USE No1
}
Transform {
translation 0 2 0
scale 5 5 5
children USE No2
}
Transform {
translation 0 0 0
scale 5 5 5
children USE No3
}
Transform {
translation 0 -2 0
scale 5 5 5
children USE No2
}
Transform {
translation 2 0 0
scale 5 5 5
children USE No2
}
Transform {
translation -2 0 0
scale 5 5 5
children USE No2
}
Transform {
translation 0 0 -2
scale 5 5 5
children USE No2
}
Transform {
translation 0 0 2
scale 5 5 5
children USE No2
}
DEF pi PositionInterpolator {
key [ 0 0.25 0.5 0.75 1]
keyValue [ 5 0 0, -5 0 0, 0 4 0, 0 -4 0, 5 0 0]
}
DEF pi2 PositionInterpolator {
key [ 0 0.25 0.5 0.75 1]
keyValue [ 1 1 1, 2 1 1, 3 0.5 1, 2 1 1, 1 1 1]
}
DEF ts TimeSensor {
cycleInterval 16
loop TRUE
}
DEF oi2 OrientationInterpolator {
key [ 0 1 ]
keyValue [ 0 1 0 0,
0 1 0 3.14, # rotate right
0 0 1 6.28] # rotate down
}
DEF ts2 TimeSensor {
cycleInterval 6
loop TRUE
}
]
}
ROUTE ts.fraction_changed TO pi.set_fraction
ROUTE pi.value_changed TO tr.set_translation
ROUTE ts2.fraction_changed TO oi2.set_fraction
ROUTE oi2.value_changed TO tr.set_rotation
ROUTE ts.fraction_changed TO pi2.set_fraction
ROUTE pi2.value_changed TO tr.scale