If dynamic material already exists, simply just reinitialize it.

--HG--
branch : gsoc2013-dfighter
hg/feature/gsoc2013-dfighter
dfighter1985 12 years ago
parent e99c1e2785
commit 80bcf2026a

@ -81,6 +81,7 @@ namespace NL3D
public: public:
CDynMaterial(); CDynMaterial();
~CDynMaterial(); ~CDynMaterial();
void reconstruct();
void clear(); void clear();
void serial( NLMISC::IStream &f ); void serial( NLMISC::IStream &f );
std::string getClassName(){ return "CDynMaterial"; } std::string getClassName(){ return "CDynMaterial"; }

@ -150,9 +150,7 @@ namespace NL3D
CDynMaterial::CDynMaterial() CDynMaterial::CDynMaterial()
{ {
SRenderPass *p = new SRenderPass(); reconstruct();
p->setName( "pass1" );
passes.push_back( p );
} }
CDynMaterial::~CDynMaterial() CDynMaterial::~CDynMaterial()
@ -160,6 +158,14 @@ namespace NL3D
clear(); clear();
} }
void CDynMaterial::reconstruct()
{
clear();
SRenderPass *p = new SRenderPass();
p->setName( "pass1" );
passes.push_back( p );
}
void CDynMaterial::clear() void CDynMaterial::clear()
{ {
std::vector< SRenderPass* >::iterator itr = passes.begin(); std::vector< SRenderPass* >::iterator itr = passes.begin();

@ -641,6 +641,8 @@ void CMaterial::createDynMat()
{ {
if( dynMat == NULL ) if( dynMat == NULL )
dynMat = new CDynMaterial(); dynMat = new CDynMaterial();
else
dynMat->reconstruct();
SRenderPass *p = dynMat->getPass( 0 ); SRenderPass *p = dynMat->getPass( 0 );

Loading…
Cancel
Save