首次提交
This commit is contained in:
@@ -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
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bd0ede699487c6c479fb7b3301ef8884
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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:
|
||||
Reference in New Issue
Block a user