I actually like the idea of a null material. :) you actually just need to copy a simple materail and avoid draw functions.
to apply however, you'd be better off to add a function that parses the entire main array centralLibrary to set these. plus if you keep a simple parallele array to this, you can restore at zero pain when you show it back. Fabrice On Sep 9, 2010, at 10:12 PM, [email protected] wrote: > As well as trying to hide the BSPTree, I am also having no luck in scaling > the AWD file at runtime. > > Is there a simple way of rescaling and then hiding a standard AWD file, so it > can be used inside a complex collada model? > > Cheers > > ;j > > On 9 Sep 2010, at 20:13, [email protected] wrote: > >> I am trying to hide a simple BSPTree's material when it is only used for BSP >> and a separate more complex model is used for the visual. >> >> My initial approach was to modify AWData to make it store the BSPTree with >> the material ( currently it seems to store null as the mesh ), but the >> material id name does not seem to be stored on the handle, so you have to >> trace out the name so after some modifications I was able to hack hiding.... >> >> (CentralMaterialLibrary.getBSPTreeFromMaterialName( 'building' ) as >> BSPTree).replaceMaterial(CentralMaterialLibrary.getMaterial( 'building' ), >> new MovieMaterial(new MovieClip()), true ); >> >> but this is probably not really cutting down on render. Looking in BSPTree >> I found I could directly modify the material of each face to reduce >> rendering, so my current solution is to add this method to BSPTree, when >> loaded I can access it via (AWData.handle as BSPTree).hide(); >> >> public function hide() >> { >> >> var loop:int = _faces.length; >> var face: Face; >> var wire: WireframeMaterial = new WireframeMaterial(); >> wire.wireAlpha = 0; >> for(var i:int = 0;i<loop;++i) >> { >> face = _faces[i]; >> face.back = null; >> // minimize drawn faces >> face.invert(); >> face.material = wire; >> >> } >> >> } >> >> I am considering creating a NullMaterial as currently when I set >> face.material = null it trys to be too helpful and instead renders a color >> wireframe, for the moment alpha simple wireframe inverted with no back is >> probably lowest overhead. >> >> Maybe I am missing something obvious, but if you try to visible false the >> whole BSPTree then I think it stops doing BSP collisions, maybe there is >> already a solution.... or a better approach. >> >> Cheers >> >> :j >> >> >
