Fabrice
Hi, Did you look at this thread again?
Cheers
;j
On 30 Sep 2010, at 23:28, Fabrice3D wrote:
Hi justin,
I'll look at it when tomorrow, just arrived...
Good input in there (iphone hasn't loaded all message tho)
Was nice meeting you. :)
Fabrice
Sent from an iPhone missing Flash
On Sep 30, 2010, at 19:22, "[email protected]"
<[email protected]> wrote:
Hi Fabrice
It was nice to meet you at Flash on the beach, Rob introduced me.
We discussed briefly AWD file materials. Unfortunately I did not
have info to hand to get across some problems with awd materials I
have had, so let me try to explain maybe I misunderstood, you
seemed to suggest it was already fixed, I have looked at the SVN
briefly and the issues do not seem to be addressed for what I was
trying to explain, but I did not remember the details so I probably
did not manage to explain at the time and some of what you
mentioned I did not follow. Let me explain what I have been
looking at.
AWData loads AWD file and creates BSPtree to be used for
BSPCollision.
On line 248 of AWData
CentralMaterialLibrary.addMaterial(matBitmap, null, filename, line);
Ok not ideal... it's saving the material to a central library so we
can access it later....
1) but the filename is not the whole path? So you could easily
overwrite materials if you have a complex system.
2) It's passing null for the mesh, so there is no way to relate the
mesh and the material, since many BSPtree's only have a single
material it make sense that you may want a simple way to change it
or replace it with a null material, but would have no idea of the
current material used, replace material in BSPTree assumes you know
the material.
So as a quick fix, I store the material above this line...
if( filename != '' ) { var storeFileName:String = filename; var
storeMatBitmap: Material = matBitmap; }
Then making the material more available (line315 on svn of AWData...)
if (isBSP){
if( storeFileName != '' )
{
CentralMaterialLibrary.addTree( storeFileName, tree );
tree.storeMaterial = matBitmap;
}
_container = tree;
}else
Then in CentralMaterialLibrary I added these...
public static function addTree( id: String, tree: BSPTree ):void
{
CentralMaterialLibrary[id][1] = tree;
}
/**
* Returns a BSPTree for the given name reference in the library.
*/
public static function getBSPTreeFromMaterialName(id:String):BSPTree
{
if (CentralMaterialLibrary[id])
return CentralMaterialLibrary[id][1];
return null;
}
And in BSPTree I added quite a lot of stuff for my needs...
public var storeMaterial: Material;
public var _ghostMaterial: GhostMaterial = null;
private var _reveal: Boolean = true;
public function set reveal( reveal_: Boolean )
{
trace( 'setting reveal!' + reveal_ );
_reveal = reveal_;
if( _reveal == true )
{
trace('showing')
show();
}