|
![]() |
![]() 1-2 さらに発展したプログラム
Program 1-3 vrml13.wrl
#VRML V2.0 utf8 #ShapeをBoxのTransformの階層の外に出し、ロゴを少しねじる。 DEF transformCUBE Transform { translation -3.0 0.0 1.0 # 3m左、2m上、1m手前 rotation -1 1 0.8 0.785 children [ DEF CUBE Shape { appearance Appearance { material Material { diffuseColor 1 0 0 specularColor 0.9 0.9 0.9 } } geometry Box { } } ] } # このBallはCubeの階層の外側にある。 DEF transformBALL Transform { translation 0.0 0.0 1.0 children [ DEF BALL Shape { appearance Appearance { material Material { diffuseColor 0 1 0 specularColor 0.9 0.9 0.9 } } geometry Sphere { } } ] } DEF transformCONE Transform { translation 3.0 0.0 1.0 children [ DEF CONE Shape { appearance Appearance { material Material { diffuseColor 0 0 1 specularColor 0.9 0.9 0.9 } } geometry Cone { } } ] }
Program1-4 vrml14.wrl
#VRML V2.0 utf8 DEF CUBEandBALL Transform { translation -3.0 0.0 1.0 # 3m左、2m上、1m後ろ rotation -1 1 0.8 0.785 children [ DEF CUBE Shape { appearance Appearance { material Material { diffuseColor 1 0 0 specularColor 0.9 0.9 0.9 } } geometry Box { } } # このBallはCubeの階層の内側にある。 # これにより、球の位置は四角形からの座標となる。 DEF BALL Transform { translation 0.0 -3.0 1.0 children [ DEF BALL Shape { appearance Appearance { material Material { diffuseColor 0 1 0 specularColor 0.9 0.9 0.9 } } geometry Sphere { } } ] } ] } # これは3角錐をあらわす。 DEF transformCONE Transform { children [ DEF CONE Shape { appearance Appearance { translation 3.0 0.0 1.0 diffuseColor 0 0 1 specularColor 0.9 0.9 0.9 } material Material { } geometry Cone { } } ] }
図で表現するなら、下の図になる。
|