Home >> Python >> PyOSG Second Appendix
import osg, osgViewer import sys root = osg.Group( ) box = osg.Box( osg.Vec3(10,0,0), 5, 10, 5 ) # 中心座標とxyz各方向の長さ shape = osg.ShapeDrawable( box ) gg = osg.Geode( ) gg.addDrawable( shape ) sphere = osg.Sphere( osg.Vec3( 20, 0, 0 ), 5 ) # 中心座標と半径 ss = osg.ShapeDrawable( sphere ) gg.addDrawable( ss ) cylinder = osg.Cylinder( osg.Vec3( 30, 0, 0 ), 5, 5 ) # 中心座標と半径、高さ sc = osg.ShapeDrawable( cylinder ) gg.addDrawable( sc ) cone = osg.Cone( osg.Vec3( 0 ,0, 0), 5, 5 ) # 中心座標と半径、高さ cc = osg.ShapeDrawable( cone ) cc.setColor( osg.Vec4( 0.0, 0.0, 1.0, 1.0 ) ) gg.addDrawable( cc ) root.addChild( gg ) viewer = osgViewer.Viewer( ) viewer.setSceneData( root ) viewer.addEventHandler( osgViewer.StatsHandler( ) ) viewer.addEventHandler( osgViewer.WindowSizeHandler( ) ) viewer.run( )
PyOSG Second | Python | PyOSG Third |