-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTextYurashiEffectProcessor.cs
More file actions
83 lines (76 loc) · 3.21 KB
/
TextYurashiEffectProcessor.cs
File metadata and controls
83 lines (76 loc) · 3.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
using Vortice.Direct2D1;
using YukkuriMovieMaker.Player.Video;
namespace TextYurashiPlugin
{
internal class TextYurashiEffectProcessor : IVideoEffectProcessor
{
readonly TextYurashiEffect item;
ID2D1Image? input;
public ID2D1Image Output => input ?? throw new NullReferenceException(nameof(input) + "is null");
public TextYurashiEffectProcessor(TextYurashiEffect item)
{
this.item = item;
}
/// <summary>
/// エフェクトを更新する
/// </summary>
/// <param name="effectDescription">エフェクトの描画に必要な各種情報</param>
/// <returns>描画位置等の情報</returns>
public DrawDescription Update(EffectDescription effectDescription)
{
var frame = effectDescription.ItemPosition.Frame;
var length = effectDescription.ItemDuration.Frame;
var fps = effectDescription.FPS;
var x = item.X.GetValue(frame, length, fps);
var y = item.Y.GetValue(frame, length, fps);
var z = item.Z.GetValue(frame, length, fps);
var 範囲 = item.範囲.GetValue(frame, length, fps);
var 間隔 = item.間隔.GetValue(frame, length, fps);
var drawDesc = effectDescription.DrawDescription;
var seeds = frame + drawDesc.Draw.X + drawDesc.Draw.Y;
var fps_frame = frame % fps;
var fps間隔 = fps_frame % (fps / Math.Round(1 / 間隔));
if (fps間隔 != 0) {
Random random2 = new Random((int)seeds - (int)fps間隔);
return
drawDesc with
{
Draw = new(
drawDesc.Draw.X + random2.Next(Math.Abs((int)x)) - ((int)x/2),
drawDesc.Draw.Y + random2.Next(Math.Abs((int)y)) - ((int)y/2),
drawDesc.Draw.Z + random2.Next(Math.Abs((int)z)) - ((int)z/2)),
Rotation = new(
drawDesc.Rotation.X,
drawDesc.Rotation.Y,
drawDesc.Rotation.Z + random2.Next(Math.Abs((int)範囲)) - ((int)範囲 / 2)
)
};
}
Random random = new Random((int)seeds);
return
drawDesc with
{
Draw = new(
drawDesc.Draw.X + random.Next(Math.Abs((int)x)) - ((int)x / 2),
drawDesc.Draw.Y + random.Next(Math.Abs((int)y)) - ((int)y / 2),
drawDesc.Draw.Z + random.Next(Math.Abs((int)z)) - ((int)z / 2)),
Rotation = new(
drawDesc.Rotation.X,
drawDesc.Rotation.Y,
drawDesc.Rotation.Z + random.Next(Math.Abs((int)範囲)) - ((int)範囲 / 2)
)
};
}
public void ClearInput()
{
input = null;
}
public void SetInput(ID2D1Image? input)
{
this.input = input;
}
public void Dispose()
{
}
}
}