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.
 
 
 
 
 

51 lines
1.4 KiB

using System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
namespace UnityEditor.VFX.Operator
{
[VFXHelpURL("Operator-Discretize")]
[VFXInfo(category = "Math/Clamp")]
class Discretize : VFXOperatorNumericUnified, IVFXOperatorNumericUnifiedConstrained
{
public class InputProperties
{
[Tooltip("The value to be discretized.")]
public float a = 0.0f;
[Min(0.000001f), Tooltip("The granularity.")]
public float b = 1.0f;
}
protected override sealed string operatorName { get { return "Discretize"; } }
public IEnumerable<int> slotIndicesThatMustHaveSameType
{
get
{
return Enumerable.Range(0, 2);
}
}
public IEnumerable<int> slotIndicesThatCanBeScalar
{
get
{
yield return 1;
}
}
protected sealed override ValidTypeRule typeFilter
{
get
{
return ValidTypeRule.allowEverythingExceptIntegerAndDirection;
}
}
protected override sealed VFXExpression[] BuildExpression(VFXExpression[] inputExpression)
{
return new[] { VFXOperatorUtility.Discretize(inputExpression[0], inputExpression[1]) };
}
}
}