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

[1日1Wonderfl] 4日目:アニメーション付きColladaにエフェクトをかけてみる

Lightwave3Dからアニメーション付きのColladaファイルを書き出すよ
手順はここにメモっておきましたー → http://www.ahiru.org/archives/135
1日1Wonderfl 4/30日目
もやってみた
// forked from mariot's forked from: Lightwave3Dからアニメーション付きColladaを書き出すよ
// forked from noenoe's Lightwave3Dからアニメーション付きColladaを書き出すよ
// Lightwave3Dからアニメーション付きのColladaファイルを書き出すよ
// 手順はここにメモっておきましたー → http://www.ahiru.org/archives/135

// 1日1Wonderfl 4/30日目
// もやってみた
package {
	import flash.events.Event;
        import flash.display.*;
        import flash.geom.*;
        import flash.filters.*;
	
	import org.papervision3d.objects.DisplayObject3D;
	import org.papervision3d.objects.parsers.DAE;
	import org.papervision3d.view.BasicView;
        import org.papervision3d.lights.PointLight3D;
        import org.papervision3d.materials.shaders.CellShader;
        import org.papervision3d.materials.ColorMaterial;
        import org.papervision3d.materials.shaders.ShadedMaterial;
        import org.papervision3d.materials.utils.MaterialsList;
        import org.papervision3d.materials.BitmapMaterial;

	public class Lightwave2Collada extends Sprite
	{
		public var dae:DAE;
		public var target:DisplayObject3D;
		public var view:BasicView;
		public var light:PointLight3D;

                private var _canvas :BitmapData;

		public function Lightwave2Collada()
		{
                        _canvas = new BitmapData( stage.stageWidth, stage.stageHeight, false, 0x00 );
                        addChild( new Bitmap( _canvas) );
                        
			view = new BasicView();
			this.addChild(view);


                        
                        // Create a new PointLight3d object
                        // PointLight3D(showLight:Boolean = false, flipped:Boolean = false)
                        light = new PointLight3D(true, true);
                        view.scene.addChild(light);
                        light.y = 800;
                        light.x = 500;
                        
			// Create a new dae object. dae was transrated from Lightwave fromat
                        // DAE(autoPlay:Boolean = true, name:String = null, loop:Boolean = false)
			dae = new DAE(true,null,true);
			dae.scale = 200;
			dae.load("http://www.ahiru.org/works/pv3d/colladaExport/sampleSwf/export.dae");
			view.scene.addChild(dae);

                        //target.replaceMaterialByName(cellShaderMat, "all");
			
			// Setting the camera
			target = new DisplayObject3D();
			target.y = 400;
			view.scene.addChild(target);

			view.camera.y = 800;
			view.camera.target = target;

			stage.addEventListener(Event.ENTER_FRAME, _enterFrameHandler)
		}

                private var filter1:BitmapFilter = new ColorMatrixFilter( [ 0.98, 0, -0.2, 0, 0,   0, 0.95, 0, 0, 0,   0, 0, 0.9, 0, 0,   0, 0, 0, 1, 0 ] );
		private var filter2:BitmapFilter = new BlurFilter(8,8,1);
                private var op:Point =new Point(0,0);
		private function _enterFrameHandler(e:Event):void{
			dae.rotationY += 3;
			view.startRendering();

                        _canvas.draw( view );
                        _canvas.applyFilter( _canvas, _canvas.rect, op, filter1 );
                        _canvas.applyFilter( _canvas, _canvas.rect, op, filter2 );
                        _canvas.scroll( Math.random()*8, Math.random()*-6 );
                        
		}
	}
}