Rasagar/Assets/ProceduralTerrainPainter/Runtime/Modifiers/Curvature.cs

27 lines
834 B
C#
Raw Permalink Normal View History

2024-08-26 13:07:20 -07:00
using UnityEngine;
namespace sc.terrain.proceduralpainter
{
[System.Serializable]
public class Curvature : Modifier
{
[Attributes.MinMaxSlider(0f, 1f)]
[Min(0f)] public Vector2 minMax = new Vector2(0f, 0.25f);
[Range(1f, 16f)] public float radius = 1;
[Range(0.001f, 1f)] public float minFalloff = 0.001f;
[Range(0.001f, 1f)] public float maxFalloff = 0.001f;
public void OnEnable()
{
passIndex = FilterPass.Curvature;
}
public override void Configure(Material material)
{
base.Configure(material);
material.SetFloat("_CurvatureRadius", radius);
material.SetVector("_MinMaxCurvature", new Vector4(minMax.x, minMax.y, minFalloff,maxFalloff));
}
}
}