|
|
|
|
|
|
return renderContext; |
|
|
|
} |
|
|
|
|
|
|
|
static Mesh m_ScreenSpaceTriangle = null; |
|
|
|
|
|
|
|
static Mesh GetScreenSpaceTriangle() |
|
|
|
{ |
|
|
|
// If the assembly has been reloaded, the pointer will become NULL.
|
|
|
|
if (!m_ScreenSpaceTriangle) |
|
|
|
{ |
|
|
|
m_ScreenSpaceTriangle = new Mesh |
|
|
|
{ |
|
|
|
// Note: neither the vertex nor the index data is actually used if the vertex shader computes vertices
|
|
|
|
// using 'SV_VertexID'. However, there is currently no way to bind NULL vertex or index buffers.
|
|
|
|
vertices = new[] { new Vector3(-1, -1, 1), new Vector3(3, -1, 1), new Vector3(-1, 3, 1) }, |
|
|
|
triangles = new[] { 0, 1, 2 } |
|
|
|
}; |
|
|
|
} |
|
|
|
|
|
|
|
return m_ScreenSpaceTriangle; |
|
|
|
} |
|
|
|
|
|
|
|
// Draws a full screen triangle as a faster alternative to drawing a full-screen quad.
|
|
|
|
public static void DrawFullscreen(CommandBuffer commandBuffer, Material material, HDCamera camera, |
|
|
|
// Draws a full screen triangle as a faster alternative to drawing a full screen quad.
|
|
|
|
public static void DrawFullScreen(CommandBuffer commandBuffer, Material material, HDCamera camera, |
|
|
|
commandBuffer.DrawMesh(GetScreenSpaceTriangle(), Matrix4x4.identity, material, 0, shaderPassID, properties); |
|
|
|
commandBuffer.DrawProcedural(Matrix4x4.identity, material, shaderPassID, MeshTopology.Triangles, 3); |
|
|
|
// Draws a full screen triangle as a faster alternative to drawing a full-screen quad.
|
|
|
|
public static void DrawFullscreen(CommandBuffer commandBuffer, Material material, HDCamera camera, |
|
|
|
// Draws a full screen triangle as a faster alternative to drawing a full screen quad.
|
|
|
|
public static void DrawFullScreen(CommandBuffer commandBuffer, Material material, HDCamera camera, |
|
|
|
commandBuffer.DrawMesh(GetScreenSpaceTriangle(), Matrix4x4.identity, material, 0, shaderPassID, properties); |
|
|
|
commandBuffer.DrawProcedural(Matrix4x4.identity, material, shaderPassID, MeshTopology.Triangles, 3); |
|
|
|
// Draws a full screen triangle as a faster alternative to drawing a full-screen quad.
|
|
|
|
public static void DrawFullscreen(CommandBuffer commandBuffer, Material material, HDCamera camera, |
|
|
|
// Draws a full screen triangle as a faster alternative to drawing a full screen quad.
|
|
|
|
public static void DrawFullScreen(CommandBuffer commandBuffer, Material material, HDCamera camera, |
|
|
|
commandBuffer.DrawMesh(GetScreenSpaceTriangle(), Matrix4x4.identity, material, 0, shaderPassID, properties); |
|
|
|
commandBuffer.DrawProcedural(Matrix4x4.identity, material, shaderPassID, MeshTopology.Triangles, 3); |
|
|
|
// Draws a full screen triangle as a faster alternative to drawing a full-screen quad.
|
|
|
|
// Draws a full screen triangle as a faster alternative to drawing a full screen quad.
|
|
|
|
public static void DrawFullscreen(CommandBuffer commandBuffer, Material material, HDCamera camera, |
|
|
|
public static void DrawFullScreen(CommandBuffer commandBuffer, Material material, HDCamera camera, |
|
|
|
RenderTargetIdentifier[] colorBuffers, |
|
|
|
MaterialPropertyBlock properties = null, int shaderPassID = 0) |
|
|
|
{ |
|
|
|
|
|
|
// no depth target ends up being bound.
|
|
|
|
DrawFullscreen(commandBuffer, material, camera, colorBuffers, colorBuffers[0], properties, shaderPassID); |
|
|
|
DrawFullScreen(commandBuffer, material, camera, colorBuffers, colorBuffers[0], properties, shaderPassID); |
|
|
|
} |
|
|
|
} |
|
|
|
} |