Merge remote-tracking branch 'upstream/master' through 6/19/2024 into develop
Some checks failed
CodeQL / Analyze (csharp) (push) Has been cancelled
dotnet package / build (8.0.x) (push) Has been cancelled
dotnet package / build (9.0.x) (push) Has been cancelled

This commit is contained in:
Mike Dickson 2024-06-22 18:26:12 -04:00
commit 8dc009d334
37 changed files with 541 additions and 249 deletions

View file

@ -126,7 +126,8 @@ namespace OpenSim.Framework.Capabilities
WLEnv = 0x200,
AdvEnv = 0x400,
PBR = 0x800,
ViewerBenefits = 0x1000
ViewerBenefits = 0x1000,
TPBR = 0x2000
}
public CapsFlags Flags { get; set;}

View file

@ -893,7 +893,8 @@ namespace OpenSim.Data.MySQL
"covenant, covenant_datetime, Sandbox, sunvectorx, sunvectory, " +
"sunvectorz, loaded_creation_datetime, " +
"loaded_creation_id, map_tile_ID, block_search, casino, " +
"TelehubObject, parcel_tile_ID, cacheID) " +
"TelehubObject, parcel_tile_ID, cacheID, " +
"TerrainPBR1, TerrainPBR2, TerrainPBR3, TerrainPBR4)" +
"values (?RegionUUID, ?BlockTerraform, " +
"?BlockFly, ?AllowDamage, ?RestrictPushing, " +
"?AllowLandResell, ?AllowLandJoinDivide, " +
@ -910,7 +911,8 @@ namespace OpenSim.Data.MySQL
"?SunVectorX, ?SunVectorY, ?SunVectorZ, " +
"?loaded_creation_datetime, ?loaded_creation_id, " +
"?map_tile_ID, ?block_search, ?casino, " +
"?TelehubObject, ?parcel_tile_ID, ?cacheID)";
"?TelehubObject, ?parcel_tile_ID, ?cacheID, " +
"?TerrainPBR1, ?TerrainPBR2, ?TerrainPBR3, ?TerrainPBR4)";
FillRegionSettingsCommand(cmd, rs);
ExecuteNonQuery(cmd);
@ -1295,6 +1297,11 @@ namespace OpenSim.Data.MySQL
if (row["cacheID"] is not DBNull)
newSettings.CacheID = DBGuid.FromDB(row["cacheID"]);
newSettings.TerrainPBR1 = DBGuid.FromDB(row["TerrainPBR1"]);
newSettings.TerrainPBR2 = DBGuid.FromDB(row["TerrainPBR2"]);
newSettings.TerrainPBR3 = DBGuid.FromDB(row["TerrainPBR3"]);
newSettings.TerrainPBR4 = DBGuid.FromDB(row["TerrainPBR4"]);
return newSettings;
}
@ -1701,6 +1708,11 @@ namespace OpenSim.Data.MySQL
cmd.Parameters.AddWithValue("parcel_tile_ID", settings.ParcelImageID.ToString());
cmd.Parameters.AddWithValue("TelehubObject", settings.TelehubObject.ToString());
cmd.Parameters.AddWithValue("cacheID", settings.CacheID.ToString());
cmd.Parameters.AddWithValue("TerrainPBR1", settings.TerrainPBR1.ToString());
cmd.Parameters.AddWithValue("TerrainPBR2", settings.TerrainPBR2.ToString());
cmd.Parameters.AddWithValue("TerrainPBR3", settings.TerrainPBR3.ToString());
cmd.Parameters.AddWithValue("TerrainPBR4", settings.TerrainPBR4.ToString());
}
/// <summary>

View file

@ -558,4 +558,11 @@ COMMIT;
:VERSION 65 #----- add linkset data storage column
BEGIN;
ALTER TABLE `prims` ADD COLUMN `linksetdata` MEDIUMTEXT default NULL;
COMMIT;
:VERSION 66 #----- add PBR Terrain storage column
BEGIN;
ALTER TABLE `regionsettings` ADD COLUMN `TerrainPBR1` varchar(36) NOT NULL;
ALTER TABLE `regionsettings` ADD COLUMN `TerrainPBR2` varchar(36) NOT NULL;
ALTER TABLE `regionsettings` ADD COLUMN `TerrainPBR3` varchar(36) NOT NULL;
ALTER TABLE `regionsettings` ADD COLUMN `TerrainPBR4` varchar(36) NOT NULL;
COMMIT;

View file

