com.github.asus4.texture-source
Advanced tools
Comparing version
{ | ||
"name": "com.github.asus4.texture-source", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"displayName": "TextureSource", | ||
@@ -5,0 +5,0 @@ "description": "Simplify WebCamera and test video handling for using Computer Vision in Unity", |
# Texture Source | ||
[](https://www.npmjs.com/package/com.github.asus4.texture-source) | ||
TextureSource is a utility that provides a consistent API to get the texture from various sources. | ||
 | ||
## Example API Usage | ||
```c# | ||
using TextureSource; | ||
using UnityEngine; | ||
[RequireComponent(typeof(VirtualTextureSource))] | ||
public class TextureSourceSample: MonoBehaviour | ||
{ | ||
private void Start() | ||
{ | ||
// Listen to OnTexture event from VirtualTextureSource | ||
// Also able to bind in the inspector | ||
if (TryGetComponent(out VirtualTextureSource source)) | ||
{ | ||
source.OnTexture.AddListener(OnTexture); | ||
} | ||
} | ||
private void OnDestroy() | ||
{ | ||
if (TryGetComponent(out VirtualTextureSource source)) | ||
{ | ||
source.OnTexture.RemoveListener(OnTexture); | ||
} | ||
} | ||
public void OnTexture(Texture texture) | ||
{ | ||
// Do whatever 🥳 | ||
// You don't need to think about webcam texture rotation. | ||
} | ||
} | ||
``` | ||
## Install via UPM | ||
@@ -21,3 +60,3 @@ | ||
"dependencies": { | ||
"com.github.asus4.texture-source": "0.2.1", | ||
"com.github.asus4.texture-source": "0.2.2", | ||
...// other dependencies | ||
@@ -34,3 +73,3 @@ } | ||
Then, right-click on the project panel and create the TexureSource scriptable object that you want to use. You can set different sources for the Editor and Runtime. | ||
Then, right-click on the project panel and create the TextureSource scriptable object that you want to use. You can set different sources for the Editor and Runtime. | ||
@@ -41,3 +80,3 @@  | ||
#### WebCam Texture Source | ||
### WebCam Texture Source | ||
@@ -48,3 +87,3 @@ Includes collecting device rotation. | ||
#### Video Texture Source | ||
### Video Texture Source | ||
@@ -55,7 +94,7 @@ Useful when using test videos only in the Editor. | ||
#### AR Foundation Texture Source | ||
### AR Foundation Texture Source | ||
Provides AR camera texture access. It supports both ARCore/ARKit. | ||
 | ||
 | ||
@@ -62,0 +101,0 @@ ## Acknowledgement |
Sorry, the diff of this file is not supported yet
32778
0.93%103
60.94%29
-6.45%