Esempio n. 1
0
 /// <summary>
 /// Sets an object of the material pass parameter. Cloning the <see cref="Material"/> if required.
 /// </summary>
 /// <typeparam name="T">The type of value.</typeparam>
 /// <param name="modelComponent">The <see cref="ModelComponent"/> to update material parameter on.</param>
 /// <param name="parameterAccessor">The parameter to update.</param>
 /// <param name="value">The value.</param>
 /// <param name="materialIndex">The index of the material to update. Default is 0.</param>
 /// <param name="passIndex">The index of the pass of the material to update. Default is 0.</param>
 /// <exception cref="ArgumentNullException">If <paramref name="modelComponent"/> is <see langword="null"/>.</exception>
 /// <exception cref="ArgumentOutOfRangeException">
 /// If <paramref name="materialIndex"/> is less than 0 or greater than <see cref="ModelComponent.GetMaterialCount"/> and not in <see cref="ModelComponent.Materials"/>.
 /// Or if <paramref name="passIndex"/> is less than 0 or greater than or equal to the mu,ber of passes the material has.
 /// </exception>
 public static void SetMaterialParameter <T>(this ModelComponent modelComponent, ObjectParameterAccessor <T> parameterAccessor, T value, int materialIndex = 0, int passIndex = 0)
 {
     modelComponent.GetMaterialPassParameters(materialIndex, passIndex).Set(parameterAccessor, value);
 }
Esempio n. 2
0
 /// <summary>
 /// Sets blittable value of the material pass parameter. Cloning the <see cref="Material"/> if required.
 /// </summary>
 /// <typeparam name="T">The type of value.</typeparam>
 /// <param name="modelComponent">The <see cref="ModelComponent"/> to update material parameter on.</param>
 /// <param name="parameter">The parameter to update.</param>
 /// <param name="value">The value.</param>
 /// <param name="materialIndex">The index of the material to update. Default is 0.</param>
 /// <param name="passIndex">The index of the pass of the material to update. Default is 0.</param>
 /// <exception cref="ArgumentNullException">If <paramref name="modelComponent"/> is <see langword="null"/>.</exception>
 /// <exception cref="ArgumentOutOfRangeException">
 /// If <paramref name="materialIndex"/> is less than 0 or greater than <see cref="ModelComponent.GetMaterialCount"/> and not in <see cref="ModelComponent.Materials"/>.
 /// Or if <paramref name="passIndex"/> is less than 0 or greater than or equal to the mu,ber of passes the material has.
 /// </exception>
 public static void SetMaterialParameter <T>(this ModelComponent modelComponent, ValueParameter <T> parameter, ref T value, int materialIndex = 0, int passIndex = 0) where T : struct
 {
     modelComponent.GetMaterialPassParameters(materialIndex, passIndex).Set(parameter, ref value);
 }
Esempio n. 3
0
 /// <summary>
 /// Sets a permutation of the material pass parameter. Cloning the <see cref="Material"/> if required.
 /// </summary>
 /// <typeparam name="T">The type of value.</typeparam>
 /// <param name="modelComponent">The <see cref="ModelComponent"/> to update material parameter on.</param>
 /// <param name="parameter">The parameter to update.</param>
 /// <param name="value">The value.</param>
 /// <param name="materialIndex">The index of the material to update. Default is 0.</param>
 /// <param name="passIndex">The index of the pass of the material to update. Default is 0.</param>
 /// <exception cref="ArgumentNullException">If <paramref name="modelComponent"/> is <see langword="null"/>.</exception>
 /// <exception cref="ArgumentOutOfRangeException">
 /// If <paramref name="materialIndex"/> is less than 0 or greater than <see cref="ModelComponent.GetMaterialCount"/> and not in <see cref="ModelComponent.Materials"/>.
 /// Or if <paramref name="passIndex"/> is less than 0 or greater than or equal to the mu,ber of passes the material has.
 /// </exception>
 public static void SetMaterialParameter <T>(this ModelComponent modelComponent, PermutationParameterKey <T> parameter, T value, int materialIndex = 0, int passIndex = 0)
 {
     modelComponent.GetMaterialPassParameters(materialIndex, passIndex).Set(parameter, value);
 }