media @ VU
vrml-math-BirchT.vr
vrml-math-BirchT.vr
(wrl
)
[ flux /
bitmanagement /
cortona /
octaga
]
NavigationInfo{ type "EXAMINE" }
Background{ skyColor .5 .5 1}
PROTO Tree3[
field SFInt32 order 3
field SFVec3f TrunkSc 1 1 1
field SFVec3f BranchSc .5 .5 .5
field SFRotation Rot 1 0 0 1 ]{
DEF ROOT Transform{ scale 2 2 2 translation 0 -2 0 children[]}
DEF Polyhedron Script {
eventOut MFNode new_f
field SFNode ROOT USE ROOT
field SFInt32 MaxIt IS order
field SFRotation Rot IS Rot
field SFVec3f TrunkSc IS TrunkSc
field SFVec3f BranchSc IS BranchSc
directOutput TRUE
url ["javascript:
function initialize(){
str =' ';
for ( i= 1; i<=MaxIt; i++)
str = 'Transform{ translation 0 1 0 children '+
'DEF s'+i+' Transform{ scale '+BranchSc+' children[ '+ str +
']} } Transform{ scale .5 .5 .5 children trunk{}} '+
'DEF g'+i+' Transform{ rotation '+Rot+' translation 0 1 0 children USE s'+i+'} '+
'Transform{ rotation 0 1 0 2.09 children USE g'+i+'} '+
'Transform{ rotation 0 1 0 -2.09 children USE g'+i+'}';
new_f = Browser.createVrmlFromString(
'PROTO trunk[]{Transform{ scale '+TrunkSc+' children[ '+
'Shape{ appearance Appearance{ material Material{ diffuseColor 1 1 1} '+
'texture ImageTexture{ url[\"birch0.png\"]} } '+
'geometry IndexedFaceSet{ coord Coordinate{ '+
'point[.2 0 0,.1 0 -.17,-.1 0 -.17,-.2 0 0,-.1 0 .17,.1 0 .17, '+
'.1 2 0,.05 2 -.09,-.05 2 -.09,-.1 2 0,-.05 2 .09,.05 2 .09]} '+
'coordIndex[0 1 7 6 -1 1 2 8 7 -1 2 3 9 8 -1 3 4 10 9 -1 4 5 11 10 -1 5 0 6 11] '+
' creaseAngle 2}}]}} ' + str );
ROOT.addChildren = new_f;
}
"]}
}
Tree3{order 3 }
(C) A. Eliëns
2/9/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.