浏览代码
Make changes based on joachims feedback.
Make changes based on joachims feedback.
-Split Asset / created instance more cleanly. -Asset provides an RenderLoop instance that can be used for rendering -Remove data store (implicitly the loop instance now)/main
Tim Cooper
8 年前
当前提交
5b39107f
共有 11 个文件被更改,包括 197 次插入 和 233 次删除
-
99Assets/BasicRenderLoopTutorial/BasicRenderLoop.cs
-
2Assets/Editor/Tests/RenderloopTests/CullResultsTest.cs
-
26Assets/Editor/Tests/RenderloopTests/RenderloopTestFixture.cs
-
2Assets/ScriptableRenderLoop/HDRenderLoop/Editor/HDRenderLoopInspector.cs
-
80Assets/ScriptableRenderLoop/HDRenderLoop/HDRenderLoop.cs
-
4Assets/ScriptableRenderLoop/HDRenderLoop/Utilities.cs
-
76Assets/ScriptableRenderLoop/core/RenderPipeline.cs
-
80Assets/ScriptableRenderLoop/fptl/FptlLighting.cs
-
9Assets/ScriptableRenderLoop/common/CubeToSpherical.shader.meta
-
12Assets/ScriptableRenderLoop/core/RenderingDataStore.cs.meta
-
40Assets/ScriptableRenderLoop/core/RenderingDataStore.cs
|
|||
using System; |
|||
public abstract class RenderPipeline : BaseRenderPipeline |
|||
{ |
|||
private readonly HashSet<IScriptableRenderDataStore> m_AssociatedDataStores = new HashSet<IScriptableRenderDataStore>(); |
|||
private ICameraProvider m_CameraProvider; |
|||
|
|||
public override ICameraProvider cameraProvider |
|||
{ |
|||
get |
|||
{ |
|||
if (m_CameraProvider == null) |
|||
m_CameraProvider = ConstructCameraProvider(); |
|||
|
|||
return m_CameraProvider; |
|||
} |
|||
set { m_CameraProvider = value; } |
|||
} |
|||
|
|||
public override void Render(ScriptableRenderContext renderContext, IScriptableRenderDataStore dataStore) |
|||
{ |
|||
if (dataStore == null) |
|||
throw new ArgumentException(string.Format("Null DataStore has been passed into pipe {0}", this)); |
|||
|
|||
if (dataStore.owner == null) |
|||
throw new ArgumentException(string.Format("DataStore owner is null. It needs o be owned by loop {0}", this)); |
|||
public abstract class RenderPipeline : BaseRenderPipeline |
|||
{ |
|||
private ICameraProvider m_CameraProvider; |
|||
if (dataStore.owner != null && !ReferenceEquals(dataStore.owner, this)) |
|||
throw new ArgumentException(string.Format("DataStore {0} has been passed into pipe {1}, but is owned by {2}", dataStore, this, dataStore.owner)); |
|||
|
|||
m_AssociatedDataStores.Add(dataStore); |
|||
dataStore.Build(); |
|||
} |
|||
|
|||
public override void ClearCachedData() |
|||
{ |
|||
foreach (var store in m_AssociatedDataStores) |
|||
store.Cleanup(); |
|||
public override ICameraProvider cameraProvider |
|||
{ |
|||
get |
|||
{ |
|||
if (m_CameraProvider == null) |
|||
m_CameraProvider = ConstructCameraProvider(); |
|||
m_AssociatedDataStores.Clear(); |
|||
} |
|||
return m_CameraProvider; |
|||
} |
|||
set { m_CameraProvider = value; } |
|||
} |
|||
public override ICameraProvider ConstructCameraProvider() |
|||
{ |
|||
return new DefaultCameraProvider(); |
|||
} |
|||
public override ICameraProvider ConstructCameraProvider() |
|||
{ |
|||
return new DefaultCameraProvider(); |
|||
} |
|||
public override IScriptableRenderDataStore ConstructDataStore() |
|||
{ |
|||
return new RenderingDataStore(this); |
|||
} |
|||
|
|||
public static void CleanCameras(IEnumerable<Camera> cameras) |
|||
{ |
|||
foreach (var camera in cameras) |
|||
camera.ClearIntermediateRenderers(); |
|||
} |
|||
} |
|||
public static void CleanCameras(IEnumerable<Camera> cameras) |
|||
{ |
|||
foreach (var camera in cameras) |
|||
camera.ClearIntermediateRenderers(); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 595434cc3b6405246b6cd3086d0b6f7d |
|||
timeCreated: 1482845902 |
|||
licenseType: Pro |
|||
ShaderImporter: |
|||
defaultTextures: [] |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: bd20f7d7bf8c34548b33677973016a96 |
|||
timeCreated: 1483005411 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using UnityEngine.Experimental.Rendering; |
|||
|
|||
namespace UnityEngine.ScriptableRenderPipeline |
|||
{ |
|||
public class RenderingDataStore : IScriptableRenderDataStore |
|||
{ |
|||
private bool m_NeedsBuild = true; |
|||
|
|||
public RenderingDataStore(IRenderPipeline owner) |
|||
{ |
|||
this.owner = owner; |
|||
} |
|||
|
|||
public void Build() |
|||
{ |
|||
if (m_NeedsBuild) |
|||
{ |
|||
InternalBuild(); |
|||
m_NeedsBuild = false; |
|||
} |
|||
} |
|||
|
|||
protected virtual void InternalBuild() |
|||
{} |
|||
|
|||
public void Cleanup() |
|||
{ |
|||
if (!m_NeedsBuild) |
|||
{ |
|||
InternalCleanup(); |
|||
m_NeedsBuild = true; |
|||
} |
|||
} |
|||
|
|||
protected virtual void InternalCleanup() |
|||
{} |
|||
|
|||
public IRenderPipeline owner { get; private set; } |
|||
} |
|||
} |
撰写
预览
正在加载...
取消
保存
Reference in new issue