コード例 #1
0
        public void Render(Rect renderRect)
        {
            if (!rect.Overlaps(renderRect))
            {
                return;
            }

            if (a != null)
            {
                a.Render(renderRect);
                b.Render(renderRect);
                c.Render(renderRect);
                d.Render(renderRect);
            }
            else if (numElements != 0)
            {
                mesh.vertices = vertices;

                if (tangentsPackChanged)
                {
                    mesh.tangents       = tangentsPack;
                    tangentsPackChanged = false;
                }

                Graphics.DrawMeshNow(mesh, Matrix4x4.identity, 0);
            }
        }
コード例 #2
0
        private void RenderParticles(WaterOverlaysData overlays)
        {
            if (overlays.UtilityMap == null)
            {
                Graphics.SetRenderTarget(new RenderBuffer[] { overlays.DynamicDisplacementMap.colorBuffer, overlays.SlopeMap.colorBuffer }, overlays.DynamicDisplacementMap.depthBuffer);
            }
            else
            {
                Graphics.SetRenderTarget(new RenderBuffer[] { overlays.DynamicDisplacementMap.colorBuffer, overlays.SlopeMap.colorBuffer, overlays.UtilityMap.colorBuffer }, overlays.DynamicDisplacementMap.depthBuffer);
            }

            //var spray = GetComponent<WaterSpray>();
            //Graphics.SetRandomWriteTarget(2, spray.ParticlesBuffer);
            Vector4 localMapsShaderCoords = overlays.Camera.LocalMapsShaderCoords;
            float   uniformWaterScale     = GetComponent <Water>().UniformWaterScale;

            waterWavesParticlesMaterial.SetFloat("_WaterScale", uniformWaterScale);
            waterWavesParticlesMaterial.SetVector("_LocalMapsCoords", localMapsShaderCoords);
            waterWavesParticlesMaterial.SetPass(0);

            particles.Render(overlays.Camera.LocalMapsRect);
            //Graphics.ClearRandomWriteTargets();
        }