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


C# Primitive.GetBytes方法代码示例

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


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

示例1: AddNewParticleSystem

 public void AddNewParticleSystem(Primitive.ParticleSystem pSystem)
 {
     m_particleSystem = pSystem.GetBytes();
 }
开发者ID:justasabc,项目名称:opensim,代码行数:4,代码来源:SceneObjectPart.cs

示例2: UpdateTexture

 /// <summary>
 /// Update the textures on the part.
 /// </summary>
 /// <remarks>
 /// Added to handle bug in libsecondlife's TextureEntry.ToBytes()
 /// not handling RGBA properly. Cycles through, and "fixes" the color
 /// info
 /// </remarks>
 /// <param name="tex"></param>
 public void UpdateTexture(Primitive.TextureEntry tex)
 {
     //Color4 tmpcolor;
     //for (uint i = 0; i < 32; i++)
     //{
     //    if (tex.FaceTextures[i] != null)
     //    {
     //        tmpcolor = tex.GetFace((uint) i).RGBA;
     //        tmpcolor.A = tmpcolor.A*255;
     //        tmpcolor.R = tmpcolor.R*255;
     //        tmpcolor.G = tmpcolor.G*255;
     //        tmpcolor.B = tmpcolor.B*255;
     //        tex.FaceTextures[i].RGBA = tmpcolor;
     //    }
     //}
     //tmpcolor = tex.DefaultTexture.RGBA;
     //tmpcolor.A = tmpcolor.A*255;
     //tmpcolor.R = tmpcolor.R*255;
     //tmpcolor.G = tmpcolor.G*255;
     //tmpcolor.B = tmpcolor.B*255;
     //tex.DefaultTexture.RGBA = tmpcolor;
     UpdateTextureEntry(tex.GetBytes());
 }
开发者ID:justasabc,项目名称:opensim,代码行数:32,代码来源:SceneObjectPart.cs

示例3: SetSculpt

        /// <summary>
        /// Set the sculptie texture and data on an object
        /// </summary>
        /// <param name="simulator">A reference to the <seealso cref="OpenMetaverse.Simulator"/> object where the object resides</param>
        /// <param name="localID">The objects ID which is local to the simulator the object is in</param>
        /// <param name="sculpt">A <seealso cref="Primitive.SculptData"/> object containing the data to set</param>
        public void SetSculpt(Simulator simulator, uint localID, Primitive.SculptData sculpt)
        {
            ObjectExtraParamsPacket extra = new ObjectExtraParamsPacket();

            extra.AgentData.AgentID = Client.Self.AgentID;
            extra.AgentData.SessionID = Client.Self.SessionID;

            extra.ObjectData = new ObjectExtraParamsPacket.ObjectDataBlock[1];
            extra.ObjectData[0] = new ObjectExtraParamsPacket.ObjectDataBlock();
            extra.ObjectData[0].ObjectLocalID = localID;
            extra.ObjectData[0].ParamType = (byte)ExtraParamType.Sculpt;
            extra.ObjectData[0].ParamInUse = true;
            extra.ObjectData[0].ParamData = sculpt.GetBytes();
            extra.ObjectData[0].ParamSize = (uint)extra.ObjectData[0].ParamData.Length;

            Client.Network.SendPacket(extra, simulator);

            // Not sure why, but if you don't send this the sculpted prim disappears
            ObjectShapePacket shape = new ObjectShapePacket();

            shape.AgentData.AgentID = Client.Self.AgentID;
            shape.AgentData.SessionID = Client.Self.SessionID;

            shape.ObjectData = new OpenMetaverse.Packets.ObjectShapePacket.ObjectDataBlock[1];
            shape.ObjectData[0] = new OpenMetaverse.Packets.ObjectShapePacket.ObjectDataBlock();
            shape.ObjectData[0].ObjectLocalID = localID;
            shape.ObjectData[0].PathScaleX = 100;
            shape.ObjectData[0].PathScaleY = 150;
            shape.ObjectData[0].PathCurve = 32;

            Client.Network.SendPacket(shape, simulator);
        }
开发者ID:RavenB,项目名称:gridsearch,代码行数:38,代码来源:ObjectManager.cs

