Here is a little example of what i did, i hope it will help  !!!

package
        {
        import away3d.containers.ObjectContainer3D;
        import away3d.containers.View3D;
        import away3d.core.base.Vertex;
        import away3d.core.math.Number3D;
        import away3d.geom.Explode;
        import away3d.primitives.Plane;
                import away3d.primitives.ReflectivePlane;
        import away3d.primitives.Sphere;
        import flash.display.BlendMode;
        import flash.display.Sprite;
        import flash.events.Event;
        import flash.filters.BitmapFilterQuality;
        import flash.filters.BlurFilter;
        import flash.text.TextField;

        /**
         * ...
         * @author Ghislain Flandin
         */
        public class Main extends View3D
                {

                private var exploded:ObjectContainer3D;
                private var nbVertices:int;
                private var containerExploded:ObjectContainer3D;
                private var rayon:int = 100;

                private var t:TextField;
                private var amountRate:int = 12;

                                private var rP:ReflectivePlane;

                public function Main():void
                        {
                        if (stage) init();
                        else addEventListener(Event.ADDED_TO_STAGE,
init);

                        }

                private function init(e:Event = null):void
                        {
                        removeEventListener(Event.ADDED_TO_STAGE,
init);


                                                rP = new ReflectivePlane(this);
                                                rP.pushfront = true;
                                                rP.y = -250;
                                                rP.rotationX = 0;
                                                rP.segmentsW = rP.segmentsH = 6;
                                                rP.width = 600;
                                                rP.height = 600;

                                                //rP.rotationX = 90;
                                                /*rP.segmentsW = rP.segmentsH = 
6;
                                                rP.boundTolerance = 0;
                                                rP.reflectionAlpha = 1;
                                                rP.width = 600;
                                                rP.height = 600;
                                                rP.backgroundColor = 0xFF3399;
                                                rP.reflectionBlur = 0;
                                                rP.reflectionAlpha = 0.75;
                                                rP.distortionStrength = 25;
                                                rP.boundTolerance = 100;
                                                rP.distortionChannel = 
BitmapDataChannel.GREEN;
                                                rP.back = new 
WireColorMaterial(0xFFFFFF);*/
                                                scene.addChild(rP);


                        x = this.stage.stageWidth / 2;
                        y = this.stage.stageHeight / 2;

                        camera.z = -900;
                        camera.y = 0;

                        var plane:Plane = new Plane( { width:256,
height:91, segmentsW:8,segmentsH:7 ,rotationX:90} );
                        //scene.addChild(plane);

                        var exploder:Explode = new Explode(true,true);
                        exploded = exploder.apply(plane) as
ObjectContainer3D;

                        containerExploded = new ObjectContainer3D();
                        scene.addChild(containerExploded);
                        containerExploded.addChild(exploded);
                        //containerExploded.rotationX = 90;

                        //use a sphere to position my triangles
                        var sphere:Sphere = new Sphere( {segmentsW:11,
segmentsH:11,radius: rayon} );
                        //scene.addChild(sphere);

                        nbVertices = sphere.vertices.length;

                        for (var i:int = 0; i < nbVertices; i+=1)
                                {
                                var vertex:Vertex = sphere.vertices
[i];

                                exploded.children[i].x =
sphere.vertices[i].x;
                                exploded.children[i].bothsides = true;
                                exploded.children[i].y =
sphere.vertices[i].y;
                                exploded.children[i].z =
sphere.vertices[i].z;
                                exploded.children[i].ownCanvas=true;
                                exploded.children[i].lookAt(new
Number3D());
                                exploded.children[i].rotationX += 90;

                                                                //trace( 
exploded.children[i].rotationX +" - " +
exploded.children[i].rotationY +" - " + exploded.children
[i].rotationZ);
                                }

                        //this.stage.addChild(t);
                        addEventListener(Event.ENTER_FRAME,
enterFrame, false, 0, true);
                        }

                private function enterFrame(e:Event):void
                        {
                        containerExploded.rotationY += 2;

                        var min:Number = 0;

                        var filtre:Array = new Array();
                        var blur:BlurFilter = new BlurFilter();
                        blur.quality = BitmapFilterQuality.LOW;
                        filtre.push(blur);

                        for (var i:int = 0; i < nbVertices; i+=1)
                                {
                                var diff:Number =
containerExploded.distanceTo(camera) - exploded.children[i].distanceTo
(camera);

                                if (diff < -5)
                                        {
                                        var amount:Number = Math.abs
(diff / rayon) *amountRate;
                                        blur.blurX =
amount*amountRate;
                                        blur.blurY =
amount*amountRate;
                                        exploded.children[i].filters =
filtre;
                                        exploded.children[i].alpha = .
6
                                        //exploded.children
[i].blendMode = BlendMode.MULTIPLY;
                                        }
                                else
                                        {
                                        exploded.children[i].filters =
null;
                                        exploded.children[i].alpha =
1;
                                        }
                                }
                        render();
                        }
                }
        }



On 16 déc, 19:28, Ghislain Flandin <[email protected]> wrote:
> Hello !
>
> I have a problem with ReflectivePlane class which throws me an error
> at Runtime ...
>
> As i saw on another thread here, i'm think i'm not the only one
> (http://groups.google.com/group/away3d-dev/browse_thread/thread/
> 8ddbe50b68d2b12a/f98c68ec6f16a16e?hl=fr&lnk=gst&q=ReflectivePlane
> +AbstractRenderSession&pli=1)
>
> Do you think it could be fix soon ?
>
> Thanks for your help !!!

Reply via email to