media @ VU
proto-dialog-conversation.vr
proto-dialog-conversation.vr
(wrl
)
[ flux /
bitmanagement /
cortona /
octaga
]
conversation
Web3D/VR
extern
#@extern @vr-extern-proto-dialog-object.wrl
#@extern @vr-extern-proto-dialog-bulb.wrl
#@extern @vr-extern-proto-dialog-repertoire.wrl
default right bulb
DEF b1 dialog-bulb {
scale 3 1 1
translation -1 1 0
color 0.7 0.2 0.2
string [ "well" "eh" ]
text 0 1 1
transparency 0.2
text_scale 0.7 1 1
}
default left bulb
DEF b2 dialog-bulb {
type 1
scale 2 1 1
translation 1 1 0
text 1 1 0
color 0 1 1
string [ "hi" ]
transparency 0.5
text_scale 0.8 1 1
text_translation -1 0 0
}
conversation
PROTO dialog-conversation [ ## "@vr-extern-proto-dialog-conversation.wrl"
exposedField SFInt32 switch 0
exposedField SFColor color 0 0 1
exposedField SFFloat transparency 0
exposedField SFNode node NULL
exposedField SFTime cycle 1
exposedField SFVec3f translation 0 0 0
exposedField SFVec3f scale 1 1 1
exposedField SFRotation rotation 0 0 1 0
exposedField MFNode children NULL
eventIn MFNode addChildren
eventIn MFNode removeChildren
exposedField MFString scene ["@vr-box.wrl"]
exposedField SFBool reverse TRUE
exposedField SFNode p1 NULL
exposedField SFNode p2 NULL
exposedField SFNode b1 USE b1
exposedField SFNode b2 USE b2
exposedField SFTime speed 3
ignore those
exposedField SFInt32 round 0
exposedField SFInt32 delay 5
exposedField SFBool enabled FALSE
exposedField SFBool ready FALSE
]{
body
DEF root Group {
children [
Transform {
translation IS translation
scale IS scale
rotation IS rotation
children [
Group {
children IS children
addChildren IS addChildren
removeChildren IS removeChildren
}
DEF touch TouchSensor { }
switch
Switch {
whichChoice IS switch
choice [
dialog-object {
color IS color
transparency IS transparency
node IS node
cycle IS cycle
}
]
}
Inline { url IS scene }
] }
]}
time
DEF time TimeSensor { enabled TRUE loop TRUE cycleInterval IS speed }
scenario
DEF scenario Script {
directOutput TRUE
eventIn SFTime cycle
eventIn SFTime touch
eventIn MFString message
field SFNode root USE root
field SFBool reverse IS reverse
field SFNode p1 IS p1
field SFNode p2 IS p2
field SFNode b1 IS b1
field SFNode b2 IS b2
field SFNode hold NULL
field MFString s1 [ "... " ]
field MFString s2 [ "... " ]
field SFInt32 toggle 0
field SFInt32 start 0
field SFInt32 delay IS delay
field SFInt32 round IS round
field SFBool enabled IS enabled
field SFBool ready IS ready
field SFInt32 turn 1
initialize/shutdown
url "javascript:
function initialize() {
root.addChildren = new MFNode(b1);
root.addChildren = new MFNode(b2);
if (!reverse) {
Browser.addRoute(p1,'string',b1,'message');
Browser.addRoute(p2,'string',b2,'message');
} else {
Browser.addRoute(p1,'string',b2,'message');
Browser.addRoute(p2,'string',b1,'message');
}
touch(0);
}
function shutdown() {
if (!reverse) {
Browser.deleteRoute(p1,'string',b1,'message');
Browser.deleteRoute(p2,'string',b2,'message');
} else {
Browser.deleteRoute(p1,'string',b2,'message');
Browser.deleteRoute(p2,'string',b1,'message');
}
}
function message(value) {
//print('message ' + value);
}
touch
function touch(value) {
if (toggle == 0) { toggle = 1; ready = TRUE; }
else if (toggle == 1) { toggle = 0; ready = FALSE; enabled = FALSE; }
}
taking turns
function cycle(value) {
if (enabled) {
if (turn == 1) {
round++; turn = 2; b2.string = s1;
p1.next = 1;
}
else if (turn == 2) {
turn = 1; b1.string = s1;
p2.next = 1;
if (round >= p1.max) {
round = 0;
enabled = FALSE;
ready = TRUE;
start = 0;
}
}
} else if (ready) {
start++;
if (start > delay) enabled = TRUE;
}
}
"
} ## end script
event routing
ROUTE touch.touchTime TO scenario.touch
ROUTE time.cycleTime TO scenario.cycle
} ## end proto
participant 1
DEF p1 dialog-repertoire {
max 12
u01 [ "how" "are" "you?" ]
u02 [ "tell" "me" "..." ]
u03 [ "what do" "you think" "of" ]
u04 [ "the 11th" "of september" "!" ]
u05 [ "of course!" ]
u06 [ "please" "speak out!" ]
u07 [ "now," "what do you" "think?" ]
u08 [ "what" "about" "terrorism?" ]
u09 [ "yes eh" "violence ..." ]
u10 [ "like in" "New York?" ]
u11 [ "americans" "you mean?" ]
u12 [ "" "what?" ]
}
participant 2
DEF p2 dialog-repertoire {
max 12
u01 [ "fine" "thank" "you" ]
u02 [ "yes" "eh" "..." ]
u03 [ "what?" "..." ]
u04 [ "the crash" "you mean?" ]
u05 [ "well eh" "..." ]
u06 [ "yes eh," "I think ..." ]
u07 [ "I think" "that" "eh terrorism" "..." ]
u08 [ "acts" "of" "violence" ]
u09 [ "against" "humanity" "..." ]
u10 [ "against" "innocent" "citizens" ]
u11 [ "right!" "and I think" "that .." ]
u12 [ "I'll miss" "the" "skyline" ]
}
final scene
dialog-conversation {
p1 USE p1
p2 USE p2
scene "@vr-box.wrl"
speed 2.5
}
NavigationInfo { type ["WALK","ANY"] }
DEF camera Viewpoint { position 0 0 10 }
Background {
groundAngle [1.57]
skyAngle [1.57]
groundColor [0 .3 0, .3 .4 .3]
skyColor [0 0 .3, .3 .3 .4]
}
(C) A. Eliëns
21/5/2007
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.