public void Process(WaterCamera waterCamera) { if (!waterCamera.RenderVolumes) { return; } bool hasSubtractiveVolumes = false; bool hasAdditiveVolumes = false; bool hasFlatMasks = false; List <Water> waters = ApplicationSingleton <WaterSystem> .Instance.Waters; for (int i = waters.Count - 1; i >= 0; i--) { waters[i].Renderer.OnSharedSubtractiveMaskRender(ref hasSubtractiveVolumes, ref hasAdditiveVolumes, ref hasFlatMasks); } MaskModule.SetupCamera(waterCamera); this._Commands.Clear(); this.SubtractiveMask(waterCamera, hasSubtractiveVolumes, hasFlatMasks); this.AdditiveMask(waterCamera, hasAdditiveVolumes); if (this._Commands.sizeInBytes != 0) { Camera cameraComponent = waterCamera.CameraComponent; CameraEvent @event = MaskModule.GetEvent(waterCamera); cameraComponent.RemoveCommandBuffer(@event, this._Commands); cameraComponent.AddCommandBuffer(@event, this._Commands); } for (int j = waters.Count - 1; j >= 0; j--) { waters[j].Renderer.OnSharedMaskPostRender(); } }
public void OnDisable(WaterCamera waterCamera) { if (this._Commands != null) { Camera cameraComponent = waterCamera.CameraComponent; CameraEvent @event = MaskModule.GetEvent(waterCamera); cameraComponent.RemoveCommandBuffer(@event, this._Commands); this._Commands.Release(); this._Commands = null; } }