using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace NiloToon.NiloToonURP
{
///
/// Contains properties and helper functions that you can use when rendering.
///
public static class NiloToonRenderingUtils
{
static Mesh s_FullscreenMesh = null;
///
/// Returns a mesh that you can use with to render full-screen effects.
///
public static Mesh fullscreenMesh
{
// [NiloToon]
// Copy from URP 14.0.9's RenderingUtils.cs
get
{
if (s_FullscreenMesh != null)
return s_FullscreenMesh;
float topV = 1.0f;
float bottomV = 0.0f;
s_FullscreenMesh = new Mesh { name = "Fullscreen Quad" };
s_FullscreenMesh.SetVertices(new List
{
new Vector3(-1.0f, -1.0f, 0.0f),
new Vector3(-1.0f, 1.0f, 0.0f),
new Vector3(1.0f, -1.0f, 0.0f),
new Vector3(1.0f, 1.0f, 0.0f)
});
s_FullscreenMesh.SetUVs(0, new List
{
new Vector2(0.0f, bottomV),
new Vector2(0.0f, topV),
new Vector2(1.0f, bottomV),
new Vector2(1.0f, topV)
});
s_FullscreenMesh.SetIndices(new[] { 0, 1, 2, 2, 1, 3 }, MeshTopology.Triangles, 0, false);
s_FullscreenMesh.UploadMeshData(true);
return s_FullscreenMesh;
}
}
}
}