浏览代码

new batcher test scenes updated

/Branch_Batching2
Arnaud Carre 8 年前
当前提交
5b684631
共有 7 个文件被更改,包括 323 次插入56 次删除
  1. 23
      Assets/TestScenes/Common/Scripts/MiniProfiler.cs
  2. 283
      Assets/TestScenes/HDTest/HDRenderLoopTest.unity
  3. 16
      Assets/TestScenes/HDTest/NewBatcherSkin.unity
  4. 43
      Assets/TestScenes/HDTest/NewBatcherTest/Mover.cs
  5. 4
      Assets/TestScenes/HDTest/NewBatcherTest/skin/PB_Spider/Models/spider.fbx.meta
  6. 10
      Assets/TestScenes/HDTest/HDRenderLoopTest.meta

23
Assets/TestScenes/Common/Scripts/MiniProfiler.cs


using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Experimental.Rendering;
public bool m_Enable = true;
public bool m_Enable = false;
private int frameCount = 0;
private const int kAverageFrameCount = 64;

new RecorderEntry() { name="RenderLoopDrawCount" },
new RecorderEntry() { name="ShadowLoopDrawCount" },
/*
*/
DebugMenuManager.instance.AddDebugItem<bool>("Arnaud", "Mini-Profiler", () => m_Enable, (value) => m_Enable = (bool)value);
DebugMenuManager.instance.AddDebugItem<bool>("Arnaud", "New Batcher", () => UnityEngine.Experimental.Rendering.ScriptableRenderContext.useNewBatcher, (value) => UnityEngine.Experimental.Rendering.ScriptableRenderContext.useNewBatcher = (bool)value);
for (int i=0;i<recordersList.Length;i++)
{
var sampler = Sampler.Get(recordersList[i].name);

if (m_Enable)
{
/*
GUI.changed = false;
if ( !Application.isEditor )
{
m_UseNewBatcher = GUI.Toggle(new Rect(10, 30, 200, 20), m_UseNewBatcher, "Use new render batch");
if (GUI.changed)
{
UnityEngine.Experimental.Rendering.ScriptableRenderContext.UseNewBatchRenderer(m_UseNewBatcher);
}
}
*/
GUILayout.BeginArea(new Rect(10, 50, w, h), "Mini Profiler", GUI.skin.window);
GUILayout.BeginArea(new Rect(Screen.width - w - 10, 10, w, h), "Mini Profiler", GUI.skin.window);
string sLabel = System.String.Format("<b>{0:F2} FPS ({1:F2}ms)</b>\n", 1.0f / m_AvgDeltaTime, Time.deltaTime * 1000.0f);
for (int i = 0; i < recordersList.Length; i++)
{

283
Assets/TestScenes/HDTest/HDRenderLoopTest.unity
文件差异内容过多而无法显示
查看文件

16
Assets/TestScenes/HDTest/NewBatcherSkin.unity


- component: {fileID: 1612142866}
- component: {fileID: 1612142865}
- component: {fileID: 1612142870}
- component: {fileID: 1612142871}
m_Layer: 0
m_Name: Main Camera
m_TagString: MainCamera

m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1612142864}
m_Enabled: 1
m_ExtensionPropertyValues: []
--- !u!124 &1612142866
Behaviour:
m_ObjectHideFlags: 0

m_Script: {fileID: 11500000, guid: 6dc6eb1c59f1c9745b732f87dafd16f2, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Enable: 1
--- !u!114 &1612142871
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1612142864}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 6dc6eb1c59f1c9745b732f87dafd16f2, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Enable: 1
m_Enable: 0
--- !u!1001 &1623160337
Prefab:
m_ObjectHideFlags: 0

43
Assets/TestScenes/HDTest/NewBatcherTest/Mover.cs


using System.Linq;
using UnityEngine;
using Object = UnityEngine.Object;
using UnityEngine.Experimental.Rendering;
Material[] m_Materials;
private bool m_ChangeColor = false;
void OnEnable()
{
DebugMenuManager.instance.AddDebugItem<bool>("Arnaud", "Pause", () => m_Pause, (value) => m_Pause = (bool)value);
DebugMenuManager.instance.AddDebugItem<bool>("Arnaud", "Change Color", () => m_ChangeColor, (value) => m_ChangeColor = (bool)value);
}
m_Transforms = (Object.FindObjectsOfType(typeof(GameObject)) as GameObject[]).Where(o => o.name.Contains("Cube") || o.name.Contains("Capsule") || o.name.Contains("Cylinder") || o.name.Contains("Sphere")).Select(g=>g.transform).ToArray();
var list = FindObjectsOfType<GameObject>().Where(o => o.name.Contains("Cube") || o.name.Contains("Capsule") || o.name.Contains("Cylinder") || o.name.Contains("Sphere"));
m_Transforms = list.Select(g => g.transform).ToArray();
m_Materials = list.Select(g => g.GetComponent<MeshRenderer>().sharedMaterial).ToArray();
if ( !m_Pause )
if (( !m_Pause ) || (m_ChangeColor))
foreach (Transform t in m_Transforms)
int count = m_Transforms.Length;
for ( int i=0;i<count;i++)
float yd = 2.0f * Mathf.Sin(innerPhase);
t.localPosition = new Vector3(t.localPosition.x, Mathf.Abs(yd), t.localPosition.z);
innerPhase += 0.01f;
if ( !m_Pause )
{
Transform t = m_Transforms[i];
float yd = 2.0f * Mathf.Sin(innerPhase);
t.localPosition = new Vector3(t.localPosition.x, Mathf.Abs(yd), t.localPosition.z);
innerPhase += 0.01f;
}
if ( m_ChangeColor )
{
Color oColor = new Color(Random.value, Random.value, Random.value, 1.0f);
m_Materials[i].SetColor("_BaseColor", oColor);
}
}
void OnGUI()
{
m_Pause = GUI.Toggle(new Rect(10, 10, 200, 20), m_Pause, "Pause");
}
}

4
Assets/TestScenes/HDTest/NewBatcherTest/skin/PB_Spider/Models/spider.fbx.meta


400110: tail_1
400112: tail_2
400114: tail_3
2100000: spider_mat
4300000: mesh
7400000: idle
7400002: walk

9500000: //RootNode
13700000: mesh
externalObjects: {}
autoMapExternalMaterials: 1
materialLocation: 1
animations:
legacyGenerateAnimations: 4
bakeSimulation: 0

10
Assets/TestScenes/HDTest/HDRenderLoopTest.meta


fileFormatVersion: 2
guid: c2d16fcd50b9fda4b908060b0afcd890
folderAsset: yes
timeCreated: 1497448738
licenseType: Pro
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

部分文件因为文件数量过多而无法显示

正在加载...
取消
保存