52 lines
1.5 KiB
C#
52 lines
1.5 KiB
C#
using Unity.Cinemachine;
|
|
using UnityEngine;
|
|
using UnityEngine.Experimental.GlobalIllumination;
|
|
using UnityEngine.Rendering.Universal;
|
|
|
|
namespace BrewMonster.Scripts
|
|
{
|
|
public class InGameGraphicOption : MonoSingleton<InGameGraphicOption>
|
|
{
|
|
[SerializeField] private UniversalRenderPipelineAsset _renderPipelineAsset;
|
|
[SerializeField] private CinemachineCamera _cinemachineVirtualCamera;
|
|
|
|
|
|
#region public functions
|
|
|
|
/// <summary>How far the objects are rendered in the scene.</summary>
|
|
/// <param name="distance"></param>
|
|
public void SetRenderDistance(float distance)
|
|
{
|
|
distance = Mathf.Clamp(distance, 50f, 500f);
|
|
_cinemachineVirtualCamera.Lens.FarClipPlane = distance;
|
|
}
|
|
|
|
/// <summary>
|
|
/// The scale of the render pipeline. <br/>
|
|
/// The value should be between 0.6 and 1.5.
|
|
/// </summary>
|
|
public void SetRenderScale(float scale)
|
|
{
|
|
scale = Mathf.Clamp(scale, 0.6f, 1.5f);
|
|
_renderPipelineAsset.renderScale = scale;
|
|
}
|
|
|
|
|
|
public void SetMSAA(int msaaLevel)
|
|
{
|
|
// Valid: 0,2,4
|
|
if (msaaLevel != 0 && msaaLevel != 2 && msaaLevel != 4)
|
|
return;
|
|
|
|
_renderPipelineAsset.msaaSampleCount = msaaLevel;
|
|
}
|
|
|
|
|
|
//TODO: figure out a solution for this.
|
|
public void SetActiveShadow(bool active)
|
|
{
|
|
|
|
}
|
|
#endregion
|
|
}
|
|
} |