首次提交

This commit is contained in:
Bob.Song
2026-03-05 18:07:55 +08:00
commit e125bb869e
4534 changed files with 563920 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 29d171e52a3428a45adc655aa7470e5d
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,25 @@
{
"name": "Ilumisoft.GraphicsControl.BuiltIn",
"rootNamespace": "",
"references": [
"GUID:7f595fd175e67274183d17fac15b74c9",
"GUID:d60799ab2a985554ea1a39cd38695018"
],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [
"POST_PROCESSING_BUILT_IN"
],
"versionDefines": [
{
"name": "com.unity.postprocessing",
"expression": "1.0.0",
"define": "POST_PROCESSING_BUILT_IN"
}
],
"noEngineReferences": false
}

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: bd0ede699487c6c479fb7b3301ef8884
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,51 @@
using UnityEngine;
using UnityEngine.Rendering.PostProcessing;
namespace Ilumisoft.GraphicsControl.Rendering
{
[RequireComponent(typeof(PostProcessVolume))]
public class PostProcessSettingsApplierBuiltIn : GraphicSettingsApplier
{
PostProcessVolume PostProcessVolume { get; set; }
GraphicSettingsManager GraphicSettingsManager { get; set; }
private void Awake()
{
GraphicSettingsManager = FindObjectOfType<GraphicSettingsManager>();
PostProcessVolume = GetComponent<PostProcessVolume>();
}
void Start()
{
ApplySettings();
}
public override void ApplySettings()
{
ApplySetting<BloomSetting, Bloom>();
ApplySetting<GrainSetting, Grain>();
ApplySetting<MotionBlurSetting, MotionBlur>();
ApplySetting<AmbientOcclusionSetting, AmbientOcclusion>();
ApplySetting<ChromaticAberrationSetting, ChromaticAberration>();
}
void ApplySetting<TGraphicSetting, TPostProcessEffect>()
where TGraphicSetting : ToggleGraphicSetting
where TPostProcessEffect : PostProcessEffectSettings
{
// Settings cannot be applied when no profile has been set
if (PostProcessVolume.profile == null)
{
return;
}
// Try to get the effect and the settings and enable/disable effect depending on the settings
if (PostProcessVolume.profile.TryGetSettings<TPostProcessEffect>(out var effect) &&
GraphicSettingsManager.TryGet<TGraphicSetting>(out var setting))
{
effect.enabled.value = setting.IsEnabled();
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c95cae303388304418e930a12566ccc1
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {fileID: 2800000, guid: 511d86b6354e6d6408dff5c757484b7f, type: 3}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,70 @@
using System.Collections;
using UnityEngine;
namespace Ilumisoft.GraphicsControl
{
/// <summary>
/// Applies global <see cref="GraphicSetting"/>'s like the resolution, vsync and general quality settings (if they have been added to the <see cref="GraphicSettingsManager"/>.
/// </summary>
[DisallowMultipleComponent]
[AddComponentMenu("Graphics Control/Global Settings Applier")]
public class GlobalSettingsApplier : GraphicSettingsApplier
{
public override void ApplySettings()
{
ApplyScreenSettings();
ApplyQuality();
ApplyVSync();
}
void ApplyScreenSettings()
{
// Get the current resolution and fullscreen mode
var resolution = Screen.currentResolution;
var fullScreenMode = Screen.fullScreenMode;
// Get the selected resolution setting
if (TryGetSetting<ResolutionSetting>(out var resolutionSetting))
{
resolution = resolutionSetting.GetSelectedOption();
}
// Get the selected fullscreen mode setting
if (TryGetSetting<FullScreenModeSetting>(out var fullScreenModeSetting))
{
fullScreenMode = fullScreenModeSetting.GetSelectedOption();
}
// If any of the settings is available apply resolution/fullScreenMode (if neither ResolutionSetting or FullScreenModeSetting is available, no update is required)
if (resolutionSetting != null || fullScreenModeSetting != null)
{
Screen.SetResolution(resolution.width, resolution.height, fullScreenMode);
}
}
void ApplyVSync()
{
if (TryGetSetting<VSyncSetting>(out var setting))
{
bool isEnabled = setting.GetSelectedOption();
QualitySettings.vSyncCount = isEnabled ? 1 : 0;
}
}
void ApplyQuality()
{
if (TryGetSetting<QualitySetting>(out var setting))
{
int qualityLevel = setting.GetSelectedOption();
QualitySettings.SetQualityLevel(qualityLevel);
}
}
bool TryGetSetting<T>(out T setting) where T : GraphicSetting
{
return GraphicSettingsManager.Instance.TryGet(out setting);
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 954b3a7630ee6b84680bd1ae3c6b9393
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {fileID: 2800000, guid: 511d86b6354e6d6408dff5c757484b7f, type: 3}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 5a1ee97a15c825e4a88d95ed3b1939ae
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,26 @@
{
"name": "Ilumisoft.GraphicsControl.URP",
"rootNamespace": "",
"references": [
"Ilumisoft.GraphicsControl",
"Unity.RenderPipelines.Core.Runtime",
"Unity.RenderPipelines.Universal.Runtime"
],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [
"POST_PROCESSING_URP"
],
"versionDefines": [
{
"name": "com.unity.render-pipelines.universal",
"expression": "1.0.0",
"define": "POST_PROCESSING_URP"
}
],
"noEngineReferences": false
}

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 43db925e0ab44994eb47f5daa359ecae
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,51 @@
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;
namespace Ilumisoft.GraphicsControl.Rendering.Universal
{
[RequireComponent(typeof(Volume))]
public class PostProcessSettingsApplierURP : GraphicSettingsApplier
{
Volume PostProcessVolume { get; set; }
GraphicSettingsManager GraphicSettingsManager { get; set; }
private void Awake()
{
GraphicSettingsManager = FindObjectOfType<GraphicSettingsManager>();
PostProcessVolume = GetComponent<Volume>();
}
void Start()
{
ApplySettings();
}
public override void ApplySettings()
{
ApplySetting<BloomSetting, Bloom>();
ApplySetting<GrainSetting, FilmGrain>();
ApplySetting<MotionBlurSetting, MotionBlur>();
ApplySetting<ChromaticAberrationSetting, ChromaticAberration>();
}
void ApplySetting<TGraphicSetting, TPostProcessEffect>()
where TGraphicSetting : ToggleGraphicSetting
where TPostProcessEffect : VolumeComponent
{
// Settings cannot be applied when no profile has been set
if (PostProcessVolume.profile == null)
{
return;
}
// Try to get the effect and the settings and enable/disable effect depending on the settings
if (PostProcessVolume.profile.TryGet<TPostProcessEffect>(out var effect) &&
GraphicSettingsManager.TryGet<TGraphicSetting>(out var setting))
{
effect.active = setting.IsEnabled();
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ad76d02bedb82f341b59136a9c970d17
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {fileID: 2800000, guid: 511d86b6354e6d6408dff5c757484b7f, type: 3}
userData:
assetBundleName:
assetBundleVariant: