VR4Medical/ICI/Library/PackageCache/com.unity.render-pipelines.universal@2b88762731f8/Editor/RendererFeatures/NewPostProcessVolumeComponent.cs.txt
2025-07-29 13:45:50 +03:00

39 lines
2.1 KiB
Plaintext

using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;
// Defines a custom Volume Override component that controls the intensity of the URP Post-processing effect on a Scriptable Renderer Feature.
// For more information about the VolumeComponent API, refer to https://docs.unity3d.com/Packages/com.unity.render-pipelines.core@17.2/api/UnityEngine.Rendering.VolumeComponent.html
// Add the Volume Override to the list of available Volume Override components in the Volume Profile.
[VolumeComponentMenu("Post-processing Custom/#DISPLAY_NAME#")]
// If the related Scriptable Renderer Feature doesn't exist, display a warning about adding it to the renderer.
[VolumeRequiresRendererFeatures(typeof(#FEATURE_TYPE#))]
// Make the Volume Override active in the Universal Render Pipeline.
[SupportedOnRenderPipeline(typeof(UniversalRenderPipelineAsset))]
// Create the Volume Override by inheriting from VolumeComponent
public sealed class #VOLUME_TYPE# : VolumeComponent, IPostProcessComponent
{
// Set the name of the volume component in the list in the Volume Profile.
public #VOLUME_TYPE#()
{
displayName = "#DISPLAY_NAME#";
}
// Create a property to control the intesity of the effect, with a tooltip description.
// You can set the default value in the project-wide Graphics settings window. For more information, refer to https://docs.unity3d.com/Manual/urp/urp-global-settings.html
// You can override the value in a local or global volume. For more information, refer to https://docs.unity3d.com/Manual/urp/volumes-landing-page.html
// To access the value in a script, refer to the VolumeManager API: https://docs.unity3d.com/Packages/com.unity.render-pipelines.core@latest/index.html?subfolder=/api/UnityEngine.Rendering.VolumeManager.html
[Tooltip("Enter the description for the property that is shown when hovered")]
public ClampedFloatParameter intensity = new ClampedFloatParameter(1f, 0f, 1f);
// Optional: Implement the IsActive() method of the IPostProcessComponent interface, and get the intensity value.
public bool IsActive()
{
return intensity.GetValue<float>() > 0.0f;
}
}