replace lightshare early work
parent
0d76635113
commit
e2be90caaf
|
@ -863,107 +863,6 @@ namespace OpenSim.Data.MySQL
|
|||
}
|
||||
}
|
||||
|
||||
public virtual RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID)
|
||||
{
|
||||
RegionLightShareData nWP = new RegionLightShareData();
|
||||
nWP.OnSave += StoreRegionWindlightSettings;
|
||||
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
{
|
||||
dbcon.Open();
|
||||
|
||||
string command = "select * from `regionwindlight` where region_id = ?regionID";
|
||||
|
||||
using (MySqlCommand cmd = new MySqlCommand(command))
|
||||
{
|
||||
cmd.Connection = dbcon;
|
||||
|
||||
cmd.Parameters.AddWithValue("?regionID", regionUUID.ToString());
|
||||
|
||||
using(IDataReader result = ExecuteReader(cmd))
|
||||
{
|
||||
if(!result.Read())
|
||||
{
|
||||
//No result, so store our default windlight profile and return it
|
||||
nWP.regionID = regionUUID;
|
||||
// StoreRegionWindlightSettings(nWP);
|
||||
return nWP;
|
||||
}
|
||||
else
|
||||
{
|
||||
nWP.regionID = DBGuid.FromDB(result["region_id"]);
|
||||
nWP.waterColor.X = Convert.ToSingle(result["water_color_r"]);
|
||||
nWP.waterColor.Y = Convert.ToSingle(result["water_color_g"]);
|
||||
nWP.waterColor.Z = Convert.ToSingle(result["water_color_b"]);
|
||||
nWP.waterFogDensityExponent = Convert.ToSingle(result["water_fog_density_exponent"]);
|
||||
nWP.underwaterFogModifier = Convert.ToSingle(result["underwater_fog_modifier"]);
|
||||
nWP.reflectionWaveletScale.X = Convert.ToSingle(result["reflection_wavelet_scale_1"]);
|
||||
nWP.reflectionWaveletScale.Y = Convert.ToSingle(result["reflection_wavelet_scale_2"]);
|
||||
nWP.reflectionWaveletScale.Z = Convert.ToSingle(result["reflection_wavelet_scale_3"]);
|
||||
nWP.fresnelScale = Convert.ToSingle(result["fresnel_scale"]);
|
||||
nWP.fresnelOffset = Convert.ToSingle(result["fresnel_offset"]);
|
||||
nWP.refractScaleAbove = Convert.ToSingle(result["refract_scale_above"]);
|
||||
nWP.refractScaleBelow = Convert.ToSingle(result["refract_scale_below"]);
|
||||
nWP.blurMultiplier = Convert.ToSingle(result["blur_multiplier"]);
|
||||
nWP.bigWaveDirection.X = Convert.ToSingle(result["big_wave_direction_x"]);
|
||||
nWP.bigWaveDirection.Y = Convert.ToSingle(result["big_wave_direction_y"]);
|
||||
nWP.littleWaveDirection.X = Convert.ToSingle(result["little_wave_direction_x"]);
|
||||
nWP.littleWaveDirection.Y = Convert.ToSingle(result["little_wave_direction_y"]);
|
||||
UUID.TryParse(result["normal_map_texture"].ToString(),out nWP.normalMapTexture);
|
||||
nWP.horizon.X = Convert.ToSingle(result["horizon_r"]);
|
||||
nWP.horizon.Y = Convert.ToSingle(result["horizon_g"]);
|
||||
nWP.horizon.Z = Convert.ToSingle(result["horizon_b"]);
|
||||
nWP.horizon.W = Convert.ToSingle(result["horizon_i"]);
|
||||
nWP.hazeHorizon = Convert.ToSingle(result["haze_horizon"]);
|
||||
nWP.blueDensity.X = Convert.ToSingle(result["blue_density_r"]);
|
||||
nWP.blueDensity.Y = Convert.ToSingle(result["blue_density_g"]);
|
||||
nWP.blueDensity.Z = Convert.ToSingle(result["blue_density_b"]);
|
||||
nWP.blueDensity.W = Convert.ToSingle(result["blue_density_i"]);
|
||||
nWP.hazeDensity = Convert.ToSingle(result["haze_density"]);
|
||||
nWP.densityMultiplier = Convert.ToSingle(result["density_multiplier"]);
|
||||
nWP.distanceMultiplier = Convert.ToSingle(result["distance_multiplier"]);
|
||||
nWP.maxAltitude = Convert.ToUInt16(result["max_altitude"]);
|
||||
nWP.sunMoonColor.X = Convert.ToSingle(result["sun_moon_color_r"]);
|
||||
nWP.sunMoonColor.Y = Convert.ToSingle(result["sun_moon_color_g"]);
|
||||
nWP.sunMoonColor.Z = Convert.ToSingle(result["sun_moon_color_b"]);
|
||||
nWP.sunMoonColor.W = Convert.ToSingle(result["sun_moon_color_i"]);
|
||||
nWP.sunMoonPosition = Convert.ToSingle(result["sun_moon_position"]);
|
||||
nWP.ambient.X = Convert.ToSingle(result["ambient_r"]);
|
||||
nWP.ambient.Y = Convert.ToSingle(result["ambient_g"]);
|
||||
nWP.ambient.Z = Convert.ToSingle(result["ambient_b"]);
|
||||
nWP.ambient.W = Convert.ToSingle(result["ambient_i"]);
|
||||
nWP.eastAngle = Convert.ToSingle(result["east_angle"]);
|
||||
nWP.sunGlowFocus = Convert.ToSingle(result["sun_glow_focus"]);
|
||||
nWP.sunGlowSize = Convert.ToSingle(result["sun_glow_size"]);
|
||||
nWP.sceneGamma = Convert.ToSingle(result["scene_gamma"]);
|
||||
nWP.starBrightness = Convert.ToSingle(result["star_brightness"]);
|
||||
nWP.cloudColor.X = Convert.ToSingle(result["cloud_color_r"]);
|
||||
nWP.cloudColor.Y = Convert.ToSingle(result["cloud_color_g"]);
|
||||
nWP.cloudColor.Z = Convert.ToSingle(result["cloud_color_b"]);
|
||||
nWP.cloudColor.W = Convert.ToSingle(result["cloud_color_i"]);
|
||||
nWP.cloudXYDensity.X = Convert.ToSingle(result["cloud_x"]);
|
||||
nWP.cloudXYDensity.Y = Convert.ToSingle(result["cloud_y"]);
|
||||
nWP.cloudXYDensity.Z = Convert.ToSingle(result["cloud_density"]);
|
||||
nWP.cloudCoverage = Convert.ToSingle(result["cloud_coverage"]);
|
||||
nWP.cloudScale = Convert.ToSingle(result["cloud_scale"]);
|
||||
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"]);
|
||||
nWP.valid = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
dbcon.Close();
|
||||
}
|
||||
|
||||
return nWP;
|
||||
}
|
||||
|
||||
public virtual RegionSettings LoadRegionSettings(UUID regionUUID)
|
||||
{
|
||||
RegionSettings rs = null;
|
||||
|
@ -1009,127 +908,6 @@ namespace OpenSim.Data.MySQL
|
|||
return rs;
|
||||
}
|
||||
|
||||
public virtual void StoreRegionWindlightSettings(RegionLightShareData wl)
|
||||
{
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
{
|
||||
dbcon.Open();
|
||||
|
||||
using (MySqlCommand cmd = dbcon.CreateCommand())
|
||||
{
|
||||
cmd.CommandText = "REPLACE INTO `regionwindlight` (`region_id`, `water_color_r`, `water_color_g`, "
|
||||
+ "`water_color_b`, `water_fog_density_exponent`, `underwater_fog_modifier`, "
|
||||
+ "`reflection_wavelet_scale_1`, `reflection_wavelet_scale_2`, `reflection_wavelet_scale_3`, "
|
||||
+ "`fresnel_scale`, `fresnel_offset`, `refract_scale_above`, `refract_scale_below`, "
|
||||
+ "`blur_multiplier`, `big_wave_direction_x`, `big_wave_direction_y`, `little_wave_direction_x`, "
|
||||
+ "`little_wave_direction_y`, `normal_map_texture`, `horizon_r`, `horizon_g`, `horizon_b`, "
|
||||
+ "`horizon_i`, `haze_horizon`, `blue_density_r`, `blue_density_g`, `blue_density_b`, "
|
||||
+ "`blue_density_i`, `haze_density`, `density_multiplier`, `distance_multiplier`, `max_altitude`, "
|
||||
+ "`sun_moon_color_r`, `sun_moon_color_g`, `sun_moon_color_b`, `sun_moon_color_i`, `sun_moon_position`, "
|
||||
+ "`ambient_r`, `ambient_g`, `ambient_b`, `ambient_i`, `east_angle`, `sun_glow_focus`, `sun_glow_size`, "
|
||||
+ "`scene_gamma`, `star_brightness`, `cloud_color_r`, `cloud_color_g`, `cloud_color_b`, `cloud_color_i`, "
|
||||
+ "`cloud_x`, `cloud_y`, `cloud_density`, `cloud_coverage`, `cloud_scale`, `cloud_detail_x`, "
|
||||
+ "`cloud_detail_y`, `cloud_detail_density`, `cloud_scroll_x`, `cloud_scroll_x_lock`, `cloud_scroll_y`, "
|
||||
+ "`cloud_scroll_y_lock`, `draw_classic_clouds`) VALUES (?region_id, ?water_color_r, "
|
||||
+ "?water_color_g, ?water_color_b, ?water_fog_density_exponent, ?underwater_fog_modifier, ?reflection_wavelet_scale_1, "
|
||||
+ "?reflection_wavelet_scale_2, ?reflection_wavelet_scale_3, ?fresnel_scale, ?fresnel_offset, ?refract_scale_above, "
|
||||
+ "?refract_scale_below, ?blur_multiplier, ?big_wave_direction_x, ?big_wave_direction_y, ?little_wave_direction_x, "
|
||||
+ "?little_wave_direction_y, ?normal_map_texture, ?horizon_r, ?horizon_g, ?horizon_b, ?horizon_i, ?haze_horizon, "
|
||||
+ "?blue_density_r, ?blue_density_g, ?blue_density_b, ?blue_density_i, ?haze_density, ?density_multiplier, "
|
||||
+ "?distance_multiplier, ?max_altitude, ?sun_moon_color_r, ?sun_moon_color_g, ?sun_moon_color_b, "
|
||||
+ "?sun_moon_color_i, ?sun_moon_position, ?ambient_r, ?ambient_g, ?ambient_b, ?ambient_i, ?east_angle, "
|
||||
+ "?sun_glow_focus, ?sun_glow_size, ?scene_gamma, ?star_brightness, ?cloud_color_r, ?cloud_color_g, "
|
||||
+ "?cloud_color_b, ?cloud_color_i, ?cloud_x, ?cloud_y, ?cloud_density, ?cloud_coverage, ?cloud_scale, "
|
||||
+ "?cloud_detail_x, ?cloud_detail_y, ?cloud_detail_density, ?cloud_scroll_x, ?cloud_scroll_x_lock, "
|
||||
+ "?cloud_scroll_y, ?cloud_scroll_y_lock, ?draw_classic_clouds)"
|
||||
;
|
||||
|
||||
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);
|
||||
}
|
||||
dbcon.Close();
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void RemoveRegionWindlightSettings(UUID regionID)
|
||||
{
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
{
|
||||
dbcon.Open();
|
||||
|
||||
using (MySqlCommand cmd = dbcon.CreateCommand())
|
||||
{
|
||||
cmd.CommandText = "delete from `regionwindlight` where `region_id`=?regionID";
|
||||
cmd.Parameters.AddWithValue("?regionID", regionID.ToString());
|
||||
ExecuteNonQuery(cmd);
|
||||
}
|
||||
dbcon.Close();
|
||||
}
|
||||
}
|
||||
|
||||
#region RegionEnvironmentSettings
|
||||
public string LoadRegionEnvironmentSettings(UUID regionUUID)
|
||||
{
|
||||
|
|
|
@ -825,477 +825,6 @@ namespace OpenSim.Data.PGSQL
|
|||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
public RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID)
|
||||
{
|
||||
RegionLightShareData nWP = new RegionLightShareData();
|
||||
nWP.OnSave += StoreRegionWindlightSettings;
|
||||
|
||||
string sql = @"select * from regionwindlight where ""region_id"" = :regionID";
|
||||
|
||||
using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString))
|
||||
using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn))
|
||||
{
|
||||
cmd.Parameters.Add(_Database.CreateParameter("regionID", regionUUID.ToString() ));
|
||||
conn.Open();
|
||||
using (NpgsqlDataReader result = cmd.ExecuteReader())
|
||||
{
|
||||
if (!result.Read())
|
||||
{
|
||||
//No result, so store our default windlight profile and return it
|
||||
nWP.regionID = regionUUID;
|
||||
StoreRegionWindlightSettings(nWP);
|
||||
return nWP;
|
||||
}
|
||||
else
|
||||
{
|
||||
nWP.regionID = DBGuid.FromDB(result["region_id"]);
|
||||
nWP.waterColor.X = Convert.ToSingle(result["water_color_r"]);
|
||||
nWP.waterColor.Y = Convert.ToSingle(result["water_color_g"]);
|
||||
nWP.waterColor.Z = Convert.ToSingle(result["water_color_b"]);
|
||||
nWP.waterFogDensityExponent = Convert.ToSingle(result["water_fog_density_exponent"]);
|
||||
nWP.underwaterFogModifier = Convert.ToSingle(result["underwater_fog_modifier"]);
|
||||
nWP.reflectionWaveletScale.X = Convert.ToSingle(result["reflection_wavelet_scale_1"]);
|
||||
nWP.reflectionWaveletScale.Y = Convert.ToSingle(result["reflection_wavelet_scale_2"]);
|
||||
nWP.reflectionWaveletScale.Z = Convert.ToSingle(result["reflection_wavelet_scale_3"]);
|
||||
nWP.fresnelScale = Convert.ToSingle(result["fresnel_scale"]);
|
||||
nWP.fresnelOffset = Convert.ToSingle(result["fresnel_offset"]);
|
||||
nWP.refractScaleAbove = Convert.ToSingle(result["refract_scale_above"]);
|
||||
nWP.refractScaleBelow = Convert.ToSingle(result["refract_scale_below"]);
|
||||
nWP.blurMultiplier = Convert.ToSingle(result["blur_multiplier"]);
|
||||
nWP.bigWaveDirection.X = Convert.ToSingle(result["big_wave_direction_x"]);
|
||||
nWP.bigWaveDirection.Y = Convert.ToSingle(result["big_wave_direction_y"]);
|
||||
nWP.littleWaveDirection.X = Convert.ToSingle(result["little_wave_direction_x"]);
|
||||
nWP.littleWaveDirection.Y = Convert.ToSingle(result["little_wave_direction_y"]);
|
||||
UUID.TryParse(result["normal_map_texture"].ToString(), out nWP.normalMapTexture);
|
||||
nWP.horizon.X = Convert.ToSingle(result["horizon_r"]);
|
||||
nWP.horizon.Y = Convert.ToSingle(result["horizon_g"]);
|
||||
nWP.horizon.Z = Convert.ToSingle(result["horizon_b"]);
|
||||
nWP.horizon.W = Convert.ToSingle(result["horizon_i"]);
|
||||
nWP.hazeHorizon = Convert.ToSingle(result["haze_horizon"]);
|
||||
nWP.blueDensity.X = Convert.ToSingle(result["blue_density_r"]);
|
||||
nWP.blueDensity.Y = Convert.ToSingle(result["blue_density_g"]);
|
||||
nWP.blueDensity.Z = Convert.ToSingle(result["blue_density_b"]);
|
||||
nWP.blueDensity.W = Convert.ToSingle(result["blue_density_i"]);
|
||||
nWP.hazeDensity = Convert.ToSingle(result["haze_density"]);
|
||||
nWP.densityMultiplier = Convert.ToSingle(result["density_multiplier"]);
|
||||
nWP.distanceMultiplier = Convert.ToSingle(result["distance_multiplier"]);
|
||||
nWP.maxAltitude = Convert.ToUInt16(result["max_altitude"]);
|
||||
nWP.sunMoonColor.X = Convert.ToSingle(result["sun_moon_color_r"]);
|
||||
nWP.sunMoonColor.Y = Convert.ToSingle(result["sun_moon_color_g"]);
|
||||
nWP.sunMoonColor.Z = Convert.ToSingle(result["sun_moon_color_b"]);
|
||||
nWP.sunMoonColor.W = Convert.ToSingle(result["sun_moon_color_i"]);
|
||||
nWP.sunMoonPosition = Convert.ToSingle(result["sun_moon_position"]);
|
||||
nWP.ambient.X = Convert.ToSingle(result["ambient_r"]);
|
||||
nWP.ambient.Y = Convert.ToSingle(result["ambient_g"]);
|
||||
nWP.ambient.Z = Convert.ToSingle(result["ambient_b"]);
|
||||
nWP.ambient.W = Convert.ToSingle(result["ambient_i"]);
|
||||
nWP.eastAngle = Convert.ToSingle(result["east_angle"]);
|
||||
nWP.sunGlowFocus = Convert.ToSingle(result["sun_glow_focus"]);
|
||||
nWP.sunGlowSize = Convert.ToSingle(result["sun_glow_size"]);
|
||||
nWP.sceneGamma = Convert.ToSingle(result["scene_gamma"]);
|
||||
nWP.starBrightness = Convert.ToSingle(result["star_brightness"]);
|
||||
nWP.cloudColor.X = Convert.ToSingle(result["cloud_color_r"]);
|
||||
nWP.cloudColor.Y = Convert.ToSingle(result["cloud_color_g"]);
|
||||
nWP.cloudColor.Z = Convert.ToSingle(result["cloud_color_b"]);
|
||||
nWP.cloudColor.W = Convert.ToSingle(result["cloud_color_i"]);
|
||||
nWP.cloudXYDensity.X = Convert.ToSingle(result["cloud_x"]);
|
||||
nWP.cloudXYDensity.Y = Convert.ToSingle(result["cloud_y"]);
|
||||
nWP.cloudXYDensity.Z = Convert.ToSingle(result["cloud_density"]);
|
||||
nWP.cloudCoverage = Convert.ToSingle(result["cloud_coverage"]);
|
||||
nWP.cloudScale = Convert.ToSingle(result["cloud_scale"]);
|
||||
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"]);
|
||||
nWP.valid = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return nWP;
|
||||
}
|
||||
|
||||
public void RemoveRegionWindlightSettings(UUID regionID)
|
||||
{
|
||||
string sql = @"delete from regionwindlight where ""region_id"" = :region_id";
|
||||
using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString))
|
||||
using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn))
|
||||
{
|
||||
conn.Open();
|
||||
cmd.Parameters.Add(_Database.CreateParameter("region_id", regionID.ToString()));
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
|
||||
public void StoreRegionWindlightSettings(RegionLightShareData wl)
|
||||
{
|
||||
string sql = @"select region_id from regionwindlight where ""region_id"" = :region_id limit 1;";
|
||||
bool exists = false;
|
||||
using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString))
|
||||
{
|
||||
conn.Open();
|
||||
using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn))
|
||||
{
|
||||
cmd.Parameters.Add(_Database.CreateParameter("region_id", wl.regionID.ToString() ));
|
||||
NpgsqlDataReader dr = cmd.ExecuteReader();
|
||||
exists = dr.Read();
|
||||
}
|
||||
}
|
||||
if (exists)
|
||||
{
|
||||
RemoveRegionWindlightSettings(wl.regionID);
|
||||
}
|
||||
|
||||
// sql insert
|
||||
sql = @"INSERT INTO regionwindlight
|
||||
(region_id
|
||||
,water_color_r
|
||||
,water_color_g
|
||||
,water_color_b
|
||||
,water_fog_density_exponent
|
||||
,underwater_fog_modifier
|
||||
,reflection_wavelet_scale_1
|
||||
,reflection_wavelet_scale_2
|
||||
,reflection_wavelet_scale_3
|
||||
,fresnel_scale
|
||||
,fresnel_offset
|
||||
,refract_scale_above
|
||||
,refract_scale_below
|
||||
,blur_multiplier
|
||||
,big_wave_direction_x
|
||||
,big_wave_direction_y
|
||||
,little_wave_direction_x
|
||||
,little_wave_direction_y
|
||||
,normal_map_texture
|
||||
,horizon_r
|
||||
,horizon_g
|
||||
,horizon_b
|
||||
,horizon_i
|
||||
,haze_horizon
|
||||
,blue_density_r
|
||||
,blue_density_g
|
||||
,blue_density_b
|
||||
,blue_density_i
|
||||
,haze_density
|
||||
,density_multiplier
|
||||
,distance_multiplier
|
||||
,max_altitude
|
||||
,sun_moon_color_r
|
||||
,sun_moon_color_g
|
||||
,sun_moon_color_b
|
||||
,sun_moon_color_i
|
||||
,sun_moon_position
|
||||
,ambient_r
|
||||
,ambient_g
|
||||
,ambient_b
|
||||
,ambient_i
|
||||
,east_angle
|
||||
,sun_glow_focus
|
||||
,sun_glow_size
|
||||
,scene_gamma
|
||||
,star_brightness
|
||||
,cloud_color_r
|
||||
,cloud_color_g
|
||||
,cloud_color_b
|
||||
,cloud_color_i
|
||||
,cloud_x
|
||||
,cloud_y
|
||||
,cloud_density
|
||||
,cloud_coverage
|
||||
,cloud_scale
|
||||
,cloud_detail_x
|
||||
,cloud_detail_y
|
||||
,cloud_detail_density
|
||||
,cloud_scroll_x
|
||||
,cloud_scroll_x_lock
|
||||
,cloud_scroll_y
|
||||
,cloud_scroll_y_lock
|
||||
,draw_classic_clouds)
|
||||
VALUES
|
||||
(:region_id
|
||||
,:water_color_r
|
||||
,:water_color_g
|
||||
,:water_color_b
|
||||
,:water_fog_density_exponent
|
||||
,:underwater_fog_modifier
|
||||
,:reflection_wavelet_scale_1
|
||||
,:reflection_wavelet_scale_2
|
||||
,:reflection_wavelet_scale_3
|
||||
,:fresnel_scale
|
||||
,:fresnel_offset
|
||||
,:refract_scale_above
|
||||
,:refract_scale_below
|
||||
,:blur_multiplier
|
||||
,:big_wave_direction_x
|
||||
,:big_wave_direction_y
|
||||
,:little_wave_direction_x
|
||||
,:little_wave_direction_y
|
||||
,:normal_map_texture
|
||||
,:horizon_r
|
||||
,:horizon_g
|
||||
,:horizon_b
|
||||
,:horizon_i
|
||||
,:haze_horizon
|
||||
,:blue_density_r
|
||||
,:blue_density_g
|
||||
,:blue_density_b
|
||||
,:blue_density_i
|
||||
,:haze_density
|
||||
,:density_multiplier
|
||||
,:distance_multiplier
|
||||
,:max_altitude
|
||||
,:sun_moon_color_r
|
||||
,:sun_moon_color_g
|
||||
,:sun_moon_color_b
|
||||
,:sun_moon_color_i
|
||||
,:sun_moon_position
|
||||
,:ambient_r
|
||||
,:ambient_g
|
||||
,:ambient_b
|
||||
,:ambient_i
|
||||
,:east_angle
|
||||
,:sun_glow_focus
|
||||
,:sun_glow_size
|
||||
,:scene_gamma
|
||||
,:star_brightness
|
||||
,:cloud_color_r
|
||||
,:cloud_color_g
|
||||
,:cloud_color_b
|
||||
,:cloud_color_i
|
||||
,:cloud_x
|
||||
,:cloud_y
|
||||
,:cloud_density
|
||||
,:cloud_coverage
|
||||
,:cloud_scale
|
||||
,:cloud_detail_x
|
||||
,:cloud_detail_y
|
||||
,:cloud_detail_density
|
||||
,:cloud_scroll_x
|
||||
,:cloud_scroll_x_lock
|
||||
,:cloud_scroll_y
|
||||
,:cloud_scroll_y_lock
|
||||
,:draw_classic_clouds);";
|
||||
|
||||
using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString))
|
||||
{
|
||||
conn.Open();
|
||||
using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn))
|
||||
{
|
||||
cmd.Parameters.Add(_Database.CreateParameter("region_id", wl.regionID.ToString()));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("water_color_r", wl.waterColor.X));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("water_color_g", wl.waterColor.Y));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("water_color_b", wl.waterColor.Z));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("water_fog_density_exponent", wl.waterFogDensityExponent));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("underwater_fog_modifier", wl.underwaterFogModifier));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("reflection_wavelet_scale_1", wl.reflectionWaveletScale.X));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("reflection_wavelet_scale_2", wl.reflectionWaveletScale.Y));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("reflection_wavelet_scale_3", wl.reflectionWaveletScale.Z));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("fresnel_scale", wl.fresnelScale));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("fresnel_offset", wl.fresnelOffset));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("refract_scale_above", wl.refractScaleAbove));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("refract_scale_below", wl.refractScaleBelow));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("blur_multiplier", wl.blurMultiplier));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("big_wave_direction_x", wl.bigWaveDirection.X));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("big_wave_direction_y", wl.bigWaveDirection.Y));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("little_wave_direction_x", wl.littleWaveDirection.X));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("little_wave_direction_y", wl.littleWaveDirection.Y));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("normal_map_texture", wl.normalMapTexture.ToString()));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("horizon_r", wl.horizon.X));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("horizon_g", wl.horizon.Y));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("horizon_b", wl.horizon.Z));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("horizon_i", wl.horizon.W));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("haze_horizon", wl.hazeHorizon));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("blue_density_r", wl.blueDensity.X));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("blue_density_g", wl.blueDensity.Y));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("blue_density_b", wl.blueDensity.Z));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("blue_density_i", wl.blueDensity.W));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("haze_density", wl.hazeDensity));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("density_multiplier", wl.densityMultiplier));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("distance_multiplier", wl.distanceMultiplier));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("max_altitude", wl.maxAltitude));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("sun_moon_color_r", wl.sunMoonColor.X));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("sun_moon_color_g", wl.sunMoonColor.Y));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("sun_moon_color_b", wl.sunMoonColor.Z));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("sun_moon_color_i", wl.sunMoonColor.W));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("sun_moon_position", wl.sunMoonPosition));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("ambient_r", wl.ambient.X));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("ambient_g", wl.ambient.Y));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("ambient_b", wl.ambient.Z));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("ambient_i", wl.ambient.W));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("east_angle", wl.eastAngle));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("sun_glow_focus", wl.sunGlowFocus));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("sun_glow_size", wl.sunGlowSize));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("scene_gamma", wl.sceneGamma));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("star_brightness", wl.starBrightness));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("cloud_color_r", wl.cloudColor.X));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("cloud_color_g", wl.cloudColor.Y));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("cloud_color_b", wl.cloudColor.Z));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("cloud_color_i", wl.cloudColor.W));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("cloud_x", wl.cloudXYDensity.X));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("cloud_y", wl.cloudXYDensity.Y));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("cloud_density", wl.cloudXYDensity.Z));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("cloud_coverage", wl.cloudCoverage));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("cloud_scale", wl.cloudScale));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("cloud_detail_x", wl.cloudDetailXYDensity.X));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("cloud_detail_y", wl.cloudDetailXYDensity.Y));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("cloud_detail_density", wl.cloudDetailXYDensity.Z));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("cloud_scroll_x", wl.cloudScrollX));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("cloud_scroll_x_lock", wl.cloudScrollXLock));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("cloud_scroll_y", wl.cloudScrollY));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("cloud_scroll_y_lock", wl.cloudScrollYLock));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("draw_classic_clouds", wl.drawClassicClouds));
|
||||
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
#region update
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// // sql update
|
||||
// sql = @"UPDATE [OpenSim].[dbo].[regionwindlight]
|
||||
// SET [region_id] = @region_id
|
||||
// ,[water_color_r] = @water_color_r
|
||||
// ,[water_color_g] = @water_color_g
|
||||
// ,[water_color_b] = @water_color_b
|
||||
// ,[water_fog_density_exponent] = @water_fog_density_exponent
|
||||
// ,[underwater_fog_modifier] = @underwater_fog_modifier
|
||||
// ,[reflection_wavelet_scale_1] = @reflection_wavelet_scale_1
|
||||
// ,[reflection_wavelet_scale_2] = @reflection_wavelet_scale_2
|
||||
// ,[reflection_wavelet_scale_3] = @reflection_wavelet_scale_3
|
||||
// ,[fresnel_scale] = @fresnel_scale
|
||||
// ,[fresnel_offset] = @fresnel_offset
|
||||
// ,[refract_scale_above] = @refract_scale_above
|
||||
// ,[refract_scale_below] = @refract_scale_below
|
||||
// ,[blur_multiplier] = @blur_multiplier
|
||||
// ,[big_wave_direction_x] = @big_wave_direction_x
|
||||
// ,[big_wave_direction_y] = @big_wave_direction_y
|
||||
// ,[little_wave_direction_x] = @little_wave_direction_x
|
||||
// ,[little_wave_direction_y] = @little_wave_direction_y
|
||||
// ,[normal_map_texture] = @normal_map_texture
|
||||
// ,[horizon_r] = @horizon_r
|
||||
// ,[horizon_g] = @horizon_g
|
||||
// ,[horizon_b] = @horizon_b
|
||||
// ,[horizon_i] = @horizon_i
|
||||
// ,[haze_horizon] = @haze_horizon
|
||||
// ,[blue_density_r] = @blue_density_r
|
||||
// ,[blue_density_g] = @blue_density_g
|
||||
// ,[blue_density_b] = @blue_density_b
|
||||
// ,[blue_density_i] = @blue_density_i
|
||||
// ,[haze_density] = @haze_density
|
||||
// ,[density_multiplier] = @density_multiplier
|
||||
// ,[distance_multiplier] = @distance_multiplier
|
||||
// ,[max_altitude] = @max_altitude
|
||||
// ,[sun_moon_color_r] = @sun_moon_color_r
|
||||
// ,[sun_moon_color_g] = @sun_moon_color_g
|
||||
// ,[sun_moon_color_b] = @sun_moon_color_b
|
||||
// ,[sun_moon_color_i] = @sun_moon_color_i
|
||||
// ,[sun_moon_position] = @sun_moon_position
|
||||
// ,[ambient_r] = @ambient_r
|
||||
// ,[ambient_g] = @ambient_g
|
||||
// ,[ambient_b] = @ambient_b
|
||||
// ,[ambient_i] = @ambient_i
|
||||
// ,[east_angle] = @east_angle
|
||||
// ,[sun_glow_focus] = @sun_glow_focus
|
||||
// ,[sun_glow_size] = @sun_glow_size
|
||||
// ,[scene_gamma] = @scene_gamma
|
||||
// ,[star_brightness] = @star_brightness
|
||||
// ,[cloud_color_r] = @cloud_color_r
|
||||
// ,[cloud_color_g] = @cloud_color_g
|
||||
// ,[cloud_color_b] = @cloud_color_b
|
||||
// ,[cloud_color_i] = @cloud_color_i
|
||||
// ,[cloud_x] = @cloud_x
|
||||
// ,[cloud_y] = @cloud_y
|
||||
// ,[cloud_density] = @cloud_density
|
||||
// ,[cloud_coverage] = @cloud_coverage
|
||||
// ,[cloud_scale] = @cloud_scale
|
||||
// ,[cloud_detail_x] = @cloud_detail_x
|
||||
// ,[cloud_detail_y] = @cloud_detail_y
|
||||
// ,[cloud_detail_density] = @cloud_detail_density
|
||||
// ,[cloud_scroll_x] = @cloud_scroll_x
|
||||
// ,[cloud_scroll_x_lock] = @cloud_scroll_x_lock
|
||||
// ,[cloud_scroll_y] = @cloud_scroll_y
|
||||
// ,[cloud_scroll_y_lock] = @cloud_scroll_y_lock
|
||||
// ,[draw_classic_clouds] = @draw_classic_clouds
|
||||
// WHERE region_id = @region_id";
|
||||
// using (SqlConnection conn = new SqlConnection(m_connectionString))
|
||||
// {
|
||||
// conn.Open();
|
||||
// using (SqlCommand cmd = new SqlCommand(sql, conn))
|
||||
// {
|
||||
// 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);
|
||||
|
||||
// cmd.ExecuteNonQuery();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
#endregion
|
||||
}
|
||||
|
||||
#region Environment Settings
|
||||
public string LoadRegionEnvironmentSettings(UUID regionUUID)
|
||||
|
|
|
@ -429,75 +429,6 @@ namespace OpenSim.Data.SQLite
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Load windlight settings from region storage
|
||||
/// </summary>
|
||||
/// <param name="regionUUID">RegionID</param>
|
||||
public RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID)
|
||||
{
|
||||
RegionLightShareData wl = null;
|
||||
|
||||
lock (ds)
|
||||
{
|
||||
DataTable windlightTable = ds.Tables["regionwindlight"];
|
||||
DataRow windlightRow = windlightTable.Rows.Find(regionUUID.ToString());
|
||||
if (windlightRow == null)
|
||||
{
|
||||
wl = new RegionLightShareData();
|
||||
wl.regionID = regionUUID;
|
||||
StoreRegionWindlightSettings(wl);
|
||||
return wl;
|
||||
}
|
||||
wl = buildRegionWindlight(windlightRow);
|
||||
return wl;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Remove windlight settings from region storage
|
||||
/// </summary>
|
||||
/// <param name="regionID">RegionID</param>
|
||||
public void RemoveRegionWindlightSettings(UUID regionID)
|
||||
{
|
||||
lock (ds)
|
||||
{
|
||||
DataTable windlightTable = ds.Tables["regionwindlight"];
|
||||
DataRow windlightRow = windlightTable.Rows.Find(regionID.ToString());
|
||||
|
||||
if (windlightRow != null)
|
||||
{
|
||||
windlightRow.Delete();
|
||||
}
|
||||
}
|
||||
Commit();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds an windlight into region storage
|
||||
/// </summary>
|
||||
/// <param name="wl">RegionLightShareData</param>
|
||||
public void StoreRegionWindlightSettings(RegionLightShareData wl)
|
||||
{
|
||||
lock (ds)
|
||||
{
|
||||
DataTable windlightTable = ds.Tables["regionwindlight"];
|
||||
DataRow windlightRow = windlightTable.Rows.Find(wl.regionID.ToString());
|
||||
|
||||
if (windlightRow == null)
|
||||
{
|
||||
windlightRow = windlightTable.NewRow();
|
||||
fillRegionWindlightRow(windlightRow, wl);
|
||||
windlightTable.Rows.Add(windlightRow);
|
||||
}
|
||||
else
|
||||
{
|
||||
fillRegionWindlightRow(windlightRow, wl);
|
||||
}
|
||||
|
||||
Commit();
|
||||
}
|
||||
}
|
||||
|
||||
#region Region Environment Settings
|
||||
public string LoadRegionEnvironmentSettings(UUID regionUUID)
|
||||
{
|
||||
|
@ -2038,86 +1969,12 @@ namespace OpenSim.Data.SQLite
|
|||
newSettings.ParcelImageID = new UUID((String)row["parcel_tile_ID"]);
|
||||
newSettings.GodBlockSearch = Convert.ToBoolean(row["block_search"]);
|
||||
newSettings.Casino = Convert.ToBoolean(row["casino"]);
|
||||
if (!(row["cacheID"] is System.DBNull))
|
||||
newSettings.CacheID = new UUID((String)row["cacheID"]);
|
||||
|
||||
return newSettings;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Build a windlight entry from the persisted data.
|
||||
/// </summary>
|
||||
/// <param name="row"></param>
|
||||
/// <returns>RegionLightShareData</returns>
|
||||
private RegionLightShareData buildRegionWindlight(DataRow row)
|
||||
{
|
||||
RegionLightShareData windlight = new RegionLightShareData();
|
||||
|
||||
windlight.regionID = new UUID((string)row["region_id"]);
|
||||
windlight.waterColor.X = Convert.ToSingle(row["water_color_r"]);
|
||||
windlight.waterColor.Y = Convert.ToSingle(row["water_color_g"]);
|
||||
windlight.waterColor.Z = Convert.ToSingle(row["water_color_b"]);
|
||||
//windlight.waterColor.W = Convert.ToSingle(row["water_color_i"]); //not implemented
|
||||
windlight.waterFogDensityExponent = Convert.ToSingle(row["water_fog_density_exponent"]);
|
||||
windlight.underwaterFogModifier = Convert.ToSingle(row["underwater_fog_modifier"]);
|
||||
windlight.reflectionWaveletScale.X = Convert.ToSingle(row["reflection_wavelet_scale_1"]);
|
||||
windlight.reflectionWaveletScale.Y = Convert.ToSingle(row["reflection_wavelet_scale_2"]);
|
||||
windlight.reflectionWaveletScale.Z = Convert.ToSingle(row["reflection_wavelet_scale_3"]);
|
||||
windlight.fresnelScale = Convert.ToSingle(row["fresnel_scale"]);
|
||||
windlight.fresnelOffset = Convert.ToSingle(row["fresnel_offset"]);
|
||||
windlight.refractScaleAbove = Convert.ToSingle(row["refract_scale_above"]);
|
||||
windlight.refractScaleBelow = Convert.ToSingle(row["refract_scale_below"]);
|
||||
windlight.blurMultiplier = Convert.ToSingle(row["blur_multiplier"]);
|
||||
windlight.bigWaveDirection.X = Convert.ToSingle(row["big_wave_direction_x"]);
|
||||
windlight.bigWaveDirection.Y = Convert.ToSingle(row["big_wave_direction_y"]);
|
||||
windlight.littleWaveDirection.X = Convert.ToSingle(row["little_wave_direction_x"]);
|
||||
windlight.littleWaveDirection.Y = Convert.ToSingle(row["little_wave_direction_y"]);
|
||||
windlight.normalMapTexture = new UUID((string)row["normal_map_texture"]);
|
||||
windlight.horizon.X = Convert.ToSingle(row["horizon_r"]);
|
||||
windlight.horizon.Y = Convert.ToSingle(row["horizon_g"]);
|
||||
windlight.horizon.Z = Convert.ToSingle(row["horizon_b"]);
|
||||
windlight.horizon.W = Convert.ToSingle(row["horizon_i"]);
|
||||
windlight.hazeHorizon = Convert.ToSingle(row["haze_horizon"]);
|
||||
windlight.blueDensity.X = Convert.ToSingle(row["blue_density_r"]);
|
||||
windlight.blueDensity.Y = Convert.ToSingle(row["blue_density_g"]);
|
||||
windlight.blueDensity.Z = Convert.ToSingle(row["blue_density_b"]);
|
||||
windlight.blueDensity.W = Convert.ToSingle(row["blue_density_i"]);
|
||||
windlight.hazeDensity = Convert.ToSingle(row["haze_density"]);
|
||||
windlight.densityMultiplier = Convert.ToSingle(row["density_multiplier"]);
|
||||
windlight.distanceMultiplier = Convert.ToSingle(row["distance_multiplier"]);
|
||||
windlight.maxAltitude = Convert.ToUInt16(row["max_altitude"]);
|
||||
windlight.sunMoonColor.X = Convert.ToSingle(row["sun_moon_color_r"]);
|
||||
windlight.sunMoonColor.Y = Convert.ToSingle(row["sun_moon_color_g"]);
|
||||
windlight.sunMoonColor.Z = Convert.ToSingle(row["sun_moon_color_b"]);
|
||||
windlight.sunMoonColor.W = Convert.ToSingle(row["sun_moon_color_i"]);
|
||||
windlight.sunMoonPosition = Convert.ToSingle(row["sun_moon_position"]);
|
||||
windlight.ambient.X = Convert.ToSingle(row["ambient_r"]);
|
||||
windlight.ambient.Y = Convert.ToSingle(row["ambient_g"]);
|
||||
windlight.ambient.Z = Convert.ToSingle(row["ambient_b"]);
|
||||
windlight.ambient.W = Convert.ToSingle(row["ambient_i"]);
|
||||
windlight.eastAngle = Convert.ToSingle(row["east_angle"]);
|
||||
windlight.sunGlowFocus = Convert.ToSingle(row["sun_glow_focus"]);
|
||||
windlight.sunGlowSize = Convert.ToSingle(row["sun_glow_size"]);
|
||||
windlight.sceneGamma = Convert.ToSingle(row["scene_gamma"]);
|
||||
windlight.starBrightness = Convert.ToSingle(row["star_brightness"]);
|
||||
windlight.cloudColor.X = Convert.ToSingle(row["cloud_color_r"]);
|
||||
windlight.cloudColor.Y = Convert.ToSingle(row["cloud_color_g"]);
|
||||
windlight.cloudColor.Z = Convert.ToSingle(row["cloud_color_b"]);
|
||||
windlight.cloudColor.W = Convert.ToSingle(row["cloud_color_i"]);
|
||||
windlight.cloudXYDensity.X = Convert.ToSingle(row["cloud_x"]);
|
||||
windlight.cloudXYDensity.Y = Convert.ToSingle(row["cloud_y"]);
|
||||
windlight.cloudXYDensity.Z = Convert.ToSingle(row["cloud_density"]);
|
||||
windlight.cloudCoverage = Convert.ToSingle(row["cloud_coverage"]);
|
||||
windlight.cloudScale = Convert.ToSingle(row["cloud_scale"]);
|
||||
windlight.cloudDetailXYDensity.X = Convert.ToSingle(row["cloud_detail_x"]);
|
||||
windlight.cloudDetailXYDensity.Y = Convert.ToSingle(row["cloud_detail_y"]);
|
||||
windlight.cloudDetailXYDensity.Z = Convert.ToSingle(row["cloud_detail_density"]);
|
||||
windlight.cloudScrollX = Convert.ToSingle(row["cloud_scroll_x"]);
|
||||
windlight.cloudScrollXLock = Convert.ToBoolean(row["cloud_scroll_x_lock"]);
|
||||
windlight.cloudScrollY = Convert.ToSingle(row["cloud_scroll_y"]);
|
||||
windlight.cloudScrollYLock = Convert.ToBoolean(row["cloud_scroll_y_lock"]);
|
||||
windlight.drawClassicClouds = Convert.ToBoolean(row["draw_classic_clouds"]);
|
||||
|
||||
return windlight;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Build a land access entry from the persisted data.
|
||||
/// </summary>
|
||||
|
@ -2461,79 +2318,6 @@ namespace OpenSim.Data.SQLite
|
|||
row["cacheID"] = settings.CacheID;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="row"></param>
|
||||
/// <param name="windlight"></param>
|
||||
private static void fillRegionWindlightRow(DataRow row, RegionLightShareData windlight)
|
||||
{
|
||||
row["region_id"] = windlight.regionID.ToString();
|
||||
row["water_color_r"] = windlight.waterColor.X;
|
||||
row["water_color_g"] = windlight.waterColor.Y;
|
||||
row["water_color_b"] = windlight.waterColor.Z;
|
||||
row["water_color_i"] = 1; //windlight.waterColor.W; //not implemented
|
||||
row["water_fog_density_exponent"] = windlight.waterFogDensityExponent;
|
||||
row["underwater_fog_modifier"] = windlight.underwaterFogModifier;
|
||||
row["reflection_wavelet_scale_1"] = windlight.reflectionWaveletScale.X;
|
||||
row["reflection_wavelet_scale_2"] = windlight.reflectionWaveletScale.Y;
|
||||
row["reflection_wavelet_scale_3"] = windlight.reflectionWaveletScale.Z;
|
||||
row["fresnel_scale"] = windlight.fresnelScale;
|
||||
row["fresnel_offset"] = windlight.fresnelOffset;
|
||||
row["refract_scale_above"] = windlight.refractScaleAbove;
|
||||
row["refract_scale_below"] = windlight.refractScaleBelow;
|
||||
row["blur_multiplier"] = windlight.blurMultiplier;
|
||||
row["big_wave_direction_x"] = windlight.bigWaveDirection.X;
|
||||
row["big_wave_direction_y"] = windlight.bigWaveDirection.Y;
|
||||
row["little_wave_direction_x"] = windlight.littleWaveDirection.X;
|
||||
row["little_wave_direction_y"] = windlight.littleWaveDirection.Y;
|
||||
row["normal_map_texture"] = windlight.normalMapTexture.ToString();
|
||||
row["horizon_r"] = windlight.horizon.X;
|
||||
row["horizon_g"] = windlight.horizon.Y;
|
||||
row["horizon_b"] = windlight.horizon.Z;
|
||||
row["horizon_i"] = windlight.horizon.W;
|
||||
row["haze_horizon"] = windlight.hazeHorizon;
|
||||
row["blue_density_r"] = windlight.blueDensity.X;
|
||||
row["blue_density_g"] = windlight.blueDensity.Y;
|
||||
row["blue_density_b"] = windlight.blueDensity.Z;
|
||||
row["blue_density_i"] = windlight.blueDensity.W;
|
||||
row["haze_density"] = windlight.hazeDensity;
|
||||
row["density_multiplier"] = windlight.densityMultiplier;
|
||||
row["distance_multiplier"] = windlight.distanceMultiplier;
|
||||
row["max_altitude"] = windlight.maxAltitude;
|
||||
row["sun_moon_color_r"] = windlight.sunMoonColor.X;
|
||||
row["sun_moon_color_g"] = windlight.sunMoonColor.Y;
|
||||
row["sun_moon_color_b"] = windlight.sunMoonColor.Z;
|
||||
row["sun_moon_color_i"] = windlight.sunMoonColor.W;
|
||||
row["sun_moon_position"] = windlight.sunMoonPosition;
|
||||
row["ambient_r"] = windlight.ambient.X;
|
||||
row["ambient_g"] = windlight.ambient.Y;
|
||||
row["ambient_b"] = windlight.ambient.Z;
|
||||
row["ambient_i"] = windlight.ambient.W;
|
||||
row["east_angle"] = windlight.eastAngle;
|
||||
row["sun_glow_focus"] = windlight.sunGlowFocus;
|
||||
row["sun_glow_size"] = windlight.sunGlowSize;
|
||||
row["scene_gamma"] = windlight.sceneGamma;
|
||||
row["star_brightness"] = windlight.starBrightness;
|
||||
row["cloud_color_r"] = windlight.cloudColor.X;
|
||||
row["cloud_color_g"] = windlight.cloudColor.Y;
|
||||
row["cloud_color_b"] = windlight.cloudColor.Z;
|
||||
row["cloud_color_i"] = windlight.cloudColor.W;
|
||||
row["cloud_x"] = windlight.cloudXYDensity.X;
|
||||
row["cloud_y"] = windlight.cloudXYDensity.Y;
|
||||
row["cloud_density"] = windlight.cloudXYDensity.Z;
|
||||
row["cloud_coverage"] = windlight.cloudCoverage;
|
||||
row["cloud_scale"] = windlight.cloudScale;
|
||||
row["cloud_detail_x"] = windlight.cloudDetailXYDensity.X;
|
||||
row["cloud_detail_y"] = windlight.cloudDetailXYDensity.Y;
|
||||
row["cloud_detail_density"] = windlight.cloudDetailXYDensity.Z;
|
||||
row["cloud_scroll_x"] = windlight.cloudScrollX;
|
||||
row["cloud_scroll_x_lock"] = windlight.cloudScrollXLock;
|
||||
row["cloud_scroll_y"] = windlight.cloudScrollY;
|
||||
row["cloud_scroll_y_lock"] = windlight.cloudScrollYLock;
|
||||
row["draw_classic_clouds"] = windlight.drawClassicClouds;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
|
|
|
@ -40,69 +40,12 @@ using OpenMetaverse.StructuredData;
|
|||
|
||||
namespace OpenSim.Framework
|
||||
{
|
||||
[Serializable]
|
||||
public class RegionLightShareData : ICloneable
|
||||
{
|
||||
public bool valid = false;
|
||||
public UUID regionID = UUID.Zero;
|
||||
public Vector3 waterColor = new Vector3(4.0f,38.0f,64.0f);
|
||||
public float waterFogDensityExponent = 4.0f;
|
||||
public float underwaterFogModifier = 0.25f;
|
||||
public Vector3 reflectionWaveletScale = new Vector3(2.0f,2.0f,2.0f);
|
||||
public float fresnelScale = 0.40f;
|
||||
public float fresnelOffset = 0.50f;
|
||||
public float refractScaleAbove = 0.03f;
|
||||
public float refractScaleBelow = 0.20f;
|
||||
public float blurMultiplier = 0.040f;
|
||||
public Vector2 bigWaveDirection = new Vector2(1.05f,-0.42f);
|
||||
public Vector2 littleWaveDirection = new Vector2(1.11f,-1.16f);
|
||||
public UUID normalMapTexture = new UUID("822ded49-9a6c-f61c-cb89-6df54f42cdf4");
|
||||
public Vector4 horizon = new Vector4(0.25f, 0.25f, 0.32f, 0.32f);
|
||||
public float hazeHorizon = 0.19f;
|
||||
public Vector4 blueDensity = new Vector4(0.12f, 0.22f, 0.38f, 0.38f);
|
||||
public float hazeDensity = 0.70f;
|
||||
public float densityMultiplier = 0.18f;
|
||||
public float distanceMultiplier = 0.8f;
|
||||
public UInt16 maxAltitude = 1605;
|
||||
public Vector4 sunMoonColor = new Vector4(0.24f, 0.26f, 0.30f, 0.30f);
|
||||
public float sunMoonPosition = 0.317f;
|
||||
public Vector4 ambient = new Vector4(0.35f,0.35f,0.35f,0.35f);
|
||||
public float eastAngle = 0.0f;
|
||||
public float sunGlowFocus = 0.10f;
|
||||
public float sunGlowSize = 1.75f;
|
||||
public float sceneGamma = 1.0f;
|
||||
public float starBrightness = 0.0f;
|
||||
public Vector4 cloudColor = new Vector4(0.41f, 0.41f, 0.41f, 0.41f);
|
||||
public Vector3 cloudXYDensity = new Vector3(1.00f, 0.53f, 1.00f);
|
||||
public float cloudCoverage = 0.27f;
|
||||
public float cloudScale = 0.42f;
|
||||
public Vector3 cloudDetailXYDensity = new Vector3(1.00f, 0.53f, 0.12f);
|
||||
public float cloudScrollX = 0.20f;
|
||||
public bool cloudScrollXLock = false;
|
||||
public float cloudScrollY = 0.01f;
|
||||
public bool cloudScrollYLock = false;
|
||||
public bool drawClassicClouds = true;
|
||||
|
||||
public delegate void SaveDelegate(RegionLightShareData wl);
|
||||
public event SaveDelegate OnSave;
|
||||
public void Save()
|
||||
{
|
||||
if (OnSave != null)
|
||||
OnSave(this);
|
||||
}
|
||||
public object Clone()
|
||||
{
|
||||
return this.MemberwiseClone(); // call clone method
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class RegionInfo
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
private static readonly string LogHeader = "[REGION INFO]";
|
||||
|
||||
|
||||
public bool commFailTF = false;
|
||||
public ConfigurationMember configMember;
|
||||
public string DataStore = String.Empty;
|
||||
|
@ -134,7 +77,6 @@ namespace OpenSim.Framework
|
|||
private int m_maxPrimsPerUser = -1;
|
||||
private int m_linksetCapacity = 0;
|
||||
private string m_regionType = String.Empty;
|
||||
private RegionLightShareData m_windlight = new RegionLightShareData();
|
||||
protected uint m_httpPort;
|
||||
protected string m_serverURI;
|
||||
protected string m_regionName = String.Empty;
|
||||
|
@ -222,7 +164,6 @@ namespace OpenSim.Framework
|
|||
source.Save(filename);
|
||||
|
||||
RegionFile = filename;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -302,21 +243,6 @@ namespace OpenSim.Framework
|
|||
set { m_regionSettings = value; }
|
||||
}
|
||||
|
||||
public RegionLightShareData WindlightSettings
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_windlight == null)
|
||||
{
|
||||
m_windlight = new RegionLightShareData();
|
||||
}
|
||||
|
||||
return m_windlight;
|
||||
}
|
||||
|
||||
set { m_windlight = value; }
|
||||
}
|
||||
|
||||
public float NonphysPrimMin
|
||||
{
|
||||
get { return m_nonphysPrimMin; }
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -26,20 +26,25 @@
|
|||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using OpenMetaverse;
|
||||
using OpenMetaverse.StructuredData;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Capabilities;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using log4net;
|
||||
using Nini.Config;
|
||||
using Mono.Addins;
|
||||
|
||||
using Caps = OpenSim.Framework.Capabilities.Caps;
|
||||
|
||||
using OSDArray = OpenMetaverse.StructuredData.OSDArray;
|
||||
using OSDMap = OpenMetaverse.StructuredData.OSDMap;
|
||||
|
||||
namespace OpenSim.Region.CoreModules.World.LightShare
|
||||
{
|
||||
|
@ -52,6 +57,14 @@ namespace OpenSim.Region.CoreModules.World.LightShare
|
|||
private Scene m_scene = null;
|
||||
private UUID regionID = UUID.Zero;
|
||||
private bool Enabled = false;
|
||||
private IEstateModule m_estateModule;
|
||||
private IEventQueue m_eventQueue;
|
||||
private IAssetService m_assetService;
|
||||
|
||||
private static ViewerEnviroment m_DefaultEnv = null;
|
||||
private static readonly string m_defaultDayAssetID = "5646d39e-d3d7-6aff-ed71-30fc87d64a91";
|
||||
|
||||
private int m_regionEnvVersion = -1;
|
||||
|
||||
#region INonSharedRegionModule
|
||||
public void Initialise(IConfigSource source)
|
||||
|
@ -69,6 +82,7 @@ namespace OpenSim.Region.CoreModules.World.LightShare
|
|||
|
||||
Enabled = true;
|
||||
|
||||
|
||||
m_log.InfoFormat("[{0}]: Module is enabled.", Name);
|
||||
}
|
||||
|
||||
|
@ -101,12 +115,80 @@ namespace OpenSim.Region.CoreModules.World.LightShare
|
|||
if (!Enabled)
|
||||
return;
|
||||
|
||||
m_estateModule = scene.RequestModuleInterface<IEstateModule>();
|
||||
if (m_estateModule == null)
|
||||
{
|
||||
Enabled = false;
|
||||
return;
|
||||
}
|
||||
|
||||
m_eventQueue = m_scene.RequestModuleInterface<IEventQueue>();
|
||||
if (m_eventQueue == null)
|
||||
{
|
||||
Enabled = false;
|
||||
return;
|
||||
}
|
||||
|
||||
m_assetService = m_scene.AssetService;
|
||||
if (m_assetService == null)
|
||||
{
|
||||
Enabled = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if(m_DefaultEnv == null)
|
||||
{
|
||||
AssetBase defEnv = m_assetService.Get(m_defaultDayAssetID);
|
||||
if(defEnv != null)
|
||||
{
|
||||
byte[] envData = defEnv.Data;
|
||||
try
|
||||
{
|
||||
OSD oenv = OSDParser.DeserializeLLSDXml(envData);
|
||||
m_DefaultEnv = new ViewerEnviroment();
|
||||
m_DefaultEnv.CycleFromOSD(oenv);
|
||||
}
|
||||
catch ( Exception e)
|
||||
{
|
||||
m_DefaultEnv = null;
|
||||
m_log.WarnFormat("[Enviroment {0}]: failed to decode default enviroment asset: {1}", m_scene.Name, e.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
string senv = scene.SimulationDataService.LoadRegionEnvironmentSettings(scene.RegionInfo.RegionID);
|
||||
if(!string.IsNullOrEmpty(senv))
|
||||
{
|
||||
try
|
||||
{
|
||||
OSD oenv = OSDParser.DeserializeLLSDXml(senv);
|
||||
ViewerEnviroment VEnv = new ViewerEnviroment();
|
||||
if(oenv is OSDArray)
|
||||
VEnv.FromWLOSD(oenv);
|
||||
else
|
||||
VEnv.FromOSD(oenv);
|
||||
scene.RegionEnviroment = VEnv;
|
||||
m_regionEnvVersion = VEnv.version;
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
m_log.ErrorFormat("[Enviroment {0}] failed to load initial enviroment {1}", m_scene.Name, e.Message);
|
||||
scene.RegionEnviroment = null;
|
||||
m_regionEnvVersion = -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
scene.RegionEnviroment = null;
|
||||
m_regionEnvVersion = -1;
|
||||
}
|
||||
|
||||
scene.EventManager.OnRegisterCaps += OnRegisterCaps;
|
||||
}
|
||||
|
||||
public void RemoveRegion(Scene scene)
|
||||
{
|
||||
if (Enabled)
|
||||
if (!Enabled)
|
||||
return;
|
||||
|
||||
scene.EventManager.OnRegisterCaps -= OnRegisterCaps;
|
||||
|
@ -120,57 +202,339 @@ namespace OpenSim.Region.CoreModules.World.LightShare
|
|||
if (!Enabled)
|
||||
return;
|
||||
|
||||
m_scene.SimulationDataService.RemoveRegionEnvironmentSettings(regionUUID);
|
||||
StoreOnRegion(null);
|
||||
WindlightRefresh(0);
|
||||
}
|
||||
|
||||
public void WindlightRefresh(int interpolate)
|
||||
{
|
||||
List<byte[]> ls = null;
|
||||
m_scene.ForEachClient(delegate (IClientAPI client)
|
||||
{
|
||||
if(!client.IsActive)
|
||||
return;
|
||||
|
||||
uint vflags = client.GetViewerCaps();
|
||||
|
||||
if ((vflags & 0x8000) != 0)
|
||||
m_estateModule.HandleRegionInfoRequest(client);
|
||||
|
||||
else if ((vflags & 0x4000) != 0)
|
||||
m_eventQueue.WindlightRefreshEvent(interpolate, client.AgentId);
|
||||
|
||||
else
|
||||
{
|
||||
if(ls == null)
|
||||
ls = MakeLightShareData();
|
||||
SendLightShare(client, ls);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void FromLightShare(RegionLightShareData ls)
|
||||
{
|
||||
if (!Enabled)
|
||||
return;
|
||||
|
||||
ViewerEnviroment VEnv = new ViewerEnviroment();
|
||||
VEnv.FromLightShare(ls);
|
||||
|
||||
StoreOnRegion(VEnv);
|
||||
WindlightRefresh(0);
|
||||
}
|
||||
|
||||
public RegionLightShareData ToLightShare()
|
||||
{
|
||||
if (!Enabled)
|
||||
return new RegionLightShareData();
|
||||
|
||||
RegionLightShareData ls = null;
|
||||
try
|
||||
{
|
||||
ViewerEnviroment VEnv = m_scene.RegionEnviroment;
|
||||
if(VEnv == null)
|
||||
return new RegionLightShareData();
|
||||
ls = VEnv.ToLightShare();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat("[{0}]: Unable to convert environment to lightShare, Exception: {1} - {2}",
|
||||
Name, e.Message, e.StackTrace);
|
||||
}
|
||||
if(ls == null)
|
||||
return new RegionLightShareData();
|
||||
return ls;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Events
|
||||
private void OnRegisterCaps(UUID agentID, Caps caps)
|
||||
{
|
||||
// m_log.DebugFormat("[{0}]: Register capability for agentID {1} in region {2}",
|
||||
// Name, agentID, caps.RegionName);
|
||||
// m_log.DebugFormat("[{0}]: Register capability for agentID {1} in region {2}",
|
||||
// Name, agentID, caps.RegionName);
|
||||
|
||||
string capsPath = "/CAPS/" + UUID.Random();
|
||||
caps.RegisterSimpleHandler("EnvironmentSettings",
|
||||
new SimpleStreamHandler("/" + UUID.Random(), delegate (IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
processEnv(httpRequest, httpResponse, agentID);
|
||||
}));
|
||||
|
||||
// Get handler
|
||||
caps.RegisterHandler(
|
||||
"EnvironmentSettings",
|
||||
new RestStreamHandler(
|
||||
"GET",
|
||||
capsPath,
|
||||
(request, path, param, httpRequest, httpResponse)
|
||||
=> GetEnvironmentSettings(request, path, param, agentID, caps),
|
||||
"EnvironmentSettings",
|
||||
agentID.ToString()));
|
||||
|
||||
// Set handler
|
||||
caps.HttpListener.AddStreamHandler(
|
||||
new RestStreamHandler(
|
||||
"POST",
|
||||
capsPath,
|
||||
(request, path, param, httpRequest, httpResponse)
|
||||
=> SetEnvironmentSettings(request, path, param, agentID, caps),
|
||||
"EnvironmentSettings",
|
||||
agentID.ToString()));
|
||||
//Extended
|
||||
caps.RegisterSimpleHandler("ExtEnvironment",
|
||||
new SimpleStreamHandler("/" + UUID.Random(), delegate (IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
processExtEnv(httpRequest, httpResponse, agentID, caps);
|
||||
}));
|
||||
}
|
||||
#endregion
|
||||
|
||||
private string GetEnvironmentSettings(string request, string path, string param,
|
||||
UUID agentID, Caps caps)
|
||||
private void processEnv(IOSHttpRequest request, IOSHttpResponse response, UUID agentID)
|
||||
{
|
||||
// m_log.DebugFormat("[{0}]: Environment GET handle for agentID {1} in region {2}",
|
||||
// Name, agentID, caps.RegionName);
|
||||
switch (request.HttpMethod)
|
||||
{
|
||||
case "POST":
|
||||
SetEnvironmentSettings(request, response, agentID);
|
||||
return;
|
||||
case "GET":
|
||||
GetEnvironmentSettings(response, agentID);
|
||||
return;
|
||||
default:
|
||||
{
|
||||
response.StatusCode = (int)HttpStatusCode.MethodNotAllowed;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void processExtEnv(IOSHttpRequest request, IOSHttpResponse response, UUID agentID, Caps caps)
|
||||
{
|
||||
switch(request.HttpMethod)
|
||||
{
|
||||
case "PUT":
|
||||
case "POST":
|
||||
SetExtEnvironmentSettings(request, response, agentID, caps);
|
||||
return;
|
||||
case "GET":
|
||||
GetExtEnvironmentSettings(request, response, agentID);
|
||||
return;
|
||||
case "DELETE":
|
||||
DeleteExtEnvironmentSettings(request, response, agentID);
|
||||
return;
|
||||
default:
|
||||
{
|
||||
response.StatusCode = (int)HttpStatusCode.MethodNotAllowed;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void DeleteExtEnvironmentSettings(IOSHttpRequest httpRequest, IOSHttpResponse httpResponse, UUID agentID)
|
||||
{
|
||||
int parcel = -1;
|
||||
|
||||
if (httpRequest.Query.Count > 0)
|
||||
{
|
||||
if (httpRequest.Query.ContainsKey("parcelid"))
|
||||
{
|
||||
Int32.TryParse((string)httpRequest.Query["parcelid"], out parcel);
|
||||
}
|
||||
}
|
||||
|
||||
if(parcel == -1)
|
||||
StoreOnRegion(null);
|
||||
|
||||
WindlightRefresh(0);
|
||||
|
||||
StringBuilder sb = LLSDxmlEncode.Start();
|
||||
LLSDxmlEncode.AddMap(sb);
|
||||
LLSDxmlEncode.AddElem("messageID", UUID.Zero, sb);
|
||||
LLSDxmlEncode.AddElem("regionID", regionID, sb);
|
||||
LLSDxmlEncode.AddElem("success", true, sb);
|
||||
LLSDxmlEncode.AddEndMap(sb);
|
||||
httpResponse.RawBuffer = Util.UTF8.GetBytes(LLSDxmlEncode.End(sb));
|
||||
httpResponse.StatusCode = (int)HttpStatusCode.OK;
|
||||
}
|
||||
|
||||
private void GetExtEnvironmentSettings(IOSHttpRequest httpRequest, IOSHttpResponse httpResponse, UUID agentID)
|
||||
{
|
||||
if (httpRequest.Query.Count > 0)
|
||||
{
|
||||
int parcel = -1;
|
||||
if (httpRequest.Query.ContainsKey("parcelid"))
|
||||
{
|
||||
Int32.TryParse((string)httpRequest.Query["parcelid"], out parcel);
|
||||
}
|
||||
OSD oenv = ViewerEnviroment.DefaultToOSD(regionID, parcel);
|
||||
httpResponse.RawBuffer = Util.UTF8.GetBytes(OSDParser.SerializeLLSDXmlString(oenv));
|
||||
httpResponse.StatusCode = (int)HttpStatusCode.OK;
|
||||
}
|
||||
|
||||
ViewerEnviroment VEnv = m_scene.RegionEnviroment;
|
||||
if (VEnv == null)
|
||||
VEnv = m_DefaultEnv == null ? new ViewerEnviroment() : m_DefaultEnv;
|
||||
|
||||
OSDMap map = new OpenMetaverse.StructuredData.OSDMap();
|
||||
map["environment"] = VEnv.ToOSD();
|
||||
string env = OSDParser.SerializeLLSDXmlString(map);
|
||||
|
||||
// only the presence of enviroment seems to matter
|
||||
if (String.IsNullOrEmpty(env))
|
||||
{
|
||||
StringBuilder sb = LLSDxmlEncode.Start();
|
||||
LLSDxmlEncode.AddArray(sb);
|
||||
LLSDxmlEncode.AddMap(sb);
|
||||
LLSDxmlEncode.AddElem("messageID", UUID.Zero, sb);
|
||||
LLSDxmlEncode.AddElem("regionID", regionID, sb);
|
||||
LLSDxmlEncode.AddEndMap(sb);
|
||||
LLSDxmlEncode.AddEndArray(sb);
|
||||
env = LLSDxmlEncode.End(sb);
|
||||
}
|
||||
|
||||
httpResponse.RawBuffer = Util.UTF8NBGetbytes(env);
|
||||
httpResponse.StatusCode = (int)HttpStatusCode.OK;
|
||||
}
|
||||
|
||||
private void SetExtEnvironmentSettings(IOSHttpRequest httpRequest, IOSHttpResponse httpResponse, UUID agentID, Caps caps)
|
||||
{
|
||||
bool success = false;
|
||||
string message = "Could not process request";
|
||||
int parcel = -1;
|
||||
int track = -1;
|
||||
|
||||
StringBuilder sb = LLSDxmlEncode.Start();
|
||||
|
||||
if (httpRequest.Query.Count > 0)
|
||||
{
|
||||
if (httpRequest.Query.ContainsKey("parcelid"))
|
||||
{
|
||||
Int32.TryParse((string)httpRequest.Query["parcelid"], out parcel);
|
||||
}
|
||||
if (httpRequest.Query.ContainsKey("trackno"))
|
||||
{
|
||||
Int32.TryParse((string)httpRequest.Query["trackno"], out track);
|
||||
}
|
||||
|
||||
message = "Parcel Enviroment not supported";
|
||||
goto skiped;
|
||||
}
|
||||
|
||||
if(parcel == -1)
|
||||
{
|
||||
if (!m_scene.Permissions.CanIssueEstateCommand(agentID, false))
|
||||
{
|
||||
message = "Insufficient estate permissions, settings has not been saved.";
|
||||
goto skiped;
|
||||
}
|
||||
}
|
||||
|
||||
if(track == -1)
|
||||
{
|
||||
try
|
||||
{
|
||||
OSD req = OSDParser.DeserializeLLSDXml(httpRequest.InputStream);
|
||||
if(req is OpenMetaverse.StructuredData.OSDMap)
|
||||
{
|
||||
OpenMetaverse.StructuredData.OSDMap map = req as OpenMetaverse.StructuredData.OSDMap;
|
||||
if(map.TryGetValue("environment", out OSD env))
|
||||
{
|
||||
ViewerEnviroment VEnv = m_scene.RegionEnviroment;
|
||||
if (VEnv == null)
|
||||
VEnv = new ViewerEnviroment();
|
||||
OSDMap evmap = (OSDMap)env;
|
||||
if(evmap.TryGetValue("day_asset", out OSD tmp) && !evmap.ContainsKey("day_cycle"))
|
||||
{
|
||||
string id = tmp.AsString();
|
||||
AssetBase asset = m_assetService.Get(id);
|
||||
if(asset == null || asset.Data == null || asset.Data.Length == 0)
|
||||
{
|
||||
httpResponse.StatusCode = (int)HttpStatusCode.NotFound;
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
OSD oenv = OSDParser.DeserializeLLSDXml(asset.Data);
|
||||
VEnv.CycleFromOSD(oenv);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
httpResponse.StatusCode = (int)HttpStatusCode.NotFound;
|
||||
return;
|
||||
}
|
||||
}
|
||||
VEnv.FromOSD(env);
|
||||
StoreOnRegion(VEnv);
|
||||
|
||||
WindlightRefresh(0);
|
||||
|
||||
success = true;
|
||||
m_log.InfoFormat("[{0}]: ExtEnviromet settings saved from agentID {1} in region {2}",
|
||||
Name, agentID, caps.RegionName);
|
||||
}
|
||||
}
|
||||
else if (req is OSDArray)
|
||||
{
|
||||
ViewerEnviroment VEnv = m_scene.RegionEnviroment;
|
||||
if (VEnv == null)
|
||||
VEnv = new ViewerEnviroment();
|
||||
|
||||
VEnv.FromWLOSD(req);
|
||||
StoreOnRegion(VEnv);
|
||||
success = true;
|
||||
|
||||
WindlightRefresh(0);
|
||||
|
||||
m_log.InfoFormat("[{0}]: New Environment settings has been saved from agentID {1} in region {2}",
|
||||
Name, agentID, caps.RegionName);
|
||||
|
||||
LLSDxmlEncode.AddMap(sb);
|
||||
LLSDxmlEncode.AddElem("messageID", UUID.Zero, sb);
|
||||
LLSDxmlEncode.AddElem("regionID", regionID, sb);
|
||||
LLSDxmlEncode.AddElem("success", success, sb);
|
||||
LLSDxmlEncode.AddEndMap(sb);
|
||||
httpResponse.RawBuffer = Util.UTF8.GetBytes(LLSDxmlEncode.End(sb));
|
||||
httpResponse.StatusCode = (int)HttpStatusCode.OK;
|
||||
return;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat("[{0}]: ExtEnvironment settings not saved for region {1}, Exception: {2} - {3}",
|
||||
Name, caps.RegionName, e.Message, e.StackTrace);
|
||||
|
||||
success = false;
|
||||
message = String.Format("ExtEnvironment Set for region {0} has failed, settings not saved.", caps.RegionName);
|
||||
}
|
||||
}
|
||||
|
||||
skiped:
|
||||
string response;
|
||||
|
||||
LLSDxmlEncode.AddMap(sb);
|
||||
LLSDxmlEncode.AddElem("success", success, sb);
|
||||
if(!success)
|
||||
LLSDxmlEncode.AddElem("message", message, sb);
|
||||
LLSDxmlEncode.AddEndMap(sb);
|
||||
response = LLSDxmlEncode.End(sb);
|
||||
|
||||
httpResponse.RawBuffer = Util.UTF8.GetBytes(response);
|
||||
httpResponse.StatusCode = (int)HttpStatusCode.OK;
|
||||
}
|
||||
|
||||
private void GetEnvironmentSettings(IOSHttpResponse response, UUID agentID)
|
||||
{
|
||||
// m_log.DebugFormat("[{0}]: Environment GET handle for agentID {1} in region {2}",
|
||||
// Name, agentID, caps.RegionName);
|
||||
|
||||
string env = String.Empty;
|
||||
ViewerEnviroment VEnv = m_scene.RegionEnviroment;
|
||||
if (VEnv == null)
|
||||
VEnv = m_DefaultEnv;
|
||||
|
||||
try
|
||||
if (VEnv != null)
|
||||
{
|
||||
env = m_scene.SimulationDataService.LoadRegionEnvironmentSettings(regionID);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat("[{0}]: Unable to load environment settings for region {1}, Exception: {2} - {3}",
|
||||
Name, caps.RegionName, e.Message, e.StackTrace);
|
||||
OSD d = VEnv.ToWLOSD(UUID.Zero, regionID);
|
||||
env = OSDParser.SerializeLLSDXmlString(d);
|
||||
}
|
||||
|
||||
if (String.IsNullOrEmpty(env))
|
||||
|
@ -185,15 +549,39 @@ namespace OpenSim.Region.CoreModules.World.LightShare
|
|||
env = LLSDxmlEncode.End(sb);
|
||||
}
|
||||
|
||||
return env;
|
||||
response.RawBuffer = Util.UTF8.GetBytes(env);
|
||||
response.StatusCode = (int)HttpStatusCode.OK;
|
||||
}
|
||||
|
||||
private string SetEnvironmentSettings(string request, string path, string param,
|
||||
UUID agentID, Caps caps)
|
||||
private void StoreOnRegion(ViewerEnviroment VEnv)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (VEnv == null)
|
||||
{
|
||||
m_scene.SimulationDataService.RemoveRegionEnvironmentSettings(regionID);
|
||||
m_scene.RegionEnviroment = null;
|
||||
m_regionEnvVersion = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_regionEnvVersion++;
|
||||
VEnv.version = m_regionEnvVersion;
|
||||
OSD env = VEnv.ToOSD();
|
||||
m_scene.SimulationDataService.StoreRegionEnvironmentSettings(regionID, OSDParser.SerializeLLSDXmlString(env));
|
||||
m_scene.RegionEnviroment = VEnv;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat("[Enviroment {0}] failed to store enviroment {1}", m_scene.Name, e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
// m_log.DebugFormat("[{0}]: Environment SET handle from agentID {1} in region {2}",
|
||||
// Name, agentID, caps.RegionName);
|
||||
private void SetEnvironmentSettings(IOSHttpRequest request, IOSHttpResponse response, UUID agentID)
|
||||
{
|
||||
// m_log.DebugFormat("[{0}]: Environment SET handle from agentID {1} in region {2}",
|
||||
// Name, agentID, caps.RegionName);
|
||||
|
||||
bool success = false;
|
||||
string fail_reason = "";
|
||||
|
@ -206,19 +594,24 @@ namespace OpenSim.Region.CoreModules.World.LightShare
|
|||
{
|
||||
try
|
||||
{
|
||||
m_scene.SimulationDataService.StoreRegionEnvironmentSettings(regionID, request);
|
||||
ViewerEnviroment VEnv = new ViewerEnviroment();
|
||||
OSD env = OSDParser.DeserializeLLSDXml(request.InputStream);
|
||||
VEnv.FromWLOSD(env);
|
||||
StoreOnRegion(VEnv);
|
||||
success = true;
|
||||
|
||||
WindlightRefresh(0);
|
||||
|
||||
m_log.InfoFormat("[{0}]: New Environment settings has been saved from agentID {1} in region {2}",
|
||||
Name, agentID, caps.RegionName);
|
||||
Name, agentID, m_scene.Name);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat("[{0}]: Environment settings has not been saved for region {1}, Exception: {2} - {3}",
|
||||
Name, caps.RegionName, e.Message, e.StackTrace);
|
||||
Name, m_scene.Name, e.Message, e.StackTrace);
|
||||
|
||||
success = false;
|
||||
fail_reason = String.Format("Environment Set for region {0} has failed, settings not saved.", caps.RegionName);
|
||||
fail_reason = String.Format("Environment Set for region {0} has failed, settings not saved.", m_scene.Name);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -230,7 +623,111 @@ namespace OpenSim.Region.CoreModules.World.LightShare
|
|||
if(!success)
|
||||
LLSDxmlEncode.AddElem("fail_reason", fail_reason, sb);
|
||||
LLSDxmlEncode.AddEndMap(sb);
|
||||
return LLSDxmlEncode.End(sb);
|
||||
response.RawBuffer = Util.UTF8.GetBytes(LLSDxmlEncode.End(sb));
|
||||
response.StatusCode = (int)HttpStatusCode.OK;
|
||||
}
|
||||
|
||||
public byte[] GetDefaultAssetData(int type)
|
||||
{
|
||||
OSD osddata;
|
||||
switch(type)
|
||||
{
|
||||
case 0:
|
||||
SkyData sky = new SkyData();
|
||||
sky.Name = "DefaultSky";
|
||||
osddata = sky.ToOSD();
|
||||
break;
|
||||
case 1:
|
||||
WaterData water = new WaterData();
|
||||
water.Name = "DefaultWater";
|
||||
osddata = water.ToOSD();
|
||||
break;
|
||||
case 2:
|
||||
DayCycle day = new DayCycle();
|
||||
day.Name="New Daycycle";
|
||||
DayCycle.TrackEntry te = new DayCycle.TrackEntry();
|
||||
|
||||
WaterData dwater = new WaterData();
|
||||
dwater.Name = "DefaultWater";
|
||||
day.waterframes["DefaultWater"] = dwater;
|
||||
te.time = 0;
|
||||
te.frameName = "DefaultWater";
|
||||
day.waterTrack.Add(te);
|
||||
|
||||
SkyData dsky = new SkyData();
|
||||
dsky.Name = "DefaultSky";
|
||||
day.skyframes["DefaultSky"] = dsky;
|
||||
te.time = 0;
|
||||
te.frameName = "DefaultSky";
|
||||
day.skyTrack0.Add(te);
|
||||
|
||||
osddata = day.ToOSD();
|
||||
break;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
string sdata = OSDParser.SerializeLLSDXmlString(osddata);
|
||||
return Util.UTF8NBGetbytes(sdata);
|
||||
}
|
||||
|
||||
public List<byte[]> MakeLightShareData()
|
||||
{
|
||||
if(m_scene.RegionEnviroment == null)
|
||||
return null;
|
||||
|
||||
RegionLightShareData wl = ToLightShare();
|
||||
byte[] mBlock = new Byte[249];
|
||||
int pos = 0;
|
||||
|
||||
wl.waterColor.ToBytes(mBlock, 0); pos += 12;
|
||||
Utils.FloatToBytes(wl.waterFogDensityExponent).CopyTo(mBlock, pos); pos += 4;
|
||||
Utils.FloatToBytes(wl.underwaterFogModifier).CopyTo(mBlock, pos); pos += 4;
|
||||
wl.reflectionWaveletScale.ToBytes(mBlock, pos); pos += 12;
|
||||
Utils.FloatToBytes(wl.fresnelScale).CopyTo(mBlock, pos); pos += 4;
|
||||
Utils.FloatToBytes(wl.fresnelOffset).CopyTo(mBlock, pos); pos += 4;
|
||||
Utils.FloatToBytes(wl.refractScaleAbove).CopyTo(mBlock, pos); pos += 4;
|
||||
Utils.FloatToBytes(wl.refractScaleBelow).CopyTo(mBlock, pos); pos += 4;
|
||||
Utils.FloatToBytes(wl.blurMultiplier).CopyTo(mBlock, pos); pos += 4;
|
||||
wl.bigWaveDirection.ToBytes(mBlock, pos); pos += 8;
|
||||
wl.littleWaveDirection.ToBytes(mBlock, pos); pos += 8;
|
||||
wl.normalMapTexture.ToBytes(mBlock, pos); pos += 16;
|
||||
wl.horizon.ToBytes(mBlock, pos); pos += 16;
|
||||
Utils.FloatToBytes(wl.hazeHorizon).CopyTo(mBlock, pos); pos += 4;
|
||||
wl.blueDensity.ToBytes(mBlock, pos); pos += 16;
|
||||
Utils.FloatToBytes(wl.hazeDensity).CopyTo(mBlock, pos); pos += 4;
|
||||
Utils.FloatToBytes(wl.densityMultiplier).CopyTo(mBlock, pos); pos += 4;
|
||||
Utils.FloatToBytes(wl.distanceMultiplier).CopyTo(mBlock, pos); pos += 4;
|
||||
wl.sunMoonColor.ToBytes(mBlock, pos); pos += 16;
|
||||
Utils.FloatToBytes(wl.sunMoonPosition).CopyTo(mBlock, pos); pos += 4;
|
||||
wl.ambient.ToBytes(mBlock, pos); pos += 16;
|
||||
Utils.FloatToBytes(wl.eastAngle).CopyTo(mBlock, pos); pos += 4;
|
||||
Utils.FloatToBytes(wl.sunGlowFocus).CopyTo(mBlock, pos); pos += 4;
|
||||
Utils.FloatToBytes(wl.sunGlowSize).CopyTo(mBlock, pos); pos += 4;
|
||||
Utils.FloatToBytes(wl.sceneGamma).CopyTo(mBlock, pos); pos += 4;
|
||||
Utils.FloatToBytes(wl.starBrightness).CopyTo(mBlock, pos); pos += 4;
|
||||
wl.cloudColor.ToBytes(mBlock, pos); pos += 16;
|
||||
wl.cloudXYDensity.ToBytes(mBlock, pos); pos += 12;
|
||||
Utils.FloatToBytes(wl.cloudCoverage).CopyTo(mBlock, pos); pos += 4;
|
||||
Utils.FloatToBytes(wl.cloudScale).CopyTo(mBlock, pos); pos += 4;
|
||||
wl.cloudDetailXYDensity.ToBytes(mBlock, pos); pos += 12;
|
||||
Utils.FloatToBytes(wl.cloudScrollX).CopyTo(mBlock, pos); pos += 4;
|
||||
Utils.FloatToBytes(wl.cloudScrollY).CopyTo(mBlock, pos); pos += 4;
|
||||
Utils.UInt16ToBytes(wl.maxAltitude).CopyTo(mBlock, pos); pos += 2;
|
||||
mBlock[pos] = Convert.ToByte(wl.cloudScrollXLock); pos++;
|
||||
mBlock[pos] = Convert.ToByte(wl.cloudScrollYLock); pos++;
|
||||
mBlock[pos] = Convert.ToByte(wl.drawClassicClouds); pos++;
|
||||
|
||||
List<byte[]> param = new List<byte[]>();
|
||||
param.Add(mBlock);
|
||||
return param;
|
||||
}
|
||||
|
||||
public void SendLightShare(IClientAPI client, List<byte[]> param)
|
||||
{
|
||||
if(param == null || param.Count == 0)
|
||||
client.SendGenericMessage("WindlightReset", UUID.Random(), new List<byte[]>());
|
||||
else
|
||||
client.SendGenericMessage("Windlight", UUID.Random(), param);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,301 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Region.CoreModules.Framework.InterfaceCommander;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using log4net;
|
||||
using Nini.Config;
|
||||
using Mono.Addins;
|
||||
|
||||
namespace OpenSim.Region.CoreModules.World.LightShare
|
||||
{
|
||||
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "LightShareModule")]
|
||||
public class LightShareModule : INonSharedRegionModule, ILightShareModule, ICommandableModule
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
private readonly Commander m_commander = new Commander("windlight");
|
||||
private Scene m_scene;
|
||||
private static bool m_enableWindlight;
|
||||
|
||||
#region ICommandableModule Members
|
||||
|
||||
public ICommander CommandInterface
|
||||
{
|
||||
get { return m_commander; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region INonSharedRegionModule Members
|
||||
|
||||
public void Initialise(IConfigSource config)
|
||||
{
|
||||
try
|
||||
{
|
||||
m_enableWindlight = config.Configs["LightShare"].GetBoolean("enable_windlight", false);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
m_log.Debug("[WINDLIGHT]: ini failure for enable_windlight - using default");
|
||||
}
|
||||
|
||||
m_log.DebugFormat("[WINDLIGHT]: windlight module {0}", (m_enableWindlight ? "enabled" : "disabled"));
|
||||
}
|
||||
|
||||
public void AddRegion(Scene scene)
|
||||
{
|
||||
if (!m_enableWindlight)
|
||||
return;
|
||||
|
||||
m_scene = scene;
|
||||
m_scene.RegisterModuleInterface<ILightShareModule>(this);
|
||||
m_scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole;
|
||||
|
||||
m_scene.EventManager.OnMakeRootAgent += EventManager_OnMakeRootAgent;
|
||||
m_scene.EventManager.OnSaveNewWindlightProfile += EventManager_OnSaveNewWindlightProfile;
|
||||
m_scene.EventManager.OnSendNewWindlightProfileTargeted += EventManager_OnSendNewWindlightProfileTargeted;
|
||||
m_scene.LoadWindlightProfile();
|
||||
|
||||
InstallCommands();
|
||||
}
|
||||
|
||||
public void RemoveRegion(Scene scene)
|
||||
{
|
||||
if (!m_enableWindlight)
|
||||
return;
|
||||
|
||||
m_scene.EventManager.OnPluginConsole -= EventManager_OnPluginConsole;
|
||||
|
||||
m_scene.EventManager.OnMakeRootAgent -= EventManager_OnMakeRootAgent;
|
||||
m_scene.EventManager.OnSaveNewWindlightProfile -= EventManager_OnSaveNewWindlightProfile;
|
||||
m_scene.EventManager.OnSendNewWindlightProfileTargeted -= EventManager_OnSendNewWindlightProfileTargeted;
|
||||
|
||||
m_scene = null;
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
}
|
||||
|
||||
public string Name
|
||||
{
|
||||
get { return "LightShareModule"; }
|
||||
}
|
||||
|
||||
public void RegionLoaded(Scene scene)
|
||||
{
|
||||
}
|
||||
|
||||
public Type ReplaceableInterface
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public static bool EnableWindlight
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_enableWindlight;
|
||||
}
|
||||
set
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
#region events
|
||||
|
||||
private List<byte[]> compileWindlightSettings(RegionLightShareData wl)
|
||||
{
|
||||
byte[] mBlock = new Byte[249];
|
||||
int pos = 0;
|
||||
|
||||
wl.waterColor.ToBytes(mBlock, 0); pos += 12;
|
||||
Utils.FloatToBytes(wl.waterFogDensityExponent).CopyTo(mBlock, pos); pos += 4;
|
||||
Utils.FloatToBytes(wl.underwaterFogModifier).CopyTo(mBlock, pos); pos += 4;
|
||||
wl.reflectionWaveletScale.ToBytes(mBlock, pos); pos += 12;
|
||||
Utils.FloatToBytes(wl.fresnelScale).CopyTo(mBlock, pos); pos += 4;
|
||||
Utils.FloatToBytes(wl.fresnelOffset).CopyTo(mBlock, pos); pos += 4;
|
||||
Utils.FloatToBytes(wl.refractScaleAbove).CopyTo(mBlock, pos); pos += 4;
|
||||
Utils.FloatToBytes(wl.refractScaleBelow).CopyTo(mBlock, pos); pos += 4;
|
||||
Utils.FloatToBytes(wl.blurMultiplier).CopyTo(mBlock, pos); pos += 4;
|
||||
wl.bigWaveDirection.ToBytes(mBlock, pos); pos += 8;
|
||||
wl.littleWaveDirection.ToBytes(mBlock, pos); pos += 8;
|
||||
wl.normalMapTexture.ToBytes(mBlock, pos); pos += 16;
|
||||
wl.horizon.ToBytes(mBlock, pos); pos += 16;
|
||||
Utils.FloatToBytes(wl.hazeHorizon).CopyTo(mBlock, pos); pos += 4;
|
||||
wl.blueDensity.ToBytes(mBlock, pos); pos += 16;
|
||||
Utils.FloatToBytes(wl.hazeDensity).CopyTo(mBlock, pos); pos += 4;
|
||||
Utils.FloatToBytes(wl.densityMultiplier).CopyTo(mBlock, pos); pos += 4;
|
||||
Utils.FloatToBytes(wl.distanceMultiplier).CopyTo(mBlock, pos); pos += 4;
|
||||
wl.sunMoonColor.ToBytes(mBlock, pos); pos += 16;
|
||||
Utils.FloatToBytes(wl.sunMoonPosition).CopyTo(mBlock, pos); pos += 4;
|
||||
wl.ambient.ToBytes(mBlock, pos); pos += 16;
|
||||
Utils.FloatToBytes(wl.eastAngle).CopyTo(mBlock, pos); pos += 4;
|
||||
Utils.FloatToBytes(wl.sunGlowFocus).CopyTo(mBlock, pos); pos += 4;
|
||||
Utils.FloatToBytes(wl.sunGlowSize).CopyTo(mBlock, pos); pos += 4;
|
||||
Utils.FloatToBytes(wl.sceneGamma).CopyTo(mBlock, pos); pos += 4;
|
||||
Utils.FloatToBytes(wl.starBrightness).CopyTo(mBlock, pos); pos += 4;
|
||||
wl.cloudColor.ToBytes(mBlock, pos); pos += 16;
|
||||
wl.cloudXYDensity.ToBytes(mBlock, pos); pos += 12;
|
||||
Utils.FloatToBytes(wl.cloudCoverage).CopyTo(mBlock, pos); pos += 4;
|
||||
Utils.FloatToBytes(wl.cloudScale).CopyTo(mBlock, pos); pos += 4;
|
||||
wl.cloudDetailXYDensity.ToBytes(mBlock, pos); pos += 12;
|
||||
Utils.FloatToBytes(wl.cloudScrollX).CopyTo(mBlock, pos); pos += 4;
|
||||
Utils.FloatToBytes(wl.cloudScrollY).CopyTo(mBlock, pos); pos += 4;
|
||||
Utils.UInt16ToBytes(wl.maxAltitude).CopyTo(mBlock, pos); pos += 2;
|
||||
mBlock[pos] = Convert.ToByte(wl.cloudScrollXLock); pos++;
|
||||
mBlock[pos] = Convert.ToByte(wl.cloudScrollYLock); pos++;
|
||||
mBlock[pos] = Convert.ToByte(wl.drawClassicClouds); pos++;
|
||||
List<byte[]> param = new List<byte[]>();
|
||||
param.Add(mBlock);
|
||||
return param;
|
||||
}
|
||||
|
||||
public void SendProfileToClient(IClientAPI client)
|
||||
{
|
||||
SendProfileToClient(client, m_scene.RegionInfo.WindlightSettings);
|
||||
}
|
||||
|
||||
public void SendProfileToClient(IClientAPI client, RegionLightShareData wl)
|
||||
{
|
||||
if (client == null)
|
||||
return;
|
||||
|
||||
if (m_enableWindlight)
|
||||
{
|
||||
if (m_scene.RegionInfo.WindlightSettings.valid)
|
||||
{
|
||||
List<byte[]> param = compileWindlightSettings(wl);
|
||||
client.SendGenericMessage("Windlight", UUID.Random(), param);
|
||||
}
|
||||
else
|
||||
{
|
||||
List<byte[]> param = new List<byte[]>();
|
||||
client.SendGenericMessage("WindlightReset", UUID.Random(), param);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void EventManager_OnMakeRootAgent(ScenePresence presence)
|
||||
{
|
||||
if (m_enableWindlight && m_scene.RegionInfo.WindlightSettings.valid)
|
||||
m_log.Debug("[WINDLIGHT]: Sending windlight scene to new client");
|
||||
SendProfileToClient(presence.ControllingClient);
|
||||
}
|
||||
|
||||
private void EventManager_OnSendNewWindlightProfileTargeted(RegionLightShareData wl, UUID pUUID)
|
||||
{
|
||||
IClientAPI client;
|
||||
m_scene.TryGetClient(pUUID, out client);
|
||||
SendProfileToClient(client, wl);
|
||||
}
|
||||
|
||||
private void EventManager_OnSaveNewWindlightProfile()
|
||||
{
|
||||
m_scene.ForEachRootClient(SendProfileToClient);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ICommandableModule Members
|
||||
|
||||
private void InstallCommands()
|
||||
{
|
||||
Command wlload = new Command("load", CommandIntentions.COMMAND_NON_HAZARDOUS, HandleLoad, "Load windlight profile from the database and broadcast");
|
||||
Command wlenable = new Command("enable", CommandIntentions.COMMAND_NON_HAZARDOUS, HandleEnable, "Enable the windlight plugin");
|
||||
Command wldisable = new Command("disable", CommandIntentions.COMMAND_NON_HAZARDOUS, HandleDisable, "Disable the windlight plugin");
|
||||
|
||||
m_commander.RegisterCommand("load", wlload);
|
||||
m_commander.RegisterCommand("enable", wlenable);
|
||||
m_commander.RegisterCommand("disable", wldisable);
|
||||
|
||||
m_scene.RegisterModuleCommander(m_commander);
|
||||
}
|
||||
|
||||
private void HandleLoad(Object[] args)
|
||||
{
|
||||
if (!m_enableWindlight)
|
||||
{
|
||||
m_log.InfoFormat("[WINDLIGHT]: Cannot load windlight profile, module disabled. Use 'windlight enable' first.");
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.InfoFormat("[WINDLIGHT]: Loading Windlight profile from database");
|
||||
m_scene.LoadWindlightProfile();
|
||||
m_log.InfoFormat("[WINDLIGHT]: Load complete");
|
||||
}
|
||||
}
|
||||
|
||||
private void HandleDisable(Object[] args)
|
||||
{
|
||||
m_log.InfoFormat("[WINDLIGHT]: Plugin now disabled");
|
||||
m_enableWindlight = false;
|
||||
}
|
||||
|
||||
private void HandleEnable(Object[] args)
|
||||
{
|
||||
m_log.InfoFormat("[WINDLIGHT]: Plugin now enabled");
|
||||
m_enableWindlight = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Processes commandline input. Do not call directly.
|
||||
/// </summary>
|
||||
/// <param name="args">Commandline arguments</param>
|
||||
private void EventManager_OnPluginConsole(string[] args)
|
||||
{
|
||||
if (args[0] == "windlight")
|
||||
{
|
||||
if (args.Length == 1)
|
||||
{
|
||||
m_commander.ProcessConsoleCommand("add", new string[0]);
|
||||
return;
|
||||
}
|
||||
|
||||
string[] tmpArgs = new string[args.Length - 2];
|
||||
int i;
|
||||
for (i = 2; i < args.Length; i++)
|
||||
{
|
||||
tmpArgs[i - 2] = args[i];
|
||||
}
|
||||
|
||||
m_commander.ProcessConsoleCommand(args[1], tmpArgs);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -33,8 +33,8 @@ namespace OpenSim.Region.Framework.Interfaces
|
|||
public interface IEnvironmentModule
|
||||
{
|
||||
void ResetEnvironmentSettings(UUID regionUUID);
|
||||
//void FromLightShare(RegionLightShareData wl);
|
||||
//RegionLightShareData ToLightShare();
|
||||
//byte[] GetDefaultAssetData(string name);
|
||||
void FromLightShare(RegionLightShareData wl);
|
||||
RegionLightShareData ToLightShare();
|
||||
byte[] GetDefaultAssetData(int type);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -109,9 +109,6 @@ namespace OpenSim.Region.Framework.Interfaces
|
|||
|
||||
void StoreRegionSettings(RegionSettings rs);
|
||||
RegionSettings LoadRegionSettings(UUID regionUUID);
|
||||
RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID);
|
||||
void StoreRegionWindlightSettings(RegionLightShareData wl);
|
||||
void RemoveRegionWindlightSettings(UUID regionID);
|
||||
|
||||
/// <summary>
|
||||
/// Load Environment settings from region storage
|
||||
|
|
|
@ -121,9 +121,7 @@ namespace OpenSim.Region.Framework.Interfaces
|
|||
|
||||
void StoreRegionSettings(RegionSettings rs);
|
||||
RegionSettings LoadRegionSettings(UUID regionUUID);
|
||||
RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID);
|
||||
void StoreRegionWindlightSettings(RegionLightShareData wl);
|
||||
void RemoveRegionWindlightSettings(UUID regionID);
|
||||
|
||||
UUID[] GetObjectIDs(UUID regionID);
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -720,9 +720,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
/// </remarks>
|
||||
public event OnMakeChildAgentDelegate OnMakeChildAgent;
|
||||
|
||||
public delegate void OnSaveNewWindlightProfileDelegate();
|
||||
public delegate void OnSendNewWindlightProfileTargetedDelegate(RegionLightShareData wl, UUID user);
|
||||
|
||||
/// <summary>
|
||||
/// Triggered after the grunt work for adding a root agent to a
|
||||
/// scene has been performed (resuming attachment scripts, physics,
|
||||
|
@ -739,9 +736,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
/// </remarks>
|
||||
public event Action<ScenePresence> OnMakeRootAgent;
|
||||
|
||||
public event OnSendNewWindlightProfileTargetedDelegate OnSendNewWindlightProfileTargeted;
|
||||
public event OnSaveNewWindlightProfileDelegate OnSaveNewWindlightProfile;
|
||||
|
||||
/// <summary>
|
||||
/// Triggered when an object or attachment enters a scene
|
||||
/// </summary>
|
||||
|
@ -2160,24 +2154,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
}
|
||||
|
||||
public void TriggerOnSendNewWindlightProfileTargeted(RegionLightShareData wl, UUID user)
|
||||
{
|
||||
OnSendNewWindlightProfileTargetedDelegate handlerSendNewWindlightProfileTargeted = OnSendNewWindlightProfileTargeted;
|
||||
if (handlerSendNewWindlightProfileTargeted != null)
|
||||
{
|
||||
handlerSendNewWindlightProfileTargeted(wl, user);
|
||||
}
|
||||
}
|
||||
|
||||
public void TriggerOnSaveNewWindlightProfile()
|
||||
{
|
||||
OnSaveNewWindlightProfileDelegate handlerSaveNewWindlightProfile = OnSaveNewWindlightProfile;
|
||||
if (handlerSaveNewWindlightProfile != null)
|
||||
{
|
||||
handlerSaveNewWindlightProfile();
|
||||
}
|
||||
}
|
||||
|
||||
public void TriggerOnMakeRootAgent(ScenePresence presence)
|
||||
{
|
||||
Action<ScenePresence> handlerMakeRootAgent = OnMakeRootAgent;
|
||||
|
|
|
@ -2123,17 +2123,17 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
SimulationDataService.StoreBakedTerrain(Bakedmap.GetTerrainData(), RegionInfo.RegionID);
|
||||
}
|
||||
|
||||
public void StoreWindlightProfile(RegionLightShareData wl)
|
||||
private ViewerEnviroment m_regionEnviroment;
|
||||
public ViewerEnviroment RegionEnviroment
|
||||
{
|
||||
RegionInfo.WindlightSettings = wl;
|
||||
SimulationDataService.StoreRegionWindlightSettings(wl);
|
||||
m_eventManager.TriggerOnSaveNewWindlightProfile();
|
||||
}
|
||||
|
||||
public void LoadWindlightProfile()
|
||||
{
|
||||
RegionInfo.WindlightSettings = SimulationDataService.LoadRegionWindlightSettings(RegionInfo.RegionID);
|
||||
m_eventManager.TriggerOnSaveNewWindlightProfile();
|
||||
get
|
||||
{
|
||||
return m_regionEnviroment;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_regionEnviroment = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -62,9 +62,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
internal bool m_LSFunctionsEnabled = false;
|
||||
internal IScriptModuleComms m_comms = null;
|
||||
internal IConfig m_osslconfig;
|
||||
internal IEnvironmentModule m_enviroment = null;
|
||||
|
||||
public void Initialize(
|
||||
IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item)
|
||||
public void Initialize(IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item)
|
||||
{
|
||||
m_ScriptEngine = scriptEngine;
|
||||
m_host = host;
|
||||
|
@ -79,6 +79,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
m_comms = m_ScriptEngine.World.RequestModuleInterface<IScriptModuleComms>();
|
||||
if (m_comms == null)
|
||||
m_LSFunctionsEnabled = false;
|
||||
|
||||
m_enviroment = m_ScriptEngine.World.RequestModuleInterface<IEnvironmentModule>();
|
||||
}
|
||||
|
||||
public override Object InitializeLifetimeService()
|
||||
|
@ -88,8 +90,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
if (lease.CurrentState == LeaseState.Initial)
|
||||
{
|
||||
lease.InitialLeaseTime = TimeSpan.FromMinutes(0);
|
||||
// lease.RenewOnCallTime = TimeSpan.FromSeconds(10.0);
|
||||
// lease.SponsorshipTimeout = TimeSpan.FromMinutes(1.0);
|
||||
//lease.RenewOnCallTime = TimeSpan.FromSeconds(10.0);
|
||||
//lease.SponsorshipTimeout = TimeSpan.FromMinutes(1.0);
|
||||
}
|
||||
return lease;
|
||||
}
|
||||
|
@ -120,13 +122,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
/// <returns>List of windlight parameters</returns>
|
||||
public LSL_List lsGetWindlightScene(LSL_List rules)
|
||||
{
|
||||
if (!m_LSFunctionsEnabled)
|
||||
if (!m_LSFunctionsEnabled || m_enviroment == null)
|
||||
{
|
||||
LSShoutError("LightShare functions are not enabled.");
|
||||
return new LSL_List();
|
||||
}
|
||||
|
||||
m_host.AddScriptLPS(1);
|
||||
RegionLightShareData wl = m_host.ParentGroup.Scene.RegionInfo.WindlightSettings;
|
||||
|
||||
RegionLightShareData wl = m_enviroment.ToLightShare();
|
||||
|
||||
LSL_List values = new LSL_List();
|
||||
int idx = 0;
|
||||
|
@ -264,9 +268,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
|
||||
private RegionLightShareData getWindlightProfileFromRules(LSL_List rules)
|
||||
{
|
||||
RegionLightShareData wl = (RegionLightShareData)m_host.ParentGroup.Scene.RegionInfo.WindlightSettings.Clone();
|
||||
RegionLightShareData wl = m_enviroment.ToLightShare();
|
||||
|
||||
// LSL_List values = new LSL_List();
|
||||
int idx = 0;
|
||||
while (idx < rules.Length)
|
||||
{
|
||||
|
@ -716,12 +719,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
/// <returns>success: true or false</returns>
|
||||
public int lsSetWindlightScene(LSL_List rules)
|
||||
{
|
||||
if (!m_LSFunctionsEnabled)
|
||||
if (!m_LSFunctionsEnabled || m_enviroment == null)
|
||||
{
|
||||
LSShoutError("LightShare functions are not enabled.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
m_host.AddScriptLPS(1);
|
||||
|
||||
if (!World.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_host.OwnerID))
|
||||
{
|
||||
ScenePresence sp = World.GetScenePresence(m_host.OwnerID);
|
||||
|
@ -733,42 +738,30 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
}
|
||||
}
|
||||
|
||||
int success = 0;
|
||||
m_host.AddScriptLPS(1);
|
||||
|
||||
if (LightShareModule.EnableWindlight)
|
||||
try
|
||||
{
|
||||
RegionLightShareData wl;
|
||||
try
|
||||
{
|
||||
wl = getWindlightProfileFromRules(rules);
|
||||
}
|
||||
catch(InvalidCastException e)
|
||||
{
|
||||
LSShoutError(e.Message);
|
||||
return 0;
|
||||
}
|
||||
wl.valid = true;
|
||||
m_host.ParentGroup.Scene.StoreWindlightProfile(wl);
|
||||
success = 1;
|
||||
RegionLightShareData wl = getWindlightProfileFromRules(rules);
|
||||
m_enviroment.FromLightShare(wl);
|
||||
}
|
||||
else
|
||||
catch(InvalidCastException e)
|
||||
{
|
||||
LSShoutError("Windlight module is disabled");
|
||||
LSShoutError(e.Message);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return success;
|
||||
return 1;
|
||||
}
|
||||
|
||||
public void lsClearWindlightScene()
|
||||
{
|
||||
if (!m_LSFunctionsEnabled)
|
||||
if (!m_LSFunctionsEnabled || m_enviroment == null)
|
||||
{
|
||||
LSShoutError("LightShare functions are not enabled.");
|
||||
return;
|
||||
}
|
||||
|
||||
m_host.AddScriptLPS(1);
|
||||
|
||||
if (!World.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_host.OwnerID))
|
||||
{
|
||||
ScenePresence sp = World.GetScenePresence(m_host.OwnerID);
|
||||
|
@ -780,11 +773,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
}
|
||||
}
|
||||
|
||||
m_host.ParentGroup.Scene.RegionInfo.WindlightSettings.valid = false;
|
||||
if (m_host.ParentGroup.Scene.SimulationDataService != null)
|
||||
m_host.ParentGroup.Scene.SimulationDataService.RemoveRegionWindlightSettings(m_host.ParentGroup.Scene.RegionInfo.RegionID);
|
||||
|
||||
m_host.ParentGroup.Scene.EventManager.TriggerOnSaveNewWindlightProfile();
|
||||
m_enviroment.ResetEnvironmentSettings(m_host.ParentGroup.Scene.RegionInfo.RegionID);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -794,6 +783,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
/// <returns>success: true or false</returns>
|
||||
public int lsSetWindlightSceneTargeted(LSL_List rules, LSL_Key target)
|
||||
{
|
||||
LSShoutError("Function temporary not supported");
|
||||
return 0;
|
||||
|
||||
/* disabled code until we add force a WL into a single user
|
||||
if (!m_LSFunctionsEnabled)
|
||||
{
|
||||
LSShoutError("LightShare functions are not enabled.");
|
||||
|
@ -814,7 +807,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
int success = 0;
|
||||
m_host.AddScriptLPS(1);
|
||||
|
||||
if (LightShareModule.EnableWindlight)
|
||||
if (m_enviroment != null)
|
||||
{
|
||||
RegionLightShareData wl;
|
||||
try
|
||||
|
@ -836,6 +829,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
}
|
||||
|
||||
return success;
|
||||
*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -154,20 +154,6 @@ namespace OpenSim.Services.SimulationService
|
|||
return m_database.LoadRegionSettings(regionUUID);
|
||||
}
|
||||
|
||||
public RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID)
|
||||
{
|
||||
return m_database.LoadRegionWindlightSettings(regionUUID);
|
||||
}
|
||||
|
||||
public void StoreRegionWindlightSettings(RegionLightShareData wl)
|
||||
{
|
||||
m_database.StoreRegionWindlightSettings(wl);
|
||||
}
|
||||
public void RemoveRegionWindlightSettings(UUID regionID)
|
||||
{
|
||||
m_database.RemoveRegionWindlightSettings(regionID);
|
||||
}
|
||||
|
||||
public string LoadRegionEnvironmentSettings(UUID regionUUID)
|
||||
{
|
||||
return m_database.LoadRegionEnvironmentSettings(regionUUID);
|
||||
|
|
|
@ -119,20 +119,6 @@ namespace OpenSim.Data.Null
|
|||
return m_store.LoadRegionSettings(regionUUID);
|
||||
}
|
||||
|
||||
public RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID)
|
||||
{
|
||||
return m_store.LoadRegionWindlightSettings(regionUUID);
|
||||
}
|
||||
|
||||
public void RemoveRegionWindlightSettings(UUID regionID)
|
||||
{
|
||||
}
|
||||
|
||||
public void StoreRegionWindlightSettings(RegionLightShareData wl)
|
||||
{
|
||||
m_store.StoreRegionWindlightSettings(wl);
|
||||
}
|
||||
|
||||
public string LoadRegionEnvironmentSettings(UUID regionUUID)
|
||||
{
|
||||
return m_store.LoadRegionEnvironmentSettings(regionUUID);
|
||||
|
@ -197,22 +183,6 @@ namespace OpenSim.Data.Null
|
|||
m_regionSettings[rs.RegionUUID] = rs;
|
||||
}
|
||||
|
||||
public RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID)
|
||||
{
|
||||
//This connector doesn't support the windlight module yet
|
||||
//Return default LL windlight settings
|
||||
return new RegionLightShareData();
|
||||
}
|
||||
|
||||
public void RemoveRegionWindlightSettings(UUID regionID)
|
||||
{
|
||||
}
|
||||
|
||||
public void StoreRegionWindlightSettings(RegionLightShareData wl)
|
||||
{
|
||||
//This connector doesn't support the windlight module yet
|
||||
}
|
||||
|
||||
#region Environment Settings
|
||||
public string LoadRegionEnvironmentSettings(UUID regionUUID)
|
||||
{
|
||||
|
|
|
@ -77,5 +77,9 @@
|
|||
<Section Name="Textures AssetSet">
|
||||
<Key Name="file" Value="TexturesAssetSet/TexturesAssetSet.xml"/>
|
||||
</Section>
|
||||
|
||||
<Section Name="Settings AssetSet">
|
||||
<Key Name="file" Value="SettingsAssetSet/SettingsAssetSet.xml"/>
|
||||
</Section>
|
||||
<!---->
|
||||
</Nini>
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,9 @@
|
|||
<Nini>
|
||||
<Section Name="Default Daycycle">
|
||||
<Key Name="assetID" Value="5646d39e-d3d7-6aff-ed71-30fc87d64a91" />
|
||||
<Key Name="name" Value="Default Daycycle" />
|
||||
<Key Name="assetType" Value="56" />
|
||||
<Key Name="fileName" Value="DefaultDaycycle.xml" />
|
||||
</Section>
|
||||
|
||||
</Nini>
|
Binary file not shown.
|
@ -855,6 +855,13 @@
|
|||
<Key Name="assetType" Value="0" />
|
||||
<Key Name="fileName" Value="FALLBACK_BAKED_AUX3_32X32.j2k"/>
|
||||
</Section>
|
||||
<Section Name="DefaultCloud">
|
||||
<Key Name="assetID" Value="1dc1368f-e8fe-f02d-a08d-9d9f11c1af6b"/>
|
||||
<Key Name="name" Value="DefaultCloud"/>
|
||||
<Key Name="assetType" Value="0" />
|
||||
<Key Name="fileName" Value="DefaultClouds.j2c"/>
|
||||
</Section>
|
||||
|
||||
|
||||
|
||||
</Nini>
|
||||
|
|
|
@ -82,5 +82,9 @@
|
|||
<Key Name="foldersFile" Value="TexturesLibrary/TexturesLibraryFolders.xml"/>
|
||||
<Key Name="itemsFile" Value="TexturesLibrary/TexturesLibraryItems.xml"/>
|
||||
</Section>
|
||||
<Section Name="Settings Library">
|
||||
<Key Name="foldersFile" Value="SettingsLibrary/Folders.xml"/>
|
||||
<Key Name="itemsFile" Value="SettingsLibrary/Items.xml"/>
|
||||
</Section>
|
||||
<!---->
|
||||
</Nini>
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
<Nini>
|
||||
|
||||
|
||||
<Section Name="Settings Library">
|
||||
<Key Name="folderID" Value="00000112-000f-0000-0000-000100bba025"/>
|
||||
<Key Name="parentFolderID" Value="00000112-000f-0000-0000-000100bba000"/>
|
||||
<Key Name="name" Value="Settings Library"/>
|
||||
<Key Name="type" Value="25"/>
|
||||
</Section>
|
||||
<Section Name="Water">
|
||||
<Key Name="folderID" Value="25000112-000f-0000-0000-000100bba025"/>
|
||||
<Key Name="parentFolderID" Value="00000112-000f-0000-0000-000100bba025"/>
|
||||
<Key Name="name" Value="Water"/>
|
||||
<Key Name="type" Value="25"/>
|
||||
</Section>
|
||||
<Section Name="Sky">
|
||||
<Key Name="folderID" Value="25100112-000f-0000-0000-000100bba025"/>
|
||||
<Key Name="parentFolderID" Value="00000112-000f-0000-0000-000100bba025"/>
|
||||
<Key Name="name" Value="Sky"/>
|
||||
<Key Name="type" Value="25"/>
|
||||
</Section>
|
||||
<Section Name="Daycycle">
|
||||
<Key Name="folderID" Value="25200112-000f-0000-0000-000100bba025"/>
|
||||
<Key Name="parentFolderID" Value="00000112-000f-0000-0000-000100bba025"/>
|
||||
<Key Name="name" Value="Daycycle"/>
|
||||
<Key Name="type" Value="25"/>
|
||||
</Section>
|
||||
</Nini>
|
|
@ -0,0 +1,40 @@
|
|||
<!--
|
||||
In Keys,
|
||||
name is the name of the item.
|
||||
description is the description of the item.
|
||||
assetID is the ID of the asset data that is referenced by the item.
|
||||
folderID is the ID of the folder containing this item.
|
||||
inventoryID is the ID for the item. It must be unique.
|
||||
assetType is the asset type of the item. See the OpenMetaverse.AssetType enum in libopenmetaverse
|
||||
inventoryType is the inventory type of the item. See the OpenMetaverse.InventoryType enum in libopenmetaverse
|
||||
flags are only required for wearables. See OpenMetaverse.WearableType enum in libopenmetaverse.
|
||||
-->
|
||||
|
||||
<Nini>
|
||||
|
||||
<!--
|
||||
<Section Name="Example Library Item">
|
||||
<Key Name="inventoryID" Value="30000000-0000-2222-4444-000000000001" />
|
||||
<Key Name="assetID" Value="30000000-0000-2222-3333-000000000001" />
|
||||
<Key Name="folderID" Value="30000112-000f-0000-0000-000100bba003"/>
|
||||
<Key Name="description" Value="Example Library Item" />
|
||||
<Key Name="name" Value="Example Library Item" />
|
||||
<Key Name="assetType" Value="7" />
|
||||
<Key Name="inventoryType" Value="7" />
|
||||
</Section>
|
||||
-->
|
||||
|
||||
|
||||
<Section Name="Default Daycycle">
|
||||
<Key Name="inventoryID" Value="25210112-000f-0000-0000-000100bba025" />
|
||||
<Key Name="assetID" Value="5646d39e-d3d7-6aff-ed71-30fc87d64a91" />
|
||||
<Key Name="folderID" Value="25200112-000f-0000-0000-000100bba025"/>
|
||||
<Key Name="description" Value="Default Daycycle" />
|
||||
<Key Name="name" Value="Default Daycycle" />
|
||||
<Key Name="assetType" Value="56" />
|
||||
<Key Name="inventoryType" Value="25" />
|
||||
<Key Name="flags" Value="2" />
|
||||
</Section>
|
||||
|
||||
|
||||
</Nini>
|
Loading…
Reference in New Issue