In my experience it is virtually impossible to use [embedded] models -
they all fire multiple errors in parsing, but most files DO work when
loaded externally.
I would be very grateful if somebody could post an example of the
PROPER way to embed and parse a 3ds or obj file that has NO external
assets - eg. all geometry and textures are embedded. Interestingly, I
can get embedded models to "work" by just ignoring all the error
messages: ie: you get errors using the code below and yet the model
shows up just fine in the 3d, but loading/parsing generate all sorts
of error messages about out of index range in the events.
Is this the correct way of doing it?
[Embed (source = "foliage/tree1.obj", mimeType = "application/octet-
stream")]
public static const OBJ:Class;
[Embed (source="foliage/tree1.png")]
public static const TREETEXTURE:Class;
private var _container:ObjectContainer3D;
private var _material:BitmapMaterial;
private var _treemesh : Mesh;
_material = new BitmapMaterial(new TREETEXTURE().bitmapData);
_container = ObjectContainer3D(ResourceManager.instance.parseData(new
OBJ(),"head",true));
for (var i : int = 0; i < _container.numChildren; ++i)
{
_treemesh = Mesh(_container.getChildAt(i));
_treemesh.material = _material;
}
_view.scene.addChild(_container);
BTW the 3ds importer fails at *all* .3ds files exported by 3ds max
version 9, (external or internal). I can supply dozens of files that
don't load. I think that 100% of 3ds files as exported by 3dsmax9
cannot load. I know 3dsmax9 is a bit old, but I've tried well over 25
models and none load.
I've believe that I've tracked down the reason: max9 exports static
non-animated meshes with a NULL (0 byte) length for the animation. So
the animation "chunk" is there, but with zero bytes in it. The parser
crashes when reading the name of the animation because it doesn't
check to see if it is zero bytes long. This error existed in older
versions of away3d as well. Let me know and I will post a zip file
containing ten 3ds files that do not load properly in away3d that DO
load in other programs just fine.
Keep up the great work, thank THANK YOU, Fabrice! We are all very
grateful for all your hard work.
ChrisK aka McFunkypants