Merge branch 'master' of /home/opensim/var/repo/opensim
commit
d343ecfa82
|
@ -719,95 +719,99 @@ namespace OpenSim.Data.MySQL
|
||||||
RegionLightShareData nWP = new RegionLightShareData();
|
RegionLightShareData nWP = new RegionLightShareData();
|
||||||
nWP.OnSave += StoreRegionWindlightSettings;
|
nWP.OnSave += StoreRegionWindlightSettings;
|
||||||
|
|
||||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
lock (m_dbLock)
|
||||||
{
|
{
|
||||||
dbcon.Open();
|
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||||
|
|
||||||
string command = "select * from `regionwindlight` where region_id = ?regionID";
|
|
||||||
|
|
||||||
using (MySqlCommand cmd = new MySqlCommand(command))
|
|
||||||
{
|
{
|
||||||
cmd.Connection = dbcon;
|
dbcon.Open();
|
||||||
|
|
||||||
cmd.Parameters.AddWithValue("?regionID", regionUUID.ToString());
|
string command = "select * from `regionwindlight` where region_id = ?regionID";
|
||||||
|
|
||||||
IDataReader result = ExecuteReader(cmd);
|
using (MySqlCommand cmd = new MySqlCommand(command))
|
||||||
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())
|
||||||
{
|
{
|
||||||
nWP.regionID = DBGuid.FromDB(result["region_id"]);
|
//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"]);
|
nWP.regionID = DBGuid.FromDB(result["region_id"]);
|
||||||
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.valid = true;
|
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"]);
|
||||||
|
nWP.valid = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nWP;
|
return nWP;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -853,118 +857,124 @@ namespace OpenSim.Data.MySQL
|
||||||
|
|
||||||
public void StoreRegionWindlightSettings(RegionLightShareData wl)
|
public void StoreRegionWindlightSettings(RegionLightShareData wl)
|
||||||
{
|
{
|
||||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
lock (m_dbLock)
|
||||||
{
|
{
|
||||||
dbcon.Open();
|
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||||
|
|
||||||
using (MySqlCommand cmd = dbcon.CreateCommand())
|
|
||||||
{
|
{
|
||||||
cmd.CommandText = "REPLACE INTO `regionwindlight` (`region_id`, `water_color_r`, `water_color_g`, ";
|
dbcon.Open();
|
||||||
cmd.CommandText += "`water_color_b`, `water_fog_density_exponent`, `underwater_fog_modifier`, ";
|
|
||||||
cmd.CommandText += "`reflection_wavelet_scale_1`, `reflection_wavelet_scale_2`, `reflection_wavelet_scale_3`, ";
|
|
||||||
cmd.CommandText += "`fresnel_scale`, `fresnel_offset`, `refract_scale_above`, `refract_scale_below`, ";
|
|
||||||
cmd.CommandText += "`blur_multiplier`, `big_wave_direction_x`, `big_wave_direction_y`, `little_wave_direction_x`, ";
|
|
||||||
cmd.CommandText += "`little_wave_direction_y`, `normal_map_texture`, `horizon_r`, `horizon_g`, `horizon_b`, ";
|
|
||||||
cmd.CommandText += "`horizon_i`, `haze_horizon`, `blue_density_r`, `blue_density_g`, `blue_density_b`, ";
|
|
||||||
cmd.CommandText += "`blue_density_i`, `haze_density`, `density_multiplier`, `distance_multiplier`, `max_altitude`, ";
|
|
||||||
cmd.CommandText += "`sun_moon_color_r`, `sun_moon_color_g`, `sun_moon_color_b`, `sun_moon_color_i`, `sun_moon_position`, ";
|
|
||||||
cmd.CommandText += "`ambient_r`, `ambient_g`, `ambient_b`, `ambient_i`, `east_angle`, `sun_glow_focus`, `sun_glow_size`, ";
|
|
||||||
cmd.CommandText += "`scene_gamma`, `star_brightness`, `cloud_color_r`, `cloud_color_g`, `cloud_color_b`, `cloud_color_i`, ";
|
|
||||||
cmd.CommandText += "`cloud_x`, `cloud_y`, `cloud_density`, `cloud_coverage`, `cloud_scale`, `cloud_detail_x`, ";
|
|
||||||
cmd.CommandText += "`cloud_detail_y`, `cloud_detail_density`, `cloud_scroll_x`, `cloud_scroll_x_lock`, `cloud_scroll_y`, ";
|
|
||||||
cmd.CommandText += "`cloud_scroll_y_lock`, `draw_classic_clouds`) VALUES (?region_id, ?water_color_r, ";
|
|
||||||
cmd.CommandText += "?water_color_g, ?water_color_b, ?water_fog_density_exponent, ?underwater_fog_modifier, ?reflection_wavelet_scale_1, ";
|
|
||||||
cmd.CommandText += "?reflection_wavelet_scale_2, ?reflection_wavelet_scale_3, ?fresnel_scale, ?fresnel_offset, ?refract_scale_above, ";
|
|
||||||
cmd.CommandText += "?refract_scale_below, ?blur_multiplier, ?big_wave_direction_x, ?big_wave_direction_y, ?little_wave_direction_x, ";
|
|
||||||
cmd.CommandText += "?little_wave_direction_y, ?normal_map_texture, ?horizon_r, ?horizon_g, ?horizon_b, ?horizon_i, ?haze_horizon, ";
|
|
||||||
cmd.CommandText += "?blue_density_r, ?blue_density_g, ?blue_density_b, ?blue_density_i, ?haze_density, ?density_multiplier, ";
|
|
||||||
cmd.CommandText += "?distance_multiplier, ?max_altitude, ?sun_moon_color_r, ?sun_moon_color_g, ?sun_moon_color_b, ";
|
|
||||||
cmd.CommandText += "?sun_moon_color_i, ?sun_moon_position, ?ambient_r, ?ambient_g, ?ambient_b, ?ambient_i, ?east_angle, ";
|
|
||||||
cmd.CommandText += "?sun_glow_focus, ?sun_glow_size, ?scene_gamma, ?star_brightness, ?cloud_color_r, ?cloud_color_g, ";
|
|
||||||
cmd.CommandText += "?cloud_color_b, ?cloud_color_i, ?cloud_x, ?cloud_y, ?cloud_density, ?cloud_coverage, ?cloud_scale, ";
|
|
||||||
cmd.CommandText += "?cloud_detail_x, ?cloud_detail_y, ?cloud_detail_density, ?cloud_scroll_x, ?cloud_scroll_x_lock, ";
|
|
||||||
cmd.CommandText += "?cloud_scroll_y, ?cloud_scroll_y_lock, ?draw_classic_clouds)";
|
|
||||||
|
|
||||||
cmd.Parameters.AddWithValue("region_id", wl.regionID);
|
using (MySqlCommand cmd = dbcon.CreateCommand())
|
||||||
cmd.Parameters.AddWithValue("water_color_r", wl.waterColor.X);
|
{
|
||||||
cmd.Parameters.AddWithValue("water_color_g", wl.waterColor.Y);
|
cmd.CommandText = "REPLACE INTO `regionwindlight` (`region_id`, `water_color_r`, `water_color_g`, ";
|
||||||
cmd.Parameters.AddWithValue("water_color_b", wl.waterColor.Z);
|
cmd.CommandText += "`water_color_b`, `water_fog_density_exponent`, `underwater_fog_modifier`, ";
|
||||||
cmd.Parameters.AddWithValue("water_fog_density_exponent", wl.waterFogDensityExponent);
|
cmd.CommandText += "`reflection_wavelet_scale_1`, `reflection_wavelet_scale_2`, `reflection_wavelet_scale_3`, ";
|
||||||
cmd.Parameters.AddWithValue("underwater_fog_modifier", wl.underwaterFogModifier);
|
cmd.CommandText += "`fresnel_scale`, `fresnel_offset`, `refract_scale_above`, `refract_scale_below`, ";
|
||||||
cmd.Parameters.AddWithValue("reflection_wavelet_scale_1", wl.reflectionWaveletScale.X);
|
cmd.CommandText += "`blur_multiplier`, `big_wave_direction_x`, `big_wave_direction_y`, `little_wave_direction_x`, ";
|
||||||
cmd.Parameters.AddWithValue("reflection_wavelet_scale_2", wl.reflectionWaveletScale.Y);
|
cmd.CommandText += "`little_wave_direction_y`, `normal_map_texture`, `horizon_r`, `horizon_g`, `horizon_b`, ";
|
||||||
cmd.Parameters.AddWithValue("reflection_wavelet_scale_3", wl.reflectionWaveletScale.Z);
|
cmd.CommandText += "`horizon_i`, `haze_horizon`, `blue_density_r`, `blue_density_g`, `blue_density_b`, ";
|
||||||
cmd.Parameters.AddWithValue("fresnel_scale", wl.fresnelScale);
|
cmd.CommandText += "`blue_density_i`, `haze_density`, `density_multiplier`, `distance_multiplier`, `max_altitude`, ";
|
||||||
cmd.Parameters.AddWithValue("fresnel_offset", wl.fresnelOffset);
|
cmd.CommandText += "`sun_moon_color_r`, `sun_moon_color_g`, `sun_moon_color_b`, `sun_moon_color_i`, `sun_moon_position`, ";
|
||||||
cmd.Parameters.AddWithValue("refract_scale_above", wl.refractScaleAbove);
|
cmd.CommandText += "`ambient_r`, `ambient_g`, `ambient_b`, `ambient_i`, `east_angle`, `sun_glow_focus`, `sun_glow_size`, ";
|
||||||
cmd.Parameters.AddWithValue("refract_scale_below", wl.refractScaleBelow);
|
cmd.CommandText += "`scene_gamma`, `star_brightness`, `cloud_color_r`, `cloud_color_g`, `cloud_color_b`, `cloud_color_i`, ";
|
||||||
cmd.Parameters.AddWithValue("blur_multiplier", wl.blurMultiplier);
|
cmd.CommandText += "`cloud_x`, `cloud_y`, `cloud_density`, `cloud_coverage`, `cloud_scale`, `cloud_detail_x`, ";
|
||||||
cmd.Parameters.AddWithValue("big_wave_direction_x", wl.bigWaveDirection.X);
|
cmd.CommandText += "`cloud_detail_y`, `cloud_detail_density`, `cloud_scroll_x`, `cloud_scroll_x_lock`, `cloud_scroll_y`, ";
|
||||||
cmd.Parameters.AddWithValue("big_wave_direction_y", wl.bigWaveDirection.Y);
|
cmd.CommandText += "`cloud_scroll_y_lock`, `draw_classic_clouds`) VALUES (?region_id, ?water_color_r, ";
|
||||||
cmd.Parameters.AddWithValue("little_wave_direction_x", wl.littleWaveDirection.X);
|
cmd.CommandText += "?water_color_g, ?water_color_b, ?water_fog_density_exponent, ?underwater_fog_modifier, ?reflection_wavelet_scale_1, ";
|
||||||
cmd.Parameters.AddWithValue("little_wave_direction_y", wl.littleWaveDirection.Y);
|
cmd.CommandText += "?reflection_wavelet_scale_2, ?reflection_wavelet_scale_3, ?fresnel_scale, ?fresnel_offset, ?refract_scale_above, ";
|
||||||
cmd.Parameters.AddWithValue("normal_map_texture", wl.normalMapTexture);
|
cmd.CommandText += "?refract_scale_below, ?blur_multiplier, ?big_wave_direction_x, ?big_wave_direction_y, ?little_wave_direction_x, ";
|
||||||
cmd.Parameters.AddWithValue("horizon_r", wl.horizon.X);
|
cmd.CommandText += "?little_wave_direction_y, ?normal_map_texture, ?horizon_r, ?horizon_g, ?horizon_b, ?horizon_i, ?haze_horizon, ";
|
||||||
cmd.Parameters.AddWithValue("horizon_g", wl.horizon.Y);
|
cmd.CommandText += "?blue_density_r, ?blue_density_g, ?blue_density_b, ?blue_density_i, ?haze_density, ?density_multiplier, ";
|
||||||
cmd.Parameters.AddWithValue("horizon_b", wl.horizon.Z);
|
cmd.CommandText += "?distance_multiplier, ?max_altitude, ?sun_moon_color_r, ?sun_moon_color_g, ?sun_moon_color_b, ";
|
||||||
cmd.Parameters.AddWithValue("horizon_i", wl.horizon.W);
|
cmd.CommandText += "?sun_moon_color_i, ?sun_moon_position, ?ambient_r, ?ambient_g, ?ambient_b, ?ambient_i, ?east_angle, ";
|
||||||
cmd.Parameters.AddWithValue("haze_horizon", wl.hazeHorizon);
|
cmd.CommandText += "?sun_glow_focus, ?sun_glow_size, ?scene_gamma, ?star_brightness, ?cloud_color_r, ?cloud_color_g, ";
|
||||||
cmd.Parameters.AddWithValue("blue_density_r", wl.blueDensity.X);
|
cmd.CommandText += "?cloud_color_b, ?cloud_color_i, ?cloud_x, ?cloud_y, ?cloud_density, ?cloud_coverage, ?cloud_scale, ";
|
||||||
cmd.Parameters.AddWithValue("blue_density_g", wl.blueDensity.Y);
|
cmd.CommandText += "?cloud_detail_x, ?cloud_detail_y, ?cloud_detail_density, ?cloud_scroll_x, ?cloud_scroll_x_lock, ";
|
||||||
cmd.Parameters.AddWithValue("blue_density_b", wl.blueDensity.Z);
|
cmd.CommandText += "?cloud_scroll_y, ?cloud_scroll_y_lock, ?draw_classic_clouds)";
|
||||||
cmd.Parameters.AddWithValue("blue_density_i", wl.blueDensity.W);
|
|
||||||
cmd.Parameters.AddWithValue("haze_density", wl.hazeDensity);
|
|
||||||
cmd.Parameters.AddWithValue("density_multiplier", wl.densityMultiplier);
|
|
||||||
cmd.Parameters.AddWithValue("distance_multiplier", wl.distanceMultiplier);
|
|
||||||
cmd.Parameters.AddWithValue("max_altitude", wl.maxAltitude);
|
|
||||||
cmd.Parameters.AddWithValue("sun_moon_color_r", wl.sunMoonColor.X);
|
|
||||||
cmd.Parameters.AddWithValue("sun_moon_color_g", wl.sunMoonColor.Y);
|
|
||||||
cmd.Parameters.AddWithValue("sun_moon_color_b", wl.sunMoonColor.Z);
|
|
||||||
cmd.Parameters.AddWithValue("sun_moon_color_i", wl.sunMoonColor.W);
|
|
||||||
cmd.Parameters.AddWithValue("sun_moon_position", wl.sunMoonPosition);
|
|
||||||
cmd.Parameters.AddWithValue("ambient_r", wl.ambient.X);
|
|
||||||
cmd.Parameters.AddWithValue("ambient_g", wl.ambient.Y);
|
|
||||||
cmd.Parameters.AddWithValue("ambient_b", wl.ambient.Z);
|
|
||||||
cmd.Parameters.AddWithValue("ambient_i", wl.ambient.W);
|
|
||||||
cmd.Parameters.AddWithValue("east_angle", wl.eastAngle);
|
|
||||||
cmd.Parameters.AddWithValue("sun_glow_focus", wl.sunGlowFocus);
|
|
||||||
cmd.Parameters.AddWithValue("sun_glow_size", wl.sunGlowSize);
|
|
||||||
cmd.Parameters.AddWithValue("scene_gamma", wl.sceneGamma);
|
|
||||||
cmd.Parameters.AddWithValue("star_brightness", wl.starBrightness);
|
|
||||||
cmd.Parameters.AddWithValue("cloud_color_r", wl.cloudColor.X);
|
|
||||||
cmd.Parameters.AddWithValue("cloud_color_g", wl.cloudColor.Y);
|
|
||||||
cmd.Parameters.AddWithValue("cloud_color_b", wl.cloudColor.Z);
|
|
||||||
cmd.Parameters.AddWithValue("cloud_color_i", wl.cloudColor.W);
|
|
||||||
cmd.Parameters.AddWithValue("cloud_x", wl.cloudXYDensity.X);
|
|
||||||
cmd.Parameters.AddWithValue("cloud_y", wl.cloudXYDensity.Y);
|
|
||||||
cmd.Parameters.AddWithValue("cloud_density", wl.cloudXYDensity.Z);
|
|
||||||
cmd.Parameters.AddWithValue("cloud_coverage", wl.cloudCoverage);
|
|
||||||
cmd.Parameters.AddWithValue("cloud_scale", wl.cloudScale);
|
|
||||||
cmd.Parameters.AddWithValue("cloud_detail_x", wl.cloudDetailXYDensity.X);
|
|
||||||
cmd.Parameters.AddWithValue("cloud_detail_y", wl.cloudDetailXYDensity.Y);
|
|
||||||
cmd.Parameters.AddWithValue("cloud_detail_density", wl.cloudDetailXYDensity.Z);
|
|
||||||
cmd.Parameters.AddWithValue("cloud_scroll_x", wl.cloudScrollX);
|
|
||||||
cmd.Parameters.AddWithValue("cloud_scroll_x_lock", wl.cloudScrollXLock);
|
|
||||||
cmd.Parameters.AddWithValue("cloud_scroll_y", wl.cloudScrollY);
|
|
||||||
cmd.Parameters.AddWithValue("cloud_scroll_y_lock", wl.cloudScrollYLock);
|
|
||||||
cmd.Parameters.AddWithValue("draw_classic_clouds", wl.drawClassicClouds);
|
|
||||||
|
|
||||||
ExecuteNonQuery(cmd);
|
cmd.Parameters.AddWithValue("region_id", wl.regionID);
|
||||||
|
cmd.Parameters.AddWithValue("water_color_r", wl.waterColor.X);
|
||||||
|
cmd.Parameters.AddWithValue("water_color_g", wl.waterColor.Y);
|
||||||
|
cmd.Parameters.AddWithValue("water_color_b", wl.waterColor.Z);
|
||||||
|
cmd.Parameters.AddWithValue("water_fog_density_exponent", wl.waterFogDensityExponent);
|
||||||
|
cmd.Parameters.AddWithValue("underwater_fog_modifier", wl.underwaterFogModifier);
|
||||||
|
cmd.Parameters.AddWithValue("reflection_wavelet_scale_1", wl.reflectionWaveletScale.X);
|
||||||
|
cmd.Parameters.AddWithValue("reflection_wavelet_scale_2", wl.reflectionWaveletScale.Y);
|
||||||
|
cmd.Parameters.AddWithValue("reflection_wavelet_scale_3", wl.reflectionWaveletScale.Z);
|
||||||
|
cmd.Parameters.AddWithValue("fresnel_scale", wl.fresnelScale);
|
||||||
|
cmd.Parameters.AddWithValue("fresnel_offset", wl.fresnelOffset);
|
||||||
|
cmd.Parameters.AddWithValue("refract_scale_above", wl.refractScaleAbove);
|
||||||
|
cmd.Parameters.AddWithValue("refract_scale_below", wl.refractScaleBelow);
|
||||||
|
cmd.Parameters.AddWithValue("blur_multiplier", wl.blurMultiplier);
|
||||||
|
cmd.Parameters.AddWithValue("big_wave_direction_x", wl.bigWaveDirection.X);
|
||||||
|
cmd.Parameters.AddWithValue("big_wave_direction_y", wl.bigWaveDirection.Y);
|
||||||
|
cmd.Parameters.AddWithValue("little_wave_direction_x", wl.littleWaveDirection.X);
|
||||||
|
cmd.Parameters.AddWithValue("little_wave_direction_y", wl.littleWaveDirection.Y);
|
||||||
|
cmd.Parameters.AddWithValue("normal_map_texture", wl.normalMapTexture);
|
||||||
|
cmd.Parameters.AddWithValue("horizon_r", wl.horizon.X);
|
||||||
|
cmd.Parameters.AddWithValue("horizon_g", wl.horizon.Y);
|
||||||
|
cmd.Parameters.AddWithValue("horizon_b", wl.horizon.Z);
|
||||||
|
cmd.Parameters.AddWithValue("horizon_i", wl.horizon.W);
|
||||||
|
cmd.Parameters.AddWithValue("haze_horizon", wl.hazeHorizon);
|
||||||
|
cmd.Parameters.AddWithValue("blue_density_r", wl.blueDensity.X);
|
||||||
|
cmd.Parameters.AddWithValue("blue_density_g", wl.blueDensity.Y);
|
||||||
|
cmd.Parameters.AddWithValue("blue_density_b", wl.blueDensity.Z);
|
||||||
|
cmd.Parameters.AddWithValue("blue_density_i", wl.blueDensity.W);
|
||||||
|
cmd.Parameters.AddWithValue("haze_density", wl.hazeDensity);
|
||||||
|
cmd.Parameters.AddWithValue("density_multiplier", wl.densityMultiplier);
|
||||||
|
cmd.Parameters.AddWithValue("distance_multiplier", wl.distanceMultiplier);
|
||||||
|
cmd.Parameters.AddWithValue("max_altitude", wl.maxAltitude);
|
||||||
|
cmd.Parameters.AddWithValue("sun_moon_color_r", wl.sunMoonColor.X);
|
||||||
|
cmd.Parameters.AddWithValue("sun_moon_color_g", wl.sunMoonColor.Y);
|
||||||
|
cmd.Parameters.AddWithValue("sun_moon_color_b", wl.sunMoonColor.Z);
|
||||||
|
cmd.Parameters.AddWithValue("sun_moon_color_i", wl.sunMoonColor.W);
|
||||||
|
cmd.Parameters.AddWithValue("sun_moon_position", wl.sunMoonPosition);
|
||||||
|
cmd.Parameters.AddWithValue("ambient_r", wl.ambient.X);
|
||||||
|
cmd.Parameters.AddWithValue("ambient_g", wl.ambient.Y);
|
||||||
|
cmd.Parameters.AddWithValue("ambient_b", wl.ambient.Z);
|
||||||
|
cmd.Parameters.AddWithValue("ambient_i", wl.ambient.W);
|
||||||
|
cmd.Parameters.AddWithValue("east_angle", wl.eastAngle);
|
||||||
|
cmd.Parameters.AddWithValue("sun_glow_focus", wl.sunGlowFocus);
|
||||||
|
cmd.Parameters.AddWithValue("sun_glow_size", wl.sunGlowSize);
|
||||||
|
cmd.Parameters.AddWithValue("scene_gamma", wl.sceneGamma);
|
||||||
|
cmd.Parameters.AddWithValue("star_brightness", wl.starBrightness);
|
||||||
|
cmd.Parameters.AddWithValue("cloud_color_r", wl.cloudColor.X);
|
||||||
|
cmd.Parameters.AddWithValue("cloud_color_g", wl.cloudColor.Y);
|
||||||
|
cmd.Parameters.AddWithValue("cloud_color_b", wl.cloudColor.Z);
|
||||||
|
cmd.Parameters.AddWithValue("cloud_color_i", wl.cloudColor.W);
|
||||||
|
cmd.Parameters.AddWithValue("cloud_x", wl.cloudXYDensity.X);
|
||||||
|
cmd.Parameters.AddWithValue("cloud_y", wl.cloudXYDensity.Y);
|
||||||
|
cmd.Parameters.AddWithValue("cloud_density", wl.cloudXYDensity.Z);
|
||||||
|
cmd.Parameters.AddWithValue("cloud_coverage", wl.cloudCoverage);
|
||||||
|
cmd.Parameters.AddWithValue("cloud_scale", wl.cloudScale);
|
||||||
|
cmd.Parameters.AddWithValue("cloud_detail_x", wl.cloudDetailXYDensity.X);
|
||||||
|
cmd.Parameters.AddWithValue("cloud_detail_y", wl.cloudDetailXYDensity.Y);
|
||||||
|
cmd.Parameters.AddWithValue("cloud_detail_density", wl.cloudDetailXYDensity.Z);
|
||||||
|
cmd.Parameters.AddWithValue("cloud_scroll_x", wl.cloudScrollX);
|
||||||
|
cmd.Parameters.AddWithValue("cloud_scroll_x_lock", wl.cloudScrollXLock);
|
||||||
|
cmd.Parameters.AddWithValue("cloud_scroll_y", wl.cloudScrollY);
|
||||||
|
cmd.Parameters.AddWithValue("cloud_scroll_y_lock", wl.cloudScrollYLock);
|
||||||
|
cmd.Parameters.AddWithValue("draw_classic_clouds", wl.drawClassicClouds);
|
||||||
|
|
||||||
|
ExecuteNonQuery(cmd);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RemoveRegionWindlightSettings(UUID regionID)
|
public void RemoveRegionWindlightSettings(UUID regionID)
|
||||||
{
|
{
|
||||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
lock (m_dbLock)
|
||||||
{
|
{
|
||||||
dbcon.Open();
|
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||||
|
|
||||||
using (MySqlCommand cmd = dbcon.CreateCommand())
|
|
||||||
{
|
{
|
||||||
cmd.CommandText = "delete from `regionwindlight` where `region_id`=?regionID";
|
dbcon.Open();
|
||||||
cmd.Parameters.AddWithValue("?regionID", regionID.ToString());
|
|
||||||
ExecuteNonQuery(cmd);
|
using (MySqlCommand cmd = dbcon.CreateCommand())
|
||||||
|
{
|
||||||
|
cmd.CommandText = "delete from `regionwindlight` where `region_id`=?regionID";
|
||||||
|
cmd.Parameters.AddWithValue("?regionID", regionID.ToString());
|
||||||
|
ExecuteNonQuery(cmd);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -972,26 +982,29 @@ namespace OpenSim.Data.MySQL
|
||||||
#region RegionEnvironmentSettings
|
#region RegionEnvironmentSettings
|
||||||
public string LoadRegionEnvironmentSettings(UUID regionUUID)
|
public string LoadRegionEnvironmentSettings(UUID regionUUID)
|
||||||
{
|
{
|
||||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
lock (m_dbLock)
|
||||||
{
|
{
|
||||||
dbcon.Open();
|
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||||
|
|
||||||
string command = "select * from `regionenvironment` where region_id = ?region_id";
|
|
||||||
|
|
||||||
using (MySqlCommand cmd = new MySqlCommand(command))
|
|
||||||
{
|
{
|
||||||
cmd.Connection = dbcon;
|
dbcon.Open();
|
||||||
|
|
||||||
cmd.Parameters.AddWithValue("?region_id", regionUUID.ToString());
|
string command = "select * from `regionenvironment` where region_id = ?region_id";
|
||||||
|
|
||||||
IDataReader result = ExecuteReader(cmd);
|
using (MySqlCommand cmd = new MySqlCommand(command))
|
||||||
if (!result.Read())
|
|
||||||
{
|
{
|
||||||
return String.Empty;
|
cmd.Connection = dbcon;
|
||||||
}
|
|
||||||
else
|
cmd.Parameters.AddWithValue("?region_id", regionUUID.ToString());
|
||||||
{
|
|
||||||
return Convert.ToString(result["llsd_settings"]);
|
IDataReader result = ExecuteReader(cmd);
|
||||||
|
if (!result.Read())
|
||||||
|
{
|
||||||
|
return String.Empty;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return Convert.ToString(result["llsd_settings"]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -999,33 +1012,39 @@ namespace OpenSim.Data.MySQL
|
||||||
|
|
||||||
public void StoreRegionEnvironmentSettings(UUID regionUUID, string settings)
|
public void StoreRegionEnvironmentSettings(UUID regionUUID, string settings)
|
||||||
{
|
{
|
||||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
lock (m_dbLock)
|
||||||
{
|
{
|
||||||
dbcon.Open();
|
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||||
|
|
||||||
using (MySqlCommand cmd = dbcon.CreateCommand())
|
|
||||||
{
|
{
|
||||||
cmd.CommandText = "REPLACE INTO `regionenvironment` (`region_id`, `llsd_settings`) VALUES (?region_id, ?llsd_settings)";
|
dbcon.Open();
|
||||||
|
|
||||||
cmd.Parameters.AddWithValue("region_id", regionUUID);
|
using (MySqlCommand cmd = dbcon.CreateCommand())
|
||||||
cmd.Parameters.AddWithValue("llsd_settings", settings);
|
{
|
||||||
|
cmd.CommandText = "REPLACE INTO `regionenvironment` (`region_id`, `llsd_settings`) VALUES (?region_id, ?llsd_settings)";
|
||||||
|
|
||||||
ExecuteNonQuery(cmd);
|
cmd.Parameters.AddWithValue("region_id", regionUUID);
|
||||||
|
cmd.Parameters.AddWithValue("llsd_settings", settings);
|
||||||
|
|
||||||
|
ExecuteNonQuery(cmd);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RemoveRegionEnvironmentSettings(UUID regionUUID)
|
public void RemoveRegionEnvironmentSettings(UUID regionUUID)
|
||||||
{
|
{
|
||||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
lock (m_dbLock)
|
||||||
{
|
{
|
||||||
dbcon.Open();
|
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||||
|
|
||||||
using (MySqlCommand cmd = dbcon.CreateCommand())
|
|
||||||
{
|
{
|
||||||
cmd.CommandText = "delete from `regionenvironment` where region_id = ?region_id";
|
dbcon.Open();
|
||||||
cmd.Parameters.AddWithValue("?region_id", regionUUID.ToString());
|
|
||||||
ExecuteNonQuery(cmd);
|
using (MySqlCommand cmd = dbcon.CreateCommand())
|
||||||
|
{
|
||||||
|
cmd.CommandText = "delete from `regionenvironment` where region_id = ?region_id";
|
||||||
|
cmd.Parameters.AddWithValue("?region_id", regionUUID.ToString());
|
||||||
|
ExecuteNonQuery(cmd);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4451,37 +4451,44 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
if (bl[i].BannedUserID == UUID.Zero)
|
if (bl[i].BannedUserID == UUID.Zero)
|
||||||
continue;
|
continue;
|
||||||
BannedUsers.Add(bl[i].BannedUserID);
|
BannedUsers.Add(bl[i].BannedUserID);
|
||||||
|
|
||||||
|
if (BannedUsers.Count >= 50 || (i == (bl.Length - 1) && BannedUsers.Count > 0))
|
||||||
|
{
|
||||||
|
EstateOwnerMessagePacket packet = new EstateOwnerMessagePacket();
|
||||||
|
packet.AgentData.TransactionID = UUID.Random();
|
||||||
|
packet.AgentData.AgentID = AgentId;
|
||||||
|
packet.AgentData.SessionID = SessionId;
|
||||||
|
packet.MethodData.Invoice = invoice;
|
||||||
|
packet.MethodData.Method = Utils.StringToBytes("setaccess");
|
||||||
|
|
||||||
|
EstateOwnerMessagePacket.ParamListBlock[] returnblock = new EstateOwnerMessagePacket.ParamListBlock[6 + BannedUsers.Count];
|
||||||
|
|
||||||
|
int j;
|
||||||
|
for (j = 0; j < (6 + BannedUsers.Count); j++)
|
||||||
|
{
|
||||||
|
returnblock[j] = new EstateOwnerMessagePacket.ParamListBlock();
|
||||||
|
}
|
||||||
|
j = 0;
|
||||||
|
|
||||||
|
returnblock[j].Parameter = Utils.StringToBytes(estateID.ToString()); j++;
|
||||||
|
returnblock[j].Parameter = Utils.StringToBytes(((int)Constants.EstateAccessCodex.EstateBans).ToString()); j++;
|
||||||
|
returnblock[j].Parameter = Utils.StringToBytes("0"); j++;
|
||||||
|
returnblock[j].Parameter = Utils.StringToBytes("0"); j++;
|
||||||
|
returnblock[j].Parameter = Utils.StringToBytes(BannedUsers.Count.ToString()); j++;
|
||||||
|
returnblock[j].Parameter = Utils.StringToBytes("0"); j++;
|
||||||
|
|
||||||
|
foreach (UUID banned in BannedUsers)
|
||||||
|
{
|
||||||
|
returnblock[j].Parameter = banned.GetBytes(); j++;
|
||||||
|
}
|
||||||
|
packet.ParamList = returnblock;
|
||||||
|
packet.Header.Reliable = true;
|
||||||
|
OutPacket(packet, ThrottleOutPacketType.Task);
|
||||||
|
|
||||||
|
BannedUsers.Clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EstateOwnerMessagePacket packet = new EstateOwnerMessagePacket();
|
|
||||||
packet.AgentData.TransactionID = UUID.Random();
|
|
||||||
packet.AgentData.AgentID = AgentId;
|
|
||||||
packet.AgentData.SessionID = SessionId;
|
|
||||||
packet.MethodData.Invoice = invoice;
|
|
||||||
packet.MethodData.Method = Utils.StringToBytes("setaccess");
|
|
||||||
|
|
||||||
EstateOwnerMessagePacket.ParamListBlock[] returnblock = new EstateOwnerMessagePacket.ParamListBlock[6 + BannedUsers.Count];
|
|
||||||
|
|
||||||
for (int i = 0; i < (6 + BannedUsers.Count); i++)
|
|
||||||
{
|
|
||||||
returnblock[i] = new EstateOwnerMessagePacket.ParamListBlock();
|
|
||||||
}
|
|
||||||
int j = 0;
|
|
||||||
|
|
||||||
returnblock[j].Parameter = Utils.StringToBytes(estateID.ToString()); j++;
|
|
||||||
returnblock[j].Parameter = Utils.StringToBytes(((int)Constants.EstateAccessCodex.EstateBans).ToString()); j++;
|
|
||||||
returnblock[j].Parameter = Utils.StringToBytes("0"); j++;
|
|
||||||
returnblock[j].Parameter = Utils.StringToBytes("0"); j++;
|
|
||||||
returnblock[j].Parameter = Utils.StringToBytes(BannedUsers.Count.ToString()); j++;
|
|
||||||
returnblock[j].Parameter = Utils.StringToBytes("0"); j++;
|
|
||||||
|
|
||||||
foreach (UUID banned in BannedUsers)
|
|
||||||
{
|
|
||||||
returnblock[j].Parameter = banned.GetBytes(); j++;
|
|
||||||
}
|
|
||||||
packet.ParamList = returnblock;
|
|
||||||
packet.Header.Reliable = false;
|
|
||||||
OutPacket(packet, ThrottleOutPacketType.Task);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SendRegionInfoToEstateMenu(RegionInfoForEstateMenuArgs args)
|
public void SendRegionInfoToEstateMenu(RegionInfoForEstateMenuArgs args)
|
||||||
|
|
|
@ -186,63 +186,79 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
|
||||||
public UUID AddDynamicTextureData(UUID simID, UUID primID, string contentType, string data,
|
public UUID AddDynamicTextureData(UUID simID, UUID primID, string contentType, string data,
|
||||||
string extraParams, int updateTimer, bool SetBlending, int disp, byte AlphaValue, int face)
|
string extraParams, int updateTimer, bool SetBlending, int disp, byte AlphaValue, int face)
|
||||||
{
|
{
|
||||||
if (RenderPlugins.ContainsKey(contentType))
|
if (!RenderPlugins.ContainsKey(contentType))
|
||||||
|
return UUID.Zero;
|
||||||
|
|
||||||
|
Scene scene;
|
||||||
|
RegisteredScenes.TryGetValue(simID, out scene);
|
||||||
|
|
||||||
|
if (scene == null)
|
||||||
|
return UUID.Zero;
|
||||||
|
|
||||||
|
SceneObjectPart part = scene.GetSceneObjectPart(primID);
|
||||||
|
|
||||||
|
if (part == null)
|
||||||
|
return UUID.Zero;
|
||||||
|
|
||||||
|
// If we want to reuse dynamic textures then we have to ignore any request from the caller to expire
|
||||||
|
// them.
|
||||||
|
if (ReuseTextures)
|
||||||
|
disp = disp & ~DISP_EXPIRE;
|
||||||
|
|
||||||
|
DynamicTextureUpdater updater = new DynamicTextureUpdater();
|
||||||
|
updater.SimUUID = simID;
|
||||||
|
updater.PrimID = primID;
|
||||||
|
updater.ContentType = contentType;
|
||||||
|
updater.BodyData = data;
|
||||||
|
updater.UpdateTimer = updateTimer;
|
||||||
|
updater.UpdaterID = UUID.Random();
|
||||||
|
updater.Params = extraParams;
|
||||||
|
updater.BlendWithOldTexture = SetBlending;
|
||||||
|
updater.FrontAlpha = AlphaValue;
|
||||||
|
updater.Face = face;
|
||||||
|
updater.Url = "Local image";
|
||||||
|
updater.Disp = disp;
|
||||||
|
|
||||||
|
object objReusableTextureUUID = null;
|
||||||
|
|
||||||
|
if (ReuseTextures && !updater.BlendWithOldTexture)
|
||||||
{
|
{
|
||||||
// If we want to reuse dynamic textures then we have to ignore any request from the caller to expire
|
string reuseableTextureKey = GenerateReusableTextureKey(data, extraParams);
|
||||||
// them.
|
objReusableTextureUUID = m_reuseableDynamicTextures.Get(reuseableTextureKey);
|
||||||
if (ReuseTextures)
|
|
||||||
disp = disp & ~DISP_EXPIRE;
|
|
||||||
|
|
||||||
DynamicTextureUpdater updater = new DynamicTextureUpdater();
|
if (objReusableTextureUUID != null)
|
||||||
updater.SimUUID = simID;
|
|
||||||
updater.PrimID = primID;
|
|
||||||
updater.ContentType = contentType;
|
|
||||||
updater.BodyData = data;
|
|
||||||
updater.UpdateTimer = updateTimer;
|
|
||||||
updater.UpdaterID = UUID.Random();
|
|
||||||
updater.Params = extraParams;
|
|
||||||
updater.BlendWithOldTexture = SetBlending;
|
|
||||||
updater.FrontAlpha = AlphaValue;
|
|
||||||
updater.Face = face;
|
|
||||||
updater.Url = "Local image";
|
|
||||||
updater.Disp = disp;
|
|
||||||
|
|
||||||
object reusableTextureUUID = null;
|
|
||||||
|
|
||||||
if (ReuseTextures)
|
|
||||||
reusableTextureUUID
|
|
||||||
= m_reuseableDynamicTextures.Get(GenerateReusableTextureKey(data, extraParams));
|
|
||||||
|
|
||||||
// We cannot reuse a dynamic texture if the data is going to be blended with something already there.
|
|
||||||
if (reusableTextureUUID == null || updater.BlendWithOldTexture)
|
|
||||||
{
|
{
|
||||||
lock (Updaters)
|
// If something else has removed this temporary asset from the cache, detect and invalidate
|
||||||
|
// our cached uuid.
|
||||||
|
if (scene.AssetService.GetMetadata(objReusableTextureUUID.ToString()) == null)
|
||||||
{
|
{
|
||||||
if (!Updaters.ContainsKey(updater.UpdaterID))
|
m_reuseableDynamicTextures.Invalidate(reuseableTextureKey);
|
||||||
{
|
objReusableTextureUUID = null;
|
||||||
Updaters.Add(updater.UpdaterID, updater);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
RenderPlugins[contentType].AsyncConvertData(updater.UpdaterID, data, extraParams);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// No need to add to updaters as the texture is always the same. Not that this functionality
|
|
||||||
// apppears to be implemented anyway.
|
|
||||||
if (RegisteredScenes.ContainsKey(updater.SimUUID))
|
|
||||||
{
|
|
||||||
SceneObjectPart part = RegisteredScenes[updater.SimUUID].GetSceneObjectPart(updater.PrimID);
|
|
||||||
|
|
||||||
if (part != null)
|
|
||||||
updater.UpdatePart(part, (UUID)reusableTextureUUID);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return updater.UpdaterID;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return UUID.Zero;
|
// We cannot reuse a dynamic texture if the data is going to be blended with something already there.
|
||||||
|
if (objReusableTextureUUID == null)
|
||||||
|
{
|
||||||
|
lock (Updaters)
|
||||||
|
{
|
||||||
|
if (!Updaters.ContainsKey(updater.UpdaterID))
|
||||||
|
{
|
||||||
|
Updaters.Add(updater.UpdaterID, updater);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
RenderPlugins[contentType].AsyncConvertData(updater.UpdaterID, data, extraParams);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// No need to add to updaters as the texture is always the same. Not that this functionality
|
||||||
|
// apppears to be implemented anyway.
|
||||||
|
updater.UpdatePart(part, (UUID)objReusableTextureUUID);
|
||||||
|
}
|
||||||
|
|
||||||
|
return updater.UpdaterID;
|
||||||
}
|
}
|
||||||
|
|
||||||
private string GenerateReusableTextureKey(string data, string extraParams)
|
private string GenerateReusableTextureKey(string data, string extraParams)
|
||||||
|
@ -267,6 +283,10 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
|
||||||
|
|
||||||
public void Initialise(Scene scene, IConfigSource config)
|
public void Initialise(Scene scene, IConfigSource config)
|
||||||
{
|
{
|
||||||
|
IConfig texturesConfig = config.Configs["Textures"];
|
||||||
|
if (texturesConfig != null)
|
||||||
|
ReuseTextures = texturesConfig.GetBoolean("ReuseDynamicTextures", false);
|
||||||
|
|
||||||
if (!RegisteredScenes.ContainsKey(scene.RegionInfo.RegionID))
|
if (!RegisteredScenes.ContainsKey(scene.RegionInfo.RegionID))
|
||||||
{
|
{
|
||||||
RegisteredScenes.Add(scene.RegionInfo.RegionID, scene);
|
RegisteredScenes.Add(scene.RegionInfo.RegionID, scene);
|
||||||
|
@ -276,7 +296,6 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
|
||||||
|
|
||||||
public void PostInitialise()
|
public void PostInitialise()
|
||||||
{
|
{
|
||||||
// ReuseTextures = true;
|
|
||||||
if (ReuseTextures)
|
if (ReuseTextures)
|
||||||
{
|
{
|
||||||
m_reuseableDynamicTextures = new Cache(CacheMedium.Memory, CacheStrategy.Conservative);
|
m_reuseableDynamicTextures = new Cache(CacheMedium.Memory, CacheStrategy.Conservative);
|
||||||
|
|
|
@ -46,9 +46,38 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||||
/// </summary>
|
/// </summary>
|
||||||
event ScriptCommand OnScriptCommand;
|
event ScriptCommand OnScriptCommand;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Register an instance method as a script call by method name
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="target"></param>
|
||||||
|
/// <param name="method"></param>
|
||||||
void RegisterScriptInvocation(object target, string method);
|
void RegisterScriptInvocation(object target, string method);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Register a static or instance method as a script call by method info
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="target">If target is a Type object, will assume method is static.</param>
|
||||||
|
/// <param name="method"></param>
|
||||||
void RegisterScriptInvocation(object target, MethodInfo method);
|
void RegisterScriptInvocation(object target, MethodInfo method);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Register one or more instance methods as script calls by method name
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="target"></param>
|
||||||
|
/// <param name="methods"></param>
|
||||||
void RegisterScriptInvocation(object target, string[] methods);
|
void RegisterScriptInvocation(object target, string[] methods);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Register one or more static methods as script calls by method name
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="target"></param>
|
||||||
|
/// <param name="methods"></param>
|
||||||
|
void RegisterScriptInvocation(Type target, string[] methods);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns an array of all registered script calls
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
Delegate[] GetScriptInvocationList();
|
Delegate[] GetScriptInvocationList();
|
||||||
|
|
||||||
Delegate LookupScriptInvocation(string fname);
|
Delegate LookupScriptInvocation(string fname);
|
||||||
|
|
|
@ -130,13 +130,25 @@ namespace OpenSim.Region.OptionalModules.Scripting.ScriptModuleComms
|
||||||
m_scriptModule.PostScriptEvent(script, "link_message", args);
|
m_scriptModule.PostScriptEvent(script, "link_message", args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static MethodInfo GetMethodInfoFromType(Type target, string meth, bool searchInstanceMethods)
|
||||||
|
{
|
||||||
|
BindingFlags getMethodFlags =
|
||||||
|
BindingFlags.NonPublic | BindingFlags.Public;
|
||||||
|
|
||||||
|
if (searchInstanceMethods)
|
||||||
|
getMethodFlags |= BindingFlags.Instance;
|
||||||
|
else
|
||||||
|
getMethodFlags |= BindingFlags.Static;
|
||||||
|
|
||||||
|
return target.GetMethod(meth, getMethodFlags);
|
||||||
|
}
|
||||||
|
|
||||||
public void RegisterScriptInvocation(object target, string meth)
|
public void RegisterScriptInvocation(object target, string meth)
|
||||||
{
|
{
|
||||||
MethodInfo mi = target.GetType().GetMethod(meth,
|
MethodInfo mi = GetMethodInfoFromType(target.GetType(), meth, true);
|
||||||
BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);
|
|
||||||
if (mi == null)
|
if (mi == null)
|
||||||
{
|
{
|
||||||
m_log.WarnFormat("[MODULE COMMANDS] Failed to register method {0}",meth);
|
m_log.WarnFormat("[MODULE COMMANDS] Failed to register method {0}", meth);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -151,39 +163,55 @@ namespace OpenSim.Region.OptionalModules.Scripting.ScriptModuleComms
|
||||||
|
|
||||||
public void RegisterScriptInvocation(object target, MethodInfo mi)
|
public void RegisterScriptInvocation(object target, MethodInfo mi)
|
||||||
{
|
{
|
||||||
m_log.DebugFormat("[MODULE COMMANDS] Register method {0} from type {1}", mi.Name, target.GetType().Name);
|
m_log.DebugFormat("[MODULE COMMANDS] Register method {0} from type {1}", mi.Name, (target is Type) ? ((Type)target).Name : target.GetType().Name);
|
||||||
|
|
||||||
Type delegateType;
|
Type delegateType;
|
||||||
var typeArgs = mi.GetParameters()
|
List<Type> typeArgs = mi.GetParameters()
|
||||||
.Select(p => p.ParameterType)
|
.Select(p => p.ParameterType)
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
if (mi.ReturnType == typeof(void))
|
if (mi.ReturnType == typeof(void))
|
||||||
{
|
{
|
||||||
delegateType = Expression.GetActionType(typeArgs.ToArray());
|
delegateType = Expression.GetActionType(typeArgs.ToArray());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
typeArgs.Add(mi.ReturnType);
|
typeArgs.Add(mi.ReturnType);
|
||||||
delegateType = Expression.GetFuncType(typeArgs.ToArray());
|
delegateType = Expression.GetFuncType(typeArgs.ToArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
Delegate fcall = Delegate.CreateDelegate(delegateType, target, mi);
|
Delegate fcall;
|
||||||
|
if (!(target is Type))
|
||||||
|
fcall = Delegate.CreateDelegate(delegateType, target, mi);
|
||||||
|
else
|
||||||
|
fcall = Delegate.CreateDelegate(delegateType, (Type)target, mi.Name);
|
||||||
|
|
||||||
lock (m_scriptInvocation)
|
lock (m_scriptInvocation)
|
||||||
{
|
{
|
||||||
ParameterInfo[] parameters = fcall.Method.GetParameters ();
|
ParameterInfo[] parameters = fcall.Method.GetParameters();
|
||||||
if (parameters.Length < 2) // Must have two UUID params
|
if (parameters.Length < 2) // Must have two UUID params
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Hide the first two parameters
|
// Hide the first two parameters
|
||||||
Type[] parmTypes = new Type[parameters.Length - 2];
|
Type[] parmTypes = new Type[parameters.Length - 2];
|
||||||
for (int i = 2 ; i < parameters.Length ; i++)
|
for (int i = 2; i < parameters.Length; i++)
|
||||||
parmTypes[i - 2] = parameters[i].ParameterType;
|
parmTypes[i - 2] = parameters[i].ParameterType;
|
||||||
m_scriptInvocation[fcall.Method.Name] = new ScriptInvocationData(fcall.Method.Name, fcall, parmTypes, fcall.Method.ReturnType);
|
m_scriptInvocation[fcall.Method.Name] = new ScriptInvocationData(fcall.Method.Name, fcall, parmTypes, fcall.Method.ReturnType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void RegisterScriptInvocation(Type target, string[] methods)
|
||||||
|
{
|
||||||
|
foreach (string method in methods)
|
||||||
|
{
|
||||||
|
MethodInfo mi = GetMethodInfoFromType(target, method, false);
|
||||||
|
if (mi == null)
|
||||||
|
m_log.WarnFormat("[MODULE COMMANDS] Failed to register method {0}", method);
|
||||||
|
else
|
||||||
|
RegisterScriptInvocation(target, mi);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public Delegate[] GetScriptInvocationList()
|
public Delegate[] GetScriptInvocationList()
|
||||||
{
|
{
|
||||||
List<Delegate> ret = new List<Delegate>();
|
List<Delegate> ret = new List<Delegate>();
|
||||||
|
|
|
@ -247,7 +247,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
return GetLinkParts(m_host, linkType);
|
return GetLinkParts(m_host, linkType);
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<SceneObjectPart> GetLinkParts(SceneObjectPart part, int linkType)
|
public static List<SceneObjectPart> GetLinkParts(SceneObjectPart part, int linkType)
|
||||||
{
|
{
|
||||||
List<SceneObjectPart> ret = new List<SceneObjectPart>();
|
List<SceneObjectPart> ret = new List<SceneObjectPart>();
|
||||||
ret.Add(part);
|
ret.Add(part);
|
||||||
|
|
|
@ -693,6 +693,17 @@
|
||||||
;LevelUpload = 0
|
;LevelUpload = 0
|
||||||
|
|
||||||
|
|
||||||
|
[Textures]
|
||||||
|
; If true, textures generated dynamically (i.e. through osSetDynamicTextureData() and similar OSSL functions) are reused where possible
|
||||||
|
; Chiefly, reuse occurs if a texture has already been generated with identical data and settings, and that texture contains no dynamic components
|
||||||
|
; (e.g. images pulled from an external HTTP address).
|
||||||
|
; Reusing previously generated textures results in a much faster update on the viewer but may cause issues if the viewer didn't receive all resolutions of the texture.
|
||||||
|
; Currently, it will also increase asset cache use since temporary dynamic textures are no longer deleted.
|
||||||
|
; Hence, currently considered experimental.
|
||||||
|
; Default is false.
|
||||||
|
ReuseDynamicTextures = false
|
||||||
|
|
||||||
|
|
||||||
[ODEPhysicsSettings]
|
[ODEPhysicsSettings]
|
||||||
; ##
|
; ##
|
||||||
; ## Physics stats settings
|
; ## Physics stats settings
|
||||||
|
|
Loading…
Reference in New Issue