media @ VU
proto-slide-element-annot.vr
proto-slide-element-annot.vr
(wrl
)
[ flux /
bitmanagement /
cortona /
octaga
]
text
Web3D/VR
proto
PROTO AnnotTextElement [
exposedField SFString elementType "TEXTELEMENT"
exposedField SFInt32 startLevel -1
exposedField SFInt32 endLevel -1
exposedField SFFloat width 1
exposedField SFFloat height 1
exposedField SFBool linebreak FALSE
exposedField SFBool absolute FALSE
exposedField SFBool nochange FALSE
exposedField MFString string []
exposedField SFVec3f position 0 0 0
exposedField SFColor color 1 1 1
exposedField SFFloat alpha 0
exposedField SFColor bgColor 0 0 1
exposedField SFFloat bgTransparency 1
exposedField SFVec3f location 0 0 0
exposedField SFRotation rotation 0 1 0 0
exposedField SFVec3f scale 1 1 1
exposedField MFString justify [ "BEGIN" ]
exposedField MFString family [ "SERIF" ]
exposedField SFString style "PLAIN"
exposedField SFString href ""
exposedField MFString parameters []
exposedField MFString annot []
exposedField SFVec3f ascale 2 2 2
exposedField SFVec3f atrans 3 2 1
exposedField SFVec3f asize 8 6 1
exposedField SFFloat aalpha 0.5
exposedField SFColor acolor 0.0 0.8 0.8
exposedField SFRotation arotation 0 0 1 0
exposedField SFNode anode NULL
exposedField SFInt32 atype 0
exposedField MFString ascene [ "@dlp.wrl" ]
] {
body
DEF TRANSFORMXX Transform {
translation IS position
children [
DEF TRANSFORM Transform {
translation IS location
rotation IS rotation
scale IS scale
children [
DEF BOXTRANSFORM Transform {
translation 0 0 -0.015
}
Shape {
appearance Appearance {
material Material {
diffuseColor 0 0 0
specularColor 0 0 0
emissiveColor IS color
transparency IS alpha
}
}
geometry DEF TEXT Text {
string IS string
fontStyle FontStyle {
size IS height
family IS family
style IS style
justify [ "BEGIN" ]
topToBottom TRUE
leftToRight TRUE
}
}
}
DEF xswitch Switch {
whichChoice -1
choice [
Transform {
rotation IS arotation
translation IS atrans
scale IS ascale
children [
Switch {
whichChoice IS atype
choice [
Shape {
geometry Box { size IS asize }
appearance DEF APP Appearance {
material Material {
diffuseColor IS acolor
transparency IS aalpha
}
##texture ImageTexture { url IS annot }
texture DEF MOVIE MovieTexture { url IS annot }
}
} ## 0
Transform {
scale 3 3 3
children [
Shape {
geometry nsphere { }
appearance USE APP
} ] } ## 1
Shape {
geometry IS anode
appearance USE APP
} ## 2
Transform {
children [
Transform {
translation 0 0 -1
children [
Shape {
geometry Box { size IS asize }
appearance USE APP
}
] }
Shape {
geometry IS anode
##appearance USE APP
} ]} ## 3
Transform {
children [
Transform {
scale 3 3 3
children [
Shape {
geometry nsphere { }
appearance USE APP
} ] }
Shape {
geometry IS anode
##appearance USE APP
} ]} ## 4
Layer3D {
depth -100
translation 0 0
size 1 1
viewpoint Viewpoint { position 0 0 10 }
navigationInfo NavigationInfo { headlight TRUE }
children [
Transform {
rotation IS arotation
translation IS atrans
scale IS ascale
children [
Inline { url IS ascene }
]}
]
} ## 5
]} ## atype
]
}
]} ## Switch
DEF touch TouchSensor { }
DEF script Script {
directOutput TRUE
eventIn SFBool over
field SFNode xswitch USE xswitch
field SFNode movie USE MOVIE
url "javascript:
function over(v,t) {
Browser.print('OK ' + v);
if (v) {
xswitch.whichChoice = 0;
//movie.startTime = t;
movie.loop = TRUE;
}
else {
xswitch.whichChoice = -1;
//movie.stopTime = t;
movie.loop = FALSE;
}
}"
}
ROUTE touch.isOver TO script.over
]
} ] }
script
DEF SCRIPT Script {
mustEvaluate TRUE
directOutput TRUE
field SFNode boxTransform USE BOXTRANSFORM
field SFNode transform USE TRANSFORM
field SFNode me USE SCRIPT
field MFString family IS family
field SFFloat size IS height
eventIn MFString set_string IS string
field MFString string IS string
field MFString justify IS justify
field SFFloat length IS width
eventOut SFFloat length_changed IS width
field SFColor bgColor IS bgColor
field SFFloat bgTransparency IS bgTransparency
field SFString href IS href
field MFString parameters IS parameters
eventIn SFTime touched
functions
url "vrmlscript:
function initialize() {
// guess length...
var factor = 1;
if(family[0]=='TYPEWRITER') {
factor = 0.6;
} else if(family[0]=='SANS') {
factor = 0.5;
} else if(family[0]=='SERIF') {
factor = 0.38;
}
length = string[0].length * factor * size;
length_changed = length;
// Setup backgroundBox to be size widthXheight
boxTransform.translation = new SFVec3f(length/2,size/2,-0.015);
var bgBox = Browser.createVrmlFromString(' Shape { appearance Appearance { material Material { diffuseColor 0 0 0 specularColor 0 0 0 emissiveColor ' + bgColor + ' transparency ' + bgTransparency + ' } } geometry Box { size ' + length + ' ' + size + ' 0.01 } } ');
boxTransform.children = bgBox;
if(href != '') {
var touch = Browser.createVrmlFromString(' TouchSensor{} ');
transform.addChildren = touch;
Browser.addRoute(touch[0],'touchTime',me,'touched');
}
}
function set_string(v,t) {
string = v;
initialize();
}
function touched(v,t) {
Browser.loadURLrel(href,parameter);
// Change, this for absolute URLs
// Browser.loadURL(href,parameter);
}
"
}
}
(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.