mirror of
https://github.com/tym1116/BH3.git
synced 2025-12-19 09:54:46 +01:00
38 lines
828 B
C#
38 lines
828 B
C#
using UnityEngine;
|
|
|
|
namespace RenderHeads.Media.AVProVideo
|
|
{
|
|
[ExecuteInEditMode]
|
|
[AddComponentMenu("AVPro Video/Display Background")]
|
|
public class DisplayBackground : MonoBehaviour
|
|
{
|
|
public IMediaProducer _source;
|
|
|
|
public Texture2D _texture;
|
|
|
|
public Material _material;
|
|
|
|
private void OnRenderObject()
|
|
{
|
|
if (!(_material == null) && !(_texture == null))
|
|
{
|
|
Vector4 vector = new Vector4(0f, 0f, 1f, 1f);
|
|
_material.SetPass(0);
|
|
GL.PushMatrix();
|
|
GL.LoadOrtho();
|
|
GL.Begin(7);
|
|
GL.TexCoord2(vector.x, vector.y);
|
|
GL.Vertex3(0f, 0f, 0.1f);
|
|
GL.TexCoord2(vector.z, vector.y);
|
|
GL.Vertex3(1f, 0f, 0.1f);
|
|
GL.TexCoord2(vector.z, vector.w);
|
|
GL.Vertex3(1f, 1f, 0.1f);
|
|
GL.TexCoord2(vector.x, vector.w);
|
|
GL.Vertex3(0f, 1f, 0.1f);
|
|
GL.End();
|
|
GL.PopMatrix();
|
|
}
|
|
}
|
|
}
|
|
}
|