Pixel3D
/**
* Copyright hacker_szoe51ih ( http://wonderfl.net/user/hacker_szoe51ih )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/3pYE
*/
package {
import flash.events.*;
import flash.filters.*;
import flash.utils.*;
import org.papervision3d.materials.*;
import org.papervision3d.objects.primitives.*;
import org.papervision3d.core.effects.*;
import org.papervision3d.core.geom.*;
import org.papervision3d.core.geom.renderables.*;
import org.papervision3d.view.layer.*;
import org.papervision3d.view.*;
[SWF(width="465", height="465", frameRate="60", backgroundColor="#000000")]
public class Main extends BasicView {
public var globalRot:Number = 0;
public function Main() {
/*床を作る*/
var floor:WireframeMaterial = new WireframeMaterial(0xffffffff);
floor.doubleSided = true;
var floorObj:Plane = new Plane(floor,500,500,5,5);
floorObj.rotationX = 90;
//floorObj.y = -100;
scene.addChild(floorObj);
/*ビットマップレイヤーを作る*/
var layer:BitmapEffectLayer = new BitmapEffectLayer(viewport,640,480);
viewport.containerSprite.addLayer(layer);
layer.addEffect(new BitmapLayerEffect(new BlurFilter(4,4,4),false));
//layer.addEffect(new BitmapFireEffect(1.0,1.0,1.0));
/*ピクセルを作る*/
var pixels:Pixels = new Pixels(layer);
scene.addChild(pixels);
/*ピクセル3Dを作る*/
for (var i:int=0; i<10000; i++) {
var rot:Number = Math.ceil(Math.random() * 500) - 250;
var pX:Number = Math.ceil(Math.random() * 500) - 250;
var pY:Number = Math.ceil(Math.random() * 500) + 20;
var pZ:Number = Math.ceil(Math.random() * 500) - 250;
var pixel3D:Pixel3D = new Pixel3D(Math.random() * 0xffffffff,pX,pY,pZ);
pixels.addPixel3D(pixel3D);
}
startRendering();
addEventListener(Event.ENTER_FRAME,loop);
}
public function loop(e:Event):void{
globalRot += 0.5;
camera.y=700*Math.cos(globalRot*Math.PI/180);
camera.x=400*Math.cos(globalRot*Math.PI/180);
camera.z=400*Math.sin(globalRot*Math.PI/180);
}
}
}