flash on 2010-1-11 FogMaterialSample

by albatrus_jp
♥0 | Line 30 | Modified 2010-01-11 20:14:29 | MIT License
play

ActionScript3 source code

/**
 * Copyright albatrus_jp ( http://wonderfl.net/user/albatrus_jp )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/xbvm
 */

package {
    import flash.events.Event;
    import org.papervision3d.materials.*;
    import org.papervision3d.materials.special.*;
    import org.papervision3d.objects.primitives.*;
    import org.papervision3d.view.*;
    import org.papervision3d.core.render.filter.*;
    
    public class FlashTest extends BasicView {
    	    private var sphere:Sphere ;
        public function FlashTest() {
            
            var fg:FogMaterial =new FogMaterial(0xffffff);
            renderer.filter = new FogFilter(fg,40,2000,6000);
            
            var plane:Plane = new Plane(new ColorMaterial(0x000000),10000,10000,20,20);
            
            plane.rotationX = 90;
            scene.addChild(plane);
            
            
            sphere= new Sphere(new WireframeMaterial(0x00ffff),500);
            scene.addChild(sphere);
            
            sphere.x = 500;
            sphere.y = 500;
            
            startRendering();
            
            addEventListener(Event.ENTER_FRAME,function(e:Event):void{
            	
            	
            	var rot:Number = mouseX / stage.stageWidth* 360;
            	
            	camera.x = 3000* Math.sin(rot* Math.PI/180);
            	camera.y = mouseY / stage.stageWidth* 3000;
            	camera.x = 3000* Math.cos(rot* Math.PI/180);
            	
            	sphere.rotationY += 0.5;
            	
            });
            
        }
  
    }
  
  
    }