示例4: SetTextures

        /// <summary>
        /// Set the textures to apply to the faces of an object
        /// </summary>
        /// <param name="simulator">A reference to the <seealso cref="OpenMetaverse.Simulator"/> object where the object resides</param>
        /// <param name="localID">The objects ID which is local to the simulator the object is in</param>
        /// <param name="textures">The texture data to apply</param>
        /// <param name="mediaUrl">A media URL (not used)</param>
        public void SetTextures(Simulator simulator, uint localID, Primitive.TextureEntry textures, string mediaUrl)
        {
            ObjectImagePacket image = new ObjectImagePacket();

            image.AgentData.AgentID = Client.Self.AgentID;
            image.AgentData.SessionID = Client.Self.SessionID;
            image.ObjectData = new ObjectImagePacket.ObjectDataBlock[1];
            image.ObjectData[0] = new ObjectImagePacket.ObjectDataBlock();
            image.ObjectData[0].ObjectLocalID = localID;
            image.ObjectData[0].TextureEntry = textures.GetBytes();
            image.ObjectData[0].MediaURL = Utils.StringToBytes(mediaUrl);

            Client.Network.SendPacket(image, simulator);
        }
开发者ID:RavenB,项目名称:gridsearch,代码行数:21,代码来源:ObjectManager.cs

示例5: SetFlexible

        /// <summary>
        /// Set the flexible data on an object
        /// </summary>
        /// <param name="simulator">A reference to the <seealso cref="OpenMetaverse.Simulator"/> object where the object resides</param>
        /// <param name="localID">The objects ID which is local to the simulator the object is in</param>
        /// <param name="flexible">A <seealso cref="Primitive.FlexibleData"/> object containing the data to set</param>
        public void SetFlexible(Simulator simulator, uint localID, Primitive.FlexibleData flexible)
        {
            ObjectExtraParamsPacket extra = new ObjectExtraParamsPacket();

            extra.AgentData.AgentID = Client.Self.AgentID;
            extra.AgentData.SessionID = Client.Self.SessionID;
            extra.ObjectData = new ObjectExtraParamsPacket.ObjectDataBlock[1];
            extra.ObjectData[0] = new ObjectExtraParamsPacket.ObjectDataBlock();
            extra.ObjectData[0].ObjectLocalID = localID;
            extra.ObjectData[0].ParamType = (byte)ExtraParamType.Flexible;
            extra.ObjectData[0].ParamInUse = true;
            extra.ObjectData[0].ParamData = flexible.GetBytes();
            extra.ObjectData[0].ParamSize = (uint)extra.ObjectData[0].ParamData.Length;

            Client.Network.SendPacket(extra, simulator);
        }
开发者ID:RavenB,项目名称:gridsearch,代码行数:22,代码来源:ObjectManager.cs

示例6: SetLight

        /// <summary>
        /// Set the Light data on an object
        /// </summary>
        /// <param name="simulator">A reference to the <seealso cref="OpenMetaverse.Simulator"/> object where the object resides</param>
        /// <param name="localID">The objects ID which is local to the simulator the object is in</param>
        /// <param name="light">A <seealso cref="Primitive.LightData"/> object containing the data to set</param>
        public void SetLight(Simulator simulator, uint localID, Primitive.LightData light)
        {
            ObjectExtraParamsPacket extra = new ObjectExtraParamsPacket();

            extra.AgentData.AgentID = Client.Self.AgentID;
            extra.AgentData.SessionID = Client.Self.SessionID;
            extra.ObjectData = new ObjectExtraParamsPacket.ObjectDataBlock[1];
            extra.ObjectData[0] = new ObjectExtraParamsPacket.ObjectDataBlock();
            extra.ObjectData[0].ObjectLocalID = localID;
            extra.ObjectData[0].ParamType = (byte)ExtraParamType.Light;
            if (light.Intensity == 0.0f)
            {
                // Disables the light if intensity is 0
                extra.ObjectData[0].ParamInUse = false;
            }
            else
            {
                extra.ObjectData[0].ParamInUse = true;
            }
            extra.ObjectData[0].ParamData = light.GetBytes();
            extra.ObjectData[0].ParamSize = (uint)extra.ObjectData[0].ParamData.Length;

            Client.Network.SendPacket(extra, simulator);
        }
开发者ID:RavenB,项目名称:gridsearch,代码行数:30,代码来源:ObjectManager.cs

