浏览代码

GetSupportedRenderingFeatures now figures out what the render loop supports, and changes UI accordingly.

/main
Joachim Ante 8 年前
当前提交
e552280d
共有 4 个文件被更改,包括 46 次插入6 次删除
  1. 11
      Assets/ScriptableRenderLoop/ForwardRenderLoop/ForwardRenderLoop.cs
  2. 4
      Assets/ScriptableRenderLoop/ScriptableRenderLoop.cs
  3. 33
      Assets/ScriptableRenderLoop/ScriptableRenderLoopPicker.cs
  4. 4
      Assets/TestScenes/ForwardRenderLoop/ForwardRenderLoop.unity

11
Assets/ScriptableRenderLoop/ForwardRenderLoop/ForwardRenderLoop.cs


// Post effects
}
#if UNITY_EDITOR
public override UnityEditor.SupportedRenderingFeatures GetSupportedRenderingFeatures()
{
var features = new UnityEditor.SupportedRenderingFeatures();
features.reflectionProbe = UnityEditor.SupportedRenderingFeatures.ReflectionProbe.Rotation;
return features;
}
#endif
}
}

4
Assets/ScriptableRenderLoop/ScriptableRenderLoop.cs


public abstract class ScriptableRenderLoop : ScriptableObject
{
public abstract void Render(Camera[] cameras, RenderLoop renderLoop);
#if UNITY_EDITOR
public virtual UnityEditor.SupportedRenderingFeatures GetSupportedRenderingFeatures() { return new UnityEditor.SupportedRenderingFeatures(); }
#endif
}
}

33
Assets/ScriptableRenderLoop/ScriptableRenderLoopPicker.cs


[ExecuteInEditMode]
public class ScriptableRenderLoopPicker : MonoBehaviour
{
public ScriptableRenderLoop renderLoop;
public ScriptableRenderLoop renderloop
{
get { return m_RenderLoop; }
set { m_RenderLoop = value; }
}
[SerializeField]
private ScriptableRenderLoop m_RenderLoop;
SyncRenderingFeatures();
}
void OnValidate()
{
SyncRenderingFeatures();
}
void SyncRenderingFeatures ()
{
if (m_RenderLoop != null && isActiveAndEnabled)
UnityEditor.SupportedRenderingFeatures.active = m_RenderLoop.GetSupportedRenderingFeatures();
else
UnityEditor.SupportedRenderingFeatures.active = UnityEditor.SupportedRenderingFeatures.Default;
#if UNITY_EDITOR
UnityEditor.SupportedRenderingFeatures.active = UnityEditor.SupportedRenderingFeatures.Default;
#endif
if (renderLoop == null)
if (m_RenderLoop == null)
renderLoop.Render (cameras, loop);
m_RenderLoop.Render (cameras, loop);
}
}

4
Assets/TestScenes/ForwardRenderLoop/ForwardRenderLoop.unity


m_Script: {fileID: 11500000, guid: 92bb16b4ee20841929b24d6bd771738d, type: 3}
m_Name:
m_EditorClassIdentifier:
renderLoop: {fileID: 11400000, guid: 873753be6b0da44d58b061c5ec3d12bc, type: 2}
m_RenderLoop: {fileID: 11400000, guid: 873753be6b0da44d58b061c5ec3d12bc, type: 2}
--- !u!1 &1758207072
GameObject:
m_ObjectHideFlags: 0

m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1810843056}
m_LocalRotation: {x: -0.26871023, y: -0.31149623, z: 0.872998, w: 0.26199108}
m_LocalRotation: {x: -0.26871026, y: -0.31149626, z: 0.87299806, w: 0.2619911}
m_LocalPosition: {x: 28.75, y: 9.26, z: 7.88}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []

正在加载...
取消
保存