Contrary to the previous revisions this one had incorporate
substantial changes to the API - so I tried to merge it with other
breaking changes pending.
Old revision is still available at /svn/branches/oldscene and probably
will be supported some time - at least until it will be clear that new
revision didn't introduce any performance issue.
Now for the changes:
1) Repackaging
away3d.core.proto and away3d.core.geom are gone for the sake of
away3d.core.scene, away3d.core.mesh and away3d.core.sprite.
2) API isolation
Some of the fields and methods intended for in engine use only are
marked with arcane namespace. If you are sure you need to access these
fields or methods, call
import away3d.core.*;
use name arcane;
3) New meshes
Meshes are rewritten from scratch and -3D suffix is dropped for the
most mesh-related classes.
New Vertex class (ex-Vertex3D) - now an event is dispatched when it's
xyz change - so that Mesh's dimensions will be recalculated on each
vertex change.
New UV class (ex-UV) - now an event is dispatched when texture
coordinates change - so that texture mapping will be recalculated on
each uv change.
New Face class (ex-Face) now has the normal property - and also has
onchange notifiers.
New Mesh class now has three material - main material, outline
material and material for drawing the back faces. If you specify
outline material, mesh will track the contiguous faces.
Mesh also has bounding radius property and bounding box property - to
enable mesh dropping from the rendering completely and probably even
get the redraw regions.
Mesh's vertices property is now readonly and consist of all the
vertices of all faces - no need to add them manually.
Instead of
mesh.faces.push(new Face3D(...))
use
mesh.addFace(new Face(...));
Meshes now don't take material as the required first parameter
Instead of
new Sphere(WireColorMaterial(0x0000FF), {radius:200});
use
new Sphere({material:WireColorMaterial(0x0000FF), radius:200});
or
new Sphere({material:WireColorMaterial("blue"), radius:200});
or
new Sphere({material:"blue#", radius:200});
4) Reworked Object3D class
Now you can access not only the local transform (relative to
container), but also the tranform relative to the scene using world
(transform) and worldPosition properties.
Object3D's scene property returns the scene the object belongs to.
TransformChange and SceneChange events allow to track object movements and
object attachment and detachment from the scene.
Instead of using generic EventDispatcher interface, Object3D exposes
only well defined events subscribers.
Instead of
mesh.events.addEventListener(MouseEvent.MOUSE_MOVE, onMouseMove);
use
mesh.addOnMouseMove(onMouseMove);
Instead of
camera.lookAt(mesh);
use
camera.lookAt(mesh.position); // if mesh it top level object
or
camera.lookAt(mesh.worldPosition); // if mesh is in the container
5) ObjectContainer3D now has bounding radius and bounding box properties.
Instead of scale property use scale() method.
6) Light3D changed parameter initialization to init object
Instead of
new Light3D(0xFFFFFF, 0xFFFFFF, 0xFFFFFF);
use
new Light3D({ambient:0xFFFFFF, diffuse:0xFFFFFF, specular:0xFFFFFF});
or
new Light3D({color:0xFFFFFF});
or
new Light3D({color:"white"});
7) View3D changed parameter initialization to init object
Instead of
new View3D(scene, camera, renderer);
use
new View3D({scene:scene, camera:camera, renderer:renderer});
If you omit the scene parameter, new scene is created.
If you omit the camera parameter, new camera is created.
If you omit the renderer parameter, basic renderer is used.
Use {mouseZeroMove:true} if you need mouse move events to be launched
on each frame.
Use {mouseChildren:true} if you are going to use MovieClip sprites
that should react on mouse events.
8) Materials initialization changed to init objects
Instead of
new ColorMaterial(0xFFFFFF, 0.5);
use
new ColorMaterial(0xFFFFFF, {alpha:0.5});
or
new ColorMaterial("white", {alpha:0.5});
If you create a new mesh, instead of
{material:new ColorMaterial(0xFFFFFF)}
use
{material:0xFFFFFF}
or
{material:"blue"}
Instead of
new WireColorMaterial(0x0000FF, 0xFF0000, 0.5, 0.7, 3);
use
new WireColorMaterial(0x0000FF, {alpha:0.5, wirecolor:0xFF0000,
wirealpha:0.7, width:3});
or
new WireColorMaterial("blue", {alpha:0.5, wirecolor:"red",
wirealpha:0.7, width:3});
If you create a new mesh, instead of
{material:new WireColorMaterial(0x0000FF, 0x000000, 1, 1, 1)}
use
{material:"blue#"}
or
{material:"blue#black"}
or
{material:"blue#black|1"}
You can use "random" to get a random color.
If you use
{material:bitmapdata}
or
{material:BitmapAssetClass}
you will get a BitmapMaterial with the extracted bitmap.
9) MovieClipSprite class
Allows you to add interactive movieclips to the 3d scene.
10) LODObject and Sprite2DDir initialization changed. Sprite's now
have smooth property and store dimensions as Numbers, not as ints.
11) Obj file format loader added (tnx to Fabrice)
Max3ds and Md2still (w/o animation) loaders added (tnx to Philippe Ajoux)
All of them are far from complete so usually you have to play with
exporting options to load the successfully.
12) Object3DLoader class - responsible for loading meshes by the url.
You can subclass it to get a preloader 3D object on the scene while
the mesh is loading. When successfully loaded, mesh replaces preloader
inheriting its transform.
Usage:
addChild(Obj.load("turtle.obj", {scaling:0.1, z:100,
material:Asset.SeaTurtleImage, title:"Turtle"}));
13) Default Camera3D's zoom and focus changed to 10 and 100.
This means by default view is less skewed.
14) away3d.trash package contains old Mesh3D implementation and old
primitives - they coexist well on the same scene with the new Meshes -
but sooner or later are to be removed.
15) NoHitContainer removed, now you have mousable property of the
Object3D - mousable:false means the object won't recieve mouse event -
and in case of container neither of children will.
You can get the new revision here http://away3d.com/downloads
There may be are couple of places where I deoptimized code and forgot
or failed to optimize it back, so if you run into a speed regress -
please inform me.
wbr,
Alexander
Is latest rev in svn too?
Thanks,
Tim
Oh, man... all the changes make so much sense that I will really start
playing with away3D at last.
I believe the documentation will be a bit obsolete right now, isn't it?
Thanks a lot for the hard work!
PS: Oh, and thanks a lot for the lessons .zip, just what I needed.
--
Ricardo Cabello ~ Mr.doob
Designer + Developer
Web: http://mrdoob.com
RSS feed: http://mrdoob.com/rss.php
MSN/AIM: in...@mrdoob.com
Yes, but I can start writing the updates now that the major API
changes are through. There will still be Physics and Materials APIs
later, but the underlying methods shouldn't be changing too
dramatically now.
Any eta on updated docs or lessons for the new API, im particularly
after a good lesson on sprite2d, sprite2dDir and the MovieClipCLass.
Many thanks
Mark Fennell