コード例 #1
0
 public void LoadSkybox()
 {
     _skyboxPath = FileBrowser.OpenSingleFile("Open skybox file", SettingsBehaviour.Instance.Settings.SkyboxImportDirectory, "");
     if (!string.IsNullOrEmpty(_skyboxPath))
     {
         Modal.Show(500, 100, "Skybox mapping type", "",
                    new ButtonDescriptor("Latitude-longitude", () => { _mapping = SkyboxMapping.LatLong; }),
                    new ButtonDescriptor("Six sided", () => { _mapping = SkyboxMapping.Cube; }),
                    new ButtonDescriptor("Cancel", ButtonDescriptor.ColorPresets.Red)
                    );
     }
 }
コード例 #2
0
        private void Update()
        {
            if (_mapping != SkyboxMapping.None)
            {
                Material  mat = _mapping == SkyboxMapping.LatLong ? Resources.Load <Material>("Materials/SkyboxLatLong") : Resources.Load <Material>("Materials/SkyboxSixSided");
                Texture2D tex = new Texture2D(2, 2);
                tex.LoadImage(System.IO.File.ReadAllBytes(_skyboxPath));
                tex.wrapMode             = TextureWrapMode.Clamp;
                tex.requestedMipmapLevel = 0;
                mat.mainTexture          = tex;
                RenderSettings.skybox    = mat;

                _mapping = SkyboxMapping.None;
            }
        }