www.pudn.com > HF¶àýÌå.rar > monb11.wrl, change:2003-05-22,size:6266b
#VRML V2.0 utf8
#monitor monb.wrl
# set the background color
Background
{
skyColor 0.3 0.2 1.0
}
# set the opening rotated viewpoint
Viewpoint
{
position 6 0 6
orientation 0 1 0 0.785
}
Transform
{
#rotation 1 0 0 -0.087 # rotate and reduce the next object's
# size to 25% along the z-axis
scale 1 1 0.25
children
[
# apply a texture color to this object
Shape
{
appearance DEF switch Appearance
{
texture DEF beginsh ImageTexture
{
#set the beginning statius of the computer
url "media.jpg"
}
textureTransform TextureTransform
{
center 0 0
}
}
# draw the monitor screen
geometry Box
{
size 3 2.35 3
}
}
]
}
#set a touchsensor to help switch computer interface
DEF compswitch TouchSensor {}
#add script
DEF cscript Script
{
field SFBool on TRUE
eventIn SFBool set_active
eventOut SFBool on_changed
url "vrmlscript:
function set_active (b,tm)
{
//ignore button releases
if(b==FALSE) return;
//toggle on button presses
if(on==TRUE) on=FALSE;
else on=TRUE;
on_changed=on;
}"
}
DEF faceselector Script
{
#the beginning statius of the computer
field SFNode onface ImageTexture {url "media.jpg"}
#teacher's lecturing content
field SFNode offface ImageTexture {url "vrml2.jpg"}
eventIn SFBool set_selection
eventOut SFNode face_changed
url"vrmlscript:
function set_selection (b,tm)
{
if(b==TRUE)
face_changed=onface;
else
face_changed=offface;
}"
}
ROUTE compswitch.isActive TO cscript.set_active
ROUTE cscript.on_changed TO faceselector.set_selection
ROUTE faceselector.face_changed TO switch.set_texture
Transform
{
translation 1.707 0 0
children
[
# define and draw the "side" object
DEF side Shape
{
# define and apply the "gray" color to this object
appearance DEF gray Appearance
{
material Material
{
diffuseColor 0.8 0.8 0.8
specularColor 0.1 0.1 0.1
shininess 0.4
}
}
# draw the right side screen border
geometry Box
{
size 0.586 2.4 1
}
}
# move to draw the next object
Transform
{
translation -3.414 0 0
children
[
# draw the left side border of the screen
USE side
]
}
# move to draw the next object
Transform
{
translation -1.707 1.435 0
children
[
# define and draw the "top" object
DEF top Shape
{
# apply the "gray" color to this object
appearance USE gray
# draw the top border of the screen
geometry Box
{
size 4 0.53 1
}
}
# move to draw the next object
Transform
{
translation 0 -2.884 0
children
[
# draw the bottom border of the screen
USE top
]
}
]
}
]
}
# move to draw the next object
Transform
{
translation 0 -0.17 -1.914
children
[
Shape
{
# apply the "gray" color to this object
appearance USE gray
# draw the rear body of the monitor
geometry Box
{
size 2.828 2.828 2.828
}
}
# move to draw the next object
Transform
{
rotation 1 0 0 0.087
translation 0 -1.33 0
children
[
Shape
{
# apply the "gray" color to this object
appearance USE gray
# draw the swivel base below the rear body of the monitor
geometry Cone
{
height 2
bottomRadius 1.5
bottom FALSE
}
}
]
}
# move to draw the next object
Transform
{
translation 0 -2.375 0
children
[
Shape
{
# apply the "gray" color to this object
appearance USE gray
# draw the flat base of the monitor
geometry Box
{
size 3 0.2 3
}
}
]
}
]
}
#monitor monb.wrl