public class vr_bi_4 extends Script {
private Browser
b;
Node[]
monBloc ;
public void initialize()
{
b =
this.getBrowser();
}
private void
create() {
try {
monBloc = (Node[])b.createVrmlFromString(
"NavigationInfo {\n"+
" type \"EXAMINE\"\n"+
"}\n"+
"DirectionalLight {\n"+
" ambientIntensity 1\n"+
"}\n"+
"Transform {\n" +
" translation 2 0 0\n"+
" children [ \n" +
" Shape { \n" +
" appearance Appearance { \n" +
" material Material { \n" +
" diffuseColor
0.2 0.2 0.8 \n" +
" } \n" +
" } \n" +
" geometry Box {} \n" +
" }, \n" +
" ] \n" +
"} \n"
);
b.replaceWorld(monBloc);
}
//-- Attention: Obligatoire
catch (InvalidVRMLSyntaxException
ie) {
System.out.println("VRML Syntax Error !" +
ie);
}
}
public void processEvent(Event
e) {
if (b
!= null)
{
create() ;
}
}
}