├── .gitignore ├── Assets ├── Controller.cs ├── Controller.cs.meta ├── Editor.meta ├── Editor │ ├── Build.cs │ └── Build.cs.meta ├── GifPlayer.cs ├── GifPlayer.cs.meta ├── Main.unity ├── Main.unity.meta ├── StandaloneFileBrowser.meta ├── StandaloneFileBrowser │ ├── IStandaloneFileBrowser.cs │ ├── IStandaloneFileBrowser.cs.meta │ ├── LICENSE.txt │ ├── LICENSE.txt.meta │ ├── Plugins.meta │ ├── Plugins │ │ ├── StandaloneFileBrowser.bundle.meta │ │ ├── StandaloneFileBrowser.bundle │ │ │ ├── Contents.meta │ │ │ └── Contents │ │ │ │ ├── Info.plist │ │ │ │ ├── Info.plist.meta │ │ │ │ ├── MacOS.meta │ │ │ │ └── MacOS │ │ │ │ ├── StandaloneFileBrowser │ │ │ │ └── StandaloneFileBrowser.meta │ │ ├── StandaloneFileBrowser.jslib │ │ └── StandaloneFileBrowser.jslib.meta │ ├── README.md │ ├── README.md.meta │ ├── StandaloneFileBrowser.cs │ ├── StandaloneFileBrowser.cs.meta │ ├── StandaloneFileBrowserEditor.cs │ ├── StandaloneFileBrowserEditor.cs.meta │ ├── StandaloneFileBrowserMac.cs │ ├── StandaloneFileBrowserMac.cs.meta │ ├── StandaloneFileBrowserWindows.cs │ └── StandaloneFileBrowserWindows.cs.meta ├── StreamingAssets.meta ├── StreamingAssets │ ├── UTJ.meta │ └── UTJ │ │ ├── FrameCapturer.meta │ │ └── FrameCapturer │ │ ├── License.txt │ │ └── License.txt.meta ├── UTJ.meta ├── UTJ │ ├── FrameCapturer.meta │ ├── FrameCapturer │ │ ├── Editor.meta │ │ ├── Editor │ │ │ ├── AudioEncoderConfigDrawer.cs │ │ │ ├── AudioEncoderConfigDrawer.cs.meta │ │ │ ├── AudioRecorderEditor.cs │ │ │ ├── AudioRecorderEditor.cs.meta │ │ │ ├── GBufferRecorderEditor.cs │ │ │ ├── GBufferRecorderEditor.cs.meta │ │ │ ├── Misc.meta │ │ │ ├── Misc │ │ │ │ ├── BoolDrawer.cs │ │ │ │ ├── BoolDrawer.cs.meta │ │ │ │ ├── DataPathDrawer.cs │ │ │ │ └── DataPathDrawer.cs.meta │ │ │ ├── MovieEncoderConfigDrawer.cs │ │ │ ├── MovieEncoderConfigDrawer.cs.meta │ │ │ ├── MovieRecorderEditor.cs │ │ │ ├── MovieRecorderEditor.cs.meta │ │ │ ├── RecorderBaseEditor.cs │ │ │ └── RecorderBaseEditor.cs.meta │ │ ├── Plugins.meta │ │ ├── Plugins │ │ │ ├── x86.meta │ │ │ ├── x86 │ │ │ │ ├── fccore.dll │ │ │ │ └── fccore.dll.meta │ │ │ ├── x86_64.meta │ │ │ └── x86_64 │ │ │ │ ├── fccore.bundle.meta │ │ │ │ ├── fccore.bundle │ │ │ │ ├── Contents.meta │ │ │ │ └── Contents │ │ │ │ │ ├── Info.plist │ │ │ │ │ ├── Info.plist.meta │ │ │ │ │ ├── MacOS.meta │ │ │ │ │ └── MacOS │ │ │ │ │ ├── fccore │ │ │ │ │ └── fccore.meta │ │ │ │ ├── fccore.dll │ │ │ │ └── fccore.dll.meta │ │ ├── Scripts.meta │ │ ├── Scripts │ │ │ ├── AudioRecorder.cs │ │ │ ├── AudioRecorder.cs.meta │ │ │ ├── Encoder.meta │ │ │ ├── Encoder │ │ │ │ ├── AudioEncoder.cs │ │ │ │ ├── AudioEncoder.cs.meta │ │ │ │ ├── EncoderBase.cs │ │ │ │ ├── EncoderBase.cs.meta │ │ │ │ ├── ExrEncoder.cs │ │ │ │ ├── ExrEncoder.cs.meta │ │ │ │ ├── FlacEncoder.cs │ │ │ │ ├── FlacEncoder.cs.meta │ │ │ │ ├── GifEncoder.cs │ │ │ │ ├── GifEncoder.cs.meta │ │ │ │ ├── MP4Encoder.cs │ │ │ │ ├── MP4Encoder.cs.meta │ │ │ │ ├── MovieEncoder.cs │ │ │ │ ├── MovieEncoder.cs.meta │ │ │ │ ├── OggEncoder.cs │ │ │ │ ├── OggEncoder.cs.meta │ │ │ │ ├── PngEncoder.cs │ │ │ │ ├── PngEncoder.cs.meta │ │ │ │ ├── WaveEncoder.cs │ │ │ │ ├── WaveEncoder.cs.meta │ │ │ │ ├── WebMEncoder.cs │ │ │ │ ├── WebMEncoder.cs.meta │ │ │ │ ├── fcAPI.cs │ │ │ │ └── fcAPI.cs.meta │ │ │ ├── GBufferRecorder.cs │ │ │ ├── GBufferRecorder.cs.meta │ │ │ ├── Misc.meta │ │ │ ├── Misc │ │ │ │ ├── Bool.cs │ │ │ │ ├── Bool.cs.meta │ │ │ │ ├── DataPath.cs │ │ │ │ └── DataPath.cs.meta │ │ │ ├── MovieRecorder.cs │ │ │ ├── MovieRecorder.cs.meta │ │ │ ├── RecorderBase.cs │ │ │ └── RecorderBase.cs.meta │ │ ├── Shaders.meta │ │ └── Shaders │ │ │ ├── CopyFrameBuffer.shader │ │ │ └── CopyFrameBuffer.shader.meta │ ├── FrameCapturerExample.meta │ └── FrameCapturerExample │ │ ├── Animation.meta │ │ ├── Animation │ │ ├── Camera.anim │ │ ├── Camera.anim.meta │ │ ├── CameraRig.controller │ │ ├── CameraRig.controller.meta │ │ ├── Sphere.anim │ │ ├── Sphere.anim.meta │ │ ├── Sphere.controller │ │ └── Sphere.controller.meta │ │ ├── Materials.meta │ │ ├── Materials │ │ ├── Test1.mat │ │ ├── Test1.mat.meta │ │ ├── Test2.mat │ │ ├── Test2.mat.meta │ │ ├── Test3.mat │ │ ├── Test3.mat.meta │ │ ├── Test4.mat │ │ └── Test4.mat.meta │ │ ├── Prefabs.meta │ │ ├── Prefabs │ │ ├── CameraRig.prefab │ │ ├── CameraRig.prefab.meta │ │ ├── Root.prefab │ │ └── Root.prefab.meta │ │ ├── Test.unity │ │ ├── Test.unity.meta │ │ ├── TestOffscreen.unity │ │ ├── TestOffscreen.unity.meta │ │ ├── Textures.meta │ │ └── Textures │ │ ├── RenderTarget.renderTexture │ │ └── RenderTarget.renderTexture.meta ├── UniGif.meta ├── UniGif │ ├── .gitignore │ ├── Assets.meta │ ├── Assets │ │ ├── UniGif.meta │ │ └── UniGif │ │ │ ├── UniGif.cs │ │ │ ├── UniGif.cs.meta │ │ │ ├── UniGifConst.cs │ │ │ ├── UniGifConst.cs.meta │ │ │ ├── UniGifDecoder.cs │ │ │ ├── UniGifDecoder.cs.meta │ │ │ ├── UniGifExtension.cs │ │ │ ├── UniGifExtension.cs.meta │ │ │ ├── UniGifFormatter.cs │ │ │ └── UniGifFormatter.cs.meta │ ├── LICENSE.txt │ ├── LICENSE.txt.meta │ ├── ProjectSettings.meta │ ├── ProjectSettings │ │ ├── AudioManager.asset │ │ ├── AudioManager.asset.meta │ │ ├── ClusterInputManager.asset │ │ ├── ClusterInputManager.asset.meta │ │ ├── DynamicsManager.asset │ │ ├── DynamicsManager.asset.meta │ │ ├── EditorBuildSettings.asset │ │ ├── EditorBuildSettings.asset.meta │ │ ├── EditorSettings.asset │ │ ├── EditorSettings.asset.meta │ │ ├── GraphicsSettings.asset │ │ ├── GraphicsSettings.asset.meta │ │ ├── InputManager.asset │ │ ├── InputManager.asset.meta │ │ ├── NavMeshAreas.asset │ │ ├── NavMeshAreas.asset.meta │ │ ├── NavMeshLayers.asset │ │ ├── NavMeshLayers.asset.meta │ │ ├── NetworkManager.asset │ │ ├── NetworkManager.asset.meta │ │ ├── Physics2DSettings.asset │ │ ├── Physics2DSettings.asset.meta │ │ ├── ProjectSettings.asset │ │ ├── ProjectSettings.asset.meta │ │ ├── ProjectVersion.txt │ │ ├── ProjectVersion.txt.meta │ │ ├── QualitySettings.asset │ │ ├── QualitySettings.asset.meta │ │ ├── TagManager.asset │ │ ├── TagManager.asset.meta │ │ ├── TimeManager.asset │ │ ├── TimeManager.asset.meta │ │ ├── UnityAdsSettings.asset │ │ ├── UnityAdsSettings.asset.meta │ │ ├── UnityConnectSettings.asset │ │ └── UnityConnectSettings.asset.meta │ ├── README.md │ └── README.md.meta ├── Visualizer.cs └── Visualizer.cs.meta ├── LICENSE ├── ProjectSettings ├── AudioManager.asset ├── ClusterInputManager.asset ├── DynamicsManager.asset ├── EditorBuildSettings.asset ├── EditorSettings.asset ├── GraphicsSettings.asset ├── InputManager.asset ├── NavMeshAreas.asset ├── NetworkManager.asset ├── Physics2DSettings.asset ├── ProjectSettings.asset ├── ProjectVersion.txt ├── QualitySettings.asset ├── TagManager.asset ├── TimeManager.asset └── UnityConnectSettings.asset └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | /TwitterMVGenerator/ 2 | /audio.wav 3 | /background.png 4 | /Movie/ 5 | /ffmpeg/ 6 | /.vs/ 7 | 8 | /[Ll]ibrary/ 9 | /[Tt]emp/ 10 | /[Oo]bj/ 11 | /[Bb]uild/ 12 | /[Bb]uilds/ 13 | /Assets/AssetStoreTools* 14 | 15 | # Autogenerated VS/MD solution and project files 16 | ExportedObj/ 17 | *.csproj 18 | *.unityproj 19 | *.sln 20 | *.suo 21 | *.tmp 22 | *.user 23 | *.userprefs 24 | *.pidb 25 | *.booproj 26 | *.svd 27 | 28 | 29 | # Unity3D generated meta files 30 | *.pidb.meta 31 | 32 | # Unity3D Generated File On Crash Reports 33 | sysinfo.txt 34 | 35 | # Builds 36 | *.apk 37 | *.unitypackage 38 | -------------------------------------------------------------------------------- /Assets/Controller.cs: -------------------------------------------------------------------------------- 1 | using SFB; 2 | using System; 3 | using System.Collections; 4 | using System.Diagnostics; 5 | using System.IO; 6 | using UnityEngine; 7 | using UnityEngine.UI; 8 | using UTJ.FrameCapturer; 9 | 10 | public class Controller : MonoBehaviour 11 | { 12 | public static string LastPath { get; set; } 13 | 14 | [SerializeField] 15 | MovieRecorder mp4Recorder; 16 | [SerializeField] 17 | MovieRecorder webMRecorder; 18 | [SerializeField] 19 | RawImage image; 20 | 21 | bool useWebMInsteadOfMp4; 22 | 23 | string rootDirectory; 24 | 25 | GifPlayer gifPlayer; 26 | 27 | string GetFilePath(string relativePathFromRoot) 28 | { 29 | if (relativePathFromRoot.StartsWith("./")) 30 | { 31 | relativePathFromRoot = relativePathFromRoot.Substring(2); 32 | } 33 | 34 | return new FileInfo(rootDirectory + relativePathFromRoot).FullName.Replace("\\", "/"); 35 | } 36 | 37 | IEnumerator Start() 38 | { 39 | rootDirectory = Application.dataPath + "/../"; 40 | 41 | if (Application.platform == RuntimePlatform.OSXEditor || Application.platform == RuntimePlatform.OSXPlayer) 42 | { 43 | useWebMInsteadOfMp4 = true; 44 | } 45 | 46 | if (Application.platform == RuntimePlatform.OSXPlayer) 47 | { 48 | // OSX の場合にはアプリが別のパスに隔離されてしまうので問い合わせが必要 49 | var dir = PlayerPrefs.HasKey("RootDirectory") ? PlayerPrefs.GetString("RootDirectory") : ""; 50 | var paths = StandaloneFileBrowser.OpenFilePanel("audio.wav を選択してください", dir, "wav", false); 51 | if (paths.Length == 0) 52 | { 53 | Application.Quit(); 54 | yield break; 55 | } 56 | 57 | rootDirectory = Uri.UnescapeDataString(Path.GetDirectoryName(paths[0]).Replace("file:", "") + "/"); 58 | PlayerPrefs.SetString("RootDirectory", rootDirectory); 59 | } 60 | 61 | 62 | print("rootDir:" + rootDirectory); 63 | 64 | if (File.Exists(GetFilePath("background.png"))) 65 | { 66 | print(GetFilePath("background.png")); 67 | var imageWWW = new WWW("file://" + GetFilePath("background.png")); 68 | yield return imageWWW; 69 | image.texture = imageWWW.texture; 70 | SetResolution(imageWWW.texture.width, imageWWW.texture.height); 71 | } 72 | else if (File.Exists(GetFilePath("background.jpg"))) 73 | { 74 | print(GetFilePath("background.jpg")); 75 | var imageWWW = new WWW("file://" + GetFilePath("background.jpg")); 76 | yield return imageWWW; 77 | image.texture = imageWWW.texture; 78 | SetResolution(imageWWW.texture.width, imageWWW.texture.height); 79 | } 80 | else if (File.Exists(GetFilePath("background.gif"))) 81 | { 82 | print(GetFilePath("background.gif")); 83 | var imageWWW = new WWW("file://" + GetFilePath("background.gif")); 84 | yield return imageWWW; 85 | yield return StartCoroutine(UniGif.GetTextureListCoroutine(imageWWW.bytes, (gifTexList, loopCount, width, height) => 86 | { 87 | SetResolution(width, height); 88 | gifPlayer = GifPlayer.Create(image, gifTexList); 89 | })); 90 | } 91 | else 92 | { 93 | SetResolution(720, 304); 94 | } 95 | 96 | print(GetFilePath("audio.wav")); 97 | var audiosource = gameObject.AddComponent(); 98 | var audioWWW = new WWW("file://" + GetFilePath("audio.wav")); 99 | yield return audioWWW; 100 | audiosource.clip = audioWWW.GetAudioClip(false); 101 | 102 | var recorder = mp4Recorder; 103 | 104 | if (useWebMInsteadOfMp4) 105 | { 106 | recorder = webMRecorder; 107 | } 108 | 109 | recorder.outputDir = new DataPath(GetFilePath("Movie")); 110 | 111 | recorder.BeginRecording(); 112 | if (gifPlayer != null) 113 | { 114 | gifPlayer.PlaySyncWith(audiosource); 115 | } 116 | audiosource.Play(); 117 | print(LastPath); 118 | yield return new WaitWhile(() => audiosource.isPlaying); 119 | recorder.EndRecording(); 120 | 121 | yield return new WaitForSeconds(2f); 122 | 123 | if (useWebMInsteadOfMp4) 124 | { 125 | var webmPath = "\"" + LastPath + ".webm" + "\""; 126 | var mp4Path = "\"" + LastPath + ".mp4" + "\""; 127 | var exeExtension = Application.platform == RuntimePlatform.WindowsEditor || Application.platform == RuntimePlatform.WindowsPlayer ? ".exe" : ""; 128 | var process = Process.Start(GetFilePath("ffmpeg/ffmpeg" + exeExtension), "-i " + webmPath + " " + mp4Path); 129 | process.WaitForExit(); 130 | File.Delete(LastPath + ".webm"); 131 | } 132 | 133 | Application.Quit(); 134 | } 135 | 136 | void SetResolution(int width, int height) 137 | { 138 | const int MinimumResolution = 720; 139 | if (width < MinimumResolution || height < MinimumResolution) 140 | { 141 | var scale = (float)MinimumResolution / Mathf.Min(width, height); 142 | width = Mathf.RoundToInt(width * scale); 143 | height = Mathf.RoundToInt(height * scale); 144 | } 145 | 146 | Screen.SetResolution(width, height, false); 147 | } 148 | } 149 | -------------------------------------------------------------------------------- /Assets/Controller.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 29cfcd564f125f14ea8f4ef499d1d627 3 | timeCreated: 1500626091 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4bf9c1c64d55ffe44b4860f0fb784039 3 | folderAsset: yes 4 | timeCreated: 1500726634 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Editor/Build.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using UnityEditor; 3 | 4 | public static class Build 5 | { 6 | [MenuItem("File/Build For All Platforms")] 7 | public static void BuildForAllPlatforms() 8 | { 9 | var scenes = EditorBuildSettings.scenes.Select(s => s.path).ToArray(); 10 | 11 | var winOptions = new BuildPlayerOptions() 12 | { 13 | locationPathName = "TwitterMVGenerator/win/TwitterMVGenerator.exe", 14 | target = BuildTarget.StandaloneWindows, 15 | options = BuildOptions.None, 16 | scenes = scenes, 17 | }; 18 | BuildPipeline.BuildPlayer(winOptions); 19 | 20 | var osxOptions = new BuildPlayerOptions() 21 | { 22 | locationPathName = "TwitterMVGenerator/osx/TwitterMVGenerator.app", 23 | target = BuildTarget.StandaloneOSXIntel64, 24 | options = BuildOptions.None, 25 | scenes = scenes, 26 | }; 27 | BuildPipeline.BuildPlayer(osxOptions); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Assets/Editor/Build.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fecc03c9ac8fde64f9af7e311077ae89 3 | timeCreated: 1500726634 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/GifPlayer.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | using UnityEngine; 4 | using UnityEngine.UI; 5 | using UTJ.FrameCapturer; 6 | 7 | public class GifPlayer : MonoBehaviour 8 | { 9 | public static GifPlayer Create(RawImage image, List textures) 10 | { 11 | var player = new GameObject("GifPlayer").AddComponent(); 12 | player.Initialize(image, textures); 13 | return player; 14 | } 15 | 16 | class SequenceData 17 | { 18 | public readonly Texture2D texture; 19 | public readonly float cumulativeSec; 20 | 21 | public SequenceData(Texture2D texture, float cumulativeSec) 22 | { 23 | this.texture = texture; 24 | this.cumulativeSec = cumulativeSec; 25 | } 26 | } 27 | 28 | RawImage image; 29 | 30 | float lengthSec; 31 | List sequence = new List(); 32 | MovieRecorder recorder; 33 | 34 | AudioSource audioSource; 35 | 36 | void Initialize(RawImage image, List textures) 37 | { 38 | var cumulativeSec = 0f; 39 | foreach (var texture in textures) 40 | { 41 | sequence.Add(new SequenceData(texture.m_texture2d, cumulativeSec)); 42 | cumulativeSec += texture.m_delaySec; 43 | } 44 | lengthSec = cumulativeSec; 45 | 46 | this.image = image; 47 | this.image.texture = sequence[0].texture; 48 | } 49 | 50 | public void PlaySyncWith(AudioSource audioSource) 51 | { 52 | this.audioSource = audioSource; 53 | } 54 | 55 | void Update() 56 | { 57 | if (sequence.Count == 1 || audioSource == null) return; 58 | var currentSec = audioSource.time % lengthSec; 59 | image.texture = sequence.Last(s => s.cumulativeSec <= currentSec).texture; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /Assets/GifPlayer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 363a6711d48cbe94aa9e4f1cda1db60e 3 | timeCreated: 1500855765 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/Main.unity: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chiepomme/TwitterMVGenerator/e4608e3a4aa01d2943441b27ab6071b3f4d3a011/Assets/Main.unity -------------------------------------------------------------------------------- /Assets/Main.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d0b4f1b79b96547439ce99c8be589f3e 3 | timeCreated: 1500626019 4 | licenseType: Free 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/StandaloneFileBrowser.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a170f49d2def54e8fbf9d7d7598e0890 3 | folderAsset: yes 4 | timeCreated: 1483902786 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/StandaloneFileBrowser/IStandaloneFileBrowser.cs: -------------------------------------------------------------------------------- 1 | namespace SFB { 2 | public interface IStandaloneFileBrowser { 3 | string[] OpenFilePanel(string title, string directory, ExtensionFilter[] extensions, bool multiselect); 4 | string[] OpenFolderPanel(string title, string directory, bool multiselect); 5 | string SaveFilePanel(string title, string directory, string defaultName, ExtensionFilter[] extensions); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /Assets/StandaloneFileBrowser/IStandaloneFileBrowser.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7609f7b6787a54496aa41a3053fcc76a 3 | timeCreated: 1483902788 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/StandaloneFileBrowser/LICENSE.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Gökhan Gökçe 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 | -------------------------------------------------------------------------------- /Assets/StandaloneFileBrowser/LICENSE.txt.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1e40c9029689f994fa5671f85796d63b 3 | timeCreated: 1500722916 4 | licenseType: Free 5 | TextScriptImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/StandaloneFileBrowser/Plugins.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fabd0452d926f4a79b1a6ac2a3524117 3 | folderAsset: yes 4 | timeCreated: 1483902786 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/StandaloneFileBrowser/Plugins/StandaloneFileBrowser.bundle.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a2a9837b81577491baf2ffadec5e2852 3 | folderAsset: yes 4 | timeCreated: 1491979493 5 | licenseType: Pro 6 | PluginImporter: 7 | serializedVersion: 2 8 | iconMap: {} 9 | executionOrder: {} 10 | isPreloaded: 0 11 | isOverridable: 0 12 | platformData: 13 | data: 14 | first: 15 | Any: 16 | second: 17 | enabled: 0 18 | settings: {} 19 | data: 20 | first: 21 | Editor: Editor 22 | second: 23 | enabled: 1 24 | settings: 25 | DefaultValueInitialized: true 26 | data: 27 | first: 28 | Standalone: OSXIntel 29 | second: 30 | enabled: 1 31 | settings: {} 32 | data: 33 | first: 34 | Standalone: OSXIntel64 35 | second: 36 | enabled: 1 37 | settings: {} 38 | data: 39 | first: 40 | Standalone: OSXUniversal 41 | second: 42 | enabled: 1 43 | settings: {} 44 | userData: 45 | assetBundleName: 46 | assetBundleVariant: 47 | -------------------------------------------------------------------------------- /Assets/StandaloneFileBrowser/Plugins/StandaloneFileBrowser.bundle/Contents.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 46dc4eb12fae14a349800ec0e97ac0c2 3 | folderAsset: yes 4 | timeCreated: 1497808938 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/StandaloneFileBrowser/Plugins/StandaloneFileBrowser.bundle/Contents/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | BuildMachineOSBuild 6 | 16E195 7 | CFBundleDevelopmentRegion 8 | English 9 | CFBundleExecutable 10 | StandaloneFileBrowser 11 | CFBundleIdentifier 12 | com.gkngkc.sfb 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | StandaloneFileBrowser 17 | CFBundlePackageType 18 | BNDL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleSupportedPlatforms 24 | 25 | MacOSX 26 | 27 | CFBundleVersion 28 | 1.0 29 | CSResourcesFileMapped 30 | 31 | DTCompiler 32 | com.apple.compilers.llvm.clang.1_0 33 | DTPlatformBuild 34 | 8E3004b 35 | DTPlatformVersion 36 | GM 37 | DTSDKBuild 38 | 16E185 39 | DTSDKName 40 | macosx10.12 41 | DTXcode 42 | 0833 43 | DTXcodeBuild 44 | 8E3004b 45 | 46 | 47 | -------------------------------------------------------------------------------- /Assets/StandaloneFileBrowser/Plugins/StandaloneFileBrowser.bundle/Contents/Info.plist.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ce685769797f44046afa3e567860c94c 3 | timeCreated: 1497808940 4 | licenseType: Pro 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/StandaloneFileBrowser/Plugins/StandaloneFileBrowser.bundle/Contents/MacOS.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ee557323b3b2e4d0f8b4d5a2fdca2f1b 3 | folderAsset: yes 4 | timeCreated: 1497808940 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/StandaloneFileBrowser/Plugins/StandaloneFileBrowser.bundle/Contents/MacOS/StandaloneFileBrowser: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chiepomme/TwitterMVGenerator/e4608e3a4aa01d2943441b27ab6071b3f4d3a011/Assets/StandaloneFileBrowser/Plugins/StandaloneFileBrowser.bundle/Contents/MacOS/StandaloneFileBrowser -------------------------------------------------------------------------------- /Assets/StandaloneFileBrowser/Plugins/StandaloneFileBrowser.bundle/Contents/MacOS/StandaloneFileBrowser.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ddf122e0e89124ce78aacfeecb3ec554 3 | timeCreated: 1497808943 4 | licenseType: Pro 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/StandaloneFileBrowser/Plugins/StandaloneFileBrowser.jslib: -------------------------------------------------------------------------------- 1 | var StandaloneFileBrowserWebGLPlugin = { 2 | // Open file. 3 | // gameObjectNamePtr: GameObject name required for calling back unity side with SendMessage. And it should be unique 4 | // filter(disabled): Filter files. Example filters: 5 | // Match all image files: "image/*" 6 | // Match all video files: "video/*" 7 | // Match all audio files: "audio/*" 8 | // Custom: ".plist,.xml,.yaml" 9 | // multiselect(disabled): Allows multiple file selection 10 | UploadFile: function(gameObjectNamePtr/*, filter, multiselect*/) { 11 | gameObjectName = Pointer_stringify(gameObjectNamePtr); 12 | 13 | // Delete if element exist 14 | var fileInput = document.getElementById(gameObjectName) 15 | if (fileInput) { 16 | document.body.removeChild(fileInput); 17 | } 18 | 19 | fileInput = document.createElement('input'); 20 | fileInput.setAttribute('id', gameObjectName); 21 | fileInput.setAttribute('type', 'file'); 22 | fileInput.setAttribute('style','display:none;'); 23 | fileInput.setAttribute('style','visibility:hidden;'); 24 | // if (multiselect) { 25 | // fileInput.setAttribute('multiple', multiselect); 26 | // } 27 | // if (filter) { 28 | // fileInput.setAttribute('accept', filter); 29 | // } 30 | fileInput.onclick = function (event) { 31 | // File dialog opened 32 | this.value = null; 33 | }; 34 | fileInput.onchange = function (event) { 35 | // multiselect works 36 | // for (var i = 0; i < event.target.files.length; i++) { 37 | // console.log(URL.createObjectURL(event.target.files[i])); 38 | // } 39 | // File selected 40 | SendMessage(gameObjectName, 'OnFileUploaded', URL.createObjectURL(event.target.files[0])); 41 | 42 | // Remove after file selected 43 | document.body.removeChild(fileInput); 44 | } 45 | document.body.appendChild(fileInput); 46 | 47 | document.onmouseup = function() { 48 | fileInput.click(); 49 | document.onmouseup = null; 50 | } 51 | }, 52 | 53 | // Open folder. - NOT IMPLEMENTED 54 | UploadFolder: function(gameObjectNamePtr) { 55 | gameObjectName = Pointer_stringify(gameObjectNamePtr); 56 | SendMessage(gameObjectName, 'OnFolderUploaded', ''); 57 | }, 58 | 59 | // Save file 60 | // DownloadFile method does not open SaveFileDialog like standalone builds, its just allows user to download file 61 | // gameObjectNamePtr: GameObject name required for calling back unity side with SendMessage. And it should be unique 62 | // DownloadFile does not return any info, just calls 'OnFileDownloaded' without any parameter 63 | // filenamePtr: Filename with extension 64 | // byteArray: byte[] 65 | // byteArraySize: byte[].Length 66 | DownloadFile: function(gameObjectNamePtr, filenamePtr, byteArray, byteArraySize) { 67 | gameObjectName = Pointer_stringify(gameObjectNamePtr); 68 | filename = Pointer_stringify(filenamePtr); 69 | 70 | var bytes = new Uint8Array(byteArraySize); 71 | for (var i = 0; i < byteArraySize; i++) { 72 | bytes[i] = HEAPU8[byteArray + i]; 73 | } 74 | 75 | var downloader = window.document.createElement('a'); 76 | downloader.setAttribute('id', gameObjectName); 77 | downloader.href = window.URL.createObjectURL(new Blob([bytes], { type: 'application/octet-stream' })); 78 | downloader.download = filename; 79 | document.body.appendChild(downloader); 80 | 81 | document.onmouseup = function() { 82 | downloader.click(); 83 | document.body.removeChild(downloader); 84 | document.onmouseup = null; 85 | 86 | SendMessage(gameObjectName, 'OnFileDownloaded'); 87 | } 88 | } 89 | }; 90 | 91 | mergeInto(LibraryManager.library, StandaloneFileBrowserWebGLPlugin); -------------------------------------------------------------------------------- /Assets/StandaloneFileBrowser/Plugins/StandaloneFileBrowser.jslib.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 265aaf20a6d564e0fb00a9c4a7a9c300 3 | timeCreated: 1491979497 4 | licenseType: Pro 5 | PluginImporter: 6 | serializedVersion: 2 7 | iconMap: {} 8 | executionOrder: {} 9 | isPreloaded: 0 10 | isOverridable: 0 11 | platformData: 12 | data: 13 | first: 14 | Any: 15 | second: 16 | enabled: 0 17 | settings: {} 18 | data: 19 | first: 20 | Editor: Editor 21 | second: 22 | enabled: 0 23 | settings: 24 | DefaultValueInitialized: true 25 | data: 26 | first: 27 | Facebook: WebGL 28 | second: 29 | enabled: 1 30 | settings: {} 31 | data: 32 | first: 33 | WebGL: WebGL 34 | second: 35 | enabled: 1 36 | settings: {} 37 | userData: 38 | assetBundleName: 39 | assetBundleVariant: 40 | -------------------------------------------------------------------------------- /Assets/StandaloneFileBrowser/README.md: -------------------------------------------------------------------------------- 1 | # Unity Standalone File Browser 2 | 3 | A simple wrapper for native file dialogs on Windows/Mac. 4 | 5 | - Works in editor and runtime. 6 | - Open file/folder, save file dialogs supported. 7 | - Multiple file selection. 8 | - File extension filter. 9 | - Windows version requires .NET 2.0 api compatibility level 10 | - Linux is not supported. 11 | - Basic WebGL support. 12 | 13 | Example usage: 14 | 15 | ```csharp 16 | // Open file 17 | var paths = StandaloneFileBrowser.OpenFilePanel("Open File", "", "", false); 18 | 19 | // Open file with filter 20 | var extensions = new [] { 21 | new ExtensionFilter("Image Files", "png", "jpg", "jpeg" ), 22 | new ExtensionFilter("Sound Files", "mp3", "wav" ), 23 | new ExtensionFilter("All Files", "*" ), 24 | }; 25 | var paths = StandaloneFileBrowser.OpenFilePanel("Open File", "", extensions, true); 26 | 27 | // Save file 28 | var path = StandaloneFileBrowser.SaveFilePanel("Save File", "", "", ""); 29 | 30 | // Save file with filter 31 | var extensionList = new [] { 32 | new ExtensionFilter("Binary", "bin"), 33 | new ExtensionFilter("Text", "txt"), 34 | }; 35 | var path = StandaloneFileBrowser.SaveFilePanel("Save File", "", "MySaveFile", extensionList); 36 | ``` 37 | Look for Sample/BasicSampleScene.unity for more detailed examples. 38 | 39 | Mac Screenshot 40 | ![Alt text](/Images/sfb_mac.jpg?raw=true "Mac") 41 | 42 | Windows Screenshot 43 | ![Alt text](/Images/sfb_win.jpg?raw=true "Win") 44 | 45 | WebGL: 46 | - Basic upload/download file support. 47 | - Not well tested, probably not much reliable. 48 | - Since browsers require more work to do file operations, webgl isn't directly implemented to Open/Save calls. You can check CanvasSampleScene.unity and canvas sample scripts for example usages. 49 | 50 | Live Demo: https://gkngkc.github.io/ 51 | -------------------------------------------------------------------------------- /Assets/StandaloneFileBrowser/README.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2fd4cc599dd52714585d56cc3205ff44 3 | timeCreated: 1500722916 4 | licenseType: Free 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/StandaloneFileBrowser/StandaloneFileBrowser.cs: -------------------------------------------------------------------------------- 1 | namespace SFB { 2 | public struct ExtensionFilter { 3 | public string Name; 4 | public string[] Extensions; 5 | 6 | public ExtensionFilter(string filterName, params string[] filterExtensions) { 7 | Name = filterName; 8 | Extensions = filterExtensions; 9 | } 10 | } 11 | 12 | public class StandaloneFileBrowser { 13 | private static IStandaloneFileBrowser _platformWrapper = null; 14 | 15 | static StandaloneFileBrowser() { 16 | #if UNITY_STANDALONE_OSX 17 | _platformWrapper = new StandaloneFileBrowserMac(); 18 | #elif UNITY_STANDALONE_WIN 19 | _platformWrapper = new StandaloneFileBrowserWindows(); 20 | #elif UNITY_EDITOR 21 | _platformWrapper = new StandaloneFileBrowserEditor(); 22 | #endif 23 | } 24 | 25 | /// 26 | /// Open native file browser 27 | /// 28 | /// Dialog title 29 | /// Root directory 30 | /// Allowed extension 31 | /// Allow multiple file selection 32 | /// Returns array of chosen paths. Zero length array when cancelled 33 | public static string[] OpenFilePanel(string title, string directory, string extension, bool multiselect) { 34 | var extensions = string.IsNullOrEmpty(extension) ? null : new [] { new ExtensionFilter("", extension) }; 35 | return OpenFilePanel(title, directory, extensions, multiselect); 36 | } 37 | 38 | /// 39 | /// Native open file dialog 40 | /// 41 | /// Dialog title 42 | /// Root directory 43 | /// List of extension filters. Filter Example: new ExtensionFilter("Image Files", "jpg", "png") 44 | /// Allow multiple file selection 45 | /// Returns array of chosen paths. Zero length array when cancelled 46 | public static string[] OpenFilePanel(string title, string directory, ExtensionFilter[] extensions, bool multiselect) { 47 | return _platformWrapper.OpenFilePanel(title, directory, extensions, multiselect); 48 | } 49 | 50 | /// 51 | /// Native open folder dialog 52 | /// NOTE: Multiple folder selection doesn't supported on Windows 53 | /// 54 | /// 55 | /// Root directory 56 | /// 57 | /// Returns array of chosen paths. Zero length array when cancelled 58 | public static string[] OpenFolderPanel(string title, string directory, bool multiselect) { 59 | return _platformWrapper.OpenFolderPanel(title, directory, multiselect); 60 | } 61 | 62 | /// 63 | /// Native save file dialog 64 | /// 65 | /// Dialog title 66 | /// Root directory 67 | /// Default file name 68 | /// File extension 69 | /// Returns chosen path. Empty string when cancelled 70 | public static string SaveFilePanel(string title, string directory, string defaultName , string extension) { 71 | var extensions = string.IsNullOrEmpty(extension) ? null : new [] { new ExtensionFilter("", extension) }; 72 | return SaveFilePanel(title, directory, defaultName, extensions); 73 | } 74 | 75 | /// 76 | /// Native save file dialog 77 | /// 78 | /// Dialog title 79 | /// Root directory 80 | /// Default file name 81 | /// List of extension filters. Filter Example: new ExtensionFilter("Image Files", "jpg", "png") 82 | /// Returns chosen path. Empty string when cancelled 83 | public static string SaveFilePanel(string title, string directory, string defaultName, ExtensionFilter[] extensions) { 84 | return _platformWrapper.SaveFilePanel(title, directory, defaultName, extensions); 85 | } 86 | } 87 | } -------------------------------------------------------------------------------- /Assets/StandaloneFileBrowser/StandaloneFileBrowser.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3c708be74128e4ced9b79eaaf80e8443 3 | timeCreated: 1483902788 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/StandaloneFileBrowser/StandaloneFileBrowserEditor.cs: -------------------------------------------------------------------------------- 1 | #if UNITY_EDITOR 2 | 3 | using UnityEditor; 4 | 5 | namespace SFB { 6 | public class StandaloneFileBrowserEditor : IStandaloneFileBrowser { 7 | public string[] OpenFilePanel(string title, string directory, ExtensionFilter[] extensions, bool multiselect) { 8 | string path = ""; 9 | 10 | if (extensions == null) { 11 | path = EditorUtility.OpenFilePanel(title, directory, ""); 12 | } 13 | else { 14 | path = EditorUtility.OpenFilePanelWithFilters(title, directory, GetFilterFromFileExtensionList(extensions)); 15 | } 16 | 17 | return string.IsNullOrEmpty(path) ? new string[0] : new[] { path }; 18 | } 19 | 20 | public string[] OpenFolderPanel(string title, string directory, bool multiselect) { 21 | var path = EditorUtility.OpenFolderPanel(title, directory, ""); 22 | return string.IsNullOrEmpty(path) ? new string[0] : new[] {path}; 23 | } 24 | 25 | public string SaveFilePanel(string title, string directory, string defaultName, ExtensionFilter[] extensions) { 26 | var ext = extensions != null ? extensions[0].Extensions[0] : ""; 27 | var name = string.IsNullOrEmpty(ext) ? defaultName : defaultName + "." + ext; 28 | return EditorUtility.SaveFilePanel(title, directory, name, ext); 29 | } 30 | 31 | // EditorUtility.OpenFilePanelWithFilters extension filter format 32 | private static string[] GetFilterFromFileExtensionList(ExtensionFilter[] extensions) { 33 | var filters = new string[extensions.Length * 2]; 34 | for (int i = 0; i < extensions.Length; i++) { 35 | filters[(i * 2)] = extensions[i].Name; 36 | filters[(i * 2) + 1] = string.Join(",", extensions[i].Extensions); 37 | } 38 | return filters; 39 | } 40 | } 41 | } 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /Assets/StandaloneFileBrowser/StandaloneFileBrowserEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2650af8de2cda46b99b1bc7cf5d30ca5 3 | timeCreated: 1483902788 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/StandaloneFileBrowser/StandaloneFileBrowserMac.cs: -------------------------------------------------------------------------------- 1 | #if UNITY_STANDALONE_OSX 2 | 3 | using System; 4 | using System.Runtime.InteropServices; 5 | 6 | namespace SFB { 7 | public class StandaloneFileBrowserMac : IStandaloneFileBrowser { 8 | [DllImport("StandaloneFileBrowser")] 9 | private static extern IntPtr DialogOpenFilePanel(string title, string directory, string extension, bool multiselect); 10 | [DllImport("StandaloneFileBrowser")] 11 | private static extern IntPtr DialogOpenFolderPanel(string title, string directory, bool multiselect); 12 | [DllImport("StandaloneFileBrowser")] 13 | private static extern IntPtr DialogSaveFilePanel(string title, string directory, string defaultName, string extension); 14 | 15 | public string[] OpenFilePanel(string title, string directory, ExtensionFilter[] extensions, bool multiselect) { 16 | var paths = Marshal.PtrToStringAnsi(DialogOpenFilePanel(title, directory, GetFilterFromFileExtensionList(extensions), multiselect)); 17 | return paths.Split((char)28); 18 | } 19 | 20 | public string[] OpenFolderPanel(string title, string directory, bool multiselect) { 21 | var paths = Marshal.PtrToStringAnsi(DialogOpenFolderPanel(title, directory, multiselect)); 22 | return paths.Split((char)28); 23 | } 24 | 25 | public string SaveFilePanel(string title, string directory, string defaultName, ExtensionFilter[] extensions) { 26 | return Marshal.PtrToStringAnsi(DialogSaveFilePanel(title, directory, defaultName, GetFilterFromFileExtensionList(extensions))); 27 | } 28 | 29 | private static string GetFilterFromFileExtensionList(ExtensionFilter[] extensions) { 30 | if (extensions == null) { 31 | return ""; 32 | } 33 | 34 | var filterString = ""; 35 | foreach (var filter in extensions) { 36 | filterString += filter.Name + ";"; 37 | 38 | foreach (var ext in filter.Extensions) { 39 | filterString += ext + ","; 40 | } 41 | 42 | filterString = filterString.Remove(filterString.Length - 1); 43 | filterString += "|"; 44 | } 45 | filterString = filterString.Remove(filterString.Length - 1); 46 | return filterString; 47 | } 48 | } 49 | } 50 | 51 | #endif -------------------------------------------------------------------------------- /Assets/StandaloneFileBrowser/StandaloneFileBrowserMac.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bcb49ddb0ed5644fda9c3b055cafa27a 3 | timeCreated: 1483902788 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/StandaloneFileBrowser/StandaloneFileBrowserWindows.cs: -------------------------------------------------------------------------------- 1 | #if UNITY_STANDALONE_WIN 2 | 3 | using System; 4 | using System.Runtime.InteropServices; 5 | 6 | namespace SFB 7 | { 8 | 9 | 10 | public class StandaloneFileBrowserWindows : IStandaloneFileBrowser 11 | { 12 | [DllImport("user32.dll")] 13 | private static extern IntPtr GetActiveWindow(); 14 | 15 | public string[] OpenFilePanel(string title, string directory, ExtensionFilter[] extensions, bool multiselect) 16 | { 17 | return null; 18 | } 19 | 20 | public string[] OpenFolderPanel(string title, string directory, bool multiselect) 21 | { 22 | return null; 23 | } 24 | 25 | public string SaveFilePanel(string title, string directory, string defaultName, ExtensionFilter[] extensions) 26 | { 27 | return null; 28 | } 29 | 30 | // .NET Framework FileDialog Filter format 31 | // https://msdn.microsoft.com/en-us/library/microsoft.win32.filedialog.filter 32 | private static string GetFilterFromFileExtensionList(ExtensionFilter[] extensions) 33 | { 34 | return null; 35 | } 36 | 37 | private static string GetDirectoryPath(string directory) 38 | { 39 | return null; 40 | } 41 | } 42 | } 43 | 44 | #endif -------------------------------------------------------------------------------- /Assets/StandaloneFileBrowser/StandaloneFileBrowserWindows.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 194e247414a78461d83ae606c1b96917 3 | timeCreated: 1483902788 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/StreamingAssets.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 64715083f38207245a159552a3a72130 3 | folderAsset: yes 4 | timeCreated: 1500626367 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/StreamingAssets/UTJ.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1851881336bf9a44388a0051a301628d 3 | folderAsset: yes 4 | timeCreated: 1457806452 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/StreamingAssets/UTJ/FrameCapturer.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 94a951d32d09b2044b947c7f85b41be9 3 | folderAsset: yes 4 | timeCreated: 1457806476 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/StreamingAssets/UTJ/FrameCapturer/License.txt.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 999348212bf87d2498da7e6df0f0d7d0 3 | timeCreated: 1457815014 4 | licenseType: Pro 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/UTJ.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f2e937c06a3aa48459b5a7475e11570c 3 | folderAsset: yes 4 | timeCreated: 1453544223 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturer.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 522bab85d8eab374194107c6d00ba0e5 3 | folderAsset: yes 4 | timeCreated: 1432793486 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturer/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1e8066324c8ba02488f823792218ad75 3 | folderAsset: yes 4 | timeCreated: 1493972568 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturer/Editor/AudioEncoderConfigDrawer.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEditor; 3 | 4 | namespace UTJ.FrameCapturer 5 | { 6 | [CustomPropertyDrawer(typeof(AudioEncoderConfigs))] 7 | class AudioEncoderConfigsDrawer : PropertyDrawer 8 | { 9 | public override float GetPropertyHeight(SerializedProperty property, GUIContent label) 10 | { 11 | return 0.0f; 12 | } 13 | 14 | public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) 15 | { 16 | var type = property.FindPropertyRelative("format"); 17 | EditorGUILayout.PropertyField(type); 18 | EditorGUI.indentLevel++; 19 | switch ((AudioEncoder.Type)type.intValue) 20 | { 21 | case AudioEncoder.Type.Wave: 22 | EditorGUILayout.PropertyField(property.FindPropertyRelative("waveEncoderSettings"), true); 23 | break; 24 | case AudioEncoder.Type.Ogg: 25 | EditorGUILayout.PropertyField(property.FindPropertyRelative("oggEncoderSettings"), true); 26 | break; 27 | case AudioEncoder.Type.Flac: 28 | EditorGUILayout.PropertyField(property.FindPropertyRelative("flacEncoderSettings"), true); 29 | break; 30 | } 31 | EditorGUI.indentLevel--; 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturer/Editor/AudioEncoderConfigDrawer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d37e99b22a0420240a5efe886afba75c 3 | timeCreated: 1494516670 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturer/Editor/AudioRecorderEditor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEditor; 3 | using UnityEngine; 4 | 5 | namespace UTJ.FrameCapturer 6 | { 7 | [CustomEditor(typeof(AudioRecorder))] 8 | public class AudioRecorderEditor : RecorderBaseEditor 9 | { 10 | public override void OnInspectorGUI() 11 | { 12 | var so = serializedObject; 13 | 14 | CommonConfig(); 15 | EditorGUILayout.Space(); 16 | FramerateControl(); 17 | EditorGUILayout.Space(); 18 | RecordingControl(); 19 | 20 | so.ApplyModifiedProperties(); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturer/Editor/AudioRecorderEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1e85d227bfdde1c4ebb0db593dc10c1c 3 | timeCreated: 1494516962 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturer/Editor/GBufferRecorderEditor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEditor; 3 | using UnityEngine; 4 | 5 | namespace UTJ.FrameCapturer 6 | { 7 | [CustomEditor(typeof(GBufferRecorder))] 8 | public class ImageSequenceRecorderEditor : RecorderBaseEditor 9 | { 10 | public override void OnInspectorGUI() 11 | { 12 | //DrawDefaultInspector(); 13 | 14 | var recorder = target as GBufferRecorder; 15 | var so = serializedObject; 16 | 17 | CommonConfig(); 18 | 19 | EditorGUILayout.Space(); 20 | EditorGUILayout.LabelField("Capture Components"); 21 | EditorGUI.indentLevel++; 22 | { 23 | EditorGUI.BeginChangeCheck(); 24 | var fbc = recorder.fbComponents; 25 | 26 | fbc.frameBuffer = EditorGUILayout.Toggle("Frame Buffer", fbc.frameBuffer); 27 | if(fbc.frameBuffer) 28 | { 29 | EditorGUI.indentLevel++; 30 | fbc.fbColor = EditorGUILayout.Toggle("Color", fbc.fbColor); 31 | fbc.fbAlpha = EditorGUILayout.Toggle("Alpha", fbc.fbAlpha); 32 | EditorGUI.indentLevel--; 33 | } 34 | 35 | fbc.GBuffer = EditorGUILayout.Toggle("GBuffer", fbc.GBuffer); 36 | if (fbc.GBuffer) 37 | { 38 | EditorGUI.indentLevel++; 39 | fbc.gbAlbedo = EditorGUILayout.Toggle("Albedo", fbc.gbAlbedo); 40 | fbc.gbOcclusion = EditorGUILayout.Toggle("Occlusion", fbc.gbOcclusion); 41 | fbc.gbSpecular = EditorGUILayout.Toggle("Specular", fbc.gbSpecular); 42 | fbc.gbSmoothness= EditorGUILayout.Toggle("Smoothness", fbc.gbSmoothness); 43 | fbc.gbNormal = EditorGUILayout.Toggle("Normal", fbc.gbNormal); 44 | fbc.gbEmission = EditorGUILayout.Toggle("Emission", fbc.gbEmission); 45 | fbc.gbDepth = EditorGUILayout.Toggle("Depth", fbc.gbDepth); 46 | fbc.gbVelocity = EditorGUILayout.Toggle("Velocity", fbc.gbVelocity); 47 | EditorGUI.indentLevel--; 48 | } 49 | if (EditorGUI.EndChangeCheck()) 50 | { 51 | recorder.fbComponents = fbc; 52 | EditorUtility.SetDirty(recorder); 53 | } 54 | } 55 | EditorGUI.indentLevel--; 56 | 57 | EditorGUILayout.Space(); 58 | 59 | ResolutionControl(); 60 | FramerateControl(); 61 | 62 | EditorGUILayout.Space(); 63 | 64 | RecordingControl(); 65 | 66 | so.ApplyModifiedProperties(); 67 | } 68 | 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturer/Editor/GBufferRecorderEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1b00edfdbd1f8de4b8a40e518dbde401 3 | timeCreated: 1494007084 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturer/Editor/Misc.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a7cbd21b9490d0e4d9f828a4595c1f00 3 | folderAsset: yes 4 | timeCreated: 1494004663 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturer/Editor/Misc/BoolDrawer.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEditor; 3 | 4 | namespace UTJ.FrameCapturer 5 | { 6 | [CustomPropertyDrawer(typeof(Bool))] 7 | class BoolDrawer : PropertyDrawer 8 | { 9 | public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) 10 | { 11 | EditorGUI.BeginProperty(position, label, property); 12 | position = EditorGUI.PrefixLabel(position, GUIUtility.GetControlID(FocusType.Passive), label); 13 | 14 | var indent = EditorGUI.indentLevel; 15 | EditorGUI.indentLevel = 0; 16 | 17 | var p = property.FindPropertyRelative("v"); 18 | bool value = p.intValue != 0; 19 | 20 | EditorGUI.BeginChangeCheck(); 21 | value = EditorGUI.Toggle(position, value); 22 | if (EditorGUI.EndChangeCheck()) 23 | { 24 | p.intValue = value ? 1 : 0; 25 | } 26 | 27 | EditorGUI.indentLevel = indent; 28 | EditorGUI.EndProperty(); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturer/Editor/Misc/BoolDrawer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a7234308adeab3d419817de7e29c50f1 3 | timeCreated: 1494004664 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturer/Editor/Misc/DataPathDrawer.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEditor; 3 | 4 | namespace UTJ.FrameCapturer 5 | { 6 | [CustomPropertyDrawer(typeof(DataPath))] 7 | class DataPathDrawer : PropertyDrawer 8 | { 9 | public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) 10 | { 11 | bool ro = property.FindPropertyRelative("m_readOnly").boolValue; 12 | if(ro) { EditorGUI.BeginDisabledGroup(true); } 13 | 14 | EditorGUI.BeginProperty(position, label, property); 15 | position = EditorGUI.PrefixLabel(position, GUIUtility.GetControlID(FocusType.Passive), label); 16 | 17 | var indent = EditorGUI.indentLevel; 18 | EditorGUI.indentLevel = 0; 19 | 20 | float buttonWidth = 22; 21 | float rootWidth = 70; 22 | float leafWidth = position.width - rootWidth - 5 - buttonWidth; 23 | var rootRect = new Rect(position.x, position.y, rootWidth, position.height); 24 | var leafRect = new Rect(position.x + rootWidth + 5, position.y, leafWidth, position.height); 25 | var buttonRect = new Rect(position.x + rootWidth + 5 + leafWidth, position.y, buttonWidth, position.height); 26 | 27 | var pRoot = property.FindPropertyRelative("m_root"); 28 | var pLeaf = property.FindPropertyRelative("m_leaf"); 29 | EditorGUI.PropertyField(rootRect, pRoot, GUIContent.none); 30 | EditorGUI.PropertyField(leafRect, pLeaf, GUIContent.none); 31 | if (GUI.Button(buttonRect, "...")) 32 | { 33 | var tmp = new DataPath((DataPath.Root)pRoot.intValue, pLeaf.stringValue); 34 | var path = EditorUtility.OpenFolderPanel("Select Directory", tmp.GetFullPath(), ""); 35 | if (path.Length > 0) 36 | { 37 | var newPath = new DataPath(path); 38 | pRoot.intValue = (int)newPath.root; 39 | pLeaf.stringValue = newPath.leaf; 40 | } 41 | } 42 | 43 | EditorGUI.indentLevel = indent; 44 | EditorGUI.EndProperty(); 45 | 46 | if (ro) { EditorGUI.EndDisabledGroup(); } 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturer/Editor/Misc/DataPathDrawer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a2c8844522598244c853bbfcb74cf8ac 3 | timeCreated: 1494004664 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturer/Editor/MovieEncoderConfigDrawer.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEditor; 3 | 4 | namespace UTJ.FrameCapturer 5 | { 6 | [CustomPropertyDrawer(typeof(MovieEncoderConfigs))] 7 | class MovieEncoderConfigsDrawer : PropertyDrawer 8 | { 9 | public override float GetPropertyHeight(SerializedProperty property, GUIContent label) 10 | { 11 | return 0.0f; 12 | } 13 | 14 | public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) 15 | { 16 | var type = property.FindPropertyRelative("format"); 17 | EditorGUILayout.PropertyField(type); 18 | EditorGUI.indentLevel++; 19 | switch ((MovieEncoder.Type)type.intValue) 20 | { 21 | case MovieEncoder.Type.Png: 22 | EditorGUILayout.PropertyField(property.FindPropertyRelative("pngEncoderSettings"), true); 23 | break; 24 | case MovieEncoder.Type.Exr: 25 | EditorGUILayout.PropertyField(property.FindPropertyRelative("exrEncoderSettings"), true); 26 | break; 27 | case MovieEncoder.Type.Gif: 28 | EditorGUILayout.PropertyField(property.FindPropertyRelative("gifEncoderSettings"), true); 29 | break; 30 | case MovieEncoder.Type.WebM: 31 | EditorGUILayout.PropertyField(property.FindPropertyRelative("webmEncoderSettings"), true); 32 | break; 33 | case MovieEncoder.Type.MP4: 34 | EditorGUILayout.PropertyField(property.FindPropertyRelative("mp4EncoderSettings"), true); 35 | break; 36 | } 37 | EditorGUI.indentLevel--; 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturer/Editor/MovieEncoderConfigDrawer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 95451e4e68362fb4095b5bba3a47096a 3 | timeCreated: 1494313411 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturer/Editor/MovieRecorderEditor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEditor; 3 | using UnityEngine; 4 | 5 | namespace UTJ.FrameCapturer 6 | { 7 | [CustomEditor(typeof(MovieRecorder))] 8 | public class MovieRecorderEditor : RecorderBaseEditor 9 | { 10 | public virtual void VideoConfig() 11 | { 12 | var recorder = target as MovieRecorder; 13 | var so = serializedObject; 14 | 15 | EditorGUILayout.PropertyField(so.FindProperty("m_captureTarget")); 16 | if(recorder.captureTarget == MovieRecorder.CaptureTarget.RenderTexture) 17 | { 18 | EditorGUI.indentLevel++; 19 | EditorGUILayout.PropertyField(so.FindProperty("m_targetRT")); 20 | EditorGUI.indentLevel--; 21 | } 22 | 23 | ResolutionControl(); 24 | EditorGUILayout.PropertyField(so.FindProperty("m_captureEveryNthFrame")); 25 | } 26 | 27 | 28 | public virtual void AudioConfig() 29 | { 30 | } 31 | 32 | public override void OnInspectorGUI() 33 | { 34 | //DrawDefaultInspector(); 35 | 36 | var recorder = target as MovieRecorder; 37 | var so = serializedObject; 38 | 39 | CommonConfig(); 40 | 41 | EditorGUILayout.Space(); 42 | 43 | if (recorder.supportVideo && !recorder.supportAudio) 44 | { 45 | VideoConfig(); 46 | } 47 | else if (!recorder.supportVideo && recorder.supportAudio) 48 | { 49 | AudioConfig(); 50 | } 51 | else if (recorder.supportVideo && recorder.supportAudio) 52 | { 53 | EditorGUILayout.PropertyField(so.FindProperty("m_captureVideo")); 54 | if (recorder.captureVideo) 55 | { 56 | EditorGUI.indentLevel++; 57 | VideoConfig(); 58 | EditorGUI.indentLevel--; 59 | } 60 | EditorGUILayout.Space(); 61 | 62 | EditorGUILayout.PropertyField(so.FindProperty("m_captureAudio")); 63 | if (recorder.captureAudio) 64 | { 65 | EditorGUI.indentLevel++; 66 | AudioConfig(); 67 | EditorGUI.indentLevel--; 68 | } 69 | } 70 | 71 | EditorGUILayout.Space(); 72 | FramerateControl(); 73 | EditorGUILayout.Space(); 74 | RecordingControl(); 75 | 76 | so.ApplyModifiedProperties(); 77 | } 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturer/Editor/MovieRecorderEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 16bccb8f58e67a348b23389b312ec2d6 3 | timeCreated: 1493972568 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturer/Editor/RecorderBaseEditor.cs: -------------------------------------------------------------------------------- 1 | using UnityEditor; 2 | using UnityEngine; 3 | 4 | namespace UTJ.FrameCapturer 5 | { 6 | public class RecorderBaseEditor : Editor 7 | { 8 | public virtual void CommonConfig() 9 | { 10 | var so = serializedObject; 11 | EditorGUILayout.PropertyField(so.FindProperty("m_outputDir"), true); 12 | EditorGUILayout.PropertyField(so.FindProperty("m_encoderConfigs"), true); 13 | } 14 | 15 | public virtual void ResolutionControl() 16 | { 17 | var recorder = target as RecorderBase; 18 | var so = serializedObject; 19 | 20 | EditorGUILayout.PropertyField(so.FindProperty("m_resolution")); 21 | EditorGUI.indentLevel++; 22 | if (recorder.resolutionUnit == RecorderBase.ResolutionUnit.Percent) 23 | { 24 | EditorGUILayout.PropertyField(so.FindProperty("m_resolutionPercent")); 25 | } 26 | else if (recorder.resolutionUnit == RecorderBase.ResolutionUnit.Pixels) 27 | { 28 | EditorGUILayout.PropertyField(so.FindProperty("m_resolutionWidth")); 29 | } 30 | EditorGUI.indentLevel--; 31 | } 32 | 33 | public virtual void FramerateControl() 34 | { 35 | var recorder = target as RecorderBase; 36 | var so = serializedObject; 37 | 38 | EditorGUILayout.PropertyField(so.FindProperty("m_framerateMode")); 39 | if (recorder.framerateMode == MovieRecorder.FrameRateMode.Constant) 40 | { 41 | EditorGUI.indentLevel++; 42 | EditorGUILayout.PropertyField(so.FindProperty("m_targetFramerate")); 43 | EditorGUILayout.PropertyField(so.FindProperty("m_fixDeltaTime")); 44 | if (recorder.fixDeltaTime) 45 | { 46 | EditorGUI.indentLevel++; 47 | EditorGUILayout.PropertyField(so.FindProperty("m_waitDeltaTime")); 48 | EditorGUI.indentLevel--; 49 | } 50 | EditorGUI.indentLevel--; 51 | } 52 | } 53 | 54 | public virtual void RecordingControl() 55 | { 56 | var recorder = target as RecorderBase; 57 | var so = serializedObject; 58 | 59 | // capture control 60 | EditorGUILayout.PropertyField(so.FindProperty("m_captureControl")); 61 | EditorGUI.indentLevel++; 62 | if (recorder.captureControl == RecorderBase.CaptureControl.FrameRange) 63 | { 64 | EditorGUILayout.PropertyField(so.FindProperty("m_startFrame")); 65 | EditorGUILayout.PropertyField(so.FindProperty("m_endFrame")); 66 | } 67 | else if (recorder.captureControl == RecorderBase.CaptureControl.TimeRange) 68 | { 69 | EditorGUILayout.PropertyField(so.FindProperty("m_startTime")); 70 | EditorGUILayout.PropertyField(so.FindProperty("m_endTime")); 71 | } 72 | 73 | if (recorder.captureControl == RecorderBase.CaptureControl.FrameRange || 74 | recorder.captureControl == RecorderBase.CaptureControl.TimeRange) 75 | { 76 | if (!EditorApplication.isPlaying) 77 | { 78 | EditorGUILayout.Space(); 79 | if (GUILayout.Button("Play")) 80 | { 81 | EditorApplication.isPlaying = true; 82 | } 83 | } 84 | else if (recorder.isRecording) 85 | { 86 | if (GUILayout.Button("Abort")) 87 | { 88 | recorder.EndRecording(); 89 | } 90 | } 91 | } 92 | else if (recorder.captureControl == RecorderBase.CaptureControl.Manual) 93 | { 94 | EditorGUILayout.Space(); 95 | if (!recorder.isRecording) 96 | { 97 | if (GUILayout.Button("Start Recording")) 98 | { 99 | if (!EditorApplication.isPlaying) 100 | { 101 | so.FindProperty("m_recordOnStart").boolValue = true; 102 | EditorApplication.isPlaying = true; 103 | } 104 | else 105 | { 106 | recorder.BeginRecording(); 107 | } 108 | } 109 | } 110 | else 111 | { 112 | if (GUILayout.Button("End Recording")) 113 | { 114 | recorder.EndRecording(); 115 | } 116 | } 117 | } 118 | EditorGUI.indentLevel--; 119 | } 120 | } 121 | } 122 | -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturer/Editor/RecorderBaseEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cac941334b980ff489d8d28bfde34140 3 | timeCreated: 1494741859 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturer/Plugins.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 178d677034729554ba412d8026f03471 3 | folderAsset: yes 4 | timeCreated: 1432793503 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturer/Plugins/x86.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b6a99610875e99f4a86c25c0d98826fb 3 | folderAsset: yes 4 | timeCreated: 1433034131 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturer/Plugins/x86/fccore.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chiepomme/TwitterMVGenerator/e4608e3a4aa01d2943441b27ab6071b3f4d3a011/Assets/UTJ/FrameCapturer/Plugins/x86/fccore.dll -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturer/Plugins/x86/fccore.dll.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: af2eb4260adfc8648ace36d39d74522f 3 | timeCreated: 1493911880 4 | licenseType: Pro 5 | PluginImporter: 6 | serializedVersion: 1 7 | iconMap: {} 8 | executionOrder: {} 9 | isPreloaded: 0 10 | isOverridable: 0 11 | platformData: 12 | Any: 13 | enabled: 0 14 | settings: 15 | Exclude Android: 1 16 | Exclude Editor: 0 17 | Exclude LinuxUniversal: 0 18 | Exclude OSXUniversal: 1 19 | Exclude WebGL: 1 20 | Exclude iOS: 1 21 | Editor: 22 | enabled: 1 23 | settings: 24 | CPU: x86 25 | DefaultValueInitialized: true 26 | Linux: 27 | enabled: 1 28 | settings: 29 | CPU: x86 30 | Linux64: 31 | enabled: 0 32 | settings: 33 | CPU: None 34 | LinuxUniversal: 35 | enabled: 1 36 | settings: 37 | CPU: x86 38 | OSXIntel: 39 | enabled: 1 40 | settings: 41 | CPU: AnyCPU 42 | OSXIntel64: 43 | enabled: 0 44 | settings: 45 | CPU: None 46 | OSXUniversal: 47 | enabled: 0 48 | settings: 49 | CPU: x86 50 | Win: 51 | enabled: 1 52 | settings: 53 | CPU: AnyCPU 54 | Win64: 55 | enabled: 0 56 | settings: 57 | CPU: None 58 | data: 59 | enabled: 0 60 | settings: {} 61 | userData: 62 | assetBundleName: 63 | assetBundleVariant: 64 | -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturer/Plugins/x86_64.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bb423a2251dfbf04488bb95a0f1ec0e1 3 | folderAsset: yes 4 | timeCreated: 1432793511 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturer/Plugins/x86_64/fccore.bundle.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 095a7aaa840de2c40b28e8f46c6527bd 3 | folderAsset: yes 4 | timeCreated: 1494431117 5 | licenseType: Pro 6 | PluginImporter: 7 | serializedVersion: 2 8 | iconMap: {} 9 | executionOrder: {} 10 | isPreloaded: 0 11 | isOverridable: 0 12 | platformData: 13 | data: 14 | first: 15 | '': Any 16 | second: 17 | enabled: 0 18 | settings: 19 | Exclude Editor: 0 20 | Exclude Linux: 0 21 | Exclude Linux64: 0 22 | Exclude LinuxUniversal: 0 23 | Exclude OSXIntel: 1 24 | Exclude OSXIntel64: 0 25 | Exclude OSXUniversal: 0 26 | Exclude Win: 0 27 | Exclude Win64: 0 28 | data: 29 | first: 30 | Any: 31 | second: 32 | enabled: 1 33 | settings: {} 34 | data: 35 | first: 36 | Editor: Editor 37 | second: 38 | enabled: 1 39 | settings: 40 | CPU: x86_64 41 | DefaultValueInitialized: true 42 | OS: OSX 43 | data: 44 | first: 45 | Facebook: Win 46 | second: 47 | enabled: 0 48 | settings: 49 | CPU: None 50 | data: 51 | first: 52 | Facebook: Win64 53 | second: 54 | enabled: 1 55 | settings: 56 | CPU: AnyCPU 57 | data: 58 | first: 59 | Standalone: Linux 60 | second: 61 | enabled: 1 62 | settings: 63 | CPU: None 64 | data: 65 | first: 66 | Standalone: Linux64 67 | second: 68 | enabled: 1 69 | settings: 70 | CPU: x86_64 71 | data: 72 | first: 73 | Standalone: LinuxUniversal 74 | second: 75 | enabled: 1 76 | settings: 77 | CPU: AnyCPU 78 | data: 79 | first: 80 | Standalone: OSXIntel 81 | second: 82 | enabled: 0 83 | settings: 84 | CPU: None 85 | data: 86 | first: 87 | Standalone: OSXIntel64 88 | second: 89 | enabled: 1 90 | settings: 91 | CPU: AnyCPU 92 | data: 93 | first: 94 | Standalone: OSXUniversal 95 | second: 96 | enabled: 1 97 | settings: 98 | CPU: x86_64 99 | data: 100 | first: 101 | Standalone: Win 102 | second: 103 | enabled: 1 104 | settings: 105 | CPU: None 106 | data: 107 | first: 108 | Standalone: Win64 109 | second: 110 | enabled: 1 111 | settings: 112 | CPU: AnyCPU 113 | userData: 114 | assetBundleName: 115 | assetBundleVariant: 116 | -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturer/Plugins/x86_64/fccore.bundle/Contents.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 96396973072080b44b74b8b56e8ca90f 3 | folderAsset: yes 4 | timeCreated: 1494431117 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturer/Plugins/x86_64/fccore.bundle/Contents/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | fccore 9 | CFBundleGetInfoString 10 | 11 | CFBundleIconFile 12 | 13 | CFBundleIdentifier 14 | 15 | CFBundleInfoDictionaryVersion 16 | 6.0 17 | CFBundleLongVersionString 18 | 19 | CFBundleName 20 | 21 | CFBundlePackageType 22 | APPL 23 | CFBundleShortVersionString 24 | 25 | CFBundleSignature 26 | ???? 27 | CFBundleVersion 28 | 29 | CSResourcesFileMapped 30 | 31 | NSHumanReadableCopyright 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturer/Plugins/x86_64/fccore.bundle/Contents/Info.plist.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ae3adaf31cbcac144bd5778be1e565ed 3 | timeCreated: 1494431117 4 | licenseType: Pro 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturer/Plugins/x86_64/fccore.bundle/Contents/MacOS.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b5d1e24071d5d1e46ace7e1af1f324bb 3 | folderAsset: yes 4 | timeCreated: 1494431117 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturer/Plugins/x86_64/fccore.bundle/Contents/MacOS/fccore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chiepomme/TwitterMVGenerator/e4608e3a4aa01d2943441b27ab6071b3f4d3a011/Assets/UTJ/FrameCapturer/Plugins/x86_64/fccore.bundle/Contents/MacOS/fccore -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturer/Plugins/x86_64/fccore.bundle/Contents/MacOS/fccore.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ebc87403d133ba04da787b7ea5967b1f 3 | timeCreated: 1494431117 4 | licenseType: Pro 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturer/Plugins/x86_64/fccore.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chiepomme/TwitterMVGenerator/e4608e3a4aa01d2943441b27ab6071b3f4d3a011/Assets/UTJ/FrameCapturer/Plugins/x86_64/fccore.dll -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturer/Plugins/x86_64/fccore.dll.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8dfc932324fbf314586b61e5e846c01c 3 | timeCreated: 1494024139 4 | licenseType: Pro 5 | PluginImporter: 6 | serializedVersion: 1 7 | iconMap: {} 8 | executionOrder: {} 9 | isPreloaded: 0 10 | isOverridable: 0 11 | platformData: 12 | Any: 13 | enabled: 0 14 | settings: 15 | Exclude Android: 1 16 | Exclude Editor: 0 17 | Exclude LinuxUniversal: 0 18 | Exclude OSXUniversal: 1 19 | Exclude WebGL: 1 20 | Exclude iOS: 1 21 | Editor: 22 | enabled: 1 23 | settings: 24 | CPU: x86_64 25 | DefaultValueInitialized: true 26 | Linux: 27 | enabled: 0 28 | settings: 29 | CPU: None 30 | Linux64: 31 | enabled: 1 32 | settings: 33 | CPU: x86_64 34 | LinuxUniversal: 35 | enabled: 1 36 | settings: 37 | CPU: x86_64 38 | OSXIntel: 39 | enabled: 0 40 | settings: 41 | CPU: None 42 | OSXIntel64: 43 | enabled: 1 44 | settings: 45 | CPU: AnyCPU 46 | OSXUniversal: 47 | enabled: 0 48 | settings: 49 | CPU: x86_64 50 | Win: 51 | enabled: 0 52 | settings: 53 | CPU: None 54 | Win64: 55 | enabled: 1 56 | settings: 57 | CPU: AnyCPU 58 | data: 59 | enabled: 0 60 | settings: {} 61 | userData: 62 | assetBundleName: 63 | assetBundleVariant: 64 | -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturer/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2eb1eb6bf0605b8469d2d383642f1fe4 3 | folderAsset: yes 4 | timeCreated: 1432793494 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturer/Scripts/AudioRecorder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using UnityEngine; 4 | using UnityEngine.Rendering; 5 | 6 | 7 | namespace UTJ.FrameCapturer 8 | { 9 | [AddComponentMenu("UTJ/FrameCapturer/Audio Recorder")] 10 | [RequireComponent(typeof(AudioListener))] 11 | [ExecuteInEditMode] 12 | public class AudioRecorder : RecorderBase 13 | { 14 | #region fields 15 | [SerializeField] AudioEncoderConfigs m_encoderConfigs = new AudioEncoderConfigs(); 16 | AudioEncoder m_encoder; 17 | #endregion 18 | 19 | 20 | public override bool BeginRecording() 21 | { 22 | if (m_recording) { return false; } 23 | 24 | m_outputDir.CreateDirectory(); 25 | 26 | // initialize encoder 27 | { 28 | string outPath = m_outputDir.GetFullPath() + "/" + DateTime.Now.ToString("yyyyMMdd_HHmmss"); 29 | 30 | m_encoderConfigs.Setup(); 31 | m_encoder = AudioEncoder.Create(m_encoderConfigs, outPath); 32 | if (m_encoder == null || !m_encoder.IsValid()) 33 | { 34 | EndRecording(); 35 | return false; 36 | } 37 | } 38 | 39 | base.BeginRecording(); 40 | Debug.Log("AudioMRecorder: BeginRecording()"); 41 | return true; 42 | } 43 | 44 | public override void EndRecording() 45 | { 46 | if (m_encoder != null) 47 | { 48 | m_encoder.Release(); 49 | m_encoder = null; 50 | } 51 | 52 | if (m_recording) 53 | { 54 | Debug.Log("AudioMRecorder: EndRecording()"); 55 | } 56 | base.EndRecording(); 57 | 58 | } 59 | 60 | 61 | #region impl 62 | void LateUpdate() 63 | { 64 | ++m_frame; 65 | } 66 | 67 | void OnAudioFilterRead(float[] samples, int channels) 68 | { 69 | if (m_recording && m_encoder != null) 70 | { 71 | m_encoder.AddAudioSamples(samples); 72 | m_recordedSamples += samples.Length; 73 | } 74 | } 75 | #endregion 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturer/Scripts/AudioRecorder.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 264fb370ec254fe4591ad390d173ceb2 3 | timeCreated: 1494460973 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturer/Scripts/Encoder.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fde401d160f133842addfb7db5ae4c97 3 | folderAsset: yes 4 | timeCreated: 1494318897 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturer/Scripts/Encoder/AudioEncoder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using UnityEngine.Rendering; 5 | 6 | 7 | namespace UTJ.FrameCapturer 8 | { 9 | [Serializable] 10 | public class AudioEncoderConfigs 11 | { 12 | public AudioEncoder.Type format = AudioEncoder.Type.Flac; 13 | public fcAPI.fcWaveConfig waveEncoderSettings = fcAPI.fcWaveConfig.default_value; 14 | public fcAPI.fcOggConfig oggEncoderSettings = fcAPI.fcOggConfig.default_value; 15 | public fcAPI.fcFlacConfig flacEncoderSettings = fcAPI.fcFlacConfig.default_value; 16 | 17 | public void Setup() 18 | { 19 | } 20 | } 21 | 22 | public abstract class AudioEncoder : EncoderBase 23 | { 24 | public enum Type 25 | { 26 | Wave, 27 | Ogg, 28 | Flac, 29 | } 30 | static public Type[] GetAvailableEncoderTypes() 31 | { 32 | var ret = new List(); 33 | if (fcAPI.fcWaveIsSupported()) { ret.Add(Type.Wave); } 34 | if (fcAPI.fcOggIsSupported()) { ret.Add(Type.Ogg); } 35 | if (fcAPI.fcFlacIsSupported()) { ret.Add(Type.Flac); } 36 | return ret.ToArray(); 37 | } 38 | 39 | 40 | public abstract Type type { get; } 41 | 42 | // config: config struct (fcGifConfig, fcWebMConfig, etc) 43 | public abstract void Initialize(object config, string outPath); 44 | public abstract void AddAudioSamples(float[] samples); 45 | 46 | 47 | public static AudioEncoder Create(Type t) 48 | { 49 | switch (t) 50 | { 51 | case Type.Wave: return new WaveEncoder(); 52 | case Type.Ogg: return new OggEncoder(); 53 | case Type.Flac: return new FlacEncoder(); 54 | } 55 | return null; 56 | } 57 | 58 | public static AudioEncoder Create(AudioEncoderConfigs c, string path) 59 | { 60 | var ret = Create(c.format); 61 | switch (c.format) 62 | { 63 | case Type.Wave: ret.Initialize(c.waveEncoderSettings, path); break; 64 | case Type.Ogg: ret.Initialize(c.oggEncoderSettings, path); break; 65 | case Type.Flac: ret.Initialize(c.flacEncoderSettings, path); break; 66 | } 67 | return ret; 68 | } 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturer/Scripts/Encoder/AudioEncoder.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a237ca86d54fa1f4088547fad559cd49 3 | timeCreated: 1494460406 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturer/Scripts/Encoder/EncoderBase.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | using UnityEngine.Rendering; 4 | 5 | 6 | namespace UTJ.FrameCapturer 7 | { 8 | public abstract class EncoderBase 9 | { 10 | public EncoderBase() 11 | { 12 | AppDomain.CurrentDomain.DomainUnload += WaitAsyncDelete; 13 | } 14 | public static void WaitAsyncDelete(object sender, EventArgs e) 15 | { 16 | fcAPI.fcWaitAsyncDelete(); 17 | } 18 | 19 | public abstract void Release(); 20 | public abstract bool IsValid(); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturer/Scripts/Encoder/EncoderBase.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5078fb266c916184bb5cd9e635b82f9d 3 | timeCreated: 1494630775 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturer/Scripts/Encoder/ExrEncoder.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using UnityEngine; 3 | using UnityEngine.Rendering; 4 | 5 | 6 | namespace UTJ.FrameCapturer 7 | { 8 | public class ExrEncoder : MovieEncoder 9 | { 10 | static readonly string[] s_channelNames = { "R", "G", "B", "A" }; 11 | fcAPI.fcExrContext m_ctx; 12 | fcAPI.fcExrConfig m_config; 13 | string m_outPath; 14 | int m_frame; 15 | 16 | public override void Release() { m_ctx.Release(); } 17 | public override bool IsValid() { return m_ctx; } 18 | public override Type type { get { return Type.Exr; } } 19 | 20 | public override void Initialize(object config, string outPath) 21 | { 22 | if (!fcAPI.fcExrIsSupported()) 23 | { 24 | Debug.LogError("Exr encoder is not available on this platform."); 25 | return; 26 | } 27 | 28 | m_config = (fcAPI.fcExrConfig)config; 29 | m_ctx = fcAPI.fcExrCreateContext(ref m_config); 30 | m_outPath = outPath; 31 | m_frame = 0; 32 | } 33 | 34 | public override void AddVideoFrame(byte[] frame, fcAPI.fcPixelFormat format, double timestamp = -1.0) 35 | { 36 | if (m_ctx) 37 | { 38 | string path = m_outPath + "_" + m_frame.ToString("0000") + ".exr"; 39 | int channels = System.Math.Min(m_config.channels, (int)format & 7); 40 | 41 | fcAPI.fcExrBeginImage(m_ctx, path, m_config.width, m_config.height); 42 | for (int i = 0; i < channels; ++i) 43 | { 44 | fcAPI.fcExrAddLayerPixels(m_ctx, frame, format, i, s_channelNames[i]); 45 | } 46 | fcAPI.fcExrEndImage(m_ctx); 47 | } 48 | ++m_frame; 49 | } 50 | 51 | public override void AddAudioSamples(float[] samples) 52 | { 53 | // not supported 54 | } 55 | 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturer/Scripts/Encoder/ExrEncoder.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2edf1ed5e1f1c8544b925c302853bbb8 3 | timeCreated: 1494000131 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturer/Scripts/Encoder/FlacEncoder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | 5 | namespace UTJ.FrameCapturer 6 | { 7 | public class FlacEncoder : AudioEncoder 8 | { 9 | fcAPI.fcFlacContext m_ctx; 10 | fcAPI.fcFlacConfig m_config; 11 | 12 | public override void Release() { m_ctx.Release(); } 13 | public override bool IsValid() { return m_ctx; } 14 | public override Type type { get { return Type.Flac; } } 15 | 16 | public override void Initialize(object config, string outPath) 17 | { 18 | if (!fcAPI.fcFlacIsSupported()) 19 | { 20 | Debug.LogError("Flac encoder is not available on this platform."); 21 | return; 22 | } 23 | 24 | m_config = (fcAPI.fcFlacConfig)config; 25 | m_config.sampleRate = AudioSettings.outputSampleRate; 26 | m_config.numChannels = fcAPI.fcGetNumAudioChannels(); 27 | m_ctx = fcAPI.fcFlacCreateContext(ref m_config); 28 | 29 | var path = outPath + ".flac"; 30 | var stream = fcAPI.fcCreateFileStream(path); 31 | fcAPI.fcFlacAddOutputStream(m_ctx, stream); 32 | stream.Release(); 33 | } 34 | 35 | public override void AddAudioSamples(float[] samples) 36 | { 37 | if (m_ctx) 38 | { 39 | fcAPI.fcFlacAddAudioSamples(m_ctx, samples, samples.Length); 40 | } 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturer/Scripts/Encoder/FlacEncoder.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: de9a4cfb1e5acbf44a178668df9a378d 3 | timeCreated: 1494460081 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturer/Scripts/Encoder/GifEncoder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | 5 | namespace UTJ.FrameCapturer 6 | { 7 | public class GifEncoder : MovieEncoder 8 | { 9 | fcAPI.fcGifContext m_ctx; 10 | fcAPI.fcGifConfig m_config; 11 | 12 | public override void Release() { m_ctx.Release(); } 13 | public override bool IsValid() { return m_ctx; } 14 | public override Type type { get { return Type.Gif; } } 15 | 16 | public override void Initialize(object config, string outPath) 17 | { 18 | if (!fcAPI.fcGifIsSupported()) 19 | { 20 | Debug.LogError("Gif encoder is not available on this platform."); 21 | return; 22 | } 23 | 24 | m_config = (fcAPI.fcGifConfig)config; 25 | m_config.numColors = Mathf.Clamp(m_config.numColors, 1, 256); 26 | m_ctx = fcAPI.fcGifCreateContext(ref m_config); 27 | 28 | var path = outPath + ".gif"; 29 | var stream = fcAPI.fcCreateFileStream(path); 30 | fcAPI.fcGifAddOutputStream(m_ctx, stream); 31 | stream.Release(); 32 | } 33 | 34 | public override void AddVideoFrame(byte[] frame, fcAPI.fcPixelFormat format, double timestamp) 35 | { 36 | if (m_ctx) 37 | { 38 | fcAPI.fcGifAddFramePixels(m_ctx, frame, format, timestamp); 39 | } 40 | } 41 | 42 | public override void AddAudioSamples(float[] samples) 43 | { 44 | // not supported 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturer/Scripts/Encoder/GifEncoder.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e328bea6ad6257848a01305be866b33b 3 | timeCreated: 1493996447 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturer/Scripts/Encoder/MP4Encoder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | 5 | namespace UTJ.FrameCapturer 6 | { 7 | public class MP4Encoder : MovieEncoder 8 | { 9 | fcAPI.fcMP4Context m_ctx; 10 | fcAPI.fcMP4Config m_config; 11 | 12 | public override void Release() { m_ctx.Release(); } 13 | public override bool IsValid() { return m_ctx; } 14 | public override Type type { get { return Type.MP4; } } 15 | 16 | public override void Initialize(object config, string outPath) 17 | { 18 | if (!fcAPI.fcMP4OSIsSupported()) 19 | { 20 | Debug.LogError("MP4 encoder is not available on this platform."); 21 | return; 22 | } 23 | 24 | m_config = (fcAPI.fcMP4Config)config; 25 | m_config.audioSampleRate = AudioSettings.outputSampleRate; 26 | m_config.audioNumChannels = fcAPI.fcGetNumAudioChannels(); 27 | 28 | var path = outPath + ".mp4"; 29 | m_ctx = fcAPI.fcMP4OSCreateContext(ref m_config, path); 30 | } 31 | 32 | public override void AddVideoFrame(byte[] frame, fcAPI.fcPixelFormat format, double timestamp) 33 | { 34 | if (m_ctx && m_config.video) 35 | { 36 | fcAPI.fcMP4AddVideoFramePixels(m_ctx, frame, format, timestamp); 37 | } 38 | } 39 | 40 | public override void AddAudioSamples(float[] samples) 41 | { 42 | if (m_ctx && m_config.audio) 43 | { 44 | fcAPI.fcMP4AddAudioSamples(m_ctx, samples, samples.Length); 45 | } 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturer/Scripts/Encoder/MP4Encoder.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 15136ad38d3c16f4d91a6c802884de03 3 | timeCreated: 1493996447 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturer/Scripts/Encoder/MovieEncoder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using UnityEngine.Rendering; 5 | 6 | 7 | namespace UTJ.FrameCapturer 8 | { 9 | [Serializable] 10 | public class MovieEncoderConfigs 11 | { 12 | public MovieEncoder.Type format = MovieEncoder.Type.WebM; 13 | public fcAPI.fcPngConfig pngEncoderSettings = fcAPI.fcPngConfig.default_value; 14 | public fcAPI.fcExrConfig exrEncoderSettings = fcAPI.fcExrConfig.default_value; 15 | public fcAPI.fcGifConfig gifEncoderSettings = fcAPI.fcGifConfig.default_value; 16 | public fcAPI.fcWebMConfig webmEncoderSettings = fcAPI.fcWebMConfig.default_value; 17 | public fcAPI.fcMP4Config mp4EncoderSettings = fcAPI.fcMP4Config.default_value; 18 | 19 | public MovieEncoderConfigs(MovieEncoder.Type t) 20 | { 21 | format = t; 22 | } 23 | 24 | public bool supportVideo 25 | { 26 | get { 27 | return 28 | format == MovieEncoder.Type.Png || 29 | format == MovieEncoder.Type.Exr || 30 | format == MovieEncoder.Type.Gif || 31 | format == MovieEncoder.Type.WebM || 32 | format == MovieEncoder.Type.MP4; 33 | } 34 | } 35 | 36 | public bool supportAudio 37 | { 38 | get 39 | { 40 | return 41 | format == MovieEncoder.Type.WebM || 42 | format == MovieEncoder.Type.MP4; 43 | } 44 | } 45 | 46 | public bool captureVideo 47 | { 48 | get 49 | { 50 | switch (format) 51 | { 52 | case MovieEncoder.Type.Png: return true; 53 | case MovieEncoder.Type.Exr: return true; 54 | case MovieEncoder.Type.Gif: return true; 55 | case MovieEncoder.Type.WebM: return webmEncoderSettings.video; 56 | case MovieEncoder.Type.MP4: return webmEncoderSettings.video; 57 | } 58 | return false; 59 | } 60 | set 61 | { 62 | webmEncoderSettings.video = 63 | mp4EncoderSettings.video = value; 64 | } 65 | } 66 | public bool captureAudio 67 | { 68 | get 69 | { 70 | switch (format) 71 | { 72 | case MovieEncoder.Type.Png: return false; 73 | case MovieEncoder.Type.Exr: return false; 74 | case MovieEncoder.Type.Gif: return false; 75 | case MovieEncoder.Type.WebM: return webmEncoderSettings.audio; 76 | case MovieEncoder.Type.MP4: return webmEncoderSettings.audio; 77 | } 78 | return false; 79 | } 80 | set 81 | { 82 | webmEncoderSettings.audio = 83 | mp4EncoderSettings.audio = value; 84 | } 85 | } 86 | 87 | public void Setup(int w, int h, int ch = 4, int targetFrameRate = 60) 88 | { 89 | pngEncoderSettings.width = 90 | exrEncoderSettings.width = 91 | gifEncoderSettings.width = 92 | webmEncoderSettings.videoWidth = 93 | mp4EncoderSettings.videoWidth = w; 94 | 95 | pngEncoderSettings.height = 96 | exrEncoderSettings.height = 97 | gifEncoderSettings.height = 98 | webmEncoderSettings.videoHeight = 99 | mp4EncoderSettings.videoHeight = h; 100 | 101 | pngEncoderSettings.channels = 102 | exrEncoderSettings.channels = ch; 103 | 104 | webmEncoderSettings.videoTargetFramerate = 105 | mp4EncoderSettings.videoTargetFramerate = targetFrameRate; 106 | } 107 | } 108 | 109 | public abstract class MovieEncoder : EncoderBase 110 | { 111 | public enum Type 112 | { 113 | Png, 114 | Exr, 115 | Gif, 116 | WebM, 117 | MP4, 118 | } 119 | static public Type[] GetAvailableEncoderTypes() 120 | { 121 | var ret = new List(); 122 | if (fcAPI.fcPngIsSupported()) { ret.Add(Type.Png); } 123 | if (fcAPI.fcExrIsSupported()) { ret.Add(Type.Exr); } 124 | if (fcAPI.fcGifIsSupported()) { ret.Add(Type.Gif); } 125 | if (fcAPI.fcWebMIsSupported()) { ret.Add(Type.WebM); } 126 | if (fcAPI.fcMP4OSIsSupported()) { ret.Add(Type.MP4); } 127 | return ret.ToArray(); 128 | } 129 | 130 | 131 | public abstract Type type { get; } 132 | 133 | // config: config struct (fcGifConfig, fcWebMConfig, etc) 134 | public abstract void Initialize(object config, string outPath); 135 | public abstract void AddVideoFrame(byte[] frame, fcAPI.fcPixelFormat format, double timestamp = -1.0); 136 | public abstract void AddAudioSamples(float[] samples); 137 | 138 | 139 | public static MovieEncoder Create(Type t) 140 | { 141 | switch (t) 142 | { 143 | case Type.Png: return new PngEncoder(); 144 | case Type.Exr: return new ExrEncoder(); 145 | case Type.Gif: return new GifEncoder(); 146 | case Type.WebM:return new WebMEncoder(); 147 | case Type.MP4: return new MP4Encoder(); 148 | } 149 | return null; 150 | } 151 | 152 | public static MovieEncoder Create(MovieEncoderConfigs c, string path) 153 | { 154 | var ret = Create(c.format); 155 | switch (c.format) 156 | { 157 | case Type.Png: ret.Initialize(c.pngEncoderSettings, path); break; 158 | case Type.Exr: ret.Initialize(c.exrEncoderSettings, path); break; 159 | case Type.Gif: ret.Initialize(c.gifEncoderSettings, path); break; 160 | case Type.WebM:ret.Initialize(c.webmEncoderSettings,path); break; 161 | case Type.MP4: ret.Initialize(c.mp4EncoderSettings, path); break; 162 | } 163 | return ret; 164 | } 165 | } 166 | } 167 | -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturer/Scripts/Encoder/MovieEncoder.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 05a483774a00261429ff072ba4a63bea 3 | timeCreated: 1493995555 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturer/Scripts/Encoder/OggEncoder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | 5 | namespace UTJ.FrameCapturer 6 | { 7 | public class OggEncoder : AudioEncoder 8 | { 9 | fcAPI.fcOggContext m_ctx; 10 | fcAPI.fcOggConfig m_config; 11 | 12 | public override void Release() { m_ctx.Release(); } 13 | public override bool IsValid() { return m_ctx; } 14 | public override Type type { get { return Type.Ogg; } } 15 | 16 | public override void Initialize(object config, string outPath) 17 | { 18 | if (!fcAPI.fcOggIsSupported()) 19 | { 20 | Debug.LogError("Ogg encoder is not available on this platform."); 21 | return; 22 | } 23 | 24 | m_config = (fcAPI.fcOggConfig)config; 25 | m_config.sampleRate = AudioSettings.outputSampleRate; 26 | m_config.numChannels = fcAPI.fcGetNumAudioChannels(); 27 | m_ctx = fcAPI.fcOggCreateContext(ref m_config); 28 | 29 | var path = outPath + ".ogg"; 30 | var stream = fcAPI.fcCreateFileStream(path); 31 | fcAPI.fcOggAddOutputStream(m_ctx, stream); 32 | stream.Release(); 33 | } 34 | 35 | public override void AddAudioSamples(float[] samples) 36 | { 37 | if(m_ctx) 38 | { 39 | fcAPI.fcOggAddAudioSamples(m_ctx, samples, samples.Length); 40 | } 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturer/Scripts/Encoder/OggEncoder.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1d73bca5c7709074dab1e33c534c5015 3 | timeCreated: 1494516452 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturer/Scripts/Encoder/PngEncoder.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | 4 | namespace UTJ.FrameCapturer 5 | { 6 | public class PngEncoder : MovieEncoder 7 | { 8 | fcAPI.fcPngContext m_ctx; 9 | fcAPI.fcPngConfig m_config; 10 | string m_outPath; 11 | int m_frame; 12 | 13 | 14 | public override void Release() { m_ctx.Release(); } 15 | public override bool IsValid() { return m_ctx; } 16 | public override Type type { get { return Type.Png; } } 17 | 18 | public override void Initialize(object config, string outPath) 19 | { 20 | if (!fcAPI.fcPngIsSupported()) 21 | { 22 | Debug.LogError("Png encoder is not available on this platform."); 23 | return; 24 | } 25 | 26 | m_config = (fcAPI.fcPngConfig)config; 27 | m_ctx = fcAPI.fcPngCreateContext(ref m_config); 28 | m_outPath = outPath; 29 | m_frame = 0; 30 | } 31 | 32 | public override void AddVideoFrame(byte[] frame, fcAPI.fcPixelFormat format, double timestamp = -1.0) 33 | { 34 | if (m_ctx) 35 | { 36 | string path = m_outPath + "_" + m_frame.ToString("0000") + ".png"; 37 | int channels = System.Math.Min(m_config.channels, (int)format & 7); 38 | fcAPI.fcPngExportPixels(m_ctx, path, frame, m_config.width, m_config.height, format, channels); 39 | } 40 | ++m_frame; 41 | } 42 | 43 | public override void AddAudioSamples(float[] samples) 44 | { 45 | // not supported 46 | } 47 | 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturer/Scripts/Encoder/PngEncoder.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cb579d3ab681ded4bbcd41bac0530cb4 3 | timeCreated: 1494000131 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturer/Scripts/Encoder/WaveEncoder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | 5 | namespace UTJ.FrameCapturer 6 | { 7 | public class WaveEncoder : AudioEncoder 8 | { 9 | fcAPI.fcWaveContext m_ctx; 10 | fcAPI.fcWaveConfig m_config; 11 | 12 | public override void Release() { m_ctx.Release(); } 13 | public override bool IsValid() { return m_ctx; } 14 | public override Type type { get { return Type.Wave; } } 15 | 16 | public override void Initialize(object config, string outPath) 17 | { 18 | if (!fcAPI.fcWaveIsSupported()) 19 | { 20 | Debug.LogError("Wave encoder is not available on this platform."); 21 | return; 22 | } 23 | 24 | m_config = (fcAPI.fcWaveConfig)config; 25 | m_config.sampleRate = AudioSettings.outputSampleRate; 26 | m_config.numChannels = fcAPI.fcGetNumAudioChannels(); 27 | m_ctx = fcAPI.fcWaveCreateContext(ref m_config); 28 | 29 | var path = outPath + ".wave"; 30 | var stream = fcAPI.fcCreateFileStream(path); 31 | fcAPI.fcWaveAddOutputStream(m_ctx, stream); 32 | stream.Release(); 33 | } 34 | 35 | public override void AddAudioSamples(float[] samples) 36 | { 37 | if(m_ctx) 38 | { 39 | fcAPI.fcWaveAddAudioSamples(m_ctx, samples, samples.Length); 40 | } 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturer/Scripts/Encoder/WaveEncoder.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 294b105c376faa845995d961f1e3a434 3 | timeCreated: 1494460081 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturer/Scripts/Encoder/WebMEncoder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | 5 | namespace UTJ.FrameCapturer 6 | { 7 | public class WebMEncoder : MovieEncoder 8 | { 9 | fcAPI.fcWebMContext m_ctx; 10 | fcAPI.fcWebMConfig m_config; 11 | 12 | public override void Release() { m_ctx.Release(); } 13 | public override bool IsValid() { return m_ctx; } 14 | public override Type type { get { return Type.WebM; } } 15 | 16 | public override void Initialize(object config, string outPath) 17 | { 18 | if (!fcAPI.fcWebMIsSupported()) 19 | { 20 | Debug.LogError("WebM encoder is not available on this platform."); 21 | return; 22 | } 23 | 24 | m_config = (fcAPI.fcWebMConfig)config; 25 | if (m_config.audio && m_config.audioEncoder == fcAPI.fcWebMAudioEncoder.Opus) 26 | { 27 | var sampleRate = AudioSettings.outputSampleRate; 28 | if (sampleRate != 8000 && sampleRate != 12000 && sampleRate != 16000 && sampleRate != 24000 && sampleRate != 48000) 29 | { 30 | Debug.LogError("Current output sample rate is " + sampleRate + ". It must be 8000, 12000, 16000, 24000 or 48000 to use Opus audio encoder. Fallback to Vorbis."); 31 | m_config.audioEncoder = fcAPI.fcWebMAudioEncoder.Vorbis; 32 | } 33 | } 34 | 35 | m_config.audioSampleRate = AudioSettings.outputSampleRate; 36 | m_config.audioNumChannels = fcAPI.fcGetNumAudioChannels(); 37 | m_ctx = fcAPI.fcWebMCreateContext(ref m_config); 38 | 39 | var path = outPath + ".webm"; 40 | var stream = fcAPI.fcCreateFileStream(path); 41 | fcAPI.fcWebMAddOutputStream(m_ctx, stream); 42 | stream.Release(); 43 | } 44 | 45 | public override void AddVideoFrame(byte[] frame, fcAPI.fcPixelFormat format, double timestamp) 46 | { 47 | if (m_ctx && m_config.video) 48 | { 49 | fcAPI.fcWebMAddVideoFramePixels(m_ctx, frame, format, timestamp); 50 | } 51 | } 52 | 53 | public override void AddAudioSamples(float[] samples) 54 | { 55 | if (m_ctx && m_config.audio) 56 | { 57 | fcAPI.fcWebMAddAudioSamples(m_ctx, samples, samples.Length); 58 | } 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturer/Scripts/Encoder/WebMEncoder.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: feb89bd50fd2c9b4589670dc229526c7 3 | timeCreated: 1493996447 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturer/Scripts/Encoder/fcAPI.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d6913dd8876ab8149ac67f69aba208ac 3 | timeCreated: 1432919907 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturer/Scripts/GBufferRecorder.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 300557aa730d7984a8b4b12f91bfa3b2 3 | timeCreated: 1493993867 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturer/Scripts/Misc.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 324c02e09f53928429e39bbbd971fa1c 3 | folderAsset: yes 4 | timeCreated: 1457073395 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturer/Scripts/Misc/Bool.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | namespace UTJ.FrameCapturer 5 | { 6 | // bool is marshal as int (4 byte) by default and you need ugly [MarshalAs(UnmanagedType.U1)] to pass to (or receive from) C++ code. 7 | // this struct emulates bool and marshal as byte (1 byte). this makes things bit easier in some cases. 8 | [Serializable] 9 | public struct Bool 10 | { 11 | [SerializeField] byte v; 12 | public static implicit operator bool(Bool v) { return v.v != 0; } 13 | public static implicit operator Bool(bool v) { Bool r; r.v = v ? (byte)1 : (byte)0; return r; } 14 | 15 | public static Bool True { get { Bool r; r.v = (byte)1; return r; } } 16 | } 17 | } -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturer/Scripts/Misc/Bool.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e74a0ade798956d49a6bbb833422663e 3 | timeCreated: 1457112037 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturer/Scripts/Misc/DataPath.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | 5 | namespace UTJ.FrameCapturer 6 | { 7 | [Serializable] 8 | public class DataPath 9 | { 10 | public enum Root 11 | { 12 | Absolute, 13 | Current, 14 | PersistentData, 15 | StreamingAssets, 16 | TemporaryCache, 17 | DataPath, 18 | } 19 | 20 | [SerializeField] Root m_root = Root.Current; 21 | [SerializeField] string m_leaf = string.Empty; 22 | #if UNITY_EDITOR 23 | [SerializeField] bool m_readOnly = false; // just for inspector 24 | #endif 25 | 26 | public Root root 27 | { 28 | get { return m_root; } 29 | set { m_root = value; } 30 | } 31 | public string leaf 32 | { 33 | get { return m_leaf; } 34 | set { m_leaf = value; } 35 | } 36 | public bool readOnly 37 | { 38 | #if UNITY_EDITOR 39 | get { return m_readOnly; } 40 | set { m_readOnly = value; } 41 | #else 42 | get { return false; } 43 | set { } 44 | #endif 45 | } 46 | 47 | public DataPath() { } 48 | public DataPath(Root root, string leaf) 49 | { 50 | m_root = root; 51 | m_leaf = leaf; 52 | } 53 | 54 | public DataPath(string path) 55 | { 56 | m_root = Root.Absolute; 57 | m_leaf = path; 58 | } 59 | 60 | public string GetFullPath() 61 | { 62 | if (m_root == Root.Absolute) 63 | { 64 | return m_leaf; 65 | } 66 | if (m_root == Root.Current) 67 | { 68 | return m_leaf.Length == 0 ? "." : "./" + m_leaf; 69 | } 70 | 71 | string ret = ""; 72 | switch (m_root) 73 | { 74 | case Root.PersistentData: 75 | ret = Application.persistentDataPath; 76 | break; 77 | case Root.StreamingAssets: 78 | ret = Application.streamingAssetsPath; 79 | break; 80 | case Root.TemporaryCache: 81 | ret = Application.temporaryCachePath; 82 | break; 83 | case Root.DataPath: 84 | ret = Application.dataPath; 85 | break; 86 | } 87 | 88 | if (!m_leaf.StartsWith("/")) 89 | { 90 | ret += "/"; 91 | } 92 | ret += m_leaf; 93 | return ret; 94 | } 95 | 96 | public void CreateDirectory() 97 | { 98 | try 99 | { 100 | var path = GetFullPath(); 101 | if(path.Length > 0) 102 | { 103 | System.IO.Directory.CreateDirectory(path); 104 | } 105 | } 106 | catch(Exception) 107 | { 108 | } 109 | } 110 | } 111 | } -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturer/Scripts/Misc/DataPath.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0fd1bcdf4e762654da9323b7b37cfecb 3 | timeCreated: 1457112037 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturer/Scripts/MovieRecorder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using UnityEngine; 4 | using UnityEngine.Rendering; 5 | #if UNITY_EDITOR 6 | using UnityEditor; 7 | #endif 8 | 9 | 10 | namespace UTJ.FrameCapturer 11 | { 12 | [AddComponentMenu("UTJ/FrameCapturer/Movie Recorder")] 13 | [RequireComponent(typeof(Camera))] 14 | [ExecuteInEditMode] 15 | public class MovieRecorder : RecorderBase 16 | { 17 | #region inner_types 18 | public enum CaptureTarget 19 | { 20 | FrameBuffer, 21 | RenderTexture, 22 | } 23 | #endregion 24 | 25 | 26 | #region fields 27 | [SerializeField] MovieEncoderConfigs m_encoderConfigs = new MovieEncoderConfigs(MovieEncoder.Type.WebM); 28 | [SerializeField] CaptureTarget m_captureTarget = CaptureTarget.FrameBuffer; 29 | [SerializeField] RenderTexture m_targetRT; 30 | [SerializeField] bool m_captureVideo = true; 31 | [SerializeField] bool m_captureAudio = true; 32 | 33 | [SerializeField] Shader m_shCopy; 34 | Material m_matCopy; 35 | Mesh m_quad; 36 | CommandBuffer m_cb; 37 | RenderTexture m_scratchBuffer; 38 | MovieEncoder m_encoder; 39 | #endregion 40 | 41 | 42 | #region properties 43 | public CaptureTarget captureTarget 44 | { 45 | get { return m_captureTarget; } 46 | set { m_captureTarget = value; } 47 | } 48 | public RenderTexture targetRT 49 | { 50 | get { return m_targetRT; } 51 | set { m_targetRT = value; } 52 | } 53 | public bool captureAudio 54 | { 55 | get { return m_captureAudio; } 56 | set { m_captureAudio = value; } 57 | } 58 | public bool captureVideo 59 | { 60 | get { return m_captureVideo; } 61 | set { m_captureVideo = value; } 62 | } 63 | 64 | public bool supportVideo { get { return m_encoderConfigs.supportVideo; } } 65 | public bool supportAudio { get { return m_encoderConfigs.supportAudio; } } 66 | public RenderTexture scratchBuffer { get { return m_scratchBuffer; } } 67 | #endregion 68 | 69 | 70 | public override bool BeginRecording() 71 | { 72 | if (m_recording) { return false; } 73 | if (m_shCopy == null) 74 | { 75 | Debug.LogError("MovieRecorder: copy shader is missing!"); 76 | return false; 77 | } 78 | if (m_captureTarget == CaptureTarget.RenderTexture && m_targetRT == null) 79 | { 80 | Debug.LogError("MovieRecorder: target RenderTexture is null!"); 81 | return false; 82 | } 83 | 84 | m_outputDir.CreateDirectory(); 85 | if (m_quad == null) m_quad = fcAPI.CreateFullscreenQuad(); 86 | if (m_matCopy == null) m_matCopy = new Material(m_shCopy); 87 | 88 | var cam = GetComponent(); 89 | if (cam.targetTexture != null) 90 | { 91 | m_matCopy.EnableKeyword("OFFSCREEN"); 92 | } 93 | else 94 | { 95 | m_matCopy.DisableKeyword("OFFSCREEN"); 96 | } 97 | 98 | // create scratch buffer 99 | { 100 | int captureWidth = cam.pixelWidth; 101 | int captureHeight = cam.pixelHeight; 102 | GetCaptureResolution(ref captureWidth, ref captureHeight); 103 | if (m_encoderConfigs.format == MovieEncoder.Type.MP4 || 104 | m_encoderConfigs.format == MovieEncoder.Type.WebM) 105 | { 106 | captureWidth = (captureWidth + 1) & ~1; 107 | captureHeight = (captureHeight + 1) & ~1; 108 | } 109 | 110 | m_scratchBuffer = new RenderTexture(captureWidth, captureHeight, 0, RenderTextureFormat.ARGB32); 111 | m_scratchBuffer.wrapMode = TextureWrapMode.Repeat; 112 | m_scratchBuffer.Create(); 113 | } 114 | 115 | // initialize encoder 116 | { 117 | int targetFramerate = 60; 118 | if(m_framerateMode == FrameRateMode.Constant) 119 | { 120 | targetFramerate = m_targetFramerate; 121 | } 122 | string outPath = m_outputDir.GetFullPath() + "/" + DateTime.Now.ToString("yyyyMMdd_HHmmss"); 123 | 124 | m_encoderConfigs.captureVideo = m_captureVideo; 125 | m_encoderConfigs.captureAudio = m_captureAudio; 126 | m_encoderConfigs.Setup(m_scratchBuffer.width, m_scratchBuffer.height, 3, targetFramerate); 127 | m_encoder = MovieEncoder.Create(m_encoderConfigs, outPath); 128 | Controller.LastPath = outPath; 129 | if (m_encoder == null || !m_encoder.IsValid()) 130 | { 131 | EndRecording(); 132 | return false; 133 | } 134 | } 135 | 136 | // create command buffer 137 | { 138 | int tid = Shader.PropertyToID("_TmpFrameBuffer"); 139 | m_cb = new CommandBuffer(); 140 | m_cb.name = "MovieRecorder: copy frame buffer"; 141 | 142 | if(m_captureTarget == CaptureTarget.FrameBuffer) 143 | { 144 | m_cb.GetTemporaryRT(tid, -1, -1, 0, FilterMode.Bilinear); 145 | m_cb.Blit(BuiltinRenderTextureType.CurrentActive, tid); 146 | m_cb.SetRenderTarget(m_scratchBuffer); 147 | m_cb.DrawMesh(m_quad, Matrix4x4.identity, m_matCopy, 0, 0); 148 | m_cb.ReleaseTemporaryRT(tid); 149 | } 150 | else if(m_captureTarget == CaptureTarget.RenderTexture) 151 | { 152 | m_cb.SetRenderTarget(m_scratchBuffer); 153 | m_cb.SetGlobalTexture("_TmpRenderTarget", m_targetRT); 154 | m_cb.DrawMesh(m_quad, Matrix4x4.identity, m_matCopy, 0, 1); 155 | } 156 | cam.AddCommandBuffer(CameraEvent.AfterEverything, m_cb); 157 | } 158 | 159 | base.BeginRecording(); 160 | Debug.Log("MovieRecorder: BeginRecording()"); 161 | return true; 162 | } 163 | 164 | public override void EndRecording() 165 | { 166 | if (m_encoder != null) 167 | { 168 | m_encoder.Release(); 169 | m_encoder = null; 170 | } 171 | if (m_cb != null) 172 | { 173 | GetComponent().RemoveCommandBuffer(CameraEvent.AfterEverything, m_cb); 174 | m_cb.Release(); 175 | m_cb = null; 176 | } 177 | if (m_scratchBuffer != null) 178 | { 179 | m_scratchBuffer.Release(); 180 | m_scratchBuffer = null; 181 | } 182 | 183 | if (m_recording) 184 | { 185 | Debug.Log("MovieRecorder: EndRecording()"); 186 | } 187 | base.EndRecording(); 188 | } 189 | 190 | 191 | #region impl 192 | #if UNITY_EDITOR 193 | void Reset() 194 | { 195 | m_shCopy = fcAPI.GetFrameBufferCopyShader(); 196 | } 197 | #endif // UNITY_EDITOR 198 | 199 | IEnumerator OnPostRender() 200 | { 201 | if (m_recording && m_encoder != null && Time.frameCount % m_captureEveryNthFrame == 0) 202 | { 203 | yield return new WaitForEndOfFrame(); 204 | 205 | double timestamp = Time.unscaledTime - m_initialTime; 206 | if (m_framerateMode == FrameRateMode.Constant) 207 | { 208 | timestamp = 1.0 / m_targetFramerate * m_recordedFrames; 209 | } 210 | 211 | fcAPI.fcLock(m_scratchBuffer, TextureFormat.RGB24, (data, fmt) => 212 | { 213 | m_encoder.AddVideoFrame(data, fmt, timestamp); 214 | }); 215 | ++m_recordedFrames; 216 | } 217 | ++m_frame; 218 | } 219 | 220 | void OnAudioFilterRead(float[] samples, int channels) 221 | { 222 | if (m_recording && m_encoder != null) 223 | { 224 | m_encoder.AddAudioSamples(samples); 225 | m_recordedSamples += samples.Length; 226 | } 227 | } 228 | #endregion 229 | } 230 | } 231 | -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturer/Scripts/MovieRecorder.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 199311a1781af854fb1334c3c195468a 3 | timeCreated: 1455634659 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturer/Scripts/RecorderBase.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using UnityEngine; 4 | using UnityEngine.Rendering; 5 | #if UNITY_EDITOR 6 | using UnityEditor; 7 | #endif 8 | 9 | 10 | namespace UTJ.FrameCapturer 11 | { 12 | [ExecuteInEditMode] 13 | public abstract class RecorderBase : MonoBehaviour 14 | { 15 | public enum ResolutionUnit 16 | { 17 | Percent, 18 | Pixels, 19 | } 20 | 21 | public enum FrameRateMode 22 | { 23 | Variable, 24 | Constant, 25 | } 26 | 27 | public enum CaptureControl 28 | { 29 | Manual, 30 | FrameRange, 31 | TimeRange, 32 | } 33 | 34 | 35 | [SerializeField] protected DataPath m_outputDir = new DataPath(DataPath.Root.Current, "Capture"); 36 | 37 | [SerializeField] protected ResolutionUnit m_resolution = ResolutionUnit.Percent; 38 | [SerializeField] [Range(1,100)] protected int m_resolutionPercent = 100; 39 | [SerializeField] protected int m_resolutionWidth = 1920; 40 | 41 | [SerializeField] protected FrameRateMode m_framerateMode = FrameRateMode.Constant; 42 | [SerializeField] protected int m_targetFramerate = 30; 43 | [SerializeField] protected bool m_fixDeltaTime = true; 44 | [SerializeField] protected bool m_waitDeltaTime = true; 45 | [SerializeField] [Range(1,10)]protected int m_captureEveryNthFrame = 1; 46 | 47 | [SerializeField] protected CaptureControl m_captureControl = CaptureControl.FrameRange; 48 | [SerializeField] protected int m_startFrame = 0; 49 | [SerializeField] protected int m_endFrame = 100; 50 | [SerializeField] protected float m_startTime = 0.0f; 51 | [SerializeField] protected float m_endTime = 10.0f; 52 | [SerializeField] bool m_recordOnStart = false; 53 | 54 | protected bool m_recording = false; 55 | protected bool m_aborted = false; 56 | protected int m_initialFrame = 0; 57 | protected float m_initialTime = 0.0f; 58 | protected float m_initialRealTime = 0.0f; 59 | protected int m_frame = 0; 60 | protected int m_recordedFrames = 0; 61 | protected int m_recordedSamples = 0; 62 | 63 | 64 | public DataPath outputDir 65 | { 66 | get { return m_outputDir; } 67 | set { m_outputDir = value; } 68 | } 69 | 70 | public ResolutionUnit resolutionUnit 71 | { 72 | get { return m_resolution; } 73 | set { m_resolution = value; } 74 | } 75 | public int resolutionPercent 76 | { 77 | get { return m_resolutionPercent; } 78 | set { m_resolutionPercent = value; } 79 | } 80 | public int resolutionWidth 81 | { 82 | get { return m_resolutionWidth; } 83 | set { m_resolutionWidth = value; } 84 | } 85 | 86 | public FrameRateMode framerateMode 87 | { 88 | get { return m_framerateMode; } 89 | set { m_framerateMode = value; } 90 | } 91 | public int targetFramerate 92 | { 93 | get { return m_targetFramerate; } 94 | set { m_targetFramerate = value; } 95 | } 96 | public bool fixDeltaTime 97 | { 98 | get { return m_fixDeltaTime; } 99 | set { m_fixDeltaTime = value; } 100 | } 101 | public bool waitDeltaTime 102 | { 103 | get { return m_waitDeltaTime; } 104 | set { m_waitDeltaTime = value; } 105 | } 106 | public int captureEveryNthFrame 107 | { 108 | get { return m_captureEveryNthFrame; } 109 | set { m_captureEveryNthFrame = value; } 110 | } 111 | 112 | public CaptureControl captureControl 113 | { 114 | get { return m_captureControl; } 115 | set { m_captureControl = value; } 116 | } 117 | public int startFrame 118 | { 119 | get { return m_startFrame; } 120 | set { m_startFrame = value; } 121 | } 122 | public int endFrame 123 | { 124 | get { return m_endFrame; } 125 | set { m_endFrame = value; } 126 | } 127 | public float startTime 128 | { 129 | get { return m_startTime; } 130 | set { m_startTime = value; } 131 | } 132 | public float endTime 133 | { 134 | get { return m_endTime; } 135 | set { m_endTime = value; } 136 | } 137 | public bool isRecording 138 | { 139 | get { return m_recording; } 140 | set { 141 | if (value) { BeginRecording(); } 142 | else { EndRecording(); } 143 | } 144 | } 145 | public bool recordOnStart { set { m_recordOnStart = value; } } 146 | 147 | 148 | 149 | public virtual bool BeginRecording() 150 | { 151 | if(m_recording) { return false; } 152 | 153 | // delta time control 154 | if (m_framerateMode == FrameRateMode.Constant && m_fixDeltaTime) 155 | { 156 | Time.maximumDeltaTime = (1.0f / m_targetFramerate); 157 | if (!m_waitDeltaTime) 158 | { 159 | Time.captureFramerate = m_targetFramerate; 160 | } 161 | } 162 | 163 | m_initialFrame = Time.renderedFrameCount; 164 | m_initialTime = Time.unscaledTime; 165 | m_initialRealTime = Time.realtimeSinceStartup; 166 | m_recordedFrames = 0; 167 | m_recordedSamples = 0; 168 | m_recording = true; 169 | return true; 170 | } 171 | 172 | public virtual void EndRecording() 173 | { 174 | if (!m_recording) { return; } 175 | 176 | if (m_framerateMode == FrameRateMode.Constant && m_fixDeltaTime) 177 | { 178 | if (!m_waitDeltaTime) 179 | { 180 | Time.captureFramerate = 0; 181 | } 182 | } 183 | 184 | m_recording = false; 185 | m_aborted = true; 186 | } 187 | 188 | 189 | protected void GetCaptureResolution(ref int w, ref int h) 190 | { 191 | if(m_resolution == ResolutionUnit.Percent) 192 | { 193 | float scale = m_resolutionPercent * 0.01f; 194 | w = (int)(w * scale); 195 | h = (int)(h * scale); 196 | } 197 | else 198 | { 199 | float aspect = (float)h / w; 200 | w = m_resolutionWidth; 201 | h = (int)(m_resolutionWidth * aspect); 202 | } 203 | } 204 | 205 | protected IEnumerator Wait() 206 | { 207 | yield return new WaitForEndOfFrame(); 208 | 209 | float wt = (1.0f / m_targetFramerate) * (Time.renderedFrameCount - m_initialFrame); 210 | while (Time.realtimeSinceStartup - m_initialRealTime < wt) 211 | { 212 | System.Threading.Thread.Sleep(1); 213 | } 214 | } 215 | 216 | #if UNITY_EDITOR 217 | protected virtual void OnValidate() 218 | { 219 | m_targetFramerate = Mathf.Max(1, m_targetFramerate); 220 | m_startFrame = Mathf.Max(0, m_startFrame); 221 | m_endFrame = Mathf.Max(m_startFrame, m_endFrame); 222 | m_startTime = Mathf.Max(0.0f, m_startTime); 223 | m_endTime = Mathf.Max(m_startTime, m_endTime); 224 | } 225 | #endif // UNITY_EDITOR 226 | 227 | protected virtual void Start() 228 | { 229 | m_initialFrame = Time.renderedFrameCount; 230 | m_initialTime = Time.unscaledTime; 231 | m_initialRealTime = Time.realtimeSinceStartup; 232 | 233 | #if UNITY_EDITOR 234 | if (EditorApplication.isPlaying) 235 | #endif 236 | { 237 | if (m_recordOnStart) 238 | { 239 | BeginRecording(); 240 | } 241 | } 242 | m_recordOnStart = false; 243 | } 244 | 245 | protected virtual void OnDisable() 246 | { 247 | #if UNITY_EDITOR 248 | if (EditorApplication.isPlaying) 249 | #endif 250 | { 251 | EndRecording(); 252 | } 253 | } 254 | 255 | protected virtual void Update() 256 | { 257 | #if UNITY_EDITOR 258 | if (EditorApplication.isPlaying) 259 | #endif 260 | { 261 | if (m_captureControl == CaptureControl.FrameRange) 262 | { 263 | if (!m_aborted && m_frame >= m_startFrame && m_frame <= m_endFrame) 264 | { 265 | if (!m_recording) { BeginRecording(); } 266 | } 267 | else if (m_recording) 268 | { 269 | EndRecording(); 270 | } 271 | } 272 | else if (m_captureControl == CaptureControl.TimeRange) 273 | { 274 | float time = Time.unscaledTime - m_initialTime; 275 | if (!m_aborted && time >= m_startTime && time <= m_endTime) 276 | { 277 | if (!m_recording) { BeginRecording(); } 278 | } 279 | else if (m_recording) 280 | { 281 | EndRecording(); 282 | } 283 | } 284 | else if (m_captureControl == CaptureControl.Manual) 285 | { 286 | } 287 | 288 | if(m_framerateMode == FrameRateMode.Constant && m_fixDeltaTime && m_waitDeltaTime) 289 | { 290 | StartCoroutine(Wait()); 291 | } 292 | } 293 | } 294 | 295 | } 296 | } 297 | -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturer/Scripts/RecorderBase.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 29ac315c95aad34439a7dc4a107c3c35 3 | timeCreated: 1494734319 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturer/Shaders.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e43556cd2e1f10e48ac6cc20c04e94a3 3 | folderAsset: yes 4 | timeCreated: 1432924708 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturer/Shaders/CopyFrameBuffer.shader: -------------------------------------------------------------------------------- 1 | Shader "Hidden/UTJ/FrameCapturer/CopyFrameBuffer" { 2 | 3 | CGINCLUDE 4 | #include "UnityCG.cginc" 5 | #pragma multi_compile ___ UNITY_HDR_ON 6 | #pragma multi_compile ___ OFFSCREEN 7 | 8 | sampler2D _TmpFrameBuffer; 9 | sampler2D _CameraGBufferTexture0; 10 | sampler2D _CameraGBufferTexture1; 11 | sampler2D _CameraGBufferTexture2; 12 | sampler2D _CameraGBufferTexture3; 13 | sampler2D_float _CameraDepthTexture; 14 | sampler2D_half _CameraMotionVectorsTexture; 15 | sampler2D _TmpRenderTarget; 16 | float4 _ClearColor; 17 | 18 | struct v2f { 19 | float4 pos : POSITION; 20 | float4 spos : TEXCOORD0; 21 | }; 22 | 23 | v2f vert(appdata_img v) 24 | { 25 | v2f o; 26 | o.pos = o.spos = v.vertex; 27 | return o; 28 | } 29 | 30 | 31 | float2 get_texcoord(v2f i) 32 | { 33 | float2 t = i.spos.xy * 0.5 + 0.5; 34 | return t; 35 | } 36 | 37 | float2 get_texcoord_gb(v2f i) 38 | { 39 | float2 t = i.spos.xy * 0.5 + 0.5; 40 | #if !defined(UNITY_UV_STARTS_AT_TOP) 41 | t.y = 1.0 - t.y; 42 | #endif 43 | return t; 44 | } 45 | 46 | 47 | // framebuffer 48 | struct framebuffer_out 49 | { 50 | half4 color : SV_Target0; 51 | half4 alpha : SV_Target1; 52 | }; 53 | framebuffer_out copy_framebuffer(v2f I) 54 | { 55 | float2 t = get_texcoord(I); 56 | #if !defined(OFFSCREEN) || !defined(UNITY_UV_STARTS_AT_TOP) 57 | t.y = 1.0 - t.y; 58 | #endif 59 | half4 c = tex2D(_TmpFrameBuffer, t); 60 | 61 | framebuffer_out O; 62 | O.color = half4(c.rgb, 1.0); 63 | O.alpha = half4(c.aaa, 1.0); 64 | return O; 65 | } 66 | 67 | // render target (for offscreen-recorder) 68 | half4 copy_rendertarget(v2f I) : SV_Target 69 | { 70 | half4 O = tex2D(_TmpRenderTarget, get_texcoord_gb(I)); 71 | return O; 72 | } 73 | 74 | 75 | // gbuffer 76 | struct gbuffer_out 77 | { 78 | half4 albedo : SV_Target0; 79 | half4 occlusion : SV_Target1; 80 | half4 specular : SV_Target2; 81 | half4 smoothness : SV_Target3; 82 | half4 normal : SV_Target4; 83 | half4 emission : SV_Target5; 84 | half4 depth : SV_Target6; 85 | }; 86 | gbuffer_out copy_gbuffer(v2f I) 87 | { 88 | float2 t = get_texcoord_gb(I); 89 | half4 ao = tex2D(_CameraGBufferTexture0, t); 90 | half4 ss = tex2D(_CameraGBufferTexture1, t); 91 | half4 normal = tex2D(_CameraGBufferTexture2, t); 92 | half4 emission = tex2D(_CameraGBufferTexture3, t); 93 | half depth = tex2D(_CameraDepthTexture, get_texcoord_gb(I)); 94 | #if defined(UNITY_REVERSED_Z) 95 | depth = 1.0 - depth; 96 | #endif 97 | 98 | gbuffer_out O; 99 | O.albedo = half4(ao.rgb, 1.0); 100 | O.occlusion = half4(ao.aaa, 1.0); 101 | O.specular = half4(ss.rgb, 1.0); 102 | O.smoothness = half4(ss.aaa, 1.0); 103 | O.normal = half4(normal.rgb, 1.0); 104 | O.emission = emission; 105 | #ifndef UNITY_HDR_ON 106 | O.emission.rgb = -log2(O.emission.rgb); 107 | #endif 108 | O.depth = half4(depth.rrr, 1.0); 109 | return O; 110 | } 111 | 112 | 113 | // clear 114 | half4 clear(v2f I) : SV_Target 115 | { 116 | return _ClearColor; 117 | } 118 | 119 | // velocity 120 | half4 copy_velocity(v2f I) : SV_Target 121 | { 122 | float2 t = get_texcoord_gb(I); 123 | half2 velocity = tex2D(_CameraMotionVectorsTexture, t).rg; 124 | return half4(velocity, 1.0, 1.0); 125 | } 126 | 127 | ENDCG 128 | 129 | Subshader { 130 | // Pass 0: framebuffer 131 | Pass { 132 | Blend Off Cull Off ZTest Off ZWrite Off 133 | CGPROGRAM 134 | #pragma vertex vert 135 | #pragma fragment copy_framebuffer 136 | ENDCG 137 | } 138 | 139 | // Pass 1: render target 140 | Pass { 141 | Blend Off Cull Off ZTest Off ZWrite Off 142 | CGPROGRAM 143 | #pragma vertex vert 144 | #pragma fragment copy_rendertarget 145 | ENDCG 146 | } 147 | 148 | // Pass 2: gbuffer 149 | Pass{ 150 | Blend Off Cull Off ZTest Off ZWrite Off 151 | CGPROGRAM 152 | #pragma exclude_renderers d3d9 153 | #pragma vertex vert 154 | #pragma fragment copy_gbuffer 155 | ENDCG 156 | } 157 | 158 | // Pass 3: clear 159 | Pass { 160 | Blend Off Cull Off ZTest Off ZWrite Off 161 | CGPROGRAM 162 | #pragma vertex vert 163 | #pragma fragment clear 164 | ENDCG 165 | } 166 | 167 | // Pass 4: velocity 168 | Pass{ 169 | Blend Off Cull Off ZTest Off ZWrite Off 170 | CGPROGRAM 171 | #pragma vertex vert 172 | #pragma fragment copy_velocity 173 | ENDCG 174 | } 175 | } 176 | 177 | Fallback off 178 | } 179 | -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturer/Shaders/CopyFrameBuffer.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2283fb92223c7914c9096670e29202c8 3 | timeCreated: 1432965900 4 | licenseType: Pro 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturerExample.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f9cb17e751bf5b54da0a3eace1893871 3 | folderAsset: yes 4 | timeCreated: 1433128581 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturerExample/Animation.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7dfa2763feea86d459f7431320ad48ee 3 | folderAsset: yes 4 | timeCreated: 1432797266 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturerExample/Animation/Camera.anim: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chiepomme/TwitterMVGenerator/e4608e3a4aa01d2943441b27ab6071b3f4d3a011/Assets/UTJ/FrameCapturerExample/Animation/Camera.anim -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturerExample/Animation/Camera.anim.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 509e2a1c8a971324888c9056689fc789 3 | timeCreated: 1493887012 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | mainObjectFileID: 7400000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturerExample/Animation/CameraRig.controller: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chiepomme/TwitterMVGenerator/e4608e3a4aa01d2943441b27ab6071b3f4d3a011/Assets/UTJ/FrameCapturerExample/Animation/CameraRig.controller -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturerExample/Animation/CameraRig.controller.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fc7f32bc4e68b484fbd5820aab2507b4 3 | timeCreated: 1493887012 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | mainObjectFileID: 9100000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturerExample/Animation/Sphere.anim: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chiepomme/TwitterMVGenerator/e4608e3a4aa01d2943441b27ab6071b3f4d3a011/Assets/UTJ/FrameCapturerExample/Animation/Sphere.anim -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturerExample/Animation/Sphere.anim.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 464cd1a53e42cdf4e8dc0add91d50017 3 | timeCreated: 1494168161 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | mainObjectFileID: 7400000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturerExample/Animation/Sphere.controller: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chiepomme/TwitterMVGenerator/e4608e3a4aa01d2943441b27ab6071b3f4d3a011/Assets/UTJ/FrameCapturerExample/Animation/Sphere.controller -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturerExample/Animation/Sphere.controller.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b40a27a2d217d7840a9e9684186614e7 3 | timeCreated: 1494168161 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | mainObjectFileID: 9100000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturerExample/Materials.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d6dda3a27b1afee42addd9e3d4f21f1b 3 | folderAsset: yes 4 | timeCreated: 1494161269 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturerExample/Materials/Test1.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chiepomme/TwitterMVGenerator/e4608e3a4aa01d2943441b27ab6071b3f4d3a011/Assets/UTJ/FrameCapturerExample/Materials/Test1.mat -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturerExample/Materials/Test1.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7a9eb127c080da64495766f509cba702 3 | timeCreated: 1494163862 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | mainObjectFileID: 2100000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturerExample/Materials/Test2.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chiepomme/TwitterMVGenerator/e4608e3a4aa01d2943441b27ab6071b3f4d3a011/Assets/UTJ/FrameCapturerExample/Materials/Test2.mat -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturerExample/Materials/Test2.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7df773c1edb90744ca90e357edaee87e 3 | timeCreated: 1494161278 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | mainObjectFileID: 2100000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturerExample/Materials/Test3.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chiepomme/TwitterMVGenerator/e4608e3a4aa01d2943441b27ab6071b3f4d3a011/Assets/UTJ/FrameCapturerExample/Materials/Test3.mat -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturerExample/Materials/Test3.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f3229d91ca743404aa3c2b213a1e89ba 3 | timeCreated: 1494164206 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | mainObjectFileID: 2100000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturerExample/Materials/Test4.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chiepomme/TwitterMVGenerator/e4608e3a4aa01d2943441b27ab6071b3f4d3a011/Assets/UTJ/FrameCapturerExample/Materials/Test4.mat -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturerExample/Materials/Test4.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 07e266ac1cc2cba4f8e6456564bc25f3 3 | timeCreated: 1499928190 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | mainObjectFileID: 2100000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturerExample/Prefabs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 031c03053336c85448a6c276b1c3ded2 3 | folderAsset: yes 4 | timeCreated: 1494174781 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturerExample/Prefabs/CameraRig.prefab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chiepomme/TwitterMVGenerator/e4608e3a4aa01d2943441b27ab6071b3f4d3a011/Assets/UTJ/FrameCapturerExample/Prefabs/CameraRig.prefab -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturerExample/Prefabs/CameraRig.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a90437c91e3d4154cb2db98d9296b91f 3 | timeCreated: 1494174821 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | mainObjectFileID: 100100000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturerExample/Prefabs/Root.prefab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chiepomme/TwitterMVGenerator/e4608e3a4aa01d2943441b27ab6071b3f4d3a011/Assets/UTJ/FrameCapturerExample/Prefabs/Root.prefab -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturerExample/Prefabs/Root.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 19415a94a1b344a4bbf88249c1e0e17c 3 | timeCreated: 1494174787 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | mainObjectFileID: 100100000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturerExample/Test.unity: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chiepomme/TwitterMVGenerator/e4608e3a4aa01d2943441b27ab6071b3f4d3a011/Assets/UTJ/FrameCapturerExample/Test.unity -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturerExample/Test.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 24809c0f78c89b64eab4427929f07f52 3 | timeCreated: 1493887130 4 | licenseType: Pro 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturerExample/TestOffscreen.unity: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chiepomme/TwitterMVGenerator/e4608e3a4aa01d2943441b27ab6071b3f4d3a011/Assets/UTJ/FrameCapturerExample/TestOffscreen.unity -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturerExample/TestOffscreen.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fcbe4ff2bef2e5242b4466080d31749d 3 | timeCreated: 1457557306 4 | licenseType: Pro 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturerExample/Textures.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 989c74e63d19ead41ad8bad1871b6366 3 | folderAsset: yes 4 | timeCreated: 1433453590 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturerExample/Textures/RenderTarget.renderTexture: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chiepomme/TwitterMVGenerator/e4608e3a4aa01d2943441b27ab6071b3f4d3a011/Assets/UTJ/FrameCapturerExample/Textures/RenderTarget.renderTexture -------------------------------------------------------------------------------- /Assets/UTJ/FrameCapturerExample/Textures/RenderTarget.renderTexture.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f9cff1cb8a7cff64f93e5143faccd53c 3 | timeCreated: 1457085462 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/UniGif.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4bf10c250d97af24784664085b6c60c5 3 | folderAsset: yes 4 | timeCreated: 1500854025 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/UniGif/.gitignore: -------------------------------------------------------------------------------- 1 | # ---------------[ Unity generated ]------------------ # 2 | [Aa]pps/ 3 | [Ll]ibrary/ 4 | [Tt]emp/ 5 | [Oo]bj/ 6 | [Ss]treamingAssets/ 7 | [Ss]treamingAssets.meta 8 | UnityGenerated/ 9 | 10 | # ----[ Visual Studio / MonoDevelop generated ]------- # 11 | 12 | ExportedObj/ 13 | *.svd 14 | *.userprefs 15 | *.csproj 16 | *.pidb 17 | *.suo 18 | *.sln 19 | *.user 20 | *.unityproj 21 | *.booproj 22 | [Uu]nityVS/ 23 | [Uu]nityVS.meta 24 | 25 | # -------------[ OS generated ]------------------------ # 26 | .DS_Store 27 | .DS_Store? 28 | ._* 29 | .Spotlight-V100 30 | .Trashes 31 | Icon? 32 | ehthumbs.db 33 | Thumbs.db 34 | -------------------------------------------------------------------------------- /Assets/UniGif/Assets.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 13227cddb784adc4aa9462b3472877e1 3 | folderAsset: yes 4 | timeCreated: 1500854025 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/UniGif/Assets/UniGif.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1a6906b6a74529c4a91500e31409ef99 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | -------------------------------------------------------------------------------- /Assets/UniGif/Assets/UniGif/UniGif.cs: -------------------------------------------------------------------------------- 1 | /* 2 | UniGif 3 | Copyright (c) 2015 WestHillApps (Hironari Nishioka) 4 | This software is released under the MIT License. 5 | http://opensource.org/licenses/mit-license.php 6 | */ 7 | 8 | using System; 9 | using System.Collections; 10 | using System.Collections.Generic; 11 | using UnityEngine; 12 | 13 | public static partial class UniGif 14 | { 15 | /// 16 | /// Get GIF texture list Coroutine 17 | /// 18 | /// GIF file byte data 19 | /// Callback method(param is GIF texture list, Animation loop count, GIF image width (px), GIF image height (px)) 20 | /// Textures filter mode 21 | /// Textures wrap mode 22 | /// Debug Log Flag 23 | /// IEnumerator 24 | public static IEnumerator GetTextureListCoroutine( 25 | byte[] bytes, 26 | Action, int, int, int> callback, 27 | FilterMode filterMode = FilterMode.Bilinear, 28 | TextureWrapMode wrapMode = TextureWrapMode.Clamp, 29 | bool debugLog = false) 30 | { 31 | int loopCount = -1; 32 | int width = 0; 33 | int height = 0; 34 | 35 | // Set GIF data 36 | var gifData = new GifData(); 37 | if (SetGifData(bytes, ref gifData, debugLog) == false) 38 | { 39 | Debug.LogError("GIF file data set error."); 40 | if (callback != null) 41 | { 42 | callback(null, loopCount, width, height); 43 | } 44 | yield break; 45 | } 46 | 47 | // Decode to textures from GIF data 48 | List gifTexList = null; 49 | yield return DecodeTextureCoroutine(gifData, result => gifTexList = result, filterMode, wrapMode); 50 | 51 | if (gifTexList == null || gifTexList.Count <= 0) 52 | { 53 | Debug.LogError("GIF texture decode error."); 54 | if (callback != null) 55 | { 56 | callback(null, loopCount, width, height); 57 | } 58 | yield break; 59 | } 60 | 61 | loopCount = gifData.m_appEx.loopCount; 62 | width = gifData.m_logicalScreenWidth; 63 | height = gifData.m_logicalScreenHeight; 64 | 65 | if (callback != null) 66 | { 67 | callback(gifTexList, loopCount, width, height); 68 | } 69 | 70 | yield break; 71 | } 72 | } -------------------------------------------------------------------------------- /Assets/UniGif/Assets/UniGif/UniGif.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: dc888f2174383f449acbb36759059036 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | -------------------------------------------------------------------------------- /Assets/UniGif/Assets/UniGif/UniGifConst.cs: -------------------------------------------------------------------------------- 1 | /* 2 | UniGif 3 | Copyright (c) 2015 WestHillApps (Hironari Nishioka) 4 | This software is released under the MIT License. 5 | http://opensource.org/licenses/mit-license.php 6 | */ 7 | 8 | using System; 9 | using System.Collections.Generic; 10 | using System.Text; 11 | using UnityEngine; 12 | 13 | public static partial class UniGif 14 | { 15 | /// 16 | /// Gif Texture 17 | /// 18 | public class GifTexture 19 | { 20 | // Texture 21 | public Texture2D m_texture2d; 22 | // Delay time until the next texture. 23 | public float m_delaySec; 24 | 25 | public GifTexture(Texture2D texture2d, float delaySec) 26 | { 27 | m_texture2d = texture2d; 28 | m_delaySec = delaySec; 29 | } 30 | } 31 | 32 | /// 33 | /// GIF Data Format 34 | /// 35 | private struct GifData 36 | { 37 | // Signature 38 | public byte m_sig0, m_sig1, m_sig2; 39 | // Version 40 | public byte m_ver0, m_ver1, m_ver2; 41 | // Logical Screen Width 42 | public ushort m_logicalScreenWidth; 43 | // Logical Screen Height 44 | public ushort m_logicalScreenHeight; 45 | // Global Color Table Flag 46 | public bool m_globalColorTableFlag; 47 | // Color Resolution 48 | public int m_colorResolution; 49 | // Sort Flag 50 | public bool m_sortFlag; 51 | // Size of Global Color Table 52 | public int m_sizeOfGlobalColorTable; 53 | // Background Color Index 54 | public byte m_bgColorIndex; 55 | // Pixel Aspect Ratio 56 | public byte m_pixelAspectRatio; 57 | // Global Color Table 58 | public List m_globalColorTable; 59 | // ImageBlock 60 | public List m_imageBlockList; 61 | // GraphicControlExtension 62 | public List m_graphicCtrlExList; 63 | // Comment Extension 64 | public List m_commentExList; 65 | // Plain Text Extension 66 | public List m_plainTextExList; 67 | // Application Extension 68 | public ApplicationExtension m_appEx; 69 | // Trailer 70 | public byte m_trailer; 71 | 72 | public string signature 73 | { 74 | get 75 | { 76 | char[] c = { (char)m_sig0, (char)m_sig1, (char)m_sig2 }; 77 | return new string(c); 78 | } 79 | } 80 | 81 | public string version 82 | { 83 | get 84 | { 85 | char[] c = { (char)m_ver0, (char)m_ver1, (char)m_ver2 }; 86 | return new string(c); 87 | } 88 | } 89 | 90 | public void Dump() 91 | { 92 | Debug.Log("GIF Type: " + signature + "-" + version); 93 | Debug.Log("Image Size: " + m_logicalScreenWidth + "x" + m_logicalScreenHeight); 94 | Debug.Log("Animation Image Count: " + m_imageBlockList.Count); 95 | Debug.Log("Animation Loop Count (0 is infinite): " + m_appEx.loopCount); 96 | if (m_graphicCtrlExList != null && m_graphicCtrlExList.Count > 0) 97 | { 98 | var sb = new StringBuilder("Animation Delay Time (1/100sec)"); 99 | for (int i = 0; i < m_graphicCtrlExList.Count; i++) 100 | { 101 | sb.Append(", "); 102 | sb.Append(m_graphicCtrlExList[i].m_delayTime); 103 | } 104 | Debug.Log(sb.ToString()); 105 | } 106 | Debug.Log("Application Identifier: " + m_appEx.applicationIdentifier); 107 | Debug.Log("Application Authentication Code: " + m_appEx.applicationAuthenticationCode); 108 | } 109 | } 110 | 111 | /// 112 | /// Image Block 113 | /// 114 | private struct ImageBlock 115 | { 116 | // Image Separator 117 | public byte m_imageSeparator; 118 | // Image Left Position 119 | public ushort m_imageLeftPosition; 120 | // Image Top Position 121 | public ushort m_imageTopPosition; 122 | // Image Width 123 | public ushort m_imageWidth; 124 | // Image Height 125 | public ushort m_imageHeight; 126 | // Local Color Table Flag 127 | public bool m_localColorTableFlag; 128 | // Interlace Flag 129 | public bool m_interlaceFlag; 130 | // Sort Flag 131 | public bool m_sortFlag; 132 | // Size of Local Color Table 133 | public int m_sizeOfLocalColorTable; 134 | // Local Color Table 135 | public List m_localColorTable; 136 | // LZW Minimum Code Size 137 | public byte m_lzwMinimumCodeSize; 138 | // Block Size & Image Data List 139 | public List m_imageDataList; 140 | 141 | public struct ImageDataBlock 142 | { 143 | // Block Size 144 | public byte m_blockSize; 145 | // Image Data 146 | public byte[] m_imageData; 147 | } 148 | } 149 | 150 | /// 151 | /// Graphic Control Extension 152 | /// 153 | private struct GraphicControlExtension 154 | { 155 | // Extension Introducer 156 | public byte m_extensionIntroducer; 157 | // Graphic Control Label 158 | public byte m_graphicControlLabel; 159 | // Block Size 160 | public byte m_blockSize; 161 | // Disposal Mothod 162 | public ushort m_disposalMethod; 163 | // Transparent Color Flag 164 | public bool m_transparentColorFlag; 165 | // Delay Time 166 | public ushort m_delayTime; 167 | // Transparent Color Index 168 | public byte m_transparentColorIndex; 169 | // Block Terminator 170 | public byte m_blockTerminator; 171 | } 172 | 173 | /// 174 | /// Comment Extension 175 | /// 176 | private struct CommentExtension 177 | { 178 | // Extension Introducer 179 | public byte m_extensionIntroducer; 180 | // Comment Label 181 | public byte m_commentLabel; 182 | // Block Size & Comment Data List 183 | public List m_commentDataList; 184 | 185 | public struct CommentDataBlock 186 | { 187 | // Block Size 188 | public byte m_blockSize; 189 | // Image Data 190 | public byte[] m_commentData; 191 | } 192 | } 193 | 194 | /// 195 | /// Plain Text Extension 196 | /// 197 | private struct PlainTextExtension 198 | { 199 | // Extension Introducer 200 | public byte m_extensionIntroducer; 201 | // Plain Text Label 202 | public byte m_plainTextLabel; 203 | // Block Size 204 | public byte m_blockSize; 205 | // Block Size & Plain Text Data List 206 | public List m_plainTextDataList; 207 | 208 | public struct PlainTextDataBlock 209 | { 210 | // Block Size 211 | public byte m_blockSize; 212 | // Plain Text Data 213 | public byte[] m_plainTextData; 214 | } 215 | } 216 | 217 | /// 218 | /// Application Extension 219 | /// 220 | private struct ApplicationExtension 221 | { 222 | // Extension Introducer 223 | public byte m_extensionIntroducer; 224 | // Extension Label 225 | public byte m_extensionLabel; 226 | // Block Size 227 | public byte m_blockSize; 228 | // Application Identifier 229 | public byte m_appId1, m_appId2, m_appId3, m_appId4, m_appId5, m_appId6, m_appId7, m_appId8; 230 | // Application Authentication Code 231 | public byte m_appAuthCode1, m_appAuthCode2, m_appAuthCode3; 232 | // Block Size & Application Data List 233 | public List m_appDataList; 234 | 235 | public struct ApplicationDataBlock 236 | { 237 | // Block Size 238 | public byte m_blockSize; 239 | // Application Data 240 | public byte[] m_applicationData; 241 | } 242 | 243 | public string applicationIdentifier 244 | { 245 | get 246 | { 247 | char[] c = { (char)m_appId1, (char)m_appId2, (char)m_appId3, (char)m_appId4, (char)m_appId5, (char)m_appId6, (char)m_appId7, (char)m_appId8 }; 248 | return new string(c); 249 | } 250 | } 251 | 252 | public string applicationAuthenticationCode 253 | { 254 | get 255 | { 256 | char[] c = { (char)m_appAuthCode1, (char)m_appAuthCode2, (char)m_appAuthCode3 }; 257 | return new string(c); 258 | } 259 | } 260 | 261 | public int loopCount 262 | { 263 | get 264 | { 265 | if (m_appDataList == null || m_appDataList.Count < 1 || 266 | m_appDataList[0].m_applicationData.Length < 3 || 267 | m_appDataList[0].m_applicationData[0] != 0x01) 268 | { 269 | return 0; 270 | } 271 | return BitConverter.ToUInt16(m_appDataList[0].m_applicationData, 1); 272 | } 273 | } 274 | } 275 | } 276 | -------------------------------------------------------------------------------- /Assets/UniGif/Assets/UniGif/UniGifConst.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 37f5eaccd43e9b94ebe77bd6edcd1377 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | -------------------------------------------------------------------------------- /Assets/UniGif/Assets/UniGif/UniGifDecoder.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7f251ba69c91af840b8837da30503cbe 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | -------------------------------------------------------------------------------- /Assets/UniGif/Assets/UniGif/UniGifExtension.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | 4 | /// 5 | /// Extension methods class 6 | /// 7 | public static class UniGifExtension 8 | { 9 | /// 10 | /// Convert BitArray to int (Specifies the start index and bit length) 11 | /// 12 | /// Start index 13 | /// Bit length 14 | /// Converted int 15 | public static int GetNumeral(this BitArray array, int startIndex, int bitLength) 16 | { 17 | var newArray = new BitArray(bitLength); 18 | 19 | for (int i = 0; i < bitLength; i++) 20 | { 21 | if (array.Length <= startIndex + i) 22 | { 23 | newArray[i] = false; 24 | } 25 | else 26 | { 27 | bool bit = array.Get(startIndex + i); 28 | newArray[i] = bit; 29 | } 30 | } 31 | 32 | return newArray.ToNumeral(); 33 | } 34 | 35 | /// 36 | /// Convert BitArray to int 37 | /// 38 | /// Converted int 39 | public static int ToNumeral(this BitArray array) 40 | { 41 | if (array == null) 42 | { 43 | Debug.LogError("array is nothing."); 44 | return 0; 45 | } 46 | if (array.Length > 32) 47 | { 48 | Debug.LogError("must be at most 32 bits long."); 49 | return 0; 50 | } 51 | 52 | var result = new int[1]; 53 | array.CopyTo(result, 0); 54 | return result[0]; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /Assets/UniGif/Assets/UniGif/UniGifExtension.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: eeaa59f4867db714ca47c5a842078952 3 | timeCreated: 1489477916 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/UniGif/Assets/UniGif/UniGifFormatter.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b74d64e144c492a40849d69b064810ad 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | -------------------------------------------------------------------------------- /Assets/UniGif/LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 WestHillApps (Hironari Nishioka) 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 13 | all 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 21 | THE SOFTWARE. -------------------------------------------------------------------------------- /Assets/UniGif/LICENSE.txt.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 46ee8dd240fc3e7419b4a7d051ee885a 3 | timeCreated: 1500854030 4 | licenseType: Free 5 | TextScriptImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/UniGif/ProjectSettings.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2d796d5d8f14301469c0e9cfa6774c5a 3 | folderAsset: yes 4 | timeCreated: 1500854025 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/UniGif/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 | m_Volume: 1 7 | Rolloff Scale: 1 8 | Doppler Factor: 1 9 | Default Speaker Mode: 2 10 | m_SampleRate: 0 11 | m_DSPBufferSize: 0 12 | m_VirtualVoiceCount: 512 13 | m_RealVoiceCount: 32 14 | m_SpatializerPlugin: 15 | m_DisableAudio: 0 16 | m_VirtualizeEffects: 1 17 | -------------------------------------------------------------------------------- /Assets/UniGif/ProjectSettings/AudioManager.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 55f48cad145dcfc40a08ab212fcaba3e 3 | timeCreated: 1500854030 4 | licenseType: Free 5 | NativeFormatImporter: 6 | mainObjectFileID: 0 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/UniGif/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 | -------------------------------------------------------------------------------- /Assets/UniGif/ProjectSettings/ClusterInputManager.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 88b33a9bc75a67745994beb8630e4b4a 3 | timeCreated: 1500854030 4 | licenseType: Free 5 | NativeFormatImporter: 6 | mainObjectFileID: 0 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/UniGif/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: 2 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_SolverIterationCount: 6 13 | m_SolverVelocityIterations: 1 14 | m_QueriesHitTriggers: 1 15 | m_EnableAdaptiveForce: 0 16 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 17 | -------------------------------------------------------------------------------- /Assets/UniGif/ProjectSettings/DynamicsManager.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a2cd725607ed7b944baf863e1f8e5a79 3 | timeCreated: 1500854030 4 | licenseType: Free 5 | NativeFormatImporter: 6 | mainObjectFileID: 0 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/UniGif/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 | -------------------------------------------------------------------------------- /Assets/UniGif/ProjectSettings/EditorBuildSettings.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c96fc1271d07ddd4fbb0ca829868c977 3 | timeCreated: 1500854030 4 | licenseType: Free 5 | NativeFormatImporter: 6 | mainObjectFileID: 0 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/UniGif/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: 3 7 | m_ExternalVersionControlSupport: Visible Meta Files 8 | m_SerializationMode: 2 9 | m_WebSecurityEmulationEnabled: 0 10 | m_WebSecurityEmulationHostUrl: http://www.mydomain.com/mygame.unity3d 11 | m_DefaultBehaviorMode: 0 12 | m_SpritePackerMode: 0 13 | m_SpritePackerPaddingPower: 1 14 | m_ProjectGenerationIncludedExtensions: txt;xml;fnt;cd 15 | m_ProjectGenerationRootNamespace: 16 | -------------------------------------------------------------------------------- /Assets/UniGif/ProjectSettings/EditorSettings.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6fed3a06eab5dee43ae0338db6656b09 3 | timeCreated: 1500854030 4 | licenseType: Free 5 | NativeFormatImporter: 6 | mainObjectFileID: 0 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/UniGif/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: 7 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: 10770, guid: 0000000000000000f000000000000000, type: 0} 37 | - {fileID: 10782, guid: 0000000000000000f000000000000000, type: 0} 38 | m_PreloadedShaders: [] 39 | m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000, 40 | type: 0} 41 | m_ShaderSettings_Tier1: 42 | useCascadedShadowMaps: 1 43 | standardShaderQuality: 2 44 | useReflectionProbeBoxProjection: 1 45 | useReflectionProbeBlending: 1 46 | m_ShaderSettings_Tier2: 47 | useCascadedShadowMaps: 1 48 | standardShaderQuality: 2 49 | useReflectionProbeBoxProjection: 1 50 | useReflectionProbeBlending: 1 51 | m_ShaderSettings_Tier3: 52 | useCascadedShadowMaps: 1 53 | standardShaderQuality: 2 54 | useReflectionProbeBoxProjection: 1 55 | useReflectionProbeBlending: 1 56 | m_BuildTargetShaderSettings: [] 57 | m_LightmapStripping: 0 58 | m_FogStripping: 0 59 | m_LightmapKeepPlain: 1 60 | m_LightmapKeepDirCombined: 1 61 | m_LightmapKeepDirSeparate: 1 62 | m_LightmapKeepDynamicPlain: 1 63 | m_LightmapKeepDynamicDirCombined: 1 64 | m_LightmapKeepDynamicDirSeparate: 1 65 | m_FogKeepLinear: 1 66 | m_FogKeepExp: 1 67 | m_FogKeepExp2: 1 68 | -------------------------------------------------------------------------------- /Assets/UniGif/ProjectSettings/GraphicsSettings.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 92d6779fd3d63f143b2a0a762711f18b 3 | timeCreated: 1500854030 4 | licenseType: Free 5 | NativeFormatImporter: 6 | mainObjectFileID: 0 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/UniGif/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 cmd 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 | -------------------------------------------------------------------------------- /Assets/UniGif/ProjectSettings/InputManager.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0846cb38c056b7e4eacbd5b477f101ea 3 | timeCreated: 1500854030 4 | licenseType: Free 5 | NativeFormatImporter: 6 | mainObjectFileID: 0 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/UniGif/ProjectSettings/NavMeshAreas.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!126 &1 4 | NavMeshAreas: 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 | -------------------------------------------------------------------------------- /Assets/UniGif/ProjectSettings/NavMeshAreas.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 49b3a67d171724846af5ce50ccaf3a51 3 | timeCreated: 1500854030 4 | licenseType: Free 5 | NativeFormatImporter: 6 | mainObjectFileID: 0 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/UniGif/ProjectSettings/NavMeshLayers.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chiepomme/TwitterMVGenerator/e4608e3a4aa01d2943441b27ab6071b3f4d3a011/Assets/UniGif/ProjectSettings/NavMeshLayers.asset -------------------------------------------------------------------------------- /Assets/UniGif/ProjectSettings/NavMeshLayers.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4b4b7202030313342a54a3018f96ec2c 3 | timeCreated: 1500854030 4 | licenseType: Free 5 | NativeFormatImporter: 6 | mainObjectFileID: 0 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/UniGif/ProjectSettings/NetworkManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!149 &1 4 | NetworkManager: 5 | m_ObjectHideFlags: 0 6 | m_DebugLevel: 0 7 | m_Sendrate: 15 8 | m_AssetToPrefab: {} 9 | -------------------------------------------------------------------------------- /Assets/UniGif/ProjectSettings/NetworkManager.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4997fc6984caf12409fed8f7bf54a15c 3 | timeCreated: 1500854030 4 | licenseType: Free 5 | NativeFormatImporter: 6 | mainObjectFileID: 0 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/UniGif/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: 2 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_MinPenetrationForPenalty: 0.01 17 | m_BaumgarteScale: 0.2 18 | m_BaumgarteTimeOfImpactScale: 0.75 19 | m_TimeToSleep: 0.5 20 | m_LinearSleepTolerance: 0.01 21 | m_AngularSleepTolerance: 2 22 | m_QueriesHitTriggers: 1 23 | m_QueriesStartInColliders: 1 24 | m_ChangeStopsCallbacks: 0 25 | m_AlwaysShowColliders: 0 26 | m_ShowColliderSleep: 1 27 | m_ShowColliderContacts: 0 28 | m_ContactArrowScale: 0.2 29 | m_ColliderAwakeColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.7529412} 30 | m_ColliderAsleepColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.36078432} 31 | m_ColliderContactColor: {r: 1, g: 0, b: 1, a: 0.6862745} 32 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 33 | -------------------------------------------------------------------------------- /Assets/UniGif/ProjectSettings/Physics2DSettings.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 35ae96b9ea1feab4ead6b9fe51d7e408 3 | timeCreated: 1500854030 4 | licenseType: Free 5 | NativeFormatImporter: 6 | mainObjectFileID: 0 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/UniGif/ProjectSettings/ProjectSettings.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 001596c7d5565fc4db34474c3aebbe4b 3 | timeCreated: 1500854030 4 | licenseType: Free 5 | NativeFormatImporter: 6 | mainObjectFileID: 0 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/UniGif/ProjectSettings/ProjectVersion.txt: -------------------------------------------------------------------------------- 1 | m_EditorVersion: 5.4.0f3 2 | m_StandardAssetsVersion: 0 3 | -------------------------------------------------------------------------------- /Assets/UniGif/ProjectSettings/ProjectVersion.txt.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3f21c2130852b6f4bbcebcf3f4627621 3 | timeCreated: 1500854030 4 | licenseType: Free 5 | TextScriptImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/UniGif/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: 3 8 | m_QualitySettings: 9 | - serializedVersion: 2 10 | name: Fastest 11 | pixelLightCount: 0 12 | shadows: 0 13 | shadowResolution: 0 14 | shadowProjection: 1 15 | shadowCascades: 1 16 | shadowDistance: 15 17 | shadowNearPlaneOffset: 2 18 | shadowCascade2Split: 0.33333334 19 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 20 | blendWeights: 1 21 | textureQuality: 1 22 | anisotropicTextures: 0 23 | antiAliasing: 0 24 | softParticles: 0 25 | softVegetation: 0 26 | realtimeReflectionProbes: 0 27 | billboardsFaceCameraPosition: 0 28 | vSyncCount: 0 29 | lodBias: 0.3 30 | maximumLODLevel: 0 31 | particleRaycastBudget: 4 32 | asyncUploadTimeSlice: 2 33 | asyncUploadBufferSize: 4 34 | excludedTargetPlatforms: [] 35 | - serializedVersion: 2 36 | name: Fast 37 | pixelLightCount: 0 38 | shadows: 0 39 | shadowResolution: 0 40 | shadowProjection: 1 41 | shadowCascades: 1 42 | shadowDistance: 20 43 | shadowNearPlaneOffset: 2 44 | shadowCascade2Split: 0.33333334 45 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 46 | blendWeights: 2 47 | textureQuality: 0 48 | anisotropicTextures: 0 49 | antiAliasing: 0 50 | softParticles: 0 51 | softVegetation: 0 52 | realtimeReflectionProbes: 0 53 | billboardsFaceCameraPosition: 0 54 | vSyncCount: 0 55 | lodBias: 0.4 56 | maximumLODLevel: 0 57 | particleRaycastBudget: 16 58 | asyncUploadTimeSlice: 2 59 | asyncUploadBufferSize: 4 60 | excludedTargetPlatforms: [] 61 | - serializedVersion: 2 62 | name: Simple 63 | pixelLightCount: 1 64 | shadows: 1 65 | shadowResolution: 0 66 | shadowProjection: 1 67 | shadowCascades: 1 68 | shadowDistance: 20 69 | shadowNearPlaneOffset: 2 70 | shadowCascade2Split: 0.33333334 71 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 72 | blendWeights: 2 73 | textureQuality: 0 74 | anisotropicTextures: 1 75 | antiAliasing: 0 76 | softParticles: 0 77 | softVegetation: 0 78 | realtimeReflectionProbes: 0 79 | billboardsFaceCameraPosition: 0 80 | vSyncCount: 0 81 | lodBias: 0.7 82 | maximumLODLevel: 0 83 | particleRaycastBudget: 64 84 | asyncUploadTimeSlice: 2 85 | asyncUploadBufferSize: 4 86 | excludedTargetPlatforms: [] 87 | - serializedVersion: 2 88 | name: Good 89 | pixelLightCount: 2 90 | shadows: 2 91 | shadowResolution: 1 92 | shadowProjection: 1 93 | shadowCascades: 2 94 | shadowDistance: 40 95 | shadowNearPlaneOffset: 2 96 | shadowCascade2Split: 0.33333334 97 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 98 | blendWeights: 2 99 | textureQuality: 0 100 | anisotropicTextures: 1 101 | antiAliasing: 0 102 | softParticles: 0 103 | softVegetation: 1 104 | realtimeReflectionProbes: 1 105 | billboardsFaceCameraPosition: 1 106 | vSyncCount: 1 107 | lodBias: 1 108 | maximumLODLevel: 0 109 | particleRaycastBudget: 256 110 | asyncUploadTimeSlice: 2 111 | asyncUploadBufferSize: 4 112 | excludedTargetPlatforms: [] 113 | - serializedVersion: 2 114 | name: Beautiful 115 | pixelLightCount: 3 116 | shadows: 2 117 | shadowResolution: 2 118 | shadowProjection: 1 119 | shadowCascades: 2 120 | shadowDistance: 70 121 | shadowNearPlaneOffset: 2 122 | shadowCascade2Split: 0.33333334 123 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 124 | blendWeights: 4 125 | textureQuality: 0 126 | anisotropicTextures: 2 127 | antiAliasing: 2 128 | softParticles: 1 129 | softVegetation: 1 130 | realtimeReflectionProbes: 1 131 | billboardsFaceCameraPosition: 1 132 | vSyncCount: 1 133 | lodBias: 1.5 134 | maximumLODLevel: 0 135 | particleRaycastBudget: 1024 136 | asyncUploadTimeSlice: 2 137 | asyncUploadBufferSize: 4 138 | excludedTargetPlatforms: [] 139 | - serializedVersion: 2 140 | name: Fantastic 141 | pixelLightCount: 4 142 | shadows: 2 143 | shadowResolution: 2 144 | shadowProjection: 1 145 | shadowCascades: 4 146 | shadowDistance: 150 147 | shadowNearPlaneOffset: 2 148 | shadowCascade2Split: 0.33333334 149 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 150 | blendWeights: 4 151 | textureQuality: 0 152 | anisotropicTextures: 2 153 | antiAliasing: 2 154 | softParticles: 1 155 | softVegetation: 1 156 | realtimeReflectionProbes: 1 157 | billboardsFaceCameraPosition: 1 158 | vSyncCount: 1 159 | lodBias: 2 160 | maximumLODLevel: 0 161 | particleRaycastBudget: 4096 162 | asyncUploadTimeSlice: 2 163 | asyncUploadBufferSize: 4 164 | excludedTargetPlatforms: [] 165 | m_PerPlatformDefaultQuality: 166 | Android: 2 167 | BlackBerry: 2 168 | FlashPlayer: 3 169 | GLES Emulation: 3 170 | PS3: 3 171 | Standalone: 3 172 | Tizen: 2 173 | WP8: 3 174 | Web: 3 175 | Wii: 3 176 | Windows Store Apps: 3 177 | XBOX360: 3 178 | iPhone: 2 179 | -------------------------------------------------------------------------------- /Assets/UniGif/ProjectSettings/QualitySettings.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f52ea772bec5e0a419edfdb414fabc21 3 | timeCreated: 1500854030 4 | licenseType: Free 5 | NativeFormatImporter: 6 | mainObjectFileID: 0 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/UniGif/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 | -------------------------------------------------------------------------------- /Assets/UniGif/ProjectSettings/TagManager.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c70b5cb8d1e22ff4e943647c91985f07 3 | timeCreated: 1500854030 4 | licenseType: Free 5 | NativeFormatImporter: 6 | mainObjectFileID: 0 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/UniGif/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 | -------------------------------------------------------------------------------- /Assets/UniGif/ProjectSettings/TimeManager.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 989dd99cd13ef1f44bc83a9830379277 3 | timeCreated: 1500854030 4 | licenseType: Free 5 | NativeFormatImporter: 6 | mainObjectFileID: 0 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/UniGif/ProjectSettings/UnityAdsSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!292 &1 4 | UnityAdsSettings: 5 | m_ObjectHideFlags: 0 6 | m_Enabled: 0 7 | m_InitializeOnStartup: 1 8 | m_TestMode: 0 9 | m_EnabledPlatforms: 4294967295 10 | m_IosGameId: 11 | m_AndroidGameId: 12 | -------------------------------------------------------------------------------- /Assets/UniGif/ProjectSettings/UnityAdsSettings.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e64f247ff28e12c4195fc7750894af27 3 | timeCreated: 1500854030 4 | licenseType: Free 5 | NativeFormatImporter: 6 | mainObjectFileID: 0 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/UniGif/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 | m_Enabled: 0 7 | m_TestMode: 0 8 | m_TestEventUrl: 9 | m_TestConfigUrl: 10 | CrashReportingSettings: 11 | m_EventUrl: https://perf-events.cloud.unity3d.com/api/events/crashes 12 | m_Enabled: 0 13 | UnityPurchasingSettings: 14 | m_Enabled: 0 15 | m_TestMode: 0 16 | UnityAnalyticsSettings: 17 | m_Enabled: 0 18 | m_InitializeOnStartup: 1 19 | m_TestMode: 0 20 | m_TestEventUrl: 21 | m_TestConfigUrl: 22 | -------------------------------------------------------------------------------- /Assets/UniGif/ProjectSettings/UnityConnectSettings.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 30adb211bd8439945aeece226c66d7ba 3 | timeCreated: 1500854030 4 | licenseType: Free 5 | NativeFormatImporter: 6 | mainObjectFileID: 0 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/UniGif/README.md: -------------------------------------------------------------------------------- 1 | UniGif 2 | ====== 3 | 4 | [![License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat)](http://opensource.org/licenses/mit-license.php) 5 | 6 | GIF image decoder for Unity. 7 | 8 | Decode a GIF file at run time to get the texture list. 9 | Supports GIF87a or GIF89a format. (Animation, transparency, interlace, etc) 10 | 11 | This is made with Unity 5.4.0f3 (Mac, Win, Android, iOS). 12 | 13 | ![GIFAnimSample](https://raw.githubusercontent.com/WestHillApps/westhillapps.github.io/master/res/unigif_sample.gif) 14 | 15 | How To Use 16 | ------- 17 | Use GIF file bytes which have been taken from the WWW or StreamingAssets. 18 | 19 | ```csharp 20 | // Get GIF textures 21 | yield return StartCoroutine(UniGif.GetTextureListCoroutine(www.bytes, (gifTexList, loopCount, width, height) => { /* Do something */ })); 22 | ``` 23 | 24 | For more information, Please check the example scene and example components. 25 | * example scene - (Assets/UniGif/Example/UniGifExample.unity) 26 | * example component - (Assets/UniGif/Example/Script/UniGifImage.cs) 27 | 28 | Developed By 29 | ------- 30 | WestHillApps (Hironari Nishioka) - 31 | 32 | 33 | Follow me on Twitter 35 | 36 | 37 | License 38 | ------- 39 | The MIT License (MIT) 40 | 41 | Copyright (c) 2015 WestHillApps (Hironari Nishioka) 42 | 43 | Permission is hereby granted, free of charge, to any person obtaining a copy 44 | of this software and associated documentation files (the "Software"), to deal 45 | in the Software without restriction, including without limitation the rights 46 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 47 | copies of the Software, and to permit persons to whom the Software is 48 | furnished to do so, subject to the following conditions: 49 | 50 | The above copyright notice and this permission notice shall be included in 51 | all copies or substantial portions of the Software. 52 | 53 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 54 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 55 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 56 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 57 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 58 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 59 | THE SOFTWARE. 60 | 61 | License (sample gif image) 62 | ------- 63 | ![UnityChanLicense](http://unity-chan.com/images/imageLicenseLogo.png) 64 | These contents are licensed under the [“Unity-Chan” License Terms and Conditions](http://unity-chan.com/contents/guideline_en/). -------------------------------------------------------------------------------- /Assets/UniGif/README.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f9d6561d0553d4546af3c21531202a60 3 | timeCreated: 1500854025 4 | licenseType: Free 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Visualizer.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEngine.UI; 3 | 4 | public class Visualizer : MonoBehaviour 5 | { 6 | Slider[] sliders; 7 | float[] spectrum = new float[1024]; 8 | float[] bands; 9 | 10 | void Awake() 11 | { 12 | sliders = GetComponentsInChildren(); 13 | foreach (var slider in sliders) 14 | { 15 | slider.value = 0; 16 | } 17 | 18 | bands = new float[sliders.Length]; 19 | } 20 | 21 | // TODO: 整理する 22 | void Update() 23 | { 24 | var baseHz = (float)AudioSettings.outputSampleRate / spectrum.Length / 2; 25 | 26 | AudioListener.GetSpectrumData(spectrum, 0, FFTWindow.BlackmanHarris); 27 | 28 | var specI = 0; 29 | var interval = (Mathf.Log((spectrum.Length - 1) * baseHz, 2) - Mathf.Log(1 * baseHz, 2)) / bands.Length / 4f; // 4? 30 | 31 | for (var i = 0; i < bands.Length; i++) 32 | { 33 | var v = 0f; 34 | var startSpecI = specI; 35 | while (specI < spectrum.Length) 36 | { 37 | if (Mathf.Log(specI * baseHz, 2) - Mathf.Log(startSpecI * baseHz, 2) >= interval) break; 38 | v += spectrum[specI]; 39 | specI++; 40 | } 41 | 42 | v /= specI - startSpecI; 43 | bands[i] = v; 44 | } 45 | 46 | for (var i = 0; i < sliders.Length; i++) 47 | { 48 | var slider = sliders[i]; 49 | slider.value = bands[i] * 4f; 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /Assets/Visualizer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f25d5cbd44e510d4fbd79695dbc1f83c 3 | timeCreated: 1500626110 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 chiepomme 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 | -------------------------------------------------------------------------------- /ProjectSettings/AudioManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chiepomme/TwitterMVGenerator/e4608e3a4aa01d2943441b27ab6071b3f4d3a011/ProjectSettings/AudioManager.asset -------------------------------------------------------------------------------- /ProjectSettings/ClusterInputManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chiepomme/TwitterMVGenerator/e4608e3a4aa01d2943441b27ab6071b3f4d3a011/ProjectSettings/ClusterInputManager.asset -------------------------------------------------------------------------------- /ProjectSettings/DynamicsManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chiepomme/TwitterMVGenerator/e4608e3a4aa01d2943441b27ab6071b3f4d3a011/ProjectSettings/DynamicsManager.asset -------------------------------------------------------------------------------- /ProjectSettings/EditorBuildSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chiepomme/TwitterMVGenerator/e4608e3a4aa01d2943441b27ab6071b3f4d3a011/ProjectSettings/EditorBuildSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/EditorSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chiepomme/TwitterMVGenerator/e4608e3a4aa01d2943441b27ab6071b3f4d3a011/ProjectSettings/EditorSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/GraphicsSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chiepomme/TwitterMVGenerator/e4608e3a4aa01d2943441b27ab6071b3f4d3a011/ProjectSettings/GraphicsSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/InputManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chiepomme/TwitterMVGenerator/e4608e3a4aa01d2943441b27ab6071b3f4d3a011/ProjectSettings/InputManager.asset -------------------------------------------------------------------------------- /ProjectSettings/NavMeshAreas.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chiepomme/TwitterMVGenerator/e4608e3a4aa01d2943441b27ab6071b3f4d3a011/ProjectSettings/NavMeshAreas.asset -------------------------------------------------------------------------------- /ProjectSettings/NetworkManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chiepomme/TwitterMVGenerator/e4608e3a4aa01d2943441b27ab6071b3f4d3a011/ProjectSettings/NetworkManager.asset -------------------------------------------------------------------------------- /ProjectSettings/Physics2DSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chiepomme/TwitterMVGenerator/e4608e3a4aa01d2943441b27ab6071b3f4d3a011/ProjectSettings/Physics2DSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/ProjectSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chiepomme/TwitterMVGenerator/e4608e3a4aa01d2943441b27ab6071b3f4d3a011/ProjectSettings/ProjectSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/ProjectVersion.txt: -------------------------------------------------------------------------------- 1 | m_EditorVersion: 2017.1.0f3 2 | -------------------------------------------------------------------------------- /ProjectSettings/QualitySettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chiepomme/TwitterMVGenerator/e4608e3a4aa01d2943441b27ab6071b3f4d3a011/ProjectSettings/QualitySettings.asset -------------------------------------------------------------------------------- /ProjectSettings/TagManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chiepomme/TwitterMVGenerator/e4608e3a4aa01d2943441b27ab6071b3f4d3a011/ProjectSettings/TagManager.asset -------------------------------------------------------------------------------- /ProjectSettings/TimeManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chiepomme/TwitterMVGenerator/e4608e3a4aa01d2943441b27ab6071b3f4d3a011/ProjectSettings/TimeManager.asset -------------------------------------------------------------------------------- /ProjectSettings/UnityConnectSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chiepomme/TwitterMVGenerator/e4608e3a4aa01d2943441b27ab6071b3f4d3a011/ProjectSettings/UnityConnectSettings.asset -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | TwitterMVGenerator 2 | ============================================= 3 | 4 | Twitter で音楽を簡単に投稿するために動画を作るツールです。 5 | 6 | ユーザーの方へ 7 | ---------------------------------------------- 8 | 動作環境は、Windows7 以降、Mac OSX Sierra(10.12) 以降です。 9 | ダウンロードは[こちら](https://github.com/chiepomme/TwitterMVGenerator/releases)からどうぞ。 10 | 使い方は同梱されている README.txt を見てください。 11 | 12 | 開発者の方へ 13 | ---------------------------------------------- 14 | OSX 向けのビルドは FrameCapturer が mp4 出力に対応していないため、ffmpeg を使用して変換しています。 15 | そのため、Mac での開発のためには ffmpeg のバイナリを、リポジトリのルートの `ffmpeg` フォルダに置く必要があります。 16 | 17 | License 18 | ------------------------------ 19 | MIT 20 | 21 | Author 22 | ------------------------------ 23 | @chiepomme 24 | https://chiepom.me/ 25 | --------------------------------------------------------------------------------