com.github.asus4.texture-source 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -39,6 +39,17 @@ namespace TextureSource
|
|
|
39
39
|
public bool DidUpdateThisFrame => activeSource.DidUpdateThisFrame;
|
|
40
40
|
public Texture Texture => activeSource.Texture;
|
|
41
41
|
|
|
42
|
+
public BaseTextureSource Source
|
|
43
|
+
{
|
|
44
|
+
get => source;
|
|
45
|
+
set => source = value;
|
|
46
|
+
}
|
|
47
|
+
public BaseTextureSource SourceForEditor
|
|
48
|
+
{
|
|
49
|
+
get => sourceForEditor;
|
|
50
|
+
set => sourceForEditor = value;
|
|
51
|
+
}
|
|
52
|
+
|
|
42
53
|
private void OnEnable()
|
|
43
54
|
{
|
|
44
55
|
activeSource = sourceForEditor != null && Application.isEditor
|
|
@@ -57,12 +57,48 @@ namespace TextureSource
|
|
|
57
57
|
private int lastUpdatedFrame = -1;
|
|
58
58
|
private bool isFrontFacing;
|
|
59
59
|
|
|
60
|
+
public WebCamKindFlag KindFilter
|
|
61
|
+
{
|
|
62
|
+
get => kindFilter;
|
|
63
|
+
set => kindFilter = value;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
public FacingFlag FacingFilter
|
|
67
|
+
{
|
|
68
|
+
get => facingFilter;
|
|
69
|
+
set => facingFilter = value;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
public Vector2Int Resolution
|
|
73
|
+
{
|
|
74
|
+
get => resolution;
|
|
75
|
+
set => resolution = value;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
public bool IsFrontFacing => isFrontFacing;
|
|
79
|
+
|
|
80
|
+
public int FrameRate
|
|
81
|
+
{
|
|
82
|
+
get => frameRate;
|
|
83
|
+
set => frameRate = value;
|
|
84
|
+
}
|
|
85
|
+
|
|
60
86
|
public override void Start()
|
|
61
87
|
{
|
|
62
88
|
devices = WebCamTexture.devices.Where(IsMatchFilter).ToArray();
|
|
63
89
|
StartCamera(currentIndex);
|
|
64
90
|
}
|
|
65
91
|
|
|
92
|
+
private void StartCamera(int index)
|
|
93
|
+
{
|
|
94
|
+
Stop();
|
|
95
|
+
WebCamDevice device = devices[index];
|
|
96
|
+
webCamTexture = new WebCamTexture(device.name, resolution.x, resolution.y, frameRate);
|
|
97
|
+
webCamTexture.Play();
|
|
98
|
+
isFrontFacing = device.isFrontFacing;
|
|
99
|
+
lastUpdatedFrame = -1;
|
|
100
|
+
}
|
|
101
|
+
|
|
66
102
|
public override void Stop()
|
|
67
103
|
{
|
|
68
104
|
if (webCamTexture != null)
|
|
@@ -80,17 +116,6 @@ namespace TextureSource
|
|
|
80
116
|
StartCamera(currentIndex);
|
|
81
117
|
}
|
|
82
118
|
|
|
83
|
-
private void StartCamera(int index)
|
|
84
|
-
{
|
|
85
|
-
Stop();
|
|
86
|
-
WebCamDevice device = devices[index];
|
|
87
|
-
webCamTexture = new WebCamTexture(device.name, resolution.x, resolution.y, frameRate);
|
|
88
|
-
webCamTexture.Play();
|
|
89
|
-
isFrontFacing = device.isFrontFacing;
|
|
90
|
-
lastUpdatedFrame = -1;
|
|
91
|
-
Debug.Log($"Started camera:{device.name}");
|
|
92
|
-
}
|
|
93
|
-
|
|
94
119
|
private RenderTexture NormalizeWebCam()
|
|
95
120
|
{
|
|
96
121
|
if (webCamTexture == null)
|