Пример #1
0
        private static byte[] GeneratePreprocessedUpdateBlock(IAgent agent)
        {
            byte[] newupdateblock;
            /* last element is group title */
            byte[] nameblock = string.Format("FirstName STRING RW SV {0}\nLastName STRING RW SV {1}\nTitle STRING RW SV {2}\0", agent.FirstName, agent.LastName, string.Empty).ToUTF8Bytes();
            newupdateblock = new byte[nameblock.Length + 2 + (int)FullFixedBlock1Offset.BlockLength + (int)FullFixedBlock2Offset.BlockLength];
            Array.Clear(newupdateblock, 0, newupdateblock.Length);
            agent.ID.ToBytes(newupdateblock, (int)FullFixedBlock1Offset.FullID);
            newupdateblock[(int)FullFixedBlock1Offset.ObjectDataLength] = 76;
            newupdateblock[(int)FullFixedBlock1Offset.Material]         = (byte)PrimitiveMaterial.Flesh;
            newupdateblock[(int)FullFixedBlock1Offset.PathCurve]        = 16;
            newupdateblock[(int)FullFixedBlock1Offset.PathScaleX]       = 100;
            newupdateblock[(int)FullFixedBlock1Offset.PathScaleY]       = 100;
            newupdateblock[(int)FullFixedBlock1Offset.ProfileCurve]     = 1;
            newupdateblock[(int)FullFixedBlock1Offset.PCode]            = (byte)PrimitiveCode.Avatar;

            PrimitiveFlags primUpdateFlags = PrimitiveFlags.Physics | PrimitiveFlags.ObjectModify | PrimitiveFlags.ObjectCopy | PrimitiveFlags.ObjectAnyOwner |
                                             PrimitiveFlags.ObjectYouOwner | PrimitiveFlags.ObjectMove | PrimitiveFlags.InventoryEmpty | PrimitiveFlags.ObjectTransfer |
                                             PrimitiveFlags.ObjectOwnerModify;

            newupdateblock[(int)FullFixedBlock1Offset.UpdateFlags]     = (byte)((uint)primUpdateFlags & 0xFF);
            newupdateblock[(int)FullFixedBlock1Offset.UpdateFlags + 1] = (byte)(((uint)primUpdateFlags >> 8) & 0xFF);
            newupdateblock[(int)FullFixedBlock1Offset.UpdateFlags + 2] = (byte)(((uint)primUpdateFlags >> 16) & 0xFF);
            newupdateblock[(int)FullFixedBlock1Offset.UpdateFlags + 3] = (byte)(((uint)primUpdateFlags >> 24) & 0xFF);

            var offset = (int)FullFixedBlock1Offset.BlockLength;

            newupdateblock[offset] = (byte)(nameblock.Length & 0xFF);
            ++offset;
            newupdateblock[offset] = (byte)((nameblock.Length >> 8) & 0xFF);
            ++offset;

            Buffer.BlockCopy(nameblock, 0, newupdateblock, offset, nameblock.Length);
            offset += nameblock.Length;

            newupdateblock[offset + (int)FullFixedBlock2Offset.ExtraParams] = 1;
            newupdateblock[offset + (int)FullFixedBlock2Offset.Text]        = 1;
            byte[] floatbytes = BitConverter.GetBytes((float)0);
            if (!BitConverter.IsLittleEndian)
            {
                Array.Reverse(floatbytes);
            }
            Buffer.BlockCopy(floatbytes, 0, newupdateblock, offset + (int)FullFixedBlock2Offset.SoundGain, 4);
            Buffer.BlockCopy(floatbytes, 0, newupdateblock, offset + (int)FullFixedBlock2Offset.SoundRadius, 4);

            return(newupdateblock);
        }
Пример #2
0
        // Get the vertices, flags and collision filter of a primitive
        internal void GetPrimitive(int primitiveKey, out float3x4 vertices, out PrimitiveFlags flags, out CollisionFilter filter)
        {
            int sectionIndex          = primitiveKey >> 8;
            int sectionPrimitiveIndex = primitiveKey & 0xFF;

            ref Section section = ref Sections[sectionIndex];
Пример #3
0
 public static int GetNumPolygonsInPrimitive(PrimitiveFlags primitiveFlags) => primitiveFlags == PrimitiveFlags.IsTrianglePair ? 2 : 1;
Пример #4
0
 public static bool IsPrimitiveFlagSet(PrimitiveFlags flags, PrimitiveFlags testFlag) => (flags & testFlag) != 0;