public void TestRender()
    {
        var startTime = TimePoint.Now;
        var target    = CameraCenter + new Vector3(300, 0, 300);

        var effect = new CallLightningEffect(
            _renderer,
            startTime,
            target
            );

        void Render(int timeSinceStart)
        {
            TimePoint.SetFakeTime(startTime + TimeSpan.FromMilliseconds(timeSinceStart));
            effect.Render(Viewport);
        }

        var frames = RenderFrameSequence(36, Render, new [] { target }, interval: 25);

        AttachVideo("call_lightning.mp4", frames);

        // Assert against reference images at certain intervals
        // Points are chosen where arcs become visible/invisible.
        CompareReferenceFrames(frames, "Core/Systems/Vfx/CallLightning", 0, 150, 200, 500, 800);
    }
    public void TestRender()
    {
        var startTime = TimePoint.Now;
        var from      = CameraCenter - new Vector3(300, 0, -250);
        var targets   = new List <ChainLightningTarget>()
        {
            new(CameraCenter + new Vector3(300, 0, -250)),
            new(CameraCenter + new Vector3(300, 0, 250)),
            new(CameraCenter + new Vector3(500, 0, 0))
        };
        var locations = new[] { from }.Concat(targets.Select(t => t.Location)).ToArray();

        var effect = new ChainLightningEffect(
            _renderer,
            startTime,
            from,
            targets
            );

        void Render(int timeSinceStart)
        {
            TimePoint.SetFakeTime(startTime + TimeSpan.FromMilliseconds(timeSinceStart));
            effect.Render(Viewport);
        }

        var frames = RenderFrameSequence(45, Render, locations);

        ScreenshotCommandWrapper.AttachVideo("chain_lightning.mp4", frames);

        // Assert against reference images at certain intervals
        // Points are chosen where arcs become visible/invisible.
        CompareReferenceFrames(frames, "Core/Systems/Vfx/ChainLightning", 0, 300, 550, 1800, 2200);
    }
Exemple #3
0
    public void TestRender()
    {
        var startTime = TimePoint.Now;
        var from      = CameraCenter - new Vector3(0, 0, 0);
        var to        = CameraCenter - new Vector3(300, 0, 0);
        var locations = new[] { from, to };

        var effect = new LightningBoltEffect(
            _renderer,
            startTime,
            from,
            to
            );

        void Render(int timeSinceStart)
        {
            TimePoint.SetFakeTime(startTime + TimeSpan.FromMilliseconds(timeSinceStart));
            effect.Render(Viewport);
        }

        var frames = RenderFrameSequence(37, Render, locations);

        ScreenshotCommandWrapper.AttachVideo("lightning_bolt.mp4", frames);

        // Assert against reference images at certain intervals
        CompareReferenceFrames(frames, "Core/Systems/Vfx/LightningBolt", 0, 300, 550, 1800);
    }