Most likely, when it comes out the new version of Adobe Flash, 3D libraries to "low level" as FIVe3D will end up badly! However, before the "Trash", here is an example of what can be achieved (with the latest release 2.1):
The code of the demo above is quite articulate, so I do not propose entirely online. Insertion, however, some interesting pieces of code.
Update: for the source click here
A container 3D
The first interesting thing is the ability to create (as is the case with Papervision3D and under normal operations with the MovieClip in Flash) containers of 3D objects. To create the cube, in fact, I created a container object __cube and to this I added the faces of the cube!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | / * ** @ Name: initCube () * / initCube ( ) : void { protected function initCube (): void { ; __cube Sprite3D = new (); ; __cube. rotationX = 40; 40 ; __cube. rotationY = - 40; = false ; __cube. mouseChildren = false; = [ ( new BlurFilter ( 2 , 2 , BitmapFilterQuality . HIGH ) ) ] ; __cube. filters = [(new BlurFilter (2, 2, BitmapFilterQuality . HIGH))]; ( __cube ) ; __scene. addChild (__cube); , 0 , - 150 , 0 , 0 , 0 ) ; createFace (0, 0, - 150, 0, 0, 0); , 0 , 0 , 0 , - 90 , 0 ) ; createFace (150, 0, 0, 0, - 90, 0); , 0 , 150 , 0 , 180 , 0 ) ; createFace (0, 0, 150, 0, 180, 0); 150 , 0 , 0 , 0 , 90 , 0 ) ; createFace (- 150, 0, 0, 0, 90, 0); , - 150 , 0 , - 90 , 0 , 0 ) ; createFace (0, - 150, 0, - 90, 0, 0); , 150 , 0 , 90 , 0 , 0 ) ; createFace (0, 150, 0, 90, 0, 0); } |
, e all'interno di __cube aggiungo le “facce”: __cube is added to the scene __scene , and within __cube add the "faces":
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | / * ** @ Name: createFace () * / createFace ( x : Number , y : Number , z : Number , createFace protected function (x: Number , y: Number , z: Number , , rotationy : Number , rotationz : Number ) : void { rotationX: Number , rotationY: Number , rotationZ: Number ): void { Sprite3D = new Sprite3D ( ) ; var face: Sprite3D Sprite3D = new (); beginFill ( 0xff0000 ) ; face. graphics3D. beginFill (0xFF0000); drawRect ( - 150 , - 150 , 300 , 300 ) ; face. graphics3D. drawRect (- 150, - 150, 300, 300); endFill ( ) ; face. graphics3D. endFill (); = x ; face. x = x; = y ; face. y = y; face. z = z; face. rotationX = rotationX; face. rotationY = rotationY; face. rotationZ = rotationZ; ; face. singleSided = true; ; face. flatShaded = true; ( face ) ; __cube. addChild (face); } |
The scene, of course, is the classic one, with the added use of the parameter ambientLightIntensity :
1 2 3 4 5 6 7 8 9 10 11 | / * ** @ Name: initScene () * / initScene ( ) : void { protected function initScene (): void { ; __scene Scene3D = new (); = stage . stageWidth / 2 ; __scene. x = internship. stageWidth / 2; = stage . stageHeight / 2 ; __scene. y = internship. stageHeight / 2; ; __scene. viewDistance = 400; ; __scene. ambientLightIntensity = 1; __scene ) ; addChild (__scene); } |










FIVe3D: effects of a cube! Waiting for Flash 10 ...
Most likely, when it comes out the new version of Adobe Flash, 3D libraries to "low level" as FIVe3D will end up badly! However, before the "Trash", here is an example of what can be achieved (with the latest release 2 ...
Hi all,
Have you seen this amazing 3D engine for flash player?
http://www.sophie3d.com