Hey everyone.
I just started working with away3D a few days ago, so this might be a very simple question.
I am currently trying to load a model via the Loader3D functionality.
The model loads fine, however, the texture / material does not.
This is how I load the model.
Parsers.enableAllBundled();
m_Loader3D = new Loader3D();
m_Loader3D.addEventListener(LoaderEvent.RESOURCE_COMPLETE, onResourceComplete);
m_Loader3D.addEventListener(LoaderEvent.LOAD_ERROR, onLoadError);
m_Loader3D.load( new URLRequest('../../GameApp/assets/models/icecube/ice_cube.obj') );
Gathering from the examples this should automatically load the texture as well? I have to manually apply a ColorMaterial in order to see the model.
I tried loading a texture and apply it to the mesh, unfortunately to no avail.
[Embed(source="/../../JeligniteApp/assets/models/icecube/ice04.png")]
private var Ice04:Class;
and in onResourceComplete (the following approach works if I apply a ColorMaterial, not when using a BitmapMaterial)
var IceCubeBitmap : Bitmap = new Ice04();
var IceCubeMaterial : BitmapMaterial = new BitmapMaterial( IceCubeBitmap.bitmapData );
var nc : Number = m_Loader3D.numChildren;
for (var i : Number = 0; i < nc; i++)
{
var Mesh : Mesh = Mesh(m_Loader3D.getChildAt(i));
Mesh.material = IceCubeMaterial;
}
What could I be doing wrong?
Thanks in advance for your support!
(I have attached the file in question, just in case)