当前位置: 首页>>代码示例>>C#>>正文


C# Primitive.GetExtraParamsBytes方法代码示例

本文整理汇总了C#中OpenMetaverse.Primitive.GetExtraParamsBytes方法的典型用法代码示例。如果您正苦于以下问题:C# Primitive.GetExtraParamsBytes方法的具体用法?C# Primitive.GetExtraParamsBytes怎么用?C# Primitive.GetExtraParamsBytes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OpenMetaverse.Primitive的用法示例。


在下文中一共展示了Primitive.GetExtraParamsBytes方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: BuildUpdateBlock

        public static ObjectUpdatePacket.ObjectDataBlock BuildUpdateBlock(Primitive prim, PrimFlags flags, uint crc)
        {
            byte[] objectData = new byte[60];
            prim.Position.ToBytes(objectData, 0);
            prim.Velocity.ToBytes(objectData, 12);
            prim.Acceleration.ToBytes(objectData, 24);
            prim.Rotation.ToBytes(objectData, 36);
            prim.AngularVelocity.ToBytes(objectData, 48);

            ObjectUpdatePacket.ObjectDataBlock update = new ObjectUpdatePacket.ObjectDataBlock();
            update.ClickAction = (byte)prim.ClickAction;
            update.CRC = crc;
            update.ExtraParams = prim.GetExtraParamsBytes();
            update.Flags = (byte)flags;
            update.FullID = prim.ID;
            update.Gain = prim.SoundGain;
            update.ID = prim.LocalID;
            update.JointAxisOrAnchor = prim.JointAxisOrAnchor;
            update.JointPivot = prim.JointPivot;
            update.JointType = (byte)prim.Joint;
            update.Material = (byte)prim.PrimData.Material;
            update.MediaURL = Utils.StringToBytes(prim.MediaURL);
            update.NameValue = Utils.StringToBytes(NameValue.NameValuesToString(prim.NameValues));
            update.ObjectData = objectData;
            update.OwnerID = (prim.Properties != null ? prim.Properties.OwnerID : UUID.Zero);
            update.ParentID = prim.ParentID;
            update.PathBegin = Primitive.PackBeginCut(prim.PrimData.PathBegin);
            update.PathCurve = (byte)prim.PrimData.PathCurve;
            update.PathEnd = Primitive.PackEndCut(prim.PrimData.PathEnd);
            update.PathRadiusOffset = Primitive.PackPathTwist(prim.PrimData.PathRadiusOffset);
            update.PathRevolutions = Primitive.PackPathRevolutions(prim.PrimData.PathRevolutions);
            update.PathScaleX = Primitive.PackPathScale(prim.PrimData.PathScaleX);
            update.PathScaleY = Primitive.PackPathScale(prim.PrimData.PathScaleY);
            update.PathShearX = (byte)Primitive.PackPathShear(prim.PrimData.PathShearX);
            update.PathShearY = (byte)Primitive.PackPathShear(prim.PrimData.PathShearY);
            update.PathSkew = Primitive.PackPathTwist(prim.PrimData.PathSkew);
            update.PathTaperX = Primitive.PackPathTaper(prim.PrimData.PathTaperX);
            update.PathTaperY = Primitive.PackPathTaper(prim.PrimData.PathTaperY);
            update.PathTwist = Primitive.PackPathTwist(prim.PrimData.PathTwist);
            update.PathTwistBegin = Primitive.PackPathTwist(prim.PrimData.PathTwistBegin);
            update.PCode = (byte)prim.PrimData.PCode;
            update.ProfileBegin = Primitive.PackBeginCut(prim.PrimData.ProfileBegin);
            update.ProfileCurve = (byte)prim.PrimData.ProfileCurve;
            update.ProfileEnd = Primitive.PackEndCut(prim.PrimData.ProfileEnd);
            update.ProfileHollow = Primitive.PackProfileHollow(prim.PrimData.ProfileHollow);
            update.PSBlock = prim.ParticleSys.GetBytes();
            update.TextColor = prim.TextColor.GetBytes(true);
            update.TextureAnim = prim.TextureAnim.GetBytes();
            update.TextureEntry = prim.Textures == null ? Utils.EmptyBytes : prim.Textures.GetBytes();
            update.Radius = prim.SoundRadius;
            update.Scale = prim.Scale;
            update.Sound = prim.Sound;
            update.State = prim.PrimData.State;
            update.Text = Utils.StringToBytes(prim.Text);
            update.UpdateFlags = (uint)flags;
            switch (prim.PrimData.PCode)
            {
                case PCode.Grass:
                case PCode.Tree:
                case PCode.NewTree:
                    update.Data = new byte[1];
                    update.Data[0] = (byte)prim.TreeSpecies;
                    break;
                default:
                    if (prim.ScratchPad != null)
                    {
                        update.Data = new byte[prim.ScratchPad.Length];
                        Buffer.BlockCopy(prim.ScratchPad, 0, update.Data, 0, update.Data.Length);
                    }
                    else
                    {
                        update.Data = new byte[0];
                    }
                    break;
            }

            return update;
        }