@ -951,7 +951,8 @@ namespace OpenSim.Data.PGSQL
,block_show_in_search = :block_show_in_search ,agent_limit = :agent_limit ,object_bonus = :object_bonus ,maturity = :maturity
,disable_scripts = :disable_scripts ,disable_collisions = :disable_collisions ,disable_physics = :disable_physics
,terrain_texture_1 = :terrain_texture_1 ,terrain_texture_2 = :terrain_texture_2 ,terrain_texture_3 = :terrain_texture_3
,terrain_texture_4 = :terrain_texture_4 ,elevation_1_nw = :elevation_1_nw ,elevation_2_nw = :elevation_2_nw
,terrain_texture_4 = :terrain_texture_4 , TerrainPBR1 = :TerrainPBR1, TerrainPBR2 = :TerrainPBR2, TerrainPBR3 = :TerrainPBR3
,TerrainPBR4 = :TerrainPBR4, elevation_1_nw = :elevation_1_nw ,elevation_2_nw = :elevation_2_nw
,elevation_1_ne = :elevation_1_ne ,elevation_2_ne = :elevation_2_ne ,elevation_1_se = :elevation_1_se ,elevation_2_se = :elevation_2_se
,elevation_1_sw = :elevation_1_sw ,elevation_2_sw = :elevation_2_sw ,water_height = :water_height ,terrain_raise_limit = :terrain_raise_limit
,terrain_lower_limit = :terrain_lower_limit ,use_estate_sun = :use_estate_sun ,fixed_sun = :fixed_sun ,sun_position = :sun_position
@ -1074,6 +1075,12 @@ namespace OpenSim.Data.PGSQL
if (!(row["cacheID"] is DBNull))
newSettings.CacheID = new UUID((Guid)row["cacheID"]);
newSettings.TerrainPBR1 = new UUID((Guid)row["TerrainPBR1"]);
newSettings.TerrainPBR2 = new UUID((Guid)row["TerrainPBR2"]);
newSettings.TerrainPBR3 = new UUID((Guid)row["TerrainPBR3"]);
newSettings.TerrainPBR4 = new UUID((Guid)row["TerrainPBR4"]);
return newSettings;
}
@ -1551,53 +1558,57 @@ namespace OpenSim.Data.PGSQL
/// <returns></returns>
private NpgsqlParameter[] CreateRegionSettingParameters(RegionSettings settings)
{
List<NpgsqlParameter> parameters = new List<NpgsqlParameter>();
parameters.Add(_Database.CreateParameter("regionUUID", settings.RegionUUID));
parameters.Add(_Database.CreateParameter("block_terraform", settings.BlockTerraform));
parameters.Add(_Database.CreateParameter("block_fly", settings.BlockFly));
parameters.Add(_Database.CreateParameter("allow_damage", settings.AllowDamage));
parameters.Add(_Database.CreateParameter("restrict_pushing", settings.RestrictPushing));
parameters.Add(_Database.CreateParameter("allow_land_resell", settings.AllowLandResell));
parameters.Add(_Database.CreateParameter("allow_land_join_divide", settings.AllowLandJoinDivide));
parameters.Add(_Database.CreateParameter("block_show_in_search", settings.BlockShowInSearch));
parameters.Add(_Database.CreateParameter("agent_limit", settings.AgentLimit));
parameters.Add(_Database.CreateParameter("object_bonus", settings.ObjectBonus));
parameters.Add(_Database.CreateParameter("maturity", settings.Maturity));
parameters.Add(_Database.CreateParameter("disable_scripts", settings.DisableScripts));
parameters.Add(_Database.CreateParameter("disable_collisions", settings.DisableCollisions));
parameters.Add(_Database.CreateParameter("disable_physics", settings.DisablePhysics));
parameters.Add(_Database.CreateParameter("terrain_texture_1", settings.TerrainTexture1));
parameters.Add(_Database.CreateParameter("terrain_texture_2", settings.TerrainTexture2));
parameters.Add(_Database.CreateParameter("terrain_texture_3", settings.TerrainTexture3));
parameters.Add(_Database.CreateParameter("terrain_texture_4", settings.TerrainTexture4));
parameters.Add(_Database.CreateParameter("elevation_1_nw", settings.Elevation1NW));
parameters.Add(_Database.CreateParameter("elevation_2_nw", settings.Elevation2NW));
parameters.Add(_Database.CreateParameter("elevation_1_ne", settings.Elevation1NE));
parameters.Add(_Database.CreateParameter("elevation_2_ne", settings.Elevation2NE));
parameters.Add(_Database.CreateParameter("elevation_1_se", settings.Elevation1SE));
parameters.Add(_Database.CreateParameter("elevation_2_se", settings.Elevation2SE));
parameters.Add(_Database.CreateParameter("elevation_1_sw", settings.Elevation1SW));
parameters.Add(_Database.CreateParameter("elevation_2_sw", settings.Elevation2SW));
parameters.Add(_Database.CreateParameter("water_height", settings.WaterHeight));
parameters.Add(_Database.CreateParameter("terrain_raise_limit", settings.TerrainRaiseLimit));
parameters.Add(_Database.CreateParameter("terrain_lower_limit", settings.TerrainLowerLimit));
parameters.Add(_Database.CreateParameter("use_estate_sun", settings.UseEstateSun));
parameters.Add(_Database.CreateParameter("Sandbox", settings.Sandbox));
parameters.Add(_Database.CreateParameter("fixed_sun", settings.FixedSun));
parameters.Add(_Database.CreateParameter("sun_position", settings.SunPosition));
parameters.Add(_Database.CreateParameter("sunvectorx", settings.SunVector.X));
parameters.Add(_Database.CreateParameter("sunvectory", settings.SunVector.Y));
parameters.Add(_Database.CreateParameter("sunvectorz", settings.SunVector.Z));
parameters.Add(_Database.CreateParameter("covenant", settings.Covenant));
parameters.Add(_Database.CreateParameter("covenant_datetime", settings.CovenantChangedDateTime));
parameters.Add(_Database.CreateParameter("Loaded_Creation_DateTime", settings.LoadedCreationDateTime));
parameters.Add(_Database.CreateParameter("Loaded_Creation_ID", settings.LoadedCreationID));
parameters.Add(_Database.CreateParameter("TerrainImageID", settings.TerrainImageID));
parameters.Add(_Database.CreateParameter("ParcelImageID", settings.ParcelImageID));
parameters.Add(_Database.CreateParameter("TelehubObject", settings.TelehubObject));
parameters.Add(_Database.CreateParameter("cacheID", settings.CacheID));
List<NpgsqlParameter> parameters =
[
_Database.CreateParameter("regionUUID", settings.RegionUUID),
_Database.CreateParameter("block_terraform", settings.BlockTerraform),
_Database.CreateParameter("block_fly", settings.BlockFly),
_Database.CreateParameter("allow_damage", settings.AllowDamage),
_Database.CreateParameter("restrict_pushing", settings.RestrictPushing),
_Database.CreateParameter("allow_land_resell", settings.AllowLandResell),
_Database.CreateParameter("allow_land_join_divide", settings.AllowLandJoinDivide),
_Database.CreateParameter("block_show_in_search", settings.BlockShowInSearch),
_Database.CreateParameter("agent_limit", settings.AgentLimit),
_Database.CreateParameter("object_bonus", settings.ObjectBonus),
_Database.CreateParameter("maturity", settings.Maturity),
_Database.CreateParameter("disable_scripts", settings.DisableScripts),
_Database.CreateParameter("disable_collisions", settings.DisableCollisions),
_Database.CreateParameter("disable_physics", settings.DisablePhysics),
_Database.CreateParameter("terrain_texture_1", settings.TerrainTexture1),
_Database.CreateParameter("terrain_texture_2", settings.TerrainTexture2),
_Database.CreateParameter("terrain_texture_3", settings.TerrainTexture3),
_Database.CreateParameter("terrain_texture_4", settings.TerrainTexture4),
_Database.CreateParameter("elevation_1_nw", settings.Elevation1NW),
_Database.CreateParameter("elevation_2_nw", settings.Elevation2NW),
_Database.CreateParameter("elevation_1_ne", settings.Elevation1NE),
_Database.CreateParameter("elevation_2_ne", settings.Elevation2NE),
_Database.CreateParameter("elevation_1_se", settings.Elevation1SE),
_Database.CreateParameter("elevation_2_se", settings.Elevation2SE),
_Database.CreateParameter("elevation_1_sw", settings.Elevation1SW),
_Database.CreateParameter("elevation_2_sw", settings.Elevation2SW),
_Database.CreateParameter("water_height", settings.WaterHeight),
_Database.CreateParameter("terrain_raise_limit", settings.TerrainRaiseLimit),
_Database.CreateParameter("terrain_lower_limit", settings.TerrainLowerLimit),
_Database.CreateParameter("use_estate_sun", settings.UseEstateSun),
_Database.CreateParameter("Sandbox", settings.Sandbox),
_Database.CreateParameter("fixed_sun", settings.FixedSun),
_Database.CreateParameter("sun_position", settings.SunPosition),
_Database.CreateParameter("sunvectorx", settings.SunVector.X),
_Database.CreateParameter("sunvectory", settings.SunVector.Y),
_Database.CreateParameter("sunvectorz", settings.SunVector.Z),
_Database.CreateParameter("covenant", settings.Covenant),
_Database.CreateParameter("covenant_datetime", settings.CovenantChangedDateTime),
_Database.CreateParameter("Loaded_Creation_DateTime", settings.LoadedCreationDateTime),
_Database.CreateParameter("Loaded_Creation_ID", settings.LoadedCreationID),
_Database.CreateParameter("TerrainImageID", settings.TerrainImageID),
_Database.CreateParameter("ParcelImageID", settings.ParcelImageID),
_Database.CreateParameter("TelehubObject", settings.TelehubObject),
_Database.CreateParameter("cacheID", settings.CacheID),
_Database.CreateParameter("TerrainPBR1", settings.TerrainPBR1),
_Database.CreateParameter("TerrainPBR2", settings.TerrainPBR2),
_Database.CreateParameter("TerrainPBR3", settings.TerrainPBR3),
_Database.CreateParameter("TerrainPBR4", settings.TerrainPBR4),
];
return parameters.ToArray();
}

View file

@ -1259,3 +1259,11 @@ COMMIT;
BEGIN;
ALTER TABLE "public".`prims` ADD COLUMN `linksetdata` varchar default NULL;
COMMIT;
:VERSION 54 #----- add pbr terrain storage
BEGIN;
ALTER TABLE regionsettings ADD COLUMN "TerrainPBR1" uuid NOT NULL;
ALTER TABLE regionsettings ADD COLUMN "TerrainPBR2" uuid NOT NULL;
ALTER TABLE regionsettings ADD COLUMN "TerrainPBR3" uuid NOT NULL;
ALTER TABLE regionsettings ADD COLUMN "TerrainPBR4" uuid NOT NULL;
COMMIT;

View file

