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


C# Color4.GetBytes方法代码示例

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


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

示例1: SphereEffect

        /// <summary>
        /// Create a particle swirl around a target position using a <seealso cref="ViewerEffectPacket"/> packet
        /// </summary>
        /// <param name="globalOffset">global offset</param>
        /// <param name="color">A <see cref="Color4"/> object containing the combined red, green, blue and alpha 
        /// color values of particle beam</param>
        /// <param name="duration">a float representing the duration the parcicle beam will last</param>
        /// <param name="effectID">A Unique ID for the beam</param>
        public void SphereEffect(Vector3d globalOffset, Color4 color, float duration, UUID effectID)
        {
            ViewerEffectPacket effect = new ViewerEffectPacket();

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

            effect.Effect = new ViewerEffectPacket.EffectBlock[1];
            effect.Effect[0] = new ViewerEffectPacket.EffectBlock();
            effect.Effect[0].AgentID = Client.Self.AgentID;
            effect.Effect[0].Color = color.GetBytes();
            effect.Effect[0].Duration = duration;
            effect.Effect[0].ID = effectID;
            effect.Effect[0].Type = (byte)EffectType.Sphere;

            byte[] typeData = new byte[56];
            Buffer.BlockCopy(UUID.Zero.GetBytes(), 0, typeData, 0, 16);
            Buffer.BlockCopy(UUID.Zero.GetBytes(), 0, typeData, 16, 16);
            Buffer.BlockCopy(globalOffset.GetBytes(), 0, typeData, 32, 24);

            effect.Effect[0].TypeData = typeData;

            Client.Network.SendPacket(effect);
        }
开发者ID:RavenB,项目名称:gridsearch,代码行数:32,代码来源:AgentManager.cs

示例2: PackColor

 /// <summary>
 /// 
 /// </summary>
 /// <param name="data"></param>
 public void PackColor(Color4 data)
 {
     byte[] bytes = data.GetBytes();
     PackBitArray(bytes, 32);
 }
开发者ID:UbitUmarov,项目名称:Aurora-libomv,代码行数:9,代码来源:BitPack.cs

示例3: GetLightBytes

        public byte[] GetLightBytes()
        {
            byte[] data = new byte[16];

            // Alpha channel in color is intensity
            Color4 tmpColor = new Color4(_lightColorR,_lightColorG,_lightColorB,_lightIntensity);

            tmpColor.GetBytes().CopyTo(data, 0);
            Utils.FloatToBytes(_lightRadius).CopyTo(data, 4);
            Utils.FloatToBytes(_lightCutoff).CopyTo(data, 8);
            Utils.FloatToBytes(_lightFalloff).CopyTo(data, 12);

            return data;
        }
开发者ID:dirkhusemann,项目名称:opensim,代码行数:14,代码来源:PrimitiveBaseShape.cs

示例4: BeamEffect

        /// <summary>
        /// Create a particle beam between an avatar and an primitive
        /// </summary>
        /// <param name="sourceAvatar"><seealso cref="Guid"/> of sources avatar</param>
        /// <param name="targetObject"><seealso cref="Guid"/> of the target</param>
        /// <param name="globalOffset"><seealso cref="Vector3d"/>global offset</param>
        /// <param name="color"><seealso cref="Color4"/>Color values of beam</param>
        /// <param name="duration">a float representing the duration the beam will last</param>
        /// <param name="effectID"><seealso cref="Guid"/> of the Effect</param>
        public void BeamEffect(Guid sourceAvatar, Guid targetObject, Vector3d globalOffset, Color4 color,
            float duration, Guid effectID)
        {
            ViewerEffectPacket effect = new ViewerEffectPacket();

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

            effect.Effect = new ViewerEffectPacket.EffectBlock[1];
            effect.Effect[0] = new ViewerEffectPacket.EffectBlock();
            effect.Effect[0].AgentID = Client.Self.AgentID;
            effect.Effect[0].Color = color.GetBytes();
            effect.Effect[0].Duration = duration;
            effect.Effect[0].ID = effectID;
            effect.Effect[0].Type = (byte)EffectType.Beam;

            byte[] typeData = new byte[56];
            Buffer.BlockCopy(sourceAvatar.GetBytes(), 0, typeData, 0, 16);
            Buffer.BlockCopy(targetObject.GetBytes(), 0, typeData, 16, 16);
            Buffer.BlockCopy(globalOffset.GetBytes(), 0, typeData, 32, 24);

            effect.Effect[0].TypeData = typeData;

            Client.Network.SendPacket(effect);
        }
开发者ID:RavenB,项目名称:gridsearch,代码行数:34,代码来源:AgentManager.cs


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