You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
1.1 KiB
C#
40 lines
1.1 KiB
C#
using UnityEngine;
|
|
|
|
namespace Game
|
|
{
|
|
public class GameCamera : MonoBehaviour
|
|
{
|
|
public Material material;
|
|
private RenderTexture _myRenderTexture;
|
|
private Camera _gameCamera;
|
|
void Start()
|
|
{
|
|
_gameCamera = GetComponent<Camera>();
|
|
}
|
|
void Update()
|
|
{
|
|
}
|
|
void OnRenderImage(RenderTexture source, RenderTexture target)
|
|
{
|
|
if (material)
|
|
{
|
|
Graphics.Blit(source, target, material);
|
|
}
|
|
else
|
|
{
|
|
Graphics.Blit(source, target);
|
|
}
|
|
}
|
|
// void OnPreRender()
|
|
// {
|
|
// myRenderTexture = RenderTexture.GetTemporary(Screen.width, Screen.height, 16);
|
|
// gameCamera.targetTexture = myRenderTexture;
|
|
// }
|
|
// void OnPostRender()
|
|
// {
|
|
// gameCamera.targetTexture = null; //null means framebuffer
|
|
// Graphics.Blit(myRenderTexture, null as RenderTexture, material);
|
|
// RenderTexture.ReleaseTemporary(myRenderTexture);
|
|
// }
|
|
}
|
|
} |