从旧版中移植,Prefab未确认
This commit is contained in:
8
Convention/[Runtime]/Camera/SO.meta
Normal file
8
Convention/[Runtime]/Camera/SO.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a0b1e2d16c11a17428f957d86291013b
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,43 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.Experimental.Rendering;
|
||||
|
||||
namespace Convention
|
||||
{
|
||||
namespace SO
|
||||
{
|
||||
[CreateAssetMenu(fileName = "new TextureRenderingConfig", menuName = "Convention/Camera/TextureRenderingConfig", order = 0)]
|
||||
public class TextureRenderingCameraConfig : CameraInitializerConfig
|
||||
{
|
||||
[Tooltip("Value Name"), Setting] private string m_RenderTextureScaleName = "RenderTextureScale";
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
Reset();
|
||||
}
|
||||
|
||||
public override void Reset()
|
||||
{
|
||||
base.Reset();
|
||||
m_RenderTextureScaleName = "RenderTextureScale";
|
||||
this.values[m_RenderTextureScaleName] = 1f;
|
||||
}
|
||||
|
||||
private void OnValidate()
|
||||
{
|
||||
if (this.values.ContainsKey(m_RenderTextureScaleName) == false)
|
||||
{
|
||||
Reset();
|
||||
}
|
||||
}
|
||||
|
||||
public override void Invoke(Camera camera)
|
||||
{
|
||||
camera.targetTexture = new RenderTexture(
|
||||
(int)(camera.scaledPixelWidth * this.values[m_RenderTextureScaleName]),
|
||||
(int)(camera.scaledPixelHeight * this.values[m_RenderTextureScaleName]),
|
||||
GraphicsFormat.R16G16B16A16_SFloat, GraphicsFormat.D24_UNorm_S8_UInt
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 234eb658dcbbff94aaa51624bd64af0b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Reference in New Issue
Block a user