SHA256
Add Preset System
This commit is contained in:
7 files changed
+931
-151
No files matched your search
+156
-74
@@ -1,74 +1,156 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ADOFAIRenderer.Data;
|
||||
|
||||
[SuppressMessage("ReSharper", "RedundantDefaultMemberInitializer")]
|
||||
public class RenderConfig
|
||||
{
|
||||
public double RenderFPS { get; set; }
|
||||
public double VideoFPS { get; set; }
|
||||
|
||||
public int RenderWidth { get; set; }
|
||||
public int RenderHeight { get; set; }
|
||||
|
||||
public VideoEncodingConfig VideoConfig { get; set; } = new();
|
||||
public AudioEncodingConfig AudioConfig { get; set; } = new();
|
||||
public AdvancedConfig AdvancedConfig { get; set; } = new();
|
||||
|
||||
public double DelayAfterEnd { get; set; } = 15;
|
||||
public bool ShowJudgementText { get; set; } = false;
|
||||
}
|
||||
|
||||
[SuppressMessage("ReSharper", "RedundantDefaultMemberInitializer")]
|
||||
public class AdvancedConfig
|
||||
{
|
||||
public int? RandomSeed { get; set; } = null;
|
||||
public bool ProcessAudio { get; set; } = true;
|
||||
public bool NonTile { get; set; } = false;
|
||||
public string FileExtension { get; set; } = "mkv";
|
||||
|
||||
public Color? firePlanetColor = null;
|
||||
public Color? icePlanetColor = null;
|
||||
public Color? windPlanetColor = null;
|
||||
}
|
||||
|
||||
public class VideoEncodingConfig
|
||||
{
|
||||
public Codec Codec { get; set; } = Codec.H264;
|
||||
public RateControlMode RateControlMode { get; set; } = RateControlMode.CBR;
|
||||
|
||||
public int Bitrate { get; set; } = 30000;
|
||||
public int MaxBitrate { get; set; } = 50000;
|
||||
// ReSharper disable once InconsistentNaming
|
||||
public int QP { get; set; } = 18;
|
||||
public double KeyframeInterval { get; set; } = 2.0;
|
||||
public bool ForceSoftwareEncoder { get; set; }
|
||||
}
|
||||
|
||||
public class AudioEncodingConfig
|
||||
{
|
||||
private int _audioSampleRate = 48000;
|
||||
private int _audioChannels = 2;
|
||||
private int _audioBitrate = 256000;
|
||||
|
||||
public bool RenderAudio { get; set; } = true;
|
||||
|
||||
public int AudioSampleRate
|
||||
{
|
||||
get => _audioSampleRate <= 0 ? 48000 : _audioSampleRate;
|
||||
set => _audioSampleRate = value <= 0 ? 48000 : value;
|
||||
}
|
||||
|
||||
public int AudioChannels
|
||||
{
|
||||
get => _audioChannels <= 0 ? 2 : _audioChannels;
|
||||
set => _audioChannels = value <= 0 ? 2 : value;
|
||||
}
|
||||
|
||||
public int AudioBitrate
|
||||
{
|
||||
get => _audioBitrate <= 0 ? 256000 : _audioBitrate;
|
||||
set => _audioBitrate = value <= 0 ? 256000 : value;
|
||||
}
|
||||
}
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Newtonsoft.Json;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ADOFAIRenderer.Data;
|
||||
|
||||
[SuppressMessage("ReSharper", "RedundantDefaultMemberInitializer")]
|
||||
public class RenderConfig
|
||||
{
|
||||
public double RenderFPS { get; set; }
|
||||
public double VideoFPS { get; set; }
|
||||
|
||||
public int RenderWidth { get; set; }
|
||||
public int RenderHeight { get; set; }
|
||||
|
||||
public VideoEncodingConfig VideoConfig { get; set; } = new();
|
||||
public AudioEncodingConfig AudioConfig { get; set; } = new();
|
||||
public AdvancedConfig AdvancedConfig { get; set; } = new();
|
||||
|
||||
public double DelayAfterEnd { get; set; } = 15;
|
||||
public bool ShowJudgementText { get; set; } = false;
|
||||
|
||||
public void CopyFrom(RenderConfig? source)
|
||||
{
|
||||
if (source == null) return;
|
||||
RenderFPS = source.RenderFPS;
|
||||
VideoFPS = source.VideoFPS;
|
||||
RenderWidth = source.RenderWidth;
|
||||
RenderHeight = source.RenderHeight;
|
||||
DelayAfterEnd = source.DelayAfterEnd;
|
||||
ShowJudgementText = source.ShowJudgementText;
|
||||
|
||||
VideoConfig.CopyFrom(source.VideoConfig);
|
||||
AudioConfig.CopyFrom(source.AudioConfig);
|
||||
AdvancedConfig.CopyFrom(source.AdvancedConfig);
|
||||
}
|
||||
|
||||
public RenderConfig Clone()
|
||||
{
|
||||
var clone = new RenderConfig();
|
||||
clone.CopyFrom(this);
|
||||
return clone;
|
||||
}
|
||||
}
|
||||
|
||||
[SuppressMessage("ReSharper", "RedundantDefaultMemberInitializer")]
|
||||
public class AdvancedConfig
|
||||
{
|
||||
public int? RandomSeed { get; set; } = null;
|
||||
public bool ProcessAudio { get; set; } = true;
|
||||
public bool NonTile { get; set; } = false;
|
||||
public string FileExtension { get; set; } = "mkv";
|
||||
|
||||
[JsonConverter(typeof(ColorJsonConverter))]
|
||||
public Color? firePlanetColor = null;
|
||||
|
||||
[JsonConverter(typeof(ColorJsonConverter))]
|
||||
public Color? icePlanetColor = null;
|
||||
|
||||
[JsonConverter(typeof(ColorJsonConverter))]
|
||||
public Color? windPlanetColor = null;
|
||||
|
||||
public void CopyFrom(AdvancedConfig? source)
|
||||
{
|
||||
if (source == null) return;
|
||||
RandomSeed = source.RandomSeed;
|
||||
ProcessAudio = source.ProcessAudio;
|
||||
NonTile = source.NonTile;
|
||||
FileExtension = source.FileExtension;
|
||||
firePlanetColor = source.firePlanetColor;
|
||||
icePlanetColor = source.icePlanetColor;
|
||||
windPlanetColor = source.windPlanetColor;
|
||||
}
|
||||
|
||||
public AdvancedConfig Clone()
|
||||
{
|
||||
var clone = new AdvancedConfig();
|
||||
clone.CopyFrom(this);
|
||||
return clone;
|
||||
}
|
||||
}
|
||||
|
||||
public class VideoEncodingConfig
|
||||
{
|
||||
public Codec Codec { get; set; } = Codec.H264;
|
||||
public RateControlMode RateControlMode { get; set; } = RateControlMode.CBR;
|
||||
|
||||
public int Bitrate { get; set; } = 30000;
|
||||
public int MaxBitrate { get; set; } = 50000;
|
||||
// ReSharper disable once InconsistentNaming
|
||||
public int QP { get; set; } = 18;
|
||||
public double KeyframeInterval { get; set; } = 2.0;
|
||||
public bool ForceSoftwareEncoder { get; set; }
|
||||
|
||||
public void CopyFrom(VideoEncodingConfig? source)
|
||||
{
|
||||
if (source == null) return;
|
||||
Codec = source.Codec;
|
||||
RateControlMode = source.RateControlMode;
|
||||
Bitrate = source.Bitrate;
|
||||
MaxBitrate = source.MaxBitrate;
|
||||
QP = source.QP;
|
||||
KeyframeInterval = source.KeyframeInterval;
|
||||
ForceSoftwareEncoder = source.ForceSoftwareEncoder;
|
||||
}
|
||||
|
||||
public VideoEncodingConfig Clone()
|
||||
{
|
||||
var clone = new VideoEncodingConfig();
|
||||
clone.CopyFrom(this);
|
||||
return clone;
|
||||
}
|
||||
}
|
||||
|
||||
public class AudioEncodingConfig
|
||||
{
|
||||
private int _audioSampleRate = 48000;
|
||||
private int _audioChannels = 2;
|
||||
private int _audioBitrate = 256000;
|
||||
|
||||
public bool RenderAudio { get; set; } = true;
|
||||
|
||||
public int AudioSampleRate
|
||||
{
|
||||
get => _audioSampleRate <= 0 ? 48000 : _audioSampleRate;
|
||||
set => _audioSampleRate = value <= 0 ? 48000 : value;
|
||||
}
|
||||
|
||||
public int AudioChannels
|
||||
{
|
||||
get => _audioChannels <= 0 ? 2 : _audioChannels;
|
||||
set => _audioChannels = value <= 0 ? 2 : value;
|
||||
}
|
||||
|
||||
public int AudioBitrate
|
||||
{
|
||||
get => _audioBitrate <= 0 ? 256000 : _audioBitrate;
|
||||
set => _audioBitrate = value <= 0 ? 256000 : value;
|
||||
}
|
||||
|
||||
public void CopyFrom(AudioEncodingConfig? source)
|
||||
{
|
||||
if (source == null) return;
|
||||
RenderAudio = source.RenderAudio;
|
||||
AudioSampleRate = source.AudioSampleRate;
|
||||
AudioChannels = source.AudioChannels;
|
||||
AudioBitrate = source.AudioBitrate;
|
||||
}
|
||||
|
||||
public AudioEncodingConfig Clone()
|
||||
{
|
||||
var clone = new AudioEncodingConfig();
|
||||
clone.CopyFrom(this);
|
||||
return clone;
|
||||
}
|
||||
}␍
|
||||
Reference in new issue
Block a user