Ok thanks but it doesn't seem to be working ... Reading the simpleShadow Class , i saw : "this class generate a projected shadow. Not suitable if shadows need to be updated at runtime in scenes with lots of polygons. "
On 18 déc, 12:57, Fabrice3D <[email protected]> wrote: > may be update before render... > > Note that the update method was experimental and hasn't been tested > very much > (very far down on my todo list) > if the tip above doesn't help, try rotate the cube 45,45, before > declare the simpleshadow instance > this way the plane will have the largest possible area and would not > need a resizing for both map and plane > > Fabrice > > On Dec 18, 2009, at 12:33 PM, Ghislain Flandin wrote: > > > Hello !! > > > I'm again here about SimpleShadow ... > > > I want to add a simple shadow on a cube but i have a rendering > > problem ... > > > My shadow is truncated : > > > 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.geom.Mirror; > > import away3d.materials.ColorMaterial; > > import away3d.materials.utils.SimpleShadow; > > import away3d.primitives.Cube; > > import away3d.primitives.Plane; > > import away3d.primitives.ReflectivePlane; > > import away3d.primitives.Sphere; > > import flash.display.Bitmap; > > import flash.display.BitmapData; > > import flash.display.BlendMode; > > import flash.display.Sprite; > > import flash.display.StageAlign; > > import flash.display.StageScaleMode; > > import flash.events.Event; > > import flash.filters.BitmapFilterQuality; > > import flash.filters.BlurFilter; > > import flash.geom.Matrix; > > import flash.geom.Rectangle; > > import flash.text.TextField; > > > /** > > * ... > > * @author Ghislain Flandin > > */ > > public class Main extends View3D > > { > > private var cube:Cube; > > private var rP:ReflectivePlane; > > private var ss:SimpleShadow; > > > public function Main():void > > { > > if (stage) init(); > > else addEventListener(Event.ADDED_TO_STAGE, > > init); > > } > > > private function init(e:Event = null):void > > { > > this.stage.scaleMode = StageScaleMode.NO_SCALE; > > this.stage.align = StageAlign.TOP_LEFT; > > > removeEventListener(Event.ADDED_TO_STAGE, init); > > > x = this.stage.stageWidth / 2; > > y = this.stage.stageHeight / 2; > > > camera.z = -900; > > camera.y = 100; > > > cube = new Cube(); > > scene.addChild(cube); > > > addReflection(); > > addEventListener(Event.ENTER_FRAME, enterFrame, > > false, 0, true); > > } > > > private function addReflection():void > > { > > ss = new SimpleShadow(cube, 0x33666666, > > 5,-200,800) > > ss.apply(scene); > > } > > > private function enterFrame(e:Event):void > > { > > var diffX:Number = (this.stage.mouseX - > > Math.round > > (this.stage.stageWidth / 2)) / Math.round(this.stage.stageWidth / 2); > > var diffY:Number = (this.stage.mouseY - > > Math.round > > (this.stage.stageHeight/ 2)) / Math.round(this.stage.stageHeight / 2); > > > cube.rotationX = -diffY * 270; > > cube.rotationY = diffX * 180; > > > render(); > > ss.update(); > > } > > } > > } > > > is there a way to avoid it ? > > > Thanks for your help ! > > > Ghislain
