CUEB demo
package {
import flash.text.TextField;
import flash.events.*;
import flash.filters.*;
import flash.utils.*;
import flash.geom.*;
import flash.display.*;
import flash.geom.Transform;
import flash.geom.ColorTransform;
import org.papervision3d.objects.*;
import org.papervision3d.materials.shadematerials.*;
import org.papervision3d.core.effects.*;
import org.papervision3d.core.effects.utils.*;
import org.papervision3d.objects.*;
import org.papervision3d.view.layer.BitmapEffectLayer;
import org.papervision3d.view.layer.*;
import org.papervision3d.objects.primitives.*;
import org.papervision3d.materials.utils.MaterialsList;
import org.papervision3d.core.effects.view.ReflectionView;
import org.papervision3d.lights.*;
import org.papervision3d.core.math.*;
[SWF(width = "465", height = "465", backgroundColor="0", fps = "30")]
public class Main extends ReflectionView {
private var cube:Cube;
public function Main() {
cube = new Cube(
new MaterialsList( {
all : new FlatShadeMaterial(new PointLight3D(), 0x2288cc, 0x004466)
})
);
surfaceHeight = -600
viewportReflection.filters = [new BlurFilter(2, 2, 2)];
viewportReflection.alpha = .2;
//viewport.filters = [new GlowFilter(0xcccccc, 0.8, 20, 20, 4, 3)];
viewportReflection.filters = [new GlowFilter(0xcccccc, 1, 20, 20, 4, 3)];
var bfx:BitmapEffectLayer = new BitmapEffectLayer(viewport);//, 400, stage.stageHeight, true, 0, BitmapClearMode.CLEAR_PRE);
viewport.containerSprite.addLayer(bfx);
//bfx.addEffect( new BitmapLayerEffect( new BlurFilter(10,10,4)));
bfx.addEffect( new BitmapLayerEffect( new BlurFilter(25, 25, 4)));
bfx.addEffect( new BitmapColorEffect(.95, 1.0, .98, 0.98));
var ct:ColorTransform = new ColorTransform(0, 0, 1, .08);
var drawCommand:BitmapDrawCommand = new BitmapDrawCommand(null, ct, BlendMode.ADD);
bfx.drawCommand = drawCommand;
bfx.drawLayer.filters = [ new GlowFilter(0xFFFFFF,.5, 0, 50, 10)];
bfx.drawLayer.blendMode = BlendMode.MULTIPLY;
bfx.clippingPoint = new Point(9, -20);
bfx.addDisplayObject3D(cube);
scene.addChild(cube);
addEventListener(Event.ENTER_FRAME,function():void {
//cube.yaw(2)
camera.y = 500 + 200 * Math.sin(getTimer() / 1000);
singleRender()
});
}
private function move(me:MouseEvent):void{
var msg:TextField = new TextField();
msg.text = "Coucou lutin !";
addChild(msg);
}
override protected function onRenderTick(event:Event=null):void
{
cube.rotationY += (viewport.containerSprite.mouseX - cube.rotationY) * .21;
cube.rotationX += (viewport.containerSprite.mouseY - cube.rotationX) * .21;
renderer.renderScene(scene, camera, viewport);
}
}
}