Rasagar/Library/PackageCache/com.unity.visualeffectgraph/Shaders/ParticleLines/Pass.template

75 lines
1.6 KiB
Plaintext
Raw Normal View History

2024-08-26 13:07:20 -07:00
#if !(defined(VFX_VARYING_PS_INPUTS) && defined(VFX_VARYING_POSCS))
#error VFX_VARYING_PS_INPUTS and VFX_VARYING_POSCS must be defined.
#endif
${VFXPerPassInclude}
${VFXGeneratedBlockFunction}
struct vs_input
{
VFX_DECLARE_INSTANCE_ID
};
#if HAS_STRIPS
${VFXDeclareGetStripTangent}
#endif
#pragma vertex vert
VFX_VARYING_PS_INPUTS vert(uint id : SV_VertexID, vs_input i)
{
VFX_VARYING_PS_INPUTS o = (VFX_VARYING_PS_INPUTS)0;
UNITY_SETUP_INSTANCE_ID(i);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
uint index = id >> 1;
${VFXInitInstancing}
${VFXLoadGraphValues}
${VFXLoadContextData}
uint systemSeed = contextData.systemSeed;
uint nbMax = contextData.maxParticleCount;
${VFXLoadAttributesOrCull}
${VFXProcessBlocks}
#if HAS_STRIPS
float3 vPos = attributes.position;
#else
if (!attributes.alive)
return o;
#if TARGET_FROM_ATTRIBUTES
${VFXLoadSize}
float4x4 elementToVFX = GetElementToVFXMatrix(
attributes.axisX,
attributes.axisY,
attributes.axisZ,
float3(attributes.angleX,attributes.angleY,attributes.angleZ),
float3(attributes.pivotX,attributes.pivotY,attributes.pivotZ),
size3,
attributes.position);
attributes.position = mul(elementToVFX,float4(0,0,0,1)).xyz;
${VFXLoadParameter:{targetOffset}}
attributes.targetPosition = mul(elementToVFX,float4(targetOffset,1)).xyz;
#endif
// If ever used we need the position in vfx space (we dont take into account the pixel offset)
float3 vPos = id & 1 ? attributes.targetPosition : attributes.position;
#endif
o.VFX_VARYING_POSCS = TransformPositionVFXToClip(vPos);
${VFXVertexComputeCurrentAndPreviousClipPos}
${VFXVertexCommonProcess}
${VFXVertexAdditionalProcess}
return o;
}