do not auto set reflection_probe_ambiance on old skies, so a viewer can decide to fix for pbr (ofc seems tha currently they just set it 0 and do nothing showing broke skies in same cases); a few changes on notecards uuid detection

This commit is contained in:
UbitUmarov
2024-01-10 13:30:14 +00:00
parent 75952d9bea
commit f21aca428f
6 changed files with 86 additions and 39 deletions

View File

@@ -615,8 +615,8 @@ namespace OpenSim.Framework
if(indx > 0)
{
indx += 14;
List<UUID> textIDs = Util.GetUUIDsOnString(ref note, indx, note.Length - indx);
if(textIDs.Count > 0)
List<UUID> textIDs = Util.GetUUIDsOnString(note.AsSpan(indx, note.Length - indx));
if (textIDs.Count > 0)
ids.AddRange(textIDs);
}
if (ids.Count == 0)

View File

@@ -928,7 +928,7 @@ namespace OpenSim.Framework
if (indx != next)
continue;
if (UUID.TryParse(s.Substring(idbase, 36), out UUID u))
if (UUID.TryParse(s.AsSpan(idbase, 36), out UUID u))
{
ids.Add(u);
}
@@ -937,7 +937,33 @@ namespace OpenSim.Framework
return ids;
}
public static List<UUID> GetUUIDsOnString(ReadOnlySpan<char> s)
{
var ids = new List<UUID>();
if (s.Length < 36)
return ids;
int indx = 8;
while (indx < s.Length - 28)
{
if (s[indx] == '-')
{
if (UUID.TryParse(s.Slice(indx - 8, 36), out UUID id))
{
if (id.IsNotZero())
ids.Add(id);
indx += 37;
}
else
indx += 9;
}
else
indx++;
}
return ids;
}
/*
[MethodImpl(MethodImplOptions.AggressiveInlining)]
static bool IsHexa(byte c)
{
@@ -1061,6 +1087,7 @@ namespace OpenSim.Framework
return ids;
}
*/
/// <summary>
/// Is the platform Windows?

View File

@@ -158,6 +158,8 @@ namespace OpenSim.Framework
public float dome_radius = 15000f;
public float droplet_radius = 800.0f;
public float ice_level = 0f;
public bool HasRefProbe = false;
public float reflectionProbeAmbiance = 0f;
public float moisture_level = 0;
@@ -222,8 +224,6 @@ namespace OpenSim.Framework
sunlight_color = map["sunlight_color"];
reflectionProbeAmbiance = 0f;
ViewerEnvironment.convertFromAngles(this, map["sun_angle"], map["east_angle"]);
Name = name;
}
@@ -318,7 +318,8 @@ namespace OpenSim.Framework
["type"] = "sky"
};
map["reflection_probe_ambiance"] = reflectionProbeAmbiance;
if(HasRefProbe)
map["reflection_probe_ambiance"] = reflectionProbeAmbiance;
return map;
}
@@ -369,7 +370,10 @@ namespace OpenSim.Framework
ice_level = otmp;
if (map.TryGetValue("reflection_probe_ambiance", out otmp))
{
reflectionProbeAmbiance = otmp;
HasRefProbe = true;
}
if (map.TryGetValue("legacy_haze", out OSD tmp) && tmp is OSDMap lHaze)
{