Semi-working fade into warehouse by trigger press

This commit is contained in:
2016-05-19 00:35:30 +02:00
parent ce46120e5a
commit cdf40b852e
12 changed files with 140 additions and 39 deletions
+16 -1
View File
@@ -1,12 +1,21 @@
using UnityEngine;
using System.Collections;
using Valve.VR;
public class CameraFade : MonoBehaviour {
public RenderTexture BlendTextureLeft;
public RenderTexture BlendTextureRight;
private float alpha = 0.0F;
static Material blitMaterial;
// Use this for initialization
void Start () {
if (!blitMaterial) {
blitMaterial = new Material(Shader.Find("Custom/TransparencyBitch"));
}
}
// Update is called once per frame
@@ -16,6 +25,12 @@ public class CameraFade : MonoBehaviour {
}
void OnRenderImage(RenderTexture src, RenderTexture dest) {
blitMaterial.SetFloat("_Ratio", alpha);
if (SteamVR_Render.eye == EVREye.Eye_Left) {
blitMaterial.SetTexture("_BlendTex", BlendTextureLeft);
} else {
blitMaterial.SetTexture("_BlendTex", BlendTextureRight);
}
Graphics.Blit(src, dest, blitMaterial);
}
}