Merge branch 'master' into careminster

avinationmerge
Melanie 2012-02-15 01:11:17 +00:00
commit 272ba5a741
17 changed files with 906 additions and 361 deletions

View File

@ -236,3 +236,10 @@ CREATE NONCLUSTERED INDEX IX_regions_name ON dbo.regions
) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
COMMIT COMMIT
:VERSION 9
BEGIN TRANSACTION
ALTER TABLE regions ADD parcelMapTexture uniqueidentifier NULL;
COMMIT

View File

@ -472,3 +472,73 @@ COMMIT;
BEGIN; BEGIN;
ALTER TABLE regionsettings ADD COLUMN covenant_datetime INTEGER NOT NULL default 0; ALTER TABLE regionsettings ADD COLUMN covenant_datetime INTEGER NOT NULL default 0;
COMMIT; COMMIT;
:VERSION 23
BEGIN;
CREATE TABLE regionwindlight (
region_id VARCHAR(36) NOT NULL DEFAULT '000000-0000-0000-0000-000000000000' PRIMARY KEY,
water_color_r FLOAT NOT NULL DEFAULT '4.000000',
water_color_g FLOAT NOT NULL DEFAULT '38.000000',
water_color_b FLOAT NOT NULL DEFAULT '64.000000',
water_color_i FLOAT NOT NULL DEFAULT '1.000000',
water_fog_density_exponent FLOAT NOT NULL DEFAULT '4.0',
underwater_fog_modifier FLOAT NOT NULL DEFAULT '0.25',
reflection_wavelet_scale_1 FLOAT NOT NULL DEFAULT '2.0',
reflection_wavelet_scale_2 FLOAT NOT NULL DEFAULT '2.0',
reflection_wavelet_scale_3 FLOAT NOT NULL DEFAULT '2.0',
fresnel_scale FLOAT NOT NULL DEFAULT '0.40',
fresnel_offset FLOAT NOT NULL DEFAULT '0.50',
refract_scale_above FLOAT NOT NULL DEFAULT '0.03',
refract_scale_below FLOAT NOT NULL DEFAULT '0.20',
blur_multiplier FLOAT NOT NULL DEFAULT '0.040',
big_wave_direction_x FLOAT NOT NULL DEFAULT '1.05',
big_wave_direction_y FLOAT NOT NULL DEFAULT '-0.42',
little_wave_direction_x FLOAT NOT NULL DEFAULT '1.11',
little_wave_direction_y FLOAT NOT NULL DEFAULT '-1.16',
normal_map_texture VARCHAR(36) NOT NULL DEFAULT '822ded49-9a6c-f61c-cb89-6df54f42cdf4',
horizon_r FLOAT NOT NULL DEFAULT '0.25',
horizon_g FLOAT NOT NULL DEFAULT '0.25',
horizon_b FLOAT NOT NULL DEFAULT '0.32',
horizon_i FLOAT NOT NULL DEFAULT '0.32',
haze_horizon FLOAT NOT NULL DEFAULT '0.19',
blue_density_r FLOAT NOT NULL DEFAULT '0.12',
blue_density_g FLOAT NOT NULL DEFAULT '0.22',
blue_density_b FLOAT NOT NULL DEFAULT '0.38',
blue_density_i FLOAT NOT NULL DEFAULT '0.38',
haze_density FLOAT NOT NULL DEFAULT '0.70',
density_multiplier FLOAT NOT NULL DEFAULT '0.18',
distance_multiplier FLOAT NOT NULL DEFAULT '0.8',
max_altitude INTEGER NOT NULL DEFAULT '1605',
sun_moon_color_r FLOAT NOT NULL DEFAULT '0.24',
sun_moon_color_g FLOAT NOT NULL DEFAULT '0.26',
sun_moon_color_b FLOAT NOT NULL DEFAULT '0.30',
sun_moon_color_i FLOAT NOT NULL DEFAULT '0.30',
sun_moon_position FLOAT NOT NULL DEFAULT '0.317',
ambient_r FLOAT NOT NULL DEFAULT '0.35',
ambient_g FLOAT NOT NULL DEFAULT '0.35',
ambient_b FLOAT NOT NULL DEFAULT '0.35',
ambient_i FLOAT NOT NULL DEFAULT '0.35',
east_angle FLOAT NOT NULL DEFAULT '0.00',
sun_glow_focus FLOAT NOT NULL DEFAULT '0.10',
sun_glow_size FLOAT NOT NULL DEFAULT '1.75',
scene_gamma FLOAT NOT NULL DEFAULT '1.00',
star_brightness FLOAT NOT NULL DEFAULT '0.00',
cloud_color_r FLOAT NOT NULL DEFAULT '0.41',
cloud_color_g FLOAT NOT NULL DEFAULT '0.41',
cloud_color_b FLOAT NOT NULL DEFAULT '0.41',
cloud_color_i FLOAT NOT NULL DEFAULT '0.41',
cloud_x FLOAT NOT NULL DEFAULT '1.00',
cloud_y FLOAT NOT NULL DEFAULT '0.53',
cloud_density FLOAT NOT NULL DEFAULT '1.00',
cloud_coverage FLOAT NOT NULL DEFAULT '0.27',
cloud_scale FLOAT NOT NULL DEFAULT '0.42',
cloud_detail_x FLOAT NOT NULL DEFAULT '1.00',
cloud_detail_y FLOAT NOT NULL DEFAULT '0.53',
cloud_detail_density FLOAT NOT NULL DEFAULT '0.12',
cloud_scroll_x FLOAT NOT NULL DEFAULT '0.20',
cloud_scroll_x_lock INTEGER NOT NULL DEFAULT '0',
cloud_scroll_y FLOAT NOT NULL DEFAULT '0.01',
cloud_scroll_y_lock INTEGER NOT NULL DEFAULT '0',
draw_classic_clouds INTEGER NOT NULL DEFAULT '1');
COMMIT;

