media @ VU
template-avatar.vr
template-avatar.vr
(wrl
)
[ flux /
bitmanagement /
cortona /
octaga
]
#@extern @vr-extern-proto-dlp-bulb.wrl
PROTO avatar-@name [
exposedField SFInt32 visible 0
exposedField SFInt32 persona 0
exposedField SFInt32 dialog 0
exposedField SFBool isPilot FALSE
exposedField MFFloat avatarSize [.25 0 .05]
exposedField SFFloat avatarHeight 1.75
exposedField SFBool isAvatar TRUE
eventIn SFInt32 gesture
exposedField SFTime gesture1 0
exposedField SFTime gesture2 0
exposedField SFTime gesture3 0
exposedField SFTime gesture4 0
exposedField SFTime gesture5 0
exposedField SFTime gesture6 0
exposedField SFTime gesture7 0
exposedField SFTime gesture8 0
eventIn SFVec3f set_position
exposedField SFRotation rotation 0 1 0 0
exposedField SFInt32 whichChoice 0
exposedField SFBool isOver FALSE
exposedField SFTime touchTime 0
exposedField SFVec3f translation 0 0 0
eventIn MFString message
exposedField MFString string []
exposedField SFVec3f bulb_translation 0 0 0
exposedField SFRotation bulb_rotation 0 0 1 0
exposedField SFVec3f bulb_scale 1 1 1
exposedField SFInt32 type 0
exposedField SFColor color 1 0 0
exposedField SFColor text 1 1 1
exposedField SFFloat transparency 0.7
exposedField SFVec3f text_scale 1 1 1
exposedField SFVec3f text_translation 0 0 0
exposedField SFRotation text_rotation 0 0 1 0
exposedField MFString background []
eventOut MFString message_changed
]{
Switch {
whichChoice IS visible
choice [
Transform {
translation IS translation
children [
Switch {
whichChoice IS dialog
choice [
DEF bulb-root Transform {
scale 0.3 0.3 0.3
children [
DEF bulb dlp-bulb {
message IS message
string IS string
translation IS bulb_translation
rotation IS bulb_rotation
scale IS bulb_scale
type IS type
color IS color
text IS text
transparency IS transparency
text_scale IS text_scale
text_translation IS text_translation
text_rotation IS text_rotation
background IS background
message_changed IS message_changed
}
]}
] } ## dialog
Switch {
whichChoice IS persona
choice [
DEF avatar Avatar-@name {
avatarSize IS avatarSize
avatarHeight IS avatarHeight
isAvatar IS isAvatar
gesture1 IS gesture1
gesture2 IS gesture2
gesture3 IS gesture3
gesture4 IS gesture4
gesture5 IS gesture5
gesture6 IS gesture6
gesture7 IS gesture7
gesture8 IS gesture8
##set_position IS set_position
rotation IS rotation
##
whichChoice IS whichChoice
isOver IS isOver
touchTime IS touchTime
}
] } ## persona
] }
] } ## visible
Script {
directOutput TRUE
mustEvaluate TRUE
eventIn SFInt32 gesture IS gesture
eventIn SFVec3f set_position IS set_position
field SFNode bulb USE bulb-root
field SFNode avatar USE avatar
url "javascript:
function set_position(value) {
avatar.set_position = value;
bulb.translation = value;
}
function gesture(value,time) {
if (value==0) { // nothing
} else if (value == 1) { avatar.gesture1 = time;
} else if (value == 2) { avatar.gesture2 = time;
} else if (value == 3) { avatar.gesture3 = time;
} else if (value == 4) { avatar.gesture4 = time;
} else if (value == 5) { avatar.gesture5 = time;
} else if (value == 6) { avatar.gesture6 = time;
} else if (value == 7) { avatar.gesture7 = time;
} else if (value == 8) { avatar.gesture8 = time;
}
}
"
}
}
(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.