1
This commit is contained in:
49
Src/Unity/Scripts/URP/RenderWeaponsLastFeature.cs
Normal file
49
Src/Unity/Scripts/URP/RenderWeaponsLastFeature.cs
Normal file
@@ -0,0 +1,49 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.Experimental.Rendering.Universal;
|
||||
using UnityEngine.Rendering;
|
||||
using UnityEngine.Rendering.Universal;
|
||||
|
||||
namespace BITKit.Rendering
|
||||
{
|
||||
public class RenderWeaponsLastFeature : ScriptableRendererFeature
|
||||
{
|
||||
class RenderWeaponsLastPass : ScriptableRenderPass
|
||||
{
|
||||
private RenderQueueType renderQueueType;
|
||||
private FilteringSettings filteringSettings;
|
||||
|
||||
public RenderWeaponsLastPass(RenderQueueType renderQueueType)
|
||||
{
|
||||
this.renderQueueType = renderQueueType;
|
||||
this.filteringSettings = new FilteringSettings(){renderQueueRange = RenderQueueRange.all};
|
||||
}
|
||||
|
||||
public override void Execute(ScriptableRenderContext context, ref RenderingData renderingData)
|
||||
{
|
||||
var cmd = CommandBufferPool.Get();
|
||||
context.ExecuteCommandBuffer(cmd);
|
||||
cmd.Clear();
|
||||
|
||||
var sortFlags = renderingData.cameraData.defaultOpaqueSortFlags;
|
||||
var drawSettings = CreateDrawingSettings(ShaderTagId.none, ref renderingData, sortFlags);
|
||||
context.DrawRenderers(renderingData.cullResults, ref drawSettings, ref filteringSettings);
|
||||
|
||||
context.ExecuteCommandBuffer(cmd);
|
||||
CommandBufferPool.Release(cmd);
|
||||
}
|
||||
}
|
||||
|
||||
RenderWeaponsLastPass renderWeaponsLastPass;
|
||||
|
||||
public override void Create()
|
||||
{
|
||||
renderWeaponsLastPass = new RenderWeaponsLastPass(RenderQueueType.Opaque);
|
||||
}
|
||||
|
||||
public override void AddRenderPasses(ScriptableRenderer renderer, ref RenderingData renderingData)
|
||||
{
|
||||
renderer.EnqueuePass(renderWeaponsLastPass);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
11
Src/Unity/Scripts/URP/RenderWeaponsLastFeature.cs.meta
Normal file
11
Src/Unity/Scripts/URP/RenderWeaponsLastFeature.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cfe447543055d3d438d371961f31212c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Reference in New Issue
Block a user