internal void Render(WaterRenderingVisibleArea visibleArea, Color backgroundColor, float pixelsPerUnit, int extraLayersToIgnoreMask = 0) { if (!visibleArea.IsValid) { return; } int textureWidth = Mathf.RoundToInt(visibleArea.Width * _renderTextureResizingFactor * pixelsPerUnit); int textureHeight = Mathf.RoundToInt(visibleArea.Height * _renderTextureResizingFactor * pixelsPerUnit); if (textureWidth < 1 || textureHeight < 1) { return; } Quaternion cameraRotation = _isReflectionMode ? visibleArea.RotationReflection : visibleArea.Rotation; Vector3 cameraPosition = _isReflectionMode ? visibleArea.PositionReflection : visibleArea.Position; cameraPosition.z += _zOffset; Camera camera = GetCamera(); camera.targetTexture = GetRenderTexture(textureWidth, textureHeight); camera.transform.SetPositionAndRotation(cameraPosition, cameraRotation); camera.projectionMatrix = visibleArea.ProjectionMatrix; camera.cullingMask = _cullingMask & (~extraLayersToIgnoreMask); camera.backgroundColor = backgroundColor; camera.farClipPlane = _renderingModule.FarClipPlane; camera.allowHDR = _renderingModule.AllowHDR; camera.allowMSAA = _renderingModule.AllowMSAA; camera.Render(); }
internal void Initialize() { _meshModule.MeshRenderer.sortingOrder = _sortingOrder; _meshModule.MeshRenderer.sortingLayerID = _sortingLayerID; _fullWaterVisibleArea = new WaterRenderingVisibleArea(_mainModule); _surfaceVisibleArea = new WaterRenderingVisibleArea(_mainModule); _surfaceBelowSubmergeLevelVisibleArea = new WaterRenderingVisibleArea(_mainModule); _renderingCameraFrustum = new WaterRenderingCameraFrustum(_mainModule); _clipeePoints = new SimpleFixedSizedList <Vector2>(8); }
override internal void Initialize() { _mainModule = _waterfallObject.MainModule; _meshModule = _waterfallObject.MeshModule; _materialModule = _waterfallObject.MaterialModule; _visibleArea = new WaterRenderingVisibleArea(_mainModule); _renderingCameraFrustum = new WaterRenderingCameraFrustum(_mainModule); if (_clipeePoints == null) { _clipeePoints = new SimpleFixedSizeList <Vector2>(8); } base.Initialize(); }
private void ExecuteRendering(WaterRenderingMode renderingMode, Camera camera, WaterRenderingVisibleArea visibleArea, Color backgroundColor, bool hdr, bool msaa, int extraLayersToIgnoreMask = 0) { #if GAME_2D_WATER_KIT_LWRP || GAME_2D_WATER_KIT_URP renderingMode.Render(_renderingContext, camera, visibleArea, backgroundColor, hdr, msaa, extraLayersToIgnoreMask); #else renderingMode.Render(camera, visibleArea, backgroundColor, hdr, msaa, extraLayersToIgnoreMask); #endif }
internal void Render(Camera camera, WaterRenderingVisibleArea visibleArea, Color backgroundColor, bool hdr, bool msaa, int extraLayersToIgnoreMask = 0) #endif { if (!visibleArea.IsValid) { return; } int renderTextureWidth, renderTextureHeight; if (!_renderTextureUseFixedSize) { renderTextureWidth = (int)(visibleArea.PixelWidth * _renderTextureResizingFactor); renderTextureHeight = (int)(visibleArea.PixelHeight * _renderTextureResizingFactor); if (renderTextureWidth < 1 || renderTextureHeight < 1) { return; } } else { renderTextureWidth = renderTextureHeight = _renderTextureFixedSize; } var modeProperties = _isReflectionMode ? visibleArea.ReflectionProperties : visibleArea.RefractionProperties; var cullingMask = _cullingMask & (~extraLayersToIgnoreMask); camera.orthographic = visibleArea.IsOrthographicCamera; camera.projectionMatrix = modeProperties.ProjectionMatrix; camera.nearClipPlane = modeProperties.NearClipPlane; camera.farClipPlane = visibleArea.FarClipPlane; camera.cullingMask = cullingMask; camera.targetTexture = GetRenderTexture(renderTextureWidth, renderTextureHeight, hdr, msaa); camera.backgroundColor = backgroundColor; if (visibleArea.IsOrthographicCamera) { camera.orthographicSize = visibleArea.OrthographicSize; } else { camera.fieldOfView = visibleArea.FieldOfView; } camera.aspect = visibleArea.Aspect; camera.allowHDR = hdr; camera.allowMSAA = msaa; camera.transform.SetPositionAndRotation(modeProperties.Position, modeProperties.Rotation); #if GAME_2D_WATER_KIT_LWRP UnityEngine.Rendering.LWRP.LightweightRenderPipeline.RenderSingleCamera(context, camera); #elif GAME_2D_WATER_KIT_URP UnityEngine.Rendering.Universal.UniversalRenderPipeline.RenderSingleCamera(context, camera); #else camera.Render(); #endif }
internal void Render(UnityEngine.Rendering.ScriptableRenderContext context, Camera camera, WaterRenderingVisibleArea visibleArea, Color backgroundColor, bool hdr, bool msaa, int extraLayersToIgnoreMask = 0)