fix stencil pass
This commit is contained in:
@@ -4,6 +4,7 @@ using EscapeRoomEngine.Engine.Runtime.Modules;
|
||||
using EscapeRoomEngine.Engine.Runtime.Utilities;
|
||||
using NaughtyAttributes;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Serialization;
|
||||
|
||||
namespace EscapeRoomEngine.Portal.Runtime
|
||||
{
|
||||
@@ -12,9 +13,10 @@ namespace EscapeRoomEngine.Portal.Runtime
|
||||
/// </summary>
|
||||
public class Portal : DoorState
|
||||
{
|
||||
private static readonly int PortalNumberProperty = Shader.PropertyToID("_PortalNumber");
|
||||
public static readonly Matrix4x4 HalfRotation = Matrix4x4.Rotate(Quaternion.Euler(0, 180, 0));
|
||||
|
||||
private static int _portalCounter;
|
||||
private static int _portalCounter = 1;
|
||||
|
||||
/// <summary>
|
||||
/// The portal that is connected with this one.
|
||||
@@ -40,6 +42,7 @@ namespace EscapeRoomEngine.Portal.Runtime
|
||||
protected virtual void Awake()
|
||||
{
|
||||
PortalNumber = _portalCounter++;
|
||||
screen.material.SetInt(PortalNumberProperty, PortalNumber);
|
||||
|
||||
DoorEvent += (_, type) =>
|
||||
{
|
||||
|
||||
@@ -33,9 +33,7 @@ namespace EscapeRoomEngine.Portal.Runtime
|
||||
},
|
||||
ref renderingData, sortingCriteria);
|
||||
|
||||
// set stencil to portal
|
||||
var filteringSettings = new FilteringSettings(RenderQueueRange.opaque, _settings.layer);
|
||||
drawingSettings.overrideMaterial = _settings.material;
|
||||
context.DrawRenderers(renderingData.cullResults, ref drawingSettings, ref filteringSettings, ref _renderStateBlock);
|
||||
}
|
||||
}
|
||||
@@ -46,7 +44,6 @@ namespace EscapeRoomEngine.Portal.Runtime
|
||||
public class Settings
|
||||
{
|
||||
public LayerMask layer;
|
||||
public Material material;
|
||||
}
|
||||
|
||||
public Settings settings = new();
|
||||
@@ -56,8 +53,6 @@ namespace EscapeRoomEngine.Portal.Runtime
|
||||
_portalPass = new PortalRenderPass(settings);
|
||||
}
|
||||
|
||||
// Here you can inject one or multiple render passes in the renderer.
|
||||
// This method is called when setting up the renderer once per-camera.
|
||||
public override void AddRenderPasses(ScriptableRenderer renderer, ref RenderingData renderingData)
|
||||
{
|
||||
renderer.EnqueuePass(_portalPass);
|
||||
|
||||
Reference in New Issue
Block a user