浏览代码

changed samplers property from array to IEnumerable

/parameter-bahaviours
Steven Leal 4 年前
当前提交
9baa72fc
共有 9 个文件被更改,包括 71 次插入18 次删除
  1. 7
      com.unity.perception/Runtime/Randomization/Parameters/CategoricalParameter.cs
  2. 5
      com.unity.perception/Runtime/Randomization/Parameters/Parameter.cs
  3. 8
      com.unity.perception/Runtime/Randomization/Parameters/ParameterTypes/BooleanParameter.cs
  4. 14
      com.unity.perception/Runtime/Randomization/Parameters/ParameterTypes/ColorHsvaParameter.cs
  5. 8
      com.unity.perception/Runtime/Randomization/Parameters/ParameterTypes/FloatParameter.cs
  6. 8
      com.unity.perception/Runtime/Randomization/Parameters/ParameterTypes/IntegerParameter.cs
  7. 12
      com.unity.perception/Runtime/Randomization/Parameters/ParameterTypes/Vector2Parameter.cs
  8. 13
      com.unity.perception/Runtime/Randomization/Parameters/ParameterTypes/Vector3Parameter.cs
  9. 14
      com.unity.perception/Runtime/Randomization/Parameters/ParameterTypes/Vector4Parameter.cs

7
com.unity.perception/Runtime/Randomization/Parameters/CategoricalParameter.cs


float[] m_NormalizedProbabilities;
/// <summary>
/// Returns a list containing the samplers attached to this parameter
/// Returns an IEnumerable that iterates over each sampler field in this parameter
public override ISampler[] samplers => new [] { m_Sampler };
public override IEnumerable<ISampler> samplers
{
get { yield return m_Sampler; }
}
/// <summary>
/// The sample type generated by this parameter

5
com.unity.perception/Runtime/Randomization/Parameters/Parameter.cs


using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Perception.Randomization.Samplers;

public abstract Type sampleType { get; }
/// <summary>
/// An array containing a reference to each sampler field in this parameter
/// Returns an IEnumerable that iterates over each sampler field in this parameter
public abstract ISampler[] samplers { get; }
public abstract IEnumerable<ISampler> samplers { get; }
/// <summary>
/// Constructs a new parameter

8
com.unity.perception/Runtime/Randomization/Parameters/ParameterTypes/BooleanParameter.cs


using System;
using System.Collections.Generic;
using Unity.Burst;
using Unity.Collections;
using Unity.Jobs;

[HideInInspector, SerializeReference] public ISampler value = new UniformSampler(0f, 1f);
/// <summary>
/// Returns the sampler employed by this parameter
/// Returns an IEnumerable that iterates over each sampler field in this parameter
public override ISampler[] samplers => new[] { value };
public override IEnumerable<ISampler> samplers
{
get { yield return value; }
}
static bool Sample(float t) => t >= 0.5f;

14
com.unity.perception/Runtime/Randomization/Parameters/ParameterTypes/ColorHsvaParameter.cs


using System;
using System.Collections.Generic;
using Unity.Burst;
using Unity.Collections;
using Unity.Jobs;

[SerializeReference] public ISampler alpha = new ConstantSampler(1f);
/// <summary>
/// Returns the samplers employed by this parameter
/// Returns an IEnumerable that iterates over each sampler field in this parameter
public override ISampler[] samplers => new []{ hue, saturation, value, alpha };
public override IEnumerable<ISampler> samplers
{
get
{
yield return hue;
yield return saturation;
yield return value;
yield return alpha;
}
}
/// <summary>
/// Generates a color sample

8
com.unity.perception/Runtime/Randomization/Parameters/ParameterTypes/FloatParameter.cs


using System;
using System.Collections.Generic;
using Unity.Collections;
using Unity.Jobs;
using UnityEngine.Perception.Randomization.Samplers;

[SerializeReference] public ISampler value = new UniformSampler(0f, 1f);
/// <summary>
/// Returns the sampler employed by this parameter
/// Returns an IEnumerable that iterates over each sampler field in this parameter
public override ISampler[] samplers => new []{ value };
public override IEnumerable<ISampler> samplers
{
get { yield return value; }
}
/// <summary>
/// Generates a float sample

8
com.unity.perception/Runtime/Randomization/Parameters/ParameterTypes/IntegerParameter.cs


using System;
using System.Collections.Generic;
using Unity.Burst;
using Unity.Collections;
using Unity.Jobs;

[SerializeReference] public ISampler value = new UniformSampler(0f, 1f);
/// <summary>
/// Returns the sampler employed by this parameter
/// Returns an IEnumerable that iterates over each sampler field in this parameter
public override ISampler[] samplers => new[] { value };
public override IEnumerable<ISampler> samplers
{
get { yield return value; }
}
/// <summary>
/// Generates an integer sample

12
com.unity.perception/Runtime/Randomization/Parameters/ParameterTypes/Vector2Parameter.cs


using System;
using System.Collections.Generic;
using Unity.Burst;
using Unity.Collections;
using Unity.Jobs;

[SerializeReference] public ISampler y = new UniformSampler(0f, 1f);
/// <summary>
/// Returns the samplers employed by this parameter
/// Returns an IEnumerable that iterates over each sampler field in this parameter
public override ISampler[] samplers => new []{ x, y };
public override IEnumerable<ISampler> samplers
{
get
{
yield return x;
yield return y;
}
}
/// <summary>
/// Generates a Vector2 sample

13
com.unity.perception/Runtime/Randomization/Parameters/ParameterTypes/Vector3Parameter.cs


using System;
using System.Collections.Generic;
using Unity.Burst;
using Unity.Collections;
using Unity.Jobs;

[SerializeReference] public ISampler z = new UniformSampler(0f, 1f);
/// <summary>
/// Returns the samplers employed by this parameter
/// Returns an IEnumerable that iterates over each sampler field in this parameter
public override ISampler[] samplers => new []{ x, y, z };
public override IEnumerable<ISampler> samplers
{
get
{
yield return x;
yield return y;
yield return z;
}
}
/// <summary>
/// Generates a Vector3 sample

14
com.unity.perception/Runtime/Randomization/Parameters/ParameterTypes/Vector4Parameter.cs


using System;
using System.Collections.Generic;
using Unity.Burst;
using Unity.Collections;
using Unity.Jobs;

[SerializeReference] public ISampler w = new UniformSampler(0f, 1f);
/// <summary>
/// The sampler used the samplers employed by this parameter
/// Returns an IEnumerable that iterates over each sampler field in this parameter
public override ISampler[] samplers => new []{ x, y, z, w };
public override IEnumerable<ISampler> samplers
{
get
{
yield return x;
yield return y;
yield return z;
yield return w;
}
}
/// <summary>
/// Generates a Vector4 sample

正在加载...
取消
保存