As promised, here is the source code for the simple blurring example:
<?xml version=
"1.0" encoding=
"utf-8"?>
<mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml"
backgroundColor="0x000000"
creationCompleteEffect="Fade"
creationComplete="handleCreationComplete()"
>
<mx:Script>
<![CDATA[
import org.papervision3d.objects.Cube;
//Do the imports
import org.papervision3d.objects.DisplayObject3D;
import org.papervision3d.cameras.Camera3D;
import org.papervision3d.scenes.Scene3D;
import org.papervision3d.objects.Plane;
import org.papervision3d.materials.BitmapMaterial;
import org.papervision3d.core.proto.MaterialObject3D;
public var scene:Scene3D;
public var camera:Camera3D;
public var posX:Number;
public var posY:Number;
public function handleCreationComplete():void
{
camera = new Camera3D( new DisplayObject3D() )
;//make a camera
camera.zoom = 20
;//zoom it
scene = new Scene3D( sceneTarget )
;//make my scene
//Add my first cube
var c:Cube = scene.addChild( new Cube(null,
15,
15,
200,
2,
2,
2) ,
"oneCube") as Cube;
//set the container of the cube...
//because I am using "Scene3D" the container isn't automatically created
c.container = sceneTarget;
addEventListener( Event.ENTER_FRAME , handleEnterFrame );
}
public function handleEnterFrame( event:Event ):void
{
posX = (mouseX / width) - 0.5;
posY = (mouseY / height) - 0.5;
var factor:Number = 50;
//get the cube
var c:Cube = scene.getChildByName(
"oneCube" ) as Cube;
//blur it
var blur:BlurFilter = new BlurFilter();
blur.blurX = Math.abs( factor * posX );
blur.blurY = Math.abs( factor * posY );
c.container.filters = [blur];
//spin it...
c.rotationX += factor * posY;
c.rotationY += factor * posX;
scene.renderCamera( camera );
}
]]>
</mx:Script>
<mx:Panel
width="100%"
height="100%"
verticalAlign="middle"
horizontalAlign="center"
>
<mx:Canvas
id="sceneTarget"
/>
</mx:Panel>
</mx:Application>...file attached to for your downloading pleasure...
yes, it is very simple, but I was learning how to work with filters...and nothing else! ;-)