home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Late Night VRML 2.0 with Java CD-ROM
/
code.zip
/
Ch11
/
waterfall
/
dsp.wrl
< prev
next >
Wrap
Text File
|
1997-03-31
|
12KB
|
446 lines
#VRML V2.0 utf8
# ================================================================
#
# This prototype shows the minimum and maximum range ellipsoids
# of a Sound node. The current version does NOT handle direction
# values, so for this to work, you must leave your sound direction
# set to 0 0 1 and use the rotation in a higher Transform node to
# aim your sound. The prototype also does not track dynamic changes to
# the sound range values or location. Watch http://vrml.sgi.com for
# newer versions.
#
# debugSound proto by Geoff Brown
# (c) 1997 Silicon Graphics, Inc
#
PROTO debugSound [
field SFVec3f direction 0 0 1
field SFFloat intensity 1
field SFVec3f location 0 0 0
field SFFloat maxBack 10
field SFFloat maxFront 10
field SFFloat minBack 1
field SFFloat minFront 1
field SFFloat priority 0
field SFNode source NULL
field SFBool spatialize TRUE
]
{
Group {
children [
DEF dbgSound Sound {
source IS source
priority IS priority
location IS location
direction IS direction
minFront IS minFront
maxFront IS maxFront
minBack IS minBack
maxBack IS maxBack
spatialize IS spatialize
}
DEF rangeScript_0 Script {
eventOut SFVec3f maxScale
eventOut SFVec3f minScale
eventOut SFVec3f maxTrans
eventOut SFVec3f minTrans
eventOut SFString dbg1
eventOut SFString dbg2
eventOut SFString dbg3
field SFFloat maxFront IS maxFront
field SFFloat minFront IS minFront
field SFFloat maxBack IS maxBack
field SFFloat minBack IS minBack
field SFVec3f location IS location
field SFFloat maxf 10
field SFFloat minf 1
field SFFloat maxb 10
field SFFloat minb 1
field SFFloat minyx 1
field SFFloat maxxy 10
field SFVec3f loc 0 0 0
field SFVec3f maxs 10 10 1
field SFVec3f mins 1 1 1
field SFVec3f maxt 0 0 0
field SFVec3f mint 0 0 0
url "vrmlscript:
function maxRange() {
maxxy = Math.sqrt(maxf*maxb);
maxs = new SFVec3f(maxxy, maxxy, ((maxf + maxb) * 0.5));
maxt = new SFVec3f(loc[0], loc[1], loc[2]+((maxf-maxb) * 0.5));
maxScale = maxs;
maxTrans = maxt;
dbg2 = \"maxScale = \" + maxs[0] + \" \" + maxs[1] + \" \" + maxs[2];
dbg3 = \"maxTrans = \" + maxt[0] + \" \" + maxt[1] + \" \" + maxt[2];
}
function minRange() {
minxy = Math.sqrt(minf*minb);
mins = new SFVec3f(minxy, minxy, ((minf + minb) * 0.5));
mint = new SFVec3f(loc[0], loc[1], loc[2]+((minf-minb) * 0.5));
minScale = mins;
minTrans = mint;
dbg2 = \"minScale = \" + mins[0] + \" \" + mins[1] + \" \" + mins[2];
dbg3 = \"minTrans = \" + mint[0] + \" \" + mint[1] + \" \" + mint[2];
}
function initialize() {
loc = location;
maxf = maxFront;
maxb = maxBack;
minf = minFront;
minb = minBack;
minRange();
maxRange();
}
"
}
DEF minRange Transform {
children Transform {
children Shape {
appearance Appearance {
material Material {
ambientIntensity 1.4
diffuseColor 0.3 0.3 0
specularColor 0 0 0
emissiveColor 0.3 0.3 0
shininess 0.2
transparency 0
}
texture NULL
textureTransform NULL
}
geometry DEF wireframe IndexedLineSet {
coord Coordinate {
point [ 1 0 0,
0.9701 0.2425 0,
0.9701 0 0.2425,
0.9045 0.3015 0.3015,
0.8321 0 0.5547,
0.6667 0.3333 0.6667,
0.5547 0 0.8321,
0.3015 0.3015 0.9045,
0.2425 0 0.9701,
0 0.2425 0.9701,
0 0 1,
0.8321 0.5547 0,
0.6667 0.6667 0.3333,
0.3333 0.6667 0.6667,
0 0.5547 0.8321,
0.5547 0.8321 0,
0.3015 0.9045 0.3015,
0 0.8321 0.5547,
0.2425 0.9701 0,
0 0.9701 0.2425,
0 1 0,
-0.2425 0 0.9701,
-0.3015 0.3015 0.9045,
-0.5547 0 0.8321,
-0.6667 0.3333 0.6667,
-0.8321 0 0.5547,
-0.9045 0.3015 0.3015,
-0.9701 0 0.2425,
-0.9701 0.2425 0,
-1 0 0,
-0.3333 0.6667 0.6667,
-0.6667 0.6667 0.3333,
-0.8321 0.5547 0,
-0.3015 0.9045 0.3015,
-0.5547 0.8321 0,
-0.2425 0.9701 0,
0 -0.2425 0.9701,
0.3015 -0.3015 0.9045,
0.6667 -0.3333 0.6667,
0.9045 -0.3015 0.3015,
0.9701 -0.2425 0,
0 -0.5547 0.8321,
0.3333 -0.6667 0.6667,
0.6667 -0.6667 0.3333,
0.8321 -0.5547 0,
0 -0.8321 0.5547,
0.3015 -0.9045 0.3015,
0.5547 -0.8321 0,
0 -0.9701 0.2425,
0.2425 -0.9701 0,
0 -1 0,
-0.9701 -0.2425 0,
-0.9045 -0.3015 0.3015,
-0.6667 -0.3333 0.6667,
-0.3015 -0.3015 0.9045,
-0.8321 -0.5547 0,
-0.6667 -0.6667 0.3333,
-0.3333 -0.6667 0.6667,
-0.5547 -0.8321 0,
-0.3015 -0.9045 0.3015,
-0.2425 -0.9701 0,
0 0 -1,
0 0.2425 -0.9701,
0.2425 0 -0.9701,
0.3015 0.3015 -0.9045,
0.5547 0 -0.8321,
0.6667 0.3333 -0.6667,
0.8321 0 -0.5547,
0.9045 0.3015 -0.3015,
0.9701 0 -0.2425,
0 0.5547 -0.8321,
0.3333 0.6667 -0.6667,
0.6667 0.6667 -0.3333,
0 0.8321 -0.5547,
0.3015 0.9045 -0.3015,
0 0.9701 -0.2425,
-0.9701 0 -0.2425,
-0.9045 0.3015 -0.3015,
-0.8321 0 -0.5547,
-0.6667 0.3333 -0.6667,
-0.5547 0 -0.8321,
-0.3015 0.3015 -0.9045,
-0.2425 0 -0.9701,
-0.6667 0.6667 -0.3333,
-0.3333 0.6667 -0.6667,
-0.3015 0.9045 -0.3015,
0.9045 -0.3015 -0.3015,
0.6667 -0.3333 -0.6667,
0.3015 -0.3015 -0.9045,
0 -0.2425 -0.9701,
0.6667 -0.6667 -0.3333,
0.3333 -0.6667 -0.6667,
0 -0.5547 -0.8321,
0.3015 -0.9045 -0.3015,
0 -0.8321 -0.5547,
0 -0.9701 -0.2425,
-0.3015 -0.3015 -0.9045,
-0.6667 -0.3333 -0.6667,
-0.9045 -0.3015 -0.3015,
-0.3333 -0.6667 -0.6667,
-0.6667 -0.6667 -0.3333,
-0.3015 -0.9045 -0.3015 ]
}
color NULL
coordIndex [ 0, 1, 2, -1, 2, 1, 3, -1,
2, 3, 4, -1, 4, 3, 5, -1,
4, 5, 6, -1, 6, 5, 7, -1,
6, 7, 8, -1, 8, 7, 9, -1,
8, 9, 10, -1, 1, 11, 3, -1,
3, 11, 12, -1, 3, 12, 5, -1,
5, 12, 13, -1, 5, 13, 7, -1,
7, 13, 14, -1, 7, 14, 9, -1,
11, 15, 12, -1, 12, 15, 16, -1,
12, 16, 13, -1, 13, 16, 17, -1,
13, 17, 14, -1, 15, 18, 16, -1,
16, 18, 19, -1, 16, 19, 17, -1,
19, 18, 20, -1, 10, 9, 21, -1,
21, 9, 22, -1, 21, 22, 23, -1,
23, 22, 24, -1, 23, 24, 25, -1,
25, 24, 26, -1, 25, 26, 27, -1,
27, 26, 28, -1, 27, 28, 29, -1,
9, 14, 22, -1, 22, 14, 30, -1,
22, 30, 24, -1, 24, 30, 31, -1,
24, 31, 26, -1, 26, 31, 32, -1,
26, 32, 28, -1, 14, 17, 30, -1,
30, 17, 33, -1, 30, 33, 31, -1,
31, 33, 34, -1, 31, 34, 32, -1,
17, 19, 33, -1, 33, 19, 35, -1,
33, 35, 34, -1, 35, 19, 20, -1,
10, 36, 8, -1, 8, 36, 37, -1,
8, 37, 6, -1, 6, 37, 38, -1,
6, 38, 4, -1, 4, 38, 39, -1,
4, 39, 2, -1, 2, 39, 40, -1,
2, 40, 0, -1, 36, 41, 37, -1,
37, 41, 42, -1, 37, 42, 38, -1,
38, 42, 43, -1, 38, 43, 39, -1,
39, 43, 44, -1, 39, 44, 40, -1,
41, 45, 42, -1, 42, 45, 46, -1,
42, 46, 43, -1, 43, 46, 47, -1,
43, 47, 44, -1, 45, 48, 46, -1,
46, 48, 49, -1, 46, 49, 47, -1,
49, 48, 50, -1, 29, 51, 27, -1,
27, 51, 52, -1, 27, 52, 25, -1,
25, 52, 53, -1, 25, 53, 23, -1,
23, 53, 54, -1, 23, 54, 21, -1,
21, 54, 36, -1, 21, 36, 10, -1,
51, 55, 52, -1, 52, 55, 56, -1,
52, 56, 53, -1, 53, 56, 57, -1,
53, 57, 54, -1, 54, 57, 41, -1,
54, 41, 36, -1, 55, 58, 56, -1,
56, 58, 59, -1, 56, 59, 57, -1,
57, 59, 45, -1, 57, 45, 41, -1,
58, 60, 59, -1, 59, 60, 48, -1,
59, 48, 45, -1, 48, 60, 50, -1,
61, 62, 63, -1, 63, 62, 64, -1,
63, 64, 65, -1, 65, 64, 66, -1,
65, 66, 67, -1, 67, 66, 68, -1,
67, 68, 69, -1, 69, 68, 1, -1,
69, 1, 0, -1, 62, 70, 64, -1,
64, 70, 71, -1, 64, 71, 66, -1,
66, 71, 72, -1, 66, 72, 68, -1,
68, 72, 11, -1, 68, 11, 1, -1,
70, 73, 71, -1, 71, 73, 74, -1,
71, 74, 72, -1, 72, 74, 15, -1,
72, 15, 11, -1, 73, 75, 74, -1,
74, 75, 18, -1, 74, 18, 15, -1,
18, 75, 20, -1, 29, 28, 76, -1,
76, 28, 77, -1, 76, 77, 78, -1,
78, 77, 79, -1, 78, 79, 80, -1,
80, 79, 81, -1, 80, 81, 82, -1,
82, 81, 62, -1, 82, 62, 61, -1,
28, 32, 77, -1, 77, 32, 83, -1,
77, 83, 79, -1, 79, 83, 84, -1,
79, 84, 81, -1, 81, 84, 70, -1,
81, 70, 62, -1, 32, 34, 83, -1,
83, 34, 85, -1, 83, 85, 84, -1,
84, 85, 73, -1, 84, 73, 70, -1,
34, 35, 85, -1, 85, 35, 75, -1,
85, 75, 73, -1, 75, 35, 20, -1,
0, 40, 69, -1, 69, 40, 86, -1,
69, 86, 67, -1, 67, 86, 87, -1,
67, 87, 65, -1, 65, 87, 88, -1,
65, 88, 63, -1, 63, 88, 89, -1,
63, 89, 61, -1, 40, 44, 86, -1,
86, 44, 90, -1, 86, 90, 87, -1,
87, 90, 91, -1, 87, 91, 88, -1,
88, 91, 92, -1, 88, 92, 89, -1,
44, 47, 90, -1, 90, 47, 93, -1,
90, 93, 91, -1, 91, 93, 94, -1,
91, 94, 92, -1, 47, 49, 93, -1,
93, 49, 95, -1, 93, 95, 94, -1,
95, 49, 50, -1, 61, 89, 82, -1,
82, 89, 96, -1, 82, 96, 80, -1,
80, 96, 97, -1, 80, 97, 78, -1,
78, 97, 98, -1, 78, 98, 76, -1,
76, 98, 51, -1, 76, 51, 29, -1,
89, 92, 96, -1, 96, 92, 99, -1,
96, 99, 97, -1, 97, 99, 100, -1,
97, 100, 98, -1, 98, 100, 55, -1,
98, 55, 51, -1, 92, 94, 99, -1,
99, 94, 101, -1, 99, 101, 100, -1,
100, 101, 58, -1, 100, 58, 55, -1,
94, 95, 101, -1, 101, 95, 60, -1,
101, 60, 58, -1, 60, 95, 50, -1 ]
}
}
translation 0 0 0
rotation 1 0 0 1.571
scale 1 1 1
scaleOrientation 0 0 1 0
}
translation 0 0 0
scale 1 1 1
}
DEF maxRange Transform {
children Transform {
children Shape {
appearance Appearance {
material Material {
ambientIntensity 1.4
diffuseColor 0.41 0.11 0.11
specularColor 0 0 0
emissiveColor 0.41 0.11 0.11
shininess 0.2
transparency 0
}
texture NULL
textureTransform NULL
}
geometry USE wireframe
}
translation 0 0 0
rotation 0 0 1 0
scale 1 1 1
scaleOrientation 0 0 1 0
}
translation 0 0 0
scale 1 1 1
}
]
}
ROUTE rangeScript_0.minTrans TO minRange.set_translation
ROUTE rangeScript_0.minScale TO minRange.set_scale
ROUTE rangeScript_0.maxTrans TO maxRange.set_translation
ROUTE rangeScript_0.maxScale TO maxRange.set_scale
}
NavigationInfo {
speed 3
type "EXAMINE"
}
DEF background Transform {
children Background {
groundAngle 1.01
groundColor [ 0.1 0.1 0.09,
0.48 0.48 0.45 ]
skyAngle [ 0.05, 0.1, 1, 1.57 ]
skyColor [ 1 1 0,
1 1 0.5,
0.125 0.125 0.5,
0.3 0.3 0.55,
0.64 0.73 0.84 ]
}
translation 139.5 161.9 -16.62
rotation 0 0 1 0
}
DEF xform Transform {
children [
DEF click TouchSensor {
}
DEF clickScript Script {
eventOut SFTime start
eventOut SFTime stop
eventIn SFTime touch
field SFBool playing FALSE
url "vrmlscript:
function touch (value, time) {
if (playing) {
stop = value;
playing = FALSE;
}
else {
start = value;
playing = TRUE;
}
}
"
}
debugSound {
maxBack 5
maxFront 150
minBack 1
minFront 25
source DEF aclip AudioClip {
# url "forest.wav"
loop TRUE
startTime 0
stopTime 1
description "debug"
# }
}
DEF mybox Shape {
appearance NULL
geometry Box {
size 0.5 0.5 0.5
}
}
]
translation -1 0 0
}
ROUTE click.touchTime TO clickScript.touch
ROUTE clickScript.start TO aclip.set_startTime
ROUTE clickScript.stop TO aclip.set_stopTime