Skip to content

Commit 8cde9b5

Browse files
committed
Update to Unity 2018.1.1f1
1 parent 92417ee commit 8cde9b5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+2034
-563
lines changed

Assets/Standard Assets/Editor/ImageEffects/BloomAndFlaresEditor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public override void OnInspectorGUI () {
7777
// display info text when screen blend mode cannot be used
7878
Camera cam = (target as BloomAndFlares).GetComponent<Camera>();
7979
if (cam != null) {
80-
if (screenBlendMode.enumValueIndex==0 && ((cam.hdr && hdr.enumValueIndex==0) || (hdr.enumValueIndex==1))) {
80+
if (screenBlendMode.enumValueIndex==0 && ((cam.allowHDR && hdr.enumValueIndex==0) || (hdr.enumValueIndex==1))) {
8181
EditorGUILayout.HelpBox("Screen blend is not supported in HDR. Using 'Add' instead.", MessageType.Info);
8282
}
8383
}

Assets/Standard Assets/Editor/ImageEffects/BloomEditor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public override void OnInspectorGUI () {
8585
// display info text when screen blend mode cannot be used
8686
Camera cam = (target as Bloom).GetComponent<Camera>();
8787
if (cam != null) {
88-
if (screenBlendMode.enumValueIndex==0 && ((cam.hdr && hdr.enumValueIndex==0) || (hdr.enumValueIndex==1))) {
88+
if (screenBlendMode.enumValueIndex==0 && ((cam.allowHDR && hdr.enumValueIndex==0) || (hdr.enumValueIndex==1))) {
8989
EditorGUILayout.HelpBox("Screen blend is not supported in HDR. Using 'Add' instead.", MessageType.Info);
9090
}
9191
}

Assets/Standard Assets/Editor/ImageEffects/TonemappingEditor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public override void OnInspectorGUI () {
4242

4343
Camera cam = (target as Tonemapping).GetComponent<Camera>();
4444
if (cam != null) {
45-
if (!cam.hdr) {
45+
if (!cam.allowHDR) {
4646
EditorGUILayout.HelpBox("The camera is not HDR enabled. This will likely break the Tonemapper.", MessageType.Warning);
4747
}
4848
else if (!(target as Tonemapping).validRenderTextureFormat) {

Assets/Standard Assets/Effects/ImageEffects/Scripts/Bloom.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public void OnRenderImage (RenderTexture source, RenderTexture destination)
106106

107107
doHdr = false;
108108
if (hdr == HDRBloomMode.Auto)
109-
doHdr = source.format == RenderTextureFormat.ARGBHalf && GetComponent<Camera>().hdr;
109+
doHdr = source.format == RenderTextureFormat.ARGBHalf && GetComponent<Camera>().allowHDR;
110110
else {
111111
doHdr = hdr == HDRBloomMode.On;
112112
}

Assets/Standard Assets/Effects/ImageEffects/Scripts/BloomAndFlares.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ void OnRenderImage(RenderTexture source, RenderTexture destination)
109109

110110
doHdr = false;
111111
if (hdr == HDRBloomMode.Auto)
112-
doHdr = source.format == RenderTextureFormat.ARGBHalf && GetComponent<Camera>().hdr;
112+
doHdr = source.format == RenderTextureFormat.ARGBHalf && GetComponent<Camera>().allowHDR;
113113
else
114114
{
115115
doHdr = hdr == HDRBloomMode.On;

Assets/Standard Assets/Effects/ImageEffects/Scripts/SunShafts.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ void OnRenderImage (RenderTexture source, RenderTexture destination) {
9090
sunShaftsMaterial.SetVector ("_SunThreshold", sunThreshold);
9191

9292
if (!useDepthTexture) {
93-
var format= GetComponent<Camera>().hdr ? RenderTextureFormat.DefaultHDR: RenderTextureFormat.Default;
93+
var format= GetComponent<Camera>().allowHDR ? RenderTextureFormat.DefaultHDR: RenderTextureFormat.Default;
9494
RenderTexture tmpBuffer = RenderTexture.GetTemporary (source.width, source.height, 0, format);
9595
RenderTexture.active = tmpBuffer;
9696
GL.ClearWithSkybox (false, GetComponent<Camera>());

Assets/Unity Technologies/Recorder/Extensions/MovieRecorder/Audio.meta

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/Unity Technologies/Recorder/Extensions/MovieRecorder/Audio/Editor.meta

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 175 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,175 @@
1+
using System;
2+
using UnityEngine;
3+
#if UNITY_EDITOR
4+
using System.Reflection;
5+
using UnityEditor;
6+
using UnityEditorInternal;
7+
8+
#endif
9+
#if UNITY_2018_1_OR_NEWER
10+
using Unity.Collections;
11+
#else
12+
using UnityEngine.Collections;
13+
#endif
14+
using UnityEngine.Recorder;
15+
16+
namespace UnityEditor.Recorder.Input
17+
{
18+
class AudioRenderer
19+
{
20+
private static MethodInfo m_StartMethod;
21+
private static MethodInfo m_StopMethod;
22+
private static MethodInfo m_GetSampleCountForCaptureFrameMethod;
23+
private static MethodInfo m_RenderMethod;
24+
25+
static AudioRenderer()
26+
{
27+
var className = "UnityEngine.AudioRenderer";
28+
var dllName = "UnityEngine";
29+
var audioRecorderType = Type.GetType(className + ", " + dllName);
30+
if (audioRecorderType == null)
31+
{
32+
Debug.Log("AudioInput could not find " + className + " type in " + dllName);
33+
return;
34+
}
35+
m_StartMethod = audioRecorderType.GetMethod("Start");
36+
m_StopMethod = audioRecorderType.GetMethod("Stop");
37+
m_GetSampleCountForCaptureFrameMethod =
38+
audioRecorderType.GetMethod("GetSampleCountForCaptureFrame");
39+
m_RenderMethod = audioRecorderType.GetMethod("Render");
40+
}
41+
42+
static public void Start()
43+
{
44+
m_StartMethod.Invoke(null, null);
45+
}
46+
47+
static public void Stop()
48+
{
49+
m_StopMethod.Invoke(null, null);
50+
}
51+
52+
static public uint GetSampleCountForCaptureFrame()
53+
{
54+
var count = (int)m_GetSampleCountForCaptureFrameMethod.Invoke(null, null);
55+
return (uint)count;
56+
}
57+
58+
static public void Render(NativeArray<float> buffer)
59+
{
60+
m_RenderMethod.Invoke(null, new object[] { buffer });
61+
}
62+
}
63+
64+
public class AudioInput : RecorderInput
65+
{
66+
private class BufferManager : IDisposable
67+
{
68+
private NativeArray<float>[] m_Buffers;
69+
70+
public BufferManager(ushort bufferCount, uint sampleFrameCount, ushort channelCount)
71+
{
72+
m_Buffers = new NativeArray<float>[bufferCount];
73+
for (int i = 0; i < m_Buffers.Length; ++i)
74+
m_Buffers[i] = new NativeArray<float>((int)sampleFrameCount * (int)channelCount, Allocator.Temp);
75+
}
76+
77+
public NativeArray<float> GetBuffer(int index)
78+
{
79+
return m_Buffers[index];
80+
}
81+
82+
public void Dispose()
83+
{
84+
foreach (var a in m_Buffers)
85+
a.Dispose();
86+
}
87+
}
88+
89+
public ushort channelCount { get { return m_ChannelCount; } }
90+
private ushort m_ChannelCount;
91+
public int sampleRate { get { return AudioSettings.outputSampleRate; } }
92+
public NativeArray<float> mainBuffer { get { return m_BufferManager.GetBuffer(0); } }
93+
public NativeArray<float> GetMixerGroupBuffer(int n)
94+
{ return m_BufferManager.GetBuffer(n + 1); }
95+
private BufferManager m_BufferManager;
96+
97+
public AudioInputSettings audioSettings
98+
{ get { return (AudioInputSettings)settings; } }
99+
100+
public override void BeginRecording(RecordingSession session)
101+
{
102+
m_ChannelCount = new Func<ushort>(() => {
103+
switch (AudioSettings.speakerMode)
104+
{
105+
case AudioSpeakerMode.Mono: return 1;
106+
case AudioSpeakerMode.Stereo: return 2;
107+
case AudioSpeakerMode.Quad: return 4;
108+
case AudioSpeakerMode.Surround: return 5;
109+
case AudioSpeakerMode.Mode5point1: return 6;
110+
case AudioSpeakerMode.Mode7point1: return 7;
111+
case AudioSpeakerMode.Prologic: return 2;
112+
default: return 1;
113+
}
114+
})();
115+
116+
if (Verbose.enabled)
117+
Debug.Log(string.Format(
118+
"AudioInput.BeginRecording for capture frame rate {0}", Time.captureFramerate));
119+
120+
if (audioSettings.m_PreserveAudio)
121+
AudioRenderer.Start();
122+
}
123+
124+
public override void NewFrameReady(RecordingSession session)
125+
{
126+
if (!audioSettings.m_PreserveAudio)
127+
return;
128+
129+
var sampleFrameCount = (uint)AudioRenderer.GetSampleCountForCaptureFrame();
130+
if (Verbose.enabled)
131+
Debug.Log(string.Format("AudioInput.NewFrameReady {0} audio sample frames @ {1} ch",
132+
sampleFrameCount, m_ChannelCount));
133+
134+
ushort bufferCount =
135+
#if RECORD_AUDIO_MIXERS
136+
(ushort)(audioSettings.m_AudioMixerGroups.Length + 1)
137+
#else
138+
1
139+
#endif
140+
;
141+
142+
m_BufferManager = new BufferManager(bufferCount, sampleFrameCount, m_ChannelCount);
143+
var mainBuffer = m_BufferManager.GetBuffer(0);
144+
145+
#if RECORD_AUDIO_MIXERS
146+
for (int n = 1; n < bufferCount; n++)
147+
{
148+
var group = audioSettings.m_AudioMixerGroups[n - 1];
149+
if (group.m_MixerGroup == null)
150+
continue;
151+
152+
var buffer = m_BufferManager.GetBuffer(n);
153+
AudioRenderer.AddMixerGroupRecorder(group.m_MixerGroup, buffer, group.m_Isolate);
154+
}
155+
#endif
156+
157+
AudioRenderer.Render(mainBuffer);
158+
}
159+
160+
public override void FrameDone(RecordingSession session)
161+
{
162+
if (!audioSettings.m_PreserveAudio)
163+
return;
164+
165+
m_BufferManager.Dispose();
166+
m_BufferManager = null;
167+
}
168+
169+
public override void EndRecording(RecordingSession session)
170+
{
171+
if (audioSettings.m_PreserveAudio)
172+
AudioRenderer.Stop();
173+
}
174+
}
175+
}

Assets/Unity Technologies/Recorder/Extensions/MovieRecorder/Audio/Editor/AudioInput.cs.meta

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)