Fix: Lightshare Module(Windlight)-Region settings are not applicable for database sqlite mantis: http://opensimulator.org/mantis/view.php?id=5888

iar_mods
PixelTomsen 2012-02-13 00:58:28 +01:00 committed by Justin Clark-Casey (justincc)
parent db90dea9bd
commit 33e66107be
4 changed files with 691 additions and 306 deletions

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

@ -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

View File

@ -1070,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