sebastienlagarde 8 年前
当前提交
3e7b5a91
共有 4 个文件被更改,包括 11 次插入26 次删除
  1. 3
      Assets/BasicRenderLoopTutorial/BasicRenderLoop.cs
  2. 6
      Assets/Editor/Tests/RenderloopTests/RenderloopTestFixture.cs
  3. 14
      Assets/ScriptableRenderLoop/HDRenderLoop/HDRenderLoop.cs
  4. 14
      Assets/ScriptableRenderLoop/fptl/FptlLighting.cs

3
Assets/BasicRenderLoopTutorial/BasicRenderLoop.cs


using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Experimental.Rendering;
using UnityEngine.Experimental.ScriptableRenderLoop;
// Very basic scriptable rendering loop example:
// - Use with BasicRenderLoopShader.shader (the loop expects "BasicPass" pass type to exist)

// - This loop also does not setup lightmaps, light probes, reflection probes or light cookies
[ExecuteInEditMode]
public class BasicRenderLoop : ScriptableRenderLoop
public class BasicRenderLoop : RenderPipeline
{
#if UNITY_EDITOR

6
Assets/Editor/Tests/RenderloopTests/RenderloopTestFixture.cs


using UnityEngine.Rendering;
[ExecuteInEditMode]
public class RenderLoopTestFixture : ScriptableRenderLoop
public class RenderLoopTestFixture : RenderPipeline
{
public delegate void TestDelegate(Camera camera, CullResults cullResults, RenderLoop renderLoop);
private static TestDelegate s_Callback;

var sceneCamera = Camera.main;
var camObject = sceneCamera.gameObject;
GraphicsSettings.SetScriptableRenderLoop(m_Instance);
GraphicsSettings.SetRenderPipeline(m_Instance);
s_Callback = renderCallback;
Transform t = camObject.transform;

SceneView.lastActiveSceneView.LookAtDirect(t.position + t.forward * camDist, t.rotation, size);
sceneCamera.Render();
GraphicsSettings.SetScriptableRenderLoop(null);
GraphicsSettings.SetRenderPipeline(null);
}
}

14
Assets/ScriptableRenderLoop/HDRenderLoop/HDRenderLoop.cs


{
[ExecuteInEditMode]
// This HDRenderLoop assume linear lighting. Don't work with gamma.
public partial class HDRenderLoop : ScriptableRenderLoop
public partial class HDRenderLoop : RenderPipeline
{
const string k_HDRenderLoopPath = "Assets/ScriptableRenderLoop/HDRenderLoop/HDRenderLoop.asset";

TextureCache2D m_CookieTexArray;
TextureCacheCubemap m_CubeCookieTexArray;
private void OnEnable()
private void OnValidate()
// TODO: Design workaround for OnValidate being missing on ScriptableObject
Rebuild();
}
private void OnDisable()
{
// TODO: Rework ScriptableRenderLoop Lifecycle
//CleanUp();
}
public override void Rebuild()

Rebuild();
}
public override void CleanUp()
public override void Cleanup()
{
m_LitRenderLoop.OnDisable();
m_SinglePassLightLoop.OnDisable();

14
Assets/ScriptableRenderLoop/fptl/FptlLighting.cs


namespace UnityEngine.Experimental.ScriptableRenderLoop
{
[ExecuteInEditMode]
public class FptlLighting : ScriptableRenderLoop
public class FptlLighting : RenderPipeline
{
#if UNITY_EDITOR
[UnityEditor.MenuItem("Renderloop/CreateRenderLoopFPTL")]

private Texture2D m_LightAttentuationTexture;
private int m_shadowBufferID;
public override void Initialize()
private void OnValidate()
private void OnEnable()
public override void Initialize()
private void OnDisable()
{
// TODO: Rework ScriptableRenderLoop Lifecycle
//CleanUp();
}
public override void CleanUp()
public override void Cleanup()
{
// RenderLoop.renderLoopDelegate -= ExecuteRenderLoop;
if (m_DeferredMaterial) DestroyImmediate(m_DeferredMaterial);

正在加载...
取消
保存