|
|
|
|
|
|
using UnityEngine; |
|
|
|
using UnityEngine.Rendering; |
|
|
|
using UnityEngine.Rendering.Universal; |
|
|
|
public class WaterCausticsFeature : UnityEngine.Rendering.Universal.ScriptableRendererFeature |
|
|
|
public class WaterCausticsFeature : ScriptableRendererFeature |
|
|
|
{ |
|
|
|
private WaterCausticsPass m_WaterCausticsPass; |
|
|
|
public WaterCausticSettings settings = new WaterCausticSettings(); |
|
|
|
|
|
|
{ |
|
|
|
m_WaterCausticsPass = new WaterCausticsPass(); |
|
|
|
m_WaterCausticsPass.m_WaterCausticMaterial = settings.material; |
|
|
|
m_WaterCausticsPass.renderPassEvent = RenderPassEvent.AfterRenderingSkybox + 1; |
|
|
|
} |
|
|
|
|
|
|
|
public override void AddRenderPasses(UnityEngine.Rendering.Universal.ScriptableRenderer renderer, ref UnityEngine.Rendering.Universal.RenderingData renderingData) |
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
CommandBuffer cmd = CommandBufferPool.Get(k_RenderWaterCausticsTag); |
|
|
|
cmd.SetViewProjectionMatrices(Matrix4x4.identity, Matrix4x4.identity); |
|
|
|
cmd.DrawMesh(UnityEngine.Rendering.Universal.RenderingUtils.fullscreenMesh, Matrix4x4.identity, m_WaterCausticMaterial, 0, 0); |
|
|
|
cmd.SetViewProjectionMatrices(renderingData.cameraData.camera.worldToCameraMatrix, renderingData.cameraData.camera.projectionMatrix); |
|
|
|
|
|
|
|
cmd.DrawMesh(RenderingUtils.fullscreenMesh, Matrix4x4.identity, m_WaterCausticMaterial, 0, 0); |
|
|
|
context.ExecuteCommandBuffer(cmd); |
|
|
|
CommandBufferPool.Release(cmd); |
|
|
|
} |