From 2f6c78b88895c0934179fb8eb70ae1dc08883d5f Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Tue, 25 Apr 2017 04:58:24 +0100
Subject: finish encoding number of mesh faces in pbs shape on new meshs
upload, and *HACK* flag it setting hollow shape to triangle. (some limited
encoding as added some months ago, but only for viewers LOD). Use this hack
flag to fix sop number of faces. old meshs will still report 8 faces,
information to fix this seems lost unless the mesh asset is decoded
---
.../Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 25 ++++++++++++++++------
.../Region/ClientStack/Linden/UDP/LLClientView.cs | 25 +++++++---------------
OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 24 ++++++++++++---------
3 files changed, 41 insertions(+), 33 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
index 58b7b00..46932b1 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
@@ -1006,28 +1006,41 @@ namespace OpenSim.Region.ClientStack.Linden
}
}
- // faces number to pbs shape
- switch(face_list.Count)
+ // faces number to pbs shape for viewers LOD
+ // now extended to full faces equivalent
+ int nfaces = face_list.Count;
+ switch(nfaces)
{
case 1:
case 2:
- pbs.ProfileCurve = (byte)ProfileCurve.Circle;
+ pbs.ProfileCurve = (byte)ProfileCurve.Circle | (byte)HollowShape.Triangle;
pbs.PathCurve = (byte)PathCurve.Circle;
+ if(nfaces == 2)
+ pbs.ProfileHollow = 1;
break;
case 3:
case 4:
- pbs.ProfileCurve = (byte)ProfileCurve.Circle;
+ pbs.ProfileCurve = (byte)ProfileCurve.Circle | (byte)HollowShape.Triangle;
pbs.PathCurve = (byte)PathCurve.Line;
+ if(nfaces == 4)
+ pbs.ProfileHollow = 1;
break;
+
case 5:
- pbs.ProfileCurve = (byte)ProfileCurve.EqualTriangle;
+ pbs.ProfileCurve = (byte)ProfileCurve.EqualTriangle | (byte)HollowShape.Triangle;
pbs.PathCurve = (byte)PathCurve.Line;
break;
default:
- pbs.ProfileCurve = (byte)ProfileCurve.Square;
+ // hack to flag that pbs does represent number of faces
+ //meshs where never uploaded with this
+ pbs.ProfileCurve = (byte)ProfileCurve.Square | (byte)HollowShape.Triangle;
pbs.PathCurve = (byte)PathCurve.Line;
+ if(nfaces == 7)
+ pbs.ProfileHollow = 1;
+ else if(nfaces == 8)
+ pbs.ProfileBegin = 1;
break;
}
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index dc8d267..cf96a8b 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -4212,12 +4212,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
SceneObjectGroup grp = part.ParentGroup;
if (grp.inTransit && !update.Flags.HasFlag(PrimUpdateFlags.SendInTransit))
continue;
+/* debug
if (update.Flags.HasFlag(PrimUpdateFlags.SendInTransit))
{
}
-
+*/
if (grp.IsDeleted)
{
// Don't send updates for objects that have been marked deleted.
@@ -4274,14 +4275,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{
part.Shape.LightEntry = false;
}
-
- if (part.Shape != null && (part.Shape.SculptType == (byte)SculptType.Mesh))
- {
- // Ensure that mesh has at least 8 valid faces
- part.Shape.ProfileBegin = 12500;
- part.Shape.ProfileEnd = 0;
- part.Shape.ProfileHollow = 27500;
- }
}
if(doCulling && !grp.IsAttachment)
@@ -4309,14 +4302,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
continue;
}
}
-
- if (part.Shape != null && (part.Shape.SculptType == (byte)SculptType.Mesh))
- {
- // Ensure that mesh has at least 8 valid faces
- part.Shape.ProfileBegin = 12500;
- part.Shape.ProfileEnd = 0;
- part.Shape.ProfileHollow = 27500;
- }
}
else if (update.Entity is ScenePresence)
{
@@ -5877,6 +5862,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
update.PCode = part.Shape.PCode;
update.ProfileBegin = part.Shape.ProfileBegin;
update.ProfileCurve = part.Shape.ProfileCurve;
+
+ if(part.Shape.SculptType == (byte)SculptType.Mesh) // filter out hack
+ update.ProfileCurve = (byte)(part.Shape.ProfileCurve & 0x0f);
+ else
+ update.ProfileCurve = part.Shape.ProfileCurve;
+
update.ProfileEnd = part.Shape.ProfileEnd;
update.ProfileHollow = part.Shape.ProfileHollow;
update.PSBlock = part.ParticleSystem ?? Utils.EmptyBytes;
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index affd4de..19bf53f 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -3728,7 +3728,18 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
bool hasDimple;
bool hasProfileCut;
- PrimType primType = GetPrimType();
+ if(Shape.SculptEntry)
+ {
+ if (Shape.SculptType != (byte)SculptType.Mesh)
+ return 1; // sculp
+
+ //hack to detect new upload with faces data enconded on pbs
+ if ((Shape.ProfileCurve & 0xf0) != (byte)HollowShape.Triangle)
+ // old broken upload TODO
+ return 8;
+ }
+
+ PrimType primType = GetPrimType(true);
HasCutHollowDimpleProfileCut(primType, Shape, out hasCut, out hasHollow, out hasDimple, out hasProfileCut);
switch (primType)
@@ -3772,13 +3783,6 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
if (hasProfileCut) ret += 2;
if (hasHollow) ret += 1;
break;
- case PrimType.SCULPT:
- // Special mesh handling
- if (Shape.SculptType == (byte)SculptType.Mesh)
- ret = 8; // if it's a mesh then max 8 faces
- else
- ret = 1; // if it's a sculpt then max 1 face
- break;
}
return ret;
@@ -3789,9 +3793,9 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
///
///
///
- public PrimType GetPrimType()
+ public PrimType GetPrimType(bool ignoreSculpt = false)
{
- if (Shape.SculptEntry)
+ if (Shape.SculptEntry && !ignoreSculpt)
return PrimType.SCULPT;
if ((Shape.ProfileCurve & 0x07) == (byte)ProfileShape.Square)
--
cgit v1.1