|
@@ -18,10 +18,10 @@ public class XRRGBCamera : SingletonMono<XRRGBCamera>
|
|
|
private void Start()
|
|
|
{
|
|
|
|
|
|
- playCamera();
|
|
|
+
|
|
|
}
|
|
|
|
|
|
- public void playCamera()
|
|
|
+ public void playCamera(int w, int h)
|
|
|
{
|
|
|
if (RGBCamTexture != null && RGBCamTexture.isPlaying)
|
|
|
{
|
|
@@ -39,21 +39,21 @@ public class XRRGBCamera : SingletonMono<XRRGBCamera>
|
|
|
|
|
|
#if UNITY_EDITOR
|
|
|
|
|
|
- RGBCamTexture = new WebCamTexture(devices[0].name, 1280, 720, 30);
|
|
|
+ RGBCamTexture = new WebCamTexture(devices[0].name, w, h, 30);
|
|
|
Debug.Log("开启摄像头" + devices[0].name);
|
|
|
#else
|
|
|
|
|
|
- RGBCamTexture = new WebCamTexture(devices[2].name, 1280, 720, 30);
|
|
|
+ RGBCamTexture = new WebCamTexture(devices[2].name, w, h, 30);
|
|
|
Debug.Log("开启摄像头" + devices[2].name);
|
|
|
#endif
|
|
|
|
|
|
|
|
|
RGBCamTexture.Play();
|
|
|
CaptureImage = RGBCamTexture;
|
|
|
- if (this.GetComponent<RawImage>()!=null)
|
|
|
+ if (this.GetComponent<RawImage>() != null)
|
|
|
{
|
|
|
this.GetComponent<RawImage>().texture = CaptureImage;
|
|
|
- this.GetComponent<RawImage>().transform.localEulerAngles = new Vector3(0,0,0);
|
|
|
+ this.GetComponent<RawImage>().transform.localEulerAngles = new Vector3(0, 0, 0);
|
|
|
}
|
|
|
if (this.GetComponent<MeshRenderer>() != null)
|
|
|
{
|