Tim Cooper
8 年前
当前提交
5ce376fd
共有 13 个文件被更改,包括 197 次插入 和 7 次删除
-
3Assets/BasicRenderLoopTutorial/BasicRenderLoop.cs
-
3Assets/Editor/Tests/RenderloopTests/RenderloopTestFixture.cs
-
2Assets/ScriptableRenderLoop/HDRenderLoop/Editor/HDRenderLoopInspector.cs
-
5Assets/ScriptableRenderLoop/HDRenderLoop/HDRenderLoop.cs
-
5Assets/ScriptableRenderLoop/fptl/FptlLighting.cs
-
9Assets/ScriptableRenderLoop/core.meta
-
33Assets/ScriptableRenderLoop/core/DefaultCameraProvider.cs
-
12Assets/ScriptableRenderLoop/core/DefaultCameraProvider.cs.meta
-
63Assets/ScriptableRenderLoop/core/RenderPipeline.cs
-
12Assets/ScriptableRenderLoop/core/RenderPipeline.cs.meta
-
45Assets/ScriptableRenderLoop/core/RenderingDataStore.cs
-
12Assets/ScriptableRenderLoop/core/RenderingDataStore.cs.meta
|
|||
fileFormatVersion: 2 |
|||
guid: 2850f79359a84d84793e8feefa3ebb54 |
|||
folderAsset: yes |
|||
timeCreated: 1483004461 |
|||
licenseType: Pro |
|||
DefaultImporter: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System.Collections.Generic; |
|||
using UnityEngine.Experimental.Rendering; |
|||
|
|||
namespace UnityEngine.ScriptableRenderPipeline |
|||
{ |
|||
public class DefaultCameraProvider : ICameraProvider |
|||
{ |
|||
public Camera overrideCamera { get; set; } |
|||
|
|||
public static void GetCamerasToRenderDefault(List<Camera> cameras) |
|||
{ |
|||
cameras.Clear(); |
|||
foreach (var c in Camera.allCameras) |
|||
{ |
|||
if (c.enabled) |
|||
cameras.Add(c); |
|||
} |
|||
} |
|||
|
|||
public void GetCamerasToRender(List<Camera> cameras) |
|||
{ |
|||
if (overrideCamera != null) |
|||
{ |
|||
cameras.Clear(); |
|||
cameras.Add(overrideCamera); |
|||
} |
|||
else |
|||
{ |
|||
GetCamerasToRenderDefault(cameras); |
|||
} |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 3ac0b0f83d74a194f8578dc2907cacf6 |
|||
timeCreated: 1483007679 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System; |
|||
using System.Collections.Generic; |
|||
using UnityEngine.Experimental.Rendering; |
|||
|
|||
namespace UnityEngine.ScriptableRenderPipeline |
|||
{ |
|||
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("DataStore has been passed into pipe {0}", this)); |
|||
|
|||
if (dataStore.owner == null) |
|||
throw new ArgumentException(string.Format("DataStore owner is not set to {0}", this)); |
|||
|
|||
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 Cleanup() |
|||
{ |
|||
foreach (var store in m_AssociatedDataStores) |
|||
store.Cleanup(); |
|||
|
|||
m_AssociatedDataStores.Clear(); |
|||
} |
|||
|
|||
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(); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 841216767fdff24409a31bd55d2f6f72 |
|||
timeCreated: 1483005410 |
|||
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; } |
|||
|
|||
public T GetRealOwner<T>() where T : IRenderPipeline |
|||
{ |
|||
return (T)owner; |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: bd20f7d7bf8c34548b33677973016a96 |
|||
timeCreated: 1483005411 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
撰写
预览
正在加载...
取消
保存
Reference in new issue