Steven Leal
4 年前
当前提交
23943522
共有 33 个文件被更改,包括 339 次插入 和 293 次删除
-
25com.unity.perception/Editor/Randomization/CategoricalOptionElement.cs
-
72com.unity.perception/Editor/Randomization/ParameterConfigurationEditor.cs
-
4com.unity.perception/Editor/Randomization/ParameterDrawer.cs
-
4com.unity.perception/Editor/Randomization/ParameterDrawerElement.cs
-
126com.unity.perception/Editor/Randomization/ParameterElement.cs
-
16com.unity.perception/Editor/Randomization/SamplerElement.cs
-
6com.unity.perception/Editor/Randomization/Uxml/ParameterElement.uxml
-
50com.unity.perception/Runtime/Randomization/Configuration/ParameterConfiguration.cs
-
74com.unity.perception/Runtime/Randomization/Parameters/CategoricalParameter.cs
-
9com.unity.perception/Runtime/Randomization/Parameters/Parameter.cs
-
7com.unity.perception/Runtime/Randomization/Parameters/ParameterTypes/BooleanParameter.cs
-
4com.unity.perception/Runtime/Randomization/Parameters/ParameterTypes/ColorHsvaParameter.cs
-
4com.unity.perception/Runtime/Randomization/Parameters/ParameterTypes/FloatParameter.cs
-
7com.unity.perception/Runtime/Randomization/Parameters/ParameterTypes/IntegerParameter.cs
-
2com.unity.perception/Runtime/Randomization/Parameters/ParameterTypes/MaterialParameter.cs
-
5com.unity.perception/Runtime/Randomization/Parameters/ParameterTypes/StringParameter.cs
-
4com.unity.perception/Runtime/Randomization/Parameters/ParameterTypes/Vector2Parameter.cs
-
4com.unity.perception/Runtime/Randomization/Parameters/ParameterTypes/Vector3Parameter.cs
-
4com.unity.perception/Runtime/Randomization/Parameters/ParameterTypes/Vector4Parameter.cs
-
21com.unity.perception/Tests/Runtime/Randomization/CategoricalParameterTests.cs
-
4com.unity.perception/Tests/Runtime/Randomization/ParameterConfigurationTests.cs
-
18com.unity.perception/Tests/Runtime/Randomization/ParameterTests.cs
-
2com.unity.perception/Tests/Runtime/Randomization/SamplerTests.cs
-
20com.unity.perception/Tests/Runtime/Randomization/StructParameterTests.cs
-
15com.unity.perception/Runtime/Randomization/Parameters/CategoricalParameterBase.cs
-
3com.unity.perception/Runtime/Randomization/Parameters/CategoricalParameterBase.cs.meta
-
49com.unity.perception/Runtime/Randomization/Parameters/NumericParameter.cs
-
12com.unity.perception/Runtime/Randomization/Parameters/ICategoricalParameter.cs
-
3com.unity.perception/Runtime/Randomization/Parameters/ICategoricalParameter.cs.meta
-
18com.unity.perception/Runtime/Randomization/Parameters/StructParameter.cs
-
3com.unity.perception/Runtime/Randomization/Parameters/StructParameter.cs.meta
-
37com.unity.perception/Runtime/Randomization/Parameters/TypedParameter.cs
-
0/com.unity.perception/Runtime/Randomization/Parameters/NumericParameter.cs.meta
|
|||
using UnityEngine.Perception.Randomization.Parameters.Attributes; |
|||
using System; |
|||
using UnityEngine.Perception.Randomization.Parameters.Attributes; |
|||
[AddComponentMenu("")] |
|||
[Serializable] |
|||
[ParameterMetaData("String")] |
|||
public class StringParameter : CategoricalParameter<string> {} |
|||
} |
|
|||
using System; |
|||
using System.Collections.Generic; |
|||
|
|||
namespace UnityEngine.Perception.Randomization.Parameters |
|||
{ |
|||
[Serializable] |
|||
public abstract class CategoricalParameterBase : Parameter |
|||
{ |
|||
[SerializeField] internal List<float> probabilities = new List<float>(); |
|||
|
|||
internal abstract void AddOption(); |
|||
public abstract void RemoveOption(int index); |
|||
public abstract void ClearOptions(); |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: dffac5e109d340beb8934d1070923c21 |
|||
timeCreated: 1597346882 |
|
|||
using System; |
|||
using Unity.Collections; |
|||
using Unity.Jobs; |
|||
using UnityEngine.Perception.Randomization.Samplers; |
|||
|
|||
namespace UnityEngine.Perception.Randomization.Parameters |
|||
{ |
|||
[Serializable] |
|||
public abstract class NumericParameter<T> : Parameter where T : struct |
|||
{ |
|||
public sealed override Type OutputType => typeof(T); |
|||
|
|||
/// <summary>
|
|||
/// Generates one parameter sample
|
|||
/// </summary>
|
|||
/// <param name="index">Often the current scenario iteration or a scenario's framesSinceInitialization</param>
|
|||
public abstract T Sample(int index); |
|||
|
|||
/// <summary>
|
|||
/// Generates an array of parameter samples
|
|||
/// </summary>
|
|||
/// <param name="index">Often the current scenario iteration or a scenario's framesSinceInitialization</param>
|
|||
/// <param name="sampleCount">Number of parameter samples to generate</param>
|
|||
public abstract T[] Samples(int index, int sampleCount); |
|||
|
|||
/// <summary>
|
|||
/// Schedules a job to generate an array of parameter samples.
|
|||
/// Call Complete() on the JobHandle returned by this function to wait on the job generating the parameter samples.
|
|||
/// </summary>
|
|||
/// <param name="index">Often the current scenario iteration or a scenario's framesSinceInitialization</param>
|
|||
/// <param name="sampleCount">Number of parameter samples to generate</param>
|
|||
/// <param name="jobHandle">The JobHandle returned from scheduling the sampling job</param>
|
|||
public abstract NativeArray<T> Samples(int index, int sampleCount, out JobHandle jobHandle); |
|||
|
|||
public sealed override void ApplyToTarget(int seedOffset) |
|||
{ |
|||
if (!hasTarget) |
|||
return; |
|||
target.ApplyValueToTarget(Sample(seedOffset)); |
|||
} |
|||
|
|||
public override void Validate() |
|||
{ |
|||
base.Validate(); |
|||
foreach (var sampler in Samplers) |
|||
SamplerUtility.ValidateRange(sampler.range); |
|||
} |
|||
} |
|||
} |
|
|||
using System.Collections.Generic; |
|||
|
|||
namespace UnityEngine.Perception.Randomization.Parameters |
|||
{ |
|||
/// <summary>
|
|||
/// Exposes the probabilities property of categorical parameters for UI purposes
|
|||
/// </summary>
|
|||
public interface ICategoricalParameter |
|||
{ |
|||
List<float> Probabilities { get; } |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 747fbbdb7a6e4eae87ea193025685e5e |
|||
timeCreated: 1595536474 |
|
|||
using System; |
|||
using Unity.Collections; |
|||
using Unity.Jobs; |
|||
|
|||
namespace UnityEngine.Perception.Randomization.Parameters |
|||
{ |
|||
public abstract class StructParameter<T> : TypedParameter<T> where T : struct |
|||
{ |
|||
/// <summary>
|
|||
/// Schedules a job to generate an array of parameter samples.
|
|||
/// Call Complete() on the JobHandle returned by this function to wait on the job generating the parameter samples.
|
|||
/// </summary>
|
|||
/// <param name="index">Often the current scenario iteration or a scenario's framesSinceInitialization</param>
|
|||
/// <param name="sampleCount">Number of parameter samples to generate</param>
|
|||
/// <param name="jobHandle">The JobHandle returned from scheduling the sampling job</param>
|
|||
public abstract NativeArray<T> Samples(int index, int sampleCount, out JobHandle jobHandle); |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 0db409852a654ba4856c729c57bba332 |
|||
timeCreated: 1595629954 |
|
|||
using System; |
|||
using UnityEngine.Perception.Randomization.Samplers; |
|||
|
|||
namespace UnityEngine.Perception.Randomization.Parameters |
|||
{ |
|||
public abstract class TypedParameter<T> : Parameter |
|||
{ |
|||
public sealed override Type OutputType => typeof(T); |
|||
|
|||
/// <summary>
|
|||
/// Generates one parameter sample
|
|||
/// </summary>
|
|||
/// <param name="index">Often the current scenario iteration or a scenario's framesSinceInitialization</param>
|
|||
public abstract T Sample(int index); |
|||
|
|||
/// <summary>
|
|||
/// Generates an array of parameter samples
|
|||
/// </summary>
|
|||
/// <param name="index">Often the current scenario iteration or a scenario's framesSinceInitialization</param>
|
|||
/// <param name="sampleCount">Number of parameter samples to generate</param>
|
|||
public abstract T[] Samples(int index, int sampleCount); |
|||
|
|||
public sealed override void ApplyToTarget(int seedOffset) |
|||
{ |
|||
if (!hasTarget) |
|||
return; |
|||
target.ApplyValueToTarget(Sample(seedOffset)); |
|||
} |
|||
|
|||
public override void Validate() |
|||
{ |
|||
base.Validate(); |
|||
foreach (var sampler in Samplers) |
|||
SamplerUtility.ValidateRange(sampler.range); |
|||
} |
|||
} |
|||
} |
撰写
预览
正在加载...
取消
保存
Reference in new issue