public void RenderOverlays(DynamicWaterCameraData overlays) { Spray component = base.GetComponent <Spray>(); if (component != null && component.ParticlesBuffer != null) { Graphics.SetRandomWriteTarget(3, component.ParticlesBuffer); } this._RenderBuffers[0] = overlays.DynamicDisplacementMap.colorBuffer; this._RenderBuffers[1] = overlays.NormalMap.colorBuffer; this._ParticlesRenderMaterial.SetBuffer("_Particles", this._ParticlesA); this._ParticlesRenderMaterial.SetMatrix("_ParticlesVP", GL.GetGPUProjectionMatrix(overlays.Camera.PlaneProjectorCamera.projectionMatrix, true) * overlays.Camera.PlaneProjectorCamera.worldToCameraMatrix); if (this._ParticlesRenderMaterial.SetPass(0)) { Graphics.SetRenderTarget(this._RenderBuffers, overlays.DynamicDisplacementMap.depthBuffer); Graphics.DrawProceduralIndirect(MeshTopology.Points, this._ParticlesRenderInfo); Graphics.ClearRandomWriteTargets(); } if (this._ParticlesRenderMaterial.SetPass(2)) { Graphics.SetRenderTarget(overlays.DisplacementsMask); Graphics.DrawProceduralIndirect(MeshTopology.Points, this._ParticlesRenderInfo); } Graphics.SetRenderTarget(null); }
private void RenderParticles(DynamicWaterCameraData overlays) { Spray component = base.GetComponent <Spray>(); if (component != null && component.ParticlesBuffer != null) { Graphics.SetRandomWriteTarget(3, component.ParticlesBuffer); } if (!this._Water.ShaderSet.LocalEffectsDebug) { Graphics.SetRenderTarget(new RenderBuffer[] { overlays.DynamicDisplacementMap.colorBuffer, overlays.NormalMap.colorBuffer }, overlays.DynamicDisplacementMap.depthBuffer); } else { Graphics.SetRenderTarget(new RenderBuffer[] { overlays.DynamicDisplacementMap.colorBuffer, overlays.NormalMap.colorBuffer, overlays.GetDebugMap(true).colorBuffer }, overlays.DynamicDisplacementMap.depthBuffer); } Shader.SetGlobalMatrix("_ParticlesVP", GL.GetGPUProjectionMatrix(overlays.Camera.PlaneProjectorCamera.projectionMatrix, true) * overlays.Camera.PlaneProjectorCamera.worldToCameraMatrix); Vector4 localMapsShaderCoords = overlays.Camera.LocalMapsShaderCoords; float uniformWaterScale = base.GetComponent <Water>().UniformWaterScale; this._WaterWavesParticlesMaterial.SetFloat("_WaterScale", uniformWaterScale); this._WaterWavesParticlesMaterial.SetVector("_LocalMapsCoords", localMapsShaderCoords); this._WaterWavesParticlesMaterial.SetPass((!this._Water.ShaderSet.LocalEffectsDebug) ? 0 : 1); this._Particles.Render(overlays.Camera.LocalMapsRect); Graphics.ClearRandomWriteTargets(); }