-
-
Notifications
You must be signed in to change notification settings - Fork 468
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(sample)!: remove Start Scene (#1017)
* remove console window button * refactor: change sample scripts namespace * refactor: use AppSettings to configure the sample app * refactor!: ImageSource stops inheriting MonoBehaviour * refactor: remove ImageSource components from scenes * refactor: make Bootstrap a prefab * remove Global Config button * add AppSettings.asset * remove Start Scene * remove MemoizedLogger
- Loading branch information
Showing
89 changed files
with
1,732 additions
and
5,123 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
87 changes: 87 additions & 0 deletions
87
Assets/MediaPipeUnity/Samples/Common/Scripts/AppSettings.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
// Copyright (c) 2021 homuler | ||
// | ||
// Use of this source code is governed by an MIT-style | ||
// license that can be found in the LICENSE file or at | ||
// https://opensource.org/licenses/MIT. | ||
|
||
using System; | ||
using UnityEngine; | ||
using UnityEngine.Video; | ||
|
||
namespace Mediapipe.Unity.Sample | ||
{ | ||
[Serializable] | ||
public class AppSettings : ScriptableObject | ||
{ | ||
[Serializable] | ||
public enum AssetLoaderType | ||
{ | ||
StreamingAssets, | ||
AssetBundle, | ||
Local, | ||
} | ||
|
||
[SerializeField] private ImageSourceType _defaultImageSource; | ||
[SerializeField] private InferenceMode _preferableInferenceMode; | ||
[SerializeField] private AssetLoaderType _assetLoaderType; | ||
[SerializeField] private Logger.LogLevel _logLevel = Logger.LogLevel.Debug; | ||
|
||
[Header("Glog settings")] | ||
[SerializeField] private int _glogMinloglevel = Glog.Minloglevel; | ||
[SerializeField] private int _glogStderrthreshold = Glog.Stderrthreshold; | ||
[SerializeField] private int _glogV = Glog.V; | ||
|
||
[Header("WebCam Source")] | ||
[Tooltip("For the default resolution, the one whose width is closest to this value will be chosen")] | ||
|
||
[SerializeField] private int _preferredDefaultWebCamWidth = 1280; | ||
[SerializeField] private ImageSource.ResolutionStruct[] _defaultAvailableWebCamResolutions = new ImageSource.ResolutionStruct[] { | ||
new ImageSource.ResolutionStruct(176, 144, 30), | ||
new ImageSource.ResolutionStruct(320, 240, 30), | ||
new ImageSource.ResolutionStruct(424, 240, 30), | ||
new ImageSource.ResolutionStruct(640, 360, 30), | ||
new ImageSource.ResolutionStruct(640, 480, 30), | ||
new ImageSource.ResolutionStruct(848, 480, 30), | ||
new ImageSource.ResolutionStruct(960, 540, 30), | ||
new ImageSource.ResolutionStruct(1280, 720, 30), | ||
new ImageSource.ResolutionStruct(1600, 896, 30), | ||
new ImageSource.ResolutionStruct(1920, 1080, 30), | ||
}; | ||
|
||
[Header("Static Image Source")] | ||
[SerializeField] private Texture[] _availableStaticImageSources; | ||
[SerializeField] private ImageSource.ResolutionStruct[] _defaultAvailableStaticImageResolutions = new ImageSource.ResolutionStruct[] { | ||
new ImageSource.ResolutionStruct(512, 512, 0), | ||
new ImageSource.ResolutionStruct(640, 480, 0), | ||
new ImageSource.ResolutionStruct(1280, 720, 0), | ||
}; | ||
|
||
[Header("Video Source")] | ||
[SerializeField] private VideoClip[] _availableVideoSources; | ||
|
||
public ImageSourceType defaultImageSource => _defaultImageSource; | ||
public InferenceMode preferableInferenceMode => _preferableInferenceMode; | ||
public AssetLoaderType assetLoaderType => _assetLoaderType; | ||
public Logger.LogLevel logLevel => _logLevel; | ||
|
||
public void ResetGlogFlags() | ||
{ | ||
Glog.Logtostderr = true; | ||
Glog.Minloglevel = _glogMinloglevel; | ||
Glog.Stderrthreshold = _glogStderrthreshold; | ||
Glog.V = _glogV; | ||
} | ||
|
||
public WebCamSource BuildWebCamSource() => new WebCamSource( | ||
_preferredDefaultWebCamWidth, | ||
_defaultAvailableWebCamResolutions | ||
); | ||
|
||
public StaticImageSource BuildStaticImageSource() => new StaticImageSource( | ||
_availableStaticImageSources, | ||
_defaultAvailableStaticImageResolutions | ||
); | ||
|
||
public VideoSource BuildVideoSource() => new VideoSource(_availableVideoSources); | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...mmon/Scripts/StartSceneController.cs.meta → ...amples/Common/Scripts/AppSettings.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.