Exemplo n.º 1
0
//---------------------------------------------------------------------------------
bool CCaelumEditor::_setCloudsHeight(OgitorsPropertyBase* property, const Ogre::Real& value)
{
    Caelum::CloudSystem *clouds = mHandle->getCloudSystem();
    Caelum::FlatCloudLayer *layer = clouds->getLayer(property->getTag());
    layer->setHeight(value);

    return true;
}
Exemplo n.º 2
0
//--------------------------------------------------------------------------------------------------
bool CCaelumEditor::_createSky(Ogre::SceneManager *mngr, Ogre::Camera *cam)
{
    Caelum::CaelumSystem::CaelumComponent componentMask;
    componentMask = static_cast<Caelum::CaelumSystem::CaelumComponent> (
                Caelum::CaelumSystem::CAELUM_COMPONENT_SUN |                
                Caelum::CaelumSystem::CAELUM_COMPONENT_MOON |
                Caelum::CaelumSystem::CAELUM_COMPONENT_SKY_DOME |
                Caelum::CaelumSystem::CAELUM_COMPONENT_POINT_STARFIELD |
                 Caelum::CaelumSystem::CAELUM_COMPONENT_CLOUDS |
             0);

    mSceneManager = mngr;
    mHandle = new Caelum::CaelumSystem(Ogre::Root::getSingletonPtr(), mngr,componentMask);

    mHandle->setManageSceneFog(false);
    mHandle->notifyCameraChanged(cam);
    mHandle->getSkyDome()->setQueryFlags(0);
    mHandle->getSkyDome()->setVisibilityFlags(0x80000000);
    mHandle->forceSubcomponentQueryFlags(0);
    mHandle->forceSubcomponentVisibilityFlags(0x80000000);

    mHandle->getUniversalClock()->setGregorianDateTime(mClockYear->get(),mClockMonth->get(),mClockDay->get(),mClockHour->get(),mClockMinute->get(),mClockSecond->get());
    mHandle->getUniversalClock()->setTimeScale(mClockSpeed->get());
    mHandle->setObserverLongitude(Ogre::Degree(mLongitude->get()));
    mHandle->setObserverLatitude(Ogre::Degree(mLatitude->get()));
    mHandle->setManageSceneFog(mFogManage->get());
    mHandle->setGlobalFogDensityMultiplier(mFogDensityMultiplier->get());
    
    Caelum::BaseSkyLight *sun = mHandle->getSun();
    sun->setAmbientMultiplier(mSunAmbientMultiplier->get());
    sun->setDiffuseMultiplier(mSunDiffuseMultiplier->get());
    sun->setSpecularMultiplier(mSunSpecularMultiplier->get());
    mHandle->getSun()->setAutoDisable(mSunAutoDisable->get());
    mHandle->getSun()->getMainLight()->setCastShadows(mSunCastShadow->get());
    mHandle->getSun()->getMainLight()->setAttenuation(mSunAttenuationDistance->get(),mSunAttenuationConstantMultiplier->get(),mSunAttenuationLinearMultiplier->get(),mSunAttenuationConstantMultiplier->get());

    Caelum::BaseSkyLight *moon = mHandle->getMoon();
    moon->setAmbientMultiplier(mMoonAmbientMultiplier->get());
    moon->setDiffuseMultiplier(mMoonDiffuseMultiplier->get());
    moon->setSpecularMultiplier(mMoonSpecularMultiplier->get());
    mHandle->getMoon()->setAutoDisable(mMoonAutoDisable->get());
    mHandle->getMoon()->getMainLight()->setCastShadows(mMoonCastShadow->get());
    mHandle->getMoon()->getMainLight()->setAttenuation(mMoonAttenuationDistance->get(),mMoonAttenuationConstantMultiplier->get(),mMoonAttenuationLinearMultiplier->get(),mMoonAttenuationConstantMultiplier->get());

    
    Caelum::PointStarfield *stars = mHandle->getPointStarfield();
    stars->setMagnitudeScale( mStarsMagnitudeScale->get() );
    stars->setMag0PixelSize( mStarsMag0PixelSize->get() );
    stars->setMinPixelSize( mStarsMinPixelSize->get() );
    stars->setMaxPixelSize( mStarsMaxPixelSize->get() );
    mHandle->setEnsureSingleLightSource( mLightingSingleLightSource->get() );
    mHandle->setEnsureSingleShadowSource( mLightingSingleShadowSource->get() );
    mHandle->setManageAmbientLight( mLightingManageAmbientLight->get() );
    mHandle->setMinimumAmbientLight( mLightingMinimumAmbientLight->get() );

    Caelum::CloudSystem *clouds = mHandle->getCloudSystem();
    if(!clouds) 
    {
        clouds = new Caelum::CloudSystem(mSceneManager,mHandle->getCaelumCameraNode());
        mHandle->setCloudSystem(clouds);
    }

    clouds->clearLayers();
    clouds->getLayerVector().clear();

    for(int i = 0;i < 3;i++)
    {
        Caelum::FlatCloudLayer *layer = clouds->createLayer();
        layer->setVisibilityFlags(mCloudsEnabled[i]->get() == true?0xFFFFFFFF:0);
        layer->setQueryFlags(0);
        layer->setCloudCover(mCloudsCoverage[i]->get());
        layer->setHeight(mCloudsHeight[i]->get());
        layer->setCloudSpeed(mCloudsSpeed[0]->get());
    }

    return true;
}