diff --git a/Assets/_Project/Frame/FrameDataLoader.asset b/Assets/_Project/Frame/FrameDataLoader.asset index c4f5bcc..5644c15 100644 --- a/Assets/_Project/Frame/FrameDataLoader.asset +++ b/Assets/_Project/Frame/FrameDataLoader.asset @@ -266,13 +266,13 @@ MonoBehaviour: Data: - Name: $k Entry: 1 - Data: photoDurationSeconds + Data: slideDurationSeconds - Name: $v Entry: 7 Data: 14|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 - Data: photoDurationSeconds + Data: slideDurationSeconds - Name: k__BackingField Entry: 7 Data: 15|System.RuntimeType, mscorlib @@ -482,13 +482,13 @@ MonoBehaviour: Data: - Name: $k Entry: 1 - Data: captions + Data: _captions - Name: $v Entry: 7 Data: 26|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 - Data: captions + Data: _captions - Name: k__BackingField Entry: 7 Data: 27|System.RuntimeType, mscorlib @@ -536,13 +536,13 @@ MonoBehaviour: Data: - Name: $k Entry: 1 - Data: downloadsComplete + Data: _downloadsComplete - Name: $v Entry: 7 Data: 29|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 - Data: downloadsComplete + Data: _downloadsComplete - Name: k__BackingField Entry: 7 Data: 30|System.RuntimeType, mscorlib diff --git a/Assets/_Project/Frame/FrameDataLoader.cs b/Assets/_Project/Frame/FrameDataLoader.cs index 08a4e22..636a8ea 100644 --- a/Assets/_Project/Frame/FrameDataLoader.cs +++ b/Assets/_Project/Frame/FrameDataLoader.cs @@ -13,14 +13,14 @@ public class FrameDataLoader : UdonSharpBehaviour public VRCUrl stringUrl; public new Renderer renderer; public Text field; - public float photoDurationSeconds = 10f; + public float slideDurationSeconds = 10f; // Private Variables private int _loadedIndex = -1; private VRCImageDownloader _imageDownloader; private IUdonEventReceiver udonEventReceiver; - private string[] captions = new string[0]; - private bool[] downloadsComplete; + private string[] _captions = new string[0]; + private bool[] _downloadsComplete; private Texture2D[] _textures; void Start() @@ -29,7 +29,7 @@ public class FrameDataLoader : UdonSharpBehaviour udonEventReceiver = (IUdonEventReceiver)this; // Track which downloads have been completed already - downloadsComplete = new bool[rgbUrl.Length]; + _downloadsComplete = new bool[rgbUrl.Length]; _textures = new Texture2D[rgbUrl.Length]; // Construct Image Downloader to reuse @@ -44,29 +44,28 @@ public class FrameDataLoader : UdonSharpBehaviour public void LoadNextRecursive() { LoadNext(); - SendCustomEventDelayedSeconds(nameof(LoadNextRecursive), photoDurationSeconds); + SendCustomEventDelayedSeconds(nameof(LoadNextRecursive), slideDurationSeconds); } private void LoadNext() { - _loadedIndex = (int)(Networking.GetServerTimeInMilliseconds() / 1000f / photoDurationSeconds) % rgbUrl.Length; + _loadedIndex = (int)(Networking.GetServerTimeInMilliseconds() / 1000f / slideDurationSeconds) % rgbUrl.Length; - if (downloadsComplete[_loadedIndex]) + if (_downloadsComplete[_loadedIndex]) { renderer.sharedMaterial.mainTexture = _textures[_loadedIndex]; } else { var rgbInfo = new TextureInfo(); - rgbInfo.WrapModeU = TextureWrapMode.Mirror; - rgbInfo.WrapModeV = TextureWrapMode.Mirror; + rgbInfo.GenerateMipMaps = true; _imageDownloader.DownloadImage(rgbUrl[_loadedIndex], renderer.material, udonEventReceiver, rgbInfo); } // Set caption if one is provided - if (_loadedIndex < captions.Length) + if (_loadedIndex < _captions.Length) { - field.text = captions[_loadedIndex]; + field.text = _captions[_loadedIndex]; } else { @@ -76,7 +75,7 @@ public class FrameDataLoader : UdonSharpBehaviour public override void OnStringLoadSuccess(IVRCStringDownload result) { - captions = result.Result.Split('\n'); + _captions = result.Result.Split('\n'); } public override void OnStringLoadError(IVRCStringDownload result) @@ -88,14 +87,14 @@ public class FrameDataLoader : UdonSharpBehaviour { Debug.Log($"Image loaded: {result.SizeInMemoryBytes} bytes."); - downloadsComplete[_loadedIndex] = true; + _downloadsComplete[_loadedIndex] = true; _textures[_loadedIndex] = result.Result; } public override void OnImageLoadError(IVRCImageDownload result) { Debug.Log($"Image not loaded: {result.Error.ToString()}: {result.ErrorMessage}."); - downloadsComplete[_loadedIndex] = false; + _downloadsComplete[_loadedIndex] = false; } private void OnDestroy() diff --git a/Assets/_Project/Gallery.unity b/Assets/_Project/Gallery.unity index ea22bf4..c12f317 100644 --- a/Assets/_Project/Gallery.unity +++ b/Assets/_Project/Gallery.unity @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:51b98c47e7a7bc8a0df8d4068b0cdf4ebb2ba1fcc3776216bb6d7e0519f30cc8 -size 50307 +oid sha256:a29fc0b7ad1c79d167df2c286714c2efa3c7b4418fe2ff1369c9cce78deb1c3b +size 52736