1 using System
.Collections
.Generic
;
2 using UnityEngine
.Rendering
;
4 namespace UnityEngine
.Experimental
.Rendering
6 public partial class RTHandleSystem
10 internal RTHandleSystem m_Owner
;
11 internal RenderTexture m_RT
;
12 internal RenderTargetIdentifier m_NameID
;
13 internal bool m_EnableMSAA
= false;
14 internal bool m_EnableRandomWrite
= false;
15 internal string m_Name
;
17 internal Vector2 scaleFactor
= Vector2
.one
;
18 internal ScaleFunc scaleFunc
;
20 public bool useScaling { get; internal set; }
21 public Vector2Int referenceSize {get; internal set; }
23 public RenderTexture rt
31 public RenderTargetIdentifier nameID
39 // Keep constructor private
40 internal RTHandle(RTHandleSystem owner
)
45 public static implicit operator RenderTexture(RTHandle handle
)
50 public static implicit operator RenderTargetIdentifier(RTHandle handle
)
55 internal void SetRenderTexture(RenderTexture rt
, RTCategory category
)
58 m_NameID
= new RenderTargetIdentifier(rt
);
63 m_Owner
.m_AutoSizedRTs
.Remove(this);
64 CoreUtils
.Destroy(m_RT
);
65 m_NameID
= BuiltinRenderTextureType
.None
;
69 public Vector2Int
GetScaledSize(Vector2Int refSize
)
71 if (scaleFunc
!= null)
73 return scaleFunc(refSize
);
77 return new Vector2Int(
78 x: Mathf
.RoundToInt(scaleFactor
.x
* refSize
.x
),
79 y: Mathf
.RoundToInt(scaleFactor
.y
* refSize
.y
)