void SceneManager::SetToOutdoor()
	{
		/*Main::Instance().GetOgreSceneMgr()->setSkyBox(true, "Skybox/LostValley");
		Main::Instance().GetOgreSceneMgr()->getSkyBoxNode()->getAttachedObject(0)->setVisibilityFlags( Ice::VisibilityFlags::V_SKY);
		Ogre::Light *Light = Main::Instance().GetOgreSceneMgr()->createLight("Light0");
		Light->setType(Ogre::Light::LT_DIRECTIONAL);
		Light->setDirection(0, -1, 0.9);
		Light->setDiffuseColour(2, 2, 2);
		Light->setSpecularColour(Ogre::ColourValue(1, 0.9, 0.6));*/
		
		if (!mWeatherController) mWeatherController = ICE_NEW WeatherController();
		SetTimeScale(mTimeScale);
		SetTime(11, 0);
		mIndoorRendering = false;

		if (!mWeatherController->GetCaelumSystem()->getSun()->getForceDisable())
			AIManager::Instance().RegisterLight(mWeatherController->GetCaelumSystem()->getSun()->getMainLight());
		else AIManager::Instance().RegisterLight(mWeatherController->GetCaelumSystem()->getMoon()->getMainLight());
	}
OMX_ERRORTYPE Clock::SetConfig(
        OMX_INDEXTYPE nParamIndex, 
        OMX_PTR pStructure)
{
    OMX_ERRORTYPE ret = OMX_ErrorNone;

    switch ((int)nParamIndex) {
        case OMX_IndexConfigTimeScale:
            ret = SetTimeScale((OMX_TIME_CONFIG_SCALETYPE*)pStructure);
            break;
        case OMX_IndexConfigTimeClockState:
            ret = SetState((OMX_TIME_CONFIG_CLOCKSTATETYPE*)pStructure);
            break;
        case OMX_IndexConfigTimeActiveRefClock:
            ret = SetRefClock((OMX_TIME_CONFIG_ACTIVEREFCLOCKTYPE*)pStructure);
            break;
        case OMX_IndexConfigTimeCurrentAudioReference:
            ret = SetRefTime((OMX_TIME_CONFIG_TIMESTAMPTYPE*)pStructure, OMX_TIME_RefClockAudio);
            break;
        case OMX_IndexConfigTimeCurrentVideoReference:
            ret = SetRefTime((OMX_TIME_CONFIG_TIMESTAMPTYPE*)pStructure, OMX_TIME_RefClockVideo);
            break;
        case OMX_IndexConfigTimeMediaTimeRequest:
            ret = MediaTimeRequest((OMX_TIME_CONFIG_MEDIATIMEREQUESTTYPE*)pStructure);
            break;
        case OMX_IndexConfigTimeClientStartTime:
            ret = SetStartTime((OMX_TIME_CONFIG_TIMESTAMPTYPE*)pStructure);
            break;
        case OMX_IndexConfigTimeVideoLate:
            ret = SetVideoLate((OMX_TIME_CONFIG_TIMEVIDEOLATE*)pStructure);
        default :
            ret = OMX_ErrorUnsupportedIndex;
            break;
    }

    return ret;
}
void CDmeTimeFrame::SetTimeScale( float flScale, DmeTime_t scaleCenter, bool bChangeDuration )
{
#ifdef _DEBUG
    DmeTime_t preCenterTime = ToChildMediaTime( scaleCenter, false );
#endif

    float ratio = m_Scale / flScale;
    int t = scaleCenter.GetTenthsOfMS() - m_Start;

    if ( bChangeDuration )
    {
        int newDuration = int( m_Duration * ratio );

        if ( scaleCenter.GetTenthsOfMS() != m_Start )
        {
            int newStart = int( ( m_Start - scaleCenter.GetTenthsOfMS() ) * ratio + scaleCenter.GetTenthsOfMS() );
            SetStartTime( DmeTime_t( newStart ) );
        }

        int newStart = m_Start;
        int newOffset = int( ( t + m_Offset ) * ratio + newStart - scaleCenter.GetTenthsOfMS() );
        SetTimeOffset( DmeTime_t( newOffset ) );
        SetDuration( DmeTime_t( newDuration ) );
    }
    else
    {
        int newOffset = int( ( t + m_Offset ) * ratio - t );
        SetTimeOffset( DmeTime_t( newOffset ) );
    }

    SetTimeScale( flScale );

#ifdef _DEBUG
    DmeTime_t postCenterTime = ToChildMediaTime( scaleCenter, false );
    Assert( abs( preCenterTime - postCenterTime ) <= DMETIME_MINDELTA );
#endif
}