papervision初めの2歩 yaimo forked:0favorite:0lines:58license : All rights reserved modified : 2009-05-08 19:00:12 share Tweet package { import flash.display.Sprite; import org.papervision3d.materials.WireframeMaterial; import org.papervision3d.objects.primitives.Arrow; import org.papervision3d.objects.primitives.Cone; import org.papervision3d.objects.primitives.Cube; import org.papervision3d.objects.primitives.Cylinder; import org.papervision3d.objects.primitives.PaperPlane; import org.papervision3d.objects.primitives.Plane; import org.papervision3d.objects.primitives.Sphere; import org.papervision3d.materials.utils.MaterialsList; import org.papervision3d.view.BasicView; import flash.events.Event; public class Index extends Sprite { public function Index():void { var basicview:BasicView = new BasicView(); var material:WireframeMaterial = new WireframeMaterial(0xFF0080, 50, 1); material.doubleSided = true; //-------------------------------------------------------------------------- // Plane //-------------------------------------------------------------------------- var plane:Plane = new Plane(material, 100, 100, 2, 2); plane.x = 200; plane.y = 200; //-------------------------------------------------------------------------- // Sphere //-------------------------------------------------------------------------- var sphere:Sphere = new Sphere(material, 100, 8, 6); sphere.x = -200; sphere.y = -200; //-------------------------------------------------------------------------- // Cube //-------------------------------------------------------------------------- /*** Cubeの場合だとMaterialsListでの指定に注意 ***/ var cube:Cube = new Cube(new MaterialsList({all : material}), 500, 500, 500, 1, 1, 1); //--------------------------------------------------------------------------- // Cone //--------------------------------------------------------------------------- var cone:Cone = new Cone(material, 100, 100, 8, 6); cone.x = -200; cone.y = 200; //--------------------------------------------------------------------------- // Cylinder //--------------------------------------------------------------------------- var cylinder:Cylinder = new Cylinder(material, 100, 100, 8, 6, -1); cylinder.x = 200; cylinder.y = -200; //--------------------------------------------------------------------------- // paperPlane //--------------------------------------------------------------------------- var paperPlane:PaperPlane = new PaperPlane(null, 4); //--------------------------------------------------------------------------- // Arrow //--------------------------------------------------------------------------- var arrow:Arrow = new Arrow(null); arrow.y = -400; //-------------------------------------------------------------------------- // 登録 //-------------------------------------------------------------------------- addChild(basicview); basicview.scene.addChild(plane); basicview.scene.addChild(sphere); basicview.scene.addChild(cube); basicview.scene.addChild(cone); basicview.scene.addChild(cylinder); basicview.scene.addChild(paperPlane); basicview.scene.addChild(arrow); basicview.startRendering(); addEventListener(Event.ENTER_FRAME,function (e:Event):void { plane.rotationX += 1; sphere.rotationY += 1; cube.rotationZ += 1; cone.localRotationX += 1; cylinder.localRotationY += 1; paperPlane.localRotationZ += 1; //arrow.localRotationX += 1; arrow.rotationY += 1; }); } } } Code Fullscreen Preview Fullscreen material localRotationY localRotationX localRotationZ doubleSided rotationZ rotationX rotationY addEventListener addChild Event.ENTER_FRAME Event Sprite