Example #1
0
        private void RenderUv()
        {
            var effect = DeviceContextHolder.GetEffect <EffectSpecialUv>();
            var a      = new List <ToDrawAt>(1);

            for (var i = _filteredNodes.Length - 1; i >= 0; i--)
            {
                var v = _filteredNodes[i].OriginalNode.Vertices;
                var w = new List <ToDrawAt>(1);
                for (var j = v.Length - 1; j >= 0; j--)
                {
                    var t = new ToDrawAt(v[j].TexC);
                    if (!w.Contains(t))
                    {
                        w.Add(t);
                    }

                    if (w.Count >= 16)
                    {
                        break;
                    }
                }

                a.AddRange(w.ApartFrom(a).ToList());
            }

            AcToolsLogging.Write($"Affected sectors: {a.Select(x => $"[X: {x.X}, Y: {x.Y}]").JoinToString("; ")}");

            var s = Stopwatch.StartNew();

            foreach (var w in a)
            {
                effect.FxOffset.Set(new Vector2(-w.X, -w.Y - 1f));
                for (var i = _filteredNodes.Length - 1; i >= 0; i--)
                {
                    _filteredNodes[i].Draw(DeviceContextHolder, null, SpecialRenderMode.Simple);
                }
            }

            AcToolsLogging.Write($"Performance: {s.Elapsed.TotalMilliseconds / a.Count:F1} ms per sector; {a.Count} sectors; {_filteredNodes.Length} node(s)");
        }
Example #2
0
 private bool Equals(ToDrawAt other)
 {
     return(X == other.X && Y == other.Y);
 }