您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
36 行
971 B
36 行
971 B
using System;
|
|
using UnityEngine;
|
|
|
|
namespace UnityEditor.Recorder
|
|
{
|
|
class TextureFlipper : IDisposable
|
|
{
|
|
RenderTexture m_WorkTexture;
|
|
|
|
internal void Flip(RenderTexture target)
|
|
{
|
|
if (m_WorkTexture == null || m_WorkTexture.width != target.width || m_WorkTexture.height != target.height)
|
|
{
|
|
UnityHelpers.Destroy(m_WorkTexture);
|
|
m_WorkTexture = new RenderTexture(target);
|
|
}
|
|
|
|
var sRGBWrite = GL.sRGBWrite;
|
|
GL.sRGBWrite = PlayerSettings.colorSpace == ColorSpace.Linear;
|
|
|
|
Graphics.Blit(target, m_WorkTexture, new Vector2(1.0f, -1.0f), new Vector2(0.0f, 1.0f));
|
|
Graphics.Blit(m_WorkTexture, target);
|
|
|
|
|
|
|
|
GL.sRGBWrite = sRGBWrite;
|
|
}
|
|
|
|
public void Dispose()
|
|
{
|
|
UnityHelpers.Destroy(m_WorkTexture);
|
|
m_WorkTexture = null;
|
|
}
|
|
|
|
}
|
|
}
|