You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

32 lines
1.1 KiB

using System.Linq;
using UnityEngine;
namespace UnityEditor.VFX.Operator
{
[VFXHelpURL("Operator-RGBToHSV")]
[VFXInfo(name = "RGB to HSV", category = "Color", synonyms = new []{ "Red", "Green", "Blue", "Convert" })]
class RGBtoHSV : VFXOperator
{
public class InputProperties
{
[Tooltip("Sets the color to be converted to Hue, Saturation, and Value parameters.")]
public Color color = Color.white;
}
public class OutputProperties
{
[Tooltip("Outputs the Hue, Saturation, and Value parameters derived from the input color.")]
public Vector3 HSV = Vector3.zero;
}
override public string name { get { return "RGB to HSV"; } }
protected override sealed VFXExpression[] BuildExpression(VFXExpression[] inputExpression)
{
var components = VFXOperatorUtility.ExtractComponents(inputExpression[0]);
VFXExpression rgb = new VFXExpressionCombine(components.Take(3).ToArray());
return new[] { new VFXExpressionRGBtoHSV(rgb) };
}
}
}