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


C# Particle.Get方法代码示例

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


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

示例1: GetParticlePosition

        /// <summary>
        /// Gets the combined position for the particle, adding its field value (if any) to its sampled value from the curve
        /// </summary>
        /// <param name="particle"></param>
        /// <param name="positionField"></param>
        /// <param name="lifeField">Normalized life for sampling</param>
        /// <returns>Particle's current 3D position</returns>
        protected unsafe Vector3 GetParticlePosition(Particle particle, ParticleFieldAccessor<Vector3> positionField, ParticleFieldAccessor<float> lifeField)
        {
            if (SamplerPosition == null)
                return particle.Get(positionField);

            var life = 1f - (*((float*)particle[lifeField]));   // The Life field contains remaining life, so for sampling we take (1 - life)

            return particle.Get(positionField) + SamplerPosition.Evaluate(life);
        }
开发者ID:cg123,项目名称:xenko,代码行数:16,代码来源:ShapeBuilderCommon.cs

示例2: GetParticleSize

        /// <summary>
        /// Gets the combined size for the particle, adding its field value (if any) to its sampled value from the curve
        /// </summary>
        /// <param name="particle">Target particle</param>
        /// <param name="sizeField">Size field accessor</param>
        /// <param name="lifeField">Normalized life for sampling</param>
        /// <returns>Particle's current uniform size</returns>
        protected unsafe float GetParticleSize(Particle particle, ParticleFieldAccessor<float> sizeField, ParticleFieldAccessor<float> lifeField)
        {
            var particleSize = sizeField.IsValid() ? particle.Get(sizeField) : 1f;

            if (SamplerSize == null)
                return particleSize;

            var life = 1f - (*((float*)particle[lifeField]));   // The Life field contains remaining life, so for sampling we take (1 - life)

            return particleSize * SamplerSize.Evaluate(life);
        }
开发者ID:cg123,项目名称:xenko,代码行数:18,代码来源:ShapeBuilderCommon.cs

示例3: GetParticleRotation

        /// <summary>
        /// Gets the combined rotation for the particle, adding its field value (if any) to its sampled value from the curve
        /// </summary>
        /// <param name="particle">Target particle</param>
        /// <param name="rotationField">Rotation field accessor</param>
        /// <param name="lifeField">Normalized particle life for sampling</param>
        /// <returns>Screen space rotation in radians, positive is clockwise</returns>
        protected unsafe float GetParticleRotation(Particle particle, ParticleFieldAccessor<float> rotationField, ParticleFieldAccessor<float> lifeField)
        {
            var particleRotation = rotationField.IsValid() ? particle.Get(rotationField) : 1f;

            if (SamplerRotation == null)
                return particleRotation;

            var life = 1f - (*((float*)particle[lifeField]));   // The Life field contains remaining life, so for sampling we take (1 - life)

            return particleRotation + MathUtil.DegreesToRadians(SamplerRotation.Evaluate(life));
        }
开发者ID:Kryptos-FR,项目名称:xenko-reloaded,代码行数:18,代码来源:ShapeBuilderHexagon.cs

示例4: GetParticleRotation

        /// <summary>
        /// Gets the combined rotation for the particle, adding its field value (if any) to its sampled value from the curve
        /// </summary>
        /// <param name="particle">Target particle</param>
        /// <param name="rotationField">Rotation field accessor</param>
        /// <param name="lifeField">Normalized particle life for sampling</param>
        /// <returns>Quaternion rotation of the quad particle, assuming flat horizontal square at neutral rotation</returns>
        protected unsafe Quaternion GetParticleRotation(Particle particle, ParticleFieldAccessor<Quaternion> rotationField, ParticleFieldAccessor<float> lifeField)
        {
            var particleRotation = rotationField.IsValid() ? particle.Get(rotationField) : Quaternion.Identity;

            if (SamplerRotation == null)
                return particleRotation;

            var life = 1f - (*((float*)particle[lifeField]));   // The Life field contains remaining life, so for sampling we take (1 - life)

            return SamplerRotation.Evaluate(life) * particleRotation;
        }
开发者ID:Kryptos-FR,项目名称:xenko-reloaded,代码行数:18,代码来源:ShapeBuilderQuad.cs


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