本文整理汇总了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);
}
示例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);
}
示例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));
}
示例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;
}