View File

@ -60,6 +60,7 @@ namespace OpenSim.Data.SQLite
private const string landAccessListSelect = "select distinct * from landaccesslist"; private const string landAccessListSelect = "select distinct * from landaccesslist";
private const string regionbanListSelect = "select * from regionban"; private const string regionbanListSelect = "select * from regionban";
private const string regionSettingsSelect = "select * from regionsettings"; private const string regionSettingsSelect = "select * from regionsettings";
private const string regionWindlightSelect = "select * from regionwindlight";
private DataSet ds; private DataSet ds;
private SqliteDataAdapter primDa; private SqliteDataAdapter primDa;
@ -69,9 +70,9 @@ namespace OpenSim.Data.SQLite
private SqliteDataAdapter landDa; private SqliteDataAdapter landDa;
private SqliteDataAdapter landAccessListDa; private SqliteDataAdapter landAccessListDa;
private SqliteDataAdapter regionSettingsDa; private SqliteDataAdapter regionSettingsDa;
private SqliteDataAdapter regionWindlightDa;
private SqliteConnection m_conn; private SqliteConnection m_conn;
private String m_connectionString; private String m_connectionString;
protected virtual Assembly Assembly protected virtual Assembly Assembly
@ -136,6 +137,9 @@ namespace OpenSim.Data.SQLite
SqliteCommand regionSettingsSelectCmd = new SqliteCommand(regionSettingsSelect, m_conn); SqliteCommand regionSettingsSelectCmd = new SqliteCommand(regionSettingsSelect, m_conn);
regionSettingsDa = new SqliteDataAdapter(regionSettingsSelectCmd); regionSettingsDa = new SqliteDataAdapter(regionSettingsSelectCmd);
SqliteCommand regionWindlightSelectCmd = new SqliteCommand(regionWindlightSelect, m_conn);
regionWindlightDa = new SqliteDataAdapter(regionWindlightSelectCmd);
// This actually does the roll forward assembly stuff // This actually does the roll forward assembly stuff
Migration m = new Migration(m_conn, Assembly, "RegionStore"); Migration m = new Migration(m_conn, Assembly, "RegionStore");
m.Update(); m.Update();
@ -163,6 +167,9 @@ namespace OpenSim.Data.SQLite
ds.Tables.Add(createRegionSettingsTable()); ds.Tables.Add(createRegionSettingsTable());
setupRegionSettingsCommands(regionSettingsDa, m_conn); setupRegionSettingsCommands(regionSettingsDa, m_conn);
ds.Tables.Add(createRegionWindlightTable());
setupRegionWindlightCommands(regionWindlightDa, m_conn);
// WORKAROUND: This is a work around for sqlite on // WORKAROUND: This is a work around for sqlite on
// windows, which gets really unhappy with blob columns // windows, which gets really unhappy with blob columns
// that have no sample data in them. At some point we // that have no sample data in them. At some point we
@ -171,63 +178,72 @@ namespace OpenSim.Data.SQLite
{ {
primDa.Fill(ds.Tables["prims"]); primDa.Fill(ds.Tables["prims"]);
} }
catch (Exception) catch (Exception e)
{ {
m_log.Info("[SQLITE REGION DB]: Caught fill error on prims table"); m_log.ErrorFormat("[SQLITE REGION DB]: Caught fill error on prims table :{0}", e.Message);
} }
try try
{ {
shapeDa.Fill(ds.Tables["primshapes"]); shapeDa.Fill(ds.Tables["primshapes"]);
} }
catch (Exception) catch (Exception e)
{ {
m_log.Info("[SQLITE REGION DB]: Caught fill error on primshapes table"); m_log.ErrorFormat("[SQLITE REGION DB]: Caught fill error on primshapes table :{0}", e.Message);
} }
try try
{ {
itemsDa.Fill(ds.Tables["primitems"]); itemsDa.Fill(ds.Tables["primitems"]);
} }
catch (Exception) catch (Exception e)
{ {
m_log.Info("[SQLITE REGION DB]: Caught fill error on primitems table"); m_log.ErrorFormat("[SQLITE REGION DB]: Caught fill error on primitems table :{0}", e.Message);
} }
try try
{ {
terrainDa.Fill(ds.Tables["terrain"]); terrainDa.Fill(ds.Tables["terrain"]);
} }
catch (Exception) catch (Exception e)
{ {
m_log.Info("[SQLITE REGION DB]: Caught fill error on terrain table"); m_log.ErrorFormat("[SQLITE REGION DB]: Caught fill error on terrain table :{0}", e.Message);
} }
try try
{ {
landDa.Fill(ds.Tables["land"]); landDa.Fill(ds.Tables["land"]);
} }
catch (Exception) catch (Exception e)
{ {
m_log.Info("[SQLITE REGION DB]: Caught fill error on land table"); m_log.ErrorFormat("[SQLITE REGION DB]: Caught fill error on land table :{0}", e.Message);
} }
try try
{ {
landAccessListDa.Fill(ds.Tables["landaccesslist"]); landAccessListDa.Fill(ds.Tables["landaccesslist"]);
} }
catch (Exception) catch (Exception e)
{ {
m_log.Info("[SQLITE REGION DB]: Caught fill error on landaccesslist table"); m_log.ErrorFormat("[SQLITE REGION DB]: Caught fill error on landaccesslist table :{0}", e.Message);
} }
try try
{ {
regionSettingsDa.Fill(ds.Tables["regionsettings"]); regionSettingsDa.Fill(ds.Tables["regionsettings"]);
} }
catch (Exception) catch (Exception e)
{ {
m_log.Info("[SQLITE REGION DB]: Caught fill error on regionsettings table"); m_log.ErrorFormat("[SQLITE REGION DB]: Caught fill error on regionsettings table :{0}", e.Message);
}
try
{
regionWindlightDa.Fill(ds.Tables["regionwindlight"]);
}
catch (Exception e)
{
m_log.ErrorFormat("[SQLITE REGION DB]: Caught fill error on regionwindlight table :{0}", e.Message);
} }
// We have to create a data set mapping for every table, otherwise the IDataAdaptor.Update() will not populate rows with values! // We have to create a data set mapping for every table, otherwise the IDataAdaptor.Update() will not populate rows with values!
@ -240,14 +256,14 @@ namespace OpenSim.Data.SQLite
CreateDataSetMapping(landDa, "land"); CreateDataSetMapping(landDa, "land");
CreateDataSetMapping(landAccessListDa, "landaccesslist"); CreateDataSetMapping(landAccessListDa, "landaccesslist");
CreateDataSetMapping(regionSettingsDa, "regionsettings"); CreateDataSetMapping(regionSettingsDa, "regionsettings");
CreateDataSetMapping(regionWindlightDa, "regionwindlight");
} }
} }
catch (Exception e) catch (Exception e)
{ {
m_log.Error(e); m_log.ErrorFormat("[SQLITE REGION DB]: ", e);
Environment.Exit(23); Environment.Exit(23);
} }
return; return;
} }
@ -298,6 +314,11 @@ namespace OpenSim.Data.SQLite
regionSettingsDa.Dispose(); regionSettingsDa.Dispose();
regionSettingsDa = null; regionSettingsDa = null;
} }
if (regionWindlightDa != null)
{
regionWindlightDa.Dispose();
regionWindlightDa = null;
}
} }
public void StoreRegionSettings(RegionSettings rs) public void StoreRegionSettings(RegionSettings rs)
@ -321,19 +342,76 @@ namespace OpenSim.Data.SQLite
Commit(); Commit();
} }
} }
/// <summary>
/// Load windlight settings from region storage
/// </summary>
/// <param name="regionUUID">RegionID</param>
public RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID) public RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID)
{ {
//This connector doesn't support the windlight module yet RegionLightShareData wl = null;
//Return default LL windlight settings
return new RegionLightShareData(); 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) 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) public void StoreRegionWindlightSettings(RegionLightShareData wl)
{ {
//This connector doesn't support the windlight module yet 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();
}
}
public RegionSettings LoadRegionSettings(UUID regionUUID) public RegionSettings LoadRegionSettings(UUID regionUUID)
{ {
lock (ds) lock (ds)
@ -562,8 +640,7 @@ namespace OpenSim.Data.SQLite
DataRow[] dbItemRows = dbItems.Select(sql); DataRow[] dbItemRows = dbItems.Select(sql);
IList<TaskInventoryItem> inventory = new List<TaskInventoryItem>(); IList<TaskInventoryItem> inventory = new List<TaskInventoryItem>();
// m_log.DebugFormat( // m_log.DebugFormat("[SQLITE REGION DB]: Found {0} items for {1} {2}", dbItemRows.Length, prim.Name, prim.UUID);
// "[SQLITE REGION DB]: Found {0} items for {1} {2}", dbItemRows.Length, prim.Name, prim.UUID);
foreach (DataRow row in dbItemRows) foreach (DataRow row in dbItemRows)
{ {
@ -819,6 +896,7 @@ namespace OpenSim.Data.SQLite
try try
{ {
regionSettingsDa.Update(ds, "regionsettings"); regionSettingsDa.Update(ds, "regionsettings");
regionWindlightDa.Update(ds, "regionwindlight");
} }
catch (SqliteException SqlEx) catch (SqliteException SqlEx)
{ {
@ -1191,6 +1269,82 @@ namespace OpenSim.Data.SQLite
return regionsettings; return regionsettings;
} }
/// <summary>
/// create "regionwindlight" table
/// </summary>
/// <returns>RegionWindlight DataTable</returns>
private static DataTable createRegionWindlightTable()
{
DataTable regionwindlight = new DataTable("regionwindlight");
createCol(regionwindlight, "region_id", typeof(String));
createCol(regionwindlight, "water_color_r", typeof(Double));
createCol(regionwindlight, "water_color_g", typeof(Double));
createCol(regionwindlight, "water_color_b", typeof(Double));
createCol(regionwindlight, "water_color_i", typeof(Double));
createCol(regionwindlight, "water_fog_density_exponent", typeof(Double));
createCol(regionwindlight, "underwater_fog_modifier", typeof(Double));
createCol(regionwindlight, "reflection_wavelet_scale_1", typeof(Double));
createCol(regionwindlight, "reflection_wavelet_scale_2", typeof(Double));
createCol(regionwindlight, "reflection_wavelet_scale_3", typeof(Double));
createCol(regionwindlight, "fresnel_scale", typeof(Double));
createCol(regionwindlight, "fresnel_offset", typeof(Double));
createCol(regionwindlight, "refract_scale_above", typeof(Double));
createCol(regionwindlight, "refract_scale_below", typeof(Double));
createCol(regionwindlight, "blur_multiplier", typeof(Double));
createCol(regionwindlight, "big_wave_direction_x", typeof(Double));
createCol(regionwindlight, "big_wave_direction_y", typeof(Double));
createCol(regionwindlight, "little_wave_direction_x", typeof(Double));
createCol(regionwindlight, "little_wave_direction_y", typeof(Double));
createCol(regionwindlight, "normal_map_texture", typeof(String));
createCol(regionwindlight, "horizon_r", typeof(Double));
createCol(regionwindlight, "horizon_g", typeof(Double));
createCol(regionwindlight, "horizon_b", typeof(Double));
createCol(regionwindlight, "horizon_i", typeof(Double));
createCol(regionwindlight, "haze_horizon", typeof(Double));
createCol(regionwindlight, "blue_density_r", typeof(Double));
createCol(regionwindlight, "blue_density_g", typeof(Double));
createCol(regionwindlight, "blue_density_b", typeof(Double));
createCol(regionwindlight, "blue_density_i", typeof(Double));
createCol(regionwindlight, "haze_density", typeof(Double));
createCol(regionwindlight, "density_multiplier", typeof(Double));
createCol(regionwindlight, "distance_multiplier", typeof(Double));
createCol(regionwindlight, "max_altitude", typeof(Int32));
createCol(regionwindlight, "sun_moon_color_r", typeof(Double));
createCol(regionwindlight, "sun_moon_color_g", typeof(Double));
createCol(regionwindlight, "sun_moon_color_b", typeof(Double));
createCol(regionwindlight, "sun_moon_color_i", typeof(Double));
createCol(regionwindlight, "sun_moon_position", typeof(Double));
createCol(regionwindlight, "ambient_r", typeof(Double));
createCol(regionwindlight, "ambient_g", typeof(Double));
createCol(regionwindlight, "ambient_b", typeof(Double));
createCol(regionwindlight, "ambient_i", typeof(Double));
createCol(regionwindlight, "east_angle", typeof(Double));
createCol(regionwindlight, "sun_glow_focus", typeof(Double));
createCol(regionwindlight, "sun_glow_size", typeof(Double));
createCol(regionwindlight, "scene_gamma", typeof(Double));
createCol(regionwindlight, "star_brightness", typeof(Double));
createCol(regionwindlight, "cloud_color_r", typeof(Double));
createCol(regionwindlight, "cloud_color_g", typeof(Double));
createCol(regionwindlight, "cloud_color_b", typeof(Double));
createCol(regionwindlight, "cloud_color_i", typeof(Double));
createCol(regionwindlight, "cloud_x", typeof(Double));
createCol(regionwindlight, "cloud_y", typeof(Double));
createCol(regionwindlight, "cloud_density", typeof(Double));
createCol(regionwindlight, "cloud_coverage", typeof(Double));
createCol(regionwindlight, "cloud_scale", typeof(Double));
createCol(regionwindlight, "cloud_detail_x", typeof(Double));
createCol(regionwindlight, "cloud_detail_y", typeof(Double));
createCol(regionwindlight, "cloud_detail_density", typeof(Double));
createCol(regionwindlight, "cloud_scroll_x", typeof(Double));
createCol(regionwindlight, "cloud_scroll_x_lock", typeof(Int32));
createCol(regionwindlight, "cloud_scroll_y", typeof(Double));
createCol(regionwindlight, "cloud_scroll_y_lock", typeof(Int32));
createCol(regionwindlight, "draw_classic_clouds", typeof(Int32));
regionwindlight.PrimaryKey = new DataColumn[] { regionwindlight.Columns["region_id"] };
return regionwindlight;
}
/*********************************************************************** /***********************************************************************
* *
* Convert between ADO.NET <=> OpenSim Objects * Convert between ADO.NET <=> OpenSim Objects
@ -1516,6 +1670,83 @@ namespace OpenSim.Data.SQLite
return newSettings; 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> /// <summary>
/// Build a land access entry from the persisted data. /// Build a land access entry from the persisted data.
/// </summary> /// </summary>
@ -1839,6 +2070,79 @@ namespace OpenSim.Data.SQLite
row["map_tile_ID"] = settings.TerrainImageID.ToString(); row["map_tile_ID"] = settings.TerrainImageID.ToString();
} }
/// <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>
/// ///
/// </summary> /// </summary>
@ -2274,6 +2578,19 @@ namespace OpenSim.Data.SQLite
da.UpdateCommand.Connection = conn; da.UpdateCommand.Connection = conn;
} }
/// <summary>
///
/// </summary>
/// <param name="da"></param>
/// <param name="conn"></param>
private void setupRegionWindlightCommands(SqliteDataAdapter da, SqliteConnection conn)
{
da.InsertCommand = createInsertCommand("regionwindlight", ds.Tables["regionwindlight"]);
da.InsertCommand.Connection = conn;
da.UpdateCommand = createUpdateCommand("regionwindlight", "region_id=:region_id", ds.Tables["regionwindlight"]);
da.UpdateCommand.Connection = conn;
}
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>

View File

@ -49,15 +49,16 @@ namespace OpenSim.Framework.Serialization.External
/// <param name="nodeToFill"></param> /// <param name="nodeToFill"></param>
/// <param name="processors">/param> /// <param name="processors">/param>
/// <param name="xtr"></param> /// <param name="xtr"></param>
public static void ExecuteReadProcessors<NodeType>( /// <returns>true on successful, false if there were any processing failures</returns>
public static bool ExecuteReadProcessors<NodeType>(
NodeType nodeToFill, Dictionary<string, Action<NodeType, XmlTextReader>> processors, XmlTextReader xtr) NodeType nodeToFill, Dictionary<string, Action<NodeType, XmlTextReader>> processors, XmlTextReader xtr)
{ {
ExecuteReadProcessors( return ExecuteReadProcessors(
nodeToFill, nodeToFill,
processors, processors,
xtr, xtr,
(o, name, e) (o, name, e)
=> m_log.ErrorFormat( => m_log.DebugFormat(
"[ExternalRepresentationUtils]: Exception while parsing element {0}, continuing. Exception {1}{2}", "[ExternalRepresentationUtils]: Exception while parsing element {0}, continuing. Exception {1}{2}",
name, e.Message, e.StackTrace)); name, e.Message, e.StackTrace));
} }
@ -71,12 +72,15 @@ namespace OpenSim.Framework.Serialization.External
/// <param name="parseExceptionAction"> /// <param name="parseExceptionAction">
/// Action to take if there is a parsing problem. This will usually just be to log the exception /// Action to take if there is a parsing problem. This will usually just be to log the exception
/// </param> /// </param>
public static void ExecuteReadProcessors<NodeType>( /// <returns>true on successful, false if there were any processing failures</returns>
public static bool ExecuteReadProcessors<NodeType>(
NodeType nodeToFill, NodeType nodeToFill,
Dictionary<string, Action<NodeType, XmlTextReader>> processors, Dictionary<string, Action<NodeType, XmlTextReader>> processors,
XmlTextReader xtr, XmlTextReader xtr,
Action<NodeType, string, Exception> parseExceptionAction) Action<NodeType, string, Exception> parseExceptionAction)
{ {
bool errors = false;
string nodeName = string.Empty; string nodeName = string.Empty;
while (xtr.NodeType != XmlNodeType.EndElement) while (xtr.NodeType != XmlNodeType.EndElement)
{ {
@ -95,6 +99,7 @@ namespace OpenSim.Framework.Serialization.External
} }
catch (Exception e) catch (Exception e)
{ {
errors = true;
parseExceptionAction(nodeToFill, nodeName, e); parseExceptionAction(nodeToFill, nodeName, e);
if (xtr.NodeType == XmlNodeType.EndElement) if (xtr.NodeType == XmlNodeType.EndElement)
@ -107,6 +112,8 @@ namespace OpenSim.Framework.Serialization.External
xtr.ReadOuterXml(); // ignore xtr.ReadOuterXml(); // ignore
} }
} }
return errors;
} }
/// <summary> /// <summary>
@ -140,6 +147,7 @@ namespace OpenSim.Framework.Serialization.External
UUID.TryParse(node.InnerText, out uuid); UUID.TryParse(node.InnerText, out uuid);
creator = userService.GetUserAccount(scopeID, uuid); creator = userService.GetUserAccount(scopeID, uuid);
} }
if (node.Name == "CreatorData" && node.InnerText != null && node.InnerText != string.Empty) if (node.Name == "CreatorData" && node.InnerText != null && node.InnerText != string.Empty)
hasCreatorData = true; hasCreatorData = true;
@ -163,7 +171,6 @@ namespace OpenSim.Framework.Serialization.External
doc.Save(wr); doc.Save(wr);
return wr.ToString(); return wr.ToString();
} }
} }
} }
} }

View File

@ -111,6 +111,15 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
#region IAvatarFactoryModule #region IAvatarFactoryModule
/// </summary>
/// <param name="sp"></param>
/// <param name="texture"></param>
/// <param name="visualParam"></param>
public void SetAppearance(IScenePresence sp, AvatarAppearance appearance)
{
SetAppearance(sp, appearance.Texture, appearance.VisualParams);
}
/// <summary> /// <summary>
/// Set appearance data (texture asset IDs and slider settings) /// Set appearance data (texture asset IDs and slider settings)
/// </summary> /// </summary>
@ -156,7 +165,9 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
changed = sp.Appearance.SetTextureEntries(textureEntry) || changed; changed = sp.Appearance.SetTextureEntries(textureEntry) || changed;
// WriteBakedTexturesReport(sp, m_log.DebugFormat); // WriteBakedTexturesReport(sp, m_log.DebugFormat);
if (!ValidateBakedTextureCache(sp))
// If bake textures are missing and this is not an NPC, request a rebake from client
if (!ValidateBakedTextureCache(sp) && (((ScenePresence)sp).PresenceType != PresenceType.Npc))
RequestRebake(sp, true); RequestRebake(sp, true);
// This appears to be set only in the final stage of the appearance // This appears to be set only in the final stage of the appearance
@ -164,6 +175,13 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
// appearance send and save here. // appearance send and save here.
} }
// NPC should send to clients immediately and skip saving appearance
if (((ScenePresence)sp).PresenceType == PresenceType.Npc)
{
SendAppearance((ScenePresence)sp);
return;
}
// save only if there were changes, send no matter what (doesn't hurt to send twice) // save only if there were changes, send no matter what (doesn't hurt to send twice)
if (changed) if (changed)
QueueAppearanceSave(sp.ControllingClient.AgentId); QueueAppearanceSave(sp.ControllingClient.AgentId);
@ -174,6 +192,15 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
// m_log.WarnFormat("[AVFACTORY]: complete SetAppearance for {0}:\n{1}",client.AgentId,sp.Appearance.ToString()); // m_log.WarnFormat("[AVFACTORY]: complete SetAppearance for {0}:\n{1}",client.AgentId,sp.Appearance.ToString());
} }
private void SendAppearance(ScenePresence sp)
{
// Send the appearance to everyone in the scene
sp.SendAppearanceToAllOtherAgents();
// Send animations back to the avatar as well
sp.Animator.SendAnimPack();
}
public bool SendAppearance(UUID agentId) public bool SendAppearance(UUID agentId)
{ {
// m_log.DebugFormat("[AVFACTORY]: Sending appearance for {0}", agentId); // m_log.DebugFormat("[AVFACTORY]: Sending appearance for {0}", agentId);
@ -185,12 +212,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
return false; return false;
} }
// Send the appearance to everyone in the scene SendAppearance(sp);
sp.SendAppearanceToAllOtherAgents();
// Send animations back to the avatar as well
sp.Animator.SendAnimPack();
return true; return true;
} }

View File

@ -707,7 +707,12 @@ namespace OpenSim.Region.CoreModules.World.Permissions
// Object owners should be able to edit their own content // Object owners should be able to edit their own content
if (currentUser == objectOwner) if (currentUser == objectOwner)
{ {
permission = true; // there is no way that later code can change this back to false
// so just return true immediately and short circuit the more
// expensive group checks
return true;
//permission = true;
} }
else if (group.IsAttachment) else if (group.IsAttachment)
{ {

View File

@ -35,6 +35,7 @@ namespace OpenSim.Region.Framework.Interfaces
public interface IAvatarFactoryModule public interface IAvatarFactoryModule
{ {
void SetAppearance(IScenePresence sp, AvatarAppearance appearance);
void SetAppearance(IScenePresence sp, Primitive.TextureEntry textureEntry, byte[] visualParams); void SetAppearance(IScenePresence sp, Primitive.TextureEntry textureEntry, byte[] visualParams);
/// <summary> /// <summary>

View File

@ -3408,9 +3408,9 @@ namespace OpenSim.Region.Framework.Scenes
// Don't disable this log message - it's too helpful // Don't disable this log message - it's too helpful
m_log.DebugFormat( m_log.DebugFormat(
"[SCENE]: Region {0} told of incoming {1} agent {2} {3} {4} (circuit code {5}, teleportflags {6}, position {7})", "[SCENE]: Region {0} told of incoming {1} agent {2} {3} {4} (circuit code {5}, IP {6}, viewer {7}, teleportflags {8}, position {9})",
RegionInfo.RegionName, (agent.child ? "child" : "root"),agent.firstname, agent.lastname, RegionInfo.RegionName, (agent.child ? "child" : "root"),agent.firstname, agent.lastname,
agent.AgentID, agent.circuitcode, teleportFlags, agent.startpos); agent.AgentID, agent.circuitcode, agent.IPAddress, agent.Viewer, teleportFlags, agent.startpos);
if (LoginsDisabled) if (LoginsDisabled)
{ {

View File

@ -295,13 +295,10 @@ namespace OpenSim.Region.Framework.Scenes
/// </summary> /// </summary>
public PhysicsActor PhysicsActor { get; private set; } public PhysicsActor PhysicsActor { get; private set; }
private byte m_movementflag; /// <summary>
/// Record user movement inputs.
public byte MovementFlag /// </summary>
{ public byte MovementFlag { get; private set; }
set { m_movementflag = value; }
get { return m_movementflag; }
}
private bool m_updateflag; private bool m_updateflag;

View File

@ -1486,7 +1486,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
m_SOPXmlProcessors, m_SOPXmlProcessors,
reader, reader,
(o, nodeName, e) (o, nodeName, e)
=> m_log.ErrorFormat( => m_log.DebugFormat(
"[SceneObjectSerializer]: Exception while parsing {0} in object {1} {2}: {3}{4}", "[SceneObjectSerializer]: Exception while parsing {0} in object {1} {2}: {3}{4}",
((SceneObjectPart)o).Name, ((SceneObjectPart)o).UUID, nodeName, e.Message, e.StackTrace)); ((SceneObjectPart)o).Name, ((SceneObjectPart)o).UUID, nodeName, e.Message, e.StackTrace));
@ -1539,14 +1539,18 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
reader.ReadStartElement(name, String.Empty); // Shape reader.ReadStartElement(name, String.Empty); // Shape
ExternalRepresentationUtils.ExecuteReadProcessors( errors = ExternalRepresentationUtils.ExecuteReadProcessors(
shape, shape,
m_ShapeXmlProcessors, m_ShapeXmlProcessors,
reader, reader,
(o, nodeName, e) (o, nodeName, e)
=> m_log.ErrorFormat( =>
{
m_log.DebugFormat(
"[SceneObjectSerializer]: Exception while parsing Shape property {0}: {1}{2}", "[SceneObjectSerializer]: Exception while parsing Shape property {0}: {1}{2}",
nodeName, e.Message, e.StackTrace)); nodeName, e.Message, e.StackTrace);
}
);
reader.ReadEndElement(); // Shape reader.ReadEndElement(); // Shape

View File

@ -63,9 +63,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
// Capability string prefixes // Capability string prefixes
private static readonly string m_parcelVoiceInfoRequestPath = "0007/"; private static readonly string m_parcelVoiceInfoRequestPath = "0207/";
private static readonly string m_provisionVoiceAccountRequestPath = "0008/"; private static readonly string m_provisionVoiceAccountRequestPath = "0208/";
private static readonly string m_chatSessionRequestPath = "0009/"; private static readonly string m_chatSessionRequestPath = "0209/";
// Control info // Control info
private static bool m_Enabled = false; private static bool m_Enabled = false;

View File

@ -30,6 +30,7 @@ using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.Specialized; using System.Collections.Specialized;
using System.Reflection; using System.Reflection;
using System.Threading;
using Nwc.XmlRpc; using Nwc.XmlRpc;
@ -167,6 +168,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
private bool m_debugEnabled = false; private bool m_debugEnabled = false;
private Dictionary<string, bool> m_pendingRequests = new Dictionary<string,bool>();
private ExpiringCache<string, OSDMap> m_memoryCache; private ExpiringCache<string, OSDMap> m_memoryCache;
private int m_cacheTimeout = 30; private int m_cacheTimeout = 30;
@ -1348,6 +1351,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
// Immediately forward the request if the cache is disabled. // Immediately forward the request if the cache is disabled.
if (m_cacheTimeout == 0) if (m_cacheTimeout == 0)
{ {
m_log.WarnFormat("[SIMIAN GROUPS CONNECTOR]: cache is disabled");
return WebUtil.PostToService(m_groupsServerURI, requestArgs); return WebUtil.PostToService(m_groupsServerURI, requestArgs);
} }
@ -1355,6 +1359,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
if (requestArgs["RequestMethod"] == "RemoveGeneric" if (requestArgs["RequestMethod"] == "RemoveGeneric"
|| requestArgs["RequestMethod"] == "AddGeneric") || requestArgs["RequestMethod"] == "AddGeneric")
{ {
m_log.WarnFormat("[SIMIAN GROUPS CONNECTOR]: clearing generics cache");
// Any and all updates cause the cache to clear // Any and all updates cause the cache to clear
m_memoryCache.Clear(); m_memoryCache.Clear();
@ -1366,19 +1372,68 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
// Create the cache key for the request and see if we have it cached // Create the cache key for the request and see if we have it cached
string CacheKey = WebUtil.BuildQueryString(requestArgs); string CacheKey = WebUtil.BuildQueryString(requestArgs);
OSDMap response = null;
if (!m_memoryCache.TryGetValue(CacheKey, out response))
{
// if it wasn't in the cache, pass the request to the Simian Grid Services
response = WebUtil.PostToService(m_groupsServerURI, requestArgs);
// and cache the response // This code uses a leader/follower pattern. On a cache miss, the request is added
m_memoryCache.AddOrUpdate(CacheKey, response, TimeSpan.FromSeconds(m_cacheTimeout)); // to a queue; the first thread to add it to the queue completes the request while
// follow on threads busy wait for the results, this situation seems to happen
// often when checking permissions
while (true)
{
OSDMap response = null;
bool firstRequest = false;
lock (m_memoryCache)
{
if (m_memoryCache.TryGetValue(CacheKey, out response))
return response;
if (! m_pendingRequests.ContainsKey(CacheKey))
{
m_pendingRequests.Add(CacheKey,true);
firstRequest = true;
}
}
if (firstRequest)
{
// if it wasn't in the cache, pass the request to the Simian Grid Services
try
{
response = WebUtil.PostToService(m_groupsServerURI, requestArgs);
}
catch (Exception e)
{
m_log.InfoFormat("[SIMIAN GROUPS CONNECTOR] request failed {0}",CacheKey);
}
// and cache the response
lock (m_memoryCache)
{
m_memoryCache.AddOrUpdate(CacheKey, response, TimeSpan.FromSeconds(m_cacheTimeout));
m_pendingRequests.Remove(CacheKey);
} }
// return cached response
return response; return response;
} }
Thread.Sleep(50); // waiting for a web request to complete, 50msecs is reasonable
}
// if (!m_memoryCache.TryGetValue(CacheKey, out response))
// {
// m_log.WarnFormat("[SIMIAN GROUPS CONNECTOR]: query not in the cache");
// Util.PrintCallStack();
// // if it wasn't in the cache, pass the request to the Simian Grid Services
// response = WebUtil.PostToService(m_groupsServerURI, requestArgs);
// // and cache the response
// m_memoryCache.AddOrUpdate(CacheKey, response, TimeSpan.FromSeconds(m_cacheTimeout));
// }
// // return cached response
// return response;
}
#endregion #endregion
} }

View File

@ -96,14 +96,14 @@ namespace OpenSim.Region.OptionalModules.World.NPC
if (!m_avatars.ContainsKey(agentId)) if (!m_avatars.ContainsKey(agentId))
return false; return false;
// Delete existing sp attachments
scene.AttachmentsModule.DeleteAttachmentsFromScene(sp, false); scene.AttachmentsModule.DeleteAttachmentsFromScene(sp, false);
AvatarAppearance npcAppearance = new AvatarAppearance(appearance, true); // Set new sp appearance. Also sends to clients.
sp.Appearance = npcAppearance; scene.RequestModuleInterface<IAvatarFactoryModule>().SetAppearance(sp, new AvatarAppearance(appearance, true));
scene.AttachmentsModule.RezAttachments(sp);
IAvatarFactoryModule module = scene.RequestModuleInterface<IAvatarFactoryModule>(); // Rez needed sp attachments
module.SendAppearance(sp.UUID); scene.AttachmentsModule.RezAttachments(sp);
return true; return true;
} }

View File

@ -156,6 +156,22 @@ namespace OpenSim.Region.Physics.OdePlugin
internal UUID m_uuid { get; private set; } internal UUID m_uuid { get; private set; }
internal bool bad = false; internal bool bad = false;
/// <summary>
/// ODE Avatar.
/// </summary>
/// <param name="avName"></param>
/// <param name="parent_scene"></param>
/// <param name="pos"></param>
/// <param name="size"></param>
/// <param name="pid_d"></param>
/// <param name="pid_p"></param>
/// <param name="capsule_radius"></param>
/// <param name="tensor"></param>
/// <param name="density">
/// Only used right now to return information to LSL. Not actually used to set mass in ODE!
/// </param>
/// <param name="walk_divisor"></param>
/// <param name="rundivisor"></param>
public OdeCharacter( public OdeCharacter(
String avName, OdeScene parent_scene, Vector3 pos, Vector3 size, float pid_d, float pid_p, String avName, OdeScene parent_scene, Vector3 pos, Vector3 size, float pid_d, float pid_p,
float capsule_radius, float tensor, float density, float capsule_radius, float tensor, float density,
@ -786,6 +802,10 @@ namespace OpenSim.Region.Physics.OdePlugin
Vector3 vec = Vector3.Zero; Vector3 vec = Vector3.Zero;
d.Vector3 vel = d.BodyGetLinearVel(Body); d.Vector3 vel = d.BodyGetLinearVel(Body);
// m_log.DebugFormat(
// "[ODE CHARACTER]: Current velocity in Move() is <{0},{1},{2}>, target {3} for {4}",
// vel.X, vel.Y, vel.Z, _target_velocity, Name);
float movementdivisor = 1f; float movementdivisor = 1f;
if (!m_alwaysRun) if (!m_alwaysRun)
@ -884,12 +904,14 @@ namespace OpenSim.Region.Physics.OdePlugin
if (flying) if (flying)
{ {
// This also acts as anti-gravity so that we hover when flying rather than fall.
vec.Z = (_target_velocity.Z - vel.Z) * (PID_D); vec.Z = (_target_velocity.Z - vel.Z) * (PID_D);
} }
} }
if (flying) if (flying)
{ {
// Anti-gravity so that we hover when flying rather than fall.
vec.Z += ((-1 * _parent_scene.gravityz) * m_mass); vec.Z += ((-1 * _parent_scene.gravityz) * m_mass);
//Added for auto fly height. Kitto Flora //Added for auto fly height. Kitto Flora
@ -921,6 +943,25 @@ namespace OpenSim.Region.Physics.OdePlugin
return; return;
} }
d.Vector3 newVel = d.BodyGetLinearVel(Body);
if (newVel.X >= 256 || newVel.X <= 256 || newVel.Y >= 256 || newVel.Y <= 256 || newVel.Z >= 256 || newVel.Z <= 256)
{
// m_log.DebugFormat(
// "[ODE CHARACTER]: Limiting falling velocity from {0} to {1} for {2}", newVel.Z, -9.8, Name);
newVel.X = Util.Clamp<float>(newVel.X, -255f, 255f);
newVel.Y = Util.Clamp<float>(newVel.Y, -255f, 255f);
if (!flying)
newVel.Z
= Util.Clamp<float>(
newVel.Z, -_parent_scene.AvatarTerminalVelocity, _parent_scene.AvatarTerminalVelocity);
else
newVel.Z = Util.Clamp<float>(newVel.Z, -255f, 255f);
d.BodySetLinearVel(Body, newVel.X, newVel.Y, newVel.Z);
}
} }
/// <summary> /// <summary>

View File

@ -144,6 +144,8 @@ namespace OpenSim.Region.Physics.OdePlugin
public float gravityy = 0f; public float gravityy = 0f;
public float gravityz = -9.8f; public float gravityz = -9.8f;
public float AvatarTerminalVelocity { get; set; }
private float contactsurfacelayer = 0.001f; private float contactsurfacelayer = 0.001f;
private int worldHashspaceLow = -4; private int worldHashspaceLow = -4;
@ -459,6 +461,15 @@ namespace OpenSim.Region.Physics.OdePlugin
gravityy = physicsconfig.GetFloat("world_gravityy", 0f); gravityy = physicsconfig.GetFloat("world_gravityy", 0f);
gravityz = physicsconfig.GetFloat("world_gravityz", -9.8f); gravityz = physicsconfig.GetFloat("world_gravityz", -9.8f);
float avatarTerminalVelocity = physicsconfig.GetFloat("avatar_terminal_velocity", 54f);
AvatarTerminalVelocity = Util.Clamp<float>(avatarTerminalVelocity, 0, 255f);
if (AvatarTerminalVelocity != avatarTerminalVelocity)
{
m_log.WarnFormat(
"[ODE SCENE]: avatar_terminal_velocity of {0} is invalid. Clamping to {1}",
avatarTerminalVelocity, AvatarTerminalVelocity);
}
worldHashspaceLow = physicsconfig.GetInt("world_hashspace_size_low", -4); worldHashspaceLow = physicsconfig.GetInt("world_hashspace_size_low", -4);
worldHashspaceHigh = physicsconfig.GetInt("world_hashspace_size_high", 128); worldHashspaceHigh = physicsconfig.GetInt("world_hashspace_size_high", 128);

View File

@ -484,7 +484,6 @@
;; such as the Meta7 viewer. ;; such as the Meta7 viewer.
;; It has no ill effect on viewers which do not support server-side ;; It has no ill effect on viewers which do not support server-side
;; windlight settings. ;; windlight settings.
;; Currently we only have support for MySQL databases.
; enable_windlight = false ; enable_windlight = false
@ -573,10 +572,15 @@
; DeleteScriptsOnStartup = true ; DeleteScriptsOnStartup = true
;; Set this to true (the default) to load each script into a separate ;; Set this to true (the default) to load each script into a separate
;; AppDomain. Setting this to false will load all script assemblies into the ;; AppDomain.
;; current AppDomain, which will reduce the per-script overhead at the ;;
;; expense of reduced security and the inability to garbage collect the ;; Setting this to false will load all script assemblies into the
;; script assemblies ;; current AppDomain, which will significantly improve script loading times.
;; It will also reduce initial per-script memory overhead.
;;
;; However, setting this to false will also prevent script DLLs from being unloaded from memory if the script is deleted.
;; This may cause an OutOfMemory problem over time when avatars with scripted attachments move in and out of the region.
;; Some Windows users have also reported script loading problems when AppDomainLoading = false
; AppDomainLoading = true ; AppDomainLoading = true
;# {DefaultCompileLanguage} {Enabled:true} {Default script language?} {lsl vb cs} lsl ;# {DefaultCompileLanguage} {Enabled:true} {Default script language?} {lsl vb cs} lsl

View File

@ -655,6 +655,11 @@
world_gravityy = 0 world_gravityy = 0
world_gravityz = -9.8 world_gravityz = -9.8
; Terminal velocity of a falling avatar
; This is the same http://en.wikipedia.org/wiki/Terminal_velocity#Examples
; Max value is 255, min value is 0
avatar_terminal_velocity = 54
; World Step size. (warning these are dangerous. Changing these will probably cause your scene to explode dramatically) ; World Step size. (warning these are dangerous. Changing these will probably cause your scene to explode dramatically)
; reference: fps = (0.089/ODE_STEPSIZE) * 1000; ; reference: fps = (0.089/ODE_STEPSIZE) * 1000;
world_stepsize = 0.0178 world_stepsize = 0.0178
@ -1065,7 +1070,6 @@
[LightShare] [LightShare]
; This enables the transmission of Windlight scenes to supporting clients, such as the Meta7 viewer. ; This enables the transmission of Windlight scenes to supporting clients, such as the Meta7 viewer.
; It has no ill effect on viewers which do not support server-side windlight settings. ; It has no ill effect on viewers which do not support server-side windlight settings.
; Currently we only have support for MySQL databases.
enable_windlight = false enable_windlight = false