Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace the deprecated Shader loading with Asset Bundles
- Loading branch information
Showing
70 changed files
with
2,130 additions
and
2,171 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
ManifestFileVersion: 0 | ||
CRC: 2860702020 | ||
AssetBundleManifest: | ||
AssetBundleInfos: | ||
Info_0: | ||
Name: shaders.bundle | ||
Dependencies: {} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
ManifestFileVersion: 0 | ||
CRC: 2124711942 | ||
Hashes: | ||
AssetFileHash: | ||
serializedVersion: 2 | ||
Hash: 66f47af053113b5066d01bb305c583a5 | ||
TypeTreeHash: | ||
serializedVersion: 2 | ||
Hash: 80729077cb39806c86b5c10073f074fb | ||
HashAppended: 0 | ||
ClassTypes: | ||
- Class: 48 | ||
Script: {instanceID: 0} | ||
Assets: | ||
- Assets/Shaders/MJ_SelfIlluminSpecular.shader | ||
- Assets/Shaders/MJ_DiffuseAmbiant.shader | ||
- Assets/Shaders/MJ_DiffuseAmbiantIgnoreZ.shader | ||
Dependencies: [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
using UnityEditor; | ||
using System.IO; | ||
|
||
public class CreateAssetBundles | ||
{ | ||
[MenuItem("MechJeb/Build AssetBundles")] | ||
static void BuildAllAssetBundles() | ||
{ | ||
// The project settings has DX9, DX11, GL2 and GLCore set for Windows. That should add the shader for all platform when building for Windows | ||
|
||
Directory.CreateDirectory("AssetBundles"); | ||
|
||
AssetBundleBuild[] buildMap = new AssetBundleBuild[1]; | ||
|
||
buildMap[0].assetBundleName = "Shaders.bundle"; | ||
|
||
string[] shadersAssets = new string[3]; | ||
shadersAssets[0] = "Assets/Shaders/MJ_DiffuseAmbiant.shader"; | ||
shadersAssets[1] = "Assets/Shaders/MJ_DiffuseAmbiantIgnoreZ.shader"; | ||
shadersAssets[2] = "Assets/Shaders/MJ_SelfIlluminSpecular.shader"; | ||
|
||
buildMap[0].assetNames = shadersAssets; | ||
|
||
BuildPipeline.BuildAssetBundles("AssetBundles", buildMap, BuildAssetBundleOptions.UncompressedAssetBundle, BuildTarget.StandaloneWindows); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
Shader "MechJeb/DiffuseAmbient" | ||
{ | ||
Properties { | ||
_Color ("Main Color", Color) = (1,1,1,1) | ||
_MainTex ("Base (RGB)", 2D) = "white" {} | ||
_SelfAmbiant("_SelfAmbiant", Range(0,1) ) = 0.5 | ||
} | ||
SubShader { | ||
Tags { "RenderType"="Opaque" } | ||
LOD 200 | ||
|
||
CGPROGRAM | ||
#pragma surface surf Lambert | ||
|
||
sampler2D _MainTex; | ||
fixed4 _Color; | ||
float _SelfAmbiant; | ||
|
||
struct Input { | ||
float2 uv_MainTex; | ||
}; | ||
|
||
void surf (Input IN, inout SurfaceOutput o) { | ||
fixed4 c = tex2D(_MainTex, IN.uv_MainTex) * _Color; | ||
o.Albedo = c.rgb; | ||
o.Alpha = c.a; | ||
o.Emission = c.rgb * _SelfAmbiant; | ||
} | ||
ENDCG | ||
} | ||
|
||
Fallback "VertexLit" | ||
} |
38 changes: 38 additions & 0 deletions
38
MechJeb2-Unity/Assets/Shaders/MJ_DiffuseAmbiantIgnoreZ.shader
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
Shader "MechJeb/DiffuseAmbientIgnoreZ" | ||
{ | ||
Properties { | ||
_Color ("Main Color", Color) = (1,1,1,1) | ||
_MainTex ("Base (RGB)", 2D) = "white" {} | ||
_SelfAmbiant("_SelfAmbiant", Range(0,1) ) = 0.5 | ||
} | ||
SubShader { | ||
Tags { | ||
"Queue"="Overlay" | ||
"RenderType"="Opaque" | ||
} | ||
ZTest Always | ||
|
||
LOD 200 | ||
|
||
CGPROGRAM | ||
#pragma surface surf Lambert | ||
|
||
sampler2D _MainTex; | ||
fixed4 _Color; | ||
float _SelfAmbiant; | ||
|
||
struct Input { | ||
float2 uv_MainTex; | ||
}; | ||
|
||
void surf (Input IN, inout SurfaceOutput o) { | ||
fixed4 c = tex2D(_MainTex, IN.uv_MainTex) * _Color; | ||
o.Albedo = c.rgb; | ||
o.Alpha = c.a; | ||
o.Emission = c.rgb * _SelfAmbiant; | ||
} | ||
ENDCG | ||
} | ||
|
||
Fallback "VertexLit" | ||
} |
42 changes: 42 additions & 0 deletions
42
MechJeb2-Unity/Assets/Shaders/MJ_SelfIlluminSpecular.shader
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
Shader "MechJeb/Self-IlluminSpecular" { | ||
Properties { | ||
_Color ("Main Color", Color) = (1,1,1,1) | ||
_SpecColor ("Specular Color", Color) = (0.5, 0.5, 0.5, 1) | ||
_Shininess ("Shininess", Range (0.01, 1)) = 0.078125 | ||
_MainTex ("Base (RGB) Gloss (A)", 2D) = "white" {} | ||
_Illum ("Illumin (A)", 2D) = "white" {} | ||
_Emission ("Emission (Lightmapper)", Float) = 1.0 | ||
} | ||
SubShader { | ||
Tags { "RenderType"="Opaque" } | ||
LOD 300 | ||
|
||
CGPROGRAM | ||
#pragma surface surf BlinnPhong | ||
|
||
sampler2D _MainTex; | ||
sampler2D _Illum; | ||
fixed4 _Color; | ||
half _Shininess; | ||
fixed _Emission; | ||
|
||
struct Input { | ||
float2 uv_MainTex; | ||
float2 uv_Illum; | ||
}; | ||
|
||
void surf (Input IN, inout SurfaceOutput o) { | ||
fixed4 tex = tex2D(_MainTex, IN.uv_MainTex); | ||
fixed4 c = tex * _Color; | ||
o.Albedo = c.rgb; | ||
o.Emission = c.rgb * tex2D(_Illum, IN.uv_Illum).a; | ||
#if defined (UNITY_PASS_META) | ||
o.Emission *= _Emission.rrr; | ||
#endif | ||
o.Gloss = tex.a; | ||
o.Alpha = c.a; | ||
o.Specular = _Shininess; | ||
} | ||
ENDCG | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
%YAML 1.1 | ||
%TAG !u! tag:unity3d.com,2011: | ||
--- !u!11 &1 | ||
AudioManager: | ||
m_ObjectHideFlags: 0 | ||
m_Volume: 1 | ||
Rolloff Scale: 1 | ||
Doppler Factor: 1 | ||
Default Speaker Mode: 2 | ||
m_SampleRate: 0 | ||
m_DSPBufferSize: 0 | ||
m_VirtualVoiceCount: 512 | ||
m_RealVoiceCount: 32 | ||
m_SpatializerPlugin: | ||
m_DisableAudio: 0 | ||
m_VirtualizeEffects: 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
%YAML 1.1 | ||
%TAG !u! tag:unity3d.com,2011: | ||
--- !u!236 &1 | ||
ClusterInputManager: | ||
m_ObjectHideFlags: 0 | ||
m_Inputs: [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
%YAML 1.1 | ||
%TAG !u! tag:unity3d.com,2011: | ||
--- !u!55 &1 | ||
PhysicsManager: | ||
m_ObjectHideFlags: 0 | ||
serializedVersion: 2 | ||
m_Gravity: {x: 0, y: -9.81, z: 0} | ||
m_DefaultMaterial: {fileID: 0} | ||
m_BounceThreshold: 2 | ||
m_SleepThreshold: 0.005 | ||
m_DefaultContactOffset: 0.01 | ||
m_SolverIterationCount: 6 | ||
m_SolverVelocityIterations: 1 | ||
m_QueriesHitTriggers: 1 | ||
m_EnableAdaptiveForce: 0 | ||
m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
%YAML 1.1 | ||
%TAG !u! tag:unity3d.com,2011: | ||
--- !u!1045 &1 | ||
EditorBuildSettings: | ||
m_ObjectHideFlags: 0 | ||
serializedVersion: 2 | ||
m_Scenes: [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
%YAML 1.1 | ||
%TAG !u! tag:unity3d.com,2011: | ||
--- !u!159 &1 | ||
EditorSettings: | ||
m_ObjectHideFlags: 0 | ||
serializedVersion: 3 | ||
m_ExternalVersionControlSupport: Hidden Meta Files | ||
m_SerializationMode: 2 | ||
m_WebSecurityEmulationEnabled: 0 | ||
m_WebSecurityEmulationHostUrl: http://www.mydomain.com/mygame.unity3d | ||
m_DefaultBehaviorMode: 0 | ||
m_SpritePackerMode: 2 | ||
m_SpritePackerPaddingPower: 1 | ||
m_ProjectGenerationIncludedExtensions: txt;xml;fnt;cd | ||
m_ProjectGenerationRootNamespace: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
%YAML 1.1 | ||
%TAG !u! tag:unity3d.com,2011: | ||
--- !u!30 &1 | ||
GraphicsSettings: | ||
m_ObjectHideFlags: 0 | ||
serializedVersion: 7 | ||
m_Deferred: | ||
m_Mode: 1 | ||
m_Shader: {fileID: 69, guid: 0000000000000000f000000000000000, type: 0} | ||
m_DeferredReflections: | ||
m_Mode: 1 | ||
m_Shader: {fileID: 74, guid: 0000000000000000f000000000000000, type: 0} | ||
m_ScreenSpaceShadows: | ||
m_Mode: 1 | ||
m_Shader: {fileID: 64, guid: 0000000000000000f000000000000000, type: 0} | ||
m_LegacyDeferred: | ||
m_Mode: 1 | ||
m_Shader: {fileID: 63, guid: 0000000000000000f000000000000000, type: 0} | ||
m_DepthNormals: | ||
m_Mode: 1 | ||
m_Shader: {fileID: 62, guid: 0000000000000000f000000000000000, type: 0} | ||
m_MotionVectors: | ||
m_Mode: 1 | ||
m_Shader: {fileID: 75, guid: 0000000000000000f000000000000000, type: 0} | ||
m_LightHalo: | ||
m_Mode: 1 | ||
m_Shader: {fileID: 105, guid: 0000000000000000f000000000000000, type: 0} | ||
m_LensFlare: | ||
m_Mode: 1 | ||
m_Shader: {fileID: 102, guid: 0000000000000000f000000000000000, type: 0} | ||
m_AlwaysIncludedShaders: | ||
- {fileID: 7, guid: 0000000000000000f000000000000000, type: 0} | ||
- {fileID: 15104, guid: 0000000000000000f000000000000000, type: 0} | ||
- {fileID: 15105, guid: 0000000000000000f000000000000000, type: 0} | ||
- {fileID: 15106, guid: 0000000000000000f000000000000000, type: 0} | ||
- {fileID: 10753, guid: 0000000000000000f000000000000000, type: 0} | ||
- {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0} | ||
- {fileID: 10782, guid: 0000000000000000f000000000000000, type: 0} | ||
m_PreloadedShaders: [] | ||
m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000, | ||
type: 0} | ||
m_ShaderSettings_Tier1: | ||
useCascadedShadowMaps: 1 | ||
standardShaderQuality: 2 | ||
useReflectionProbeBoxProjection: 1 | ||
useReflectionProbeBlending: 1 | ||
m_ShaderSettings_Tier2: | ||
useCascadedShadowMaps: 1 | ||
standardShaderQuality: 2 | ||
useReflectionProbeBoxProjection: 1 | ||
useReflectionProbeBlending: 1 | ||
m_ShaderSettings_Tier3: | ||
useCascadedShadowMaps: 1 | ||
standardShaderQuality: 2 | ||
useReflectionProbeBoxProjection: 1 | ||
useReflectionProbeBlending: 1 | ||
m_BuildTargetShaderSettings: [] | ||
m_LightmapStripping: 1 | ||
m_FogStripping: 1 | ||
m_LightmapKeepPlain: 0 | ||
m_LightmapKeepDirCombined: 0 | ||
m_LightmapKeepDirSeparate: 0 | ||
m_LightmapKeepDynamicPlain: 0 | ||
m_LightmapKeepDynamicDirCombined: 0 | ||
m_LightmapKeepDynamicDirSeparate: 0 | ||
m_FogKeepLinear: 0 | ||
m_FogKeepExp: 0 | ||
m_FogKeepExp2: 1 |
Oops, something went wrong.