diff --git a/OpenSim/Framework/Constants.cs b/OpenSim/Framework/Constants.cs
index 5dbd0bd9ac..63f7edf231 100644
--- a/OpenSim/Framework/Constants.cs
+++ b/OpenSim/Framework/Constants.cs
@@ -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);
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs
index 965e68eacc..11915a4318 100755
--- a/OpenSim/Framework/IClientAPI.cs
+++ b/OpenSim/Framework/IClientAPI.cs
@@ -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,
+ }
+
///
/// 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 GetGroupPowers();
void SetGroupPowers(Dictionary powers);
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
index 3ce2acf182..c0b709104b 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
@@ -357,10 +357,14 @@ namespace OpenSim.Region.ClientStack.Linden
if (m_Scene.RegionInfo.RegionSizeX == Constants.RegionSize &&
m_Scene.RegionInfo.RegionSizeY == Constants.RegionSize &&
m_Scene.RegionInfo.RegionSizeZ == Constants.RegionSize)
- m_HostCapsObj.Flags |= Caps.CapsFlags.TPBR;
+ {
+ m_HostCapsObj.Flags |= Caps.CapsFlags.PBR | Caps.CapsFlags.TPBR;
+ }
+ else
+ m_HostCapsObj.Flags |= Caps.CapsFlags.PBR;
continue;
case "VETPBR":
- m_HostCapsObj.Flags |= Caps.CapsFlags.TPBR;
+ m_HostCapsObj.Flags |= Caps.CapsFlags.PBR | Caps.CapsFlags.TPBR;
continue;
case "ObjectAnimation":
m_HostCapsObj.Flags |= Caps.CapsFlags.ObjectAnim;
@@ -379,7 +383,7 @@ namespace OpenSim.Region.ClientStack.Linden
}
validCaps.Add(cstr);
}
-
+
osUTF8 sb = LLSDxmlEncode2.Start();
LLSDxmlEncode2.AddMap(sb);
m_HostCapsObj.GetCapsDetailsLLSDxml(validCaps, sb);
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs
index 65c2479863..cadfb4e9ff 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs
@@ -158,12 +158,6 @@ 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["PhysicsMaterialsEnabled"] = true;
m_features["PhysicsShapeTypes"] = new OSDMap()
@@ -196,7 +190,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 +270,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 +280,21 @@ 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;
+ copy["MirrorsEnabled"] = 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 +303,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 { }
}
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index ca88013fc3..b55e02f4d5 100755
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -341,8 +341,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
private readonly Prioritizer m_prioritizer;
private bool m_disableFacelights;
- // needs optimization
- private HashSet GroupsInView = new();
+ private HashSet 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; }
///
/// 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,29 @@ 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;
+ }
}
}
-
+ ViewerFlags = (ViewerFlags)ret;
return ret;
}
}
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementCommands.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementCommands.cs
index 7879f83e97..b9723e8c4b 100644
--- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementCommands.cs
+++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementCommands.cs
@@ -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 [] []",
+ "Sets the pbr to , if or are specified, it will only " +
+ "set it on regions with a matching coordinate. Specify -1 in or to wildcard" +
+ " that coordinate.",
+ consoleSetTerrainPBR);
+
m_module.Scene.AddCommand("Regions", m_module, "set terrain heights",
"set terrain heights [] []",
"Sets the terrain texture heights on corner # to /, if or 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];
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
index 9a07d7f84b..55c5bf2781 100644
--- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
@@ -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();
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 416e6babef..804c58900b 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -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.SentSeeds)) == (uint)ViewerFlags.TPBR)
+ ControllingClient.SendRegionHandshake();
+
m_log.DebugFormat("[SCENE PRESENCE({0})]: SendInitialData for {1}", m_scene.RegionInfo.RegionName, UUID);
if (m_teleportFlags <= 0)
{
diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
index dcb366e233..8db57eb7d3 100755
--- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
+++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
@@ -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; } }
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
index 53cf030585..b83e369652 100755
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
@@ -57,6 +57,8 @@ namespace OpenSim.Region.OptionalModules.World.NPC
///
public event ChatToNPC OnChatToNPC;
+ public ViewerFlags ViewerFlags { get; private set; }
+
///
/// Fired when the NPC receives an instant message.
///
diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs
index 297c86eee4..a8758f478e 100755
--- a/OpenSim/Services/LLLoginService/LLLoginService.cs
+++ b/OpenSim/Services/LLLoginService/LLLoginService.cs
@@ -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;
}