|
|
|
|
|
|
return data; |
|
|
|
} |
|
|
|
|
|
|
|
WaterVertexOutput WaveVertexOperations(WaterVertexOutput input) |
|
|
|
WaterVertexOutput WaveVertexOperations(WaterVertexOutput input, VertexPositionInputs vertexInput) |
|
|
|
{ |
|
|
|
input.normal = float3(0, 1, 0); |
|
|
|
input.uv.zw = input.posWS.xz; |
|
|
|
|
|
|
input.viewDir = SafeNormalize(_WorldSpaceCameraPos - input.posWS); |
|
|
|
|
|
|
|
// Fog |
|
|
|
input.fogFactorNoise.x = ComputeFogFactor(input.clipPos.z); |
|
|
|
input.fogFactorNoise.x = ComputeFogFactor(vertexInput); |
|
|
|
input.preWaveSP = screenUV.xyz; // pre-displaced screenUVs |
|
|
|
|
|
|
|
// Additional data |
|
|
|
|
|
|
UNITY_TRANSFER_INSTANCE_ID(v, o); |
|
|
|
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); |
|
|
|
|
|
|
|
VertexPositionInputs vertexInput = GetVertexPositionInputs(v.vertex.xyz); |
|
|
|
o.posWS = TransformObjectToWorld(v.vertex.xyz); |
|
|
|
o.posWS = vertexInput.positionWS; |
|
|
|
o = WaveVertexOperations(o); |
|
|
|
o = WaveVertexOperations(o, vertexInput); |
|
|
|
return o; |
|
|
|
} |
|
|
|
|
|
|
|