Beispiel #1
0
	void Environment::Sky::setWeather(const Weather& weather)
	{
		_skyx->setTimeMultiplier(weather.timeMultiplier);
		_basiccontroller->setTime(weather.time);
		_basiccontroller->setMoonPhase(weather.moonPhase);
		_skyx->getAtmosphereManager()->setOptions(weather.atmosphereOpt);

		// Layered clouds
		if(weather.layeredClouds)
		{
			// Create layer cloud
			if (_skyx->getCloudsManager()->getCloudLayers().empty())
			{
				_skyx->getCloudsManager()->add(SkyX::CloudLayer::Options(/* Default options */));
			}
		}
		else
		{
			// Remove layer cloud
			if (!_skyx->getCloudsManager()->getCloudLayers().empty())
			{
				_skyx->getCloudsManager()->removeAll();
			}
		}

		_skyx->getVCloudsManager()->setWindSpeed(weather.vcWindSpeed);
		_skyx->getVCloudsManager()->setAutoupdate(weather.vcAutoupdate);

		SkyX::VClouds::VClouds* vclouds = _skyx->getVCloudsManager()->getVClouds();

		vclouds->setWindDirection(weather.vcWindDir);
		vclouds->setAmbientColor(weather.vcAmbientColor);
		vclouds->setLightResponse(weather.vcLightResponse);
		vclouds->setAmbientFactors(weather.vcAmbientFactors);
		vclouds->setWheater(weather.vcWheater.x, weather.vcWheater.y, false);

		if (weather.volumetricClouds)
		{
			// Create VClouds
			if (!_skyx->getVCloudsManager()->isCreated())
			{
				// SkyX::MeshManager::getSkydomeRadius(...) works for both finite and infinite(=0) camera far clip distances
				_skyx->getVCloudsManager()->create(_skyx->getMeshManager()->getSkydomeRadius(Application::deaultCam));
			}
		}
		else
		{
			// Remove VClouds
			if (_skyx->getVCloudsManager()->isCreated())
			{
				_skyx->getVCloudsManager()->remove();
			}
		}

		vclouds->getLightningManager()->setEnabled(weather.vcLightnings);
		vclouds->getLightningManager()->setAverageLightningApparitionTime(weather.vcLightningsAT);
		vclouds->getLightningManager()->setLightningColor(weather.vcLightningsColor);
		vclouds->getLightningManager()->setLightningTimeMultiplier(weather.vcLightningsTM);

		_skyx->update(0);
	}
Beispiel #2
0
void setPreset(const SkyXSettings& preset)
{
	mSkyX->setTimeMultiplier(preset.timeMultiplier);
	mBasicController->setTime(preset.time);
	mBasicController->setMoonPhase(preset.moonPhase);
	mSkyX->getAtmosphereManager()->setOptions(preset.atmosphereOpt);

	// Layered clouds
	if (preset.layeredClouds)
	{
		// Create layer cloud
		if (mSkyX->getCloudsManager()->getCloudLayers().empty())
		{
			mSkyX->getCloudsManager()->add(SkyX::CloudLayer::Options(/* Default options */));
		}
	}
	else
	{
		// Remove layer cloud
		if (!mSkyX->getCloudsManager()->getCloudLayers().empty())
		{
			mSkyX->getCloudsManager()->removeAll();
		}
	}

	mSkyX->getVCloudsManager()->setWindSpeed(preset.vcWindSpeed);
	mSkyX->getVCloudsManager()->setAutoupdate(preset.vcAutoupdate);

	SkyX::VClouds::VClouds* vclouds = mSkyX->getVCloudsManager()->getVClouds();

	vclouds->setWindDirection(preset.vcWindDir);
	vclouds->setAmbientColor(preset.vcAmbientColor);
	vclouds->setLightResponse(preset.vcLightResponse);
	vclouds->setAmbientFactors(preset.vcAmbientFactors);
	vclouds->setWheater(preset.vcWheater.x, preset.vcWheater.y, false);

	if (preset.volumetricClouds)
	{
		// Create VClouds
		if (!mSkyX->getVCloudsManager()->isCreated())
		{
			// SkyX::MeshManager::getSkydomeRadius(...) works for both finite and infinite(=0) camera far clip distances
			mSkyX->getVCloudsManager()->create(mSkyX->getMeshManager()->getSkydomeRadius(mCameras[0]));
		}
	}
	else
	{
		// Remove VClouds
		if (mSkyX->getVCloudsManager()->isCreated())
		{
			mSkyX->getVCloudsManager()->remove();
		}
	}

	vclouds->getLightningManager()->setEnabled(preset.vcLightnings);
	vclouds->getLightningManager()->setAverageLightningApparitionTime(preset.vcLightningsAT);
	vclouds->getLightningManager()->setLightningColor(preset.vcLightningsColor);
	vclouds->getLightningManager()->setLightningTimeMultiplier(preset.vcLightningsTM);

	mTextArea->setCaption(buildInfoStr());

	mSkyX->update(0);
}
Beispiel #3
0
void setSkyXPreset(int presetNo, SkyX::SkyX* skyX, SkyX::BasicController* controller, Ogre::Camera* camera)
{
	const SkyXSettings& preset = mPresets[presetNo];
	skyX->setTimeMultiplier(preset.timeMultiplier);
	controller->setTime(preset.time);
	controller->setMoonPhase(preset.moonPhase);
	skyX->getAtmosphereManager()->setOptions(preset.atmosphereOpt);

	// Layered clouds
	if (preset.layeredClouds)
	{
		// Create layer cloud
		if (skyX->getCloudsManager()->getCloudLayers().empty())
		{
			skyX->getCloudsManager()->add(SkyX::CloudLayer::Options(/* Default options */));
		}
	}
	else
	{
		// Remove layer cloud
		if (!skyX->getCloudsManager()->getCloudLayers().empty())
		{
			skyX->getCloudsManager()->removeAll();
		}
	}

	skyX->getVCloudsManager()->setWindSpeed(preset.vcWindSpeed);
	skyX->getVCloudsManager()->setAutoupdate(preset.vcAutoupdate);

	SkyX::VClouds::VClouds* vclouds = skyX->getVCloudsManager()->getVClouds();

	vclouds->setWindDirection(preset.vcWindDir);
	vclouds->setAmbientColor(preset.vcAmbientColor);
	vclouds->setLightResponse(preset.vcLightResponse);
	vclouds->setAmbientFactors(preset.vcAmbientFactors);
	vclouds->setWheater(preset.vcWheater.x, preset.vcWheater.y, false);

	if (preset.volumetricClouds)
	{
		// Create VClouds
		if (!skyX->getVCloudsManager()->isCreated())
		{
			// SkyX::MeshManager::getSkydomeRadius(...) works for both finite and infinite(=0) camera far clip distances
			skyX->getVCloudsManager()->create(skyX->getMeshManager()->getSkydomeRadius(camera));
		}
	}
	else
	{
		// Remove VClouds
		if (skyX->getVCloudsManager()->isCreated())
		{
			skyX->getVCloudsManager()->remove();
		}
	}

	vclouds->getLightningManager()->setEnabled(preset.vcLightnings);
	vclouds->getLightningManager()->setAverageLightningApparitionTime(preset.vcLightningsAT);
	vclouds->getLightningManager()->setLightningColor(preset.vcLightningsColor);
	vclouds->getLightningManager()->setLightningTimeMultiplier(preset.vcLightningsTM);

	skyX->update(0);
}