From 4e7cddc6a8a764a76b270dbb7aeb3a16e2bff56c Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 7 Mar 2019 17:11:52 +0000 Subject: [PATCH] vegetation is special --- .../ClientStack/Linden/UDP/LLClientView.cs | 99 +++++++++++++------ 1 file changed, 71 insertions(+), 28 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 171f8c61cc..f984009f5b 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -6241,20 +6241,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP { // prepare data - //NameValue and state - byte[] nv = null; - byte state; - if (part.ParentGroup.IsAttachment) - { - if (part.IsRoot) - nv = Util.StringToBytes256("AttachItemID STRING RW SV " + part.ParentGroup.FromItemID); - - int st = (int)part.ParentGroup.AttachmentPoint; - state = (byte)(((st & 0xf0) >> 4) + ((st & 0x0f) << 4)); ; - } - else - state = part.Shape.State; // not sure about this - #region PrimFlags // prim/update flags PrimFlags primflags = (PrimFlags)m_scene.Permissions.GenerateClientFlags(part, sp); @@ -6271,6 +6257,76 @@ namespace OpenSim.Region.ClientStack.LindenUDP } #endregion PrimFlags + // data block + byte[] data = null; + byte state = part.Shape.State; + PCode pcode = (PCode)part.Shape.PCode; + + //vegetation is special so just do it inline + if(pcode == PCode.Grass || pcode == PCode.Tree || pcode == PCode.NewTree) + { + zc.AddUInt(part.LocalId); + zc.AddByte(state); // state + zc.AddUUID(part.UUID); + zc.AddZeros(4); // crc unused + zc.AddByte((byte)pcode); + // material 1 + // clickaction 1 + zc.AddZeros(2); + zc.AddVector3(part.Shape.Scale); + + // objectdata block + zc.AddByte(60); // fixed object block size + zc.AddVector3(part.RelativePosition); + zc.AddZeros(24); + Quaternion rot = part.RotationOffset; + rot.Normalize(); + zc.AddNormQuat(rot); + zc.AddZeros(12); + + zc.AddUInt(part.ParentID); + zc.AddUInt((uint)primflags); //update flags + + //pbs volume data 23 + //texture entry 2 + //texture anim 1 + //name value 2 + zc.AddZeros(23 + 2 + 1 + 2); + + //data + zc.AddByte(1); + zc.AddZeros(1); + zc.AddByte(state); + + // text 5 + // media url 1 + // particle system 1 + // Extraparams 1 + // sound id 16 + // ownwer 16 + // sound gain 4 + // sound flags 1 + // sound radius 4 + // jointtype 1 + // joint pivot 12 + // joint offset 12 + zc.AddZeros(5 + 1 + 1 + 1 + 16 + 16 + 4 + 1 + 4 + 1 + 12 + 12); + + return; + } + + //NameValue and state + byte[] nv = null; + + if (part.ParentGroup.IsAttachment) + { + if (part.IsRoot) + nv = Util.StringToBytes256("AttachItemID STRING RW SV " + part.ParentGroup.FromItemID); + + int st = (int)part.ParentGroup.AttachmentPoint; + state = (byte)(((st & 0xf0) >> 4) + ((st & 0x0f) << 4)); ; + } + // filter out mesh faces hack ushort profileBegin = part.Shape.ProfileBegin; ushort profileHollow = part.Shape.ProfileHollow; @@ -6290,25 +6346,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP pathScaleY = 150; } - // data block - byte[] data = null; - switch ((PCode)part.Shape.PCode) - { - case PCode.Grass: - case PCode.Tree: - case PCode.NewTree: - data = new byte[] { part.Shape.State }; - break; - default: - break; - } - // do encode the things zc.AddUInt(part.LocalId); zc.AddByte(state); // state zc.AddUUID(part.UUID); zc.AddZeros(4); // crc unused - zc.AddByte(part.Shape.PCode); + zc.AddByte((byte)pcode); zc.AddByte(part.Material); zc.AddByte(part.ClickAction); // clickaction zc.AddVector3(part.Shape.Scale);