void DeferredLight::SetAttenuation(float c, float b, float a)
{
    float outerRadius = mParentLight->getAttenuationRange();

    // There is attenuation? Set material accordingly
    if (c != 1.0f || b != 0.0f || a != 0.0f)
    {
        ENABLE_BIT(mPermutation, LightMaterialGenerator::MI_ATTENUATED);

        if (mParentLight->getType() == Ogre::Light::LT_POINT)
        {
            // Calculate radius from attenuation
            int thresholdLevel = 10;    // difference of 10-15 levels deemed unnoticeable
            float threshold = 1.0f / ((float)thresholdLevel / 256.0f);

            // Use quadratic formula to Determine outer radius
            c = c - threshold;
            float d = sqrt(b * b - 4.0f * a * c);
            outerRadius = (-2.0f * c) / (b + d);
            outerRadius *= 1.2f;
        }
    }
    else
    {
        DISABLE_BIT(mPermutation, LightMaterialGenerator::MI_ATTENUATED);
    }

    SetupGeometry(outerRadius);
}
HRESULT ColladaLoader::Run()
{
	StartLogging();

	if(!Initialize()) {
        StopLogging();
        return -1;
    } else {
        SetupShaders();
        SetupMatrices();
        SetupLights();
        SetupGeometry();
        MainLoop();
        Terminate();
        StopLogging();
    }

	return 0;

}