@ -409,4 +409,12 @@ COMMIT;
:VERSION 41 #----- add linkset data storage column
BEGIN;
ALTER TABLE `prims` ADD COLUMN `linksetdata` TEXT default NULL;
COMMIT;
COMMIT;
:VERSION 42 #----- add pbr terrain storage
BEGIN;
ALTER TABLE regionsettings ADD COLUMN TerrainPBR1 char(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000';
ALTER TABLE regionsettings ADD COLUMN TerrainPBR2 char(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000';
ALTER TABLE regionsettings ADD COLUMN TerrainPBR3 char(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000';
ALTER TABLE regionsettings ADD COLUMN TerrainPBR4 char(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000';
COMMIT;

View file

@ -1427,6 +1427,10 @@ namespace OpenSim.Data.SQLite
createCol(regionsettings, "terrain_texture_2", typeof(String));
createCol(regionsettings, "terrain_texture_3", typeof(String));
createCol(regionsettings, "terrain_texture_4", typeof(String));
createCol(regionsettings, "TerrainPBR1", typeof(String));
createCol(regionsettings, "TerrainPBR2", typeof(String));
createCol(regionsettings, "TerrainPBR3", typeof(String));
createCol(regionsettings, "TerrainPBR4", typeof(String));
createCol(regionsettings, "elevation_1_nw", typeof(Double));
createCol(regionsettings, "elevation_2_nw", typeof(Double));
createCol(regionsettings, "elevation_1_ne", typeof(Double));
@ -2004,6 +2008,11 @@ namespace OpenSim.Data.SQLite
if (row["cacheID"] is not System.DBNull)
newSettings.CacheID = new UUID((String)row["cacheID"]);
newSettings.TerrainPBR1 = new UUID((String)row["TerrainPBR1"]);
newSettings.TerrainPBR2 = new UUID((String)row["TerrainPBR2"]);
newSettings.TerrainPBR3 = new UUID((String)row["TerrainPBR3"]);
newSettings.TerrainPBR4 = new UUID((String)row["TerrainPBR4"]);
return newSettings;
}
@ -2364,6 +2373,12 @@ namespace OpenSim.Data.SQLite
row["block_search"] = settings.GodBlockSearch;
row["casino"] = settings.Casino;
row["cacheID"] = settings.CacheID;
row["TerrainPBR1"] = settings.TerrainPBR1.ToString();
row["TerrainPBR2"] = settings.TerrainPBR2.ToString();
row["TerrainPBR3"] = settings.TerrainPBR3.ToString();
row["TerrainPBR4"] = settings.TerrainPBR4.ToString();
}
/// <summary>

View file

@ -59,7 +59,7 @@ namespace OpenSim.Framework
public const float MinWaterHeight = 0;
public const float MaxWaterHeight = 8000f;
public const int MaxTextureResolution = 1024;
public const int MaxTextureResolution = 2048;
public static readonly string DefaultTexture = "89556747-24cb-43ed-920b-47caed15465f"; //plywood
public static readonly UUID DefaultTextureID = new UUID(DefaultTexture);

View file

@ -598,6 +598,18 @@ namespace OpenSim.Framework
public int Price;
}
[Flags]
public enum ViewerFlags:uint
{
SentSeeds = 0x1000,
ObjectAnim = 0x2000,
WLEnv = 0x4000,
AdvEnv = 0x8000,
PBR = 0x10000,
TPBR = 0x20000,
SentTPBR = 0x40000,
}
/// <summary>
/// Specifies the fields that have been changed when sending a prim or
/// avatar update
@ -671,6 +683,8 @@ namespace OpenSim.Framework
ulong ActiveGroupPowers { get; set;}
ViewerFlags ViewerFlags { get;}
Dictionary<UUID, ulong> GetGroupPowers();
void SetGroupPowers(Dictionary<UUID, ulong> powers);

View file

@ -788,8 +788,8 @@ namespace OpenSim.Framework
// There is a practical limit to region size.
if (RegionSizeX > Constants.MaximumRegionSize || RegionSizeY > Constants.MaximumRegionSize)
{
RegionSizeX = Util.Clamp<uint>(RegionSizeX, Constants.RegionSize, Constants.MaximumRegionSize);
RegionSizeY = Util.Clamp<uint>(RegionSizeY, Constants.RegionSize, Constants.MaximumRegionSize);
RegionSizeX = Math.Clamp(RegionSizeX, Constants.RegionSize, Constants.MaximumRegionSize);
RegionSizeY = Math.Clamp(RegionSizeY, Constants.RegionSize, Constants.MaximumRegionSize);
m_log.ErrorFormat("{0} Region dimensions must be less than {1}. Clamping {2}'s size to <{3},{4}>",
LogHeader, Constants.MaximumRegionSize, m_regionName, RegionSizeX, RegionSizeY);
}

View file

@ -116,6 +116,12 @@ namespace OpenSim.Framework
public static readonly UUID DEFAULT_TERRAIN_TEXTURE_3 = new("179cdabd-398a-9b6b-1391-4dc333ba321f");
public static readonly UUID DEFAULT_TERRAIN_TEXTURE_4 = new("beb169c7-11ea-fff2-efe5-0f24dc881df2");
public static readonly UUID DEFAULT_TERRAIN_PBR_1 = new("b8d3965a-ad78-bf43-699b-bff8eca6c975");
public static readonly UUID DEFAULT_TERRAIN_PBR_2 = new("abb783e6-3e93-26c0-248a-247666855da3");
public static readonly UUID DEFAULT_TERRAIN_PBR_3 = new("179cdabd-398a-9b6b-1391-4dc333ba321f");
public static readonly UUID DEFAULT_TERRAIN_PBR_4 = new("beb169c7-11ea-fff2-efe5-0f24dc881df2");
public void Save()
{
OnSave?.Invoke(this);
@ -226,13 +232,7 @@ namespace OpenSim.Framework
public UUID TerrainTexture1
{
get { return m_TerrainTexture1; }
set
{
if (value.IsZero())
m_TerrainTexture1 = DEFAULT_TERRAIN_TEXTURE_1;
else
m_TerrainTexture1 = value;
}
set { m_TerrainTexture1 = value.IsZero() ? DEFAULT_TERRAIN_TEXTURE_1 : value; }
}
private UUID m_TerrainTexture2 = UUID.Zero;
@ -240,13 +240,7 @@ namespace OpenSim.Framework
public UUID TerrainTexture2
{
get { return m_TerrainTexture2; }
set
{
if (value.IsZero())
m_TerrainTexture2 = DEFAULT_TERRAIN_TEXTURE_2;
else
m_TerrainTexture2 = value;
}
set { m_TerrainTexture2 = value.IsZero() ? DEFAULT_TERRAIN_TEXTURE_2 : value; }
}
private UUID m_TerrainTexture3 = UUID.Zero;
@ -254,13 +248,7 @@ namespace OpenSim.Framework
public UUID TerrainTexture3
{
get { return m_TerrainTexture3; }
set
{
if (value.IsZero())
m_TerrainTexture3 = DEFAULT_TERRAIN_TEXTURE_3;
else
m_TerrainTexture3 = value;
}
set { m_TerrainTexture3 = value.IsZero() ? DEFAULT_TERRAIN_TEXTURE_3 : value; }
}
private UUID m_TerrainTexture4 = UUID.Zero;
@ -268,15 +256,38 @@ namespace OpenSim.Framework
public UUID TerrainTexture4
{
get { return m_TerrainTexture4; }
set
{
if (value.IsZero())
m_TerrainTexture4 = DEFAULT_TERRAIN_TEXTURE_4;
else
m_TerrainTexture4 = value;
}
set { m_TerrainTexture4 = value.IsZero() ? DEFAULT_TERRAIN_TEXTURE_4 : value; }
}
private UUID m_TerrainPBR1 = UUID.Zero;
public UUID TerrainPBR1
{
get { return m_TerrainPBR1; }
set { m_TerrainPBR1 = value;}
}
private UUID m_TerrainPBR2 = UUID.Zero;
public UUID TerrainPBR2
{
get { return m_TerrainPBR2; }
set { m_TerrainPBR2 = value; }
}
private UUID m_TerrainPBR3 = UUID.Zero;
public UUID TerrainPBR3
{
get { return m_TerrainPBR3; }
set { m_TerrainPBR3 = value; }
}
private UUID m_TerrainPBR4 = UUID.Zero;
public UUID TerrainPBR4
{
get { return m_TerrainPBR4; }
set { m_TerrainPBR4 = value; }
}
private double m_Elevation1NW = 10;
public double Elevation1NW
{

View file

@ -140,6 +140,18 @@ namespace OpenSim.Framework.Serialization.External
case "Texture4":
settings.TerrainTexture4 = UUID.Parse(xtr.ReadElementContentAsString());
break;
case "PBR1":
settings.TerrainPBR1 = UUID.Parse(xtr.ReadElementContentAsString());
break;
case "PBR2":
settings.TerrainPBR2 = UUID.Parse(xtr.ReadElementContentAsString());
break;
case "PBR3":
settings.TerrainPBR3 = UUID.Parse(xtr.ReadElementContentAsString());
break;
case "PBR4":
settings.TerrainPBR3 = UUID.Parse(xtr.ReadElementContentAsString());
break;
case "ElevationLowSW":
settings.Elevation1SW = double.Parse(xtr.ReadElementContentAsString(), Culture.NumberFormatInfo);
break;
@ -301,6 +313,10 @@ namespace OpenSim.Framework.Serialization.External
xtw.WriteElementString("Texture2", settings.TerrainTexture2.ToString());
xtw.WriteElementString("Texture3", settings.TerrainTexture3.ToString());
xtw.WriteElementString("Texture4", settings.TerrainTexture4.ToString());
xtw.WriteElementString("PBR1", settings.TerrainPBR1.ToString());
xtw.WriteElementString("PBR2", settings.TerrainPBR2.ToString());
xtw.WriteElementString("PBR3", settings.TerrainPBR3.ToString());
xtw.WriteElementString("PBR4", settings.TerrainPBR4.ToString());
xtw.WriteElementString("ElevationLowSW", settings.Elevation1SW.ToString());
xtw.WriteElementString("ElevationLowNW", settings.Elevation1NW.ToString());
xtw.WriteElementString("ElevationLowSE", settings.Elevation1SE.ToString());

View file

@ -659,6 +659,7 @@ namespace OpenSim.Framework
return true;
}
//obsolete use Math.Clamp
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static T Clamp<T>(T x, T min, T max)
where T : IComparable<T>

View file

@ -39,7 +39,7 @@ namespace OpenSim
{
public const string VersionNumber = "0.9.3.0";
public const string AssemblyVersionNumber = "0.9.3.0";
public const string Release = "8915";
public const string Release = "8939";
public static string Version
{

View file

@ -263,9 +263,6 @@ namespace OpenSim.Region.ClientStack.Linden
m_HostCapsObj.RegisterSimpleHandler("UpdateScriptTaskInventory", oreq, true); //legacy
}
m_HostCapsObj.RegisterSimpleHandler("UpdateAgentInformation",
new SimpleStreamHandler(GetNewCapPath(), UpdateAgentInformation));
m_HostCapsObj.RegisterSimpleHandler("CopyInventoryFromNotecard",
new SimpleOSDMapHandler("POST", GetNewCapPath(), CopyInventoryFromNotecard));
@ -350,9 +347,21 @@ namespace OpenSim.Region.ClientStack.Linden
{
case "SEED":
continue;
case "ViewerBenefits": // this may need a proper cap but not currently
case "ViewerBenefits":
m_HostCapsObj.Flags |= Caps.CapsFlags.ViewerBenefits;
continue;
case "VTPBR":
if (m_Scene.RegionInfo.RegionSizeX == Constants.RegionSize &&
m_Scene.RegionInfo.RegionSizeY == Constants.RegionSize )
{
m_HostCapsObj.Flags |= Caps.CapsFlags.PBR | Caps.CapsFlags.TPBR;
}
else
m_HostCapsObj.Flags |= Caps.CapsFlags.PBR;
continue;
case "VETPBR":
m_HostCapsObj.Flags |= Caps.CapsFlags.PBR | Caps.CapsFlags.TPBR;
continue;
case "ObjectAnimation":
m_HostCapsObj.Flags |= Caps.CapsFlags.ObjectAnim;
break;
@ -370,7 +379,7 @@ namespace OpenSim.Region.ClientStack.Linden
}
validCaps.Add(cstr);
}
osUTF8 sb = LLSDxmlEncode2.Start();
LLSDxmlEncode2.AddMap(sb);
m_HostCapsObj.GetCapsDetailsLLSDxml(validCaps, sb);
@ -1883,29 +1892,6 @@ namespace OpenSim.Region.ClientStack.Linden
httpResponse.StatusCode = (int)HttpStatusCode.OK;
}
public void UpdateAgentInformation(IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
if (httpRequest.HttpMethod != "POST")
{
httpResponse.StatusCode = (int)HttpStatusCode.NotFound;
return;
}
// this is wrong now ignores request and sends same result for all
// we don't store and worse don't use that to filter contents
// OSDMap req = (OSDMap)OSDParser.DeserializeLLSDXml(request);
OSDMap resp = new OSDMap();
OSDMap accessPrefs = new OSDMap();
accessPrefs["max"] = "A";
resp["access_prefs"] = accessPrefs;
httpResponse.RawBuffer = OSDParser.SerializeLLSDXmlBytes(resp);
httpResponse.StatusCode = (int)HttpStatusCode.OK;
}
public bool OSDMapTOVector3(OSDMap map, out Vector3 v)
{
v = Vector3.Zero;

View file

@ -158,11 +158,7 @@ namespace OpenSim.Region.ClientStack.Linden
m_features["MeshUploadEnabled"] = true;
m_features["MeshXferEnabled"] = true;
/*
m_features["MirrorsEnabled"] = false;
m_features["PBRMaterialSwatchEnabled"] = false;
m_features["PBRTerrainEnabled"] = false;
*/
m_features["MirrorsEnabled"] = true;
m_features["PhysicsMaterialsEnabled"] = true;
@ -196,7 +192,7 @@ namespace OpenSim.Region.ClientStack.Linden
new SimpleStreamHandler("/" + UUID.Random(),
delegate (IOSHttpRequest request, IOSHttpResponse response)
{
HandleSimulatorFeaturesRequest(request, response, agentID);
HandleSimulatorFeaturesRequest(request, response, caps);
}));
if (m_doScriptSyntax && !m_scriptSyntaxID.IsZero() && m_scriptSyntaxXML != null)
@ -276,7 +272,7 @@ namespace OpenSim.Region.ClientStack.Linden
return (OSDMap)copy;
}
private void HandleSimulatorFeaturesRequest(IOSHttpRequest request, IOSHttpResponse response, UUID agentID)
private void HandleSimulatorFeaturesRequest(IOSHttpRequest request, IOSHttpResponse response, Caps caps)
{
// m_log.DebugFormat("[SIMULATOR FEATURES MODULE]: SimulatorFeatures request");
@ -286,24 +282,20 @@ namespace OpenSim.Region.ClientStack.Linden
return;
}
/*
ScenePresence sp = m_scene.GetScenePresence(agentID);
if (sp == null)
{
response.StatusCode = (int)HttpStatusCode.ServiceUnavailable;
response.AddHeader("Retry-After", "5");
return;
}
*/
OSDMap copy = DeepCopy();
if ((caps.Flags & Caps.CapsFlags.TPBR) != 0)
{
copy["PBRMaterialSwatchEnabled"] = true;
copy["PBRTerrainEnabled"] = true;
}
// Let's add the agentID to the destination guide, if it is expecting that.
if(copy.TryGetValue("OpenSimExtras", out OSD oe))
{
if(((OSDMap)oe).TryGetValue("destination-guide-url", out OSD dgl))
{
((OSDMap)oe)["destination-guide-url"] = Replace(dgl.AsString(), "[USERID]", agentID.ToString());
((OSDMap)oe)["destination-guide-url"] = Replace(dgl.AsString(), "[USERID]", caps.AgentID.ToString());
}
}
@ -312,7 +304,7 @@ namespace OpenSim.Region.ClientStack.Linden
foreach(SimulatorFeaturesRequestDelegate sd in OnSimulatorFeaturesRequest.GetInvocationList())
try
{
sd?.Invoke(agentID, ref copy);
sd?.Invoke(caps.AgentID, ref copy);
}
catch { }
}

