Resolve a merge issue

avinationmerge
Melanie 2010-02-08 22:44:17 +00:00
parent ad38450f9c
commit 0ad8046582
1 changed files with 87 additions and 80 deletions

View File

@ -715,88 +715,93 @@ namespace OpenSim.Data.MySQL
{ {
RegionMeta7WindlightData nWP = new RegionMeta7WindlightData(); RegionMeta7WindlightData nWP = new RegionMeta7WindlightData();
nWP.OnSave += StoreRegionWindlightSettings; nWP.OnSave += StoreRegionWindlightSettings;
lock (m_Connection)
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{ {
dbcon.Open();
string command = "select * from `regionwindlight` where region_id = ?regionID"; string command = "select * from `regionwindlight` where region_id = ?regionID";
MySqlCommand cmd = new MySqlCommand(command); using(MySqlCommand cmd = new MySqlCommand(command))
cmd.Parameters.AddWithValue("?regionID", regionUUID.ToString());
IDataReader result = ExecuteReader(cmd);
if (!result.Read())
{ {
//No result, so store our default windlight profile and return it cmd.Connection = dbcon;
nWP.regionID = regionUUID;
StoreRegionWindlightSettings(nWP); cmd.Parameters.AddWithValue("?regionID", regionUUID.ToString());
return nWP;
} IDataReader result = ExecuteReader(cmd);
else if (!result.Read())
{ {
UUID.TryParse(result["region_id"].ToString(), out nWP.regionID); //No result, so store our default windlight profile and return it
nWP.waterColor.X = Convert.ToSingle(result["water_color_r"]); nWP.regionID = regionUUID;
nWP.waterColor.Y = Convert.ToSingle(result["water_color_g"]); StoreRegionWindlightSettings(nWP);
nWP.waterColor.Z = Convert.ToSingle(result["water_color_b"]); return nWP;
nWP.waterFogDensityExponent = Convert.ToSingle(result["water_fog_density_exponent"]); }
nWP.underwaterFogModifier = Convert.ToSingle(result["underwater_fog_modifier"]); else
nWP.reflectionWaveletScale.X = Convert.ToSingle(result["reflection_wavelet_scale_1"]); {
nWP.reflectionWaveletScale.Y = Convert.ToSingle(result["reflection_wavelet_scale_2"]); UUID.TryParse(result["region_id"].ToString(), out nWP.regionID);
nWP.reflectionWaveletScale.Z = Convert.ToSingle(result["reflection_wavelet_scale_3"]); nWP.waterColor.X = Convert.ToSingle(result["water_color_r"]);
nWP.fresnelScale = Convert.ToSingle(result["fresnel_scale"]); nWP.waterColor.Y = Convert.ToSingle(result["water_color_g"]);
nWP.fresnelOffset = Convert.ToSingle(result["fresnel_offset"]); nWP.waterColor.Z = Convert.ToSingle(result["water_color_b"]);
nWP.refractScaleAbove = Convert.ToSingle(result["refract_scale_above"]); nWP.waterFogDensityExponent = Convert.ToSingle(result["water_fog_density_exponent"]);
nWP.refractScaleBelow = Convert.ToSingle(result["refract_scale_below"]); nWP.underwaterFogModifier = Convert.ToSingle(result["underwater_fog_modifier"]);
nWP.blurMultiplier = Convert.ToSingle(result["blur_multiplier"]); nWP.reflectionWaveletScale.X = Convert.ToSingle(result["reflection_wavelet_scale_1"]);
nWP.bigWaveDirection.X = Convert.ToSingle(result["big_wave_direction_x"]); nWP.reflectionWaveletScale.Y = Convert.ToSingle(result["reflection_wavelet_scale_2"]);
nWP.bigWaveDirection.Y = Convert.ToSingle(result["big_wave_direction_y"]); nWP.reflectionWaveletScale.Z = Convert.ToSingle(result["reflection_wavelet_scale_3"]);
nWP.littleWaveDirection.X = Convert.ToSingle(result["little_wave_direction_x"]); nWP.fresnelScale = Convert.ToSingle(result["fresnel_scale"]);
nWP.littleWaveDirection.Y = Convert.ToSingle(result["little_wave_direction_y"]); nWP.fresnelOffset = Convert.ToSingle(result["fresnel_offset"]);
UUID.TryParse(result["normal_map_texture"].ToString(), out nWP.normalMapTexture); nWP.refractScaleAbove = Convert.ToSingle(result["refract_scale_above"]);
nWP.horizon.X = Convert.ToSingle(result["horizon_r"]); nWP.refractScaleBelow = Convert.ToSingle(result["refract_scale_below"]);
nWP.horizon.Y = Convert.ToSingle(result["horizon_g"]); nWP.blurMultiplier = Convert.ToSingle(result["blur_multiplier"]);
nWP.horizon.Z = Convert.ToSingle(result["horizon_b"]); nWP.bigWaveDirection.X = Convert.ToSingle(result["big_wave_direction_x"]);
nWP.horizon.W = Convert.ToSingle(result["horizon_i"]); nWP.bigWaveDirection.Y = Convert.ToSingle(result["big_wave_direction_y"]);
nWP.hazeHorizon = Convert.ToSingle(result["haze_horizon"]); nWP.littleWaveDirection.X = Convert.ToSingle(result["little_wave_direction_x"]);
nWP.blueDensity.X = Convert.ToSingle(result["blue_density_r"]); nWP.littleWaveDirection.Y = Convert.ToSingle(result["little_wave_direction_y"]);
nWP.blueDensity.Y = Convert.ToSingle(result["blue_density_g"]); UUID.TryParse(result["normal_map_texture"].ToString(), out nWP.normalMapTexture);
nWP.blueDensity.Z = Convert.ToSingle(result["blue_density_b"]); nWP.horizon.X = Convert.ToSingle(result["horizon_r"]);
nWP.blueDensity.W = Convert.ToSingle(result["blue_density_i"]); nWP.horizon.Y = Convert.ToSingle(result["horizon_g"]);
nWP.hazeDensity = Convert.ToSingle(result["haze_density"]); nWP.horizon.Z = Convert.ToSingle(result["horizon_b"]);
nWP.densityMultiplier = Convert.ToSingle(result["density_multiplier"]); nWP.horizon.W = Convert.ToSingle(result["horizon_i"]);
nWP.distanceMultiplier = Convert.ToSingle(result["distance_multiplier"]); nWP.hazeHorizon = Convert.ToSingle(result["haze_horizon"]);
nWP.maxAltitude = Convert.ToUInt16(result["max_altitude"]); nWP.blueDensity.X = Convert.ToSingle(result["blue_density_r"]);
nWP.sunMoonColor.X = Convert.ToSingle(result["sun_moon_color_r"]); nWP.blueDensity.Y = Convert.ToSingle(result["blue_density_g"]);
nWP.sunMoonColor.Y = Convert.ToSingle(result["sun_moon_color_g"]); nWP.blueDensity.Z = Convert.ToSingle(result["blue_density_b"]);
nWP.sunMoonColor.Z = Convert.ToSingle(result["sun_moon_color_b"]); nWP.blueDensity.W = Convert.ToSingle(result["blue_density_i"]);
nWP.sunMoonColor.W = Convert.ToSingle(result["sun_moon_color_i"]); nWP.hazeDensity = Convert.ToSingle(result["haze_density"]);
nWP.sunMoonPosition = Convert.ToSingle(result["sun_moon_position"]); nWP.densityMultiplier = Convert.ToSingle(result["density_multiplier"]);
nWP.ambient.X = Convert.ToSingle(result["ambient_r"]); nWP.distanceMultiplier = Convert.ToSingle(result["distance_multiplier"]);
nWP.ambient.Y = Convert.ToSingle(result["ambient_g"]); nWP.maxAltitude = Convert.ToUInt16(result["max_altitude"]);
nWP.ambient.Z = Convert.ToSingle(result["ambient_b"]); nWP.sunMoonColor.X = Convert.ToSingle(result["sun_moon_color_r"]);
nWP.ambient.W = Convert.ToSingle(result["ambient_i"]); nWP.sunMoonColor.Y = Convert.ToSingle(result["sun_moon_color_g"]);
nWP.eastAngle = Convert.ToSingle(result["east_angle"]); nWP.sunMoonColor.Z = Convert.ToSingle(result["sun_moon_color_b"]);
nWP.sunGlowFocus = Convert.ToSingle(result["sun_glow_focus"]); nWP.sunMoonColor.W = Convert.ToSingle(result["sun_moon_color_i"]);
nWP.sunGlowSize = Convert.ToSingle(result["sun_glow_size"]); nWP.sunMoonPosition = Convert.ToSingle(result["sun_moon_position"]);
nWP.sceneGamma = Convert.ToSingle(result["scene_gamma"]); nWP.ambient.X = Convert.ToSingle(result["ambient_r"]);
nWP.starBrightness = Convert.ToSingle(result["star_brightness"]); nWP.ambient.Y = Convert.ToSingle(result["ambient_g"]);
nWP.cloudColor.X = Convert.ToSingle(result["cloud_color_r"]); nWP.ambient.Z = Convert.ToSingle(result["ambient_b"]);
nWP.cloudColor.Y = Convert.ToSingle(result["cloud_color_g"]); nWP.ambient.W = Convert.ToSingle(result["ambient_i"]);
nWP.cloudColor.Z = Convert.ToSingle(result["cloud_color_b"]); nWP.eastAngle = Convert.ToSingle(result["east_angle"]);
nWP.cloudColor.W = Convert.ToSingle(result["cloud_color_i"]); nWP.sunGlowFocus = Convert.ToSingle(result["sun_glow_focus"]);
nWP.cloudXYDensity.X = Convert.ToSingle(result["cloud_x"]); nWP.sunGlowSize = Convert.ToSingle(result["sun_glow_size"]);
nWP.cloudXYDensity.Y = Convert.ToSingle(result["cloud_y"]); nWP.sceneGamma = Convert.ToSingle(result["scene_gamma"]);
nWP.cloudXYDensity.Z = Convert.ToSingle(result["cloud_density"]); nWP.starBrightness = Convert.ToSingle(result["star_brightness"]);
nWP.cloudCoverage = Convert.ToSingle(result["cloud_coverage"]); nWP.cloudColor.X = Convert.ToSingle(result["cloud_color_r"]);
nWP.cloudScale = Convert.ToSingle(result["cloud_scale"]); nWP.cloudColor.Y = Convert.ToSingle(result["cloud_color_g"]);
nWP.cloudDetailXYDensity.X = Convert.ToSingle(result["cloud_detail_x"]); nWP.cloudColor.Z = Convert.ToSingle(result["cloud_color_b"]);
nWP.cloudDetailXYDensity.Y = Convert.ToSingle(result["cloud_detail_y"]); nWP.cloudColor.W = Convert.ToSingle(result["cloud_color_i"]);
nWP.cloudDetailXYDensity.Z = Convert.ToSingle(result["cloud_detail_density"]); nWP.cloudXYDensity.X = Convert.ToSingle(result["cloud_x"]);
nWP.cloudScrollX = Convert.ToSingle(result["cloud_scroll_x"]); nWP.cloudXYDensity.Y = Convert.ToSingle(result["cloud_y"]);
nWP.cloudScrollXLock = Convert.ToBoolean(result["cloud_scroll_x_lock"]); nWP.cloudXYDensity.Z = Convert.ToSingle(result["cloud_density"]);
nWP.cloudScrollY = Convert.ToSingle(result["cloud_scroll_y"]); nWP.cloudCoverage = Convert.ToSingle(result["cloud_coverage"]);
nWP.cloudScrollYLock = Convert.ToBoolean(result["cloud_scroll_y_lock"]); nWP.cloudScale = Convert.ToSingle(result["cloud_scale"]);
nWP.drawClassicClouds = Convert.ToBoolean(result["draw_classic_clouds"]); nWP.cloudDetailXYDensity.X = Convert.ToSingle(result["cloud_detail_x"]);
nWP.cloudDetailXYDensity.Y = Convert.ToSingle(result["cloud_detail_y"]);
nWP.cloudDetailXYDensity.Z = Convert.ToSingle(result["cloud_detail_density"]);
nWP.cloudScrollX = Convert.ToSingle(result["cloud_scroll_x"]);
nWP.cloudScrollXLock = Convert.ToBoolean(result["cloud_scroll_x_lock"]);
nWP.cloudScrollY = Convert.ToSingle(result["cloud_scroll_y"]);
nWP.cloudScrollYLock = Convert.ToBoolean(result["cloud_scroll_y_lock"]);
nWP.drawClassicClouds = Convert.ToBoolean(result["draw_classic_clouds"]);
}
} }
} }
return nWP; return nWP;
@ -842,9 +847,11 @@ namespace OpenSim.Data.MySQL
public void StoreRegionWindlightSettings(RegionMeta7WindlightData wl) public void StoreRegionWindlightSettings(RegionMeta7WindlightData wl)
{ {
lock (m_Connection) using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{ {
using (MySqlCommand cmd = m_Connection.CreateCommand()) dbcon.Open();
using (MySqlCommand cmd = dbcon.CreateCommand())
{ {
cmd.CommandText = "REPLACE INTO `regionwindlight` (`region_id`, `water_color_r`, `water_color_g`, "; cmd.CommandText = "REPLACE INTO `regionwindlight` (`region_id`, `water_color_r`, `water_color_g`, ";
cmd.CommandText += "`water_color_b`, `water_fog_density_exponent`, `underwater_fog_modifier`, "; cmd.CommandText += "`water_color_b`, `water_fog_density_exponent`, `underwater_fog_modifier`, ";