示例7: UpdateTextureEntry

        /// <summary>
        /// Update the texture entry for this part.
        /// </summary>
        /// <param name="newTex"></param>
        public void UpdateTextureEntry(Primitive.TextureEntry newTex)
        {
            Primitive.TextureEntry oldTex = Shape.Textures;

            Changed changeFlags = 0;

            Primitive.TextureEntryFace fallbackNewFace = newTex.DefaultTexture;
            Primitive.TextureEntryFace fallbackOldFace = oldTex.DefaultTexture;
           
            // On Incoming packets, sometimes newText.DefaultTexture is null.  The assumption is that all 
            // other prim-sides are set, but apparently that's not always the case.  Lets assume packet/data corruption at this point.
            if (fallbackNewFace == null)
            {
                fallbackNewFace = new Primitive.TextureEntry(Util.BLANK_TEXTURE_UUID).CreateFace(0);
                newTex.DefaultTexture = fallbackNewFace;
            }
            if (fallbackOldFace == null)
            {
                fallbackOldFace = new Primitive.TextureEntry(Util.BLANK_TEXTURE_UUID).CreateFace(0);
                oldTex.DefaultTexture = fallbackOldFace;
            }

            // Materials capable viewers can send a ObjectImage packet
            // when nothing in TE has changed. MaterialID should be updated
            // by the RenderMaterials CAP handler, so updating it here may cause a
            // race condtion. Therefore, if no non-materials TE fields have changed, 
            // we should ignore any changes and not update Shape.TextureEntry

            bool otherFieldsChanged = false;

            for (int i = 0 ; i < GetNumberOfSides(); i++)
            {

                Primitive.TextureEntryFace newFace = newTex.DefaultTexture;
                Primitive.TextureEntryFace oldFace = oldTex.DefaultTexture;

                if (oldTex.FaceTextures[i] != null)
                    oldFace = oldTex.FaceTextures[i];
                if (newTex.FaceTextures[i] != null)
                    newFace = newTex.FaceTextures[i];

                Color4 oldRGBA = oldFace.RGBA;
                Color4 newRGBA = newFace.RGBA;

                if (oldRGBA.R != newRGBA.R ||
                    oldRGBA.G != newRGBA.G ||
                    oldRGBA.B != newRGBA.B ||
                    oldRGBA.A != newRGBA.A)
                    changeFlags |= Changed.COLOR;

                if (oldFace.TextureID != newFace.TextureID)
                    changeFlags |= Changed.TEXTURE;

                // Max change, skip the rest of testing
                if (changeFlags == (Changed.TEXTURE | Changed.COLOR))
                    break;

                if (!otherFieldsChanged)
                {
                    if (oldFace.Bump != newFace.Bump) otherFieldsChanged = true;
                    if (oldFace.Fullbright != newFace.Fullbright) otherFieldsChanged = true;
                    if (oldFace.Glow != newFace.Glow) otherFieldsChanged = true;
                    if (oldFace.MediaFlags != newFace.MediaFlags) otherFieldsChanged = true;
                    if (oldFace.OffsetU != newFace.OffsetU) otherFieldsChanged = true;
                    if (oldFace.OffsetV != newFace.OffsetV) otherFieldsChanged = true;
                    if (oldFace.RepeatU != newFace.RepeatU) otherFieldsChanged = true;
                    if (oldFace.RepeatV != newFace.RepeatV) otherFieldsChanged = true;
                    if (oldFace.Rotation != newFace.Rotation) otherFieldsChanged = true;
                    if (oldFace.Shiny != newFace.Shiny) otherFieldsChanged = true;
                    if (oldFace.TexMapType != newFace.TexMapType) otherFieldsChanged = true;
                }
            }

            if (changeFlags != 0 || otherFieldsChanged)
            {
                m_shape.TextureEntry = newTex.GetBytes();
                if (changeFlags != 0)
                    TriggerScriptChangedEvent(changeFlags);
                UpdateFlag = UpdateRequired.FULL;
                ParentGroup.HasGroupChanged = true;

                //This is madness..
                //ParentGroup.ScheduleGroupForFullUpdate();
                //This is sparta
                ScheduleFullUpdate();
            }
        }
开发者ID:VirTecIO,项目名称:opensim,代码行数:91,代码来源:SceneObjectPart.cs

