浏览代码
Updated project and SRLs to use new GraphicsSettings registration interface.
Updated project and SRLs to use new GraphicsSettings registration interface.
In order to register a scriptable render loop goto GraphicsSettings and set there./main
Felipe Lira
8 年前
当前提交
d2f48b79
共有 14 个文件被更改,包括 125 次插入 和 245 次删除
-
24Assets/BasicRenderLoopTutorial/BasicRenderLoop.cs
-
23Assets/BasicRenderLoopTutorial/BasicRenderLoopScene.unity
-
3Assets/Editor/Tests/RenderloopTests/CullResultsTest.cs
-
32Assets/Editor/Tests/RenderloopTests/RenderloopTestFixture.cs
-
35Assets/ScriptableRenderLoop/HDRenderLoop/HDRenderLoop.cs
-
63Assets/ScriptableRenderLoop/fptl/FptlLighting.cs
-
38ProjectSettings/GraphicsSettings.asset
-
13Assets/basicrenderloop.asset
-
8Assets/basicrenderloop.asset.meta
-
14Assets/ScriptableRenderLoop/ScriptableRenderLoop.cs
-
12Assets/ScriptableRenderLoop/ScriptableRenderLoop.cs.meta
-
93Assets/ScriptableRenderLoop/ScriptableRenderLoopPicker.cs
-
12Assets/ScriptableRenderLoop/ScriptableRenderLoopPicker.cs.meta
|
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!114 &11400000 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
m_GameObject: {fileID: 0} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 22228a1bd982b864ea6c84db2fc11dd1, type: 3} |
|||
m_Name: basicrenderloop |
|||
m_EditorClassIdentifier: |
|
|||
fileFormatVersion: 2 |
|||
guid: f77fc78803cb35147ab3c0811feb562d |
|||
timeCreated: 1480085360 |
|||
licenseType: Pro |
|||
NativeFormatImporter: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using UnityEngine.Experimental.Rendering; |
|||
|
|||
namespace UnityEngine.Experimental.ScriptableRenderLoop |
|||
{ |
|||
public abstract class ScriptableRenderLoop : ScriptableObject |
|||
{ |
|||
public abstract void Render(Camera[] cameras, RenderLoop renderLoop); |
|||
public virtual void Rebuild() {} |
|||
|
|||
#if UNITY_EDITOR
|
|||
public virtual UnityEditor.SupportedRenderingFeatures GetSupportedRenderingFeatures() { return new UnityEditor.SupportedRenderingFeatures(); } |
|||
#endif
|
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 4a2689a80c91a4fb8bec214a015b9cdc |
|||
timeCreated: 1466769781 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using UnityEngine.Experimental.Rendering; |
|||
|
|||
namespace UnityEngine.Experimental.ScriptableRenderLoop |
|||
{ |
|||
//@TODO: This should be moved into GraphicsSettings
|
|||
[ExecuteInEditMode] |
|||
public class ScriptableRenderLoopPicker : MonoBehaviour |
|||
{ |
|||
public ScriptableRenderLoop renderloop |
|||
{ |
|||
get { return m_RenderLoop; } |
|||
set { m_RenderLoop = value; } |
|||
} |
|||
|
|||
[SerializeField] |
|||
private ScriptableRenderLoop m_RenderLoop; |
|||
|
|||
// TEMPORARY
|
|||
public int legacyRenderLoopMaxShaderLOD = int.MaxValue; |
|||
|
|||
void OnEnable() |
|||
{ |
|||
RenderLoop.renderLoopDelegate += Render; |
|||
|
|||
SyncRenderingFeatures(); |
|||
} |
|||
|
|||
void OnValidate() |
|||
{ |
|||
SyncRenderingFeatures(); |
|||
} |
|||
|
|||
void SyncRenderingFeatures() |
|||
{ |
|||
if (m_RenderLoop != null && isActiveAndEnabled) |
|||
Shader.globalMaximumLOD = int.MaxValue; |
|||
|
|||
#if UNITY_EDITOR
|
|||
if (m_RenderLoop != null && isActiveAndEnabled) |
|||
UnityEditor.SupportedRenderingFeatures.active = m_RenderLoop.GetSupportedRenderingFeatures(); |
|||
else |
|||
UnityEditor.SupportedRenderingFeatures.active = UnityEditor.SupportedRenderingFeatures.Default; |
|||
#endif
|
|||
} |
|||
|
|||
void OnDisable() |
|||
{ |
|||
RenderLoop.renderLoopDelegate -= Render; |
|||
Shader.globalMaximumLOD = legacyRenderLoopMaxShaderLOD; |
|||
|
|||
#if UNITY_EDITOR
|
|||
UnityEditor.SupportedRenderingFeatures.active = UnityEditor.SupportedRenderingFeatures.Default; |
|||
#endif
|
|||
} |
|||
|
|||
bool Render(Camera[] cameras, RenderLoop loop) |
|||
{ |
|||
if (m_RenderLoop == null) |
|||
return false; |
|||
|
|||
#if UNITY_EDITOR
|
|||
if (m_AssetVersion != s_GlobalAssetVersion) |
|||
{ |
|||
m_AssetVersion = s_GlobalAssetVersion; |
|||
m_RenderLoop.Rebuild(); |
|||
} |
|||
#endif
|
|||
|
|||
m_RenderLoop.Render(cameras, loop); |
|||
return true; |
|||
} |
|||
|
|||
#if UNITY_EDITOR
|
|||
// Temporary hack to allow compute shader reloading
|
|||
internal class AssetReloader : UnityEditor.AssetPostprocessor |
|||
{ |
|||
static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths) |
|||
{ |
|||
foreach (var str in importedAssets) |
|||
{ |
|||
if (str.EndsWith(".compute")) |
|||
{ |
|||
s_GlobalAssetVersion++; |
|||
break; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
static int s_GlobalAssetVersion = 0; |
|||
int m_AssetVersion = 0; |
|||
#endif
|
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 92bb16b4ee20841929b24d6bd771738d |
|||
timeCreated: 1467028218 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
撰写
预览
正在加载...
取消
保存
Reference in new issue