本文整理汇总了C#中ParticleEffect.SetFinalWorld方法的典型用法代码示例。如果您正苦于以下问题:C# ParticleEffect.SetFinalWorld方法的具体用法?C# ParticleEffect.SetFinalWorld怎么用?C# ParticleEffect.SetFinalWorld使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ParticleEffect
的用法示例。
在下文中一共展示了ParticleEffect.SetFinalWorld方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RenderEffect
/// <summary>
/// Renders the specified particle effect.
/// </summary>
/// <param name="effect">The particle effect to render.</param>
/// <param name="worldMatrix">The world transformation matrix.</param>
/// <param name="viewMatrix">The view matrix.</param>
/// <param name="projectionMatrix">The projection matrix.</param>
/// <param name="cameraPosition">The camera matrix.</param>
public void RenderEffect(ParticleEffect effect, ref Matrix worldMatrix,
ref Matrix viewMatrix,
ref Matrix projectionMatrix,
ref Vector3 cameraPosition)
{
#if UNSAFE
unsafe
#endif
{
this.PreRender(ref worldMatrix, ref viewMatrix, ref projectionMatrix);
//Pre-multiply any proxies world matrices with the passed in world matrix
if (effect.Proxies != null && worldMatrix != Matrix.Identity)
{
effect.SetFinalWorld(ref worldMatrix);
}
for (Int32 i = 0; i < effect.Emitters.Count; i++)
{
AbstractEmitter emitter = effect.Emitters[i];
// Skip if the emitter does not have a texture...
if (emitter.ParticleTexture == null)
continue;
// Skip if the emitter blend mode is set to 'None'...
if (emitter.BlendMode == EmitterBlendMode.None)
continue;
// Skip if the emitter has no active particles...
if (emitter.ActiveParticlesCount == 0)
continue;
BlendState blendState = BlendStateFactory.GetBlendState(emitter.BlendMode);
RenderContext context = new RenderContext(emitter.BillboardStyle, emitter.BillboardRotationalAxis, blendState, emitter.ParticleTexture, ref worldMatrix, ref viewMatrix, ref projectionMatrix, ref cameraPosition, emitter.ActiveParticlesCount, emitter.UseVelocityAsBillboardAxis);
Counters.ParticlesDrawn += emitter.ActiveParticlesCount;
#if UNSAFE
fixed (Particle* buffer = emitter.Particles)
#else
Particle[] buffer = emitter.Particles;
#endif
{
ParticleIterator iterator = new ParticleIterator(buffer, emitter.Budget, emitter.ActiveIndex, emitter.ActiveParticlesCount);
this.Render(ref context, ref iterator);
}
}
}
}