Yeah, that is what I was doing previously, but this ended up being a
hard-coded kind of method since each model would have a specific
texture. I was looking for a more dynamic way of going about this as
we're going to have tons of individual models and textures.
Alright let me explain a bit more on how this is working. Currently I
have two classes running about being the Item class, which contains
all the model data. Then there is my own MatLibrary. I use the
MatLibrary to load texture's at run time and place them on the model.
However, this requires that I know which texture goes where on the
model, as there can be multiple texture's per single model. As is
such, I'd like to further separate the need to externally load
texture's when loading a model, as want to load it with the Collada
loader, not using the bitmap parameter.
Currently, this is whats happening in code:
On the load call:
public function loadModel(url:String):void
{
m_url = url;
var loader:Object3DLoader = Collada.load("Models/test/chair/
box_test.dae");
loader.addOnSuccess(onSuccess);
loader.addOnError(onError);
}
Pretty much just making a basic load call with Collada and setting up
event handlers.
On the load Success:
override protected function onSuccess(e:LoaderEvent)
{
m_model = (e.loader.handle as ObjectContainer3D);
m_model.ownCanvas =true;
m_model.renderer = renderer;
addChild(m_model);
for(var i = 0; i < m_textureNames.length; ++i)
{
fcsMaterialLibrary.getInstance().addEventListener(
"LoadComplete" +
m_textureNames[i], initMaterial);
}
fcsMaterialLibrary.getInstance().CreateMultiMaterial(m_model,
m_textureNames);
}
Turn the model that has been loaded into an object of the class, and
then continue on to load the Array of textures. The textures are hard-
coded for the time being, and I can get them to show up on the model
with some tricks. But what I'd like to do is remove the need for the
MaterialLibrary, and just have all texture's loaded on the collada
load without having the load the texture beforehand.
Thanks again in advance.
On Feb 18, 4:58 pm, "Joshua Granick" <[email protected]> wrote:
> FYI, you can parse on your own like this:
>
> Collada.parse (MeshClass, { material: MaterialClass } );
>
> or
>
> var material:BitmapMaterial = new BitmapMaterial (Cast.bitmap
> (MaterialClass), { smoothing: true } );
> Collada.parse (MeshClass, { material: material } );
>
> That works great if you're embedding. I don't use the built-in load method,
> but if you need the Collada and UV to be outside Flash at runtime, you can
> load them using a URLLoader for the mesh and Loader for the UV, then parse it
> like this. You wouldn't need to cast the material as a bitmap since that's
> how it comes from the Loader, and I think you could just pass the text value
> into the first parameter of the parse method
>
> Hope this helps you get up and running
>
> On Thu, 18 Feb 2010 13:28:38 -0800, Reinorvak <[email protected]>
> wrote:
> > Greetings again everyone,
>
> > Recently, I've come across the problem of trying to load a pre-
> > textured model into away3d using the Collada format. I believe I've
> > read on something like this before, but couldn't find the post so just
> > point me in the direction if its already been resolved.
>
> > Here's the thing. When I load the model into away3d, the parse
> > constantly gets stuck on the notifyProgress function. The parser will
> > first fire a notifySuccess, but then continues to call the
> > notifyProgess and continues parsing the collada file, after getting
> > out of its notifyProgress loop. This process will continue forever,
> > and I'll never get my models on screen.
>
> > However, should I not set the texture material onto the model, it
> > loads just fine and goes on its way. So, I'm not sure if this is a
> > problem with the .dae file, which it seems to be, or with something in
> > away3d. Either way, I need models to be able to load textures from
> > Maya using this collada format. Any help will be appreciated and
> > thanks in advance.
>
> > P.S. I'll keep looking on my own for the solution in the mean time.
>
> > Rein
>
>