-
-
Save psuong/72c3c4afe3bb6ac5b18d52b91b44f2f7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using InitialPrefabs.NimGui.Loop; | |
using UnityEngine; | |
using UnityEngine.Rendering.HighDefinition; | |
using UnityEngine.Rendering; | |
namespace InitialPrefabs.NimGui.Render { | |
public class ImGuiHDRPRenderPass : CustomPass { | |
/// <summary> | |
/// In HDRP this is aliased to an automatically initialized CommandBuffer in <see cref="CommandBuffer"/> | |
/// and <see cref="DefaultImGuiInitializationProxy.OnEnable"/> | |
/// </summary> | |
public CommandBuffer DrawCommand { get; private set; } | |
/// <summary> | |
/// In HDRP this is aliased to an automatically initialized ProperyBlock in <see cref="ImGuiRunner.CommandBuffer"/> | |
/// and <see cref="DefaultImGuiInitializationProxy.OnEnable"/> | |
/// </summary> | |
public MaterialPropertyBlock PropertyBlock { get; private set; } | |
protected override void Setup(ScriptableRenderContext renderContext, CommandBuffer cmd) { | |
// Setup code here | |
DrawCommand = ImGuiRunner.CommandBuffer; | |
PropertyBlock = ImGuiRunner.PropertyBlock; | |
} | |
protected override void Execute(CustomPassContext ctx) { | |
#if UNITY_EDITOR | |
// TODO: Figure out how to grab whether the camera is a scene camera or preview camera. | |
#endif | |
var renderContext = ctx.renderContext; | |
renderContext.ExecuteCommandBuffer(DrawCommand); | |
} | |
protected override void Cleanup() { | |
// Cleanup code | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment