浏览代码

Added first render pass code to try out.

/demo-work-customrenderer
Felipe Lira 5 年前
当前提交
5c2ca9e7
共有 1 个文件被更改,包括 30 次插入0 次删除
  1. 30
      Assets/Rendering/MainRenderPass.cs

30
Assets/Rendering/MainRenderPass.cs


using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;
using Unity.Collections;
public class MainRenderPass : ScriptableRenderPass
{

AttachmentDescriptor colorAttachmentDescriptor;
AttachmentDescriptor depthAttachmentDescriptor;
public MainRenderPass(RenderPassEvent renderPassEvent)
{

colorAttachmentDescriptor = new AttachmentDescriptor(RenderTextureFormat.RGB111110Float);
depthAttachmentDescriptor = new AttachmentDescriptor(RenderTextureFormat.Depth);
}
//public override void Configure(CommandBuffer cmd, RenderTextureDescriptor cameraTextureDescriptor)

{
var opaqueDrawingSettings = CreateDrawingSettings(m_UniversalForwardPass, ref renderingData, SortingCriteria.CommonOpaque);
var transparentDrawingSettings = CreateDrawingSettings(m_UniversalForwardPass, ref renderingData, SortingCriteria.CommonTransparent);
//var cameraTargetDescriptor = renderingData.cameraData.cameraTargetDescriptor;
//int width = cameraTargetDescriptor.width;
//int height = cameraTargetDescriptor.height;
//var attachments = new NativeArray<AttachmentDescriptor>(2, Allocator.Temp);
//attachments[0] = colorAttachmentDescriptor;
//attachments[1] = depthAttachmentDescriptor;
//var descriptors = new NativeArray<AttachmentDescriptor>(
// new[] { colorAttachmentDescriptor, depthAttachmentDescriptor },
// Allocator.Temp);
//using (context.BeginScopedRenderPass(width, height, 1, descriptors, 1))
//{
// descriptors.Dispose();
// NativeArray<int> attachmentIndices = new NativeArray<int>(new[] { 0 }, Allocator.Temp);
// using (context.BeginScopedSubPass(attachmentIndices))
// {
// attachmentIndices.Dispose();
// context.DrawRenderers(renderingData.cullResults, ref opaqueDrawingSettings, ref m_OpaqueFilteringSettings);
// context.DrawSkybox(renderingData.cameraData.camera);
// context.DrawRenderers(renderingData.cullResults, ref transparentDrawingSettings, ref m_TransparentFilteringSettings);
// }
//}
context.DrawRenderers(renderingData.cullResults, ref opaqueDrawingSettings, ref m_OpaqueFilteringSettings);
context.DrawSkybox(renderingData.cameraData.camera);

正在加载...
取消
保存