View file

@ -341,8 +341,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
private readonly Prioritizer m_prioritizer;
private bool m_disableFacelights;
// needs optimization
private HashSet<SceneObjectGroup> GroupsInView = new();
private HashSet<SceneObjectGroup> GroupsInView = [];
#pragma warning disable 0414
private bool m_VelocityInterpolate;
#pragma warning restore 0414
@ -350,6 +349,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
private bool m_SupportObjectAnimations;
private bool m_SupportPBR;
public bool SupportTerrainPBR { get; private set; }
public ViewerFlags ViewerFlags { get; private set; }
/// <value>
/// Maintain a record of all the objects killed. This allows us to stop an update being sent from the
@ -877,6 +878,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public void SendRegionHandshake()
{
GetViewerCaps(); // make sure this is up to date
RegionInfo regionInfo = m_scene.RegionInfo;
RegionSettings regionSettings = regionInfo.RegionSettings;
EstateSettings es = regionInfo.EstateSettings;
@ -915,14 +918,29 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// this seem now obsolete, sending zero uuids
// we should send the basic low resolution default ?
zc.AddZeros(16 * 4);
//TerrainDetail0
zc.AddUUID(regionSettings.TerrainTexture1);
//TerrainDetail1
zc.AddUUID(regionSettings.TerrainTexture2);
//TerrainDetail2
zc.AddUUID(regionSettings.TerrainTexture3);
//TerrainDetail3
zc.AddUUID(regionSettings.TerrainTexture4);
if(SupportTerrainPBR)
{
//TerrainDetail0
zc.AddUUID(regionSettings.TerrainPBR1);
//TerrainDetail1
zc.AddUUID(regionSettings.TerrainPBR2);
//TerrainDetail2
zc.AddUUID(regionSettings.TerrainPBR3);
//TerrainDetail3
zc.AddUUID(regionSettings.TerrainPBR4);
ViewerFlags |= ViewerFlags.SentTPBR;
}
else
{
//TerrainDetail0
zc.AddUUID(regionSettings.TerrainTexture1);
//TerrainDetail1
zc.AddUUID(regionSettings.TerrainTexture2);
//TerrainDetail2
zc.AddUUID(regionSettings.TerrainTexture3);
//TerrainDetail3
zc.AddUUID(regionSettings.TerrainTexture4);
}
//TerrainStartHeight00
zc.AddFloat((float)regionSettings.Elevation1SW);
//TerrainStartHeight01
@ -13435,21 +13453,30 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if(cap != null)
{
if((cap.Flags & Caps.CapsFlags.SentSeeds) != 0)
ret |= 0x1000;
ret |= (uint)ViewerFlags.SentSeeds;
if ((cap.Flags & Caps.CapsFlags.ObjectAnim) != 0)
{
m_SupportObjectAnimations = true;
ret |= 0x2000;
ret |= (uint)ViewerFlags.ObjectAnim;
}
if ((cap.Flags & Caps.CapsFlags.WLEnv) != 0)
ret |= 0x4000;
ret |= (uint)ViewerFlags.WLEnv;
if ((cap.Flags & Caps.CapsFlags.AdvEnv) != 0)
ret |= 0x8000;
ret |= (uint)ViewerFlags.AdvEnv;
if ((cap.Flags & Caps.CapsFlags.PBR) != 0)
{
ret |= (uint)ViewerFlags.PBR;
m_SupportPBR = true;
}
if ((cap.Flags & Caps.CapsFlags.TPBR) != 0)
{
ret |= (uint)ViewerFlags.TPBR;
SupportTerrainPBR = true;
}
}
}
ret |= (uint)(ViewerFlags & (ViewerFlags.SentTPBR));
ViewerFlags = (ViewerFlags)ret;
return ret;
}
}

