您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
32 行
899 B
32 行
899 B
using System.Reflection;
|
|
|
|
namespace UnityEngine.MaterialGraph
|
|
{
|
|
[Title("Math/Range/RandomRange")]
|
|
public class RandomRangeNode : CodeFunctionNode
|
|
{
|
|
public RandomRangeNode()
|
|
{
|
|
name = "RandomRange";
|
|
}
|
|
|
|
protected override MethodInfo GetFunctionToConvert()
|
|
{
|
|
return GetType().GetMethod("Unity_Randomrange", BindingFlags.Static | BindingFlags.NonPublic);
|
|
}
|
|
|
|
static string Unity_Randomrange(
|
|
[Slot(0, Binding.None)] Vector2 seed,
|
|
[Slot(1, Binding.None)] Vector1 min,
|
|
[Slot(2, Binding.None)] Vector1 max,
|
|
[Slot(3, Binding.None)] out Vector1 result)
|
|
{
|
|
return
|
|
@"
|
|
{
|
|
{precision} randomno = frac(sin(dot(seed, float2(12.9898, 78.233)))*43758.5453);
|
|
retresult = floor(randomno * (max - min + 1)) + min;
|
|
}";
|
|
}
|
|
}
|
|
}
|