In this example i want to show how to add material on models manually.
When creating a 3D modell in any 3D program, one can add bitmap materials to the surfaces, in a Collada.dae this is defined in library_images

< library_images>

I prefer to leave this empty and to add my material on my model manually – and this works fine using Dae.as and the method setChildMaterialByName(), which requires 2 parameter.

dae.setChildMaterialByName("Cylinder", bitmapMaterial_bump);
  • The first parameter is the geometry Elemet ID, which can be checked in the XML of the document under Visual Scene, and it repeats in all other elements like material, geometry, effect, images and all other relevant elements of a Collada. In my Collada the descriptions name is Cylinder. A meaningful name makes further use easier. Lets have a look at my Visual Scenen:
    < library_visual_scenes>
    	< visual_scene id="VisualSceneNode" name="Scene">
    		< node id="Cylinder" name="Cylinder" type="NODE">

    Debugging mode traces the following:

    INFO: DisplayObject3D: COLLADA_Scene 
    INFO: DisplayObject3D: Cylinder 

    COLLADA_Scene is the complete Collada model, the Cylinder is the geometry in the model.

  • The second Parameter is the Bitmap Material as BitmapData
    In my example one can change the skin with the buttons.

  • Leave a Reply

    XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

     
    Get Adobe Flash player