View file

@ -349,7 +349,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
get { return m_dripRate; }
set
{
m_dripRate = OpenSim.Framework.Util.Clamp<float>(value, m_minimumFlow, MaxDripRate);
m_dripRate = Math.Clamp(value, m_minimumFlow, MaxDripRate);
if (m_parent != null)
m_parent.RegisterRequest(this, m_dripRate);

View file

@ -1164,6 +1164,12 @@ namespace OpenSim.Region.CoreModules.Asset
gatherer.AddGathered(s.RegionInfo.RegionSettings.TerrainTexture2, (sbyte)AssetType.Texture);
gatherer.AddGathered(s.RegionInfo.RegionSettings.TerrainTexture3, (sbyte)AssetType.Texture);
gatherer.AddGathered(s.RegionInfo.RegionSettings.TerrainTexture4, (sbyte)AssetType.Texture);
gatherer.AddGathered(s.RegionInfo.RegionSettings.TerrainPBR1, (sbyte)AssetType.Texture);
gatherer.AddGathered(s.RegionInfo.RegionSettings.TerrainPBR2, (sbyte)AssetType.Texture);
gatherer.AddGathered(s.RegionInfo.RegionSettings.TerrainPBR3, (sbyte)AssetType.Texture);
gatherer.AddGathered(s.RegionInfo.RegionSettings.TerrainPBR4, (sbyte)AssetType.Texture);
gatherer.AddGathered(s.RegionInfo.RegionSettings.TerrainImageID, (sbyte)AssetType.Texture);
s.RegionEnvironment?.GatherAssets(gatheredids);

View file

@ -1119,6 +1119,10 @@ namespace OpenSim.Region.CoreModules.World.Archiver
currentRegionSettings.TerrainTexture2 = loadedRegionSettings.TerrainTexture2;
currentRegionSettings.TerrainTexture3 = loadedRegionSettings.TerrainTexture3;
currentRegionSettings.TerrainTexture4 = loadedRegionSettings.TerrainTexture4;
currentRegionSettings.TerrainPBR1 = loadedRegionSettings.TerrainPBR1;
currentRegionSettings.TerrainPBR2 = loadedRegionSettings.TerrainPBR2;
currentRegionSettings.TerrainPBR3 = loadedRegionSettings.TerrainPBR3;
currentRegionSettings.TerrainPBR4 = loadedRegionSettings.TerrainPBR4;
currentRegionSettings.UseEstateSun = loadedRegionSettings.UseEstateSun;
currentRegionSettings.WaterHeight = loadedRegionSettings.WaterHeight;
currentRegionSettings.TelehubObject = loadedRegionSettings.TelehubObject;

View file

@ -320,7 +320,19 @@ namespace OpenSim.Region.CoreModules.World.Archiver
if (regionSettings.TerrainTexture4 != RegionSettings.DEFAULT_TERRAIN_TEXTURE_4)
assetUuids[regionSettings.TerrainTexture4] = (sbyte)AssetType.Texture;
if(scene.RegionEnvironment != null)
if (regionSettings.TerrainPBR1 != RegionSettings.DEFAULT_TERRAIN_PBR_1)
assetUuids[regionSettings.TerrainPBR1] = (sbyte)AssetType.Texture; // it can be both tex or material
if (regionSettings.TerrainPBR2 != RegionSettings.DEFAULT_TERRAIN_PBR_2)
assetUuids[regionSettings.TerrainPBR2] = (sbyte)AssetType.Texture;
if (regionSettings.TerrainPBR3 != RegionSettings.DEFAULT_TERRAIN_PBR_3)
assetUuids[regionSettings.TerrainPBR3] = (sbyte)AssetType.Texture;
if (regionSettings.TerrainPBR4 != RegionSettings.DEFAULT_TERRAIN_PBR_4)
assetUuids[regionSettings.TerrainPBR4] = (sbyte)AssetType.Texture;
if (scene.RegionEnvironment != null)
scene.RegionEnvironment.GatherAssets(assetUuids);
List<ILandObject> landObjects = scene.LandChannel.AllParcels();

View file

@ -152,7 +152,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
return;
}
//pass this in as degrees now, convert to radians later during actual work phase
rotation = Util.Clamp<float>(rotation, -359f, 359f);
rotation = Math.Clamp(rotation, -359f, 359f);
});
options.Add("rotation-center=", delegate(string v)
{

View file

@ -68,6 +68,13 @@ namespace OpenSim.Region.CoreModules.World.Estate
" that coordinate.",
consoleSetTerrainTexture);
m_module.Scene.AddCommand("Regions", m_module, "set terrain pbr",
"set terrain pbr <number> <uuid> [<x>] [<y>]",
"Sets the pbr <number> to <uuid>, if <x> or <y> are specified, it will only " +
"set it on regions with a matching coordinate. Specify -1 in <x> or <y> to wildcard" +
" that coordinate.",
consoleSetTerrainPBR);
m_module.Scene.AddCommand("Regions", m_module, "set terrain heights",
"set terrain heights <corner> <min> <max> [<x>] [<y>]",
"Sets the terrain texture heights on corner #<corner> to <min>/<max>, if <x> or <y> are specified, it will only " +
@ -127,6 +134,44 @@ namespace OpenSim.Region.CoreModules.World.Estate
}
}
}
protected void consoleSetTerrainPBR(string module, string[] args)
{
string num = args[3];
string uuid = args[4];
int x = (args.Length > 5 ? int.Parse(args[5]) : -1);
int y = (args.Length > 6 ? int.Parse(args[6]) : -1);
if (x == -1 || m_module.Scene.RegionInfo.RegionLocX == x)
{
if (y == -1 || m_module.Scene.RegionInfo.RegionLocY == y)
{
int corner = int.Parse(num);
UUID texture = UUID.Parse(uuid);
m_log.Debug($"[ESTATEMODULE]: Setting terrain PBR asset for {m_module.Scene.RegionInfo.RegionName} to {texture}");
switch (corner)
{
case 0:
m_module.Scene.RegionInfo.RegionSettings.TerrainPBR1 = texture;
break;
case 1:
m_module.Scene.RegionInfo.RegionSettings.TerrainPBR2 = texture;
break;
case 2:
m_module.Scene.RegionInfo.RegionSettings.TerrainPBR3 = texture;
break;
case 3:
m_module.Scene.RegionInfo.RegionSettings.TerrainPBR4 = texture;
break;
}
m_module.Scene.RegionInfo.RegionSettings.Save();
m_module.TriggerRegionInfoChange();
m_module.sendRegionHandshakeToAll();
}
}
}
protected void consoleSetWaterHeight(string module, string[] args)
{
string heightstring = args[3];

View file

@ -541,22 +541,45 @@ namespace OpenSim.Region.CoreModules.World.Estate
if (texture.IsZero())
return;
switch (level)
if((remoteClient.ViewerFlags & ViewerFlags.TPBR) != 0)
{
case 0:
Scene.RegionInfo.RegionSettings.TerrainTexture1 = texture;
break;
case 1:
Scene.RegionInfo.RegionSettings.TerrainTexture2 = texture;
break;
case 2:
Scene.RegionInfo.RegionSettings.TerrainTexture3 = texture;
break;
case 3:
Scene.RegionInfo.RegionSettings.TerrainTexture4 = texture;
break;
default:
return;
switch (level)
{
case 0:
Scene.RegionInfo.RegionSettings.TerrainPBR1 = texture;
break;
case 1:
Scene.RegionInfo.RegionSettings.TerrainPBR2 = texture;
break;
case 2:
Scene.RegionInfo.RegionSettings.TerrainPBR3 = texture;
break;
case 3:
Scene.RegionInfo.RegionSettings.TerrainPBR4 = texture;
break;
default:
return;
}
}
else
{
switch (level)
{
case 0:
Scene.RegionInfo.RegionSettings.TerrainTexture1 = texture;
break;
case 1:
Scene.RegionInfo.RegionSettings.TerrainTexture2 = texture;
break;
case 2:
Scene.RegionInfo.RegionSettings.TerrainTexture3 = texture;
break;
case 3:
Scene.RegionInfo.RegionSettings.TerrainTexture4 = texture;
break;
default:
return;
}
}
Scene.RegionInfo.RegionSettings.Save();

View file

@ -232,9 +232,9 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
detailTexture[t].UnlockBits(bmdata);
detailTexture[t].Dispose();
mapColorsRed[t] = (byte)Util.Clamp(cR / npixeis, 0 , 255);
mapColorsGreen[t] = (byte)Util.Clamp(cG / npixeis, 0 , 255);
mapColorsBlue[t] = (byte)Util.Clamp(cB / npixeis, 0 , 255);
mapColorsRed[t] = (byte)Math.Clamp(cR / npixeis, 0 , 255);
mapColorsGreen[t] = (byte)Math.Clamp(cG / npixeis, 0 , 255);
mapColorsBlue[t] = (byte)Math.Clamp(cB / npixeis, 0 , 255);
}
}
else

