Ejemplo n.º 1
0
        public override void Draw(ref Particle particle, float globaltime, ParticleEffect effect, ResourceManager res, Billboards billboards, ref Matrix4 transform, float sparam)
        {
            var time    = particle.TimeAlive / particle.LifeSpan;
            var node_tr = GetTranslation(effect, transform, sparam, time);

            var       p = node_tr.Transform(particle.Position);
            Texture2D tex;
            Vector2   tl, tr, bl, br;

            HandleTexture(res, sparam, globaltime, ref particle, out tex, out tl, out tr, out bl, out br);
            var c = Color.GetValue(sparam, time);
            var a = Alpha.GetValue(sparam, time);

            billboards.Draw(
                tex,
                p,
                new Vector2(Size.GetValue(sparam, time)) * 2,
                new Color4(c, a),
                tl,
                tr,
                bl,
                br,
                Rotate.GetValue(sparam, time),
                SortLayers.OBJECT,
                BlendInfo
                );
        }
Ejemplo n.º 2
0
        public override void Draw(ref Particle particle, int pidx, float lasttime, float globaltime, NodeReference reference, ResourceManager res, ParticleEffectInstance instance, ref Matrix4 transform, float sparam)
        {
            var time    = particle.TimeAlive / particle.LifeSpan;
            var node_tr = GetAttachment(reference, transform);

            Vector3    deltap;
            Quaternion deltaq;

            if (DoTransform(reference, sparam, lasttime, globaltime, out deltap, out deltaq))
            {
                particle.Position    += deltap;
                particle.Orientation *= deltaq;
            }
            var       p = node_tr.Transform(particle.Orientation * particle.Position);
            Texture2D tex;
            Vector2   tl, tr, bl, br;

            HandleTexture(res, sparam, globaltime, ref particle, out tex, out tl, out tr, out bl, out br);
            var c = Color.GetValue(sparam, time);
            var a = Alpha.GetValue(sparam, time);

            instance.Pool.DrawBasic(
                particle.Instance,
                this,
                p,
                new Vector2(Size.GetValue(sparam, time)) * 2,
                new Color4(c, a),
                tl,
                tr,
                bl,
                br,
                Rotate == null ? 0f : MathHelper.DegreesToRadians(Rotate.GetValue(sparam, time))
                );
        }