Example #1
0
 /// <summary>
 ///     <para>Specifies a variation buffer for a GPU Instancer prototype that is defined in the prefab's shader. Required to use <see cref="AddVariation{T}"/></para>
 ///     <prara>Use this if you want any type of variation between this prototype's instances.</prara>
 ///     <para>To define the buffer necessary for this variation in your shader, you need to create a StructuredBuffer field of the relevant type in that shader.
 ///     You can then access this buffer with "gpuiTransformationMatrix[unity_InstanceID]"</para>
 ///     <para>see <seealso cref="ColorVariations"/> and its demo scene for an example</para>
 /// </summary>
 ///
 /// <example>
 ///     This sample shows how to use the variation buffer in your shader:
 ///
 ///     <code><![CDATA[
 ///     ...
 ///     fixed4 _Color;
 ///
 ///     #ifdef UNITY_PROCEDURAL_INSTANCING_ENABLED
 ///         StructuredBuffer<float4> colorBuffer;
 ///     #endif
 ///     ...
 ///     void surf (Input IN, inout SurfaceOutputStandard o) {
 ///     ...
 ///         #ifdef UNITY_PROCEDURAL_INSTANCING_ENABLED
 ///             uint index = gpuiTransformationMatrix[unity_InstanceID];
 ///             col = colorBuffer[index];
 ///         #else
 ///             col = _Color;
 ///         #endif
 ///     ...
 ///     }
 ///     ]]></code>
 ///
 ///     See "GPUInstancer/ColorVariationShader" for the full example.
 ///
 /// </example>
 ///
 /// <typeparam name="T">The type of variation buffer. Must be defined in the instance prototype's shader</typeparam>
 /// <param name="manager">The manager that defines the prototypes you want to GPU instance.</param>
 /// <param name="prototype">The GPU Instancer prototype to define variations.</param>
 /// <param name="bufferName">The name of the variation buffer in the prototype's shader.</param>
 public static void DefinePrototypeVariationBuffer <T>(GPUInstancerPrefabManager manager, GPUInstancerPrefabPrototype prototype, string bufferName)
 {
     manager.DefinePrototypeVariationBuffer <T>(prototype, bufferName);
 }