View file

@ -866,6 +866,18 @@ namespace OpenSim.Region.Framework.Scenes
updatedTerrainTextures = true;
}
if (rs.TerrainPBR1.IsZero() &&
rs.TerrainPBR2.IsZero() &&
rs.TerrainPBR3.IsZero() &&
rs.TerrainPBR4.IsZero())
{
rs.TerrainPBR1 = rs.TerrainTexture1;
rs.TerrainPBR2 = rs.TerrainTexture2;
rs.TerrainPBR3 = rs.TerrainTexture3;
rs.TerrainPBR4 = rs.TerrainTexture4;
updatedTerrainTextures = true;
}
if (updatedTerrainTextures)
rs.Save();
@ -1885,7 +1897,7 @@ namespace OpenSim.Region.Framework.Scenes
nowMS = Util.GetTimeStampMS();
sleepMS = (float)(nowMS - lastMS);
sleepError = sleepMS - frameMS;
Util.Clamp(sleepError, 0.0f, 20f);
sleepError = Math.Clamp(sleepError, 0.0f, 20f);
frameMS = (float)(nowMS - framestart);
}
else

View file

@ -3998,7 +3998,7 @@ namespace OpenSim.Region.Framework.Scenes
return;
uint flags = ControllingClient.GetViewerCaps();
if ((flags & 0x1000) == 0) // wait for seeds sending
if ((flags & (uint)ViewerFlags.SentSeeds) == 0) // wait for seeds sending
return;
// give some extra time to make sure viewers did process seeds
@ -4058,6 +4058,10 @@ namespace OpenSim.Region.Framework.Scenes
m_agentTransfer?.CloseOldChildAgents(this);
}
uint flags = ControllingClient.GetViewerCaps();
if ((flags & (uint)(ViewerFlags.TPBR | ViewerFlags.SentTPBR)) == (uint)ViewerFlags.TPBR)
ControllingClient.SendRegionHandshake();
m_log.DebugFormat("[SCENE PRESENCE({0})]: SendInitialData for {1}", m_scene.RegionInfo.RegionName, UUID);
if (m_teleportFlags <= 0)
{

View file

@ -57,6 +57,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
private UUID m_agentID = UUID.Random();
public ISceneAgent SceneAgent { get; set; }
public ViewerFlags ViewerFlags { get; private set; } = 0;
public int PingTimeMS { get { return 0; } }

View file

@ -57,6 +57,8 @@ namespace OpenSim.Region.OptionalModules.World.NPC
/// </summary>
public event ChatToNPC OnChatToNPC;
public ViewerFlags ViewerFlags { get; private set; }
/// <summary>
/// Fired when the NPC receives an instant message.
/// </summary>

View file

@ -408,7 +408,7 @@ namespace OpenSim.Region.PhysicsModule.BulletS
get { return base.Efficiency; }
set
{
base.Efficiency = Util.Clamp(value, 0f, 1f);
base.Efficiency = Math.Clamp(value, 0f, 1f);
// Compute factors based on efficiency.
// If efficiency is high (1f), use a factor value that moves the error value to zero with little overshoot.

View file

@ -1606,7 +1606,7 @@ namespace OpenSim.Region.PhysicsModule.BulletS
returnMass = Density * BSParam.DensityScaleFactor * volume;
returnMass = Util.Clamp(returnMass, BSParam.MinimumObjectMass, BSParam.MaximumObjectMass);
returnMass = Math.Clamp(returnMass, BSParam.MinimumObjectMass, BSParam.MaximumObjectMass);
// DetailLog("{0},BSPrim.CalculateMass,den={1},vol={2},mass={3}", LocalID, Density, volume, returnMass);
DetailLog("{0},BSPrim.CalculateMass,den={1},vol={2},mass={3},pathB={4},pathE={5},profB={6},profE={7},siz={8}",
LocalID, Density, volume, returnMass, pathBegin, pathEnd, profileBegin, profileEnd, _size);

View file

@ -363,8 +363,8 @@ namespace OpenSim.Region.PhysicsModule.BulletS
// First, base addresses are never negative so correct for that possible problem.
if (ret.X < 0f || ret.Y < 0f)
{
ret.X = Util.Clamp<float>(ret.X, 0f, 1000000f);
ret.Y = Util.Clamp<float>(ret.Y, 0f, 1000000f);
ret.X = Math.Clamp(ret.X, 0f, 1000000f);
ret.Y = Math.Clamp(ret.Y, 0f, 1000000f);
DetailLog("{0},BSTerrainManager.ClampPositionToKnownTerrain,zeroingNegXorY,oldPos={1},newPos={2}",
BSScene.DetailLogZero, pPos, ret);
}
@ -510,8 +510,8 @@ namespace OpenSim.Region.PhysicsModule.BulletS
return ret;
// Just some sanity
ret.X = Util.Clamp<float>(ret.X, 0f, 1000000f);
ret.Y = Util.Clamp<float>(ret.Y, 0f, 1000000f);
ret.X = Math.Clamp(ret.X, 0f, 1000000f);
ret.Y = Math.Clamp(ret.Y, 0f, 1000000f);
ret.Z = 0f;
lock (m_terrains)

View file

@ -2071,7 +2071,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return GetColor(m_host, face);
}
protected static LSL_Vector GetColor(SceneObjectPart part, int face)
public LSL_Vector GetColor(SceneObjectPart part, int face)
{
Primitive.TextureEntry tex = part.Shape.Textures;
Color4 texcolor;
@ -4654,24 +4654,33 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Key llRequestAgentData(string id, int data)
{
if(data < 1 || data > ScriptBaseClass.DATA_PAYINFO)
return string.Empty;
if (UUID.TryParse(id, out UUID uuid) && uuid.IsNotZero())
{
//pre process fast local avatars
switch(data)
{
case ScriptBaseClass.DATA_RATING:
case ScriptBaseClass.DATA_NAME: // DATA_NAME (First Last)
case ScriptBaseClass.DATA_ONLINE:
World.TryGetScenePresence(uuid, out ScenePresence sp);
if (sp != null)
{
string reply = data switch
{
ScriptBaseClass.DATA_RATING => "0,0,0,0,0,0",
ScriptBaseClass.DATA_NAME => sp.Firstname + " " + sp.Lastname,
_ => "1"
};
string ftid = m_AsyncCommands.DataserverPlugin.RequestWithImediatePost(m_host.LocalId,
m_item.ItemID, "1");
m_item.ItemID, reply);
ScriptSleep(m_sleepMsOnRequestAgentData);
return ftid;
}
break;
case ScriptBaseClass.DATA_NAME: // DATA_NAME (First Last)
case ScriptBaseClass.DATA_BORN: // DATA_BORN (YYYY-MM-DD)
case ScriptBaseClass.DATA_RATING: // DATA_RATING (0,0,0,0,0,0)
case 7: // DATA_USERLEVEL (integer). This is not available in LL and so has no constant.
case ScriptBaseClass.DATA_PAYINFO: // DATA_PAYINFO (0|1|2|3)
break;
@ -4681,24 +4690,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
void act(string eventID)
{
UserAccount account = null;
string reply;
IUserManagement umm = World.RequestModuleInterface<IUserManagement>();
if(umm == null)
return;
if (data == ScriptBaseClass.DATA_ONLINE)
{
World.TryGetScenePresence(uuid, out ScenePresence sp);
if(sp != null)
reply = "1";
else
{
account = m_userAccountService.GetUserAccount(RegionScopeID, uuid);
if (account == null)
reply = "0";
else
UserData udt = umm.GetUserData(uuid);
if (udt == null || udt.IsUnknownUser)
return;
string reply = null;
switch(data)
{
case ScriptBaseClass.DATA_ONLINE:
if (!m_PresenceInfoCache.TryGetValue(uuid, out PresenceInfo pinfo))
{
PresenceInfo[] pinfos = World.PresenceService.GetAgents(new string[] { uuid.ToString() });
PresenceInfo[] pinfos = World.PresenceService.GetAgents([uuid.ToString()]);
if (pinfos != null && pinfos.Length > 0)
{
foreach (PresenceInfo p in pinfos)
@ -4712,31 +4718,39 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_PresenceInfoCache.AddOrUpdate(uuid, pinfo, m_llRequestAgentDataCacheTimeout);
}
reply = pinfo == null ? "0" : "1";
}
}
}
else
break;
case ScriptBaseClass.DATA_NAME:
reply = udt.FirstName + " " + udt.LastName;
break;
case ScriptBaseClass.DATA_RATING:
reply = "0,0,0,0,0,0";
break;
case 7:
case ScriptBaseClass.DATA_BORN:
case ScriptBaseClass.DATA_PAYINFO:
if (udt.IsLocal)
{
UserAccount account = m_userAccountService.GetUserAccount(RegionScopeID, uuid);
if (account is not null)
{
account ??= m_userAccountService.GetUserAccount(RegionScopeID, uuid);
if (account is null)
reply = "0";
else
reply = data switch
{
// DATA_NAME (First Last)
ScriptBaseClass.DATA_NAME => account.FirstName + " " + account.LastName,
// DATA_BORN (YYYY-MM-DD)
ScriptBaseClass.DATA_BORN => Util.ToDateTime(account.Created).ToString("yyyy-MM-dd"),
// DATA_RATING (0,0,0,0,0,0)
ScriptBaseClass.DATA_RATING => "0,0,0,0,0,0",
// DATA_USERLEVEL (integer). This is not available in LL and so has no constant.
7 => account.UserLevel.ToString(),
// DATA_PAYINFO (0|1|2|3)
ScriptBaseClass.DATA_PAYINFO => "0",
_ => "0",// Raise no event
ScriptBaseClass.DATA_BORN => Util.ToDateTime(account.Created).ToString("yyyy-MM-dd"),
_ => ((account.UserFlags >> 2) & 0x03).ToString()
};
}
}
else
{
if (data == 7)
reply = "0";
}
break;
default:
break;
}
if(reply != null)
m_AsyncCommands.DataserverPlugin.DataserverReply(eventID, reply);
}
@ -6235,8 +6249,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
float rsy = World.RegionInfo.RegionSizeY;
// can understand what sl does if position is not in region, so do something :)
float px = (float)Util.Clamp(pos.x, 0.5, rsx - 0.5);
float py = (float)Util.Clamp(pos.y, 0.5, rsy - 0.5);
float px = Math.Clamp((float)pos.x, 0.5f, rsx - 0.5f);
float py = Math.Clamp((float)pos.y, 0.5f, rsy - 0.5f);
float ex, ey;
@ -7786,17 +7800,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llSetCameraEyeOffset(LSL_Vector offset)
{
m_host.SetCameraEyeOffset(offset);
if (m_host.ParentGroup.RootPart.GetCameraEyeOffset().IsZero())
m_host.ParentGroup.RootPart.SetCameraEyeOffset(offset);
}
public void llSetCameraAtOffset(LSL_Vector offset)
{
m_host.SetCameraAtOffset(offset);
if (m_host.ParentGroup.RootPart.GetCameraAtOffset().IsZero())
m_host.ParentGroup.RootPart.SetCameraAtOffset(offset);
}
public void llSetLinkCamera(LSL_Integer link, LSL_Vector eye, LSL_Vector at)
@ -10245,10 +10253,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return new LSL_List();
}
float repeatX = (float)Util.Clamp(mnrepeat.x,-100.0, 100.0);
float repeatY = (float)Util.Clamp(mnrepeat.y,-100.0, 100.0);
float offsetX = (float)Util.Clamp(mnoffset.x, 0, 1.0);
float offsetY = (float)Util.Clamp(mnoffset.y, 0, 1.0);
float repeatX = Math.Clamp((float)mnrepeat.x,-100.0f, 100.0f);
float repeatY = Math.Clamp((float)mnrepeat.y,-100.0f, 100.0f);
float offsetX = Math.Clamp((float)mnoffset.x, 0f, 1.0f);
float offsetY = Math.Clamp((float)mnoffset.y, 0f, 1.0f);
materialChanged |= SetMaterialNormalMap(part, face, mapID, repeatX, repeatY, offsetX, offsetY, mnrot);
break;
@ -10347,15 +10355,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return new LSL_List();
}
float srepeatX = (float)Util.Clamp(msrepeat.x, -100.0, 100.0);
float srepeatY = (float)Util.Clamp(msrepeat.y, -100.0, 100.0);
float soffsetX = (float)Util.Clamp(msoffset.x, -1.0, 1.0);
float soffsetY = (float)Util.Clamp(msoffset.y, -1.0, 1.0);
byte colorR = (byte)(255.0 * Util.Clamp(mscolor.x, 0, 1.0) + 0.5);
byte colorG = (byte)(255.0 * Util.Clamp(mscolor.y, 0, 1.0) + 0.5);
byte colorB = (byte)(255.0 * Util.Clamp(mscolor.z, 0, 1.0) + 0.5);
byte gloss = (byte)Util.Clamp((int)msgloss, 0, 255);
byte env = (byte)Util.Clamp((int)msenv, 0, 255);
float srepeatX = Math.Clamp((float)msrepeat.x, -100.0f, 100.0f);
float srepeatY = Math.Clamp((float)msrepeat.y, -100.0f, 100.0f);
float soffsetX = Math.Clamp((float)msoffset.x, -1.0f, 1.0f);
float soffsetY = Math.Clamp((float)msoffset.y, -1.0f, 1.0f);
byte colorR = (byte)(255.0f * Math.Clamp((float)mscolor.x, 0f, 1.0f) + 0.5f);
byte colorG = (byte)(255.0f * Math.Clamp((float)mscolor.y, 0f, 1.0f) + 0.5f);
byte colorB = (byte)(255.0f * Math.Clamp((float)mscolor.z, 0f, 1.0f) + 0.5f);
byte gloss = (byte)Math.Clamp((int)msgloss, 0, 255);
byte env = (byte)Math.Clamp((int)msenv, 0, 255);
materialChanged |= SetMaterialSpecMap(part, face, smapID, srepeatX, srepeatY, soffsetX, soffsetY,
msrot, colorR, colorG, colorB, gloss, env);
@ -10424,9 +10432,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
part.Shape.ProjectionEntry = true;
part.Shape.ProjectionTextureUUID = stexID;
part.Shape.ProjectionFOV = Util.Clamp(fov, 0, 3.0f);
part.Shape.ProjectionFocus = Util.Clamp(focus, -20.0f, 20.0f);
part.Shape.ProjectionAmbiance = Util.Clamp(amb, 0, 1.0f);
part.Shape.ProjectionFOV = Math.Clamp(fov, 0, 3.0f);
part.Shape.ProjectionFocus = Math.Clamp(focus, -20.0f, 20.0f);
part.Shape.ProjectionAmbiance = Math.Clamp(amb, 0, 1.0f);
part.ParentGroup.HasGroupChanged = true;
part.ScheduleFullUpdate();
@ -16584,32 +16592,32 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
int yInt = (int)yPos;
// Corner 1 of 1x1 rectangle
int x = Util.Clamp<int>(xInt+1, 0, World.Heightmap.Width - 1);
int y = Util.Clamp<int>(yInt+1, 0, World.Heightmap.Height - 1);
int x = Math.Clamp(xInt+1, 0, World.Heightmap.Width - 1);
int y = Math.Clamp(yInt+1, 0, World.Heightmap.Height - 1);
Vector3 pos1 = new(x, y, (float)World.Heightmap[x, y]);
// Adjust bounding box
zLower = Math.Min(zLower, pos1.Z);
zUpper = Math.Max(zUpper, pos1.Z);
// Corner 2 of 1x1 rectangle
x = Util.Clamp<int>(xInt, 0, World.Heightmap.Width - 1);
y = Util.Clamp<int>(yInt+1, 0, World.Heightmap.Height - 1);
x = Math.Clamp(xInt, 0, World.Heightmap.Width - 1);
y = Math.Clamp(yInt+1, 0, World.Heightmap.Height - 1);
Vector3 pos2 = new(x, y, (float)World.Heightmap[x, y]);
// Adjust bounding box
zLower = Math.Min(zLower, pos2.Z);
zUpper = Math.Max(zUpper, pos2.Z);
// Corner 3 of 1x1 rectangle
x = Util.Clamp<int>(xInt, 0, World.Heightmap.Width - 1);
y = Util.Clamp<int>(yInt, 0, World.Heightmap.Height - 1);
x = Math.Clamp(xInt, 0, World.Heightmap.Width - 1);
y = Math.Clamp(yInt, 0, World.Heightmap.Height - 1);
Vector3 pos3 = new(x, y, (float)World.Heightmap[x, y]);
// Adjust bounding box
zLower = Math.Min(zLower, pos3.Z);
zUpper = Math.Max(zUpper, pos3.Z);
// Corner 4 of 1x1 rectangle
x = Util.Clamp<int>(xInt+1, 0, World.Heightmap.Width - 1);
y = Util.Clamp<int>(yInt, 0, World.Heightmap.Height - 1);
x = Math.Clamp(xInt+1, 0, World.Heightmap.Width - 1);
y = Math.Clamp(yInt, 0, World.Heightmap.Height - 1);
Vector3 pos4 = new(x, y, (float)World.Heightmap[x, y]);
// Adjust bounding box
zLower = Math.Min(zLower, pos4.Z);

View file

@ -3968,9 +3968,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
obj.Shape.ProjectionEntry = true;
obj.Shape.ProjectionTextureUUID = texID;
obj.Shape.ProjectionFOV = Util.Clamp((float)fov, 0, 3.0f);
obj.Shape.ProjectionFocus = Util.Clamp((float)focus, -20.0f, 20.0f);
obj.Shape.ProjectionAmbiance = Util.Clamp((float)amb, 0, 1.0f);
obj.Shape.ProjectionFOV = Math.Clamp((float)fov, 0, 3.0f);
obj.Shape.ProjectionFocus = Math.Clamp((float)focus, -20.0f, 20.0f);
obj.Shape.ProjectionAmbiance = Math.Clamp((float)amb, 0, 1.0f);
obj.ParentGroup.HasGroupChanged = true;
obj.ScheduleFullUpdate();
@ -6571,5 +6571,58 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
return ret.ToString();
}
public LSL_Vector osGetLinkColor(LSL_Integer link, LSL_Integer face)
{
SceneObjectPart linkedPart = link.value switch
{
ScriptBaseClass.LINK_ROOT => m_host.ParentGroup.RootPart,
ScriptBaseClass.LINK_THIS => m_host,
_ => m_host.ParentGroup.GetLinkNumPart(link.value)
};
if (linkedPart != null)
{
InitLSL();
return m_LSL_Api.GetColor(linkedPart, face.value);
}
return LSL_Vector.Zero;
}
public LSL_Vector osTemperature2sRGB(LSL_Float dtemp)
{
//aproximate fit to http://www.vendian.org/mncharity/dir3/blackbody/ 10degree D65 tables
float temp = (float)dtemp.value;
if (temp <= 1000f)
return new LSL_Vector(1.0, 0.0401, 0);
else if (temp >= 40000f)
return new LSL_Vector(0.3277, 0.5022, 1.0);
float green;
if (temp < 6600f)
{
green = temp - 1000f;
green = ((((-7.87308e-13f * green) - 7.10085e-9f) * green) + 0.00022693f) * green + 0.0374249f;
green = Math.Clamp(green, 0, 1.0f);
if (temp <= 19.0f)
return new LSL_Vector(1.0, green, 0);
float blue = temp - 1900f;
blue = ((((-5.97E-12f * blue) + 5.49E-08f) * blue) + 8.85465E-05f) * blue - 0.0058959f;
blue = Math.Clamp(blue, 0f, 1.0f);
return new LSL_Vector(1.0, green, blue);
}
temp = 0.01f * (temp - 6000f);
float red = 1.897315f * MathF.Pow(temp, -0.346837f) + 0.0622044f;
red = Math.Clamp(red, 0, 1.0f);
green = 1.261989f * MathF.Pow(temp, -0.251708f) + 0.200836f;
green = Math.Clamp(green, 0, 1.0f);
return new LSL_Vector(red, green, 1.0f);
}
}
}

