资源说明:#VRML V2.0 utf8
#设置天空背景
Background {
skyColor [0.5 0.6 0.8,
0.6 0.7 0.9
1.0 1.0 1.0]
skyAngle [1.309 1.571]}
#利用群节点将灯变成一个整体,以便其它地方调用
Group {
children [
#灯的吊杆
Shape {
appearance Appearance {
material Material {
diffuseColor 0 0 0
specularColor 1 0.60 0.50
}
}
geometry Cylinder {
radius 0.04
height 2.0
}
}
Transform {
#在灯内部的局部坐标系中,将灯与灯罩向下移动移动的距离,以得到正确的效果
translation 0.0 -1.48 0.0
children [
#灯罩
Shape {
appearance Appearance {
material Material {
diffuseColor 0 0 0
specularColor 1 1 1
emissiveColor .65 .65 0
ambientIntensity 0
shininess 0.32
transparency 0.50 #设置一定的透明度
}
}
geometry Cone {
bottom TRUE #可以尝试将其设为FASLE,看看有什么变化
height 1.0
bottomRadius 1.5
}
}
Transform {
#在局部坐标系中,向下移动0.5个单位
translation 0.0 -0.5 0.0
children [
#灯泡
Shape {
appearance Appearance {
material DEF col Material {
diffuseColor 1 1 1} }
geometry Sphere {
radius 0.6}
}
]
}
]
}
]
}
DEF clock TimeSensor {
cycleInterval 8.0
loop TRUE
}
DEF path ColorInterpolator {
key [0 0.15 0.3 0.45 0.6 0.75 0.90 1.0]
keyValue [1.0 0.0 0.0,
0.5 0.0 0.0,
1.0 1.0 0.0,
0.0 1.0 0.0,
0.0 1.0 1.0,
0.0 0.0 1.0,
1.0 0.0 1.0,
1.0 1.0 1.0, ]
}
ROUTE clock.fraction_changed TO path.set_fraction
ROUTE path.value_changed TO col.diffuseColor
本源码包内暂不包含可直接显示的源代码文件,请下载源码包。