a few more changes for hypothetical terrain PBR

This commit is contained in:
UbitUmarov
2024-06-10 21:02:31 +01:00
parent 183350b617
commit 65738b3766
11 changed files with 167 additions and 57 deletions

View File

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

View File

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

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,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;
}
}