View file

@ -626,5 +626,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
LSL_String osAESEncryptTo(string secret, string plainText, string ivString);
LSL_String osAESDecrypt(string secret, string encryptedText);
LSL_String osAESDecryptFrom(string secret, string encryptedText, string ivString);
vector osGetLinkColor(LSL_Integer linknum, LSL_Integer face);
vector osTemperature2sRGB(LSL_Float dtemp);
}
}

View file

@ -1802,5 +1802,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
return m_OSSL_Functions.osAESDecryptFrom(secret, encryptedText, ivString);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public vector osGetLinkColor(LSL_Integer link, LSL_Integer face)
{
return m_OSSL_Functions.osGetLinkColor(link, face);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public vector osTemperature2sRBG(LSL_Float dtemp)
{
return m_OSSL_Functions.osTemperature2sRGB(dtemp);
}
}
}

View file

@ -731,8 +731,8 @@ namespace OpenSim.Services.LLLoginService
else
{
position = pinfo.LastPosition;
position.X = Util.Clamp(position.X, 0.5f, region.RegionSizeX - 0.5f);
position.Y = Util.Clamp(position.Y, 0.5f, region.RegionSizeY - 0.5f);
position.X = Math.Clamp(position.X, 0.5f, region.RegionSizeX - 0.5f);
position.Y = Math.Clamp(position.Y, 0.5f, region.RegionSizeY - 0.5f);
lookAt = pinfo.LastLookAt;
}