Skip to content

Commit

Permalink
Merge pull request #3 from stasikos/master
Browse files Browse the repository at this point in the history
Fixes shader loading issues on OSX and Linux
  • Loading branch information
linuxgurugamer authored Nov 11, 2016
2 parents d8bb9ec + 0c6786a commit 2f92d8a
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
Binary file added GameData/HullCameraVDS/Resources/shaders.linux
Binary file not shown.
Binary file added GameData/HullCameraVDS/Resources/shaders.osx
Binary file not shown.
Binary file added GameData/HullCameraVDS/Resources/shaders.windows
Binary file not shown.
21 changes: 18 additions & 3 deletions Src/CameraFilters/CameraFilter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -178,14 +178,29 @@ protected float GetSliderValue(string label, float value, float leftValue, float
}

private static bool BundleLoaded = false;
private static Dictionary<string, Shader> LoadedShaders = new Dictionary<string, Shader>();

private static Dictionary<string, Shader> LoadedShaders = new Dictionary<string, Shader>();

public static void LoadBundle()
{
if (BundleLoaded)
return;

using (WWW www = new WWW("file://" + KSPUtil.ApplicationRootPath + "GameData/HullCameraVDS/Resources/shaders.bundle"))
string bundleName;
switch (Application.platform)
{
case RuntimePlatform.OSXPlayer:
bundleName = "shaders.osx";
break;

case RuntimePlatform.LinuxPlayer:
bundleName = "shaders.linux";
break;

default:
bundleName = "shaders.windows";
break;
}
using (WWW www = new WWW("file://" + KSPUtil.ApplicationRootPath + "GameData/HullCameraVDS/Resources/" + bundleName))
{
if (www.error != null)
Debug.Log("Shaders bundle not found!");
Expand Down

0 comments on commit 2f92d8a

Please sign in to comment.