media @ VU
proto-line.vr
proto-line.vr
(wrl
)
[ flux /
bitmanagement /
cortona /
octaga
]
line
PROTO line [
exposedField SFVec3f translation 0 0 0
exposedField MFString string []
exposedField SFFloat size 1.0
exposedField MFString justify [ "BEGIN" ]
exposedField MFString family [ "Serif" ]
exposedField SFString style "PLAIN"
exposedField MFNode symbol []
exposedField SFColor color 1 1 1
exposedField SFInt32 nesting 0
] {
Transform {
translation IS translation
children [
DEF TRANS1 Transform {
children IS symbol
}
DEF TRANS2
Transform {
children Shape {
appearance Appearance {
material Material {
diffuseColor IS color
emissiveColor IS color
}
}
geometry DEF TEXT Text {
string IS string
fontStyle FontStyle {
family IS family
style IS style
justify IS justify
size
IS size
}
}
}
}
]
}
DEF SCRIPT Script {
directOutput TRUE
field SFNode trans1 USE TRANS1
field SFNode trans2 USE TRANS2
field MFString justify IS justify
field SFNode text USE TEXT
field MFNode symbol IS symbol
field SFFloat size IS size
field MFString string IS string
field SFInt32 nesting IS nesting
url "vrmlscript:
function initialize() {
trans1.scale = new SFVec3f(size/2,size/2,size/2);
var nest = nesting * 0.5;
if(symbol.length > 0) {
if(justify[0] != 'MIDDLE') {
trans1.translation = new SFVec3f(nest+size/2,size/4,0);
trans2.translation = new SFVec3f(nest+size,0,0);
} else {
trans1.translation = new SFVec3f(
nest-(string[0].length*(size/2))-size,size/4,0);
trans2.translation = new SFVec3f(nest,0,0);
}
} else {
trans2.translation = new SFVec3f(nest,0,0);
}
}
"
}
}
(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.