vegetation is special

0.9.1.0-post-fixes
UbitUmarov 2019-03-07 17:11:52 +00:00
parent 9ccc3ed756
commit 4e7cddc6a8
1 changed files with 71 additions and 28 deletions

View File

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