com.github.asus4.texture-source 0.2.1 → 0.2.2

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.
package/README.md CHANGED
@@ -1,7 +1,46 @@
1
1
  # Texture Source
2
2
 
3
+ [![upm](https://img.shields.io/npm/v/com.github.asus4.texture-source?label=upm)](https://www.npmjs.com/package/com.github.asus4.texture-source)
4
+
3
5
  TextureSource is a utility that provides a consistent API to get the texture from various sources.
4
6
 
7
+ ![virtual-texture](https://github.com/asus4/TextureSource/assets/357497/e52f80d2-b1be-4cfa-81f7-76cdafe271bc)
8
+
9
+ ## Example API Usage
10
+
11
+ ```c#
12
+ using TextureSource;
13
+ using UnityEngine;
14
+
15
+ [RequireComponent(typeof(VirtualTextureSource))]
16
+ public class TextureSourceSample: MonoBehaviour
17
+ {
18
+ private void Start()
19
+ {
20
+ // Listen to OnTexture event from VirtualTextureSource
21
+ // Also able to bind in the inspector
22
+ if (TryGetComponent(out VirtualTextureSource source))
23
+ {
24
+ source.OnTexture.AddListener(OnTexture);
25
+ }
26
+ }
27
+
28
+ private void OnDestroy()
29
+ {
30
+ if (TryGetComponent(out VirtualTextureSource source))
31
+ {
32
+ source.OnTexture.RemoveListener(OnTexture);
33
+ }
34
+ }
35
+
36
+ public void OnTexture(Texture texture)
37
+ {
38
+ // Do whatever 🥳
39
+ // You don't need to think about webcam texture rotation.
40
+ }
41
+ }
42
+ ```
43
+
5
44
  ## Install via UPM
6
45
 
7
46
  Add the following setting to `Packages/manifest.json`
@@ -18,7 +57,7 @@ Add the following setting to `Packages/manifest.json`
18
57
  }
19
58
  ],
20
59
  "dependencies": {
21
- "com.github.asus4.texture-source": "0.2.1",
60
+ "com.github.asus4.texture-source": "0.2.2",
22
61
  ...// other dependencies
23
62
  }
24
63
  }
@@ -30,29 +69,29 @@ After installing the library, attach `VirtualTextureSource` to the GameObject.
30
69
 
31
70
  ![virtual-texture](https://github.com/asus4/TextureSource/assets/357497/e52f80d2-b1be-4cfa-81f7-76cdafe271bc)
32
71
 
33
- 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.
72
+ 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.
34
73
 
35
74
  ![scriptable-object](https://github.com/asus4/TextureSource/assets/357497/6c4862e2-5298-4f4e-8cd5-076d54d46db8)
36
75
 
37
76
  Currently provides the following sources:
38
77
 
39
- #### WebCam Texture Source
78
+ ### WebCam Texture Source
40
79
 
41
80
  Includes collecting device rotation.
42
81
 
43
82
  ![webcam-texture-source](https://github.com/asus4/TextureSource/assets/357497/407f7372-b214-4ba9-9093-2b39755b905b)
44
83
 
45
- #### Video Texture Source
84
+ ### Video Texture Source
46
85
 
47
86
  Useful when using test videos only in the Editor.
48
87
 
49
88
  ![video-texture-source](https://github.com/asus4/TextureSource/assets/357497/8e38ed1a-d2d8-4e16-9fc4-e5d4c6d0a888)
50
89
 
51
- #### AR Foundation Texture Source
90
+ ### AR Foundation Texture Source
52
91
 
53
92
  Provides AR camera texture access. It supports both ARCore/ARKit.
54
93
 
55
- ![ar-faoundation-texture-source](https://github.com/asus4/TextureSource/assets/357497/5ac82a8a-0554-41a2-b9ef-c03ebd60c6ff)
94
+ ![ar-foundation-texture-source](https://github.com/asus4/TextureSource/assets/357497/5ac82a8a-0554-41a2-b9ef-c03ebd60c6ff)
56
95
 
57
96
  ## Acknowledgement
58
97
 
@@ -1,7 +1,5 @@
1
1
  #pragma kernel TextureTransform
2
2
 
3
- #include "Common.hlsl"
4
-
5
3
  Texture2D<float4> _InputTex;
6
4
  RWTexture2D<float4> _OutputTex;
7
5
  uint2 _OutputTexSize;
@@ -22,10 +20,6 @@ void TextureTransform (uint2 id : SV_DispatchThreadID)
22
20
 
23
21
  float4 c = _InputTex.SampleLevel(linearClampSampler, uv, 0);
24
22
 
25
- #ifndef UNITY_NO_LINEAR_COLORSPACE
26
- c.rgb = FastSRGBToLinear(c.rgb);
27
- #endif // !UNITY_COLORSPACE_GAMMA
28
-
29
23
  _OutputTex[id] = any(uv < 0) || any(uv > 1)
30
24
  ? float4(0, 0, 0, 1)
31
25
  : c;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "com.github.asus4.texture-source",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "displayName": "TextureSource",
5
5
  "description": "Simplify WebCamera and test video handling for using Computer Vision in Unity",
6
6
  "unity": "2020.3",
@@ -1,8 +0,0 @@
1
- // Ported from RenderPipeLine-Core, to support both URP and Built-in RP in one shader
2
- // com.unity.render-pipelines.core copyright © 2020 Unity Technologies ApS
3
- // Licensed under the Unity Companion License for Unity-dependent projects--see [Unity Companion License](http://www.unity3d.com/legal/licenses/Unity_Companion_License).
4
-
5
- float3 FastSRGBToLinear(float3 c)
6
- {
7
- return c * (c * (c * 0.305306011 + 0.682171111) + 0.012522878);
8
- }
@@ -1,7 +0,0 @@
1
- fileFormatVersion: 2
2
- guid: d73b9c13ee77b4bb48a8ff20c23c9709
3
- ShaderIncludeImporter:
4
- externalObjects: {}
5
- userData:
6
- assetBundleName:
7
- assetBundleVariant: