Ejemplo n.º 1
0
unsigned int psLight::AttachLight(const char* name, const csVector3& pos,
  	float radius, const csColor& colour, csRef<iMeshWrapper> mw)
{
    baseColour = colour;
    csString lightName = name;
    lightName.Append("_%u", genUniqueID);
    light = engine->CreateLight(lightName, pos, radius, colour, CS_LIGHT_DYNAMICTYPE_DYNAMIC);
    light->SetAttenuationMode(CS_ATTN_INVERSE);

    // Attach to mesh.
    light->QuerySceneNode()->SetParent(mw->QuerySceneNode());

    csString sname(mw->GetMovable()->GetSectors()->Get(0)->QueryObject()->GetName());
    if(sname.Find("room") == 0)
    {
        // Add to the podium sector.
        podium = engine->GetSectors()->FindByName("room");
        if(podium.IsValid()) podium->GetLights()->Add(light);
    }

    lastTime = vclock->GetCurrentTicks();

    return ++genUniqueID;
}