开发者ID:RavenB,项目名称:gridsearch,代码行数:78,代码来源:SimulationObject.cs

示例2: WriteShape

        public static void WriteShape(XmlTextWriter writer, Primitive prim, Primitive.ObjectProperties props, Primitive.ConstructionData shp, ImportSettings options)
        {
            if (true /*shp != null*/)
            {
                writer.WriteStartElement("Shape");

                WriteEnum(writer, "ProfileCurve", shp.ProfileCurve);

                writer.WriteStartElement("TextureEntry");
                byte[] te;
                if (prim.Textures != null)
                    te = prim.Textures.GetBytes();
                else
                    te = Utils.EmptyBytes;
                writer.WriteBase64(te, 0, te.Length);
                writer.WriteEndElement(); // TextureEntry

                writer.WriteStartElement("ExtraParams");
                byte[] ep;
                if (prim.GetExtraParamsBytes() != null)
                    ep = prim.GetExtraParamsBytes();
                else
                    ep = Utils.EmptyBytes;
                writer.WriteBase64(ep, 0, ep.Length);
                writer.WriteEndElement(); // ExtraParams

                writer.WriteElementString("PathBegin", Primitive.PackBeginCut(shp.PathBegin).ToString());
                WriteEnum(writer, "PathCurve", shp.PathCurve);
                writer.WriteElementString("PathEnd", Primitive.PackEndCut(shp.PathEnd).ToString());
                writer.WriteElementString("PathRadiusOffset", Primitive.PackPathTwist(shp.PathRadiusOffset).ToString());
                writer.WriteElementString("PathRevolutions", Primitive.PackPathRevolutions(shp.PathRevolutions).ToString());
                writer.WriteElementString("PathScaleX", Primitive.PackPathScale(shp.PathScaleX).ToString());
                writer.WriteElementString("PathScaleY", Primitive.PackPathScale(shp.PathScaleY).ToString());
                writer.WriteElementString("PathShearX", ((byte)Primitive.PackPathShear(shp.PathShearX)).ToString());
                writer.WriteElementString("PathShearY", ((byte)Primitive.PackPathShear(shp.PathShearY)).ToString());
                writer.WriteElementString("PathSkew", Primitive.PackPathTwist(shp.PathSkew).ToString());
                writer.WriteElementString("PathTaperX", Primitive.PackPathTaper(shp.PathTaperX).ToString());
                writer.WriteElementString("PathTaperY", Primitive.PackPathTaper(shp.PathTaperY).ToString());
                writer.WriteElementString("PathTwist", Primitive.PackPathTwist(shp.PathTwist).ToString());
                writer.WriteElementString("PathTwistBegin", Primitive.PackPathTwist(shp.PathTwistBegin).ToString());
                writer.WriteElementString("ProfileBegin", Primitive.PackBeginCut(shp.ProfileBegin).ToString());
                writer.WriteElementString("ProfileEnd", Primitive.PackEndCut(shp.ProfileEnd).ToString());
                writer.WriteElementString("ProfileHollow", Primitive.PackProfileHollow(shp.ProfileHollow).ToString()); 
                
                WriteEnum(writer, "PCode", shp.PCode);

                // this is Attachment in a way?
                WriteInt(writer, "State", shp.State);
                //WriteEnum(writer, "State", shp.AttachmentPoint);

                WriteFlags(writer, "ProfileShape", shp.ProfileCurve, options);
                WriteFlags(writer, "HollowShape", shp.ProfileHole, options);

                var Sculpt = prim.Sculpt;
                if (Sculpt != null)
                {
                    WriteUUID(writer, "SculptTexture", Sculpt.SculptTexture, options);
                    WriteEnum(writer, "SculptType", Sculpt.Type);
                    writer.WriteStartElement("SculptData");
                    byte[] sd;
                    if (prim.Sculpt != null)
                        sd = Sculpt.GetBytes();
                    else
                        sd = Utils.EmptyBytes;
                    writer.WriteBase64(sd, 0, sd.Length);
                    writer.WriteEndElement(); // SculptData
                }

                Primitive.FlexibleData Flexi = prim.Flexible;
                if (Flexi != null)
                {
                    WriteInt(writer,"FlexiSoftness", Flexi.Softness);
                    WriteFloat(writer,"FlexiTension", Flexi.Tension);
                    WriteFloat(writer,"FlexiDrag", Flexi.Drag);
                    WriteFloat(writer,"FlexiGravity", Flexi.Gravity);
                    WriteFloat(writer,"FlexiWind", Flexi.Wind);
                    WriteFloat(writer,"FlexiForceX", Flexi.Force.X);
                    WriteFloat(writer,"FlexiForceY", Flexi.Force.Y);
                    WriteFloat(writer,"FlexiForceZ", Flexi.Force.Z);
                }

                Primitive.LightData Light = prim.Light;
                if (Light != null)
                {
                    WriteFloat(writer,"LightColorR", Light.Color.R);
                    WriteFloat(writer,"LightColorG", Light.Color.G);
                    WriteFloat(writer,"LightColorB", Light.Color.B);
                    WriteFloat(writer,"LightColorA", Light.Color.A);
                    WriteFloat(writer,"LightRadius", Light.Radius);
                    WriteFloat(writer,"LightCutoff", Light.Cutoff);
                    WriteFloat(writer,"LightFalloff", Light.Falloff);
                    WriteFloat(writer,"LightIntensity", Light.Intensity);
                }

                WriteValue(writer,"FlexiEntry", (Flexi != null).ToString().ToLower());
                WriteValue(writer,"LightEntry", (Light != null).ToString().ToLower());
                WriteValue(writer,"SculptEntry", (Sculpt != null).ToString().ToLower());

                //todo if (shp.Media != null) WES(writer,"Media", shp.Media.ToXml());

//.........这里部分代码省略.........
开发者ID:drzo,项目名称:opensim4opencog,代码行数:101,代码来源:OarFile_Objects.cs

示例3: BuildUpdateBlock

        public static ObjectUpdatePacket.ObjectDataBlock BuildUpdateBlock(Primitive obj, ulong regionHandle, PrimFlags flags)
        {
            byte[] objectData = BuildObjectData(obj.Position, obj.Rotation, obj.Velocity,
                obj.Acceleration, obj.AngularVelocity);

            ObjectUpdatePacket.ObjectDataBlock update = new ObjectUpdatePacket.ObjectDataBlock();
            update.ClickAction = (byte)obj.ClickAction;
            update.CRC = 0;
            update.ExtraParams = obj.GetExtraParamsBytes();
            update.Flags = (byte)flags;
            update.FullID = obj.ID;
            update.Gain = obj.SoundGain;
            update.ID = obj.LocalID;
            update.JointAxisOrAnchor = obj.JointAxisOrAnchor;
            update.JointPivot = obj.JointPivot;
            update.JointType = (byte)obj.Joint;
            update.Material = (byte)obj.PrimData.Material;
            update.MediaURL = Utils.StringToBytes(obj.MediaURL);
            update.NameValue = Utils.StringToBytes(NameValue.NameValuesToString(obj.NameValues));
            update.ObjectData = objectData;
            update.OwnerID = (obj.Properties != null ? obj.Properties.OwnerID : UUID.Zero);
            update.ParentID = obj.ParentID;
            update.PathBegin = Primitive.PackBeginCut(obj.PrimData.PathBegin);
            update.PathCurve = (byte)obj.PrimData.PathCurve;
            update.PathEnd = Primitive.PackEndCut(obj.PrimData.PathEnd);
            update.PathRadiusOffset = Primitive.PackPathTwist(obj.PrimData.PathRadiusOffset);
            update.PathRevolutions = Primitive.PackPathRevolutions(obj.PrimData.PathRevolutions);
            update.PathScaleX = Primitive.PackPathScale(obj.PrimData.PathScaleX);
            update.PathScaleY = Primitive.PackPathScale(obj.PrimData.PathScaleY);
            update.PathShearX = (byte)Primitive.PackPathShear(obj.PrimData.PathShearX);
            update.PathShearY = (byte)Primitive.PackPathShear(obj.PrimData.PathShearY);
            update.PathSkew = Primitive.PackPathTwist(obj.PrimData.PathSkew);
            update.PathTaperX = Primitive.PackPathTaper(obj.PrimData.PathTaperX);
            update.PathTaperY = Primitive.PackPathTaper(obj.PrimData.PathTaperY);
            update.PathTwist = Primitive.PackPathTwist(obj.PrimData.PathTwist);
            update.PathTwistBegin = Primitive.PackPathTwist(obj.PrimData.PathTwistBegin);
            update.PCode = (byte)obj.PrimData.PCode;
            update.ProfileBegin = Primitive.PackBeginCut(obj.PrimData.ProfileBegin);
            update.ProfileCurve = (byte)obj.PrimData.ProfileCurve;
            update.ProfileEnd = Primitive.PackEndCut(obj.PrimData.ProfileEnd);
            update.ProfileHollow = Primitive.PackProfileHollow(obj.PrimData.ProfileHollow);
            update.PSBlock = obj.ParticleSys.GetBytes();
            update.TextColor = obj.TextColor.GetBytes(true);
            update.TextureAnim = obj.TextureAnim.GetBytes();
            update.TextureEntry = obj.Textures == null ? new byte[0] : obj.Textures.ToBytes();
            update.Radius = obj.SoundRadius;
            update.Scale = obj.Scale;
            update.Sound = obj.Sound;
            update.State = obj.PrimData.State;
            update.Text = Utils.StringToBytes(obj.Text);
            update.UpdateFlags = (uint)flags;
            update.Data = obj.GenericData == null ? new byte[0] : obj.GenericData;

            return update;
        }
开发者ID:3di,项目名称:3di-viewer-rei-libs,代码行数:55,代码来源:SimulationObject.cs


注:本文中的OpenMetaverse.Primitive.GetExtraParamsBytes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。