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