Ejemplo n.º 1
0
void LLEnvManagerNew::updateWaterFromPrefs(bool interpolate)
{
	LLWaterParamManager& water_mgr = LLWaterParamManager::instance();
	LLSD target_water_params;

	// Determine new water settings based on user prefs.

	{
		// Fall back to default water.
		LLWaterParamSet default_water;
		water_mgr.getParamSet("Default", default_water);
		target_water_params = default_water.getAll();

		// <FS:Ansariel> Quickprefs integration
		FloaterQuickPrefs::updateParam(QP_PARAM_WATER, LLSD("Default"));
	}

	if (getUseRegionSettings())
	{
		// *TODO: make sure whether region settings belong to the current region?
		const LLSD& region_water_params = getRegionSettings().getWaterParams();
		if (region_water_params.size() != 0) // region has no water settings
		{
			LL_DEBUGS("Windlight") << "Applying region water" << LL_ENDL;
			target_water_params = region_water_params;

			// <FS:Ansariel> Quickprefs integration
			FloaterQuickPrefs::updateParam(QP_PARAM_WATER, LLSD(PRESET_NAME_REGION_DEFAULT));
		}
		else
		{
			LL_DEBUGS("Windlight") << "Applying default water" << LL_ENDL;
		}
	}
	else
	{
		std::string water = getWaterPresetName();
		LL_DEBUGS("Windlight") << "Applying water preset [" << water << "]" << LL_ENDL;
		LLWaterParamSet params;
		if (!water_mgr.getParamSet(water, params))
		{
			LL_WARNS() << "No water preset named " << water << ", falling back to defaults" << LL_ENDL;
			water_mgr.getParamSet("Default", params);

			// *TODO: Fix user preferences accordingly.
		}
		// <FS:Ansariel> Quickprefs integration
		else
		{
			FloaterQuickPrefs::updateParam(QP_PARAM_WATER, LLSD(water));
		}
		// </FS:Ansariel> Quickprefs integration

		target_water_params = params.getAll();
	}

	// Sync water with user prefs.
	water_mgr.applyParams(target_water_params, interpolate);
}
Ejemplo n.º 2
0
void LLEnvManagerNew::updateWaterFromPrefs(bool interpolate)
{
	LLWaterParamManager& water_mgr = LLWaterParamManager::instance();
	LLSD target_water_params;

	// Determine new water settings based on user prefs.

	{
		// Fall back to default water.
		LLWaterParamSet default_water;
		water_mgr.getParamSet("Default", default_water);
		target_water_params = default_water.getAll();
	}

	if (getUseRegionSettings())
	{
		// *TODO: make sure whether region settings belong to the current region?
		const LLSD& region_water_params = getRegionSettings().getWaterParams();
		if (region_water_params.size() != 0) // region has no water settings
		{
			LL_DEBUGS("Windlight") << "Applying region water" << LL_ENDL;
			target_water_params = region_water_params;
		}
		else
		{
			LL_DEBUGS("Windlight") << "Applying default water" << LL_ENDL;
		}
	}
	else
	{
		std::string water = getWaterPresetName();
		LL_DEBUGS("Windlight") << "Applying water preset [" << water << "]" << LL_ENDL;
		LLWaterParamSet params;
		if (!water_mgr.getParamSet(water, params))
		{
			llwarns << "No water preset named " << water << ", falling back to defaults" << llendl;
			water_mgr.getParamSet("Default", params);

			// *TODO: Fix user preferences accordingly.
		}
		target_water_params = params.getAll();
	}

	// Sync water with user prefs.
	water_mgr.applyParams(target_water_params, interpolate);
}
Ejemplo n.º 3
0
void WLFloaterWindLightSend::SendSettings(bool remove, int type, bool overrideParcels,
        LLWLParamSet mSky, LLWaterParamSet mWater,
        LLSD fade, LLSD minAlt, LLSD maxAlt,
        LLUUID normalMap)
{
    LLSD body;
    std::string url = gAgent.getRegion()->getCapability("DispatchWindLightSettings");
    if (!url.empty())
    {
        bool error;

        body["type"] = type;
        body["remove"] = remove;
        body["fade"] = fade;
        body["maxEffectiveAltitude"] = maxAlt;
        body["minEffectiveAltitude"] = minAlt;
        if(overrideParcels == true || overrideParcels == false)
            body["overrideParcels"] = overrideParcels;

        LLVector4 v = mSky.getVector("ambient", error);
        body["ambientX"] = v[0] / 3.0;
        body["ambientY"] = v[1] / 3.0;
        body["ambientZ"] = v[2] / 3.0;
        body["ambientW"] = v[3] / 3.0;

        body["eastAngle"] = mSky.getEastAngle();
        body["sunMoonPosition"] = mSky.getSunAngle();

        v = mSky.getVector("sunlight_color",error);
        body["sunMoonColorX"] = v[0] / 3.0;
        body["sunMoonColorY"] = v[1] / 3.0;
        body["sunMoonColorZ"] = v[2] / 3.0;
        body["sunMoonColorW"] = v[3] / 3.0;

        v = mSky.getVector("blue_horizon",error);
        body["horizonX"] = v[0] / 2.0;
        body["horizonY"] = v[1] / 2.0;
        body["horizonZ"] = v[2] / 2.0;
        body["horizonW"] = v[3] / 2.0;

        v = mSky.getVector("blue_density",error);
        body["blueDensityX"] = v[0];
        body["blueDensityY"] = v[1];
        body["blueDensityZ"] = v[2];

        v = mSky.getVector("haze_horizon",error);
        body["hazeHorizon"] = v[0];

        body["hazeDensity"] = mSky.getFloat("haze_density",error);
        body["cloudCoverage"] = mSky.getFloat("cloud_shadow",error);
        body["densityMultiplier"] = mSky.getFloat("density_multiplier",error) * 1000;
        body["distanceMultiplier"] = mSky.getFloat("distance_multiplier",error);
        body["maxAltitude"] = mSky.getFloat("max_y",error);

        v = mSky.getVector("cloud_color",error);
        body["cloudColorX"] = v[0];
        body["cloudColorY"] = v[1];
        body["cloudColorZ"] = v[2];
        body["cloudColorW"] = v[3];

        v = mSky.getVector("cloud_pos_density1",error);
        body["cloudXYDensityX"] = v[0];
        body["cloudXYDensityY"] = v[1];
        body["cloudXYDensityZ"] = v[2];

        v = mSky.getVector("cloud_pos_density2",error);
        body["cloudDetailXYDensityX"] = v[0];
        body["cloudDetailXYDensityY"] = v[1];
        body["cloudDetailXYDensityZ"] = v[2];

        v = mSky.getVector("glow",error);
        body["sunGlowSize"] = -((v[0]/ 20) - 2);
        body["sunGlowFocus"] = -v[2] / 5;

        body["cloudScale"] = mSky.getFloat("cloud_scale",error);
        body["sceneGamma"] = mSky.getFloat("gamma",error);
        body["cloudScrollX"] = mSky.getCloudScrollX() - 10;
        body["cloudScrollY"] = mSky.getCloudScrollY() - 10;
        body["cloudScrollXLock"] = !mSky.getEnableCloudScrollX();
        body["cloudScrollYLock"] = !mSky.getEnableCloudScrollY();
        body["starBrightness"] = mSky.getStarBrightness();
        body["drawClassicClouds"] = gHippoLimits->skyUseClassicClouds;
        body["classicCloudHeight"] = gSavedSettings.getF32("ClassicCloudHeight");
        body["classicCloudRange"] = gSavedSettings.getF32("ClassicCloudRange");

        LLVector3 vvv = mWater.getVector3("normScale",error);
        body["reflectionWaveletScaleX"] = vvv[0];
        body["reflectionWaveletScaleY"] = vvv[1];
        body["reflectionWaveletScaleZ"] = vvv[2];

        v = mWater.getVector4("waterFogColor",error);
        body["waterColorX"] = v[0] * 256.0;
        body["waterColorY"] = v[1] * 256.0;
        body["waterColorZ"] = v[2] * 256.0;
        body["waterColorW"] = v[3] * 256.0;

        body["waterFogDensityExponent"] = mWater.getFloat("waterFogDensity", error);
        body["underwaterFogModifier"] = mWater.getFloat("underWaterFogMod", error);

        body["fresnelScale"] = mWater.getFloat("fresnelScale", error);
        body["fresnelOffset"] = mWater.getFloat("fresnelOffset", error);
        body["refractScaleAbove"] = mWater.getFloat("scaleAbove", error);
        body["refractScaleBelow"] = mWater.getFloat("scaleBelow", error);
        body["blurMultiplier"] = mWater.getFloat("blurMultiplier", error);

        LLVector2 vv = mWater.getVector2("wave1Dir",error);
        body["littleWaveDirectionX"] = vv[0];
        body["littleWaveDirectionY"] = vv[1];

        vv = mWater.getVector2("wave2Dir",error);
        body["bigWaveDirectionX"] = vv[0];
        body["bigWaveDirectionY"] = vv[1];

        body["normalMapTexture"] = normalMap;

        LLHTTPClient::post(url, body, new LLHTTPClient::Responder());
    }
}
Ejemplo n.º 4
0
//If we get back a normal response, handle it here
void retrieveWindlightSettings::result(const LLSD& content)
{
	//Clear the lists first
	WLFloaterManager::mMinAltParamList.clear();
	WLFloaterManager::mMaxAltParamList.clear();
	WLFloaterManager::mFadeParamList.clear();
	WLFloaterManager::mWLParamList.clear();
	WLFloaterManager::mWaterParamList.clear();
	WLFloaterManager::mWaterNormalParamList.clear();

	for(LLSD::array_const_iterator wls = content["WindLight"].beginArray();
		wls != content["WindLight"].endArray();
		++wls)
	{	
		LLSD windLightLLSD = *wls;
		LLWaterParamSet* mWater;
		LLWLParamSet* mSky;
		LLUUID* mWaterNormal;

		mWater = new LLWaterParamSet();
		mSky = new LLWLParamSet();
		mWaterNormal = new LLUUID();

		mWater->set("waterFogColor",
			windLightLLSD["waterColorX"].asReal()   / 256.f,
			windLightLLSD["waterColorY"].asReal()   / 256.f,
			windLightLLSD["waterColorZ"].asReal()   / 256.f,
			windLightLLSD["waterColorW"].asReal()   / 256.f);
		mWater->set("waterFogDensity", windLightLLSD["waterFogDensityExponent"].asReal());
		mWater->set("underWaterFogMod", windLightLLSD["underwaterFogModifier"].asReal());
		mWater->set("normScale", windLightLLSD["reflectionWaveletScaleX"].asReal(),
			windLightLLSD["reflectionWaveletScaleY"].asReal(),
			windLightLLSD["reflectionWaveletScaleZ"].asReal());
		mWater->set("fresnelScale", windLightLLSD["fresnelScale"].asReal());
		mWater->set("fresnelOffset", windLightLLSD["fresnelOffset"].asReal());
		mWater->set("scaleAbove", windLightLLSD["refractScaleAbove"].asReal());
		mWater->set("scaleBelow", windLightLLSD["refractScaleBelow"].asReal());
		mWater->set("blurMultiplier", windLightLLSD["blurMultiplier"].asReal());
		mWater->set("wave2Dir", windLightLLSD["bigWaveDirectionX"].asReal(),
			windLightLLSD["bigWaveDirectionY"].asReal());
		mWater->set("wave1Dir", windLightLLSD["littleWaveDirectionX"].asReal(),
			windLightLLSD["littleWaveDirectionY"].asReal());
		mWaterNormal->parseUUID(windLightLLSD["normalMapTexture"].asUUID().asString(), mWaterNormal);

		mSky->setSunAngle(windLightLLSD["sunMoonPosition"].asReal());
		mSky->setEastAngle(windLightLLSD["eastAngle"].asReal());

		mSky->set("sunlight_color",
			windLightLLSD["sunMoonColorX"].asReal() * 3.0f,
			windLightLLSD["sunMoonColorY"].asReal() * 3.0f,
			windLightLLSD["sunMoonColorZ"].asReal() * 3.0f,
			windLightLLSD["sunMoonColorW"].asReal() * 3.0f);

		mSky->set("ambient",
			windLightLLSD["ambientX"].asReal() * 3.0f,
			windLightLLSD["ambientY"].asReal() * 3.0f,
			windLightLLSD["ambientZ"].asReal() * 3.0f,
			windLightLLSD["ambientW"].asReal() * 3.0f);

		mSky->set("blue_horizon",
			windLightLLSD["horizonX"].asReal() * 2.0f,
			windLightLLSD["horizonY"].asReal() * 2.0f,
			windLightLLSD["horizonZ"].asReal() * 2.0f,
			windLightLLSD["horizonW"].asReal() * 2.0f);

		mSky->set("blue_density",
			windLightLLSD["blueDensityX"].asReal(),
			windLightLLSD["blueDensityY"].asReal(),
			windLightLLSD["blueDensityZ"].asReal(),
			1.0);

		mSky->set("haze_horizon",
			windLightLLSD["hazeHorizon"].asReal(),
			windLightLLSD["hazeHorizon"].asReal(),
			windLightLLSD["hazeHorizon"].asReal(),
			1.f);

		mSky->set("haze_density",
			windLightLLSD["hazeDensity"].asReal(),
			0.f, 0.f, 1.f);

		mSky->set("cloud_shadow",
			windLightLLSD["cloudCoverage"].asReal(),
			0.f, 0.f, 1.f);

		mSky->set("density_multiplier",
			windLightLLSD["densityMultiplier"].asReal() / 1000.0f,
			0.f, 0.f, 1.f);

		mSky->set("distance_multiplier",
			windLightLLSD["distanceMultiplier"].asReal(),
			0.f, 0.f, 1.f);

		mSky->set("max_y",
			windLightLLSD["maxAltitude"].asReal(),
			0.f, 0.f, 1.f);

		mSky->set("cloud_color",
			windLightLLSD["cloudColorX"].asReal(),
			windLightLLSD["cloudColorY"].asReal(),
			windLightLLSD["cloudColorZ"].asReal(),
			windLightLLSD["cloudColorW"].asReal());

		mSky->set("cloud_pos_density1",
			windLightLLSD["cloudXYDensityX"].asReal(),
			windLightLLSD["cloudXYDensityY"].asReal(),
			windLightLLSD["cloudXYDensityZ"].asReal(),
			1.f);

		mSky->set("cloud_pos_density2",
			windLightLLSD["cloudDetailXYDensityX"].asReal(),
			windLightLLSD["cloudDetailXYDensityY"].asReal(),
			windLightLLSD["cloudDetailXYDensityZ"].asReal(),
			1.f);

		mSky->set("cloud_scale",
			windLightLLSD["cloudScale"].asReal(),
			0.f, 0.f, 1.f);

		mSky->set("gamma",
			windLightLLSD["sceneGamma"].asReal(),
			0.f, 0.f, 1.f);

		mSky->set("glow",
			(2 - windLightLLSD["sunGlowSize"].asReal()) * 20,
			0.f,
			-windLightLLSD["sunGlowFocus"].asReal() * 5,
			1.f);

		mSky->setCloudScrollX(windLightLLSD["cloudScrollX"].asReal() + 10.0f);
		mSky->setCloudScrollY(windLightLLSD["cloudScrollY"].asReal() + 10.0f);

		mSky->setEnableCloudScrollX(!windLightLLSD["cloudScrollXLock"].asBoolean());
		mSky->setEnableCloudScrollY(!windLightLLSD["cloudScrollYLock"].asBoolean());

		mSky->setStarBrightness(windLightLLSD["starBrightness"].asReal());

		mSky->set("fade", windLightLLSD["fade"].asReal());

		WLFloaterManager::mMinAltParamList[windLightLLSD["Name"].asString()] = windLightLLSD["minEffectiveAltitude"].asReal();
		WLFloaterManager::mMaxAltParamList[windLightLLSD["Name"].asString()] = windLightLLSD["maxEffectiveAltitude"].asReal();
		WLFloaterManager::mFadeParamList[windLightLLSD["Name"].asString()] = windLightLLSD["fade"].asReal();

		WLFloaterManager::mWLParamList[windLightLLSD["Name"].asString()] = mSky;
		WLFloaterManager::mWaterParamList[windLightLLSD["Name"].asString()] = mWater;
		WLFloaterManager::mWaterNormalParamList[windLightLLSD["Name"].asString()] = mWaterNormal;
	}
	WLFloaterManager::UpdateFloater();
}