Hi there,
I have a problem which is that when I create an explosion, whatever texture I use just shows as black.
I am using the following code (using the explo texture from walktest)
There are no errors about the texture not being found, so I know its not that thats the problem :
//Setup missile explosion ready for use
csRef<iGeneralFactoryState> fstate;
csRef<iEngine> engine = app->GetEngine();
csRef<iLoader> loader = app->GetLoader();
missile_explo_factory = engine->CreateMeshFactory ("crystalspace.mesh.object.explosion", "explosion");
if (!missile_explo_factory)
{
app->ReportError("Failed to load explosion mesh factory!");
}
if (!loader->LoadTexture ("explosion_texture", "img/explo.jpg"))
{
app->ReportError("Error loading 'explo' texture!");
}
//Create it
csRef<iMeshWrapper> explosion = app->GetEngine()->CreateMeshWrapper(missile_explo_factory, "explosion", sector, pos);
if (!explosion)
{
app->ReportError("Error creating explosion mesh!");
return;
}
explosion->SetZBufMode(CS_ZBUF_TEST);
explosion->SetRenderPriority (app->GetEngine()->GetAlphaRenderPriority ());
csRef<iParticleState> partstate= scfQueryInterface<iParticleState>(explosion->GetMeshObject());
csRef<iMaterialWrapper> mat = app->GetEngine()->GetMaterialList()->FindByName("explosion_texture");
partstate->SetMaterialWrapper (mat);
partstate->SetColor (csColor (1, 1, 0));
partstate->SetChangeSize (1.25);
partstate->SetSelfDestruct (3000);
partstate->SetChangeRotation (5.0f);
partstate->SetAlpha(0.5);
csRef<iExplosionState> expstate (
SCF_QUERY_INTERFACE (explosion->GetMeshObject (), iExplosionState));
expstate->SetParticleCount (100);
expstate->SetCenter (csVector3 (0, 0, 0));
expstate->SetPush (csVector3 (0, 0, 0));
expstate->SetNrSides (6);
expstate->SetPartRadius (0.15f);
expstate->SetLighting (false);
expstate->SetSpreadPos (0.6f);
expstate->SetSpreadSpeed (2.0f);
expstate->SetSpreadAcceleration (2.0f);
expstate->SetFadeSprites (500);
explosion->PlaceMesh ();
regards,
Kate