So I call:

 initResourceMD2();

and here is the code for it, I might be missing something but this
code loaded the model before without the texture:

//Init Resource MD2
                private function initResourceMD2():void
                {
        
ResourceManager.instance.addEventListener(ResourceEvent.RESOURCE_RETRIEVED,
onResourceRetrieved);
                        
ResourceManager.instance.addEventListener(LoaderEvent.LOAD_ERROR,
onResourceLoadingError);
        
ResourceManager.instance.addEventListener(LoaderEvent.LOAD_MAP_ERROR,
onResourceMapsLoadingError);
                        ResourceManager.instance.getResource("buggy.md2");
                }

                private function onResourceLoadingError(e:LoaderEvent):void
                {
                        //
                }

                private function onResourceMapsLoadingError(e:LoaderEvent):void
                {
                        //
                }

                private function onResourceRetrieved(e:ResourceEvent):void
                {
                        //Loader
                        _mesh = Mesh(e.resource);

                        //MD2 Material
                        _md2Material = new BitmapMaterial(new 
Albedo().bitmapData);
                        _md2Material.normalMap = new Norm().bitmapData;
                        _md2Material.diffuseMethod = new 
EnvMapDiffuseMethod(_diffuseMap);
                        _md2Material.gloss = 100;
                        _md2Material.specular = 100;
                        _md2Material.ambientColor = 0x505060;

                        //MD2 Mesh Material
                        _mesh.material = _md2Material;

                        //MD2 Positions
                        _mesh.scaleX = 3;
                        _mesh.scaleY = 3;
                        _mesh.scaleZ = 3;
                        _mesh.rotationY = 90;
                        _mesh.y = 0;

                        //Cast Shadows
                        _mesh.castsShadows = true;

                        //Add MD2 Stage
                        _view.scene.addChild(_mesh);
                }

Am I doing something wrong again?

Thanks,
-Andrew


On Mar 2, 4:41 pm, Fabrice3D <[email protected]> wrote:
> Like in all engine versions; it can be nice to be able to set position of the 
> handle before its loaded or rotations.
> but you must wait that everything is surely loaded before do anything else.
> also now, we have greatly improved the loading, Means that when this event is 
> fired everything is parsed and loaded. that includes the maps.
>
> soon there will be parsing and loadingresource progresses events available 
> too.
>
> In the examples, like the head demo, the sources are embeded and the obj file 
> doesn't have material info(mtl)
> so then its different. You can use the parsedata method and you have it all 
> ok.
>
> Fabrice
>
> On Mar 2, 2011, at 10:22 PM, Andrew wrote:
>
> > Nope! That must be why. Ill rewrite it and test out using the
> > RETRIEVED listeners and let you know if that works.
>
> > On Mar 2, 3:30 pm, Fabrice3D <[email protected]> wrote:
> >> Do you do like this?
>
> >> [..]
> >> ResourceManager.instance.addEventListener(ResourceEvent.RESOURCE_RETRIEVED,
> >>  onResourceRetrieved);
> >> ResourceManager.instance.addEventListener(LoaderEvent.LOAD_ERROR, 
> >> onResourceLoadingError);
> >> ResourceManager.instance.addEventListener(LoaderEvent.LOAD_MAP_ERROR, 
> >> onResourceMapsLoadingError);
>
> >> ResourceManager.instance.getResource("mymd2url.md2" );
>
> >> }
>
> >> private function onResourceRetrieved(e : ResourceEvent) : void
> >> {
> >>         _mesh = Mesh(e.resource);
> >>         BitmapMaterial(_mesh.material).bitmapData = myDiffuseMap;
>
> >> Fabrice
>
> >> On Mar 2, 2011, at 7:53 PM, Andrew wrote:
>
> >>> I tried :
>
> >>> _meshMaterial = new BitmapMaterial(new Texture().bitmapData);
> >>> _mesh = Mesh(_resourceManager.getResource("assets/modelpack25/
> >>> generator.md2"));
> >>> _mesh.material = _meshMaterial;
>
> >>> It's still coming up white.
>
> >>> -Andrew
>
> >>> On Mar 2, 1:35 pm, Andrew <[email protected]> wrote:
> >>>> Hey, I have a quick questions about using MD2 Models and Applying
> >>>> Material.
>
> >>>> I noticed in the LoaderMD2Test.as that it uses the:
>
> >>>> var material : DefaultMaterialBase;
>
> >>>> material = DefaultMaterialBase(_mesh.modelMaterial);
>
> >>>> material.normalMap = new Norm().bitmapData;
> >>>> material.specularMap = new Spec().bitmapData;
> >>>> material.diffuseMethod = new EnvMapDiffuseMethod(_diffuseMap);
>
> >>>> Is the DefaultMaterialBase inheriting the skin that is used on
> >>>> the .MD2 model.
>
> >>>> I added another MD2 model and changed the skins but I'm not getting
> >>>> the skin to be applied.
>
> >>>> When I removed the normalMap, Spec, & Diffuse it's basically just a
> >>>> mesh with white.
>
> >>>> Can anyone lead me to get just the blank mesh with the default skin
> >>>> that is currently textured on it.
>
> >>>> I tried just using:
>
> >>>> var material : BitmapMaterial = new
> >>>> BitmapMaterial(Texture().bitmapData, true, false, true);
> >>>> material = BitmapMaterial(_mesh.material);
> >>>> material.normalMap = new Norm().bitmapData;
>
> >>>> Texture() is the class Embed associated with the regular texture. I'm
> >>>> sure im doing this completely wrong.
>
> >>>> Thanks,
> >>>> -Andrew

Reply via email to