static IEnumerable<IFinalizedRenderable> DrawZap(WorldRenderer wr, float2 from, float2 to, ISpriteSequence s, out float2 p, string palette) { var dist = to - from; var q = new float2(-dist.Y, dist.X); var c = -float2.Dot(from, q); var rs = new List<IFinalizedRenderable>(); var z = from; var pal = wr.Palette(palette); while ((to - z).X > 5 || (to - z).X < -5 || (to - z).Y > 5 || (to - z).Y < -5) { var step = steps.Where(t => (to - (z + new float2(t[0], t[1]))).LengthSquared < (to - z).LengthSquared) .MinBy(t => Math.Abs(float2.Dot(z + new float2(t[0], t[1]), q) + c)); var pos = wr.ProjectedPosition((z + new float2(step[2], step[3])).ToInt2()); var tintModifiers = s.IgnoreWorldTint ? TintModifiers.IgnoreWorldTint : TintModifiers.None; rs.Add(new SpriteRenderable(s.GetSprite(step[4]), pos, WVec.Zero, 0, pal, 1f, s.GetAlpha(step[4]), float3.Ones, tintModifiers, true).PrepareRender(wr)); z += new float2(step[0], step[1]); if (rs.Count >= 1000) break; } p = z; return rs; }
IEnumerable <IRenderable> IResourceRenderer.RenderPreview(WorldRenderer wr, string resourceType, WPos origin) { if (resourceType != info.ResourceType) { yield break; } var frame = HeavyIndices.First(); var sprite = veinSequence.GetSprite(frame); var alpha = veinSequence.GetAlpha(frame); var palette = wr.Palette(info.Palette); var tintModifiers = veinSequence.IgnoreWorldTint ? TintModifiers.IgnoreWorldTint : TintModifiers.None; yield return(new SpriteRenderable(sprite, origin, WVec.Zero, 0, palette, veinSequence.Scale, alpha, float3.Ones, tintModifiers, false)); }
public void Update(CPos cell, ISpriteSequence sequence, PaletteReference palette, int frame) { Update(cell, sequence.GetSprite(frame), palette, sequence.Scale, sequence.GetAlpha(frame), sequence.IgnoreWorldTint); }