├── .gitignore
├── Assets
├── Mochineko.meta
├── Mochineko
│ ├── StbImageSharpForUnity.Demo.meta
│ ├── StbImageSharpForUnity.Demo
│ │ ├── DemoImageMaterial.mat
│ │ ├── DemoImageMaterial.mat.meta
│ │ ├── GifDecodingDemoScene.unity
│ │ ├── GifDecodingDemoScene.unity.meta
│ │ ├── GifLoaderDemo.cs
│ │ ├── GifLoaderDemo.cs.meta
│ │ ├── ImageDecodingDemoScene.unity
│ │ ├── ImageDecodingDemoScene.unity.meta
│ │ ├── ImageLoaderDemo.cs
│ │ ├── ImageLoaderDemo.cs.meta
│ │ ├── Mochineko.StbImageSharpForUnity.Demo.asmdef
│ │ ├── Mochineko.StbImageSharpForUnity.Demo.asmdef.meta
│ │ ├── NOTICE.md
│ │ ├── NOTICE.md.meta
│ │ ├── SingletonHttpClient.cs
│ │ ├── SingletonHttpClient.cs.meta
│ │ ├── TransformRotator.cs
│ │ ├── TransformRotator.cs.meta
│ │ ├── package.json
│ │ └── package.json.meta
│ ├── StbImageSharpForUnity.meta
│ └── StbImageSharpForUnity
│ │ ├── AnimatedGifDecoder.cs
│ │ ├── AnimatedGifDecoder.cs.meta
│ │ ├── AnimatedTexture.cs
│ │ ├── AnimatedTexture.cs.meta
│ │ ├── AnimatedTextureConverter.cs
│ │ ├── AnimatedTextureConverter.cs.meta
│ │ ├── FormatConverter.cs
│ │ ├── FormatConverter.cs.meta
│ │ ├── ImageDecoder.cs
│ │ ├── ImageDecoder.cs.meta
│ │ ├── Mochineko.StbImageSharpForUnity.asmdef
│ │ ├── Mochineko.StbImageSharpForUnity.asmdef.meta
│ │ ├── NOTICE.md
│ │ ├── NOTICE.md.meta
│ │ ├── TextureConverter.cs
│ │ ├── TextureConverter.cs.meta
│ │ ├── TextureSharedAnimatedTexture.cs
│ │ ├── TextureSharedAnimatedTexture.cs.meta
│ │ ├── TextureSharedAnimatedTextureEnumerable.cs
│ │ ├── TextureSharedAnimatedTextureEnumerable.cs.meta
│ │ ├── TextureSharedAnimatedTextureEnumerator.cs
│ │ ├── TextureSharedAnimatedTextureEnumerator.cs.meta
│ │ ├── package.json
│ │ └── package.json.meta
├── StbImageSharp.meta
└── StbImageSharp
│ ├── AnimatedFrameResult.cs
│ ├── AnimatedFrameResult.cs.meta
│ ├── AnimatedGifEnumerator.cs
│ ├── AnimatedGifEnumerator.cs.meta
│ ├── ColorComponents.cs
│ ├── ColorComponents.cs.meta
│ ├── Hebron.Runtime.meta
│ ├── Hebron.Runtime
│ ├── CRuntime.cs
│ ├── CRuntime.cs.meta
│ ├── MemoryStats.cs
│ ├── MemoryStats.cs.meta
│ ├── Utility.cs
│ └── Utility.cs.meta
│ ├── ImageInfo.cs
│ ├── ImageInfo.cs.meta
│ ├── ImageResult.cs
│ ├── ImageResult.cs.meta
│ ├── ImageResultFloat.cs
│ ├── ImageResultFloat.cs.meta
│ ├── NOTICE.md
│ ├── NOTICE.md.meta
│ ├── StbImage.Generated.Bmp.cs
│ ├── StbImage.Generated.Bmp.cs.meta
│ ├── StbImage.Generated.Common.cs
│ ├── StbImage.Generated.Common.cs.meta
│ ├── StbImage.Generated.Gif.cs
│ ├── StbImage.Generated.Gif.cs.meta
│ ├── StbImage.Generated.Hdr.cs
│ ├── StbImage.Generated.Hdr.cs.meta
│ ├── StbImage.Generated.Jpg.cs
│ ├── StbImage.Generated.Jpg.cs.meta
│ ├── StbImage.Generated.Png.cs
│ ├── StbImage.Generated.Png.cs.meta
│ ├── StbImage.Generated.Psd.cs
│ ├── StbImage.Generated.Psd.cs.meta
│ ├── StbImage.Generated.Tga.cs
│ ├── StbImage.Generated.Tga.cs.meta
│ ├── StbImage.Generated.Zlib.cs
│ ├── StbImage.Generated.Zlib.cs.meta
│ ├── StbImage.cs
│ ├── StbImage.cs.meta
│ ├── StbSharp.StbImageSharp.asmdef
│ ├── StbSharp.StbImageSharp.asmdef.meta
│ ├── package.json
│ └── package.json.meta
├── CHANGELOG.md
├── LICENSE
├── NOTICE.md
├── Packages
├── manifest.json
└── packages-lock.json
├── ProjectSettings
├── AudioManager.asset
├── ClusterInputManager.asset
├── DynamicsManager.asset
├── EditorBuildSettings.asset
├── EditorSettings.asset
├── GraphicsSettings.asset
├── InputManager.asset
├── MemorySettings.asset
├── NavMeshAreas.asset
├── PackageManagerSettings.asset
├── Packages
│ └── com.unity.testtools.codecoverage
│ │ └── Settings.json
├── Physics2DSettings.asset
├── PresetManager.asset
├── ProjectSettings.asset
├── ProjectVersion.txt
├── QualitySettings.asset
├── RiderScriptEditorPersistedState.asset
├── TagManager.asset
├── TimeManager.asset
├── UnityConnectSettings.asset
├── VFXManager.asset
├── VersionControlSettings.asset
├── XRSettings.asset
└── boot.config
└── README.md
/.gitignore:
--------------------------------------------------------------------------------
1 | # This .gitignore file should be placed at the root of your Unity project directory
2 | #
3 | # Get latest from https://github.com/github/gitignore/blob/master/Unity.gitignore
4 | #
5 | /[Ll]ibrary/
6 | /[Tt]emp/
7 | /[Oo]bj/
8 | /[Bb]uild/
9 | /[Bb]uilds/
10 | /[Ll]ogs/
11 | /[Mm]emoryCaptures/
12 |
13 | # Asset meta data should only be ignored when the corresponding asset is also ignored
14 | !/[Aa]ssets/**/*.meta
15 |
16 | # Uncomment this line if you wish to ignore the asset store tools plugin
17 | # /[Aa]ssets/AssetStoreTools*
18 |
19 | # Autogenerated Jetbrains Rider plugin
20 | [Aa]ssets/Plugins/Editor/JetBrains*
21 |
22 | # Visual Studio cache directory
23 | .vs/
24 |
25 | # Gradle cache directory
26 | .gradle/
27 |
28 | # Autogenerated VS/MD/Consulo solution and project files
29 | ExportedObj/
30 | .consulo/
31 | *.csproj
32 | *.unityproj
33 | *.sln
34 | *.suo
35 | *.tmp
36 | *.user
37 | *.userprefs
38 | *.pidb
39 | *.booproj
40 | *.svd
41 | *.pdb
42 | *.mdb
43 | *.opendb
44 | *.VC.db
45 |
46 | # Unity3D generated meta files
47 | *.pidb.meta
48 | *.pdb.meta
49 | *.mdb.meta
50 |
51 | # Unity3D generated file on crash reports
52 | sysinfo.txt
53 |
54 | # Builds
55 | *.apk
56 | *.unitypackage
57 |
58 | # Crashlytics generated file
59 | crashlytics-build.properties
60 |
61 | # UserSettings for Unity
62 | /[Uu]er[Ss]ettings/
63 |
64 | # for macOS
65 | .DS_Store
--------------------------------------------------------------------------------
/Assets/Mochineko.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: ccab25dd1f5cd954585b3bc2c21efea9
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Assets/Mochineko/StbImageSharpForUnity.Demo.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 6845589e2369dde41ad430395b47ba7b
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Assets/Mochineko/StbImageSharpForUnity.Demo/DemoImageMaterial.mat:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!21 &2100000
4 | Material:
5 | serializedVersion: 8
6 | m_ObjectHideFlags: 0
7 | m_CorrespondingSourceObject: {fileID: 0}
8 | m_PrefabInstance: {fileID: 0}
9 | m_PrefabAsset: {fileID: 0}
10 | m_Name: DemoImageMaterial
11 | m_Shader: {fileID: 10752, guid: 0000000000000000f000000000000000, type: 0}
12 | m_ValidKeywords: []
13 | m_InvalidKeywords: []
14 | m_LightmapFlags: 4
15 | m_EnableInstancingVariants: 0
16 | m_DoubleSidedGI: 0
17 | m_CustomRenderQueue: -1
18 | stringTagMap: {}
19 | disabledShaderPasses: []
20 | m_SavedProperties:
21 | serializedVersion: 3
22 | m_TexEnvs:
23 | - _BumpMap:
24 | m_Texture: {fileID: 0}
25 | m_Scale: {x: 1, y: 1}
26 | m_Offset: {x: 0, y: 0}
27 | - _DetailAlbedoMap:
28 | m_Texture: {fileID: 0}
29 | m_Scale: {x: 1, y: 1}
30 | m_Offset: {x: 0, y: 0}
31 | - _DetailMask:
32 | m_Texture: {fileID: 0}
33 | m_Scale: {x: 1, y: 1}
34 | m_Offset: {x: 0, y: 0}
35 | - _DetailNormalMap:
36 | m_Texture: {fileID: 0}
37 | m_Scale: {x: 1, y: 1}
38 | m_Offset: {x: 0, y: 0}
39 | - _EmissionMap:
40 | m_Texture: {fileID: 0}
41 | m_Scale: {x: 1, y: 1}
42 | m_Offset: {x: 0, y: 0}
43 | - _MainTex:
44 | m_Texture: {fileID: 0}
45 | m_Scale: {x: 1, y: 1}
46 | m_Offset: {x: 0, y: 0}
47 | - _MetallicGlossMap:
48 | m_Texture: {fileID: 0}
49 | m_Scale: {x: 1, y: 1}
50 | m_Offset: {x: 0, y: 0}
51 | - _OcclusionMap:
52 | m_Texture: {fileID: 0}
53 | m_Scale: {x: 1, y: 1}
54 | m_Offset: {x: 0, y: 0}
55 | - _ParallaxMap:
56 | m_Texture: {fileID: 0}
57 | m_Scale: {x: 1, y: 1}
58 | m_Offset: {x: 0, y: 0}
59 | m_Ints: []
60 | m_Floats:
61 | - _BumpScale: 1
62 | - _Cutoff: 0.5
63 | - _DetailNormalMapScale: 1
64 | - _DstBlend: 0
65 | - _GlossMapScale: 1
66 | - _Glossiness: 0.5
67 | - _GlossyReflections: 1
68 | - _Metallic: 0
69 | - _Mode: 0
70 | - _OcclusionStrength: 1
71 | - _Parallax: 0.02
72 | - _SmoothnessTextureChannel: 0
73 | - _SpecularHighlights: 1
74 | - _SrcBlend: 1
75 | - _UVSec: 0
76 | - _ZWrite: 1
77 | m_Colors:
78 | - _Color: {r: 1, g: 1, b: 1, a: 1}
79 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
80 | m_BuildTextureStacks: []
81 |
--------------------------------------------------------------------------------
/Assets/Mochineko/StbImageSharpForUnity.Demo/DemoImageMaterial.mat.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 30f658ad6a59ab141addd74098bfb43f
3 | NativeFormatImporter:
4 | externalObjects: {}
5 | mainObjectFileID: 2100000
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Assets/Mochineko/StbImageSharpForUnity.Demo/GifDecodingDemoScene.unity:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!29 &1
4 | OcclusionCullingSettings:
5 | m_ObjectHideFlags: 0
6 | serializedVersion: 2
7 | m_OcclusionBakeSettings:
8 | smallestOccluder: 5
9 | smallestHole: 0.25
10 | backfaceThreshold: 100
11 | m_SceneGUID: 00000000000000000000000000000000
12 | m_OcclusionCullingData: {fileID: 0}
13 | --- !u!104 &2
14 | RenderSettings:
15 | m_ObjectHideFlags: 0
16 | serializedVersion: 9
17 | m_Fog: 0
18 | m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
19 | m_FogMode: 3
20 | m_FogDensity: 0.01
21 | m_LinearFogStart: 0
22 | m_LinearFogEnd: 300
23 | m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
24 | m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
25 | m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
26 | m_AmbientIntensity: 1
27 | m_AmbientMode: 0
28 | m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
29 | m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0}
30 | m_HaloStrength: 0.5
31 | m_FlareStrength: 1
32 | m_FlareFadeSpeed: 3
33 | m_HaloTexture: {fileID: 0}
34 | m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
35 | m_DefaultReflectionMode: 0
36 | m_DefaultReflectionResolution: 128
37 | m_ReflectionBounces: 1
38 | m_ReflectionIntensity: 1
39 | m_CustomReflection: {fileID: 0}
40 | m_Sun: {fileID: 0}
41 | m_IndirectSpecularColor: {r: 0.44671863, g: 0.496575, b: 0.5750147, a: 1}
42 | m_UseRadianceAmbientProbe: 0
43 | --- !u!157 &3
44 | LightmapSettings:
45 | m_ObjectHideFlags: 0
46 | serializedVersion: 12
47 | m_GIWorkflowMode: 1
48 | m_GISettings:
49 | serializedVersion: 2
50 | m_BounceScale: 1
51 | m_IndirectOutputScale: 1
52 | m_AlbedoBoost: 1
53 | m_EnvironmentLightingMode: 0
54 | m_EnableBakedLightmaps: 1
55 | m_EnableRealtimeLightmaps: 0
56 | m_LightmapEditorSettings:
57 | serializedVersion: 12
58 | m_Resolution: 2
59 | m_BakeResolution: 40
60 | m_AtlasSize: 1024
61 | m_AO: 0
62 | m_AOMaxDistance: 1
63 | m_CompAOExponent: 1
64 | m_CompAOExponentDirect: 0
65 | m_ExtractAmbientOcclusion: 0
66 | m_Padding: 2
67 | m_LightmapParameters: {fileID: 0}
68 | m_LightmapsBakeMode: 1
69 | m_TextureCompression: 1
70 | m_FinalGather: 0
71 | m_FinalGatherFiltering: 1
72 | m_FinalGatherRayCount: 256
73 | m_ReflectionCompression: 2
74 | m_MixedBakeMode: 2
75 | m_BakeBackend: 1
76 | m_PVRSampling: 1
77 | m_PVRDirectSampleCount: 32
78 | m_PVRSampleCount: 512
79 | m_PVRBounces: 2
80 | m_PVREnvironmentSampleCount: 256
81 | m_PVREnvironmentReferencePointCount: 2048
82 | m_PVRFilteringMode: 1
83 | m_PVRDenoiserTypeDirect: 1
84 | m_PVRDenoiserTypeIndirect: 1
85 | m_PVRDenoiserTypeAO: 1
86 | m_PVRFilterTypeDirect: 0
87 | m_PVRFilterTypeIndirect: 0
88 | m_PVRFilterTypeAO: 0
89 | m_PVREnvironmentMIS: 1
90 | m_PVRCulling: 1
91 | m_PVRFilteringGaussRadiusDirect: 1
92 | m_PVRFilteringGaussRadiusIndirect: 5
93 | m_PVRFilteringGaussRadiusAO: 2
94 | m_PVRFilteringAtrousPositionSigmaDirect: 0.5
95 | m_PVRFilteringAtrousPositionSigmaIndirect: 2
96 | m_PVRFilteringAtrousPositionSigmaAO: 1
97 | m_ExportTrainingData: 0
98 | m_TrainingDataDestination: TrainingData
99 | m_LightProbeSampleCountMultiplier: 4
100 | m_LightingDataAsset: {fileID: 0}
101 | m_LightingSettings: {fileID: 0}
102 | --- !u!196 &4
103 | NavMeshSettings:
104 | serializedVersion: 2
105 | m_ObjectHideFlags: 0
106 | m_BuildSettings:
107 | serializedVersion: 2
108 | agentTypeID: 0
109 | agentRadius: 0.5
110 | agentHeight: 2
111 | agentSlope: 45
112 | agentClimb: 0.4
113 | ledgeDropHeight: 0
114 | maxJumpAcrossDistance: 0
115 | minRegionArea: 2
116 | manualCellSize: 0
117 | cellSize: 0.16666667
118 | manualTileSize: 0
119 | tileSize: 256
120 | accuratePlacement: 0
121 | maxJobWorkers: 0
122 | preserveTilesOutsideBounds: 0
123 | debug:
124 | m_Flags: 0
125 | m_NavMeshData: {fileID: 0}
126 | --- !u!1 &194390145
127 | GameObject:
128 | m_ObjectHideFlags: 0
129 | m_CorrespondingSourceObject: {fileID: 0}
130 | m_PrefabInstance: {fileID: 0}
131 | m_PrefabAsset: {fileID: 0}
132 | serializedVersion: 6
133 | m_Component:
134 | - component: {fileID: 194390149}
135 | - component: {fileID: 194390148}
136 | - component: {fileID: 194390147}
137 | - component: {fileID: 194390150}
138 | m_Layer: 0
139 | m_Name: RotatingCube
140 | m_TagString: Untagged
141 | m_Icon: {fileID: 0}
142 | m_NavMeshLayer: 0
143 | m_StaticEditorFlags: 0
144 | m_IsActive: 1
145 | --- !u!23 &194390147
146 | MeshRenderer:
147 | m_ObjectHideFlags: 0
148 | m_CorrespondingSourceObject: {fileID: 0}
149 | m_PrefabInstance: {fileID: 0}
150 | m_PrefabAsset: {fileID: 0}
151 | m_GameObject: {fileID: 194390145}
152 | m_Enabled: 1
153 | m_CastShadows: 1
154 | m_ReceiveShadows: 1
155 | m_DynamicOccludee: 1
156 | m_StaticShadowCaster: 0
157 | m_MotionVectors: 1
158 | m_LightProbeUsage: 1
159 | m_ReflectionProbeUsage: 1
160 | m_RayTracingMode: 2
161 | m_RayTraceProcedural: 0
162 | m_RenderingLayerMask: 1
163 | m_RendererPriority: 0
164 | m_Materials:
165 | - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0}
166 | m_StaticBatchInfo:
167 | firstSubMesh: 0
168 | subMeshCount: 0
169 | m_StaticBatchRoot: {fileID: 0}
170 | m_ProbeAnchor: {fileID: 0}
171 | m_LightProbeVolumeOverride: {fileID: 0}
172 | m_ScaleInLightmap: 1
173 | m_ReceiveGI: 1
174 | m_PreserveUVs: 0
175 | m_IgnoreNormalsForChartDetection: 0
176 | m_ImportantGI: 0
177 | m_StitchLightmapSeams: 1
178 | m_SelectedEditorRenderState: 3
179 | m_MinimumChartSize: 4
180 | m_AutoUVMaxDistance: 0.5
181 | m_AutoUVMaxAngle: 89
182 | m_LightmapParameters: {fileID: 0}
183 | m_SortingLayerID: 0
184 | m_SortingLayer: 0
185 | m_SortingOrder: 0
186 | m_AdditionalVertexStreams: {fileID: 0}
187 | --- !u!33 &194390148
188 | MeshFilter:
189 | m_ObjectHideFlags: 0
190 | m_CorrespondingSourceObject: {fileID: 0}
191 | m_PrefabInstance: {fileID: 0}
192 | m_PrefabAsset: {fileID: 0}
193 | m_GameObject: {fileID: 194390145}
194 | m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
195 | --- !u!4 &194390149
196 | Transform:
197 | m_ObjectHideFlags: 0
198 | m_CorrespondingSourceObject: {fileID: 0}
199 | m_PrefabInstance: {fileID: 0}
200 | m_PrefabAsset: {fileID: 0}
201 | m_GameObject: {fileID: 194390145}
202 | m_LocalRotation: {x: 0.9330127, y: 0.25000006, z: 0.25000006, w: 0.06698733}
203 | m_LocalPosition: {x: -1.46, y: 0, z: 0}
204 | m_LocalScale: {x: 1, y: 1, z: 1}
205 | m_ConstrainProportionsScale: 0
206 | m_Children: []
207 | m_Father: {fileID: 0}
208 | m_RootOrder: 2
209 | m_LocalEulerAnglesHint: {x: 0, y: 150, z: 150}
210 | --- !u!114 &194390150
211 | MonoBehaviour:
212 | m_ObjectHideFlags: 0
213 | m_CorrespondingSourceObject: {fileID: 0}
214 | m_PrefabInstance: {fileID: 0}
215 | m_PrefabAsset: {fileID: 0}
216 | m_GameObject: {fileID: 194390145}
217 | m_Enabled: 1
218 | m_EditorHideFlags: 0
219 | m_Script: {fileID: 11500000, guid: 96313211964dec348a8bc1dc590cce8f, type: 3}
220 | m_Name:
221 | m_EditorClassIdentifier:
222 | speed: 45
223 | --- !u!1 &1105053354
224 | GameObject:
225 | m_ObjectHideFlags: 0
226 | m_CorrespondingSourceObject: {fileID: 0}
227 | m_PrefabInstance: {fileID: 0}
228 | m_PrefabAsset: {fileID: 0}
229 | serializedVersion: 6
230 | m_Component:
231 | - component: {fileID: 1105053358}
232 | - component: {fileID: 1105053357}
233 | - component: {fileID: 1105053356}
234 | - component: {fileID: 1105053359}
235 | m_Layer: 0
236 | m_Name: GifDecoder
237 | m_TagString: Untagged
238 | m_Icon: {fileID: 0}
239 | m_NavMeshLayer: 0
240 | m_StaticEditorFlags: 0
241 | m_IsActive: 1
242 | --- !u!23 &1105053356
243 | MeshRenderer:
244 | m_ObjectHideFlags: 0
245 | m_CorrespondingSourceObject: {fileID: 0}
246 | m_PrefabInstance: {fileID: 0}
247 | m_PrefabAsset: {fileID: 0}
248 | m_GameObject: {fileID: 1105053354}
249 | m_Enabled: 1
250 | m_CastShadows: 0
251 | m_ReceiveShadows: 0
252 | m_DynamicOccludee: 1
253 | m_StaticShadowCaster: 0
254 | m_MotionVectors: 1
255 | m_LightProbeUsage: 1
256 | m_ReflectionProbeUsage: 1
257 | m_RayTracingMode: 2
258 | m_RayTraceProcedural: 0
259 | m_RenderingLayerMask: 1
260 | m_RendererPriority: 0
261 | m_Materials:
262 | - {fileID: 2100000, guid: 30f658ad6a59ab141addd74098bfb43f, type: 2}
263 | m_StaticBatchInfo:
264 | firstSubMesh: 0
265 | subMeshCount: 0
266 | m_StaticBatchRoot: {fileID: 0}
267 | m_ProbeAnchor: {fileID: 0}
268 | m_LightProbeVolumeOverride: {fileID: 0}
269 | m_ScaleInLightmap: 1
270 | m_ReceiveGI: 1
271 | m_PreserveUVs: 0
272 | m_IgnoreNormalsForChartDetection: 0
273 | m_ImportantGI: 0
274 | m_StitchLightmapSeams: 1
275 | m_SelectedEditorRenderState: 3
276 | m_MinimumChartSize: 4
277 | m_AutoUVMaxDistance: 0.5
278 | m_AutoUVMaxAngle: 89
279 | m_LightmapParameters: {fileID: 0}
280 | m_SortingLayerID: 0
281 | m_SortingLayer: 0
282 | m_SortingOrder: 0
283 | m_AdditionalVertexStreams: {fileID: 0}
284 | --- !u!33 &1105053357
285 | MeshFilter:
286 | m_ObjectHideFlags: 0
287 | m_CorrespondingSourceObject: {fileID: 0}
288 | m_PrefabInstance: {fileID: 0}
289 | m_PrefabAsset: {fileID: 0}
290 | m_GameObject: {fileID: 1105053354}
291 | m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0}
292 | --- !u!4 &1105053358
293 | Transform:
294 | m_ObjectHideFlags: 0
295 | m_CorrespondingSourceObject: {fileID: 0}
296 | m_PrefabInstance: {fileID: 0}
297 | m_PrefabAsset: {fileID: 0}
298 | m_GameObject: {fileID: 1105053354}
299 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
300 | m_LocalPosition: {x: 1.5, y: 0, z: 0}
301 | m_LocalScale: {x: 2, y: 2, z: 2}
302 | m_ConstrainProportionsScale: 0
303 | m_Children: []
304 | m_Father: {fileID: 0}
305 | m_RootOrder: 3
306 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
307 | --- !u!114 &1105053359
308 | MonoBehaviour:
309 | m_ObjectHideFlags: 0
310 | m_CorrespondingSourceObject: {fileID: 0}
311 | m_PrefabInstance: {fileID: 0}
312 | m_PrefabAsset: {fileID: 0}
313 | m_GameObject: {fileID: 1105053354}
314 | m_Enabled: 1
315 | m_EditorHideFlags: 0
316 | m_Script: {fileID: 11500000, guid: 84bbeb110f1941b99150c728f5a389b1, type: 3}
317 | m_Name:
318 | m_EditorClassIdentifier:
319 | url: https://www.easygifanimator.net/images/samples/eglite.gif
320 | target: {fileID: 1105053356}
321 | --- !u!1 &2083921543
322 | GameObject:
323 | m_ObjectHideFlags: 0
324 | m_CorrespondingSourceObject: {fileID: 0}
325 | m_PrefabInstance: {fileID: 0}
326 | m_PrefabAsset: {fileID: 0}
327 | serializedVersion: 6
328 | m_Component:
329 | - component: {fileID: 2083921545}
330 | - component: {fileID: 2083921544}
331 | m_Layer: 0
332 | m_Name: Directional Light
333 | m_TagString: Untagged
334 | m_Icon: {fileID: 0}
335 | m_NavMeshLayer: 0
336 | m_StaticEditorFlags: 0
337 | m_IsActive: 1
338 | --- !u!108 &2083921544
339 | Light:
340 | m_ObjectHideFlags: 0
341 | m_CorrespondingSourceObject: {fileID: 0}
342 | m_PrefabInstance: {fileID: 0}
343 | m_PrefabAsset: {fileID: 0}
344 | m_GameObject: {fileID: 2083921543}
345 | m_Enabled: 1
346 | serializedVersion: 10
347 | m_Type: 1
348 | m_Shape: 0
349 | m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1}
350 | m_Intensity: 1
351 | m_Range: 10
352 | m_SpotAngle: 30
353 | m_InnerSpotAngle: 21.80208
354 | m_CookieSize: 10
355 | m_Shadows:
356 | m_Type: 2
357 | m_Resolution: -1
358 | m_CustomResolution: -1
359 | m_Strength: 1
360 | m_Bias: 0.05
361 | m_NormalBias: 0.4
362 | m_NearPlane: 0.2
363 | m_CullingMatrixOverride:
364 | e00: 1
365 | e01: 0
366 | e02: 0
367 | e03: 0
368 | e10: 0
369 | e11: 1
370 | e12: 0
371 | e13: 0
372 | e20: 0
373 | e21: 0
374 | e22: 1
375 | e23: 0
376 | e30: 0
377 | e31: 0
378 | e32: 0
379 | e33: 1
380 | m_UseCullingMatrixOverride: 0
381 | m_Cookie: {fileID: 0}
382 | m_DrawHalo: 0
383 | m_Flare: {fileID: 0}
384 | m_RenderMode: 0
385 | m_CullingMask:
386 | serializedVersion: 2
387 | m_Bits: 4294967295
388 | m_RenderingLayerMask: 1
389 | m_Lightmapping: 4
390 | m_LightShadowCasterMode: 0
391 | m_AreaSize: {x: 1, y: 1}
392 | m_BounceIntensity: 1
393 | m_ColorTemperature: 6570
394 | m_UseColorTemperature: 0
395 | m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0}
396 | m_UseBoundingSphereOverride: 0
397 | m_UseViewFrustumForShadowCasterCull: 1
398 | m_ShadowRadius: 0
399 | m_ShadowAngle: 0
400 | --- !u!4 &2083921545
401 | Transform:
402 | m_ObjectHideFlags: 0
403 | m_CorrespondingSourceObject: {fileID: 0}
404 | m_PrefabInstance: {fileID: 0}
405 | m_PrefabAsset: {fileID: 0}
406 | m_GameObject: {fileID: 2083921543}
407 | m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261}
408 | m_LocalPosition: {x: 0, y: 3, z: 0}
409 | m_LocalScale: {x: 1, y: 1, z: 1}
410 | m_ConstrainProportionsScale: 0
411 | m_Children: []
412 | m_Father: {fileID: 0}
413 | m_RootOrder: 1
414 | m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
415 | --- !u!1 &2109907609
416 | GameObject:
417 | m_ObjectHideFlags: 0
418 | m_CorrespondingSourceObject: {fileID: 0}
419 | m_PrefabInstance: {fileID: 0}
420 | m_PrefabAsset: {fileID: 0}
421 | serializedVersion: 6
422 | m_Component:
423 | - component: {fileID: 2109907612}
424 | - component: {fileID: 2109907611}
425 | - component: {fileID: 2109907610}
426 | m_Layer: 0
427 | m_Name: Main Camera
428 | m_TagString: MainCamera
429 | m_Icon: {fileID: 0}
430 | m_NavMeshLayer: 0
431 | m_StaticEditorFlags: 0
432 | m_IsActive: 1
433 | --- !u!81 &2109907610
434 | AudioListener:
435 | m_ObjectHideFlags: 0
436 | m_CorrespondingSourceObject: {fileID: 0}
437 | m_PrefabInstance: {fileID: 0}
438 | m_PrefabAsset: {fileID: 0}
439 | m_GameObject: {fileID: 2109907609}
440 | m_Enabled: 1
441 | --- !u!20 &2109907611
442 | Camera:
443 | m_ObjectHideFlags: 0
444 | m_CorrespondingSourceObject: {fileID: 0}
445 | m_PrefabInstance: {fileID: 0}
446 | m_PrefabAsset: {fileID: 0}
447 | m_GameObject: {fileID: 2109907609}
448 | m_Enabled: 1
449 | serializedVersion: 2
450 | m_ClearFlags: 1
451 | m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
452 | m_projectionMatrixMode: 1
453 | m_GateFitMode: 2
454 | m_FOVAxisMode: 0
455 | m_SensorSize: {x: 36, y: 24}
456 | m_LensShift: {x: 0, y: 0}
457 | m_FocalLength: 50
458 | m_NormalizedViewPortRect:
459 | serializedVersion: 2
460 | x: 0
461 | y: 0
462 | width: 1
463 | height: 1
464 | near clip plane: 0.3
465 | far clip plane: 1000
466 | field of view: 60
467 | orthographic: 0
468 | orthographic size: 5
469 | m_Depth: -1
470 | m_CullingMask:
471 | serializedVersion: 2
472 | m_Bits: 4294967295
473 | m_RenderingPath: -1
474 | m_TargetTexture: {fileID: 0}
475 | m_TargetDisplay: 0
476 | m_TargetEye: 3
477 | m_HDR: 1
478 | m_AllowMSAA: 1
479 | m_AllowDynamicResolution: 0
480 | m_ForceIntoRT: 0
481 | m_OcclusionCulling: 1
482 | m_StereoConvergence: 10
483 | m_StereoSeparation: 0.022
484 | --- !u!4 &2109907612
485 | Transform:
486 | m_ObjectHideFlags: 0
487 | m_CorrespondingSourceObject: {fileID: 0}
488 | m_PrefabInstance: {fileID: 0}
489 | m_PrefabAsset: {fileID: 0}
490 | m_GameObject: {fileID: 2109907609}
491 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
492 | m_LocalPosition: {x: 0, y: 0, z: -3}
493 | m_LocalScale: {x: 1, y: 1, z: 1}
494 | m_ConstrainProportionsScale: 0
495 | m_Children: []
496 | m_Father: {fileID: 0}
497 | m_RootOrder: 0
498 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
499 |
--------------------------------------------------------------------------------
/Assets/Mochineko/StbImageSharpForUnity.Demo/GifDecodingDemoScene.unity.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 23a702bf4cc3ac447aca8e74b08b1f9d
3 | DefaultImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/Assets/Mochineko/StbImageSharpForUnity.Demo/GifLoaderDemo.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.IO;
3 | using System.Threading;
4 | using Cysharp.Threading.Tasks;
5 | using UnityEngine;
6 |
7 | namespace Mochineko.StbImageSharpForUnity.Demo
8 | {
9 | ///
10 | /// A demonstration code of StbImageSharpForUnity loading an GIF image from URL to animated .
11 | ///
12 | internal sealed class GifLoaderDemo : MonoBehaviour
13 | {
14 | [SerializeField] private string url;
15 | [SerializeField] private Renderer target;
16 |
17 | private MemoryStream stream = null;
18 | private CancellationTokenSource cancellationTokenSource = null;
19 |
20 | private void Start()
21 | {
22 | DownloadAndStartAnimationAsync().Forget();
23 | }
24 |
25 | private void OnDestroy()
26 | {
27 | Clear();
28 | }
29 |
30 | private void OnGUI()
31 | {
32 | if (GUILayout.Button("Load"))
33 | {
34 | DownloadAndStartAnimationAsync().Forget();
35 | }
36 |
37 | if (GUILayout.Button("Clear"))
38 | {
39 | Clear();
40 | }
41 | }
42 |
43 | private void Clear()
44 | {
45 | cancellationTokenSource?.Cancel();
46 | cancellationTokenSource = null;
47 | stream?.Dispose();
48 | stream = null;
49 | target.material.mainTexture = null;
50 | }
51 |
52 | private async UniTask DownloadAndStartAnimationAsync()
53 | {
54 | Clear();
55 |
56 | var client = SingletonHttpClient.Instance;
57 |
58 | await UniTask.SwitchToThreadPool();
59 |
60 | var data = await client.GetByteArrayAsync(url);
61 |
62 | stream = new MemoryStream(data);
63 |
64 | await UniTask.SwitchToMainThread();
65 |
66 | cancellationTokenSource = new CancellationTokenSource();
67 |
68 | StartAnimationLoop(stream, cancellationTokenSource.Token).Forget();
69 | }
70 |
71 | private async UniTask StartAnimationLoop(Stream stream, CancellationToken cancellationToken)
72 | {
73 | IEnumerator enumerator = null;
74 |
75 | await UniTask.SwitchToMainThread(cancellationToken);
76 |
77 | target.material.mainTexture = null;
78 |
79 | while (!cancellationToken.IsCancellationRequested)
80 | {
81 | if (enumerator == null)
82 | {
83 | await UniTask.SwitchToThreadPool();
84 |
85 | // Decode GIF on a thread pool.
86 | stream.Seek(offset: 0, origin: 0);
87 | enumerator = AnimatedGifDecoder
88 | .DecodeGifImage(stream)
89 | .ToTextureSharedAnimatedTextures()
90 | .GetEnumerator();
91 |
92 | await UniTask.SwitchToMainThread(cancellationToken);
93 | }
94 |
95 | // NOTE: Call MoveNext() on the main thread.
96 | if (enumerator.MoveNext())
97 | {
98 | var frame = enumerator.Current;
99 |
100 | if (target.material.mainTexture == null)
101 | {
102 | target.material.mainTexture = frame.Texture;
103 | }
104 |
105 | await UniTask.Delay(frame.DelayInMs, DelayType.DeltaTime, PlayerLoopTiming.Update,
106 | cancellationToken);
107 | }
108 | else
109 | {
110 | enumerator.Dispose();
111 | enumerator = null;
112 | }
113 | }
114 |
115 | enumerator?.Dispose();
116 | }
117 | }
118 | }
--------------------------------------------------------------------------------
/Assets/Mochineko/StbImageSharpForUnity.Demo/GifLoaderDemo.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 84bbeb110f1941b99150c728f5a389b1
3 | timeCreated: 1660446790
--------------------------------------------------------------------------------
/Assets/Mochineko/StbImageSharpForUnity.Demo/ImageDecodingDemoScene.unity:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!29 &1
4 | OcclusionCullingSettings:
5 | m_ObjectHideFlags: 0
6 | serializedVersion: 2
7 | m_OcclusionBakeSettings:
8 | smallestOccluder: 5
9 | smallestHole: 0.25
10 | backfaceThreshold: 100
11 | m_SceneGUID: 00000000000000000000000000000000
12 | m_OcclusionCullingData: {fileID: 0}
13 | --- !u!104 &2
14 | RenderSettings:
15 | m_ObjectHideFlags: 0
16 | serializedVersion: 9
17 | m_Fog: 0
18 | m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
19 | m_FogMode: 3
20 | m_FogDensity: 0.01
21 | m_LinearFogStart: 0
22 | m_LinearFogEnd: 300
23 | m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
24 | m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
25 | m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
26 | m_AmbientIntensity: 1
27 | m_AmbientMode: 0
28 | m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
29 | m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0}
30 | m_HaloStrength: 0.5
31 | m_FlareStrength: 1
32 | m_FlareFadeSpeed: 3
33 | m_HaloTexture: {fileID: 0}
34 | m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
35 | m_DefaultReflectionMode: 0
36 | m_DefaultReflectionResolution: 128
37 | m_ReflectionBounces: 1
38 | m_ReflectionIntensity: 1
39 | m_CustomReflection: {fileID: 0}
40 | m_Sun: {fileID: 0}
41 | m_IndirectSpecularColor: {r: 0.44657898, g: 0.4964133, b: 0.5748178, a: 1}
42 | m_UseRadianceAmbientProbe: 0
43 | --- !u!157 &3
44 | LightmapSettings:
45 | m_ObjectHideFlags: 0
46 | serializedVersion: 12
47 | m_GIWorkflowMode: 1
48 | m_GISettings:
49 | serializedVersion: 2
50 | m_BounceScale: 1
51 | m_IndirectOutputScale: 1
52 | m_AlbedoBoost: 1
53 | m_EnvironmentLightingMode: 0
54 | m_EnableBakedLightmaps: 1
55 | m_EnableRealtimeLightmaps: 0
56 | m_LightmapEditorSettings:
57 | serializedVersion: 12
58 | m_Resolution: 2
59 | m_BakeResolution: 40
60 | m_AtlasSize: 1024
61 | m_AO: 0
62 | m_AOMaxDistance: 1
63 | m_CompAOExponent: 1
64 | m_CompAOExponentDirect: 0
65 | m_ExtractAmbientOcclusion: 0
66 | m_Padding: 2
67 | m_LightmapParameters: {fileID: 0}
68 | m_LightmapsBakeMode: 1
69 | m_TextureCompression: 1
70 | m_FinalGather: 0
71 | m_FinalGatherFiltering: 1
72 | m_FinalGatherRayCount: 256
73 | m_ReflectionCompression: 2
74 | m_MixedBakeMode: 2
75 | m_BakeBackend: 1
76 | m_PVRSampling: 1
77 | m_PVRDirectSampleCount: 32
78 | m_PVRSampleCount: 512
79 | m_PVRBounces: 2
80 | m_PVREnvironmentSampleCount: 256
81 | m_PVREnvironmentReferencePointCount: 2048
82 | m_PVRFilteringMode: 1
83 | m_PVRDenoiserTypeDirect: 1
84 | m_PVRDenoiserTypeIndirect: 1
85 | m_PVRDenoiserTypeAO: 1
86 | m_PVRFilterTypeDirect: 0
87 | m_PVRFilterTypeIndirect: 0
88 | m_PVRFilterTypeAO: 0
89 | m_PVREnvironmentMIS: 1
90 | m_PVRCulling: 1
91 | m_PVRFilteringGaussRadiusDirect: 1
92 | m_PVRFilteringGaussRadiusIndirect: 5
93 | m_PVRFilteringGaussRadiusAO: 2
94 | m_PVRFilteringAtrousPositionSigmaDirect: 0.5
95 | m_PVRFilteringAtrousPositionSigmaIndirect: 2
96 | m_PVRFilteringAtrousPositionSigmaAO: 1
97 | m_ExportTrainingData: 0
98 | m_TrainingDataDestination: TrainingData
99 | m_LightProbeSampleCountMultiplier: 4
100 | m_LightingDataAsset: {fileID: 0}
101 | m_LightingSettings: {fileID: 0}
102 | --- !u!196 &4
103 | NavMeshSettings:
104 | serializedVersion: 2
105 | m_ObjectHideFlags: 0
106 | m_BuildSettings:
107 | serializedVersion: 2
108 | agentTypeID: 0
109 | agentRadius: 0.5
110 | agentHeight: 2
111 | agentSlope: 45
112 | agentClimb: 0.4
113 | ledgeDropHeight: 0
114 | maxJumpAcrossDistance: 0
115 | minRegionArea: 2
116 | manualCellSize: 0
117 | cellSize: 0.16666667
118 | manualTileSize: 0
119 | tileSize: 256
120 | accuratePlacement: 0
121 | maxJobWorkers: 0
122 | preserveTilesOutsideBounds: 0
123 | debug:
124 | m_Flags: 0
125 | m_NavMeshData: {fileID: 0}
126 | --- !u!1 &194390145
127 | GameObject:
128 | m_ObjectHideFlags: 0
129 | m_CorrespondingSourceObject: {fileID: 0}
130 | m_PrefabInstance: {fileID: 0}
131 | m_PrefabAsset: {fileID: 0}
132 | serializedVersion: 6
133 | m_Component:
134 | - component: {fileID: 194390149}
135 | - component: {fileID: 194390148}
136 | - component: {fileID: 194390147}
137 | - component: {fileID: 194390150}
138 | m_Layer: 0
139 | m_Name: RotatingCube
140 | m_TagString: Untagged
141 | m_Icon: {fileID: 0}
142 | m_NavMeshLayer: 0
143 | m_StaticEditorFlags: 0
144 | m_IsActive: 1
145 | --- !u!23 &194390147
146 | MeshRenderer:
147 | m_ObjectHideFlags: 0
148 | m_CorrespondingSourceObject: {fileID: 0}
149 | m_PrefabInstance: {fileID: 0}
150 | m_PrefabAsset: {fileID: 0}
151 | m_GameObject: {fileID: 194390145}
152 | m_Enabled: 1
153 | m_CastShadows: 1
154 | m_ReceiveShadows: 1
155 | m_DynamicOccludee: 1
156 | m_StaticShadowCaster: 0
157 | m_MotionVectors: 1
158 | m_LightProbeUsage: 1
159 | m_ReflectionProbeUsage: 1
160 | m_RayTracingMode: 2
161 | m_RayTraceProcedural: 0
162 | m_RenderingLayerMask: 1
163 | m_RendererPriority: 0
164 | m_Materials:
165 | - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0}
166 | m_StaticBatchInfo:
167 | firstSubMesh: 0
168 | subMeshCount: 0
169 | m_StaticBatchRoot: {fileID: 0}
170 | m_ProbeAnchor: {fileID: 0}
171 | m_LightProbeVolumeOverride: {fileID: 0}
172 | m_ScaleInLightmap: 1
173 | m_ReceiveGI: 1
174 | m_PreserveUVs: 0
175 | m_IgnoreNormalsForChartDetection: 0
176 | m_ImportantGI: 0
177 | m_StitchLightmapSeams: 1
178 | m_SelectedEditorRenderState: 3
179 | m_MinimumChartSize: 4
180 | m_AutoUVMaxDistance: 0.5
181 | m_AutoUVMaxAngle: 89
182 | m_LightmapParameters: {fileID: 0}
183 | m_SortingLayerID: 0
184 | m_SortingLayer: 0
185 | m_SortingOrder: 0
186 | m_AdditionalVertexStreams: {fileID: 0}
187 | --- !u!33 &194390148
188 | MeshFilter:
189 | m_ObjectHideFlags: 0
190 | m_CorrespondingSourceObject: {fileID: 0}
191 | m_PrefabInstance: {fileID: 0}
192 | m_PrefabAsset: {fileID: 0}
193 | m_GameObject: {fileID: 194390145}
194 | m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
195 | --- !u!4 &194390149
196 | Transform:
197 | m_ObjectHideFlags: 0
198 | m_CorrespondingSourceObject: {fileID: 0}
199 | m_PrefabInstance: {fileID: 0}
200 | m_PrefabAsset: {fileID: 0}
201 | m_GameObject: {fileID: 194390145}
202 | m_LocalRotation: {x: 0.9330127, y: 0.25000006, z: 0.25000006, w: 0.06698733}
203 | m_LocalPosition: {x: -1.46, y: 0, z: 0}
204 | m_LocalScale: {x: 1, y: 1, z: 1}
205 | m_ConstrainProportionsScale: 0
206 | m_Children: []
207 | m_Father: {fileID: 0}
208 | m_RootOrder: 2
209 | m_LocalEulerAnglesHint: {x: 0, y: 150, z: 150}
210 | --- !u!114 &194390150
211 | MonoBehaviour:
212 | m_ObjectHideFlags: 0
213 | m_CorrespondingSourceObject: {fileID: 0}
214 | m_PrefabInstance: {fileID: 0}
215 | m_PrefabAsset: {fileID: 0}
216 | m_GameObject: {fileID: 194390145}
217 | m_Enabled: 1
218 | m_EditorHideFlags: 0
219 | m_Script: {fileID: 11500000, guid: 96313211964dec348a8bc1dc590cce8f, type: 3}
220 | m_Name:
221 | m_EditorClassIdentifier:
222 | speed: 45
223 | --- !u!1 &1105053354
224 | GameObject:
225 | m_ObjectHideFlags: 0
226 | m_CorrespondingSourceObject: {fileID: 0}
227 | m_PrefabInstance: {fileID: 0}
228 | m_PrefabAsset: {fileID: 0}
229 | serializedVersion: 6
230 | m_Component:
231 | - component: {fileID: 1105053358}
232 | - component: {fileID: 1105053357}
233 | - component: {fileID: 1105053356}
234 | - component: {fileID: 1105053355}
235 | m_Layer: 0
236 | m_Name: ImageDecoder
237 | m_TagString: Untagged
238 | m_Icon: {fileID: 0}
239 | m_NavMeshLayer: 0
240 | m_StaticEditorFlags: 0
241 | m_IsActive: 1
242 | --- !u!114 &1105053355
243 | MonoBehaviour:
244 | m_ObjectHideFlags: 0
245 | m_CorrespondingSourceObject: {fileID: 0}
246 | m_PrefabInstance: {fileID: 0}
247 | m_PrefabAsset: {fileID: 0}
248 | m_GameObject: {fileID: 1105053354}
249 | m_Enabled: 1
250 | m_EditorHideFlags: 0
251 | m_Script: {fileID: 11500000, guid: 0ab811c0c5c64122a1fc842d609f6529, type: 3}
252 | m_Name:
253 | m_EditorClassIdentifier:
254 | url: https://avatars.githubusercontent.com/u/49774151?v=4
255 | target: {fileID: 1105053356}
256 | --- !u!23 &1105053356
257 | MeshRenderer:
258 | m_ObjectHideFlags: 0
259 | m_CorrespondingSourceObject: {fileID: 0}
260 | m_PrefabInstance: {fileID: 0}
261 | m_PrefabAsset: {fileID: 0}
262 | m_GameObject: {fileID: 1105053354}
263 | m_Enabled: 1
264 | m_CastShadows: 0
265 | m_ReceiveShadows: 0
266 | m_DynamicOccludee: 1
267 | m_StaticShadowCaster: 0
268 | m_MotionVectors: 1
269 | m_LightProbeUsage: 1
270 | m_ReflectionProbeUsage: 1
271 | m_RayTracingMode: 2
272 | m_RayTraceProcedural: 0
273 | m_RenderingLayerMask: 1
274 | m_RendererPriority: 0
275 | m_Materials:
276 | - {fileID: 2100000, guid: 30f658ad6a59ab141addd74098bfb43f, type: 2}
277 | m_StaticBatchInfo:
278 | firstSubMesh: 0
279 | subMeshCount: 0
280 | m_StaticBatchRoot: {fileID: 0}
281 | m_ProbeAnchor: {fileID: 0}
282 | m_LightProbeVolumeOverride: {fileID: 0}
283 | m_ScaleInLightmap: 1
284 | m_ReceiveGI: 1
285 | m_PreserveUVs: 0
286 | m_IgnoreNormalsForChartDetection: 0
287 | m_ImportantGI: 0
288 | m_StitchLightmapSeams: 1
289 | m_SelectedEditorRenderState: 3
290 | m_MinimumChartSize: 4
291 | m_AutoUVMaxDistance: 0.5
292 | m_AutoUVMaxAngle: 89
293 | m_LightmapParameters: {fileID: 0}
294 | m_SortingLayerID: 0
295 | m_SortingLayer: 0
296 | m_SortingOrder: 0
297 | m_AdditionalVertexStreams: {fileID: 0}
298 | --- !u!33 &1105053357
299 | MeshFilter:
300 | m_ObjectHideFlags: 0
301 | m_CorrespondingSourceObject: {fileID: 0}
302 | m_PrefabInstance: {fileID: 0}
303 | m_PrefabAsset: {fileID: 0}
304 | m_GameObject: {fileID: 1105053354}
305 | m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0}
306 | --- !u!4 &1105053358
307 | Transform:
308 | m_ObjectHideFlags: 0
309 | m_CorrespondingSourceObject: {fileID: 0}
310 | m_PrefabInstance: {fileID: 0}
311 | m_PrefabAsset: {fileID: 0}
312 | m_GameObject: {fileID: 1105053354}
313 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
314 | m_LocalPosition: {x: 1.5, y: 0, z: 0}
315 | m_LocalScale: {x: 2, y: 2, z: 2}
316 | m_ConstrainProportionsScale: 0
317 | m_Children: []
318 | m_Father: {fileID: 0}
319 | m_RootOrder: 3
320 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
321 | --- !u!1 &2083921543
322 | GameObject:
323 | m_ObjectHideFlags: 0
324 | m_CorrespondingSourceObject: {fileID: 0}
325 | m_PrefabInstance: {fileID: 0}
326 | m_PrefabAsset: {fileID: 0}
327 | serializedVersion: 6
328 | m_Component:
329 | - component: {fileID: 2083921545}
330 | - component: {fileID: 2083921544}
331 | m_Layer: 0
332 | m_Name: Directional Light
333 | m_TagString: Untagged
334 | m_Icon: {fileID: 0}
335 | m_NavMeshLayer: 0
336 | m_StaticEditorFlags: 0
337 | m_IsActive: 1
338 | --- !u!108 &2083921544
339 | Light:
340 | m_ObjectHideFlags: 0
341 | m_CorrespondingSourceObject: {fileID: 0}
342 | m_PrefabInstance: {fileID: 0}
343 | m_PrefabAsset: {fileID: 0}
344 | m_GameObject: {fileID: 2083921543}
345 | m_Enabled: 1
346 | serializedVersion: 10
347 | m_Type: 1
348 | m_Shape: 0
349 | m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1}
350 | m_Intensity: 1
351 | m_Range: 10
352 | m_SpotAngle: 30
353 | m_InnerSpotAngle: 21.80208
354 | m_CookieSize: 10
355 | m_Shadows:
356 | m_Type: 2
357 | m_Resolution: -1
358 | m_CustomResolution: -1
359 | m_Strength: 1
360 | m_Bias: 0.05
361 | m_NormalBias: 0.4
362 | m_NearPlane: 0.2
363 | m_CullingMatrixOverride:
364 | e00: 1
365 | e01: 0
366 | e02: 0
367 | e03: 0
368 | e10: 0
369 | e11: 1
370 | e12: 0
371 | e13: 0
372 | e20: 0
373 | e21: 0
374 | e22: 1
375 | e23: 0
376 | e30: 0
377 | e31: 0
378 | e32: 0
379 | e33: 1
380 | m_UseCullingMatrixOverride: 0
381 | m_Cookie: {fileID: 0}
382 | m_DrawHalo: 0
383 | m_Flare: {fileID: 0}
384 | m_RenderMode: 0
385 | m_CullingMask:
386 | serializedVersion: 2
387 | m_Bits: 4294967295
388 | m_RenderingLayerMask: 1
389 | m_Lightmapping: 4
390 | m_LightShadowCasterMode: 0
391 | m_AreaSize: {x: 1, y: 1}
392 | m_BounceIntensity: 1
393 | m_ColorTemperature: 6570
394 | m_UseColorTemperature: 0
395 | m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0}
396 | m_UseBoundingSphereOverride: 0
397 | m_UseViewFrustumForShadowCasterCull: 1
398 | m_ShadowRadius: 0
399 | m_ShadowAngle: 0
400 | --- !u!4 &2083921545
401 | Transform:
402 | m_ObjectHideFlags: 0
403 | m_CorrespondingSourceObject: {fileID: 0}
404 | m_PrefabInstance: {fileID: 0}
405 | m_PrefabAsset: {fileID: 0}
406 | m_GameObject: {fileID: 2083921543}
407 | m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261}
408 | m_LocalPosition: {x: 0, y: 3, z: 0}
409 | m_LocalScale: {x: 1, y: 1, z: 1}
410 | m_ConstrainProportionsScale: 0
411 | m_Children: []
412 | m_Father: {fileID: 0}
413 | m_RootOrder: 1
414 | m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
415 | --- !u!1 &2109907609
416 | GameObject:
417 | m_ObjectHideFlags: 0
418 | m_CorrespondingSourceObject: {fileID: 0}
419 | m_PrefabInstance: {fileID: 0}
420 | m_PrefabAsset: {fileID: 0}
421 | serializedVersion: 6
422 | m_Component:
423 | - component: {fileID: 2109907612}
424 | - component: {fileID: 2109907611}
425 | - component: {fileID: 2109907610}
426 | m_Layer: 0
427 | m_Name: Main Camera
428 | m_TagString: MainCamera
429 | m_Icon: {fileID: 0}
430 | m_NavMeshLayer: 0
431 | m_StaticEditorFlags: 0
432 | m_IsActive: 1
433 | --- !u!81 &2109907610
434 | AudioListener:
435 | m_ObjectHideFlags: 0
436 | m_CorrespondingSourceObject: {fileID: 0}
437 | m_PrefabInstance: {fileID: 0}
438 | m_PrefabAsset: {fileID: 0}
439 | m_GameObject: {fileID: 2109907609}
440 | m_Enabled: 1
441 | --- !u!20 &2109907611
442 | Camera:
443 | m_ObjectHideFlags: 0
444 | m_CorrespondingSourceObject: {fileID: 0}
445 | m_PrefabInstance: {fileID: 0}
446 | m_PrefabAsset: {fileID: 0}
447 | m_GameObject: {fileID: 2109907609}
448 | m_Enabled: 1
449 | serializedVersion: 2
450 | m_ClearFlags: 1
451 | m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
452 | m_projectionMatrixMode: 1
453 | m_GateFitMode: 2
454 | m_FOVAxisMode: 0
455 | m_SensorSize: {x: 36, y: 24}
456 | m_LensShift: {x: 0, y: 0}
457 | m_FocalLength: 50
458 | m_NormalizedViewPortRect:
459 | serializedVersion: 2
460 | x: 0
461 | y: 0
462 | width: 1
463 | height: 1
464 | near clip plane: 0.3
465 | far clip plane: 1000
466 | field of view: 60
467 | orthographic: 0
468 | orthographic size: 5
469 | m_Depth: -1
470 | m_CullingMask:
471 | serializedVersion: 2
472 | m_Bits: 4294967295
473 | m_RenderingPath: -1
474 | m_TargetTexture: {fileID: 0}
475 | m_TargetDisplay: 0
476 | m_TargetEye: 3
477 | m_HDR: 1
478 | m_AllowMSAA: 1
479 | m_AllowDynamicResolution: 0
480 | m_ForceIntoRT: 0
481 | m_OcclusionCulling: 1
482 | m_StereoConvergence: 10
483 | m_StereoSeparation: 0.022
484 | --- !u!4 &2109907612
485 | Transform:
486 | m_ObjectHideFlags: 0
487 | m_CorrespondingSourceObject: {fileID: 0}
488 | m_PrefabInstance: {fileID: 0}
489 | m_PrefabAsset: {fileID: 0}
490 | m_GameObject: {fileID: 2109907609}
491 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
492 | m_LocalPosition: {x: 0, y: 0, z: -3}
493 | m_LocalScale: {x: 1, y: 1, z: 1}
494 | m_ConstrainProportionsScale: 0
495 | m_Children: []
496 | m_Father: {fileID: 0}
497 | m_RootOrder: 0
498 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
499 |
--------------------------------------------------------------------------------
/Assets/Mochineko/StbImageSharpForUnity.Demo/ImageDecodingDemoScene.unity.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 7cd08bae8e66c442298f36e11f18cdfb
3 | DefaultImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/Assets/Mochineko/StbImageSharpForUnity.Demo/ImageLoaderDemo.cs:
--------------------------------------------------------------------------------
1 | using Cysharp.Threading.Tasks;
2 | using UnityEngine;
3 |
4 | namespace Mochineko.StbImageSharpForUnity.Demo
5 | {
6 | ///
7 | /// A demonstration code of StbImageSharpForUnity loading an image from URL to .
8 | ///
9 | internal sealed class ImageLoaderDemo : MonoBehaviour
10 | {
11 | [SerializeField] private string url;
12 | [SerializeField] private Renderer target;
13 |
14 | private Texture2D texture = null;
15 |
16 | private void OnDestroy()
17 | {
18 | ClearTexture();
19 | }
20 |
21 | private void Start()
22 | {
23 | DownloadAndSetImageAsync().Forget();
24 | }
25 |
26 | private void OnGUI()
27 | {
28 | if (GUILayout.Button("Load"))
29 | {
30 | DownloadAndSetImageAsync().Forget();
31 | }
32 |
33 | if (GUILayout.Button("Clear"))
34 | {
35 | ClearTexture();
36 | }
37 | }
38 |
39 | private void ClearTexture()
40 | {
41 | if (texture != null)
42 | {
43 | UnityEngine.Object.Destroy(texture);
44 | texture = null;
45 | target.material.mainTexture = null;
46 | }
47 | }
48 |
49 | private async UniTask DownloadAndSetImageAsync()
50 | {
51 | var client = SingletonHttpClient.Instance;
52 |
53 | await UniTask.SwitchToThreadPool();
54 |
55 | var data = await client.GetByteArrayAsync(url);
56 |
57 | var imageResult = ImageDecoder.DecodeImage(data);
58 |
59 | await UniTask.SwitchToMainThread();
60 |
61 | texture = imageResult.ToTexture2D();
62 |
63 | target.material.mainTexture = texture;
64 | }
65 | }
66 | }
--------------------------------------------------------------------------------
/Assets/Mochineko/StbImageSharpForUnity.Demo/ImageLoaderDemo.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 0ab811c0c5c64122a1fc842d609f6529
3 | timeCreated: 1654348324
--------------------------------------------------------------------------------
/Assets/Mochineko/StbImageSharpForUnity.Demo/Mochineko.StbImageSharpForUnity.Demo.asmdef:
--------------------------------------------------------------------------------
1 | {
2 | "name": "Mochineko.StbImageSharpForUnity.Demo",
3 | "rootNamespace": "",
4 | "references": [
5 | "GUID:fac980d0a0def28459262c65dfd2a32d",
6 | "GUID:4b7e97d9b45fc704a97485f8a581efe8",
7 | "GUID:f51ebe6a0ceec4240a699833d6309b23"
8 | ],
9 | "includePlatforms": [],
10 | "excludePlatforms": [],
11 | "allowUnsafeCode": false,
12 | "overrideReferences": false,
13 | "precompiledReferences": [],
14 | "autoReferenced": false,
15 | "defineConstraints": [],
16 | "versionDefines": [],
17 | "noEngineReferences": false
18 | }
--------------------------------------------------------------------------------
/Assets/Mochineko/StbImageSharpForUnity.Demo/Mochineko.StbImageSharpForUnity.Demo.asmdef.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 510971f92a12a354a965e783df9aaa48
3 | AssemblyDefinitionImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/Assets/Mochineko/StbImageSharpForUnity.Demo/NOTICE.md:
--------------------------------------------------------------------------------
1 | Notice
2 | ===
3 |
4 | ## StbImageSharp
5 |
6 | https://github.com/StbSharp/StbImageSharp
7 |
8 | ```
9 | Public Domain
10 | ```
11 |
12 |
13 | ## Stb
14 |
15 | https://github.com/nothings/stb
16 |
17 | ```
18 | ALTERNATIVE B - Public Domain (www.unlicense.org)
19 | This is free and unencumbered software released into the public domain.
20 | Anyone is free to copy, modify, publish, use, compile, sell, or distribute this
21 | software, either in source code form or as a compiled binary, for any purpose,
22 | commercial or non-commercial, and by any means.
23 | In jurisdictions that recognize copyright laws, the author or authors of this
24 | software dedicate any and all copyright interest in the software to the public
25 | domain. We make this dedication for the benefit of the public at large and to
26 | the detriment of our heirs and successors. We intend this dedication to be an
27 | overt act of relinquishment in perpetuity of all present and future rights to
28 | this software under copyright law.
29 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
30 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
31 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
32 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
33 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
34 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
35 | ```
36 |
37 |
38 | ## UniTask
39 |
40 | https://github.com/Cysharp/UniTask
41 |
42 | ```
43 | The MIT License (MIT)
44 |
45 | Copyright (c) 2019 Yoshifumi Kawai / Cysharp, Inc.
46 |
47 | Permission is hereby granted, free of charge, to any person obtaining a copy
48 | of this software and associated documentation files (the "Software"), to deal
49 | in the Software without restriction, including without limitation the rights
50 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
51 | copies of the Software, and to permit persons to whom the Software is
52 | furnished to do so, subject to the following conditions:
53 |
54 | The above copyright notice and this permission notice shall be included in all
55 | copies or substantial portions of the Software.
56 |
57 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
58 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
59 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
60 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
61 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
62 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
63 | SOFTWARE.
64 | ```
--------------------------------------------------------------------------------
/Assets/Mochineko/StbImageSharpForUnity.Demo/NOTICE.md.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 14a310fd29d7a19489e7f8fbb5fa5540
3 | TextScriptImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/Assets/Mochineko/StbImageSharpForUnity.Demo/SingletonHttpClient.cs:
--------------------------------------------------------------------------------
1 | using System.Net.Http;
2 | using UnityEngine;
3 |
4 | namespace Mochineko.StbImageSharpForUnity.Demo
5 | {
6 | ///
7 | /// Provides a singleton instance of .
8 | ///
9 | internal sealed class SingletonHttpClient : MonoBehaviour
10 | {
11 | private static HttpClient instance = null;
12 | public static HttpClient Instance
13 | {
14 | get
15 | {
16 | if (instance == null)
17 | {
18 | var gameObject = new GameObject(nameof(SingletonHttpClient));
19 | GameObject.DontDestroyOnLoad(gameObject);
20 | gameObject.AddComponent();
21 | instance = new HttpClient();
22 | }
23 |
24 | return instance;
25 | }
26 | }
27 |
28 | private void OnDestroy()
29 | {
30 | instance?.Dispose();
31 | }
32 | }
33 | }
--------------------------------------------------------------------------------
/Assets/Mochineko/StbImageSharpForUnity.Demo/SingletonHttpClient.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: a8f2937005074e7f8c942fa204ab2207
3 | timeCreated: 1660458822
--------------------------------------------------------------------------------
/Assets/Mochineko/StbImageSharpForUnity.Demo/TransformRotator.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 |
3 | namespace Mochineko.StbImageSharpForUnity.Demo
4 | {
5 | // Debugs the main thread blocking visually.
6 | internal sealed class TransformRotator : MonoBehaviour
7 | {
8 | [SerializeField] private float speed = 1;
9 |
10 | private Transform myTransform;
11 |
12 | private void Awake()
13 | {
14 | myTransform = transform;
15 | }
16 |
17 | private void Update()
18 | {
19 | myTransform.Rotate(Vector3.up, speed * Time.deltaTime);
20 | }
21 | }
22 | }
23 |
24 |
--------------------------------------------------------------------------------
/Assets/Mochineko/StbImageSharpForUnity.Demo/TransformRotator.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 96313211964dec348a8bc1dc590cce8f
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/Mochineko/StbImageSharpForUnity.Demo/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "com.mochineko.stbimagesharp-for-unity.demo",
3 | "displayName": "A demo of StbImageSharp for Unity",
4 | "version": "1.3.0",
5 | "unity": "2021.3",
6 | "description": "A demo of StbImageSharp for Unity.",
7 | "author": {
8 | "name": "Mochineko",
9 | "url": "https://github.com/mochi-neko"
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/Assets/Mochineko/StbImageSharpForUnity.Demo/package.json.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 68f4011ada6e83449b737ffe5412695f
3 | TextScriptImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/Assets/Mochineko/StbImageSharpForUnity.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: eaa7799d1bdb3eb4eaacf2eb966c22dc
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Assets/Mochineko/StbImageSharpForUnity/AnimatedGifDecoder.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.IO;
3 | using StbImageSharp;
4 |
5 | namespace Mochineko.StbImageSharpForUnity
6 | {
7 | public static class AnimatedGifDecoder
8 | {
9 | ///
10 | /// Decodes an GIF image from to enumerable.
11 | ///
12 | ///
13 | ///
14 | ///
15 | public static IEnumerable DecodeGifImage(
16 | Stream stream,
17 | ColorComponents requiredColorComponents = ColorComponents.Default)
18 | {
19 | // FIXME: It does not work for GIF.
20 | //StbImage.stbi_set_flip_vertically_on_load(1);
21 |
22 | return ImageResult.AnimatedGifFramesFromStream(stream, requiredColorComponents);
23 | }
24 | }
25 | }
--------------------------------------------------------------------------------
/Assets/Mochineko/StbImageSharpForUnity/AnimatedGifDecoder.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: ee75cf316cd14d1f97682466ce5efdcf
3 | timeCreated: 1660461661
--------------------------------------------------------------------------------
/Assets/Mochineko/StbImageSharpForUnity/AnimatedTexture.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using StbImageSharp;
3 | using UnityEngine;
4 |
5 | namespace Mochineko.StbImageSharpForUnity
6 | {
7 | ///
8 | /// An animated with frame delay.
9 | ///
10 | public sealed class AnimatedTexture : IDisposable
11 | {
12 | public Texture2D Texture { get; private set; }
13 | public int DelayInMs { get; }
14 |
15 | public AnimatedTexture(AnimatedFrameResult animatedFrameResult, bool mipChain, bool linear)
16 | {
17 | Texture = animatedFrameResult.ToTexture2D(mipChain, linear);
18 | DelayInMs = animatedFrameResult.DelayInMs;
19 | }
20 |
21 | public void Dispose()
22 | {
23 | UnityEngine.Object.Destroy(Texture);
24 | Texture = null;
25 | }
26 | }
27 | }
--------------------------------------------------------------------------------
/Assets/Mochineko/StbImageSharpForUnity/AnimatedTexture.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 23e3b1766701443db9158fa350b66b03
3 | timeCreated: 1660446347
--------------------------------------------------------------------------------
/Assets/Mochineko/StbImageSharpForUnity/AnimatedTextureConverter.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using StbImageSharp;
3 |
4 | namespace Mochineko.StbImageSharpForUnity
5 | {
6 | public static class AnimatedTextureConverter
7 | {
8 | ///
9 | /// Converts enumerable to enumerable.
10 | /// If you would decode large file, I recommend to use instead.
11 | ///
12 | ///
13 | ///
14 | ///
15 | ///
16 | /// Are not lazily evaluated.
17 | public static IEnumerable ExpandAllToAnimatedTextures(
18 | this IEnumerable animatedFrameResults,
19 | bool mipChain = false,
20 | bool linear = false)
21 | {
22 | // NOTICE: Does not evaluate lazily. So if a large gif file is loaded, you spends large memory.
23 | var list = new List();
24 | foreach (var frame in animatedFrameResults)
25 | {
26 | list.Add(new AnimatedTexture(frame, mipChain, linear));
27 | }
28 |
29 | return list;
30 | }
31 |
32 | ///
33 | /// Converts enumerable to enumerable.
34 | ///
35 | ///
36 | ///
37 | ///
38 | ///
39 | public static IEnumerable ToTextureSharedAnimatedTextures(
40 | this IEnumerable enumerable,
41 | bool mipChain = false,
42 | bool linear = false)
43 | => new TextureSharedAnimatedTextureEnumerable(enumerable, mipChain, linear);
44 | }
45 | }
--------------------------------------------------------------------------------
/Assets/Mochineko/StbImageSharpForUnity/AnimatedTextureConverter.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 83db4319b8a3478680ad408efd3afd54
3 | timeCreated: 1660461643
--------------------------------------------------------------------------------
/Assets/Mochineko/StbImageSharpForUnity/FormatConverter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using StbImageSharp;
3 | using UnityEngine;
4 |
5 | namespace Mochineko.StbImageSharpForUnity
6 | {
7 | public static class FormatConverter
8 | {
9 | ///
10 | /// Converts to .
11 | ///
12 | ///
13 | ///
14 | ///
15 | public static TextureFormat ToUnityTextureFormat(this ColorComponents colorComponents)
16 | {
17 | switch (colorComponents)
18 | {
19 | case ColorComponents.RedGreenBlueAlpha:
20 | return TextureFormat.RGBA32;
21 |
22 | case ColorComponents.RedGreenBlue:
23 | return TextureFormat.RGB24;
24 |
25 | case ColorComponents.Grey:
26 | return TextureFormat.Alpha8;
27 |
28 | case ColorComponents.GreyAlpha:
29 | case ColorComponents.Default:
30 | default:
31 | throw new NotImplementedException();
32 | }
33 | }
34 | }
35 | }
--------------------------------------------------------------------------------
/Assets/Mochineko/StbImageSharpForUnity/FormatConverter.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: a723ac9398cb4ab79e34300e3f91161a
3 | timeCreated: 1654347755
--------------------------------------------------------------------------------
/Assets/Mochineko/StbImageSharpForUnity/ImageDecoder.cs:
--------------------------------------------------------------------------------
1 | using System.IO;
2 | using StbImageSharp;
3 |
4 | namespace Mochineko.StbImageSharpForUnity
5 | {
6 | public static class ImageDecoder
7 | {
8 | ///
9 | /// Decodes an image from to .
10 | ///
11 | ///
12 | ///
13 | ///
14 | public static ImageResult DecodeImage(
15 | Stream stream,
16 | ColorComponents requiredColorComponents = ColorComponents.Default)
17 | {
18 | // Flips vertical direction of image along with the Unity coordinates.
19 | StbImage.stbi_set_flip_vertically_on_load(1);
20 |
21 | return ImageResult.FromStream(stream, requiredColorComponents);
22 | }
23 |
24 | ///
25 | /// Decodes an image from array to .
26 | ///
27 | ///
28 | ///
29 | ///
30 | public static ImageResult DecodeImage(
31 | byte[] data,
32 | ColorComponents requiredColorComponents = ColorComponents.Default)
33 | {
34 | using var stream = new MemoryStream(data);
35 | return DecodeImage(stream, requiredColorComponents);
36 | }
37 | }
38 | }
--------------------------------------------------------------------------------
/Assets/Mochineko/StbImageSharpForUnity/ImageDecoder.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: fc19d840e14e7c84ba29be90339de99d
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/Mochineko/StbImageSharpForUnity/Mochineko.StbImageSharpForUnity.asmdef:
--------------------------------------------------------------------------------
1 | {
2 | "name": "Mochineko.StbImageSharpForUnity",
3 | "rootNamespace": "",
4 | "references": [
5 | "GUID:fac980d0a0def28459262c65dfd2a32d"
6 | ],
7 | "includePlatforms": [],
8 | "excludePlatforms": [],
9 | "allowUnsafeCode": false,
10 | "overrideReferences": false,
11 | "precompiledReferences": [],
12 | "autoReferenced": true,
13 | "defineConstraints": [],
14 | "versionDefines": [],
15 | "noEngineReferences": false
16 | }
--------------------------------------------------------------------------------
/Assets/Mochineko/StbImageSharpForUnity/Mochineko.StbImageSharpForUnity.asmdef.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 4b7e97d9b45fc704a97485f8a581efe8
3 | AssemblyDefinitionImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/Assets/Mochineko/StbImageSharpForUnity/NOTICE.md:
--------------------------------------------------------------------------------
1 | Notice
2 | ===
3 |
4 | ## StbImageSharp
5 |
6 | https://github.com/StbSharp/StbImageSharp
7 |
8 | ```
9 | Public Domain
10 | ```
11 |
12 | ## Stb
13 |
14 | https://github.com/nothings/stb
15 |
16 | ```
17 | ALTERNATIVE B - Public Domain (www.unlicense.org)
18 | This is free and unencumbered software released into the public domain.
19 | Anyone is free to copy, modify, publish, use, compile, sell, or distribute this
20 | software, either in source code form or as a compiled binary, for any purpose,
21 | commercial or non-commercial, and by any means.
22 | In jurisdictions that recognize copyright laws, the author or authors of this
23 | software dedicate any and all copyright interest in the software to the public
24 | domain. We make this dedication for the benefit of the public at large and to
25 | the detriment of our heirs and successors. We intend this dedication to be an
26 | overt act of relinquishment in perpetuity of all present and future rights to
27 | this software under copyright law.
28 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
29 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
30 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
31 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
32 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
33 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
34 | ```
35 |
--------------------------------------------------------------------------------
/Assets/Mochineko/StbImageSharpForUnity/NOTICE.md.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: c50e1bf1272d8f24db1ebbba740c4225
3 | TextScriptImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/Assets/Mochineko/StbImageSharpForUnity/TextureConverter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using StbImageSharp;
3 | using UnityEngine;
4 |
5 | namespace Mochineko.StbImageSharpForUnity
6 | {
7 | public static class TextureConverter
8 | {
9 | ///
10 | /// Converts to .
11 | ///
12 | ///
13 | ///
14 | ///
15 | ///
16 | /// Run on main thread because it accesses Unity APIs.
17 | public static Texture2D ToTexture2D(
18 | this ImageResult imageResult,
19 | bool mipChain = false,
20 | bool linear = false)
21 | {
22 | var texture = new Texture2D(
23 | width: imageResult.Width,
24 | height: imageResult.Height,
25 | textureFormat: imageResult.Comp.ToUnityTextureFormat(),
26 | mipChain: mipChain,
27 | linear: linear
28 | );
29 |
30 | texture.LoadRawTextureData(imageResult.Data);
31 |
32 | texture.Apply();
33 |
34 | return texture;
35 | }
36 |
37 | ///
38 | /// Set into that already been created.
39 | ///
40 | ///
41 | ///
42 | ///
43 | /// Throws when formats(width, height, texture format as Texture2D) have any mismatches between imageResult and target.
44 | /// Run on main thread because it accesses Unity APIs.
45 | public static void SetIntoTexture2D(
46 | this ImageResult imageResult,
47 | Texture2D target)
48 | {
49 | if (imageResult.Width != target.width)
50 | {
51 | throw new ArgumentException($"Widths are mismatch between image{imageResult.Width} and texture:{target.width}.");
52 | }
53 | if (imageResult.Height != target.height)
54 | {
55 | throw new ArgumentException($"Heights are mismatch between image{imageResult.Height} and texture:{target.height}.");
56 | }
57 | if (imageResult.Comp.ToUnityTextureFormat() != target.format)
58 | {
59 | throw new ArgumentException($"Texture formats are mismatch between image{imageResult.Comp.ToUnityTextureFormat()} and texture:{target.format}.");
60 | }
61 |
62 | target.LoadRawTextureData(imageResult.Data);
63 |
64 | target.Apply();
65 | }
66 | }
67 | }
--------------------------------------------------------------------------------
/Assets/Mochineko/StbImageSharpForUnity/TextureConverter.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: adf031ad52a94d77952c8c244442d9b3
3 | timeCreated: 1654350011
--------------------------------------------------------------------------------
/Assets/Mochineko/StbImageSharpForUnity/TextureSharedAnimatedTexture.cs:
--------------------------------------------------------------------------------
1 | using StbImageSharp;
2 | using UnityEngine;
3 |
4 | namespace Mochineko.StbImageSharpForUnity
5 | {
6 | ///
7 | /// An animated shared with frame delay.
8 | ///
9 | public sealed class TextureSharedAnimatedTexture
10 | {
11 | public Texture2D Texture { get; }
12 | public int DelayInMs { get; }
13 |
14 | public TextureSharedAnimatedTexture(AnimatedFrameResult animatedFrameResult, Texture2D sharedTexture)
15 | {
16 | animatedFrameResult.SetIntoTexture2D(sharedTexture);
17 | Texture = sharedTexture;
18 | DelayInMs = animatedFrameResult.DelayInMs;
19 | }
20 | }
21 | }
--------------------------------------------------------------------------------
/Assets/Mochineko/StbImageSharpForUnity/TextureSharedAnimatedTexture.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 5749a881c26947138f81d8d35e63791d
3 | timeCreated: 1672900821
--------------------------------------------------------------------------------
/Assets/Mochineko/StbImageSharpForUnity/TextureSharedAnimatedTextureEnumerable.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections;
3 | using System.Collections.Generic;
4 | using StbImageSharp;
5 |
6 | namespace Mochineko.StbImageSharpForUnity
7 | {
8 | ///
9 | /// An implementation of for .
10 | ///
11 | ///
12 | internal sealed class TextureSharedAnimatedTextureEnumerable : IEnumerable
13 | {
14 | private readonly IEnumerable enumerable;
15 | private readonly bool mipChain;
16 | private readonly bool linear;
17 |
18 | public TextureSharedAnimatedTextureEnumerable(
19 | IEnumerable enumerable,
20 | bool mipChain = false,
21 | bool linear = false)
22 | {
23 | this.enumerable = enumerable ?? throw new ArgumentNullException(nameof(enumerable));
24 | this.mipChain = mipChain;
25 | this.linear = linear;
26 | }
27 |
28 | IEnumerator IEnumerable.GetEnumerator()
29 | => new TextureSharedAnimatedTextureEnumerator(enumerable.GetEnumerator(), mipChain, linear);
30 |
31 | IEnumerator IEnumerable.GetEnumerator()
32 | => (this as IEnumerable).GetEnumerator();
33 | }
34 | }
--------------------------------------------------------------------------------
/Assets/Mochineko/StbImageSharpForUnity/TextureSharedAnimatedTextureEnumerable.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 4e8ff65cbc6649c1be0de7ec887bd3ad
3 | timeCreated: 1672897989
--------------------------------------------------------------------------------
/Assets/Mochineko/StbImageSharpForUnity/TextureSharedAnimatedTextureEnumerator.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections;
3 | using System.Collections.Generic;
4 | using StbImageSharp;
5 | using UnityEngine;
6 |
7 | namespace Mochineko.StbImageSharpForUnity
8 | {
9 | ///
10 | /// An implementation of for .
11 | ///
12 | internal sealed class TextureSharedAnimatedTextureEnumerator : IEnumerator
13 | {
14 | private readonly IEnumerator enumerator;
15 | private readonly bool mipChain;
16 | private readonly bool linear;
17 |
18 | private TextureSharedAnimatedTexture current;
19 | TextureSharedAnimatedTexture IEnumerator.Current => current;
20 | object IEnumerator.Current => current;
21 |
22 | private Texture2D sharedTexture = null;
23 |
24 | public TextureSharedAnimatedTextureEnumerator(
25 | IEnumerator enumerator,
26 | bool mipChain = false,
27 | bool linear = false)
28 | {
29 | this.enumerator = enumerator ?? throw new ArgumentNullException(nameof(enumerator));
30 | this.mipChain = mipChain;
31 | this.linear = linear;
32 | }
33 |
34 | // NOTICE: This has to be called on the main thread of Unity because it accesses Unity APIs for Texture2D.
35 | bool IEnumerator.MoveNext()
36 | {
37 | if (enumerator.MoveNext())
38 | {
39 | var currentFrame = enumerator.Current;
40 |
41 | if (sharedTexture == null)
42 | {
43 | sharedTexture = currentFrame.ToTexture2D(mipChain, linear);
44 | }
45 |
46 | current = new TextureSharedAnimatedTexture(enumerator.Current, sharedTexture);
47 |
48 | return true;
49 | }
50 | else
51 | {
52 | return false;
53 | }
54 | }
55 |
56 | void IEnumerator.Reset()
57 | {
58 | // NOTE: Not implemented Reset() at AnimatedGifEnumerator.
59 | throw new NotImplementedException();
60 | }
61 |
62 | void IDisposable.Dispose()
63 | {
64 | enumerator.Dispose();
65 |
66 | if (sharedTexture != null)
67 | {
68 | UnityEngine.Object.Destroy(sharedTexture);
69 | sharedTexture = null;
70 | }
71 | }
72 | }
73 | }
--------------------------------------------------------------------------------
/Assets/Mochineko/StbImageSharpForUnity/TextureSharedAnimatedTextureEnumerator.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: bf5a6cf086124165b6538e2c00cbd799
3 | timeCreated: 1672897995
--------------------------------------------------------------------------------
/Assets/Mochineko/StbImageSharpForUnity/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "com.mochineko.stbimagesharp-for-unity",
3 | "displayName": "StbImageSharp for Unity",
4 | "version": "1.3.0",
5 | "unity": "2021.3",
6 | "description": "An Unity extension of StbImageSharp.",
7 | "author": {
8 | "name": "Mochineko",
9 | "url": "https://github.com/mochi-neko"
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/Assets/Mochineko/StbImageSharpForUnity/package.json.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 58afe50011bd761449e25672a23383f6
3 | TextScriptImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/Assets/StbImageSharp.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: dd8ca82a917901e4d937fbe6ba70ba35
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Assets/StbImageSharp/AnimatedFrameResult.cs:
--------------------------------------------------------------------------------
1 | namespace StbImageSharp
2 | {
3 | #if !STBSHARP_INTERNAL
4 | public
5 | #else
6 | internal
7 | #endif
8 | class AnimatedFrameResult : ImageResult
9 | {
10 | public int DelayInMs { get; set; }
11 | }
12 | }
--------------------------------------------------------------------------------
/Assets/StbImageSharp/AnimatedFrameResult.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: c2383b7bcdd1cc545bb60975336f0163
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/StbImageSharp/AnimatedGifEnumerator.cs:
--------------------------------------------------------------------------------
1 | using Hebron.Runtime;
2 | using System;
3 | using System.Collections;
4 | using System.Collections.Generic;
5 | using System.IO;
6 | using System.Runtime.InteropServices;
7 |
8 | namespace StbImageSharp
9 | {
10 | internal class AnimatedGifEnumerator : IEnumerator
11 | {
12 | private readonly StbImage.stbi__context _context;
13 | private StbImage.stbi__gif _gif;
14 |
15 | public AnimatedGifEnumerator(Stream input, ColorComponents colorComponents)
16 | {
17 | if (input == null) throw new ArgumentNullException(nameof(input));
18 |
19 | _context = new StbImage.stbi__context(input);
20 |
21 | if (StbImage.stbi__gif_test(_context) == 0) throw new Exception("Input stream is not GIF file.");
22 |
23 | _gif = new StbImage.stbi__gif();
24 | ColorComponents = colorComponents;
25 | }
26 |
27 | public ColorComponents ColorComponents { get; }
28 |
29 | public AnimatedFrameResult Current { get; private set; }
30 |
31 | object IEnumerator.Current => Current;
32 |
33 | public void Dispose()
34 | {
35 | Dispose(true);
36 | GC.SuppressFinalize(this);
37 | }
38 |
39 | public unsafe bool MoveNext()
40 | {
41 | // Read next frame
42 | int ccomp;
43 | byte two_back;
44 | var result = StbImage.stbi__gif_load_next(_context, _gif, &ccomp, (int)ColorComponents, &two_back);
45 | if (result == null) return false;
46 |
47 | if (Current == null)
48 | {
49 | Current = new AnimatedFrameResult
50 | {
51 | Width = _gif.w,
52 | Height = _gif.h,
53 | SourceComp = (ColorComponents)ccomp,
54 | Comp = ColorComponents == ColorComponents.Default ? (ColorComponents)ccomp : ColorComponents
55 | };
56 |
57 | Current.Data = new byte[Current.Width * Current.Height * (int)Current.Comp];
58 | }
59 |
60 | Current.DelayInMs = _gif.delay;
61 |
62 | Marshal.Copy(new IntPtr(result), Current.Data, 0, Current.Data.Length);
63 |
64 | return true;
65 | }
66 |
67 | public void Reset()
68 | {
69 | throw new NotImplementedException();
70 | }
71 |
72 | ~AnimatedGifEnumerator()
73 | {
74 | Dispose(false);
75 | }
76 |
77 | protected unsafe virtual void Dispose(bool disposing)
78 | {
79 | if (disposing)
80 | {
81 | if (_gif != null)
82 | {
83 | if (_gif._out_ != null)
84 | {
85 | CRuntime.free(_gif._out_);
86 | _gif._out_ = null;
87 | }
88 |
89 | if (_gif.history != null)
90 | {
91 | CRuntime.free(_gif.history);
92 | _gif.history = null;
93 | }
94 |
95 | if (_gif.background != null)
96 | {
97 | CRuntime.free(_gif.background);
98 | _gif.background = null;
99 | }
100 |
101 | _gif = null;
102 | }
103 | }
104 | }
105 | }
106 |
107 | internal class AnimatedGifEnumerable : IEnumerable
108 | {
109 | private readonly Stream _input;
110 |
111 | public AnimatedGifEnumerable(Stream input, ColorComponents colorComponents)
112 | {
113 | _input = input;
114 | ColorComponents = colorComponents;
115 | }
116 |
117 | public ColorComponents ColorComponents { get; }
118 |
119 | public IEnumerator GetEnumerator()
120 | {
121 | return new AnimatedGifEnumerator(_input, ColorComponents);
122 | }
123 |
124 | IEnumerator IEnumerable.GetEnumerator()
125 | {
126 | return GetEnumerator();
127 | }
128 | }
129 | }
--------------------------------------------------------------------------------
/Assets/StbImageSharp/AnimatedGifEnumerator.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: e7690d82411d6fe43baebbd293c386af
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/StbImageSharp/ColorComponents.cs:
--------------------------------------------------------------------------------
1 | namespace StbImageSharp
2 | {
3 | #if !STBSHARP_INTERNAL
4 | public
5 | #else
6 | internal
7 | #endif
8 | enum ColorComponents
9 | {
10 | Default,
11 | Grey,
12 | GreyAlpha,
13 | RedGreenBlue,
14 | RedGreenBlueAlpha
15 | }
16 | }
--------------------------------------------------------------------------------
/Assets/StbImageSharp/ColorComponents.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 70dc0369c6ed3b24893ec80dba9e266e
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/StbImageSharp/Hebron.Runtime.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 67ae31ea42bba410ba72d971af1eb138
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Assets/StbImageSharp/Hebron.Runtime/CRuntime.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 |
4 | namespace Hebron.Runtime
5 | {
6 | internal static unsafe class CRuntime
7 | {
8 | private static readonly string numbers = "0123456789";
9 |
10 | public static void* malloc(ulong size)
11 | {
12 | return malloc((long)size);
13 | }
14 |
15 | public static void* malloc(long size)
16 | {
17 | var ptr = Marshal.AllocHGlobal((int)size);
18 |
19 | MemoryStats.Allocated();
20 |
21 | return ptr.ToPointer();
22 | }
23 |
24 | public static void free(void* a)
25 | {
26 | if (a == null)
27 | return;
28 |
29 | var ptr = new IntPtr(a);
30 | Marshal.FreeHGlobal(ptr);
31 | MemoryStats.Freed();
32 | }
33 |
34 | public static void memcpy(void* a, void* b, long size)
35 | {
36 | var ap = (byte*)a;
37 | var bp = (byte*)b;
38 | for (long i = 0; i < size; ++i)
39 | *ap++ = *bp++;
40 | }
41 |
42 | public static void memcpy(void* a, void* b, ulong size)
43 | {
44 | memcpy(a, b, (long)size);
45 | }
46 |
47 | public static void memmove(void* a, void* b, long size)
48 | {
49 | void* temp = null;
50 |
51 | try
52 | {
53 | temp = malloc(size);
54 | memcpy(temp, b, size);
55 | memcpy(a, temp, size);
56 | }
57 |
58 | finally
59 | {
60 | if (temp != null)
61 | free(temp);
62 | }
63 | }
64 |
65 | public static void memmove(void* a, void* b, ulong size)
66 | {
67 | memmove(a, b, (long)size);
68 | }
69 |
70 | public static int memcmp(void* a, void* b, long size)
71 | {
72 | var result = 0;
73 | var ap = (byte*)a;
74 | var bp = (byte*)b;
75 | for (long i = 0; i < size; ++i)
76 | {
77 | if (*ap != *bp)
78 | result += 1;
79 |
80 | ap++;
81 | bp++;
82 | }
83 |
84 | return result;
85 | }
86 |
87 | public static int memcmp(void* a, void* b, ulong size)
88 | {
89 | return memcmp(a, b, (long)size);
90 | }
91 |
92 | public static int memcmp(byte* a, byte[] b, ulong size)
93 | {
94 | fixed (void* bptr = b)
95 | {
96 | return memcmp(a, bptr, (long)size);
97 | }
98 | }
99 |
100 | public static void memset(void* ptr, int value, long size)
101 | {
102 | var bptr = (byte*)ptr;
103 | var bval = (byte)value;
104 | for (long i = 0; i < size; ++i)
105 | *bptr++ = bval;
106 | }
107 |
108 | public static void memset(void* ptr, int value, ulong size)
109 | {
110 | memset(ptr, value, (long)size);
111 | }
112 |
113 | public static uint _lrotl(uint x, int y)
114 | {
115 | return (x << y) | (x >> (32 - y));
116 | }
117 |
118 | public static void* realloc(void* a, long newSize)
119 | {
120 | if (a == null)
121 | return malloc(newSize);
122 |
123 | var ptr = new IntPtr(a);
124 | var result = Marshal.ReAllocHGlobal(ptr, new IntPtr(newSize));
125 |
126 | return result.ToPointer();
127 | }
128 |
129 | public static void* realloc(void* a, ulong newSize)
130 | {
131 | return realloc(a, (long)newSize);
132 | }
133 |
134 | public static int abs(int v)
135 | {
136 | return Math.Abs(v);
137 | }
138 |
139 | public static double pow(double a, double b)
140 | {
141 | return Math.Pow(a, b);
142 | }
143 |
144 | public static void SetArray(T[] data, T value)
145 | {
146 | for (var i = 0; i < data.Length; ++i)
147 | data[i] = value;
148 | }
149 |
150 | public static double ldexp(double number, int exponent)
151 | {
152 | return number * Math.Pow(2, exponent);
153 | }
154 |
155 | public static int strcmp(sbyte* src, string token)
156 | {
157 | var result = 0;
158 |
159 | for (var i = 0; i < token.Length; ++i)
160 | {
161 | if (src[i] != token[i])
162 | {
163 | ++result;
164 | }
165 | }
166 |
167 | return result;
168 | }
169 |
170 | public static int strncmp(sbyte* src, string token, ulong size)
171 | {
172 | var result = 0;
173 |
174 | for (var i = 0; i < Math.Min(token.Length, (int)size); ++i)
175 | {
176 | if (src[i] != token[i])
177 | {
178 | ++result;
179 | }
180 | }
181 |
182 | return result;
183 | }
184 |
185 | public static long strtol(sbyte* start, sbyte** end, int radix)
186 | {
187 | // First step - determine length
188 | var length = 0;
189 | sbyte* ptr = start;
190 | while (numbers.IndexOf((char)*ptr) != -1)
191 | {
192 | ++ptr;
193 | ++length;
194 | }
195 |
196 | long result = 0;
197 |
198 | // Now build up the number
199 | ptr = start;
200 | while (length > 0)
201 | {
202 | long num = numbers.IndexOf((char)*ptr);
203 | long pow = (long)Math.Pow(10, length - 1);
204 | result += num * pow;
205 |
206 | ++ptr;
207 | --length;
208 | }
209 |
210 | if (end != null)
211 | {
212 | *end = ptr;
213 | }
214 |
215 | return result;
216 | }
217 | }
218 | }
--------------------------------------------------------------------------------
/Assets/StbImageSharp/Hebron.Runtime/CRuntime.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 2714d100f8a844f18a983869dbd311ad
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/StbImageSharp/Hebron.Runtime/MemoryStats.cs:
--------------------------------------------------------------------------------
1 | using System.Threading;
2 |
3 | namespace Hebron.Runtime
4 | {
5 | internal unsafe static class MemoryStats
6 | {
7 | private static int _allocations;
8 |
9 | public static int Allocations
10 | {
11 | get
12 | {
13 | return _allocations;
14 | }
15 | }
16 |
17 | internal static void Allocated()
18 | {
19 | Interlocked.Increment(ref _allocations);
20 | }
21 |
22 | internal static void Freed()
23 | {
24 | Interlocked.Decrement(ref _allocations);
25 | }
26 | }
27 | }
--------------------------------------------------------------------------------
/Assets/StbImageSharp/Hebron.Runtime/MemoryStats.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: c9a90fbf6f5b144da8f1a4c74847053e
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/StbImageSharp/Hebron.Runtime/Utility.cs:
--------------------------------------------------------------------------------
1 | namespace Hebron.Runtime
2 | {
3 | internal class Utility
4 | {
5 | public static T[][] CreateArray(int d1, int d2)
6 | {
7 | var result = new T[d1][];
8 | for (int i = 0; i < d1; i++)
9 | {
10 | result[i] = new T[d2];
11 | }
12 |
13 | return result;
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/Assets/StbImageSharp/Hebron.Runtime/Utility.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 9d1918600419740238363988255a2e06
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/StbImageSharp/ImageInfo.cs:
--------------------------------------------------------------------------------
1 | using System.IO;
2 |
3 | namespace StbImageSharp
4 | {
5 | #if !STBSHARP_INTERNAL
6 | public
7 | #else
8 | internal
9 | #endif
10 | struct ImageInfo
11 | {
12 | public int Width;
13 | public int Height;
14 | public ColorComponents ColorComponents;
15 | public int BitsPerChannel;
16 |
17 |
18 | public static unsafe ImageInfo? FromStream(Stream stream)
19 | {
20 | int width, height, comp;
21 | var context = new StbImage.stbi__context(stream);
22 |
23 | var is16Bit = StbImage.stbi__is_16_main(context) == 1;
24 | StbImage.stbi__rewind(context);
25 |
26 | var infoResult = StbImage.stbi__info_main(context, &width, &height, &comp);
27 | StbImage.stbi__rewind(context);
28 |
29 | if (infoResult == 0) return null;
30 |
31 | return new ImageInfo
32 | {
33 | Width = width,
34 | Height = height,
35 | ColorComponents = (ColorComponents)comp,
36 | BitsPerChannel = is16Bit ? 16 : 8
37 | };
38 | }
39 | }
40 | }
--------------------------------------------------------------------------------
/Assets/StbImageSharp/ImageInfo.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 3b234adcdd316c649a24cc66f8280614
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/StbImageSharp/ImageResult.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Runtime.InteropServices;
5 | using Hebron.Runtime;
6 |
7 | namespace StbImageSharp
8 | {
9 | #if !STBSHARP_INTERNAL
10 | public
11 | #else
12 | internal
13 | #endif
14 | class ImageResult
15 | {
16 | public int Width { get; set; }
17 | public int Height { get; set; }
18 | public ColorComponents SourceComp { get; set; }
19 | public ColorComponents Comp { get; set; }
20 | public byte[] Data { get; set; }
21 |
22 | internal static unsafe ImageResult FromResult(byte* result, int width, int height, ColorComponents comp,
23 | ColorComponents req_comp)
24 | {
25 | if (result == null)
26 | throw new InvalidOperationException(StbImage.stbi__g_failure_reason);
27 |
28 | var image = new ImageResult
29 | {
30 | Width = width,
31 | Height = height,
32 | SourceComp = comp,
33 | Comp = req_comp == ColorComponents.Default ? comp : req_comp
34 | };
35 |
36 | // Convert to array
37 | image.Data = new byte[width * height * (int)image.Comp];
38 | Marshal.Copy(new IntPtr(result), image.Data, 0, image.Data.Length);
39 |
40 | return image;
41 | }
42 |
43 | public static unsafe ImageResult FromStream(Stream stream,
44 | ColorComponents requiredComponents = ColorComponents.Default)
45 | {
46 | byte* result = null;
47 |
48 | try
49 | {
50 | int x, y, comp;
51 |
52 | var context = new StbImage.stbi__context(stream);
53 |
54 | result = StbImage.stbi__load_and_postprocess_8bit(context, &x, &y, &comp, (int)requiredComponents);
55 |
56 | return FromResult(result, x, y, (ColorComponents)comp, requiredComponents);
57 | }
58 | finally
59 | {
60 | if (result != null)
61 | CRuntime.free(result);
62 | }
63 | }
64 |
65 | public static ImageResult FromMemory(byte[] data, ColorComponents requiredComponents = ColorComponents.Default)
66 | {
67 | using (var stream = new MemoryStream(data))
68 | {
69 | return FromStream(stream, requiredComponents);
70 | }
71 | }
72 |
73 | public static IEnumerable AnimatedGifFramesFromStream(Stream stream,
74 | ColorComponents requiredComponents = ColorComponents.Default)
75 | {
76 | return new AnimatedGifEnumerable(stream, requiredComponents);
77 | }
78 | }
79 | }
--------------------------------------------------------------------------------
/Assets/StbImageSharp/ImageResult.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 9c9b6e3461ea3084b9a0c9e5c269f5e4
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/StbImageSharp/ImageResultFloat.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using System.Runtime.InteropServices;
4 | using Hebron.Runtime;
5 |
6 | namespace StbImageSharp
7 | {
8 | #if !STBSHARP_INTERNAL
9 | public
10 | #else
11 | internal
12 | #endif
13 | class ImageResultFloat
14 | {
15 | public int Width { get; set; }
16 | public int Height { get; set; }
17 | public ColorComponents SourceComp { get; set; }
18 | public ColorComponents Comp { get; set; }
19 | public float[] Data { get; set; }
20 |
21 | internal static unsafe ImageResultFloat FromResult(float* result, int width, int height, ColorComponents comp,
22 | ColorComponents req_comp)
23 | {
24 | if (result == null)
25 | throw new InvalidOperationException(StbImage.stbi__g_failure_reason);
26 |
27 | var image = new ImageResultFloat
28 | {
29 | Width = width,
30 | Height = height,
31 | SourceComp = comp,
32 | Comp = req_comp == ColorComponents.Default ? comp : req_comp
33 | };
34 |
35 | // Convert to array
36 | image.Data = new float[width * height * (int)image.Comp];
37 | Marshal.Copy(new IntPtr(result), image.Data, 0, image.Data.Length);
38 |
39 | return image;
40 | }
41 |
42 | public static unsafe ImageResultFloat FromStream(Stream stream,
43 | ColorComponents requiredComponents = ColorComponents.Default)
44 | {
45 | float* result = null;
46 |
47 | try
48 | {
49 | int x, y, comp;
50 |
51 | var context = new StbImage.stbi__context(stream);
52 |
53 | result = StbImage.stbi__loadf_main(context, &x, &y, &comp, (int)requiredComponents);
54 |
55 | return FromResult(result, x, y, (ColorComponents)comp, requiredComponents);
56 | }
57 | finally
58 | {
59 | if (result != null)
60 | CRuntime.free(result);
61 | }
62 | }
63 |
64 | public static ImageResultFloat FromMemory(byte[] data,
65 | ColorComponents requiredComponents = ColorComponents.Default)
66 | {
67 | using (var stream = new MemoryStream(data))
68 | {
69 | return FromStream(stream, requiredComponents);
70 | }
71 | }
72 | }
73 | }
--------------------------------------------------------------------------------
/Assets/StbImageSharp/ImageResultFloat.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 330f3b19fda2304458fe5dbe934ac527
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/StbImageSharp/NOTICE.md:
--------------------------------------------------------------------------------
1 | StbImageSharp
2 | ===
3 |
4 | https://github.com/StbSharp/StbImageSharp
5 |
6 | ```
7 | Public Domain
8 | ```
9 |
10 | ## Stb
11 |
12 | https://github.com/nothings/stb
13 |
14 | ```
15 | ALTERNATIVE B - Public Domain (www.unlicense.org)
16 | This is free and unencumbered software released into the public domain.
17 | Anyone is free to copy, modify, publish, use, compile, sell, or distribute this
18 | software, either in source code form or as a compiled binary, for any purpose,
19 | commercial or non-commercial, and by any means.
20 | In jurisdictions that recognize copyright laws, the author or authors of this
21 | software dedicate any and all copyright interest in the software to the public
22 | domain. We make this dedication for the benefit of the public at large and to
23 | the detriment of our heirs and successors. We intend this dedication to be an
24 | overt act of relinquishment in perpetuity of all present and future rights to
25 | this software under copyright law.
26 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
27 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
28 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
29 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
30 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
31 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
32 | ```
--------------------------------------------------------------------------------
/Assets/StbImageSharp/NOTICE.md.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 8d0ea5ca7461b7348ba55b0261559f30
3 | TextScriptImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/Assets/StbImageSharp/StbImage.Generated.Bmp.cs:
--------------------------------------------------------------------------------
1 | // Generated by Sichem at 12/24/2021 8:28:15 PM
2 |
3 | using System.Runtime.InteropServices;
4 | using Hebron.Runtime;
5 |
6 | namespace StbImageSharp
7 | {
8 | unsafe partial class StbImage
9 | {
10 | public static int stbi__bmp_test(stbi__context s)
11 | {
12 | var r = stbi__bmp_test_raw(s);
13 | stbi__rewind(s);
14 | return r;
15 | }
16 |
17 | public static void* stbi__bmp_load(stbi__context s, int* x, int* y, int* comp, int req_comp,
18 | stbi__result_info* ri)
19 | {
20 | byte* _out_;
21 | uint mr = 0;
22 | uint mg = 0;
23 | uint mb = 0;
24 | uint ma = 0;
25 | uint all_a = 0;
26 | var pal = Utility.CreateArray(256, 4);
27 | var psize = 0;
28 | var i = 0;
29 | var j = 0;
30 | var width = 0;
31 | var flip_vertically = 0;
32 | var pad = 0;
33 | var target = 0;
34 | var info = new stbi__bmp_data();
35 | info.all_a = 255;
36 | if (stbi__bmp_parse_header(s, &info) == null)
37 | return null;
38 | flip_vertically = (int)s.img_y > 0 ? 1 : 0;
39 | s.img_y = (uint)CRuntime.abs((int)s.img_y);
40 | if (s.img_y > 1 << 24)
41 | return (byte*)(ulong)(stbi__err("too large") != 0 ? 0 : 0);
42 | if (s.img_x > 1 << 24)
43 | return (byte*)(ulong)(stbi__err("too large") != 0 ? 0 : 0);
44 | mr = info.mr;
45 | mg = info.mg;
46 | mb = info.mb;
47 | ma = info.ma;
48 | all_a = info.all_a;
49 | if (info.hsz == 12)
50 | {
51 | if (info.bpp < 24)
52 | psize = (info.offset - info.extra_read - 24) / 3;
53 | }
54 | else
55 | {
56 | if (info.bpp < 16)
57 | psize = (info.offset - info.extra_read - info.hsz) >> 2;
58 | }
59 |
60 | if (info.bpp == 24 && ma == 0xff000000)
61 | s.img_n = 3;
62 | else
63 | s.img_n = ma != 0 ? 4 : 3;
64 | if (req_comp != 0 && req_comp >= 3)
65 | target = req_comp;
66 | else
67 | target = s.img_n;
68 | if (stbi__mad3sizes_valid(target, (int)s.img_x, (int)s.img_y, 0) == 0)
69 | return (byte*)(ulong)(stbi__err("too large") != 0 ? 0 : 0);
70 | _out_ = (byte*)stbi__malloc_mad3(target, (int)s.img_x, (int)s.img_y, 0);
71 | if (_out_ == null)
72 | return (byte*)(ulong)(stbi__err("outofmem") != 0 ? 0 : 0);
73 | if (info.bpp < 16)
74 | {
75 | var z = 0;
76 | if (psize == 0 || psize > 256)
77 | {
78 | CRuntime.free(_out_);
79 | return (byte*)(ulong)(stbi__err("invalid") != 0 ? 0 : 0);
80 | }
81 |
82 | for (i = 0; i < psize; ++i)
83 | {
84 | pal[i][2] = stbi__get8(s);
85 | pal[i][1] = stbi__get8(s);
86 | pal[i][0] = stbi__get8(s);
87 | if (info.hsz != 12)
88 | stbi__get8(s);
89 | pal[i][3] = 255;
90 | }
91 |
92 | stbi__skip(s, info.offset - info.extra_read - info.hsz - psize * (info.hsz == 12 ? 3 : 4));
93 | if (info.bpp == 1)
94 | {
95 | width = (int)((s.img_x + 7) >> 3);
96 | }
97 | else if (info.bpp == 4)
98 | {
99 | width = (int)((s.img_x + 1) >> 1);
100 | }
101 | else if (info.bpp == 8)
102 | {
103 | width = (int)s.img_x;
104 | }
105 | else
106 | {
107 | CRuntime.free(_out_);
108 | return (byte*)(ulong)(stbi__err("bad bpp") != 0 ? 0 : 0);
109 | }
110 |
111 | pad = -width & 3;
112 | if (info.bpp == 1)
113 | for (j = 0; j < (int)s.img_y; ++j)
114 | {
115 | var bit_offset = 7;
116 | int v = stbi__get8(s);
117 | for (i = 0; i < (int)s.img_x; ++i)
118 | {
119 | var color = (v >> bit_offset) & 0x1;
120 | _out_[z++] = pal[color][0];
121 | _out_[z++] = pal[color][1];
122 | _out_[z++] = pal[color][2];
123 | if (target == 4)
124 | _out_[z++] = 255;
125 | if (i + 1 == (int)s.img_x)
126 | break;
127 | if (--bit_offset < 0)
128 | {
129 | bit_offset = 7;
130 | v = stbi__get8(s);
131 | }
132 | }
133 |
134 | stbi__skip(s, pad);
135 | }
136 | else
137 | for (j = 0; j < (int)s.img_y; ++j)
138 | {
139 | for (i = 0; i < (int)s.img_x; i += 2)
140 | {
141 | int v = stbi__get8(s);
142 | var v2 = 0;
143 | if (info.bpp == 4)
144 | {
145 | v2 = v & 15;
146 | v >>= 4;
147 | }
148 |
149 | _out_[z++] = pal[v][0];
150 | _out_[z++] = pal[v][1];
151 | _out_[z++] = pal[v][2];
152 | if (target == 4)
153 | _out_[z++] = 255;
154 | if (i + 1 == (int)s.img_x)
155 | break;
156 | v = info.bpp == 8 ? stbi__get8(s) : v2;
157 | _out_[z++] = pal[v][0];
158 | _out_[z++] = pal[v][1];
159 | _out_[z++] = pal[v][2];
160 | if (target == 4)
161 | _out_[z++] = 255;
162 | }
163 |
164 | stbi__skip(s, pad);
165 | }
166 | }
167 | else
168 | {
169 | var rshift = 0;
170 | var gshift = 0;
171 | var bshift = 0;
172 | var ashift = 0;
173 | var rcount = 0;
174 | var gcount = 0;
175 | var bcount = 0;
176 | var acount = 0;
177 | var z = 0;
178 | var easy = 0;
179 | stbi__skip(s, info.offset - info.extra_read - info.hsz);
180 | if (info.bpp == 24)
181 | width = (int)(3 * s.img_x);
182 | else if (info.bpp == 16)
183 | width = (int)(2 * s.img_x);
184 | else
185 | width = 0;
186 | pad = -width & 3;
187 | if (info.bpp == 24)
188 | easy = 1;
189 | else if (info.bpp == 32)
190 | if (mb == 0xff && mg == 0xff00 && mr == 0x00ff0000 && ma == 0xff000000)
191 | easy = 2;
192 | if (easy == 0)
193 | {
194 | if (mr == 0 || mg == 0 || mb == 0)
195 | {
196 | CRuntime.free(_out_);
197 | return (byte*)(ulong)(stbi__err("bad masks") != 0 ? 0 : 0);
198 | }
199 |
200 | rshift = stbi__high_bit(mr) - 7;
201 | rcount = stbi__bitcount(mr);
202 | gshift = stbi__high_bit(mg) - 7;
203 | gcount = stbi__bitcount(mg);
204 | bshift = stbi__high_bit(mb) - 7;
205 | bcount = stbi__bitcount(mb);
206 | ashift = stbi__high_bit(ma) - 7;
207 | acount = stbi__bitcount(ma);
208 | if (rcount > 8 || gcount > 8 || bcount > 8 || acount > 8)
209 | {
210 | CRuntime.free(_out_);
211 | return (byte*)(ulong)(stbi__err("bad masks") != 0 ? 0 : 0);
212 | }
213 | }
214 |
215 | for (j = 0; j < (int)s.img_y; ++j)
216 | {
217 | if (easy != 0)
218 | {
219 | for (i = 0; i < (int)s.img_x; ++i)
220 | {
221 | byte a = 0;
222 | _out_[z + 2] = stbi__get8(s);
223 | _out_[z + 1] = stbi__get8(s);
224 | _out_[z + 0] = stbi__get8(s);
225 | z += 3;
226 | a = (byte)(easy == 2 ? stbi__get8(s) : 255);
227 | all_a |= a;
228 | if (target == 4)
229 | _out_[z++] = a;
230 | }
231 | }
232 | else
233 | {
234 | var bpp = info.bpp;
235 | for (i = 0; i < (int)s.img_x; ++i)
236 | {
237 | var v = bpp == 16 ? (uint)stbi__get16le(s) : stbi__get32le(s);
238 | uint a = 0;
239 | _out_[z++] = (byte)(stbi__shiftsigned(v & mr, rshift, rcount) & 255);
240 | _out_[z++] = (byte)(stbi__shiftsigned(v & mg, gshift, gcount) & 255);
241 | _out_[z++] = (byte)(stbi__shiftsigned(v & mb, bshift, bcount) & 255);
242 | a = (uint)(ma != 0 ? stbi__shiftsigned(v & ma, ashift, acount) : 255);
243 | all_a |= a;
244 | if (target == 4)
245 | _out_[z++] = (byte)(a & 255);
246 | }
247 | }
248 |
249 | stbi__skip(s, pad);
250 | }
251 | }
252 |
253 | if (target == 4 && all_a == 0)
254 | for (i = (int)(4 * s.img_x * s.img_y - 1); i >= 0; i -= 4)
255 | _out_[i] = 255;
256 | if (flip_vertically != 0)
257 | {
258 | byte t = 0;
259 | for (j = 0; j < (int)s.img_y >> 1; ++j)
260 | {
261 | var p1 = _out_ + j * s.img_x * target;
262 | var p2 = _out_ + (s.img_y - 1 - j) * s.img_x * target;
263 | for (i = 0; i < (int)s.img_x * target; ++i)
264 | {
265 | t = p1[i];
266 | p1[i] = p2[i];
267 | p2[i] = t;
268 | }
269 | }
270 | }
271 |
272 | if (req_comp != 0 && req_comp != target)
273 | {
274 | _out_ = stbi__convert_format(_out_, target, req_comp, s.img_x, s.img_y);
275 | if (_out_ == null)
276 | return _out_;
277 | }
278 |
279 | *x = (int)s.img_x;
280 | *y = (int)s.img_y;
281 | if (comp != null)
282 | *comp = s.img_n;
283 | return _out_;
284 | }
285 |
286 | public static int stbi__bmp_info(stbi__context s, int* x, int* y, int* comp)
287 | {
288 | void* p;
289 | var info = new stbi__bmp_data();
290 | info.all_a = 255;
291 | p = stbi__bmp_parse_header(s, &info);
292 | if (p == null)
293 | {
294 | stbi__rewind(s);
295 | return 0;
296 | }
297 |
298 | if (x != null)
299 | *x = (int)s.img_x;
300 | if (y != null)
301 | *y = (int)s.img_y;
302 | if (comp != null)
303 | {
304 | if (info.bpp == 24 && info.ma == 0xff000000)
305 | *comp = 3;
306 | else
307 | *comp = info.ma != 0 ? 4 : 3;
308 | }
309 |
310 | return 1;
311 | }
312 |
313 | public static int stbi__bmp_test_raw(stbi__context s)
314 | {
315 | var r = 0;
316 | var sz = 0;
317 | if (stbi__get8(s) != 66)
318 | return 0;
319 | if (stbi__get8(s) != 77)
320 | return 0;
321 | stbi__get32le(s);
322 | stbi__get16le(s);
323 | stbi__get16le(s);
324 | stbi__get32le(s);
325 | sz = (int)stbi__get32le(s);
326 | r = sz == 12 || sz == 40 || sz == 56 || sz == 108 || sz == 124 ? 1 : 0;
327 | return r;
328 | }
329 |
330 | public static int stbi__bmp_set_mask_defaults(stbi__bmp_data* info, int compress)
331 | {
332 | if (compress == 3)
333 | return 1;
334 | if (compress == 0)
335 | {
336 | if (info->bpp == 16)
337 | {
338 | info->mr = 31u << 10;
339 | info->mg = 31u << 5;
340 | info->mb = 31u << 0;
341 | }
342 | else if (info->bpp == 32)
343 | {
344 | info->mr = 0xffu << 16;
345 | info->mg = 0xffu << 8;
346 | info->mb = 0xffu << 0;
347 | info->ma = 0xffu << 24;
348 | info->all_a = 0;
349 | }
350 | else
351 | {
352 | info->mr = info->mg = info->mb = info->ma = 0;
353 | }
354 |
355 | return 1;
356 | }
357 |
358 | return 0;
359 | }
360 |
361 | public static void* stbi__bmp_parse_header(stbi__context s, stbi__bmp_data* info)
362 | {
363 | var hsz = 0;
364 | if (stbi__get8(s) != 66 || stbi__get8(s) != 77)
365 | return (byte*)(ulong)(stbi__err("not BMP") != 0 ? 0 : 0);
366 | stbi__get32le(s);
367 | stbi__get16le(s);
368 | stbi__get16le(s);
369 | info->offset = (int)stbi__get32le(s);
370 | info->hsz = hsz = (int)stbi__get32le(s);
371 | info->mr = info->mg = info->mb = info->ma = 0;
372 | info->extra_read = 14;
373 | if (info->offset < 0)
374 | return (byte*)(ulong)(stbi__err("bad BMP") != 0 ? 0 : 0);
375 | if (hsz != 12 && hsz != 40 && hsz != 56 && hsz != 108 && hsz != 124)
376 | return (byte*)(ulong)(stbi__err("unknown BMP") != 0 ? 0 : 0);
377 | if (hsz == 12)
378 | {
379 | s.img_x = (uint)stbi__get16le(s);
380 | s.img_y = (uint)stbi__get16le(s);
381 | }
382 | else
383 | {
384 | s.img_x = stbi__get32le(s);
385 | s.img_y = stbi__get32le(s);
386 | }
387 |
388 | if (stbi__get16le(s) != 1)
389 | return (byte*)(ulong)(stbi__err("bad BMP") != 0 ? 0 : 0);
390 | info->bpp = stbi__get16le(s);
391 | if (hsz != 12)
392 | {
393 | var compress = (int)stbi__get32le(s);
394 | if (compress == 1 || compress == 2)
395 | return (byte*)(ulong)(stbi__err("BMP RLE") != 0 ? 0 : 0);
396 | if (compress >= 4)
397 | return (byte*)(ulong)(stbi__err("BMP JPEG/PNG") != 0 ? 0 : 0);
398 | if (compress == 3 && info->bpp != 16 && info->bpp != 32)
399 | return (byte*)(ulong)(stbi__err("bad BMP") != 0 ? 0 : 0);
400 | stbi__get32le(s);
401 | stbi__get32le(s);
402 | stbi__get32le(s);
403 | stbi__get32le(s);
404 | stbi__get32le(s);
405 | if (hsz == 40 || hsz == 56)
406 | {
407 | if (hsz == 56)
408 | {
409 | stbi__get32le(s);
410 | stbi__get32le(s);
411 | stbi__get32le(s);
412 | stbi__get32le(s);
413 | }
414 |
415 | if (info->bpp == 16 || info->bpp == 32)
416 | {
417 | if (compress == 0)
418 | {
419 | stbi__bmp_set_mask_defaults(info, compress);
420 | }
421 | else if (compress == 3)
422 | {
423 | info->mr = stbi__get32le(s);
424 | info->mg = stbi__get32le(s);
425 | info->mb = stbi__get32le(s);
426 | info->extra_read += 12;
427 | if (info->mr == info->mg && info->mg == info->mb)
428 | return (byte*)(ulong)(stbi__err("bad BMP") != 0 ? 0 : 0);
429 | }
430 | else
431 | {
432 | return (byte*)(ulong)(stbi__err("bad BMP") != 0 ? 0 : 0);
433 | }
434 | }
435 | }
436 | else
437 | {
438 | var i = 0;
439 | if (hsz != 108 && hsz != 124)
440 | return (byte*)(ulong)(stbi__err("bad BMP") != 0 ? 0 : 0);
441 | info->mr = stbi__get32le(s);
442 | info->mg = stbi__get32le(s);
443 | info->mb = stbi__get32le(s);
444 | info->ma = stbi__get32le(s);
445 | if (compress != 3)
446 | stbi__bmp_set_mask_defaults(info, compress);
447 | stbi__get32le(s);
448 | for (i = 0; i < 12; ++i)
449 | stbi__get32le(s);
450 | if (hsz == 124)
451 | {
452 | stbi__get32le(s);
453 | stbi__get32le(s);
454 | stbi__get32le(s);
455 | stbi__get32le(s);
456 | }
457 | }
458 | }
459 |
460 | return (void*)1;
461 | }
462 |
463 | [StructLayout(LayoutKind.Sequential)]
464 | public struct stbi__bmp_data
465 | {
466 | public int bpp;
467 | public int offset;
468 | public int hsz;
469 | public uint mr;
470 | public uint mg;
471 | public uint mb;
472 | public uint ma;
473 | public uint all_a;
474 | public int extra_read;
475 | }
476 | }
477 | }
--------------------------------------------------------------------------------
/Assets/StbImageSharp/StbImage.Generated.Bmp.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: f245cd21252f1e548a1963b709e6b5a5
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/StbImageSharp/StbImage.Generated.Common.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: a9ef396dafa261545a515d8fa7af59b8
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/StbImageSharp/StbImage.Generated.Gif.cs:
--------------------------------------------------------------------------------
1 | // Generated by Sichem at 12/24/2021 8:28:15 PM
2 |
3 | using System.Runtime.InteropServices;
4 | using Hebron.Runtime;
5 |
6 | namespace StbImageSharp
7 | {
8 | unsafe partial class StbImage
9 | {
10 | public static int stbi__gif_test(stbi__context s)
11 | {
12 | var r = stbi__gif_test_raw(s);
13 | stbi__rewind(s);
14 | return r;
15 | }
16 |
17 | public static void* stbi__gif_load(stbi__context s, int* x, int* y, int* comp, int req_comp,
18 | stbi__result_info* ri)
19 | {
20 | byte* u = null;
21 | var g = new stbi__gif();
22 | u = stbi__gif_load_next(s, g, comp, req_comp, null);
23 | if (u != null)
24 | {
25 | *x = g.w;
26 | *y = g.h;
27 | if (req_comp != 0 && req_comp != 4)
28 | u = stbi__convert_format(u, 4, req_comp, (uint)g.w, (uint)g.h);
29 | }
30 | else if (g._out_ != null)
31 | {
32 | CRuntime.free(g._out_);
33 | }
34 |
35 | CRuntime.free(g.history);
36 | CRuntime.free(g.background);
37 | return u;
38 | }
39 |
40 | public static void* stbi__load_gif_main(stbi__context s, int** delays, int* x, int* y, int* z, int* comp,
41 | int req_comp)
42 | {
43 | if (stbi__gif_test(s) != 0)
44 | {
45 | var layers = 0;
46 | byte* u = null;
47 | byte* _out_ = null;
48 | byte* two_back = null;
49 | var g = new stbi__gif();
50 | var stride = 0;
51 | var out_size = 0;
52 | var delays_size = 0;
53 | if (delays != null)
54 | *delays = null;
55 | do
56 | {
57 | u = stbi__gif_load_next(s, g, comp, req_comp, two_back);
58 | if (u != null)
59 | {
60 | *x = g.w;
61 | *y = g.h;
62 | ++layers;
63 | stride = g.w * g.h * 4;
64 | if (_out_ != null)
65 | {
66 | void* tmp = (byte*)CRuntime.realloc(_out_, (ulong)(layers * stride));
67 | if (tmp == null)
68 | return stbi__load_gif_main_outofmem(g, _out_, delays);
69 | _out_ = (byte*)tmp;
70 | out_size = layers * stride;
71 | if (delays != null)
72 | {
73 | var new_delays = (int*)CRuntime.realloc(*delays, (ulong)(sizeof(int) * layers));
74 | if (new_delays == null)
75 | return stbi__load_gif_main_outofmem(g, _out_, delays);
76 | *delays = new_delays;
77 | delays_size = layers * sizeof(int);
78 | }
79 | }
80 | else
81 | {
82 | _out_ = (byte*)stbi__malloc((ulong)(layers * stride));
83 | if (_out_ == null)
84 | return stbi__load_gif_main_outofmem(g, _out_, delays);
85 | out_size = layers * stride;
86 | if (delays != null)
87 | {
88 | *delays = (int*)stbi__malloc((ulong)(layers * sizeof(int)));
89 | if (*delays == null)
90 | return stbi__load_gif_main_outofmem(g, _out_, delays);
91 | delays_size = layers * sizeof(int);
92 | }
93 | }
94 |
95 | CRuntime.memcpy(_out_ + (layers - 1) * stride, u, (ulong)stride);
96 | if (layers >= 2)
97 | two_back = _out_ - 2 * stride;
98 | if (delays != null)
99 | (*delays)[layers - 1U] = g.delay;
100 | }
101 | } while (u != null);
102 |
103 | CRuntime.free(g._out_);
104 | CRuntime.free(g.history);
105 | CRuntime.free(g.background);
106 | if (req_comp != 0 && req_comp != 4)
107 | _out_ = stbi__convert_format(_out_, 4, req_comp, (uint)(layers * g.w), (uint)g.h);
108 | *z = layers;
109 | return _out_;
110 | }
111 |
112 | return (byte*)(ulong)(stbi__err("not GIF") != 0 ? 0 : 0);
113 | }
114 |
115 | public static int stbi__gif_info(stbi__context s, int* x, int* y, int* comp)
116 | {
117 | return stbi__gif_info_raw(s, x, y, comp);
118 | }
119 |
120 | public static int stbi__gif_test_raw(stbi__context s)
121 | {
122 | var sz = 0;
123 | if (stbi__get8(s) != 71 || stbi__get8(s) != 73 || stbi__get8(s) != 70 || stbi__get8(s) != 56)
124 | return 0;
125 | sz = stbi__get8(s);
126 | if (sz != 57 && sz != 55)
127 | return 0;
128 | if (stbi__get8(s) != 97)
129 | return 0;
130 | return 1;
131 | }
132 |
133 | public static void stbi__gif_parse_colortable(stbi__context s, byte[][] pal, int num_entries, int transp)
134 | {
135 | var i = 0;
136 | for (i = 0; i < num_entries; ++i)
137 | {
138 | pal[i][2] = stbi__get8(s);
139 | pal[i][1] = stbi__get8(s);
140 | pal[i][0] = stbi__get8(s);
141 | pal[i][3] = (byte)(transp == i ? 0 : 255);
142 | }
143 | }
144 |
145 | public static int stbi__gif_header(stbi__context s, stbi__gif g, int* comp, int is_info)
146 | {
147 | byte version = 0;
148 | if (stbi__get8(s) != 71 || stbi__get8(s) != 73 || stbi__get8(s) != 70 || stbi__get8(s) != 56)
149 | return stbi__err("not GIF");
150 | version = stbi__get8(s);
151 | if (version != 55 && version != 57)
152 | return stbi__err("not GIF");
153 | if (stbi__get8(s) != 97)
154 | return stbi__err("not GIF");
155 | stbi__g_failure_reason = "";
156 | g.w = stbi__get16le(s);
157 | g.h = stbi__get16le(s);
158 | g.flags = stbi__get8(s);
159 | g.bgindex = stbi__get8(s);
160 | g.ratio = stbi__get8(s);
161 | g.transparent = -1;
162 | if (g.w > 1 << 24)
163 | return stbi__err("too large");
164 | if (g.h > 1 << 24)
165 | return stbi__err("too large");
166 | if (comp != null)
167 | *comp = 4;
168 | if (is_info != 0)
169 | return 1;
170 | if ((g.flags & 0x80) != 0)
171 | stbi__gif_parse_colortable(s, g.pal, 2 << (g.flags & 7), -1);
172 | return 1;
173 | }
174 |
175 | public static int stbi__gif_info_raw(stbi__context s, int* x, int* y, int* comp)
176 | {
177 | var g = new stbi__gif();
178 | if (g == null)
179 | return stbi__err("outofmem");
180 | if (stbi__gif_header(s, g, comp, 1) == 0)
181 | {
182 | stbi__rewind(s);
183 | return 0;
184 | }
185 |
186 | if (x != null)
187 | *x = g.w;
188 | if (y != null)
189 | *y = g.h;
190 | return 1;
191 | }
192 |
193 | public static void stbi__out_gif_code(stbi__gif g, ushort code)
194 | {
195 | byte* p;
196 | var idx = 0;
197 | if (g.codes[code].prefix >= 0)
198 | stbi__out_gif_code(g, (ushort)g.codes[code].prefix);
199 | if (g.cur_y >= g.max_y)
200 | return;
201 | idx = g.cur_x + g.cur_y;
202 | p = &g._out_[idx];
203 | g.history[idx / 4] = 1;
204 | var c = g.color_table[g.codes[code].suffix];
205 | if (c[3] > 128)
206 | {
207 | p[0] = c[2];
208 | p[1] = c[1];
209 | p[2] = c[0];
210 | p[3] = c[3];
211 | }
212 |
213 | g.cur_x += 4;
214 | if (g.cur_x >= g.max_x)
215 | {
216 | g.cur_x = g.start_x;
217 | g.cur_y += g.step;
218 | while (g.cur_y >= g.max_y && g.parse > 0)
219 | {
220 | g.step = (1 << g.parse) * g.line_size;
221 | g.cur_y = g.start_y + (g.step >> 1);
222 | --g.parse;
223 | }
224 | }
225 | }
226 |
227 | public static byte* stbi__process_gif_raster(stbi__context s, stbi__gif g)
228 | {
229 | byte lzw_cs = 0;
230 | var len = 0;
231 | var init_code = 0;
232 | uint first = 0;
233 | var codesize = 0;
234 | var codemask = 0;
235 | var avail = 0;
236 | var oldcode = 0;
237 | var bits = 0;
238 | var valid_bits = 0;
239 | var clear = 0;
240 | stbi__gif_lzw* p;
241 | lzw_cs = stbi__get8(s);
242 | if (lzw_cs > 12)
243 | return null;
244 | clear = 1 << lzw_cs;
245 | first = 1;
246 | codesize = lzw_cs + 1;
247 | codemask = (1 << codesize) - 1;
248 | bits = 0;
249 | valid_bits = 0;
250 | for (init_code = 0; init_code < clear; init_code++)
251 | {
252 | g.codes[init_code].prefix = -1;
253 | g.codes[init_code].first = (byte)init_code;
254 | g.codes[init_code].suffix = (byte)init_code;
255 | }
256 |
257 | avail = clear + 2;
258 | oldcode = -1;
259 | len = 0;
260 | for (; ; )
261 | if (valid_bits < codesize)
262 | {
263 | if (len == 0)
264 | {
265 | len = stbi__get8(s);
266 | if (len == 0)
267 | return g._out_;
268 | }
269 |
270 | --len;
271 | bits |= stbi__get8(s) << valid_bits;
272 | valid_bits += 8;
273 | }
274 | else
275 | {
276 | var code = bits & codemask;
277 | bits >>= codesize;
278 | valid_bits -= codesize;
279 | if (code == clear)
280 | {
281 | codesize = lzw_cs + 1;
282 | codemask = (1 << codesize) - 1;
283 | avail = clear + 2;
284 | oldcode = -1;
285 | first = 0;
286 | }
287 | else if (code == clear + 1)
288 | {
289 | stbi__skip(s, len);
290 | while ((len = stbi__get8(s)) > 0)
291 | stbi__skip(s, len);
292 | return g._out_;
293 | }
294 | else if (code <= avail)
295 | {
296 | if (first != 0)
297 | return (byte*)(ulong)(stbi__err("no clear code") != 0 ? 0 : 0);
298 | if (oldcode >= 0)
299 | {
300 | fixed (stbi__gif_lzw *p2 = &g.codes[avail++])
301 | {
302 | p = p2;
303 | if (avail > 8192)
304 | return (byte*)(ulong)(stbi__err("too many codes") != 0 ? 0 : 0);
305 | p->prefix = (short)oldcode;
306 | p->first = g.codes[oldcode].first;
307 | p->suffix = code == avail ? p->first : g.codes[code].first;
308 | }
309 | }
310 | else if (code == avail)
311 | {
312 | return (byte*)(ulong)(stbi__err("illegal code in raster") != 0 ? 0 : 0);
313 | }
314 |
315 | stbi__out_gif_code(g, (ushort)code);
316 | if ((avail & codemask) == 0 && avail <= 0x0FFF)
317 | {
318 | codesize++;
319 | codemask = (1 << codesize) - 1;
320 | }
321 |
322 | oldcode = code;
323 | }
324 | else
325 | {
326 | return (byte*)(ulong)(stbi__err("illegal code in raster") != 0 ? 0 : 0);
327 | }
328 | }
329 | }
330 |
331 | public static byte* stbi__gif_load_next(stbi__context s, stbi__gif g, int* comp, int req_comp, byte* two_back)
332 | {
333 | var dispose = 0;
334 | var first_frame = 0;
335 | var pi = 0;
336 | var pcount = 0;
337 | first_frame = 0;
338 | if (g._out_ == null)
339 | {
340 | if (stbi__gif_header(s, g, comp, 0) == 0)
341 | return null;
342 | if (stbi__mad3sizes_valid(4, g.w, g.h, 0) == 0)
343 | return (byte*)(ulong)(stbi__err("too large") != 0 ? 0 : 0);
344 | pcount = g.w * g.h;
345 | g._out_ = (byte*)stbi__malloc((ulong)(4 * pcount));
346 | g.background = (byte*)stbi__malloc((ulong)(4 * pcount));
347 | g.history = (byte*)stbi__malloc((ulong)pcount);
348 | if (g._out_ == null || g.background == null || g.history == null)
349 | return (byte*)(ulong)(stbi__err("outofmem") != 0 ? 0 : 0);
350 | CRuntime.memset(g._out_, 0x00, (ulong)(4 * pcount));
351 | CRuntime.memset(g.background, 0x00, (ulong)(4 * pcount));
352 | CRuntime.memset(g.history, 0x00, (ulong)pcount);
353 | first_frame = 1;
354 | }
355 | else
356 | {
357 | dispose = (g.eflags & 0x1C) >> 2;
358 | pcount = g.w * g.h;
359 | if (dispose == 3 && two_back == null)
360 | dispose = 2;
361 | if (dispose == 3)
362 | {
363 | for (pi = 0; pi < pcount; ++pi)
364 | if (g.history[pi] != 0)
365 | CRuntime.memcpy(&g._out_[pi * 4], &two_back[pi * 4], (ulong)4);
366 | }
367 | else if (dispose == 2)
368 | {
369 | for (pi = 0; pi < pcount; ++pi)
370 | if (g.history[pi] != 0)
371 | CRuntime.memcpy(&g._out_[pi * 4], &g.background[pi * 4], (ulong)4);
372 | }
373 |
374 | CRuntime.memcpy(g.background, g._out_, (ulong)(4 * g.w * g.h));
375 | }
376 |
377 | CRuntime.memset(g.history, 0x00, (ulong)(g.w * g.h));
378 | for (; ; )
379 | {
380 | int tag = stbi__get8(s);
381 | switch (tag)
382 | {
383 | case 0x2C:
384 | {
385 | var x = 0;
386 | var y = 0;
387 | var w = 0;
388 | var h = 0;
389 | byte* o;
390 | x = stbi__get16le(s);
391 | y = stbi__get16le(s);
392 | w = stbi__get16le(s);
393 | h = stbi__get16le(s);
394 | if (x + w > g.w || y + h > g.h)
395 | return (byte*)(ulong)(stbi__err("bad Image Descriptor") != 0 ? 0 : 0);
396 | g.line_size = g.w * 4;
397 | g.start_x = x * 4;
398 | g.start_y = y * g.line_size;
399 | g.max_x = g.start_x + w * 4;
400 | g.max_y = g.start_y + h * g.line_size;
401 | g.cur_x = g.start_x;
402 | g.cur_y = g.start_y;
403 | if (w == 0)
404 | g.cur_y = g.max_y;
405 | g.lflags = stbi__get8(s);
406 | if ((g.lflags & 0x40) != 0)
407 | {
408 | g.step = 8 * g.line_size;
409 | g.parse = 3;
410 | }
411 | else
412 | {
413 | g.step = g.line_size;
414 | g.parse = 0;
415 | }
416 |
417 | if ((g.lflags & 0x80) != 0)
418 | {
419 | stbi__gif_parse_colortable(s, g.lpal, 2 << (g.lflags & 7),
420 | (g.eflags & 0x01) != 0 ? g.transparent : -1);
421 | g.color_table = g.lpal;
422 | }
423 | else if ((g.flags & 0x80) != 0)
424 | {
425 | g.color_table = g.pal;
426 | }
427 | else
428 | {
429 | return (byte*)(ulong)(stbi__err("missing color table") != 0 ? 0 : 0);
430 | }
431 |
432 | o = stbi__process_gif_raster(s, g);
433 | if (o == null)
434 | return null;
435 | pcount = g.w * g.h;
436 | if (first_frame != 0 && g.bgindex > 0)
437 | for (pi = 0; pi < pcount; ++pi)
438 | if (g.history[pi] == 0)
439 | {
440 | g.pal[g.bgindex][3] = 255;
441 | fixed (byte* ptr = &g.pal[g.bgindex][0])
442 | {
443 | CRuntime.memcpy(&g._out_[pi * 4], ptr, (ulong)4);
444 | }
445 | }
446 |
447 | return o;
448 | }
449 |
450 | case 0x21:
451 | {
452 | var len = 0;
453 | int ext = stbi__get8(s);
454 | if (ext == 0xF9)
455 | {
456 | len = stbi__get8(s);
457 | if (len == 4)
458 | {
459 | g.eflags = stbi__get8(s);
460 | g.delay = 10 * stbi__get16le(s);
461 | if (g.transparent >= 0)
462 | g.pal[g.transparent][3] = 255;
463 | if ((g.eflags & 0x01) != 0)
464 | {
465 | g.transparent = stbi__get8(s);
466 | if (g.transparent >= 0)
467 | g.pal[g.transparent][3] = 0;
468 | }
469 | else
470 | {
471 | stbi__skip(s, 1);
472 | g.transparent = -1;
473 | }
474 | }
475 | else
476 | {
477 | stbi__skip(s, len);
478 | break;
479 | }
480 | }
481 |
482 | while ((len = stbi__get8(s)) != 0)
483 | stbi__skip(s, len);
484 | break;
485 | }
486 |
487 | case 0x3B:
488 | return null;
489 | default:
490 | return (byte*)(ulong)(stbi__err("unknown code") != 0 ? 0 : 0);
491 | }
492 | }
493 | }
494 |
495 | public static void* stbi__load_gif_main_outofmem(stbi__gif g, byte* _out_, int** delays)
496 | {
497 | CRuntime.free(g._out_);
498 | CRuntime.free(g.history);
499 | CRuntime.free(g.background);
500 | if (_out_ != null)
501 | CRuntime.free(_out_);
502 | if (delays != null && *delays != null)
503 | CRuntime.free(*delays);
504 | return (byte*)(ulong)(stbi__err("outofmem") != 0 ? 0 : 0);
505 | }
506 |
507 | public class stbi__gif
508 | {
509 | public byte* _out_;
510 | public byte* background;
511 | public int bgindex;
512 | public stbi__gif_lzw[] codes = new stbi__gif_lzw[8192];
513 | public byte[][] color_table;
514 | public int cur_x;
515 | public int cur_y;
516 | public int delay;
517 | public int eflags;
518 | public int flags;
519 | public int h;
520 | public byte* history;
521 | public int lflags;
522 | public int line_size;
523 | public byte[][] lpal = Utility.CreateArray(256, 4);
524 | public int max_x;
525 | public int max_y;
526 | public byte[][] pal = Utility.CreateArray(256, 4);
527 | public int parse;
528 | public int ratio;
529 | public int start_x;
530 | public int start_y;
531 | public int step;
532 | public int transparent;
533 | public int w;
534 | }
535 |
536 | [StructLayout(LayoutKind.Sequential)]
537 | public struct stbi__gif_lzw
538 | {
539 | public short prefix;
540 | public byte first;
541 | public byte suffix;
542 | }
543 | }
544 | }
--------------------------------------------------------------------------------
/Assets/StbImageSharp/StbImage.Generated.Gif.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: d541a063aa2b07744be6d45ff4647ace
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/StbImageSharp/StbImage.Generated.Hdr.cs:
--------------------------------------------------------------------------------
1 | // Generated by Sichem at 12/24/2021 8:28:15 PM
2 |
3 | using Hebron.Runtime;
4 |
5 | namespace StbImageSharp
6 | {
7 | unsafe partial class StbImage
8 | {
9 | public static int stbi__hdr_test(stbi__context s)
10 | {
11 | var r = stbi__hdr_test_core(s, "#?RADIANCE\n");
12 | stbi__rewind(s);
13 | if (r == 0)
14 | {
15 | r = stbi__hdr_test_core(s, "#?RGBE\n");
16 | stbi__rewind(s);
17 | }
18 |
19 | return r;
20 | }
21 |
22 | public static float* stbi__hdr_load(stbi__context s, int* x, int* y, int* comp, int req_comp,
23 | stbi__result_info* ri)
24 | {
25 | var buffer = stackalloc sbyte[1024];
26 | sbyte* token;
27 | var valid = 0;
28 | var width = 0;
29 | var height = 0;
30 | byte* scanline;
31 | float* hdr_data;
32 | var len = 0;
33 | byte count = 0;
34 | byte value = 0;
35 | var i = 0;
36 | var j = 0;
37 | var k = 0;
38 | var c1 = 0;
39 | var c2 = 0;
40 | var z = 0;
41 | sbyte* headerToken;
42 | headerToken = stbi__hdr_gettoken(s, buffer);
43 | if (CRuntime.strcmp(headerToken, "#?RADIANCE") != 0 && CRuntime.strcmp(headerToken, "#?RGBE") != 0)
44 | return (float*)(ulong)(stbi__err("not HDR") != 0 ? 0 : 0);
45 | for (; ; )
46 | {
47 | token = stbi__hdr_gettoken(s, buffer);
48 | if (token[0] == 0)
49 | break;
50 | if (CRuntime.strcmp(token, "FORMAT=32-bit_rle_rgbe") == 0)
51 | valid = 1;
52 | }
53 |
54 | if (valid == 0)
55 | return (float*)(ulong)(stbi__err("unsupported format") != 0 ? 0 : 0);
56 | token = stbi__hdr_gettoken(s, buffer);
57 | if (CRuntime.strncmp(token, "-Y ", 3) != 0)
58 | return (float*)(ulong)(stbi__err("unsupported data layout") != 0 ? 0 : 0);
59 | token += 3;
60 | height = (int)CRuntime.strtol(token, &token, 10);
61 | while (*token == 32)
62 | ++token;
63 | if (CRuntime.strncmp(token, "+X ", 3) != 0)
64 | return (float*)(ulong)(stbi__err("unsupported data layout") != 0 ? 0 : 0);
65 | token += 3;
66 | width = (int)CRuntime.strtol(token, null, 10);
67 | if (height > 1 << 24)
68 | return (float*)(ulong)(stbi__err("too large") != 0 ? 0 : 0);
69 | if (width > 1 << 24)
70 | return (float*)(ulong)(stbi__err("too large") != 0 ? 0 : 0);
71 | *x = width;
72 | *y = height;
73 | if (comp != null)
74 | *comp = 3;
75 | if (req_comp == 0)
76 | req_comp = 3;
77 | if (stbi__mad4sizes_valid(width, height, req_comp, sizeof(float), 0) == 0)
78 | return (float*)(ulong)(stbi__err("too large") != 0 ? 0 : 0);
79 | hdr_data = (float*)stbi__malloc_mad4(width, height, req_comp, sizeof(float), 0);
80 | if (hdr_data == null)
81 | return (float*)(ulong)(stbi__err("outofmem") != 0 ? 0 : 0);
82 | main_decode_loop:
83 | var enterMainDecode = false;
84 | if (enterMainDecode)
85 | {
86 | for (; j < height; ++j)
87 | for (; i < width; ++i)
88 | {
89 | var rgbe = stackalloc byte[4];
90 | stbi__getn(s, rgbe, 4);
91 | stbi__hdr_convert(hdr_data + j * width * req_comp + i * req_comp, rgbe, req_comp);
92 | }
93 |
94 | goto finish;
95 | }
96 |
97 | if (width < 8 || width >= 32768)
98 | {
99 | i = j = 0;
100 | enterMainDecode = true;
101 | goto main_decode_loop;
102 | }
103 |
104 | scanline = null;
105 | for (j = 0; j < height; ++j)
106 | {
107 | c1 = stbi__get8(s);
108 | c2 = stbi__get8(s);
109 | len = stbi__get8(s);
110 | if (c1 != 2 || c2 != 2 || (len & 0x80) != 0)
111 | {
112 | var rgbe = stackalloc byte[4];
113 | rgbe[0] = (byte)c1;
114 | rgbe[1] = (byte)c2;
115 | rgbe[2] = (byte)len;
116 | rgbe[3] = stbi__get8(s);
117 | stbi__hdr_convert(hdr_data, rgbe, req_comp);
118 | i = 1;
119 | j = 0;
120 | CRuntime.free(scanline);
121 | goto main_decode_loop;
122 | }
123 |
124 | len <<= 8;
125 | len |= stbi__get8(s);
126 | if (len != width)
127 | {
128 | CRuntime.free(hdr_data);
129 | CRuntime.free(scanline);
130 | return (float*)(ulong)(stbi__err("invalid decoded scanline length") != 0 ? 0 : 0);
131 | }
132 |
133 | if (scanline == null)
134 | {
135 | scanline = (byte*)stbi__malloc_mad2(width, 4, 0);
136 | if (scanline == null)
137 | {
138 | CRuntime.free(hdr_data);
139 | return (float*)(ulong)(stbi__err("outofmem") != 0 ? 0 : 0);
140 | }
141 | }
142 |
143 | for (k = 0; k < 4; ++k)
144 | {
145 | var nleft = 0;
146 | i = 0;
147 | while ((nleft = width - i) > 0)
148 | {
149 | count = stbi__get8(s);
150 | if (count > 128)
151 | {
152 | value = stbi__get8(s);
153 | count -= 128;
154 | if (count > nleft)
155 | {
156 | CRuntime.free(hdr_data);
157 | CRuntime.free(scanline);
158 | return (float*)(ulong)(stbi__err("corrupt") != 0 ? 0 : 0);
159 | }
160 |
161 | for (z = 0; z < count; ++z)
162 | scanline[i++ * 4 + k] = value;
163 | }
164 | else
165 | {
166 | if (count > nleft)
167 | {
168 | CRuntime.free(hdr_data);
169 | CRuntime.free(scanline);
170 | return (float*)(ulong)(stbi__err("corrupt") != 0 ? 0 : 0);
171 | }
172 |
173 | for (z = 0; z < count; ++z)
174 | scanline[i++ * 4 + k] = stbi__get8(s);
175 | }
176 | }
177 | }
178 |
179 | for (i = 0; i < width; ++i)
180 | stbi__hdr_convert(hdr_data + (j * width + i) * req_comp, scanline + i * 4, req_comp);
181 | }
182 |
183 | if (scanline != null)
184 | CRuntime.free(scanline);
185 | finish:
186 | return hdr_data;
187 | }
188 |
189 | public static int stbi__hdr_info(stbi__context s, int* x, int* y, int* comp)
190 | {
191 | var buffer = stackalloc sbyte[1024];
192 | sbyte* token;
193 | var valid = 0;
194 | var dummy = 0;
195 | if (x == null)
196 | x = &dummy;
197 | if (y == null)
198 | y = &dummy;
199 | if (comp == null)
200 | comp = &dummy;
201 | if (stbi__hdr_test(s) == 0)
202 | {
203 | stbi__rewind(s);
204 | return 0;
205 | }
206 |
207 | for (; ; )
208 | {
209 | token = stbi__hdr_gettoken(s, buffer);
210 | if (token[0] == 0)
211 | break;
212 | if (CRuntime.strcmp(token, "FORMAT=32-bit_rle_rgbe") == 0)
213 | valid = 1;
214 | }
215 |
216 | if (valid == 0)
217 | {
218 | stbi__rewind(s);
219 | return 0;
220 | }
221 |
222 | token = stbi__hdr_gettoken(s, buffer);
223 | if (CRuntime.strncmp(token, "-Y ", 3) != 0)
224 | {
225 | stbi__rewind(s);
226 | return 0;
227 | }
228 |
229 | token += 3;
230 | *y = (int)CRuntime.strtol(token, &token, 10);
231 | while (*token == 32)
232 | ++token;
233 | if (CRuntime.strncmp(token, "+X ", 3) != 0)
234 | {
235 | stbi__rewind(s);
236 | return 0;
237 | }
238 |
239 | token += 3;
240 | *x = (int)CRuntime.strtol(token, null, 10);
241 | *comp = 3;
242 | return 1;
243 | }
244 |
245 | public static byte* stbi__hdr_to_ldr(float* data, int x, int y, int comp)
246 | {
247 | var i = 0;
248 | var k = 0;
249 | var n = 0;
250 | byte* output;
251 | if (data == null)
252 | return null;
253 | output = (byte*)stbi__malloc_mad3(x, y, comp, 0);
254 | if (output == null)
255 | {
256 | CRuntime.free(data);
257 | return (byte*)(ulong)(stbi__err("outofmem") != 0 ? 0 : 0);
258 | }
259 |
260 | if ((comp & 1) != 0)
261 | n = comp;
262 | else
263 | n = comp - 1;
264 | for (i = 0; i < x * y; ++i)
265 | {
266 | for (k = 0; k < n; ++k)
267 | {
268 | var z = (float)CRuntime.pow(data[i * comp + k] * stbi__h2l_scale_i, stbi__h2l_gamma_i) * 255 +
269 | 0.5f;
270 | if (z < 0)
271 | z = 0;
272 | if (z > 255)
273 | z = 255;
274 | output[i * comp + k] = (byte)(int)z;
275 | }
276 |
277 | if (k < comp)
278 | {
279 | var z = data[i * comp + k] * 255 + 0.5f;
280 | if (z < 0)
281 | z = 0;
282 | if (z > 255)
283 | z = 255;
284 | output[i * comp + k] = (byte)(int)z;
285 | }
286 | }
287 |
288 | CRuntime.free(data);
289 | return output;
290 | }
291 |
292 | public static int stbi__hdr_test_core(stbi__context s, string signature)
293 | {
294 | var i = 0;
295 | for (i = 0; i < signature.Length; ++i)
296 | if (stbi__get8(s) != signature[i])
297 | return 0;
298 | stbi__rewind(s);
299 | return 1;
300 | }
301 |
302 | public static sbyte* stbi__hdr_gettoken(stbi__context z, sbyte* buffer)
303 | {
304 | var len = 0;
305 | sbyte c = 0;
306 | c = (sbyte)stbi__get8(z);
307 | while (stbi__at_eof(z) == 0 && c != 10)
308 | {
309 | buffer[len++] = c;
310 | if (len == 1024 - 1)
311 | {
312 | while (stbi__at_eof(z) == 0 && stbi__get8(z) != 10)
313 | {
314 | }
315 |
316 | break;
317 | }
318 |
319 | c = (sbyte)stbi__get8(z);
320 | }
321 |
322 | buffer[len] = 0;
323 | return buffer;
324 | }
325 |
326 | public static void stbi__hdr_convert(float* output, byte* input, int req_comp)
327 | {
328 | if (input[3] != 0)
329 | {
330 | float f1 = 0;
331 | f1 = (float)CRuntime.ldexp(1.0f, input[3] - (128 + 8));
332 | if (req_comp <= 2)
333 | {
334 | output[0] = (input[0] + input[1] + input[2]) * f1 / 3;
335 | }
336 | else
337 | {
338 | output[0] = input[0] * f1;
339 | output[1] = input[1] * f1;
340 | output[2] = input[2] * f1;
341 | }
342 |
343 | if (req_comp == 2)
344 | output[1] = 1;
345 | if (req_comp == 4)
346 | output[3] = 1;
347 | }
348 | else
349 | {
350 | switch (req_comp)
351 | {
352 | case 4:
353 | case 3:
354 | if (req_comp == 4)
355 | output[3] = 1;
356 | output[0] = output[1] = output[2] = 0;
357 | break;
358 | case 2:
359 | case 1:
360 | if (req_comp == 2)
361 | output[1] = 1;
362 | output[0] = 0;
363 | break;
364 | }
365 | }
366 | }
367 | }
368 | }
--------------------------------------------------------------------------------
/Assets/StbImageSharp/StbImage.Generated.Hdr.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 5ade6e2c3597b7f4dbd68da47b2bea14
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/StbImageSharp/StbImage.Generated.Jpg.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 666d2e7167c00dd469af63f9c1cad813
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/StbImageSharp/StbImage.Generated.Png.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: ed0e5400fe2845a469bc55f6d202a843
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/StbImageSharp/StbImage.Generated.Psd.cs:
--------------------------------------------------------------------------------
1 | // Generated by Sichem at 12/24/2021 8:28:15 PM
2 |
3 | using Hebron.Runtime;
4 |
5 | namespace StbImageSharp
6 | {
7 | unsafe partial class StbImage
8 | {
9 | public static int stbi__psd_test(stbi__context s)
10 | {
11 | var r = stbi__get32be(s) == 0x38425053 ? 1 : 0;
12 | stbi__rewind(s);
13 | return r;
14 | }
15 |
16 | public static void* stbi__psd_load(stbi__context s, int* x, int* y, int* comp, int req_comp,
17 | stbi__result_info* ri, int bpc)
18 | {
19 | var pixelCount = 0;
20 | var channelCount = 0;
21 | var compression = 0;
22 | var channel = 0;
23 | var i = 0;
24 | var bitdepth = 0;
25 | var w = 0;
26 | var h = 0;
27 | byte* _out_;
28 | if (stbi__get32be(s) != 0x38425053)
29 | return (byte*)(ulong)(stbi__err("not PSD") != 0 ? 0 : 0);
30 | if (stbi__get16be(s) != 1)
31 | return (byte*)(ulong)(stbi__err("wrong version") != 0 ? 0 : 0);
32 | stbi__skip(s, 6);
33 | channelCount = stbi__get16be(s);
34 | if (channelCount < 0 || channelCount > 16)
35 | return (byte*)(ulong)(stbi__err("wrong channel count") != 0 ? 0 : 0);
36 | h = (int)stbi__get32be(s);
37 | w = (int)stbi__get32be(s);
38 | if (h > 1 << 24)
39 | return (byte*)(ulong)(stbi__err("too large") != 0 ? 0 : 0);
40 | if (w > 1 << 24)
41 | return (byte*)(ulong)(stbi__err("too large") != 0 ? 0 : 0);
42 | bitdepth = stbi__get16be(s);
43 | if (bitdepth != 8 && bitdepth != 16)
44 | return (byte*)(ulong)(stbi__err("unsupported bit depth") != 0 ? 0 : 0);
45 | if (stbi__get16be(s) != 3)
46 | return (byte*)(ulong)(stbi__err("wrong color format") != 0 ? 0 : 0);
47 | stbi__skip(s, (int)stbi__get32be(s));
48 | stbi__skip(s, (int)stbi__get32be(s));
49 | stbi__skip(s, (int)stbi__get32be(s));
50 | compression = stbi__get16be(s);
51 | if (compression > 1)
52 | return (byte*)(ulong)(stbi__err("bad compression") != 0 ? 0 : 0);
53 | if (stbi__mad3sizes_valid(4, w, h, 0) == 0)
54 | return (byte*)(ulong)(stbi__err("too large") != 0 ? 0 : 0);
55 | if (compression == 0 && bitdepth == 16 && bpc == 16)
56 | {
57 | _out_ = (byte*)stbi__malloc_mad3(8, w, h, 0);
58 | ri->bits_per_channel = 16;
59 | }
60 | else
61 | {
62 | _out_ = (byte*)stbi__malloc((ulong)(4 * w * h));
63 | }
64 |
65 | if (_out_ == null)
66 | return (byte*)(ulong)(stbi__err("outofmem") != 0 ? 0 : 0);
67 | pixelCount = w * h;
68 | if (compression != 0)
69 | {
70 | stbi__skip(s, h * channelCount * 2);
71 | for (channel = 0; channel < 4; channel++)
72 | {
73 | byte* p;
74 | p = _out_ + channel;
75 | if (channel >= channelCount)
76 | {
77 | for (i = 0; i < pixelCount; i++, p += 4)
78 | *p = (byte)(channel == 3 ? 255 : 0);
79 | }
80 | else
81 | {
82 | if (stbi__psd_decode_rle(s, p, pixelCount) == 0)
83 | {
84 | CRuntime.free(_out_);
85 | return (byte*)(ulong)(stbi__err("corrupt") != 0 ? 0 : 0);
86 | }
87 | }
88 | }
89 | }
90 | else
91 | {
92 | for (channel = 0; channel < 4; channel++)
93 | if (channel >= channelCount)
94 | {
95 | if (bitdepth == 16 && bpc == 16)
96 | {
97 | var q = (ushort*)_out_ + channel;
98 | var val = (ushort)(channel == 3 ? 65535 : 0);
99 | for (i = 0; i < pixelCount; i++, q += 4)
100 | *q = val;
101 | }
102 | else
103 | {
104 | var p = _out_ + channel;
105 | var val = (byte)(channel == 3 ? 255 : 0);
106 | for (i = 0; i < pixelCount; i++, p += 4)
107 | *p = val;
108 | }
109 | }
110 | else
111 | {
112 | if (ri->bits_per_channel == 16)
113 | {
114 | var q = (ushort*)_out_ + channel;
115 | for (i = 0; i < pixelCount; i++, q += 4)
116 | *q = (ushort)stbi__get16be(s);
117 | }
118 | else
119 | {
120 | var p = _out_ + channel;
121 | if (bitdepth == 16)
122 | for (i = 0; i < pixelCount; i++, p += 4)
123 | *p = (byte)(stbi__get16be(s) >> 8);
124 | else
125 | for (i = 0; i < pixelCount; i++, p += 4)
126 | *p = stbi__get8(s);
127 | }
128 | }
129 | }
130 |
131 | if (channelCount >= 4)
132 | {
133 | if (ri->bits_per_channel == 16)
134 | for (i = 0; i < w * h; ++i)
135 | {
136 | var pixel = (ushort*)_out_ + 4 * i;
137 | if (pixel[3] != 0 && pixel[3] != 65535)
138 | {
139 | var a = pixel[3] / 65535.0f;
140 | var ra = 1.0f / a;
141 | var inv_a = 65535.0f * (1 - ra);
142 | pixel[0] = (ushort)(pixel[0] * ra + inv_a);
143 | pixel[1] = (ushort)(pixel[1] * ra + inv_a);
144 | pixel[2] = (ushort)(pixel[2] * ra + inv_a);
145 | }
146 | }
147 | else
148 | for (i = 0; i < w * h; ++i)
149 | {
150 | var pixel = _out_ + 4 * i;
151 | if (pixel[3] != 0 && pixel[3] != 255)
152 | {
153 | var a = pixel[3] / 255.0f;
154 | var ra = 1.0f / a;
155 | var inv_a = 255.0f * (1 - ra);
156 | pixel[0] = (byte)(pixel[0] * ra + inv_a);
157 | pixel[1] = (byte)(pixel[1] * ra + inv_a);
158 | pixel[2] = (byte)(pixel[2] * ra + inv_a);
159 | }
160 | }
161 | }
162 |
163 | if (req_comp != 0 && req_comp != 4)
164 | {
165 | if (ri->bits_per_channel == 16)
166 | _out_ = (byte*)stbi__convert_format16((ushort*)_out_, 4, req_comp, (uint)w, (uint)h);
167 | else
168 | _out_ = stbi__convert_format(_out_, 4, req_comp, (uint)w, (uint)h);
169 | if (_out_ == null)
170 | return _out_;
171 | }
172 |
173 | if (comp != null)
174 | *comp = 4;
175 | *y = h;
176 | *x = w;
177 | return _out_;
178 | }
179 |
180 | public static int stbi__psd_info(stbi__context s, int* x, int* y, int* comp)
181 | {
182 | var channelCount = 0;
183 | var dummy = 0;
184 | var depth = 0;
185 | if (x == null)
186 | x = &dummy;
187 | if (y == null)
188 | y = &dummy;
189 | if (comp == null)
190 | comp = &dummy;
191 | if (stbi__get32be(s) != 0x38425053)
192 | {
193 | stbi__rewind(s);
194 | return 0;
195 | }
196 |
197 | if (stbi__get16be(s) != 1)
198 | {
199 | stbi__rewind(s);
200 | return 0;
201 | }
202 |
203 | stbi__skip(s, 6);
204 | channelCount = stbi__get16be(s);
205 | if (channelCount < 0 || channelCount > 16)
206 | {
207 | stbi__rewind(s);
208 | return 0;
209 | }
210 |
211 | *y = (int)stbi__get32be(s);
212 | *x = (int)stbi__get32be(s);
213 | depth = stbi__get16be(s);
214 | if (depth != 8 && depth != 16)
215 | {
216 | stbi__rewind(s);
217 | return 0;
218 | }
219 |
220 | if (stbi__get16be(s) != 3)
221 | {
222 | stbi__rewind(s);
223 | return 0;
224 | }
225 |
226 | *comp = 4;
227 | return 1;
228 | }
229 |
230 | public static int stbi__psd_is16(stbi__context s)
231 | {
232 | var channelCount = 0;
233 | var depth = 0;
234 | if (stbi__get32be(s) != 0x38425053)
235 | {
236 | stbi__rewind(s);
237 | return 0;
238 | }
239 |
240 | if (stbi__get16be(s) != 1)
241 | {
242 | stbi__rewind(s);
243 | return 0;
244 | }
245 |
246 | stbi__skip(s, 6);
247 | channelCount = stbi__get16be(s);
248 | if (channelCount < 0 || channelCount > 16)
249 | {
250 | stbi__rewind(s);
251 | return 0;
252 | }
253 |
254 | depth = stbi__get16be(s);
255 | if (depth != 16)
256 | {
257 | stbi__rewind(s);
258 | return 0;
259 | }
260 |
261 | return 1;
262 | }
263 |
264 | public static int stbi__psd_decode_rle(stbi__context s, byte* p, int pixelCount)
265 | {
266 | var count = 0;
267 | var nleft = 0;
268 | var len = 0;
269 | count = 0;
270 | while ((nleft = pixelCount - count) > 0)
271 | {
272 | len = stbi__get8(s);
273 | if (len == 128)
274 | {
275 | }
276 | else if (len < 128)
277 | {
278 | len++;
279 | if (len > nleft)
280 | return 0;
281 | count += len;
282 | while (len != 0)
283 | {
284 | *p = stbi__get8(s);
285 | p += 4;
286 | len--;
287 | }
288 | }
289 | else if (len > 128)
290 | {
291 | byte val = 0;
292 | len = 257 - len;
293 | if (len > nleft)
294 | return 0;
295 | val = stbi__get8(s);
296 | count += len;
297 | while (len != 0)
298 | {
299 | *p = val;
300 | p += 4;
301 | len--;
302 | }
303 | }
304 | }
305 |
306 | return 1;
307 | }
308 | }
309 | }
--------------------------------------------------------------------------------
/Assets/StbImageSharp/StbImage.Generated.Psd.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: f6535954acbb11440b3a71e79cf7607d
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/StbImageSharp/StbImage.Generated.Tga.cs:
--------------------------------------------------------------------------------
1 | // Generated by Sichem at 12/24/2021 8:28:15 PM
2 |
3 | using Hebron.Runtime;
4 |
5 | namespace StbImageSharp
6 | {
7 | unsafe partial class StbImage
8 | {
9 | public static int stbi__tga_test(stbi__context s)
10 | {
11 | var res = 0;
12 | var sz = 0;
13 | var tga_color_type = 0;
14 | stbi__get8(s);
15 | tga_color_type = stbi__get8(s);
16 | if (tga_color_type > 1)
17 | goto errorEnd;
18 | sz = stbi__get8(s);
19 | if (tga_color_type == 1)
20 | {
21 | if (sz != 1 && sz != 9)
22 | goto errorEnd;
23 | stbi__skip(s, 4);
24 | sz = stbi__get8(s);
25 | if (sz != 8 && sz != 15 && sz != 16 && sz != 24 && sz != 32)
26 | goto errorEnd;
27 | stbi__skip(s, 4);
28 | }
29 | else
30 | {
31 | if (sz != 2 && sz != 3 && sz != 10 && sz != 11)
32 | goto errorEnd;
33 | stbi__skip(s, 9);
34 | }
35 |
36 | if (stbi__get16le(s) < 1)
37 | goto errorEnd;
38 | if (stbi__get16le(s) < 1)
39 | goto errorEnd;
40 | sz = stbi__get8(s);
41 | if (tga_color_type == 1 && sz != 8 && sz != 16)
42 | goto errorEnd;
43 | if (sz != 8 && sz != 15 && sz != 16 && sz != 24 && sz != 32)
44 | goto errorEnd;
45 | res = 1;
46 | errorEnd:;
47 | stbi__rewind(s);
48 | return res;
49 | }
50 |
51 | public static void* stbi__tga_load(stbi__context s, int* x, int* y, int* comp, int req_comp,
52 | stbi__result_info* ri)
53 | {
54 | int tga_offset = stbi__get8(s);
55 | int tga_indexed = stbi__get8(s);
56 | int tga_image_type = stbi__get8(s);
57 | var tga_is_RLE = 0;
58 | var tga_palette_start = stbi__get16le(s);
59 | var tga_palette_len = stbi__get16le(s);
60 | int tga_palette_bits = stbi__get8(s);
61 | var tga_x_origin = stbi__get16le(s);
62 | var tga_y_origin = stbi__get16le(s);
63 | var tga_width = stbi__get16le(s);
64 | var tga_height = stbi__get16le(s);
65 | int tga_bits_per_pixel = stbi__get8(s);
66 | var tga_comp = 0;
67 | var tga_rgb16 = 0;
68 | int tga_inverted = stbi__get8(s);
69 | byte* tga_data;
70 | byte* tga_palette = null;
71 | var i = 0;
72 | var j = 0;
73 | var raw_data = stackalloc byte[] { 0, 0, 0, 0 };
74 | var RLE_count = 0;
75 | var RLE_repeating = 0;
76 | var read_next_pixel = 1;
77 | if (tga_height > 1 << 24)
78 | return (byte*)(ulong)(stbi__err("too large") != 0 ? 0 : 0);
79 | if (tga_width > 1 << 24)
80 | return (byte*)(ulong)(stbi__err("too large") != 0 ? 0 : 0);
81 | if (tga_image_type >= 8)
82 | {
83 | tga_image_type -= 8;
84 | tga_is_RLE = 1;
85 | }
86 |
87 | tga_inverted = 1 - ((tga_inverted >> 5) & 1);
88 | if (tga_indexed != 0)
89 | tga_comp = stbi__tga_get_comp(tga_palette_bits, 0, &tga_rgb16);
90 | else
91 | tga_comp = stbi__tga_get_comp(tga_bits_per_pixel, tga_image_type == 3 ? 1 : 0, &tga_rgb16);
92 | if (tga_comp == 0)
93 | return (byte*)(ulong)(stbi__err("bad format") != 0 ? 0 : 0);
94 | *x = tga_width;
95 | *y = tga_height;
96 | if (comp != null)
97 | *comp = tga_comp;
98 | if (stbi__mad3sizes_valid(tga_width, tga_height, tga_comp, 0) == 0)
99 | return (byte*)(ulong)(stbi__err("too large") != 0 ? 0 : 0);
100 | tga_data = (byte*)stbi__malloc_mad3(tga_width, tga_height, tga_comp, 0);
101 | if (tga_data == null)
102 | return (byte*)(ulong)(stbi__err("outofmem") != 0 ? 0 : 0);
103 | stbi__skip(s, tga_offset);
104 | if (tga_indexed == 0 && tga_is_RLE == 0 && tga_rgb16 == 0)
105 | {
106 | for (i = 0; i < tga_height; ++i)
107 | {
108 | var row = tga_inverted != 0 ? tga_height - i - 1 : i;
109 | var tga_row = tga_data + row * tga_width * tga_comp;
110 | stbi__getn(s, tga_row, tga_width * tga_comp);
111 | }
112 | }
113 | else
114 | {
115 | if (tga_indexed != 0)
116 | {
117 | if (tga_palette_len == 0)
118 | {
119 | CRuntime.free(tga_data);
120 | return (byte*)(ulong)(stbi__err("bad palette") != 0 ? 0 : 0);
121 | }
122 |
123 | stbi__skip(s, tga_palette_start);
124 | tga_palette = (byte*)stbi__malloc_mad2(tga_palette_len, tga_comp, 0);
125 | if (tga_palette == null)
126 | {
127 | CRuntime.free(tga_data);
128 | return (byte*)(ulong)(stbi__err("outofmem") != 0 ? 0 : 0);
129 | }
130 |
131 | if (tga_rgb16 != 0)
132 | {
133 | var pal_entry = tga_palette;
134 | for (i = 0; i < tga_palette_len; ++i)
135 | {
136 | stbi__tga_read_rgb16(s, pal_entry);
137 | pal_entry += tga_comp;
138 | }
139 | }
140 | else if (stbi__getn(s, tga_palette, tga_palette_len * tga_comp) == 0)
141 | {
142 | CRuntime.free(tga_data);
143 | CRuntime.free(tga_palette);
144 | return (byte*)(ulong)(stbi__err("bad palette") != 0 ? 0 : 0);
145 | }
146 | }
147 |
148 | for (i = 0; i < tga_width * tga_height; ++i)
149 | {
150 | if (tga_is_RLE != 0)
151 | {
152 | if (RLE_count == 0)
153 | {
154 | int RLE_cmd = stbi__get8(s);
155 | RLE_count = 1 + (RLE_cmd & 127);
156 | RLE_repeating = RLE_cmd >> 7;
157 | read_next_pixel = 1;
158 | }
159 | else if (RLE_repeating == 0)
160 | {
161 | read_next_pixel = 1;
162 | }
163 | }
164 | else
165 | {
166 | read_next_pixel = 1;
167 | }
168 |
169 | if (read_next_pixel != 0)
170 | {
171 | if (tga_indexed != 0)
172 | {
173 | var pal_idx = tga_bits_per_pixel == 8 ? stbi__get8(s) : stbi__get16le(s);
174 | if (pal_idx >= tga_palette_len)
175 | pal_idx = 0;
176 | pal_idx *= tga_comp;
177 | for (j = 0; j < tga_comp; ++j)
178 | raw_data[j] = tga_palette[pal_idx + j];
179 | }
180 | else if (tga_rgb16 != 0)
181 | {
182 | stbi__tga_read_rgb16(s, raw_data);
183 | }
184 | else
185 | {
186 | for (j = 0; j < tga_comp; ++j)
187 | raw_data[j] = stbi__get8(s);
188 | }
189 |
190 | read_next_pixel = 0;
191 | }
192 |
193 | for (j = 0; j < tga_comp; ++j)
194 | tga_data[i * tga_comp + j] = raw_data[j];
195 | --RLE_count;
196 | }
197 |
198 | if (tga_inverted != 0)
199 | for (j = 0; j * 2 < tga_height; ++j)
200 | {
201 | var index1 = j * tga_width * tga_comp;
202 | var index2 = (tga_height - 1 - j) * tga_width * tga_comp;
203 | for (i = tga_width * tga_comp; i > 0; --i)
204 | {
205 | var temp = tga_data[index1];
206 | tga_data[index1] = tga_data[index2];
207 | tga_data[index2] = temp;
208 | ++index1;
209 | ++index2;
210 | }
211 | }
212 |
213 | if (tga_palette != null)
214 | CRuntime.free(tga_palette);
215 | }
216 |
217 | if (tga_comp >= 3 && tga_rgb16 == 0)
218 | {
219 | var tga_pixel = tga_data;
220 | for (i = 0; i < tga_width * tga_height; ++i)
221 | {
222 | var temp = tga_pixel[0];
223 | tga_pixel[0] = tga_pixel[2];
224 | tga_pixel[2] = temp;
225 | tga_pixel += tga_comp;
226 | }
227 | }
228 |
229 | if (req_comp != 0 && req_comp != tga_comp)
230 | tga_data = stbi__convert_format(tga_data, tga_comp, req_comp, (uint)tga_width, (uint)tga_height);
231 | tga_palette_start = tga_palette_len = tga_palette_bits = tga_x_origin = tga_y_origin = 0;
232 | return tga_data;
233 | }
234 |
235 | public static int stbi__tga_info(stbi__context s, int* x, int* y, int* comp)
236 | {
237 | var tga_w = 0;
238 | var tga_h = 0;
239 | var tga_comp = 0;
240 | var tga_image_type = 0;
241 | var tga_bits_per_pixel = 0;
242 | var tga_colormap_bpp = 0;
243 | var sz = 0;
244 | var tga_colormap_type = 0;
245 | stbi__get8(s);
246 | tga_colormap_type = stbi__get8(s);
247 | if (tga_colormap_type > 1)
248 | {
249 | stbi__rewind(s);
250 | return 0;
251 | }
252 |
253 | tga_image_type = stbi__get8(s);
254 | if (tga_colormap_type == 1)
255 | {
256 | if (tga_image_type != 1 && tga_image_type != 9)
257 | {
258 | stbi__rewind(s);
259 | return 0;
260 | }
261 |
262 | stbi__skip(s, 4);
263 | sz = stbi__get8(s);
264 | if (sz != 8 && sz != 15 && sz != 16 && sz != 24 && sz != 32)
265 | {
266 | stbi__rewind(s);
267 | return 0;
268 | }
269 |
270 | stbi__skip(s, 4);
271 | tga_colormap_bpp = sz;
272 | }
273 | else
274 | {
275 | if (tga_image_type != 2 && tga_image_type != 3 && tga_image_type != 10 && tga_image_type != 11)
276 | {
277 | stbi__rewind(s);
278 | return 0;
279 | }
280 |
281 | stbi__skip(s, 9);
282 | tga_colormap_bpp = 0;
283 | }
284 |
285 | tga_w = stbi__get16le(s);
286 | if (tga_w < 1)
287 | {
288 | stbi__rewind(s);
289 | return 0;
290 | }
291 |
292 | tga_h = stbi__get16le(s);
293 | if (tga_h < 1)
294 | {
295 | stbi__rewind(s);
296 | return 0;
297 | }
298 |
299 | tga_bits_per_pixel = stbi__get8(s);
300 | stbi__get8(s);
301 | if (tga_colormap_bpp != 0)
302 | {
303 | if (tga_bits_per_pixel != 8 && tga_bits_per_pixel != 16)
304 | {
305 | stbi__rewind(s);
306 | return 0;
307 | }
308 |
309 | tga_comp = stbi__tga_get_comp(tga_colormap_bpp, 0, null);
310 | }
311 | else
312 | {
313 | tga_comp = stbi__tga_get_comp(tga_bits_per_pixel, tga_image_type == 3 || tga_image_type == 11 ? 1 : 0,
314 | null);
315 | }
316 |
317 | if (tga_comp == 0)
318 | {
319 | stbi__rewind(s);
320 | return 0;
321 | }
322 |
323 | if (x != null)
324 | *x = tga_w;
325 | if (y != null)
326 | *y = tga_h;
327 | if (comp != null)
328 | *comp = tga_comp;
329 | return 1;
330 | }
331 |
332 | public static int stbi__tga_get_comp(int bits_per_pixel, int is_grey, int* is_rgb16)
333 | {
334 | if (is_rgb16 != null)
335 | *is_rgb16 = 0;
336 | switch (bits_per_pixel)
337 | {
338 | case 8:
339 | return STBI_grey;
340 | case 16:
341 | case 15:
342 | if (bits_per_pixel == 16 && is_grey != 0)
343 | return STBI_grey_alpha;
344 | if (is_rgb16 != null)
345 | *is_rgb16 = 1;
346 | return STBI_rgb;
347 | case 24:
348 | case 32:
349 | return bits_per_pixel / 8;
350 | default:
351 | return 0;
352 | }
353 | }
354 |
355 | public static void stbi__tga_read_rgb16(stbi__context s, byte* _out_)
356 | {
357 | var px = (ushort)stbi__get16le(s);
358 | ushort fiveBitMask = 31;
359 | var r = (px >> 10) & fiveBitMask;
360 | var g = (px >> 5) & fiveBitMask;
361 | var b = px & fiveBitMask;
362 | _out_[0] = (byte)(r * 255 / 31);
363 | _out_[1] = (byte)(g * 255 / 31);
364 | _out_[2] = (byte)(b * 255 / 31);
365 | }
366 | }
367 | }
--------------------------------------------------------------------------------
/Assets/StbImageSharp/StbImage.Generated.Tga.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: eaf7e9135f09a05408dc8d0d3351e4a9
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/StbImageSharp/StbImage.Generated.Zlib.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: cf47c94af6bd0ec4fa06e029a1b9a4f6
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/StbImageSharp/StbImage.cs:
--------------------------------------------------------------------------------
1 | using Hebron.Runtime;
2 | using System;
3 | using System.IO;
4 | using System.Runtime.InteropServices;
5 |
6 | namespace StbImageSharp
7 | {
8 | #if !STBSHARP_INTERNAL
9 | public
10 | #else
11 | internal
12 | #endif
13 | static unsafe partial class StbImage
14 | {
15 | public static string stbi__g_failure_reason;
16 | public static readonly char[] stbi__parse_png_file_invalid_chunk = new char[25];
17 |
18 | public static int NativeAllocations => MemoryStats.Allocations;
19 |
20 | public class stbi__context
21 | {
22 | public byte[] _tempBuffer;
23 | public int img_n = 0;
24 | public int img_out_n = 0;
25 | public uint img_x = 0;
26 | public uint img_y = 0;
27 |
28 | public stbi__context(Stream stream)
29 | {
30 | if (stream == null)
31 | throw new ArgumentNullException("stream");
32 |
33 | Stream = stream;
34 | }
35 |
36 | public Stream Stream { get; }
37 | }
38 |
39 | private static int stbi__err(string str)
40 | {
41 | stbi__g_failure_reason = str;
42 | return 0;
43 | }
44 |
45 | public static byte stbi__get8(stbi__context s)
46 | {
47 | var b = s.Stream.ReadByte();
48 | if (b == -1) return 0;
49 |
50 | return (byte)b;
51 | }
52 |
53 | public static void stbi__skip(stbi__context s, int skip)
54 | {
55 | s.Stream.Seek(skip, SeekOrigin.Current);
56 | }
57 |
58 | public static void stbi__rewind(stbi__context s)
59 | {
60 | s.Stream.Seek(0, SeekOrigin.Begin);
61 | }
62 |
63 | public static int stbi__at_eof(stbi__context s)
64 | {
65 | return s.Stream.Position == s.Stream.Length ? 1 : 0;
66 | }
67 |
68 | public static int stbi__getn(stbi__context s, byte* buf, int size)
69 | {
70 | if (s._tempBuffer == null ||
71 | s._tempBuffer.Length < size)
72 | s._tempBuffer = new byte[size * 2];
73 |
74 | var result = s.Stream.Read(s._tempBuffer, 0, size);
75 | Marshal.Copy(s._tempBuffer, 0, new IntPtr(buf), result);
76 |
77 | return result;
78 | }
79 | }
80 | }
--------------------------------------------------------------------------------
/Assets/StbImageSharp/StbImage.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: ecf2037cab74a9c439fa978b656cf1cf
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/StbImageSharp/StbSharp.StbImageSharp.asmdef:
--------------------------------------------------------------------------------
1 | {
2 | "name": "StbSharp.StbImageSharp",
3 | "rootNamespace": "",
4 | "references": [],
5 | "includePlatforms": [],
6 | "excludePlatforms": [],
7 | "allowUnsafeCode": true,
8 | "overrideReferences": false,
9 | "precompiledReferences": [],
10 | "autoReferenced": true,
11 | "defineConstraints": [],
12 | "versionDefines": [],
13 | "noEngineReferences": true
14 | }
--------------------------------------------------------------------------------
/Assets/StbImageSharp/StbSharp.StbImageSharp.asmdef.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: fac980d0a0def28459262c65dfd2a32d
3 | AssemblyDefinitionImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/Assets/StbImageSharp/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "com.stbsharp.stbimagesharp",
3 | "displayName": "StbImageSharp",
4 | "version": "2.27.12",
5 | "unity": "2021.3",
6 | "description": "StbImageSharp is C# port of the stb_image.h, which is C library to load images in JPG, PNG, BMP, TGA, PSD, GIF and HDR formats.",
7 | "author": {
8 | "name": "StbSharp",
9 | "url": "https://github.com/StbSharp/StbImageSharp"
10 | }
11 | }
--------------------------------------------------------------------------------
/Assets/StbImageSharp/package.json.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: f42b644f321928047a965b2844f03fca
3 | TextScriptImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # Change Log
2 | All notable changes to this project will be documented in this file.
3 |
4 | The format is based on [Keep a Changelog](http://keepachangelog.com/)
5 | and this project adheres to [Semantic Versioning](http://semver.org/).
6 |
7 | ## [Unreleased]
8 |
9 | ### Added
10 | - HDR support for the Unity.
11 | - Unsafe APIs for decoding.
12 | - Asynchronous APIs for decoding.
13 |
14 | ### Fixed
15 | - Vertical flip of GIF textures.
16 |
17 | ## [1.3.0] - 2023-01-05
18 |
19 | ### Added
20 | - Lazy loading and reducing memory usage API for animated GIF.
21 |
22 | ### Changed
23 | - Update `StbImageSharp` version from 2.22.6 to 2.27.12.
24 | - Update animated GIF demo for new API.
25 |
26 | ## [1.2.3] - 20222-09-26
27 |
28 | ### Changed
29 | - Remove unnecessary `IDisposable` from the GIF API.
30 |
31 | ## [1.2.2] - 2022-09-26
32 |
33 | ### Changed
34 | - Remove and ignore `.DS_Store` files on macOS.
35 | - Remove dependencies in `package.json`.
36 |
37 | ## [1.2.1] - 2022-08-16
38 |
39 | ### Fixed
40 | - Fix dependencies error of `package.json`.
41 |
42 | ## [1.2.0] - 2022-08-14
43 |
44 | ### Added
45 | - GIF support.
46 |
47 | ### Changed
48 | - Blush up demos.
49 |
50 | ## [1.1.3] - 2022-08-03
51 |
52 | ### Changed
53 | - Insert `com.` to package name of `StbImageSharp`, `StbImageSharpForUnity` and `StbImageSharpForUnity`.
54 | - Fix package name typo of `StbImageSharpForUnity` and `StbImageSharpForUnity`.
55 | - Set original versioning of `StbImageForUnity.Demo`.
56 |
57 | ## [1.1.2] - 2022-07-30
58 |
59 | ### Changed
60 | - Change the `AutoReferenced` option of assembly definitions to `true` in order to be able to refer assemblies from the Assembly-CSharp (the default assembly crated by the Unity).
61 | - Set original versioning of `StbImageForUnity`.
62 |
63 | ## [1.1.1] - 2022-06-06
64 |
65 | ### Changed
66 | - Change project settings (with no changes of APIs).
67 |
68 | ## [1.1.0] - 2022-06-06
69 |
70 | ### Changed
71 | - Rename the `ImageConverter` to `TextureConverter`.
72 | - Change the default value of the `linear` option to the `false`.
73 |
74 | ## [1.0.0] - 2022-06-04
75 |
76 | ### Added
77 | - Decode an image binary to an `ImageResult` by the StbImageSharp.
78 | - Decode an image binary to a `Texture2D`.
79 | - Deploy demonstration codes.
80 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2022 mochineko
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/NOTICE.md:
--------------------------------------------------------------------------------
1 | Notice
2 | ===
3 |
4 | ## StbImageSharp
5 |
6 | https://github.com/StbSharp/StbImageSharp
7 |
8 | ```
9 | Public Domain
10 | ```
11 |
12 |
13 | ## Stb
14 |
15 | https://github.com/nothings/stb
16 |
17 | ```
18 | ALTERNATIVE B - Public Domain (www.unlicense.org)
19 | This is free and unencumbered software released into the public domain.
20 | Anyone is free to copy, modify, publish, use, compile, sell, or distribute this
21 | software, either in source code form or as a compiled binary, for any purpose,
22 | commercial or non-commercial, and by any means.
23 | In jurisdictions that recognize copyright laws, the author or authors of this
24 | software dedicate any and all copyright interest in the software to the public
25 | domain. We make this dedication for the benefit of the public at large and to
26 | the detriment of our heirs and successors. We intend this dedication to be an
27 | overt act of relinquishment in perpetuity of all present and future rights to
28 | this software under copyright law.
29 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
30 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
31 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
32 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
33 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
34 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
35 | ```
36 |
37 | ## UniTask
38 |
39 | https://github.com/Cysharp/UniTask
40 |
41 | ```
42 | The MIT License (MIT)
43 |
44 | Copyright (c) 2019 Yoshifumi Kawai / Cysharp, Inc.
45 |
46 | Permission is hereby granted, free of charge, to any person obtaining a copy
47 | of this software and associated documentation files (the "Software"), to deal
48 | in the Software without restriction, including without limitation the rights
49 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
50 | copies of the Software, and to permit persons to whom the Software is
51 | furnished to do so, subject to the following conditions:
52 |
53 | The above copyright notice and this permission notice shall be included in all
54 | copies or substantial portions of the Software.
55 |
56 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
57 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
58 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
59 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
60 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
61 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
62 | SOFTWARE.
63 | ```
--------------------------------------------------------------------------------
/Packages/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "dependencies": {
3 | "com.unity.collab-proxy": "1.15.15",
4 | "com.unity.feature.development": "1.0.1",
5 | "com.unity.ide.rider": "3.0.13",
6 | "com.unity.ide.visualstudio": "2.0.14",
7 | "com.unity.ide.vscode": "1.2.5",
8 | "com.unity.test-framework": "1.1.31",
9 | "com.unity.textmeshpro": "3.0.6",
10 | "com.unity.timeline": "1.6.4",
11 | "com.unity.ugui": "1.0.0",
12 | "com.unity.visualscripting": "1.7.6",
13 | "com.unity.modules.ai": "1.0.0",
14 | "com.unity.modules.androidjni": "1.0.0",
15 | "com.unity.modules.animation": "1.0.0",
16 | "com.unity.modules.assetbundle": "1.0.0",
17 | "com.unity.modules.audio": "1.0.0",
18 | "com.unity.modules.cloth": "1.0.0",
19 | "com.unity.modules.director": "1.0.0",
20 | "com.unity.modules.imageconversion": "1.0.0",
21 | "com.unity.modules.imgui": "1.0.0",
22 | "com.unity.modules.jsonserialize": "1.0.0",
23 | "com.unity.modules.particlesystem": "1.0.0",
24 | "com.unity.modules.physics": "1.0.0",
25 | "com.unity.modules.physics2d": "1.0.0",
26 | "com.unity.modules.screencapture": "1.0.0",
27 | "com.unity.modules.terrain": "1.0.0",
28 | "com.unity.modules.terrainphysics": "1.0.0",
29 | "com.unity.modules.tilemap": "1.0.0",
30 | "com.unity.modules.ui": "1.0.0",
31 | "com.unity.modules.uielements": "1.0.0",
32 | "com.unity.modules.umbra": "1.0.0",
33 | "com.unity.modules.unityanalytics": "1.0.0",
34 | "com.unity.modules.unitywebrequest": "1.0.0",
35 | "com.unity.modules.unitywebrequestassetbundle": "1.0.0",
36 | "com.unity.modules.unitywebrequestaudio": "1.0.0",
37 | "com.unity.modules.unitywebrequesttexture": "1.0.0",
38 | "com.unity.modules.unitywebrequestwww": "1.0.0",
39 | "com.unity.modules.vehicles": "1.0.0",
40 | "com.unity.modules.video": "1.0.0",
41 | "com.unity.modules.vr": "1.0.0",
42 | "com.unity.modules.wind": "1.0.0",
43 | "com.unity.modules.xr": "1.0.0",
44 | "com.cysharp.unitask" : "https://github.com/Cysharp/UniTask.git?path=src/UniTask/Assets/Plugins/UniTask#2.3.1"
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/Packages/packages-lock.json:
--------------------------------------------------------------------------------
1 | {
2 | "dependencies": {
3 | "com.cysharp.unitask": {
4 | "version": "https://github.com/Cysharp/UniTask.git?path=src/UniTask/Assets/Plugins/UniTask#2.3.1",
5 | "depth": 0,
6 | "source": "git",
7 | "dependencies": {},
8 | "hash": "33d32baea4d50040e0601b725a694dcf3dcf6640"
9 | },
10 | "com.unity.collab-proxy": {
11 | "version": "1.15.15",
12 | "depth": 0,
13 | "source": "registry",
14 | "dependencies": {
15 | "com.unity.services.core": "1.0.1"
16 | },
17 | "url": "https://packages.unity.com"
18 | },
19 | "com.unity.editorcoroutines": {
20 | "version": "1.0.0",
21 | "depth": 1,
22 | "source": "registry",
23 | "dependencies": {},
24 | "url": "https://packages.unity.com"
25 | },
26 | "com.unity.ext.nunit": {
27 | "version": "1.0.6",
28 | "depth": 1,
29 | "source": "registry",
30 | "dependencies": {},
31 | "url": "https://packages.unity.com"
32 | },
33 | "com.unity.feature.development": {
34 | "version": "1.0.1",
35 | "depth": 0,
36 | "source": "builtin",
37 | "dependencies": {
38 | "com.unity.ide.visualstudio": "2.0.14",
39 | "com.unity.ide.rider": "3.0.13",
40 | "com.unity.ide.vscode": "1.2.5",
41 | "com.unity.editorcoroutines": "1.0.0",
42 | "com.unity.performance.profile-analyzer": "1.1.1",
43 | "com.unity.test-framework": "1.1.31",
44 | "com.unity.testtools.codecoverage": "1.0.1"
45 | }
46 | },
47 | "com.unity.ide.rider": {
48 | "version": "3.0.13",
49 | "depth": 0,
50 | "source": "registry",
51 | "dependencies": {
52 | "com.unity.ext.nunit": "1.0.6"
53 | },
54 | "url": "https://packages.unity.com"
55 | },
56 | "com.unity.ide.visualstudio": {
57 | "version": "2.0.14",
58 | "depth": 0,
59 | "source": "registry",
60 | "dependencies": {
61 | "com.unity.test-framework": "1.1.9"
62 | },
63 | "url": "https://packages.unity.com"
64 | },
65 | "com.unity.ide.vscode": {
66 | "version": "1.2.5",
67 | "depth": 0,
68 | "source": "registry",
69 | "dependencies": {},
70 | "url": "https://packages.unity.com"
71 | },
72 | "com.unity.performance.profile-analyzer": {
73 | "version": "1.1.1",
74 | "depth": 1,
75 | "source": "registry",
76 | "dependencies": {},
77 | "url": "https://packages.unity.com"
78 | },
79 | "com.unity.services.core": {
80 | "version": "1.0.1",
81 | "depth": 1,
82 | "source": "registry",
83 | "dependencies": {
84 | "com.unity.modules.unitywebrequest": "1.0.0"
85 | },
86 | "url": "https://packages.unity.com"
87 | },
88 | "com.unity.settings-manager": {
89 | "version": "1.0.3",
90 | "depth": 2,
91 | "source": "registry",
92 | "dependencies": {},
93 | "url": "https://packages.unity.com"
94 | },
95 | "com.unity.test-framework": {
96 | "version": "1.1.31",
97 | "depth": 0,
98 | "source": "registry",
99 | "dependencies": {
100 | "com.unity.ext.nunit": "1.0.6",
101 | "com.unity.modules.imgui": "1.0.0",
102 | "com.unity.modules.jsonserialize": "1.0.0"
103 | },
104 | "url": "https://packages.unity.com"
105 | },
106 | "com.unity.testtools.codecoverage": {
107 | "version": "1.0.1",
108 | "depth": 1,
109 | "source": "registry",
110 | "dependencies": {
111 | "com.unity.test-framework": "1.0.16",
112 | "com.unity.settings-manager": "1.0.1"
113 | },
114 | "url": "https://packages.unity.com"
115 | },
116 | "com.unity.textmeshpro": {
117 | "version": "3.0.6",
118 | "depth": 0,
119 | "source": "registry",
120 | "dependencies": {
121 | "com.unity.ugui": "1.0.0"
122 | },
123 | "url": "https://packages.unity.com"
124 | },
125 | "com.unity.timeline": {
126 | "version": "1.6.4",
127 | "depth": 0,
128 | "source": "registry",
129 | "dependencies": {
130 | "com.unity.modules.director": "1.0.0",
131 | "com.unity.modules.animation": "1.0.0",
132 | "com.unity.modules.audio": "1.0.0",
133 | "com.unity.modules.particlesystem": "1.0.0"
134 | },
135 | "url": "https://packages.unity.com"
136 | },
137 | "com.unity.ugui": {
138 | "version": "1.0.0",
139 | "depth": 0,
140 | "source": "builtin",
141 | "dependencies": {
142 | "com.unity.modules.ui": "1.0.0",
143 | "com.unity.modules.imgui": "1.0.0"
144 | }
145 | },
146 | "com.unity.visualscripting": {
147 | "version": "1.7.6",
148 | "depth": 0,
149 | "source": "registry",
150 | "dependencies": {
151 | "com.unity.ugui": "1.0.0",
152 | "com.unity.modules.jsonserialize": "1.0.0"
153 | },
154 | "url": "https://packages.unity.com"
155 | },
156 | "com.unity.modules.ai": {
157 | "version": "1.0.0",
158 | "depth": 0,
159 | "source": "builtin",
160 | "dependencies": {}
161 | },
162 | "com.unity.modules.androidjni": {
163 | "version": "1.0.0",
164 | "depth": 0,
165 | "source": "builtin",
166 | "dependencies": {}
167 | },
168 | "com.unity.modules.animation": {
169 | "version": "1.0.0",
170 | "depth": 0,
171 | "source": "builtin",
172 | "dependencies": {}
173 | },
174 | "com.unity.modules.assetbundle": {
175 | "version": "1.0.0",
176 | "depth": 0,
177 | "source": "builtin",
178 | "dependencies": {}
179 | },
180 | "com.unity.modules.audio": {
181 | "version": "1.0.0",
182 | "depth": 0,
183 | "source": "builtin",
184 | "dependencies": {}
185 | },
186 | "com.unity.modules.cloth": {
187 | "version": "1.0.0",
188 | "depth": 0,
189 | "source": "builtin",
190 | "dependencies": {
191 | "com.unity.modules.physics": "1.0.0"
192 | }
193 | },
194 | "com.unity.modules.director": {
195 | "version": "1.0.0",
196 | "depth": 0,
197 | "source": "builtin",
198 | "dependencies": {
199 | "com.unity.modules.audio": "1.0.0",
200 | "com.unity.modules.animation": "1.0.0"
201 | }
202 | },
203 | "com.unity.modules.imageconversion": {
204 | "version": "1.0.0",
205 | "depth": 0,
206 | "source": "builtin",
207 | "dependencies": {}
208 | },
209 | "com.unity.modules.imgui": {
210 | "version": "1.0.0",
211 | "depth": 0,
212 | "source": "builtin",
213 | "dependencies": {}
214 | },
215 | "com.unity.modules.jsonserialize": {
216 | "version": "1.0.0",
217 | "depth": 0,
218 | "source": "builtin",
219 | "dependencies": {}
220 | },
221 | "com.unity.modules.particlesystem": {
222 | "version": "1.0.0",
223 | "depth": 0,
224 | "source": "builtin",
225 | "dependencies": {}
226 | },
227 | "com.unity.modules.physics": {
228 | "version": "1.0.0",
229 | "depth": 0,
230 | "source": "builtin",
231 | "dependencies": {}
232 | },
233 | "com.unity.modules.physics2d": {
234 | "version": "1.0.0",
235 | "depth": 0,
236 | "source": "builtin",
237 | "dependencies": {}
238 | },
239 | "com.unity.modules.screencapture": {
240 | "version": "1.0.0",
241 | "depth": 0,
242 | "source": "builtin",
243 | "dependencies": {
244 | "com.unity.modules.imageconversion": "1.0.0"
245 | }
246 | },
247 | "com.unity.modules.subsystems": {
248 | "version": "1.0.0",
249 | "depth": 1,
250 | "source": "builtin",
251 | "dependencies": {
252 | "com.unity.modules.jsonserialize": "1.0.0"
253 | }
254 | },
255 | "com.unity.modules.terrain": {
256 | "version": "1.0.0",
257 | "depth": 0,
258 | "source": "builtin",
259 | "dependencies": {}
260 | },
261 | "com.unity.modules.terrainphysics": {
262 | "version": "1.0.0",
263 | "depth": 0,
264 | "source": "builtin",
265 | "dependencies": {
266 | "com.unity.modules.physics": "1.0.0",
267 | "com.unity.modules.terrain": "1.0.0"
268 | }
269 | },
270 | "com.unity.modules.tilemap": {
271 | "version": "1.0.0",
272 | "depth": 0,
273 | "source": "builtin",
274 | "dependencies": {
275 | "com.unity.modules.physics2d": "1.0.0"
276 | }
277 | },
278 | "com.unity.modules.ui": {
279 | "version": "1.0.0",
280 | "depth": 0,
281 | "source": "builtin",
282 | "dependencies": {}
283 | },
284 | "com.unity.modules.uielements": {
285 | "version": "1.0.0",
286 | "depth": 0,
287 | "source": "builtin",
288 | "dependencies": {
289 | "com.unity.modules.ui": "1.0.0",
290 | "com.unity.modules.imgui": "1.0.0",
291 | "com.unity.modules.jsonserialize": "1.0.0",
292 | "com.unity.modules.uielementsnative": "1.0.0"
293 | }
294 | },
295 | "com.unity.modules.uielementsnative": {
296 | "version": "1.0.0",
297 | "depth": 1,
298 | "source": "builtin",
299 | "dependencies": {
300 | "com.unity.modules.ui": "1.0.0",
301 | "com.unity.modules.imgui": "1.0.0",
302 | "com.unity.modules.jsonserialize": "1.0.0"
303 | }
304 | },
305 | "com.unity.modules.umbra": {
306 | "version": "1.0.0",
307 | "depth": 0,
308 | "source": "builtin",
309 | "dependencies": {}
310 | },
311 | "com.unity.modules.unityanalytics": {
312 | "version": "1.0.0",
313 | "depth": 0,
314 | "source": "builtin",
315 | "dependencies": {
316 | "com.unity.modules.unitywebrequest": "1.0.0",
317 | "com.unity.modules.jsonserialize": "1.0.0"
318 | }
319 | },
320 | "com.unity.modules.unitywebrequest": {
321 | "version": "1.0.0",
322 | "depth": 0,
323 | "source": "builtin",
324 | "dependencies": {}
325 | },
326 | "com.unity.modules.unitywebrequestassetbundle": {
327 | "version": "1.0.0",
328 | "depth": 0,
329 | "source": "builtin",
330 | "dependencies": {
331 | "com.unity.modules.assetbundle": "1.0.0",
332 | "com.unity.modules.unitywebrequest": "1.0.0"
333 | }
334 | },
335 | "com.unity.modules.unitywebrequestaudio": {
336 | "version": "1.0.0",
337 | "depth": 0,
338 | "source": "builtin",
339 | "dependencies": {
340 | "com.unity.modules.unitywebrequest": "1.0.0",
341 | "com.unity.modules.audio": "1.0.0"
342 | }
343 | },
344 | "com.unity.modules.unitywebrequesttexture": {
345 | "version": "1.0.0",
346 | "depth": 0,
347 | "source": "builtin",
348 | "dependencies": {
349 | "com.unity.modules.unitywebrequest": "1.0.0",
350 | "com.unity.modules.imageconversion": "1.0.0"
351 | }
352 | },
353 | "com.unity.modules.unitywebrequestwww": {
354 | "version": "1.0.0",
355 | "depth": 0,
356 | "source": "builtin",
357 | "dependencies": {
358 | "com.unity.modules.unitywebrequest": "1.0.0",
359 | "com.unity.modules.unitywebrequestassetbundle": "1.0.0",
360 | "com.unity.modules.unitywebrequestaudio": "1.0.0",
361 | "com.unity.modules.audio": "1.0.0",
362 | "com.unity.modules.assetbundle": "1.0.0",
363 | "com.unity.modules.imageconversion": "1.0.0"
364 | }
365 | },
366 | "com.unity.modules.vehicles": {
367 | "version": "1.0.0",
368 | "depth": 0,
369 | "source": "builtin",
370 | "dependencies": {
371 | "com.unity.modules.physics": "1.0.0"
372 | }
373 | },
374 | "com.unity.modules.video": {
375 | "version": "1.0.0",
376 | "depth": 0,
377 | "source": "builtin",
378 | "dependencies": {
379 | "com.unity.modules.audio": "1.0.0",
380 | "com.unity.modules.ui": "1.0.0",
381 | "com.unity.modules.unitywebrequest": "1.0.0"
382 | }
383 | },
384 | "com.unity.modules.vr": {
385 | "version": "1.0.0",
386 | "depth": 0,
387 | "source": "builtin",
388 | "dependencies": {
389 | "com.unity.modules.jsonserialize": "1.0.0",
390 | "com.unity.modules.physics": "1.0.0",
391 | "com.unity.modules.xr": "1.0.0"
392 | }
393 | },
394 | "com.unity.modules.wind": {
395 | "version": "1.0.0",
396 | "depth": 0,
397 | "source": "builtin",
398 | "dependencies": {}
399 | },
400 | "com.unity.modules.xr": {
401 | "version": "1.0.0",
402 | "depth": 0,
403 | "source": "builtin",
404 | "dependencies": {
405 | "com.unity.modules.physics": "1.0.0",
406 | "com.unity.modules.jsonserialize": "1.0.0",
407 | "com.unity.modules.subsystems": "1.0.0"
408 | }
409 | }
410 | }
411 | }
412 |
--------------------------------------------------------------------------------
/ProjectSettings/AudioManager.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!11 &1
4 | AudioManager:
5 | m_ObjectHideFlags: 0
6 | serializedVersion: 2
7 | m_Volume: 1
8 | Rolloff Scale: 1
9 | Doppler Factor: 1
10 | Default Speaker Mode: 2
11 | m_SampleRate: 0
12 | m_DSPBufferSize: 1024
13 | m_VirtualVoiceCount: 512
14 | m_RealVoiceCount: 32
15 | m_SpatializerPlugin:
16 | m_AmbisonicDecoderPlugin:
17 | m_DisableAudio: 0
18 | m_VirtualizeEffects: 1
19 | m_RequestedDSPBufferSize: 1024
20 |
--------------------------------------------------------------------------------
/ProjectSettings/ClusterInputManager.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!236 &1
4 | ClusterInputManager:
5 | m_ObjectHideFlags: 0
6 | m_Inputs: []
7 |
--------------------------------------------------------------------------------
/ProjectSettings/DynamicsManager.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!55 &1
4 | PhysicsManager:
5 | m_ObjectHideFlags: 0
6 | serializedVersion: 11
7 | m_Gravity: {x: 0, y: -9.81, z: 0}
8 | m_DefaultMaterial: {fileID: 0}
9 | m_BounceThreshold: 2
10 | m_SleepThreshold: 0.005
11 | m_DefaultContactOffset: 0.01
12 | m_DefaultSolverIterations: 6
13 | m_DefaultSolverVelocityIterations: 1
14 | m_QueriesHitBackfaces: 0
15 | m_QueriesHitTriggers: 1
16 | m_EnableAdaptiveForce: 0
17 | m_ClothInterCollisionDistance: 0
18 | m_ClothInterCollisionStiffness: 0
19 | m_ContactsGeneration: 1
20 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
21 | m_AutoSimulation: 1
22 | m_AutoSyncTransforms: 0
23 | m_ReuseCollisionCallbacks: 1
24 | m_ClothInterCollisionSettingsToggle: 0
25 | m_ContactPairsMode: 0
26 | m_BroadphaseType: 0
27 | m_WorldBounds:
28 | m_Center: {x: 0, y: 0, z: 0}
29 | m_Extent: {x: 250, y: 250, z: 250}
30 | m_WorldSubdivisions: 8
31 | m_FrictionType: 0
32 | m_EnableEnhancedDeterminism: 0
33 | m_EnableUnifiedHeightmaps: 1
34 | m_DefaultMaxAngluarSpeed: 7
35 |
--------------------------------------------------------------------------------
/ProjectSettings/EditorBuildSettings.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!1045 &1
4 | EditorBuildSettings:
5 | m_ObjectHideFlags: 0
6 | serializedVersion: 2
7 | m_Scenes: []
8 | m_configObjects: {}
9 |
--------------------------------------------------------------------------------
/ProjectSettings/EditorSettings.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!159 &1
4 | EditorSettings:
5 | m_ObjectHideFlags: 0
6 | serializedVersion: 11
7 | m_ExternalVersionControlSupport: Visible Meta Files
8 | m_SerializationMode: 2
9 | m_LineEndingsForNewScripts: 0
10 | m_DefaultBehaviorMode: 0
11 | m_PrefabRegularEnvironment: {fileID: 0}
12 | m_PrefabUIEnvironment: {fileID: 0}
13 | m_SpritePackerMode: 0
14 | m_SpritePackerPaddingPower: 1
15 | m_EtcTextureCompressorBehavior: 1
16 | m_EtcTextureFastCompressor: 1
17 | m_EtcTextureNormalCompressor: 2
18 | m_EtcTextureBestCompressor: 4
19 | m_ProjectGenerationIncludedExtensions: txt;xml;fnt;cd;asmdef;rsp;asmref
20 | m_ProjectGenerationRootNamespace:
21 | m_CollabEditorSettings:
22 | inProgressEnabled: 1
23 | m_EnableTextureStreamingInEditMode: 1
24 | m_EnableTextureStreamingInPlayMode: 1
25 | m_AsyncShaderCompilation: 1
26 | m_EnterPlayModeOptionsEnabled: 0
27 | m_EnterPlayModeOptions: 3
28 | m_ShowLightmapResolutionOverlay: 1
29 | m_UseLegacyProbeSampleCount: 0
30 | m_SerializeInlineMappingsOnOneLine: 1
31 |
--------------------------------------------------------------------------------
/ProjectSettings/GraphicsSettings.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!30 &1
4 | GraphicsSettings:
5 | m_ObjectHideFlags: 0
6 | serializedVersion: 13
7 | m_Deferred:
8 | m_Mode: 1
9 | m_Shader: {fileID: 69, guid: 0000000000000000f000000000000000, type: 0}
10 | m_DeferredReflections:
11 | m_Mode: 1
12 | m_Shader: {fileID: 74, guid: 0000000000000000f000000000000000, type: 0}
13 | m_ScreenSpaceShadows:
14 | m_Mode: 1
15 | m_Shader: {fileID: 64, guid: 0000000000000000f000000000000000, type: 0}
16 | m_LegacyDeferred:
17 | m_Mode: 1
18 | m_Shader: {fileID: 63, guid: 0000000000000000f000000000000000, type: 0}
19 | m_DepthNormals:
20 | m_Mode: 1
21 | m_Shader: {fileID: 62, guid: 0000000000000000f000000000000000, type: 0}
22 | m_MotionVectors:
23 | m_Mode: 1
24 | m_Shader: {fileID: 75, guid: 0000000000000000f000000000000000, type: 0}
25 | m_LightHalo:
26 | m_Mode: 1
27 | m_Shader: {fileID: 105, guid: 0000000000000000f000000000000000, type: 0}
28 | m_LensFlare:
29 | m_Mode: 1
30 | m_Shader: {fileID: 102, guid: 0000000000000000f000000000000000, type: 0}
31 | m_AlwaysIncludedShaders:
32 | - {fileID: 7, guid: 0000000000000000f000000000000000, type: 0}
33 | - {fileID: 15104, guid: 0000000000000000f000000000000000, type: 0}
34 | - {fileID: 15105, guid: 0000000000000000f000000000000000, type: 0}
35 | - {fileID: 15106, guid: 0000000000000000f000000000000000, type: 0}
36 | - {fileID: 10753, guid: 0000000000000000f000000000000000, type: 0}
37 | - {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0}
38 | m_PreloadedShaders: []
39 | m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000,
40 | type: 0}
41 | m_CustomRenderPipeline: {fileID: 0}
42 | m_TransparencySortMode: 0
43 | m_TransparencySortAxis: {x: 0, y: 0, z: 1}
44 | m_DefaultRenderingPath: 1
45 | m_DefaultMobileRenderingPath: 1
46 | m_TierSettings: []
47 | m_LightmapStripping: 0
48 | m_FogStripping: 0
49 | m_InstancingStripping: 0
50 | m_LightmapKeepPlain: 1
51 | m_LightmapKeepDirCombined: 1
52 | m_LightmapKeepDynamicPlain: 1
53 | m_LightmapKeepDynamicDirCombined: 1
54 | m_LightmapKeepShadowMask: 1
55 | m_LightmapKeepSubtractive: 1
56 | m_FogKeepLinear: 1
57 | m_FogKeepExp: 1
58 | m_FogKeepExp2: 1
59 | m_AlbedoSwatchInfos: []
60 | m_LightsUseLinearIntensity: 0
61 | m_LightsUseColorTemperature: 0
62 | m_LogWhenShaderIsCompiled: 0
63 | m_AllowEnlightenSupportForUpgradedProject: 0
64 |
--------------------------------------------------------------------------------
/ProjectSettings/InputManager.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!13 &1
4 | InputManager:
5 | m_ObjectHideFlags: 0
6 | serializedVersion: 2
7 | m_Axes:
8 | - serializedVersion: 3
9 | m_Name: Horizontal
10 | descriptiveName:
11 | descriptiveNegativeName:
12 | negativeButton: left
13 | positiveButton: right
14 | altNegativeButton: a
15 | altPositiveButton: d
16 | gravity: 3
17 | dead: 0.001
18 | sensitivity: 3
19 | snap: 1
20 | invert: 0
21 | type: 0
22 | axis: 0
23 | joyNum: 0
24 | - serializedVersion: 3
25 | m_Name: Vertical
26 | descriptiveName:
27 | descriptiveNegativeName:
28 | negativeButton: down
29 | positiveButton: up
30 | altNegativeButton: s
31 | altPositiveButton: w
32 | gravity: 3
33 | dead: 0.001
34 | sensitivity: 3
35 | snap: 1
36 | invert: 0
37 | type: 0
38 | axis: 0
39 | joyNum: 0
40 | - serializedVersion: 3
41 | m_Name: Fire1
42 | descriptiveName:
43 | descriptiveNegativeName:
44 | negativeButton:
45 | positiveButton: left ctrl
46 | altNegativeButton:
47 | altPositiveButton: mouse 0
48 | gravity: 1000
49 | dead: 0.001
50 | sensitivity: 1000
51 | snap: 0
52 | invert: 0
53 | type: 0
54 | axis: 0
55 | joyNum: 0
56 | - serializedVersion: 3
57 | m_Name: Fire2
58 | descriptiveName:
59 | descriptiveNegativeName:
60 | negativeButton:
61 | positiveButton: left alt
62 | altNegativeButton:
63 | altPositiveButton: mouse 1
64 | gravity: 1000
65 | dead: 0.001
66 | sensitivity: 1000
67 | snap: 0
68 | invert: 0
69 | type: 0
70 | axis: 0
71 | joyNum: 0
72 | - serializedVersion: 3
73 | m_Name: Fire3
74 | descriptiveName:
75 | descriptiveNegativeName:
76 | negativeButton:
77 | positiveButton: left shift
78 | altNegativeButton:
79 | altPositiveButton: mouse 2
80 | gravity: 1000
81 | dead: 0.001
82 | sensitivity: 1000
83 | snap: 0
84 | invert: 0
85 | type: 0
86 | axis: 0
87 | joyNum: 0
88 | - serializedVersion: 3
89 | m_Name: Jump
90 | descriptiveName:
91 | descriptiveNegativeName:
92 | negativeButton:
93 | positiveButton: space
94 | altNegativeButton:
95 | altPositiveButton:
96 | gravity: 1000
97 | dead: 0.001
98 | sensitivity: 1000
99 | snap: 0
100 | invert: 0
101 | type: 0
102 | axis: 0
103 | joyNum: 0
104 | - serializedVersion: 3
105 | m_Name: Mouse X
106 | descriptiveName:
107 | descriptiveNegativeName:
108 | negativeButton:
109 | positiveButton:
110 | altNegativeButton:
111 | altPositiveButton:
112 | gravity: 0
113 | dead: 0
114 | sensitivity: 0.1
115 | snap: 0
116 | invert: 0
117 | type: 1
118 | axis: 0
119 | joyNum: 0
120 | - serializedVersion: 3
121 | m_Name: Mouse Y
122 | descriptiveName:
123 | descriptiveNegativeName:
124 | negativeButton:
125 | positiveButton:
126 | altNegativeButton:
127 | altPositiveButton:
128 | gravity: 0
129 | dead: 0
130 | sensitivity: 0.1
131 | snap: 0
132 | invert: 0
133 | type: 1
134 | axis: 1
135 | joyNum: 0
136 | - serializedVersion: 3
137 | m_Name: Mouse ScrollWheel
138 | descriptiveName:
139 | descriptiveNegativeName:
140 | negativeButton:
141 | positiveButton:
142 | altNegativeButton:
143 | altPositiveButton:
144 | gravity: 0
145 | dead: 0
146 | sensitivity: 0.1
147 | snap: 0
148 | invert: 0
149 | type: 1
150 | axis: 2
151 | joyNum: 0
152 | - serializedVersion: 3
153 | m_Name: Horizontal
154 | descriptiveName:
155 | descriptiveNegativeName:
156 | negativeButton:
157 | positiveButton:
158 | altNegativeButton:
159 | altPositiveButton:
160 | gravity: 0
161 | dead: 0.19
162 | sensitivity: 1
163 | snap: 0
164 | invert: 0
165 | type: 2
166 | axis: 0
167 | joyNum: 0
168 | - serializedVersion: 3
169 | m_Name: Vertical
170 | descriptiveName:
171 | descriptiveNegativeName:
172 | negativeButton:
173 | positiveButton:
174 | altNegativeButton:
175 | altPositiveButton:
176 | gravity: 0
177 | dead: 0.19
178 | sensitivity: 1
179 | snap: 0
180 | invert: 1
181 | type: 2
182 | axis: 1
183 | joyNum: 0
184 | - serializedVersion: 3
185 | m_Name: Fire1
186 | descriptiveName:
187 | descriptiveNegativeName:
188 | negativeButton:
189 | positiveButton: joystick button 0
190 | altNegativeButton:
191 | altPositiveButton:
192 | gravity: 1000
193 | dead: 0.001
194 | sensitivity: 1000
195 | snap: 0
196 | invert: 0
197 | type: 0
198 | axis: 0
199 | joyNum: 0
200 | - serializedVersion: 3
201 | m_Name: Fire2
202 | descriptiveName:
203 | descriptiveNegativeName:
204 | negativeButton:
205 | positiveButton: joystick button 1
206 | altNegativeButton:
207 | altPositiveButton:
208 | gravity: 1000
209 | dead: 0.001
210 | sensitivity: 1000
211 | snap: 0
212 | invert: 0
213 | type: 0
214 | axis: 0
215 | joyNum: 0
216 | - serializedVersion: 3
217 | m_Name: Fire3
218 | descriptiveName:
219 | descriptiveNegativeName:
220 | negativeButton:
221 | positiveButton: joystick button 2
222 | altNegativeButton:
223 | altPositiveButton:
224 | gravity: 1000
225 | dead: 0.001
226 | sensitivity: 1000
227 | snap: 0
228 | invert: 0
229 | type: 0
230 | axis: 0
231 | joyNum: 0
232 | - serializedVersion: 3
233 | m_Name: Jump
234 | descriptiveName:
235 | descriptiveNegativeName:
236 | negativeButton:
237 | positiveButton: joystick button 3
238 | altNegativeButton:
239 | altPositiveButton:
240 | gravity: 1000
241 | dead: 0.001
242 | sensitivity: 1000
243 | snap: 0
244 | invert: 0
245 | type: 0
246 | axis: 0
247 | joyNum: 0
248 | - serializedVersion: 3
249 | m_Name: Submit
250 | descriptiveName:
251 | descriptiveNegativeName:
252 | negativeButton:
253 | positiveButton: return
254 | altNegativeButton:
255 | altPositiveButton: joystick button 0
256 | gravity: 1000
257 | dead: 0.001
258 | sensitivity: 1000
259 | snap: 0
260 | invert: 0
261 | type: 0
262 | axis: 0
263 | joyNum: 0
264 | - serializedVersion: 3
265 | m_Name: Submit
266 | descriptiveName:
267 | descriptiveNegativeName:
268 | negativeButton:
269 | positiveButton: enter
270 | altNegativeButton:
271 | altPositiveButton: space
272 | gravity: 1000
273 | dead: 0.001
274 | sensitivity: 1000
275 | snap: 0
276 | invert: 0
277 | type: 0
278 | axis: 0
279 | joyNum: 0
280 | - serializedVersion: 3
281 | m_Name: Cancel
282 | descriptiveName:
283 | descriptiveNegativeName:
284 | negativeButton:
285 | positiveButton: escape
286 | altNegativeButton:
287 | altPositiveButton: joystick button 1
288 | gravity: 1000
289 | dead: 0.001
290 | sensitivity: 1000
291 | snap: 0
292 | invert: 0
293 | type: 0
294 | axis: 0
295 | joyNum: 0
296 |
--------------------------------------------------------------------------------
/ProjectSettings/MemorySettings.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!387306366 &1
4 | MemorySettings:
5 | m_ObjectHideFlags: 0
6 | m_EditorMemorySettings:
7 | m_MainAllocatorBlockSize: -1
8 | m_ThreadAllocatorBlockSize: -1
9 | m_MainGfxBlockSize: -1
10 | m_ThreadGfxBlockSize: -1
11 | m_CacheBlockSize: -1
12 | m_TypetreeBlockSize: -1
13 | m_ProfilerBlockSize: -1
14 | m_ProfilerEditorBlockSize: -1
15 | m_BucketAllocatorGranularity: -1
16 | m_BucketAllocatorBucketsCount: -1
17 | m_BucketAllocatorBlockSize: -1
18 | m_BucketAllocatorBlockCount: -1
19 | m_ProfilerBucketAllocatorGranularity: -1
20 | m_ProfilerBucketAllocatorBucketsCount: -1
21 | m_ProfilerBucketAllocatorBlockSize: -1
22 | m_ProfilerBucketAllocatorBlockCount: -1
23 | m_TempAllocatorSizeMain: -1
24 | m_JobTempAllocatorBlockSize: -1
25 | m_BackgroundJobTempAllocatorBlockSize: -1
26 | m_JobTempAllocatorReducedBlockSize: -1
27 | m_TempAllocatorSizeGIBakingWorker: -1
28 | m_TempAllocatorSizeNavMeshWorker: -1
29 | m_TempAllocatorSizeAudioWorker: -1
30 | m_TempAllocatorSizeCloudWorker: -1
31 | m_TempAllocatorSizeGfx: -1
32 | m_TempAllocatorSizeJobWorker: -1
33 | m_TempAllocatorSizeBackgroundWorker: -1
34 | m_TempAllocatorSizePreloadManager: -1
35 | m_PlatformMemorySettings: {}
36 |
--------------------------------------------------------------------------------
/ProjectSettings/NavMeshAreas.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!126 &1
4 | NavMeshProjectSettings:
5 | m_ObjectHideFlags: 0
6 | serializedVersion: 2
7 | areas:
8 | - name: Walkable
9 | cost: 1
10 | - name: Not Walkable
11 | cost: 1
12 | - name: Jump
13 | cost: 2
14 | - name:
15 | cost: 1
16 | - name:
17 | cost: 1
18 | - name:
19 | cost: 1
20 | - name:
21 | cost: 1
22 | - name:
23 | cost: 1
24 | - name:
25 | cost: 1
26 | - name:
27 | cost: 1
28 | - name:
29 | cost: 1
30 | - name:
31 | cost: 1
32 | - name:
33 | cost: 1
34 | - name:
35 | cost: 1
36 | - name:
37 | cost: 1
38 | - name:
39 | cost: 1
40 | - name:
41 | cost: 1
42 | - name:
43 | cost: 1
44 | - name:
45 | cost: 1
46 | - name:
47 | cost: 1
48 | - name:
49 | cost: 1
50 | - name:
51 | cost: 1
52 | - name:
53 | cost: 1
54 | - name:
55 | cost: 1
56 | - name:
57 | cost: 1
58 | - name:
59 | cost: 1
60 | - name:
61 | cost: 1
62 | - name:
63 | cost: 1
64 | - name:
65 | cost: 1
66 | - name:
67 | cost: 1
68 | - name:
69 | cost: 1
70 | - name:
71 | cost: 1
72 | m_LastAgentTypeID: -887442657
73 | m_Settings:
74 | - serializedVersion: 2
75 | agentTypeID: 0
76 | agentRadius: 0.5
77 | agentHeight: 2
78 | agentSlope: 45
79 | agentClimb: 0.75
80 | ledgeDropHeight: 0
81 | maxJumpAcrossDistance: 0
82 | minRegionArea: 2
83 | manualCellSize: 0
84 | cellSize: 0.16666667
85 | manualTileSize: 0
86 | tileSize: 256
87 | accuratePlacement: 0
88 | debug:
89 | m_Flags: 0
90 | m_SettingNames:
91 | - Humanoid
92 |
--------------------------------------------------------------------------------
/ProjectSettings/PackageManagerSettings.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!114 &1
4 | MonoBehaviour:
5 | m_ObjectHideFlags: 61
6 | m_CorrespondingSourceObject: {fileID: 0}
7 | m_PrefabInstance: {fileID: 0}
8 | m_PrefabAsset: {fileID: 0}
9 | m_GameObject: {fileID: 0}
10 | m_Enabled: 1
11 | m_EditorHideFlags: 0
12 | m_Script: {fileID: 13964, guid: 0000000000000000e000000000000000, type: 0}
13 | m_Name:
14 | m_EditorClassIdentifier:
15 | m_EnablePreReleasePackages: 0
16 | m_EnablePackageDependencies: 0
17 | m_AdvancedSettingsExpanded: 1
18 | m_ScopedRegistriesSettingsExpanded: 1
19 | m_SeeAllPackageVersions: 0
20 | oneTimeWarningShown: 0
21 | m_Registries:
22 | - m_Id: main
23 | m_Name:
24 | m_Url: https://packages.unity.com
25 | m_Scopes: []
26 | m_IsDefault: 1
27 | m_Capabilities: 7
28 | m_UserSelectedRegistryName:
29 | m_UserAddingNewScopedRegistry: 0
30 | m_RegistryInfoDraft:
31 | m_Modified: 0
32 | m_ErrorMessage:
33 | m_UserModificationsInstanceId: -830
34 | m_OriginalInstanceId: -832
35 | m_LoadAssets: 0
36 |
--------------------------------------------------------------------------------
/ProjectSettings/Packages/com.unity.testtools.codecoverage/Settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "m_Name": "Settings",
3 | "m_Path": "ProjectSettings/Packages/com.unity.testtools.codecoverage/Settings.json",
4 | "m_Dictionary": {
5 | "m_DictionaryValues": []
6 | }
7 | }
--------------------------------------------------------------------------------
/ProjectSettings/Physics2DSettings.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!19 &1
4 | Physics2DSettings:
5 | m_ObjectHideFlags: 0
6 | serializedVersion: 4
7 | m_Gravity: {x: 0, y: -9.81}
8 | m_DefaultMaterial: {fileID: 0}
9 | m_VelocityIterations: 8
10 | m_PositionIterations: 3
11 | m_VelocityThreshold: 1
12 | m_MaxLinearCorrection: 0.2
13 | m_MaxAngularCorrection: 8
14 | m_MaxTranslationSpeed: 100
15 | m_MaxRotationSpeed: 360
16 | m_BaumgarteScale: 0.2
17 | m_BaumgarteTimeOfImpactScale: 0.75
18 | m_TimeToSleep: 0.5
19 | m_LinearSleepTolerance: 0.01
20 | m_AngularSleepTolerance: 2
21 | m_DefaultContactOffset: 0.01
22 | m_JobOptions:
23 | serializedVersion: 2
24 | useMultithreading: 0
25 | useConsistencySorting: 0
26 | m_InterpolationPosesPerJob: 100
27 | m_NewContactsPerJob: 30
28 | m_CollideContactsPerJob: 100
29 | m_ClearFlagsPerJob: 200
30 | m_ClearBodyForcesPerJob: 200
31 | m_SyncDiscreteFixturesPerJob: 50
32 | m_SyncContinuousFixturesPerJob: 50
33 | m_FindNearestContactsPerJob: 100
34 | m_UpdateTriggerContactsPerJob: 100
35 | m_IslandSolverCostThreshold: 100
36 | m_IslandSolverBodyCostScale: 1
37 | m_IslandSolverContactCostScale: 10
38 | m_IslandSolverJointCostScale: 10
39 | m_IslandSolverBodiesPerJob: 50
40 | m_IslandSolverContactsPerJob: 50
41 | m_AutoSimulation: 1
42 | m_QueriesHitTriggers: 1
43 | m_QueriesStartInColliders: 1
44 | m_CallbacksOnDisable: 1
45 | m_ReuseCollisionCallbacks: 1
46 | m_AutoSyncTransforms: 0
47 | m_AlwaysShowColliders: 0
48 | m_ShowColliderSleep: 1
49 | m_ShowColliderContacts: 0
50 | m_ShowColliderAABB: 0
51 | m_ContactArrowScale: 0.2
52 | m_ColliderAwakeColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.7529412}
53 | m_ColliderAsleepColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.36078432}
54 | m_ColliderContactColor: {r: 1, g: 0, b: 1, a: 0.6862745}
55 | m_ColliderAABBColor: {r: 1, g: 1, b: 0, a: 0.2509804}
56 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
57 |
--------------------------------------------------------------------------------
/ProjectSettings/PresetManager.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!1386491679 &1
4 | PresetManager:
5 | m_ObjectHideFlags: 0
6 | serializedVersion: 2
7 | m_DefaultPresets: {}
8 |
--------------------------------------------------------------------------------
/ProjectSettings/ProjectVersion.txt:
--------------------------------------------------------------------------------
1 | m_EditorVersion: 2021.3.0f1
2 | m_EditorVersionWithRevision: 2021.3.0f1 (6eacc8284459)
3 |
--------------------------------------------------------------------------------
/ProjectSettings/QualitySettings.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!47 &1
4 | QualitySettings:
5 | m_ObjectHideFlags: 0
6 | serializedVersion: 5
7 | m_CurrentQuality: 5
8 | m_QualitySettings:
9 | - serializedVersion: 2
10 | name: Very Low
11 | pixelLightCount: 0
12 | shadows: 0
13 | shadowResolution: 0
14 | shadowProjection: 1
15 | shadowCascades: 1
16 | shadowDistance: 15
17 | shadowNearPlaneOffset: 3
18 | shadowCascade2Split: 0.33333334
19 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667}
20 | shadowmaskMode: 0
21 | blendWeights: 1
22 | textureQuality: 1
23 | anisotropicTextures: 0
24 | antiAliasing: 0
25 | softParticles: 0
26 | softVegetation: 0
27 | realtimeReflectionProbes: 0
28 | billboardsFaceCameraPosition: 0
29 | vSyncCount: 0
30 | lodBias: 0.3
31 | maximumLODLevel: 0
32 | streamingMipmapsActive: 0
33 | streamingMipmapsAddAllCameras: 1
34 | streamingMipmapsMemoryBudget: 512
35 | streamingMipmapsRenderersPerFrame: 512
36 | streamingMipmapsMaxLevelReduction: 2
37 | streamingMipmapsMaxFileIORequests: 1024
38 | particleRaycastBudget: 4
39 | asyncUploadTimeSlice: 2
40 | asyncUploadBufferSize: 16
41 | asyncUploadPersistentBuffer: 1
42 | resolutionScalingFixedDPIFactor: 1
43 | excludedTargetPlatforms: []
44 | - serializedVersion: 2
45 | name: Low
46 | pixelLightCount: 0
47 | shadows: 0
48 | shadowResolution: 0
49 | shadowProjection: 1
50 | shadowCascades: 1
51 | shadowDistance: 20
52 | shadowNearPlaneOffset: 3
53 | shadowCascade2Split: 0.33333334
54 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667}
55 | shadowmaskMode: 0
56 | blendWeights: 2
57 | textureQuality: 0
58 | anisotropicTextures: 0
59 | antiAliasing: 0
60 | softParticles: 0
61 | softVegetation: 0
62 | realtimeReflectionProbes: 0
63 | billboardsFaceCameraPosition: 0
64 | vSyncCount: 0
65 | lodBias: 0.4
66 | maximumLODLevel: 0
67 | streamingMipmapsActive: 0
68 | streamingMipmapsAddAllCameras: 1
69 | streamingMipmapsMemoryBudget: 512
70 | streamingMipmapsRenderersPerFrame: 512
71 | streamingMipmapsMaxLevelReduction: 2
72 | streamingMipmapsMaxFileIORequests: 1024
73 | particleRaycastBudget: 16
74 | asyncUploadTimeSlice: 2
75 | asyncUploadBufferSize: 16
76 | asyncUploadPersistentBuffer: 1
77 | resolutionScalingFixedDPIFactor: 1
78 | excludedTargetPlatforms: []
79 | - serializedVersion: 2
80 | name: Medium
81 | pixelLightCount: 1
82 | shadows: 1
83 | shadowResolution: 0
84 | shadowProjection: 1
85 | shadowCascades: 1
86 | shadowDistance: 20
87 | shadowNearPlaneOffset: 3
88 | shadowCascade2Split: 0.33333334
89 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667}
90 | shadowmaskMode: 0
91 | blendWeights: 2
92 | textureQuality: 0
93 | anisotropicTextures: 1
94 | antiAliasing: 0
95 | softParticles: 0
96 | softVegetation: 0
97 | realtimeReflectionProbes: 0
98 | billboardsFaceCameraPosition: 0
99 | vSyncCount: 1
100 | lodBias: 0.7
101 | maximumLODLevel: 0
102 | streamingMipmapsActive: 0
103 | streamingMipmapsAddAllCameras: 1
104 | streamingMipmapsMemoryBudget: 512
105 | streamingMipmapsRenderersPerFrame: 512
106 | streamingMipmapsMaxLevelReduction: 2
107 | streamingMipmapsMaxFileIORequests: 1024
108 | particleRaycastBudget: 64
109 | asyncUploadTimeSlice: 2
110 | asyncUploadBufferSize: 16
111 | asyncUploadPersistentBuffer: 1
112 | resolutionScalingFixedDPIFactor: 1
113 | excludedTargetPlatforms: []
114 | - serializedVersion: 2
115 | name: High
116 | pixelLightCount: 2
117 | shadows: 2
118 | shadowResolution: 1
119 | shadowProjection: 1
120 | shadowCascades: 2
121 | shadowDistance: 40
122 | shadowNearPlaneOffset: 3
123 | shadowCascade2Split: 0.33333334
124 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667}
125 | shadowmaskMode: 1
126 | blendWeights: 2
127 | textureQuality: 0
128 | anisotropicTextures: 1
129 | antiAliasing: 0
130 | softParticles: 0
131 | softVegetation: 1
132 | realtimeReflectionProbes: 1
133 | billboardsFaceCameraPosition: 1
134 | vSyncCount: 1
135 | lodBias: 1
136 | maximumLODLevel: 0
137 | streamingMipmapsActive: 0
138 | streamingMipmapsAddAllCameras: 1
139 | streamingMipmapsMemoryBudget: 512
140 | streamingMipmapsRenderersPerFrame: 512
141 | streamingMipmapsMaxLevelReduction: 2
142 | streamingMipmapsMaxFileIORequests: 1024
143 | particleRaycastBudget: 256
144 | asyncUploadTimeSlice: 2
145 | asyncUploadBufferSize: 16
146 | asyncUploadPersistentBuffer: 1
147 | resolutionScalingFixedDPIFactor: 1
148 | excludedTargetPlatforms: []
149 | - serializedVersion: 2
150 | name: Very High
151 | pixelLightCount: 3
152 | shadows: 2
153 | shadowResolution: 2
154 | shadowProjection: 1
155 | shadowCascades: 2
156 | shadowDistance: 70
157 | shadowNearPlaneOffset: 3
158 | shadowCascade2Split: 0.33333334
159 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667}
160 | shadowmaskMode: 1
161 | blendWeights: 4
162 | textureQuality: 0
163 | anisotropicTextures: 2
164 | antiAliasing: 2
165 | softParticles: 1
166 | softVegetation: 1
167 | realtimeReflectionProbes: 1
168 | billboardsFaceCameraPosition: 1
169 | vSyncCount: 1
170 | lodBias: 1.5
171 | maximumLODLevel: 0
172 | streamingMipmapsActive: 0
173 | streamingMipmapsAddAllCameras: 1
174 | streamingMipmapsMemoryBudget: 512
175 | streamingMipmapsRenderersPerFrame: 512
176 | streamingMipmapsMaxLevelReduction: 2
177 | streamingMipmapsMaxFileIORequests: 1024
178 | particleRaycastBudget: 1024
179 | asyncUploadTimeSlice: 2
180 | asyncUploadBufferSize: 16
181 | asyncUploadPersistentBuffer: 1
182 | resolutionScalingFixedDPIFactor: 1
183 | excludedTargetPlatforms: []
184 | - serializedVersion: 2
185 | name: Ultra
186 | pixelLightCount: 4
187 | shadows: 2
188 | shadowResolution: 2
189 | shadowProjection: 1
190 | shadowCascades: 4
191 | shadowDistance: 150
192 | shadowNearPlaneOffset: 3
193 | shadowCascade2Split: 0.33333334
194 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667}
195 | shadowmaskMode: 1
196 | blendWeights: 4
197 | textureQuality: 0
198 | anisotropicTextures: 2
199 | antiAliasing: 2
200 | softParticles: 1
201 | softVegetation: 1
202 | realtimeReflectionProbes: 1
203 | billboardsFaceCameraPosition: 1
204 | vSyncCount: 1
205 | lodBias: 2
206 | maximumLODLevel: 0
207 | streamingMipmapsActive: 0
208 | streamingMipmapsAddAllCameras: 1
209 | streamingMipmapsMemoryBudget: 512
210 | streamingMipmapsRenderersPerFrame: 512
211 | streamingMipmapsMaxLevelReduction: 2
212 | streamingMipmapsMaxFileIORequests: 1024
213 | particleRaycastBudget: 4096
214 | asyncUploadTimeSlice: 2
215 | asyncUploadBufferSize: 16
216 | asyncUploadPersistentBuffer: 1
217 | resolutionScalingFixedDPIFactor: 1
218 | excludedTargetPlatforms: []
219 | m_PerPlatformDefaultQuality:
220 | Android: 2
221 | Lumin: 5
222 | Nintendo 3DS: 5
223 | Nintendo Switch: 5
224 | PS4: 5
225 | PSP2: 2
226 | Stadia: 5
227 | Standalone: 5
228 | WebGL: 3
229 | Windows Store Apps: 5
230 | XboxOne: 5
231 | iPhone: 2
232 | tvOS: 2
233 |
--------------------------------------------------------------------------------
/ProjectSettings/RiderScriptEditorPersistedState.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!114 &1
4 | MonoBehaviour:
5 | m_ObjectHideFlags: 61
6 | m_CorrespondingSourceObject: {fileID: 0}
7 | m_PrefabInstance: {fileID: 0}
8 | m_PrefabAsset: {fileID: 0}
9 | m_GameObject: {fileID: 0}
10 | m_Enabled: 1
11 | m_EditorHideFlags: 0
12 | m_Script: {fileID: 0}
13 | m_Name:
14 | m_EditorClassIdentifier: Unity.Rider.Editor:Packages.Rider.Editor:RiderScriptEditorPersistedState
15 | lastWriteTicks: -8585472617036279515
16 |
--------------------------------------------------------------------------------
/ProjectSettings/TagManager.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!78 &1
4 | TagManager:
5 | serializedVersion: 2
6 | tags: []
7 | layers:
8 | - Default
9 | - TransparentFX
10 | - Ignore Raycast
11 | -
12 | - Water
13 | - UI
14 | -
15 | -
16 | -
17 | -
18 | -
19 | -
20 | -
21 | -
22 | -
23 | -
24 | -
25 | -
26 | -
27 | -
28 | -
29 | -
30 | -
31 | -
32 | -
33 | -
34 | -
35 | -
36 | -
37 | -
38 | -
39 | -
40 | m_SortingLayers:
41 | - name: Default
42 | uniqueID: 0
43 | locked: 0
44 |
--------------------------------------------------------------------------------
/ProjectSettings/TimeManager.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!5 &1
4 | TimeManager:
5 | m_ObjectHideFlags: 0
6 | Fixed Timestep: 0.02
7 | Maximum Allowed Timestep: 0.33333334
8 | m_TimeScale: 1
9 | Maximum Particle Timestep: 0.03
10 |
--------------------------------------------------------------------------------
/ProjectSettings/UnityConnectSettings.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!310 &1
4 | UnityConnectSettings:
5 | m_ObjectHideFlags: 0
6 | serializedVersion: 1
7 | m_Enabled: 0
8 | m_TestMode: 0
9 | m_EventOldUrl: https://api.uca.cloud.unity3d.com/v1/events
10 | m_EventUrl: https://cdp.cloud.unity3d.com/v1/events
11 | m_ConfigUrl: https://config.uca.cloud.unity3d.com
12 | m_DashboardUrl: https://dashboard.unity3d.com
13 | m_TestInitMode: 0
14 | CrashReportingSettings:
15 | m_EventUrl: https://perf-events.cloud.unity3d.com
16 | m_Enabled: 0
17 | m_LogBufferSize: 10
18 | m_CaptureEditorExceptions: 1
19 | UnityPurchasingSettings:
20 | m_Enabled: 0
21 | m_TestMode: 0
22 | UnityAnalyticsSettings:
23 | m_Enabled: 0
24 | m_TestMode: 0
25 | m_InitializeOnStartup: 1
26 | UnityAdsSettings:
27 | m_Enabled: 0
28 | m_InitializeOnStartup: 1
29 | m_TestMode: 0
30 | m_IosGameId:
31 | m_AndroidGameId:
32 | m_GameIds: {}
33 | m_GameId:
34 | PerformanceReportingSettings:
35 | m_Enabled: 0
36 |
--------------------------------------------------------------------------------
/ProjectSettings/VFXManager.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!937362698 &1
4 | VFXManager:
5 | m_ObjectHideFlags: 0
6 | m_IndirectShader: {fileID: 0}
7 | m_CopyBufferShader: {fileID: 0}
8 | m_SortShader: {fileID: 0}
9 | m_StripUpdateShader: {fileID: 0}
10 | m_RenderPipeSettingsPath:
11 | m_FixedTimeStep: 0.016666668
12 | m_MaxDeltaTime: 0.05
13 |
--------------------------------------------------------------------------------
/ProjectSettings/VersionControlSettings.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!890905787 &1
4 | VersionControlSettings:
5 | m_ObjectHideFlags: 0
6 | m_Mode: Visible Meta Files
7 | m_CollabEditorSettings:
8 | inProgressEnabled: 1
9 |
--------------------------------------------------------------------------------
/ProjectSettings/XRSettings.asset:
--------------------------------------------------------------------------------
1 | {
2 | "m_SettingKeys": [
3 | "VR Device Disabled",
4 | "VR Device User Alert"
5 | ],
6 | "m_SettingValues": [
7 | "False",
8 | "False"
9 | ]
10 | }
--------------------------------------------------------------------------------
/ProjectSettings/boot.config:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mochi-neko/StbImageSharpForUnity/732ad2b2c025f18542bb0b35d372ef99f2ac78a1/ProjectSettings/boot.config
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | StbImageSharpForUnity
2 | ===
3 |
4 | Provides an Unity extension of [StbImageSharp](https://github.com/StbSharp/StbImageSharp).
5 |
6 | Decodes a binary image file `byte[]` or `Stream` and converts to [Texture2D](https://docs.unity3d.com/jp/current/ScriptReference/Texture2D-ctor.html) on Unity with pure C# (without any native libraries).
7 |
8 | ## How to import by UPM
9 |
10 | Add
11 |
12 | ```
13 | dependencies: {
14 | "com.stbsharp.stbimagesharp": "https://github.com/mochi-neko/StbImageSharpForUnity.git?path=/Assets/StbImageSharp",
15 | "com.mochineko.stbimagesharp-for-unity": "https://github.com/mochi-neko/StbImageSharpForUnity.git?path=/Assets/Mochineko/StbImageSharpForUnity",
16 | }
17 | ```
18 |
19 | to `/Packages/manifest.json` on your Unity project and add its reference to your Assembly Definition.
20 |
21 | Also you can add a demo codes by adding
22 |
23 | ```
24 | "com.mochineko.stbimagesharp-for-unity.demo": "https://github.com/mochi-neko/StbImageSharpForUnity.git?path=/Assets/Mochineko/StbImageSharpForUnity.Demo",
25 | "com.cysharp.unitask": "https://github.com/Cysharp/UniTask.git?path=src/UniTask/Assets/Plugins/UniTask",
26 |
27 | ```
28 |
29 | to your dependencies.
30 |
31 |
32 | ## How to use
33 |
34 | A sample usage with the [UniTask](https://github.com/Cysharp/UniTask) is as follows:
35 |
36 | ```
37 | private async UniTask LoadImageAsync(byte[] data)
38 | {
39 | await UniTask.SwitchToThreadPool();
40 |
41 | // Decodes an image on a thread pool.
42 | var imageResult = ImageDecoder.DecodeImage(data);
43 |
44 | await UniTask.SwitchToMainThread();
45 |
46 | // Creates a texture and set the pixel data on the main thread.
47 | return imageResult.ToTexture2D();
48 | }
49 | ```
50 | .
51 |
52 | See also [Demo](https://github.com/mochi-neko/StbImageSharpForUnity/blob/main/Assets/Mochineko/StbImageSharpForUnity.Demo/ImageLoaderDemo.cs).
53 |
54 | For animated GIF images, see [Animated GIF Demo](https://github.com/mochi-neko/StbImageSharpForUnity/blob/main/Assets/Mochineko/StbImageSharpForUnity.Demo/GifLoaderDemo.cs).
55 |
56 | ## Support Codecs
57 |
58 | - JPG
59 | - PNG
60 | - BMP
61 | - TGA
62 | - PSD
63 | - GIF
64 | - (HDR)
65 |
66 | See also [StbImageSharp](https://github.com/StbSharp/StbImageSharp).
67 |
68 | ## Support Platforms
69 |
70 | All platforms supported by Unity are supported because [StbImageSharp](https://github.com/StbSharp/StbImageSharp) is written by pure C#.
71 |
72 | See also [StbImageSharp](https://github.com/StbSharp/StbImageSharp).
73 |
74 | ## Changelog
75 |
76 | See [CHANGELOG.md](https://github.com/mochi-neko/StbImageSharpForUnity/blob/main/CHANGELOG.md).
77 |
78 | ## Credits
79 |
80 | - [StbImageSharp](https://github.com/StbSharp/StbImageSharp)
81 | - [stb](https://github.com/nothings/stb)
82 |
83 | See also [NOTICE.md](https://github.com/mochi-neko/StbImageSharpForUnity/blob/main/NOTICE.md).
84 |
85 | ## License
86 |
87 | [MIT License](https://github.com/mochi-neko/StbImageSharpForUnity/blob/main/LICENSE)
88 |
--------------------------------------------------------------------------------