In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

forked from: flash on 2009-3-17

六角柱
Get Adobe Flash player
by tsu_droid 28 May 2011
    Embed
// forked from ngtn's flash on 2009-3-17
package {
    import flash.display.*;
    import flash.events.*;

    import org.papervision3d.cameras.Camera3D;
    import org.papervision3d.materials.*;
    import org.papervision3d.objects.*;
    import org.papervision3d.objects.primitives.Cylinder;
    import org.papervision3d.render.BasicRenderEngine;
    import org.papervision3d.scenes.Scene3D;
    import org.papervision3d.materials.utils.MaterialsList;
    import org.papervision3d.view.Viewport3D;
    import org.papervision3d.lights.PointLight3D;
    import org.papervision3d.materials.shadematerials.FlatShadeMaterial;

    public class PV3D_01 extends Sprite {
        private var camera    :Camera3D;
        private var scene     :Scene3D;
        private var viewport  :Viewport3D;
        private var renderer  :BasicRenderEngine;

        private var rokkaku   :Cylinder;

        public function PV3D_01() {
            camera   = new Camera3D();
            camera.x = 0;
            camera.y = 0;
            camera.z = -1000;
            
            scene    = new Scene3D();
            viewport = new Viewport3D( stage.stageWidth, stage.stageHeight );
            renderer = new BasicRenderEngine();
            addChild( viewport );

            var light : PointLight3D = new PointLight3D();
            light.x = 0;
            light.y = 0;
            light.z = -1000;
            

            rokkaku = new Cylinder( new FlatShadeMaterial(light, 0xccccff),100,500 );
            scene.addChild(rokkaku);

            addEventListener( Event.ENTER_FRAME, onEnterFrame );
        }

        public function onEnterFrame(e:Event): void {
            rokkaku .rotationX += ( mouseX - stage.stageWidth /2 ) / 200;
            rokkaku .rotationY += ( mouseY - stage.stageHeight/2 ) / 200;

            renderer.renderScene( scene, camera, viewport );
        }
    }
}