Semi-working fade into warehouse by trigger press
This commit is contained in:
+16
-1
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user