home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Late Night VRML 2.0 with Java CD-ROM
/
code.zip
/
Ch11
/
ambient
/
Ambient.wrl
next >
Wrap
Text File
|
1997-03-30
|
3KB
|
194 lines
#VRML V2.0 utf8 CosmoWorlds V1.0
# $Id: Ambient.wrl /main/1 1997/02/20 19:38:44 sandvik Exp $
# Our background node.
Background {
skyColor [
0.0 0.2 0.75,
0.0 0.56 1.0,
1.0 1.0 1.0
]
skyAngle [ 1.309, 1.571]
groundColor [
0.1 0.50 0.0,
0.4 0.55, 0.2,
0.6, 0.70, 0.6
]
groundAngle [ 1.309, 1.571]
}
# This is our control proto, has geometry as well as default
# behavior concerning selection and dragging.
PROTO MusicElement [
exposedField MFNode children []
exposedField SFVec3f position 0. 0. 0.
exposedField MFString audioSource []
exposedField SFFloat max 40
]
{
DEF TOP_LEVEL Group {
children [
# TouchSensor
DEF TOUCH TouchSensor {}
# The Object itself
DEF MAIN_NODE Transform {
translation IS position
children [
DEF OBJECT Transform {
children IS children
}
# Sound Source
Sound {
source AudioClip {
url IS audioSource
loop TRUE
startTime 1
#description "debug"
}
minFront 5.0
minBack 5.0
maxFront IS max
maxBack IS max
}
]
}
# Light -- only turn on when the mouse is over the object
DEF HILIGHT PointLight {
location 0.0 0.0 0.0
radius 10.0
on FALSE
color 1.0 0.5 0.67
}
# Planesensor that moves the object
DEF SENSOR PlaneSensor {}
# Script that tweaks the plane sensor info
DEF TWEAK Script {
eventIn SFVec3f set_translation
eventOut SFVec3f position_changed
eventOut SFString stdout
url "vrmlscript:
function set_translation(translation, eventTime){
position_changed[0] = translation[0] * 2.0;
position_changed[1] = 0;
position_changed[2] = -translation[1] * 2.0;
}"
}
# Debugger
# DEF DEBUG CoRouteDebugger{}
]
}
# ROUTES
ROUTE TOUCH.isOver TO HILIGHT.on
ROUTE SENSOR.translation_changed TO TWEAK.set_translation
ROUTE TWEAK.position_changed TO MAIN_NODE.set_translation
#ROUTE TWEAK.stdout TO DEBUG.SFString
}
# Here are the actual instances of the music elements.
DEF A MusicElement {
position -4. 0. -30.0
audioSource "jungle.wav"
max 60.0
children [
Shape {
appearance Appearance {
material Material {
diffuseColor 0.88 0.8 0.28
}
}
geometry Sphere{}
}
]
}
DEF B MusicElement {
position -8. 0. -30.0
audioSource "sweep.wav"
children [
Shape {
appearance Appearance {
material Material {
diffuseColor 0.12 0.99 0.12
}
}
geometry Sphere{}
}
]
}
DEF C MusicElement {
position 0. 0. -30.0
audioSource "thema.wav"
children [
Shape {
appearance Appearance {
material Material {
diffuseColor 0.44 0.3 0.98
}
}
geometry Sphere{}
}
]
}
DEF D MusicElement {
position 4. 0. -30.0
audioSource "beatbw.wav"
max 30
children [
Shape {
appearance Appearance {
material Material {
diffuseColor 0.99 0.1 0.98
}
}
geometry Sphere{}
}
]
}
DEF E MusicElement {
position 8. 0. -30.0
audioSource "didjOver13.wav"
max 20
children [
Shape {
appearance Appearance {
material Material {
diffuseColor 0.11 0.4 0.98
}
}
geometry Sphere{}
}
]
}