示例8: UpdateTextureEntry

        /// <summary>
        /// Update the texture entry for this part.
        /// </summary>
        /// <param name="newTex"></param>
        public void UpdateTextureEntry(Primitive.TextureEntry newTex)
        {
            Primitive.TextureEntry oldTex = Shape.Textures;

            Changed changeFlags = 0;

            for (int i = 0 ; i < GetNumberOfSides(); i++)
            {
                Primitive.TextureEntryFace newFace = newTex.DefaultTexture;
                Primitive.TextureEntryFace oldFace = oldTex.DefaultTexture;

                if (oldTex.FaceTextures[i] != null)
                    oldFace = oldTex.FaceTextures[i];
                if (newTex.FaceTextures[i] != null)
                    newFace = newTex.FaceTextures[i];

                Color4 oldRGBA = oldFace.RGBA;
                Color4 newRGBA = newFace.RGBA;

                if (oldRGBA.R != newRGBA.R ||
                    oldRGBA.G != newRGBA.G ||
                    oldRGBA.B != newRGBA.B ||
                    oldRGBA.A != newRGBA.A)
                    changeFlags |= Changed.COLOR;

                if (oldFace.TextureID != newFace.TextureID)
                    changeFlags |= Changed.TEXTURE;

                // Max change, skip the rest of testing
                if (changeFlags == (Changed.TEXTURE | Changed.COLOR))
                    break;
            }

            m_shape.TextureEntry = newTex.GetBytes();
            if (changeFlags != 0)
                TriggerScriptChangedEvent(changeFlags);
            UpdateFlag = UpdateRequired.FULL;
            ParentGroup.HasGroupChanged = true;

            //This is madness..
            //ParentGroup.ScheduleGroupForFullUpdate();
            //This is sparta
            ScheduleFullUpdate();
        }
开发者ID:justasabc,项目名称:opensim75grid,代码行数:48,代码来源:SceneObjectPart.cs

示例9: UpdateTextureEntry

        /// <summary>
        /// Update the texture entry for this part.
        /// </summary>
        /// <param name="newTex"></param>
        public void UpdateTextureEntry(Primitive.TextureEntry newTex)
        {
            Primitive.TextureEntry oldTex = Shape.Textures;

            Changed changeFlags = 0;

            Primitive.TextureEntryFace fallbackNewFace = newTex.DefaultTexture;
            Primitive.TextureEntryFace fallbackOldFace = oldTex.DefaultTexture;
           
            // On Incoming packets, sometimes newText.DefaultTexture is null.  The assumption is that all 
            // other prim-sides are set, but apparently that's not always the case.  Lets assume packet/data corruption at this point.
            if (fallbackNewFace == null)
            {
                fallbackNewFace = new Primitive.TextureEntry(Util.BLANK_TEXTURE_UUID).CreateFace(0);
                newTex.DefaultTexture = fallbackNewFace;
            }
            if (fallbackOldFace == null)
            {
                fallbackOldFace = new Primitive.TextureEntry(Util.BLANK_TEXTURE_UUID).CreateFace(0);
                oldTex.DefaultTexture = fallbackOldFace;
            }

            for (int i = 0 ; i < GetNumberOfSides(); i++)
            {

                Primitive.TextureEntryFace newFace = newTex.DefaultTexture;
                Primitive.TextureEntryFace oldFace = oldTex.DefaultTexture;

                if (oldTex.FaceTextures[i] != null)
                    oldFace = oldTex.FaceTextures[i];
                if (newTex.FaceTextures[i] != null)
                    newFace = newTex.FaceTextures[i];

                Color4 oldRGBA = oldFace.RGBA;
                Color4 newRGBA = newFace.RGBA;

                if (oldRGBA.R != newRGBA.R ||
                    oldRGBA.G != newRGBA.G ||
                    oldRGBA.B != newRGBA.B ||
                    oldRGBA.A != newRGBA.A)
                    changeFlags |= Changed.COLOR;

                if (oldFace.TextureID != newFace.TextureID)
                    changeFlags |= Changed.TEXTURE;

                // Max change, skip the rest of testing
                if (changeFlags == (Changed.TEXTURE | Changed.COLOR))
                    break;
            }

            m_shape.TextureEntry = newTex.GetBytes();
            if (changeFlags != 0)
                TriggerScriptChangedEvent(changeFlags);
            UpdateFlag = UpdateRequired.FULL;
            ParentGroup.HasGroupChanged = true;

            //This is madness..
            //ParentGroup.ScheduleGroupForFullUpdate();
            //This is sparta
            ScheduleFullUpdate();
        }
开发者ID:rryk,项目名称:omp-server,代码行数:65,代码来源:SceneObjectPart.cs


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