Browse Source

Add InfiniteGrid Shader

Nikos Kastellanos 8 years ago
parent
commit
9fc95f9c2d
29 changed files with 941 additions and 0 deletions
  1. 7 0
      Aether.Extras.WINDOWS.MG.sln
  2. 7 0
      Aether.Extras.WINDOWS.XNA.sln
  3. 7 0
      Samples.WINDOWS.MG.sln
  4. 7 0
      Samples.WINDOWS.XNA.sln
  5. 63 0
      Shaders/InfiniteGrid/Aether.Shaders.InfiniteGrid.WINDOWS.MG.csproj
  6. 64 0
      Shaders/InfiniteGrid/Aether.Shaders.InfiniteGrid.WINDOWS.XNA.csproj
  7. 107 0
      Shaders/InfiniteGrid/Components/InfiniteGridComponent.cs
  8. 202 0
      Shaders/InfiniteGrid/InfiniteGridEffect.cs
  9. 37 0
      Shaders/InfiniteGrid/Properties/AssemblyInfo.cs
  10. 30 0
      Shaders/InfiniteGrid/Resources/BuildShaders.bat
  11. BIN
      Shaders/InfiniteGrid/Resources/CompileEffect/CompileEffect.exe
  12. 3 0
      Shaders/InfiniteGrid/Resources/CompileEffect/CompileEffect.exe.config
  13. BIN
      Shaders/InfiniteGrid/Resources/CompileEffect/Microsoft.Xna.Framework.Content.Pipeline.EffectImporter.dll
  14. BIN
      Shaders/InfiniteGrid/Resources/InfiniteGridEffect.HiDef.dx11.mgfxo.7
  15. BIN
      Shaders/InfiniteGrid/Resources/InfiniteGridEffect.HiDef.dx11.mgfxo.8
  16. 123 0
      Shaders/InfiniteGrid/Resources/InfiniteGridEffect.HiDef.fx
  17. BIN
      Shaders/InfiniteGrid/Resources/InfiniteGridEffect.HiDef.ogl.mgfxo.7
  18. BIN
      Shaders/InfiniteGrid/Resources/InfiniteGridEffect.HiDef.ogl.mgfxo.8
  19. BIN
      Shaders/InfiniteGrid/Resources/InfiniteGridEffect.HiDef.xna
  20. BIN
      Shaders/InfiniteGrid/Resources/InfiniteGridEffect.Reach.dx11.mgfxo.7
  21. BIN
      Shaders/InfiniteGrid/Resources/InfiniteGridEffect.Reach.dx11.mgfxo.8
  22. 213 0
      Shaders/InfiniteGrid/Resources/InfiniteGridEffect.Reach.fx
  23. BIN
      Shaders/InfiniteGrid/Resources/InfiniteGridEffect.Reach.ogl.mgfxo.7
  24. BIN
      Shaders/InfiniteGrid/Resources/InfiniteGridEffect.Reach.ogl.mgfxo.8
  25. BIN
      Shaders/InfiniteGrid/Resources/InfiniteGridEffect.Reach.xna
  26. 67 0
      Shaders/InfiniteGrid/Resources/Macros.fxh
  27. 4 0
      Shaders/InfiniteGrid/packages.config
  28. BIN
      bin/Release/Windows.XNA/Aether.Shaders.InfiniteGrid.dll
  29. BIN
      bin/Release/Windows/Aether.Shaders.InfiniteGrid.dll

+ 7 - 0
Aether.Extras.WINDOWS.MG.sln

@@ -27,6 +27,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AtlasImporter.WINDOWS.MG",
 EndProject
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Aether.Atlas.WINDOWS.MG", "Atlas\Aether.Atlas.WINDOWS.MG.csproj", "{C7522B5E-B255-4FB6-A17A-9E6D217AEBD2}"
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Aether.Atlas.WINDOWS.MG", "Atlas\Aether.Atlas.WINDOWS.MG.csproj", "{C7522B5E-B255-4FB6-A17A-9E6D217AEBD2}"
 EndProject
 EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Aether.Shaders.InfiniteGrid.WINDOWS.MG", "Shaders\InfiniteGrid\Aether.Shaders.InfiniteGrid.WINDOWS.MG.csproj", "{08296A2E-BECF-4DB9-A518-8A613D07B80E}"
+EndProject
 Global
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Any CPU = Debug|Any CPU
 		Debug|Any CPU = Debug|Any CPU
@@ -73,6 +75,10 @@ Global
 		{C7522B5E-B255-4FB6-A17A-9E6D217AEBD2}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{C7522B5E-B255-4FB6-A17A-9E6D217AEBD2}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{C7522B5E-B255-4FB6-A17A-9E6D217AEBD2}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{C7522B5E-B255-4FB6-A17A-9E6D217AEBD2}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{C7522B5E-B255-4FB6-A17A-9E6D217AEBD2}.Release|Any CPU.Build.0 = Release|Any CPU
 		{C7522B5E-B255-4FB6-A17A-9E6D217AEBD2}.Release|Any CPU.Build.0 = Release|Any CPU
+		{08296A2E-BECF-4DB9-A518-8A613D07B80E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{08296A2E-BECF-4DB9-A518-8A613D07B80E}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{08296A2E-BECF-4DB9-A518-8A613D07B80E}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{08296A2E-BECF-4DB9-A518-8A613D07B80E}.Release|Any CPU.Build.0 = Release|Any CPU
 	EndGlobalSection
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE
 		HideSolutionNode = FALSE
@@ -85,5 +91,6 @@ Global
 		{FBBDE2BA-F9F3-4041-8584-2C912C235E26} = {13D47E11-4A7C-49C8-942E-2543E9C0098A}
 		{FBBDE2BA-F9F3-4041-8584-2C912C235E26} = {13D47E11-4A7C-49C8-942E-2543E9C0098A}
 		{96105100-20DB-4187-9BCA-0A20AC9F1298} = {13D47E11-4A7C-49C8-942E-2543E9C0098A}
 		{96105100-20DB-4187-9BCA-0A20AC9F1298} = {13D47E11-4A7C-49C8-942E-2543E9C0098A}
 		{E710FBEA-8C75-405D-B6B4-CFC82CB48FB5} = {A921886B-C6F7-4FF8-8668-EC20004C464A}
 		{E710FBEA-8C75-405D-B6B4-CFC82CB48FB5} = {A921886B-C6F7-4FF8-8668-EC20004C464A}
+		{08296A2E-BECF-4DB9-A518-8A613D07B80E} = {13D47E11-4A7C-49C8-942E-2543E9C0098A}
 	EndGlobalSection
 	EndGlobalSection
 EndGlobal
 EndGlobal

+ 7 - 0
Aether.Extras.WINDOWS.XNA.sln

@@ -21,6 +21,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AtlasImporter.WINDOWS.XNA",
 EndProject
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Aether.Atlas.WINDOWS.XNA", "Atlas\Aether.Atlas.WINDOWS.XNA.csproj", "{644629BB-1A4E-4932-8E50-4F93BC938794}"
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Aether.Atlas.WINDOWS.XNA", "Atlas\Aether.Atlas.WINDOWS.XNA.csproj", "{644629BB-1A4E-4932-8E50-4F93BC938794}"
 EndProject
 EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Aether.Shaders.InfiniteGrid.WINDOWS.XNA", "Shaders\InfiniteGrid\Aether.Shaders.InfiniteGrid.WINDOWS.XNA.csproj", "{908EC8FF-B0ED-478A-B486-702E578AF64A}"
+EndProject
 Global
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|x86 = Debug|x86
 		Debug|x86 = Debug|x86
@@ -59,6 +61,10 @@ Global
 		{644629BB-1A4E-4932-8E50-4F93BC938794}.Debug|x86.Build.0 = Debug|x86
 		{644629BB-1A4E-4932-8E50-4F93BC938794}.Debug|x86.Build.0 = Debug|x86
 		{644629BB-1A4E-4932-8E50-4F93BC938794}.Release|x86.ActiveCfg = Release|x86
 		{644629BB-1A4E-4932-8E50-4F93BC938794}.Release|x86.ActiveCfg = Release|x86
 		{644629BB-1A4E-4932-8E50-4F93BC938794}.Release|x86.Build.0 = Release|x86
 		{644629BB-1A4E-4932-8E50-4F93BC938794}.Release|x86.Build.0 = Release|x86
+		{908EC8FF-B0ED-478A-B486-702E578AF64A}.Debug|x86.ActiveCfg = Debug|x86
+		{908EC8FF-B0ED-478A-B486-702E578AF64A}.Debug|x86.Build.0 = Debug|x86
+		{908EC8FF-B0ED-478A-B486-702E578AF64A}.Release|x86.ActiveCfg = Release|x86
+		{908EC8FF-B0ED-478A-B486-702E578AF64A}.Release|x86.Build.0 = Release|x86
 	EndGlobalSection
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE
 		HideSolutionNode = FALSE
@@ -69,5 +75,6 @@ Global
 		{90E6017D-198B-4470-BF9B-8B8791C295CC} = {F6B6E505-6037-49E4-9060-8B29A7B99BC1}
 		{90E6017D-198B-4470-BF9B-8B8791C295CC} = {F6B6E505-6037-49E4-9060-8B29A7B99BC1}
 		{89E0198E-7298-411A-B5C1-61F2754A3F80} = {EFC7A27C-C20B-4BE7-8B3A-2B109991D704}
 		{89E0198E-7298-411A-B5C1-61F2754A3F80} = {EFC7A27C-C20B-4BE7-8B3A-2B109991D704}
 		{B82B862D-C728-4A10-8A56-65D688E022C8} = {EFC7A27C-C20B-4BE7-8B3A-2B109991D704}
 		{B82B862D-C728-4A10-8A56-65D688E022C8} = {EFC7A27C-C20B-4BE7-8B3A-2B109991D704}
+		{908EC8FF-B0ED-478A-B486-702E578AF64A} = {EFC7A27C-C20B-4BE7-8B3A-2B109991D704}
 	EndGlobalSection
 	EndGlobalSection
 EndGlobal
 EndGlobal

+ 7 - 0
Samples.WINDOWS.MG.sln

@@ -27,6 +27,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AtlasImporter.WINDOWS.MG",
 EndProject
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Aether.Atlas.WINDOWS.MG", "Atlas\Aether.Atlas.WINDOWS.MG.csproj", "{C7522B5E-B255-4FB6-A17A-9E6D217AEBD2}"
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Aether.Atlas.WINDOWS.MG", "Atlas\Aether.Atlas.WINDOWS.MG.csproj", "{C7522B5E-B255-4FB6-A17A-9E6D217AEBD2}"
 EndProject
 EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Aether.Shaders.InfiniteGrid.WINDOWS.MG", "Shaders\InfiniteGrid\Aether.Shaders.InfiniteGrid.WINDOWS.MG.csproj", "{08296A2E-BECF-4DB9-A518-8A613D07B80E}"
+EndProject
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Samples", "Samples", "{584E505E-859A-4DA8-9235-EE6C61C03479}"
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Samples", "Samples", "{584E505E-859A-4DA8-9235-EE6C61C03479}"
 EndProject
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Samples.Animation.WINDOWS.MG", "Samples\Animation\Samples.Animation.WINDOWS.MG.csproj", "{53EA1090-FEE4-4F16-96C2-57DD6B75FA75}"
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Samples.Animation.WINDOWS.MG", "Samples\Animation\Samples.Animation.WINDOWS.MG.csproj", "{53EA1090-FEE4-4F16-96C2-57DD6B75FA75}"
@@ -86,6 +88,10 @@ Global
 		{C7522B5E-B255-4FB6-A17A-9E6D217AEBD2}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{C7522B5E-B255-4FB6-A17A-9E6D217AEBD2}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{C7522B5E-B255-4FB6-A17A-9E6D217AEBD2}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{C7522B5E-B255-4FB6-A17A-9E6D217AEBD2}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{C7522B5E-B255-4FB6-A17A-9E6D217AEBD2}.Release|Any CPU.Build.0 = Release|Any CPU
 		{C7522B5E-B255-4FB6-A17A-9E6D217AEBD2}.Release|Any CPU.Build.0 = Release|Any CPU
+		{08296A2E-BECF-4DB9-A518-8A613D07B80E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{08296A2E-BECF-4DB9-A518-8A613D07B80E}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{08296A2E-BECF-4DB9-A518-8A613D07B80E}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{08296A2E-BECF-4DB9-A518-8A613D07B80E}.Release|Any CPU.Build.0 = Release|Any CPU
 		{53EA1090-FEE4-4F16-96C2-57DD6B75FA75}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
 		{53EA1090-FEE4-4F16-96C2-57DD6B75FA75}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
 		{53EA1090-FEE4-4F16-96C2-57DD6B75FA75}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{53EA1090-FEE4-4F16-96C2-57DD6B75FA75}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{53EA1090-FEE4-4F16-96C2-57DD6B75FA75}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{53EA1090-FEE4-4F16-96C2-57DD6B75FA75}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -114,6 +120,7 @@ Global
 		{FBBDE2BA-F9F3-4041-8584-2C912C235E26} = {13D47E11-4A7C-49C8-942E-2543E9C0098A}
 		{FBBDE2BA-F9F3-4041-8584-2C912C235E26} = {13D47E11-4A7C-49C8-942E-2543E9C0098A}
 		{96105100-20DB-4187-9BCA-0A20AC9F1298} = {13D47E11-4A7C-49C8-942E-2543E9C0098A}
 		{96105100-20DB-4187-9BCA-0A20AC9F1298} = {13D47E11-4A7C-49C8-942E-2543E9C0098A}
 		{E710FBEA-8C75-405D-B6B4-CFC82CB48FB5} = {A921886B-C6F7-4FF8-8668-EC20004C464A}
 		{E710FBEA-8C75-405D-B6B4-CFC82CB48FB5} = {A921886B-C6F7-4FF8-8668-EC20004C464A}
+		{08296A2E-BECF-4DB9-A518-8A613D07B80E} = {13D47E11-4A7C-49C8-942E-2543E9C0098A}
 		{53EA1090-FEE4-4F16-96C2-57DD6B75FA75} = {584E505E-859A-4DA8-9235-EE6C61C03479}
 		{53EA1090-FEE4-4F16-96C2-57DD6B75FA75} = {584E505E-859A-4DA8-9235-EE6C61C03479}
 		{4F224B03-7499-4EE0-A072-7CD7FC266E2A} = {584E505E-859A-4DA8-9235-EE6C61C03479}
 		{4F224B03-7499-4EE0-A072-7CD7FC266E2A} = {584E505E-859A-4DA8-9235-EE6C61C03479}
 		{594B1001-B485-499A-A22B-42125763C2CF} = {584E505E-859A-4DA8-9235-EE6C61C03479}
 		{594B1001-B485-499A-A22B-42125763C2CF} = {584E505E-859A-4DA8-9235-EE6C61C03479}

+ 7 - 0
Samples.WINDOWS.XNA.sln

@@ -21,6 +21,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AtlasImporter.WINDOWS.XNA",
 EndProject
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Aether.Atlas.WINDOWS.XNA", "Atlas\Aether.Atlas.WINDOWS.XNA.csproj", "{644629BB-1A4E-4932-8E50-4F93BC938794}"
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Aether.Atlas.WINDOWS.XNA", "Atlas\Aether.Atlas.WINDOWS.XNA.csproj", "{644629BB-1A4E-4932-8E50-4F93BC938794}"
 EndProject
 EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Aether.Shaders.InfiniteGrid.WINDOWS.XNA", "Shaders\InfiniteGrid\Aether.Shaders.InfiniteGrid.WINDOWS.XNA.csproj", "{908EC8FF-B0ED-478A-B486-702E578AF64A}"
+EndProject
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Samples", "Samples", "{45FFB286-52CE-4EB7-8ACE-8B6FBD18D616}"
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Samples", "Samples", "{45FFB286-52CE-4EB7-8ACE-8B6FBD18D616}"
 EndProject
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Samples.Animation.WINDOWS.XNA", "Samples\Animation\Samples.Animation.WINDOWS.XNA.csproj", "{8C971E86-ACD6-45E6-A4C2-7E0C556152FE}"
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Samples.Animation.WINDOWS.XNA", "Samples\Animation\Samples.Animation.WINDOWS.XNA.csproj", "{8C971E86-ACD6-45E6-A4C2-7E0C556152FE}"
@@ -77,6 +79,10 @@ Global
 		{644629BB-1A4E-4932-8E50-4F93BC938794}.Debug|x86.Build.0 = Debug|x86
 		{644629BB-1A4E-4932-8E50-4F93BC938794}.Debug|x86.Build.0 = Debug|x86
 		{644629BB-1A4E-4932-8E50-4F93BC938794}.Release|x86.ActiveCfg = Release|x86
 		{644629BB-1A4E-4932-8E50-4F93BC938794}.Release|x86.ActiveCfg = Release|x86
 		{644629BB-1A4E-4932-8E50-4F93BC938794}.Release|x86.Build.0 = Release|x86
 		{644629BB-1A4E-4932-8E50-4F93BC938794}.Release|x86.Build.0 = Release|x86
+		{908EC8FF-B0ED-478A-B486-702E578AF64A}.Debug|x86.ActiveCfg = Debug|x86
+		{908EC8FF-B0ED-478A-B486-702E578AF64A}.Debug|x86.Build.0 = Debug|x86
+		{908EC8FF-B0ED-478A-B486-702E578AF64A}.Release|x86.ActiveCfg = Release|x86
+		{908EC8FF-B0ED-478A-B486-702E578AF64A}.Release|x86.Build.0 = Release|x86
 		{8C971E86-ACD6-45E6-A4C2-7E0C556152FE}.Debug|x86.ActiveCfg = Debug|x86
 		{8C971E86-ACD6-45E6-A4C2-7E0C556152FE}.Debug|x86.ActiveCfg = Debug|x86
 		{8C971E86-ACD6-45E6-A4C2-7E0C556152FE}.Debug|x86.Build.0 = Debug|x86
 		{8C971E86-ACD6-45E6-A4C2-7E0C556152FE}.Debug|x86.Build.0 = Debug|x86
 		{8C971E86-ACD6-45E6-A4C2-7E0C556152FE}.Release|x86.ActiveCfg = Release|x86
 		{8C971E86-ACD6-45E6-A4C2-7E0C556152FE}.Release|x86.ActiveCfg = Release|x86
@@ -111,6 +117,7 @@ Global
 		{90E6017D-198B-4470-BF9B-8B8791C295CC} = {F6B6E505-6037-49E4-9060-8B29A7B99BC1}
 		{90E6017D-198B-4470-BF9B-8B8791C295CC} = {F6B6E505-6037-49E4-9060-8B29A7B99BC1}
 		{89E0198E-7298-411A-B5C1-61F2754A3F80} = {EFC7A27C-C20B-4BE7-8B3A-2B109991D704}
 		{89E0198E-7298-411A-B5C1-61F2754A3F80} = {EFC7A27C-C20B-4BE7-8B3A-2B109991D704}
 		{B82B862D-C728-4A10-8A56-65D688E022C8} = {EFC7A27C-C20B-4BE7-8B3A-2B109991D704}
 		{B82B862D-C728-4A10-8A56-65D688E022C8} = {EFC7A27C-C20B-4BE7-8B3A-2B109991D704}
+		{908EC8FF-B0ED-478A-B486-702E578AF64A} = {EFC7A27C-C20B-4BE7-8B3A-2B109991D704}
 		{8C971E86-ACD6-45E6-A4C2-7E0C556152FE} = {45FFB286-52CE-4EB7-8ACE-8B6FBD18D616}
 		{8C971E86-ACD6-45E6-A4C2-7E0C556152FE} = {45FFB286-52CE-4EB7-8ACE-8B6FBD18D616}
 		{B02966BF-88BC-41B2-80EF-8F8C5F98FA98} = {45FFB286-52CE-4EB7-8ACE-8B6FBD18D616}
 		{B02966BF-88BC-41B2-80EF-8F8C5F98FA98} = {45FFB286-52CE-4EB7-8ACE-8B6FBD18D616}
 		{E48F0BAF-BA9B-418B-9B35-8EF212E56C62} = {45FFB286-52CE-4EB7-8ACE-8B6FBD18D616}
 		{E48F0BAF-BA9B-418B-9B35-8EF212E56C62} = {45FFB286-52CE-4EB7-8ACE-8B6FBD18D616}

+ 63 - 0
Shaders/InfiniteGrid/Aether.Shaders.InfiniteGrid.WINDOWS.MG.csproj

@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProductVersion>8.0.30703</ProductVersion>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{08296A2E-BECF-4DB9-A518-8A613D07B80E}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>tainicom.Aether.Shaders</RootNamespace>
+    <AssemblyName>Aether.Shaders.InfiniteGrid</AssemblyName>
+    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>..\..\bin\Debug\Windows\</OutputPath>
+    <DefineConstants>TRACE;DEBUG;WINDOWS MG</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>none</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>..\..\bin\Release\Windows\</OutputPath>
+    <DefineConstants>TRACE;WINDOWS MG</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="System" />
+    <Reference Include="MonoGame.Framework, Version=3.1.2.0, Culture=neutral, processorArchitecture=MSIL">
+      <HintPath>..\..\packages\MonoGame.Framework.Portable.3.2.99.1-Beta\lib\portable-net40+sl40+win+wp80\MonoGame.Framework.dll</HintPath>
+      <SpecificVersion>False</SpecificVersion>
+      <Private>False</Private>
+    </Reference>
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Components\InfiniteGridComponent.cs" />
+    <Compile Include="InfiniteGridEffect.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Properties\AssemblyInfo.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="packages.config" />
+    <EmbeddedResource Include="Resources\InfiniteGridEffect.HiDef.dx11.mgfxo.7" />
+    <EmbeddedResource Include="Resources\InfiniteGridEffect.HiDef.dx11.mgfxo.8" />
+    <EmbeddedResource Include="Resources\InfiniteGridEffect.Reach.dx11.mgfxo.7" />
+    <EmbeddedResource Include="Resources\InfiniteGridEffect.Reach.dx11.mgfxo.8" />
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+</Project>

+ 64 - 0
Shaders/InfiniteGrid/Aether.Shaders.InfiniteGrid.WINDOWS.XNA.csproj

@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
+  <PropertyGroup>
+    <ProjectGuid>{908EC8FF-B0ED-478A-B486-702E578AF64A}</ProjectGuid>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>tainicom.Aether.Shaders</RootNamespace>
+    <AssemblyName>Aether.Shaders.InfiniteGrid</AssemblyName>
+    <XnaFrameworkVersion>v4.0</XnaFrameworkVersion>
+    <XnaPlatform>Windows</XnaPlatform>
+    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>..\..\bin\Debug\Windows.XNA\</OutputPath>
+    <DefineConstants>TRACE;DEBUG;WINDOWS XNA</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <PlatformTarget>x86</PlatformTarget>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
+    <DebugType>none</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>..\..\bin\Release\Windows.XNA\</OutputPath>
+    <DefineConstants>TRACE;WINDOWS XNA</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <PlatformTarget>x86</PlatformTarget>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="Microsoft.Xna.Framework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86" />
+    <Reference Include="Microsoft.Xna.Framework.Game, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86" />
+    <Reference Include="Microsoft.Xna.Framework.Graphics, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86" />
+    <Reference Include="Microsoft.Xna.Framework.Content.Pipeline, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86" />
+    <Reference Include="System" />
+    <Reference Include="System.Core">
+      <RequiredTargetFramework>4.0</RequiredTargetFramework>
+    </Reference>
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Components\InfiniteGridComponent.cs" />
+    <Compile Include="InfiniteGridEffect.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Properties\AssemblyInfo.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <EmbeddedResource Include="Resources\InfiniteGridEffect.HiDef.xna" />
+    <EmbeddedResource Include="Resources\InfiniteGridEffect.Reach.xna" />
+  </ItemGroup>
+  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+  <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\Microsoft.Xna.GameStudio.ContentPipelineExtensions.targets" />
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+     Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+</Project>

+ 107 - 0
Shaders/InfiniteGrid/Components/InfiniteGridComponent.cs

@@ -0,0 +1,107 @@
+using System;
+using Microsoft.Xna.Framework;
+using Microsoft.Xna.Framework.Content;
+using Microsoft.Xna.Framework.Graphics;
+
+namespace tainicom.Aether.Shaders.Components
+{
+    public partial class InfiniteGridComponent : IDrawable, IGameComponent
+    {   
+        private readonly GraphicsDevice GraphicsDevice;
+        private readonly ContentManager _content;
+
+        private VertexBuffer _quadVertexBuffer;
+        private IndexBuffer _quadIndexBuffer;
+        private InfiniteGridEffect _gridEffect;
+
+        public int DrawOrder { get; set; }
+        public bool Visible { get; set; }
+        // TODO: Implement IDrawable Events
+        public event EventHandler<EventArgs> DrawOrderChanged;
+        public event EventHandler<EventArgs> VisibleChanged;
+
+        public Matrix Projection;
+        public Matrix View;
+        public Matrix EditMatrix;
+
+        public InfiniteGridComponent(GraphicsDevice graphicsDevice, ContentManager content)
+        {
+            this.GraphicsDevice = graphicsDevice;
+            this._content = content;
+        }
+                
+        public void Initialize()
+        {
+            this.LoadContent();
+        }
+
+        protected void LoadContent()
+        {
+            _gridEffect = new InfiniteGridEffect(this.GraphicsDevice);
+            
+            var vertices = new VertexPositionNormalTexture[4];
+            vertices[0].Position = new Vector3(-1f, -1f, 1f);
+            vertices[1].Position = new Vector3(+1f, -1f, 1f);
+            vertices[2].Position = new Vector3(+1f, +1f, 1f);
+            vertices[3].Position = new Vector3(-1f, +1f, 1f);
+            vertices[0].Normal = Vector3.Forward;
+            vertices[1].Normal = Vector3.Forward;
+            vertices[2].Normal = Vector3.Forward;
+            vertices[3].Normal = Vector3.Forward;
+            vertices[0].TextureCoordinate = new Vector2(0,0);
+            vertices[1].TextureCoordinate = new Vector2(0,1);
+            vertices[2].TextureCoordinate = new Vector2(1,0);
+            vertices[3].TextureCoordinate = new Vector2(1,1);
+            short[] indices = new short[] { 0, 1, 2, 2, 3, 0 };
+            _quadVertexBuffer = new VertexBuffer(GraphicsDevice, VertexPositionNormalTexture.VertexDeclaration, 4, BufferUsage.None);
+            _quadIndexBuffer = new IndexBuffer(GraphicsDevice, IndexElementSize.SixteenBits, indices.Length, BufferUsage.None);
+            _quadVertexBuffer.SetData(vertices);
+            _quadIndexBuffer.SetData(indices);
+        }
+        
+        protected void UnloadContent()
+        {
+        }
+
+        public virtual void Draw(GameTime gameTime)
+        {
+            this.GraphicsDevice.BlendState = BlendState.AlphaBlend;
+            this.GraphicsDevice.DepthStencilState = DepthStencilState.None;
+            this.GraphicsDevice.RasterizerState = RasterizerState.CullNone;
+            this.GraphicsDevice.SamplerStates[0] = SamplerState.LinearClamp;
+
+            this._gridEffect.SetDefaultParameters(GraphicsDevice.Viewport, this.Projection, this.View, this.EditMatrix);
+            
+            this.GraphicsDevice.SetVertexBuffer(_quadVertexBuffer);
+            this.GraphicsDevice.Indices = _quadIndexBuffer;
+
+            if (GraphicsDevice.GraphicsProfile == GraphicsProfile.Reach)
+            {
+                this._gridEffect.CurrentTechnique = this._gridEffect.Techniques["HorzLinesATechnique"];
+                this._gridEffect.CurrentTechnique.Passes[0].Apply();
+                this.GraphicsDevice.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, 4, 0, 2);
+
+                this._gridEffect.CurrentTechnique = this._gridEffect.Techniques["VertLinesATechnique"];
+                this._gridEffect.CurrentTechnique.Passes[0].Apply();
+                this.GraphicsDevice.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, 4, 0, 2);
+
+                this._gridEffect.CurrentTechnique = this._gridEffect.Techniques["HorzLinesBTechnique"];
+                this._gridEffect.CurrentTechnique.Passes[0].Apply();
+                this.GraphicsDevice.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, 4, 0, 2);
+
+                this._gridEffect.CurrentTechnique = this._gridEffect.Techniques["VertLinesBTechnique"];
+                this._gridEffect.CurrentTechnique.Passes[0].Apply();
+                this.GraphicsDevice.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, 4, 0, 2);
+            }
+            else
+            {
+                this._gridEffect.CurrentTechnique = this._gridEffect.Techniques["GridTechnique"];
+                this._gridEffect.CurrentTechnique.Passes[0].Apply();
+                this.GraphicsDevice.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, 4, 0, 2);
+            }
+            
+            return;
+        }
+        
+    }
+}

+ 202 - 0
Shaders/InfiniteGrid/InfiniteGridEffect.cs

@@ -0,0 +1,202 @@
+#region License
+//   Copyright 2017 Kastellanos Nikolaos
+//
+//   Licensed under the Apache License, Version 2.0 (the "License");
+//   you may not use this file except in compliance with the License.
+//   You may obtain a copy of the License at
+//
+//       http://www.apache.org/licenses/LICENSE-2.0
+//
+//   Unless required by applicable law or agreed to in writing, software
+//   distributed under the License is distributed on an "AS IS" BASIS,
+//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//   See the License for the specific language governing permissions and
+//   limitations under the License.
+#endregion
+
+using System;
+using System.IO;
+using System.Reflection;
+using Microsoft.Xna.Framework;
+using Microsoft.Xna.Framework.Graphics;
+
+namespace tainicom.Aether.Shaders
+{
+    public class InfiniteGridEffect : Effect //, IEffectMatrices
+    {
+        #region Effect Parameters
+
+        EffectParameter diffuseColorParam;
+        EffectParameter worldViewProjectionParam;
+        EffectParameter texelSizeParam;
+        EffectParameter invProjectionParam;
+        EffectParameter InvViewParam;
+        EffectParameter planeNormalParam;
+        EffectParameter planeDParam;
+        EffectParameter InvPlaneMatrixParam;
+
+        #endregion
+
+        #region Fields
+
+        static readonly String ResourceName = "tainicom.Aether.Shaders.Resources.InfiniteGridEffect";
+#if XNA
+        static readonly String PlatformName = ".xna";
+#elif ((MG && WINDOWS) || W8_1 || W10)
+         static readonly String PlatformName = ".dx11.mgfxo";
+#endif
+
+        private static string GetResourceName(GraphicsDevice graphicsDevice)
+        {
+            string profileName = (graphicsDevice.GraphicsProfile == GraphicsProfile.Reach) ? ".Reach" : ".HiDef";
+
+
+            // Detect MG version
+            var version = "";
+#if !XNA
+            var mgVersion = GetAssembly(typeof(Effect)).GetName().Version;
+            if (mgVersion.Major == 3)
+            {
+                if (mgVersion.Minor == 4)
+                    version = ".6";
+                if (mgVersion.Minor == 5)
+                    version = ".7";
+                if (mgVersion.Minor == 6)
+                    version = ".8";
+                if (mgVersion.Minor == 7)
+                    version = ".8";
+            }
+#endif
+
+            return ResourceName + profileName + PlatformName + version;
+        }
+
+        internal static byte[] LoadEffectResource(string name)
+        {
+            using (var stream = GetAssembly(typeof(InfiniteGridEffect)).GetManifestResourceStream(name))
+            using (var ms = new MemoryStream())
+            {
+                stream.CopyTo(ms);
+                return ms.ToArray();
+            }
+        }
+        
+        private static Assembly GetAssembly(Type type)
+        {            
+            #if W8_1 || W10 
+            return type.GetTypeInfo().Assembly;
+            #else
+            return type.Assembly;
+            #endif
+        }
+
+        #endregion
+        
+        #region Public Properties
+
+        public Vector4 DiffuseColor
+        {
+            get { return diffuseColorParam.GetValueVector4(); }
+            set { diffuseColorParam.SetValue(value); }
+        }
+
+        public Vector2 TexelSize
+        {
+            get { return texelSizeParam.GetValueVector2(); }
+            set { texelSizeParam.SetValue(value); }
+        }
+
+        public Matrix InvProjection
+        {
+            get { return invProjectionParam.GetValueMatrix(); }
+            set { invProjectionParam.SetValue(value); }
+        }
+
+        public Matrix InvView
+        {
+            get { return InvViewParam.GetValueMatrix(); }
+            set { InvViewParam.SetValue(value); }
+        }
+        public Matrix InvPlaneMatrix
+        {
+            get { return InvPlaneMatrixParam.GetValueMatrix(); }
+            set { InvPlaneMatrixParam.SetValue(value); }
+        }
+
+        public Vector3 PlaneNormal
+        {
+            get { return planeNormalParam.GetValueVector3(); }
+            set { planeNormalParam.SetValue(value); }
+        }
+
+        public float PlaneD
+        {
+            get { return planeDParam.GetValueSingle(); }
+            set { planeDParam.SetValue(value); }
+        }
+
+        #endregion
+
+        #region Methods
+
+        public InfiniteGridEffect(GraphicsDevice graphicsDevice)
+            : base(graphicsDevice, LoadEffectResource(GetResourceName(graphicsDevice)))
+        {
+            CacheEffectParameters(null);
+            worldViewProjectionParam.SetValue(Matrix.Identity);
+            DiffuseColor = new Vector4(1.0f, 0.64f, 0.0f, 1.0f);
+        }
+
+        public InfiniteGridEffect(GraphicsDevice graphicsDevice, byte[] Bytecode): base(graphicsDevice, Bytecode)
+        {   
+            CacheEffectParameters(null);
+            worldViewProjectionParam.SetValue(Matrix.Identity);
+            DiffuseColor = new Vector4(1.0f, 0.64f, 0.0f, 1.0f);
+        }
+
+        protected InfiniteGridEffect(InfiniteGridEffect cloneSource) : base(cloneSource)
+        {
+            CacheEffectParameters(cloneSource);
+            worldViewProjectionParam.SetValue(Matrix.Identity);
+            
+            DiffuseColor    = cloneSource.DiffuseColor;
+            TexelSize       = cloneSource.TexelSize;
+            InvProjection   = cloneSource.InvProjection;
+            InvView         = cloneSource.InvView;
+            InvPlaneMatrix  = cloneSource.InvPlaneMatrix;
+            PlaneNormal     = cloneSource.PlaneNormal;
+            PlaneD          = cloneSource.PlaneD;
+        }
+        
+        public override Effect Clone()
+        {
+            return new InfiniteGridEffect(this);
+        }
+
+        void CacheEffectParameters(InfiniteGridEffect cloneSource)
+        {
+            diffuseColorParam = Parameters["DiffuseColor"];
+            worldViewProjectionParam = Parameters["WorldViewProjection"];
+            texelSizeParam = Parameters["TexelSize"];
+            invProjectionParam = Parameters["InvProjection"];
+            InvViewParam = Parameters["InvView"];
+            planeNormalParam = Parameters["PlaneNormal"];
+            planeDParam = Parameters["PlaneD"];
+            InvPlaneMatrixParam = Parameters["InvPlaneMatrix"];
+        }
+
+        internal void SetDefaultParameters(Viewport viewport, Matrix projection, Matrix view, Matrix EditMatrix)
+        {
+            var editPlane = new Plane(EditMatrix.Forward, Vector3.Dot(EditMatrix.Forward, EditMatrix.Translation));
+
+            TexelSize = new Vector2(1f / viewport.Width, 1f / viewport.Height);
+            InvProjection = Matrix.Invert(projection);
+            InvView = Matrix.Invert(view);
+            InvPlaneMatrix = Matrix.Invert(EditMatrix);
+            PlaneNormal = editPlane.Normal;
+            PlaneD = editPlane.D;
+        }
+
+        #endregion
+    }
+}

+ 37 - 0
Shaders/InfiniteGrid/Properties/AssemblyInfo.cs

@@ -0,0 +1,37 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+[assembly: AssemblyTitle("Aether.Shaders.InfiniteGrid")]
+[assembly: AssemblyProduct("Aether.Shaders.InfiniteGrid")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyCopyright("Copyright ©  Kastellanos Nikolaos 2017")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible 
+// to COM components.  If you need to access a type in this assembly from 
+// COM, set the ComVisible attribute to true on that type. Only Windows
+// assemblies support COM.
+[assembly: ComVisible(false)]
+
+// On Windows, the following GUID is for the ID of the typelib if this
+// project is exposed to COM. On other platforms, it unique identifies the
+// title storage container when deploying this assembly to the device.
+[assembly: Guid("21144CC2-17D5-480C-9D55-EBDF0F9875FC")]
+
+// Version information for an assembly consists of the following four values:
+//
+//      Major Version
+//      Minor Version 
+//      Build Number
+//      Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers 
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
+

+ 30 - 0
Shaders/InfiniteGrid/Resources/BuildShaders.bat

@@ -0,0 +1,30 @@
+@echo off
+setlocal
+
+cd %~dp0
+
+SET MGFX="C:\Program Files (x86)\MSBuild\MonoGame\v3.0\Tools\2mgfx.exe"
+SET XNAFX="CompileEffect\CompileEffect.exe"
+
+@echo Build dx11
+@for /f %%f IN ('dir /b *.fx') do (
+    call %MGFX% %%~nf.fx %%~nf.dx11.mgfxo /Profile:DirectX_11
+)
+
+@echo Build ogl
+@for /f %%f IN ('dir /b *.fx') do (
+    call %MGFX% %%~nf.fx %%~nf.ogl.mgfxo
+)
+
+@echo Build dx9/xna Reach
+@for /f %%f IN ('dir /b *.Reach.fx') do (
+    call %XNAFX% Windows Reach %%~nf.fx %%~nf.xna
+)
+
+@echo Build dx9/xna HiDef
+@for /f %%f IN ('dir /b *.HiDef.fx') do (
+    call %XNAFX% Windows HiDef %%~nf.fx %%~nf.xna
+)
+
+endlocal
+@pause

BIN
Shaders/InfiniteGrid/Resources/CompileEffect/CompileEffect.exe


+ 3 - 0
Shaders/InfiniteGrid/Resources/CompileEffect/CompileEffect.exe.config

@@ -0,0 +1,3 @@
+<?xml version="1.0"?>
+<configuration>
+<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>

BIN
Shaders/InfiniteGrid/Resources/CompileEffect/Microsoft.Xna.Framework.Content.Pipeline.EffectImporter.dll


BIN
Shaders/InfiniteGrid/Resources/InfiniteGridEffect.HiDef.dx11.mgfxo.7


BIN
Shaders/InfiniteGrid/Resources/InfiniteGridEffect.HiDef.dx11.mgfxo.8


+ 123 - 0
Shaders/InfiniteGrid/Resources/InfiniteGridEffect.HiDef.fx

@@ -0,0 +1,123 @@
+#include "Macros.fxh"
+
+BEGIN_CONSTANTS
+
+float4 DiffuseColor;
+
+float2 TexelSize;
+float3 PlaneNormal;
+float  PlaneD;
+
+MATRIX_CONSTANTS
+matrix WorldViewProjection;
+
+matrix InvProjection;
+matrix InvView;
+matrix InvPlaneMatrix;
+
+END_CONSTANTS
+
+
+struct VertexShaderInput
+{
+	float4 Position : POSITION0;
+    float3 Normal : NORMAL;
+	float4 Texture : TEXCOORD;
+};
+
+struct VertexShaderOutput
+{
+    float4 Position   : SV_POSITION;
+
+    float3 PlanePosA : TEXCOORD0;
+    float3 PlanePosB : TEXCOORD1;
+};
+
+VertexShaderOutput MainVS(in VertexShaderInput input)
+{
+	VertexShaderOutput output = (VertexShaderOutput)0;
+
+    output.Position = mul(input.Position, WorldViewProjection);
+    
+    float4 clipPosA = float4(input.Position.xy, -0.5, 1);
+    float4 viewPosA = mul(clipPosA, InvProjection);
+    float sclA = (((clipPosA.x * InvProjection._14) + (clipPosA.y * InvProjection._24)) + (-0.5f * InvProjection._34)) + InvProjection._44;
+    viewPosA = viewPosA / sclA;
+    float4 worldPosA = mul(viewPosA, InvView);
+    float4 planePosA = mul(worldPosA, InvPlaneMatrix);
+    output.PlanePosA = planePosA.xyz;
+    
+    float4 clipPosB = float4(input.Position.xy, 0.5, 1);
+    float4 viewPosB = mul(clipPosB, InvProjection);
+    float sclB = (((clipPosB.x * InvProjection._14) + (clipPosB.y * InvProjection._24)) + (0.5f * InvProjection._34)) + InvProjection._44;
+    viewPosB = viewPosB / sclB;
+    float4 worldPosB = mul(viewPosB, InvView);
+    float4 planePosB = mul(worldPosB, InvPlaneMatrix);
+    output.PlanePosB = planePosB.xyz;
+
+	return output;
+}
+
+float GridPS(float2 pos, float mag, float lgfrc)
+{    
+    float size = pow(10, mag);
+    pos = pos / size;
+
+    float fracx = frac(pos.x);
+    float fracy = frac(pos.y);
+    float ifracx = 1.0 - fracx;
+    float ifracy = 1.0 - fracy;
+    float fracx_ = max(fracx, ifracx);
+    float fracy_ = max(fracy, ifracy);
+    float frac = max(fracx_, fracy_);
+    frac = (frac - 0.5) * 2;
+    
+    frac = max(0, ((frac - 1) * lgfrc) + 1);
+    
+    float specular = frac;
+    return specular;
+}
+
+float3 RayCastToPlane(float3 planePosA, float3 planePosB)
+{
+    float3 a = planePosA;
+    float3 b = planePosB;
+    
+    float3 ab = b - a;
+    float t = (-a.z) / ab.z;
+
+    if (t < 0)
+        return float3(0, 0, 0);
+    
+    t = max(0, t);
+    float3 q = a + ab * t;
+
+    return q;
+}
+
+float4 MainPS(VertexShaderOutput input) : COLOR
+{
+    float3 q = RayCastToPlane(input.PlanePosA, input.PlanePosB);
+
+	// PS 3.0
+	float2 fw2 = fwidth((float2) q);
+	if(fw2.x == 0 && fw2.y ==0)
+        return float4(0, 0, 0, 0);
+    float fw = min(fw2.x, fw2.y);
+	
+	float2 pos = q.xy;
+
+    float logfw = log10(fw)+2;
+    float logfwfrac = frac(logfw);
+    float ilogfw = logfw - logfwfrac;
+    
+    float specular1 = GridPS(pos, ilogfw + 1, 10 + 90 * (1-logfwfrac));
+    float specular2 = GridPS(pos, ilogfw, 10 + (1 - logfwfrac)) * (1 - logfwfrac);
+    float specular = max(specular1, specular2);
+    
+    return DiffuseColor * specular;
+}
+
+
+TECHNIQUE_9_3(GridTechnique, MainVS, MainPS);
+

BIN
Shaders/InfiniteGrid/Resources/InfiniteGridEffect.HiDef.ogl.mgfxo.7


BIN
Shaders/InfiniteGrid/Resources/InfiniteGridEffect.HiDef.ogl.mgfxo.8


BIN
Shaders/InfiniteGrid/Resources/InfiniteGridEffect.HiDef.xna


BIN
Shaders/InfiniteGrid/Resources/InfiniteGridEffect.Reach.dx11.mgfxo.7


BIN
Shaders/InfiniteGrid/Resources/InfiniteGridEffect.Reach.dx11.mgfxo.8


+ 213 - 0
Shaders/InfiniteGrid/Resources/InfiniteGridEffect.Reach.fx

@@ -0,0 +1,213 @@
+#include "Macros.fxh"
+
+BEGIN_CONSTANTS
+
+float4 DiffuseColor;
+
+float2 TexelSize;
+float3 PlaneNormal;
+float  PlaneD;
+
+MATRIX_CONSTANTS
+matrix WorldViewProjection;
+
+matrix InvProjection;
+matrix InvView;
+matrix InvPlaneMatrix;
+
+END_CONSTANTS
+
+
+struct VertexShaderInput
+{
+	float4 Position : POSITION0;
+    float3 Normal : NORMAL;
+	float4 Texture : TEXCOORD;
+};
+
+struct VertexShaderOutput
+{
+    float4 Position   : SV_POSITION;
+    
+    float3 PlanePosA  : TEXCOORD0;
+    float3 PlanePosB  : TEXCOORD1;
+
+    float3 PlanePosA2 : TEXCOORD2;
+    float3 PlanePosB2 : TEXCOORD3;
+};
+
+VertexShaderOutput MainVS(in VertexShaderInput input)
+{
+	VertexShaderOutput output = (VertexShaderOutput)0;
+
+    output.Position = mul(input.Position, WorldViewProjection);
+
+    float4 clipPosA = float4(input.Position.xy, -0.5, 1);
+    float4 viewPosA = mul(clipPosA, InvProjection);
+    float sclA = (((clipPosA.x * InvProjection._14) + (clipPosA.y * InvProjection._24)) + (-0.5f * InvProjection._34)) + InvProjection._44;
+    viewPosA = viewPosA / sclA;
+    float4 worldPosA = mul(viewPosA, InvView);
+    float4 planePosA = mul(worldPosA, InvPlaneMatrix);
+    output.PlanePosA = planePosA.xyz;
+    
+    float4 clipPosB = float4(input.Position.xy, 0.5, 1);
+    float4 viewPosB = mul(clipPosB, InvProjection);
+    float sclB = (((clipPosB.x * InvProjection._14) + (clipPosB.y * InvProjection._24)) + (0.5f * InvProjection._34)) + InvProjection._44;
+    viewPosB = viewPosB / sclB;
+    float4 worldPosB = mul(viewPosB, InvView);
+    float4 planePosB = mul(worldPosB, InvPlaneMatrix);
+    output.PlanePosB = planePosB.xyz;
+
+    float4 clipPosA2 = float4(input.Position.xy + TexelSize, -0.5, 1);
+    float4 viewPosA2 = mul(clipPosA2, InvProjection);
+    float sclA2 = (((clipPosA2.x * InvProjection._14) + (clipPosA2.y * InvProjection._24)) + (-0.5f * InvProjection._34)) + InvProjection._44;
+    viewPosA2 = viewPosA2 / sclA2;
+    float4 worldPosA2 = mul(viewPosA2, InvView);
+    float4 planePosA2 = mul(worldPosA2, InvPlaneMatrix);
+    output.PlanePosA2 = planePosA2.xyz;
+
+    float4 clipPosB2 = float4(input.Position.xy + TexelSize, 0.5, 1);
+    float4 viewPosB2 = mul(clipPosB2, InvProjection);
+    float sclB2 = (((viewPosB2.x * InvProjection._14) + (viewPosB2.y * InvProjection._24)) + (0.5f * InvProjection._34)) + InvProjection._44;
+    viewPosB2 = viewPosB2 / sclB2;
+    float4 worldPosB2 = mul(viewPosB2, InvView);
+    float4 planePosB2 = mul(worldPosB2, InvPlaneMatrix);
+    output.PlanePosB2 = planePosB2.xyz;
+    
+	return output;
+}
+
+float HLinesPS(float posx, float mag, float lgfrc)
+{
+    float size = pow(10, mag);
+    posx = posx / size;
+
+    float fracx = frac(posx);
+    float ifracx = 1.0 - fracx;
+    float frac = max(fracx, ifracx);
+    frac = (frac - 0.5) * 2;
+    
+    frac = max(0, ((frac - 1) * lgfrc) + 1);
+    
+    float specular = frac;
+    return specular;
+}
+
+float VLinesPS(float posy, float mag, float lgfrc)
+{
+    float size = pow(10, mag);
+    posy = posy / size;
+
+    float fracy = frac(posy);
+    float ifracy = 1.0 - fracy;
+    float frac = max(fracy, ifracy);
+    frac = (frac - 0.5) * 2;
+    
+    frac = max(0, ((frac - 1) * lgfrc) + 1);
+    
+    float specular = frac;
+    return specular;
+}
+
+float3 RayCastToPlane(float3 planePosA, float3 planePosB)
+{   
+    float3 a = planePosA;
+    float3 b = planePosB;
+    
+    float3 ab = b - a;
+    float t = (-a.z) / ab.z;
+
+    if (t < 0)
+        return float3(0, 0, 0);
+
+    t = max(0, t);
+    float3 q = a + ab * t;
+
+    return q;
+}
+
+float4 HMainAPS(VertexShaderOutput input) : COLOR
+{   
+    float3 q = RayCastToPlane(input.PlanePosA, input.PlanePosB);
+
+	// PS 2.0 
+    float3 q2 = RayCastToPlane(input.PlanePosA2, input.PlanePosB2);
+	float2 fw2 = (float2)(q2 - q);
+	if(fw2.x == 0 && fw2.y ==0)
+        return float4(0, 0, 0, 0);
+    float fw = abs(fw2.x);
+	
+    float logfw = log10(fw) + 2;
+    float logfwfrac = frac(logfw);
+    float ilogfw = logfw - logfwfrac;
+    
+    float specular = HLinesPS(q.x, ilogfw, 10 + (1 - logfwfrac)) * (1 - logfwfrac);
+    
+    return DiffuseColor * specular;
+}
+
+float4 VMainAPS(VertexShaderOutput input) : COLOR
+{
+    float3 q = RayCastToPlane(input.PlanePosA, input.PlanePosB);
+
+	// PS 2.0 
+    float3 q2 = RayCastToPlane(input.PlanePosA2, input.PlanePosB2);
+	float2 fw2 = (float2)(q2 - q);
+	if(fw2.x == 0 && fw2.y ==0)
+        return float4(0, 0, 0, 0);
+    float fw = abs(fw2.y);
+
+    float logfw = log10(fw) + 2;
+    float logfwfrac = frac(logfw);
+    float ilogfw = logfw - logfwfrac;
+    
+    float specular = VLinesPS(q.y, ilogfw, 10 + (1 - logfwfrac)) * (1 - logfwfrac);
+    
+    return DiffuseColor * specular;
+}
+
+float4 HMainBPS(VertexShaderOutput input) : COLOR
+{
+    float3 q = RayCastToPlane(input.PlanePosA, input.PlanePosB);
+
+	// PS 2.0 
+    float3 q2 = RayCastToPlane(input.PlanePosA2, input.PlanePosB2);
+	float2 fw2 = (float2)(q2 - q);
+	if(fw2.x == 0 && fw2.y ==0)
+        return float4(0, 0, 0, 0);
+    float fw = abs(fw2.x);
+	
+    float logfw = log10(fw) + 2;
+    float logfwfrac = frac(logfw);
+    float ilogfw = logfw - logfwfrac;
+    
+    float specular = HLinesPS(q.x, ilogfw+1, 10 + 90 * (1 - logfwfrac));
+    
+    return DiffuseColor * specular;
+}
+
+float4 VMainBPS(VertexShaderOutput input) : COLOR
+{
+    float3 q = RayCastToPlane(input.PlanePosA, input.PlanePosB);
+
+	// PS 2.0 
+    float3 q2 = RayCastToPlane(input.PlanePosA2, input.PlanePosB2);
+    float2 fw2 = (float2) (q2 - q);
+	if(fw2.x == 0 && fw2.y ==0)
+        return float4(0, 0, 0, 0);
+    float fw = abs(fw2.y);
+
+    float logfw = log10(fw) + 2;
+    float logfwfrac = frac(logfw);
+    float ilogfw = logfw - logfwfrac;
+    
+    float specular = VLinesPS(q.y, ilogfw+1, 10 + 90 * (1 - logfwfrac));
+    
+    return DiffuseColor * specular;
+}
+
+TECHNIQUE(HorzLinesATechnique, MainVS, HMainAPS);
+TECHNIQUE(VertLinesATechnique, MainVS, VMainAPS);
+TECHNIQUE(HorzLinesBTechnique, MainVS, HMainBPS);
+TECHNIQUE(VertLinesBTechnique, MainVS, VMainBPS);
+

BIN
Shaders/InfiniteGrid/Resources/InfiniteGridEffect.Reach.ogl.mgfxo.7


BIN
Shaders/InfiniteGrid/Resources/InfiniteGridEffect.Reach.ogl.mgfxo.8


BIN
Shaders/InfiniteGrid/Resources/InfiniteGridEffect.Reach.xna


+ 67 - 0
Shaders/InfiniteGrid/Resources/Macros.fxh

@@ -0,0 +1,67 @@
+//-----------------------------------------------------------------------------
+// Macros.fxh
+//
+// Microsoft XNA Community Game Platform
+// Copyright (C) Microsoft Corporation. All rights reserved.
+//-----------------------------------------------------------------------------
+
+#ifdef SM4
+
+// Macros for targetting shader model 4.0 (DX11)
+
+#define TECHNIQUE(name, vsname, psname ) \
+	technique name { pass { VertexShader = compile vs_4_0_level_9_1 vsname (); PixelShader = compile ps_4_0_level_9_1 psname(); } }
+
+#define TECHNIQUE_9_3(name, vsname, psname ) \
+	technique name { pass { VertexShader = compile vs_4_0_level_9_3 vsname (); PixelShader = compile ps_4_0_level_9_3 psname(); } }
+
+#define BEGIN_CONSTANTS     cbuffer Parameters : register(b0) {
+#define MATRIX_CONSTANTS
+#define END_CONSTANTS       };
+
+#define _vs(r)
+#define _ps(r)
+#define _cb(r)
+
+#define DECLARE_TEXTURE(Name, index) \
+    Texture2D<float4> Name : register(t##index); \
+    sampler Name##Sampler : register(s##index)
+
+#define DECLARE_CUBEMAP(Name, index) \
+    TextureCube<float4> Name : register(t##index); \
+    sampler Name##Sampler : register(s##index)
+
+#define SAMPLE_TEXTURE(Name, texCoord)  Name.Sample(Name##Sampler, texCoord)
+#define SAMPLE_CUBEMAP(Name, texCoord)  Name.Sample(Name##Sampler, texCoord)
+
+
+#else
+
+
+// Macros for targetting shader model 2.0 (DX9)
+
+#define TECHNIQUE(name, vsname, psname ) \
+	technique name { pass { VertexShader = compile vs_2_0 vsname (); PixelShader = compile ps_2_0 psname(); } }
+
+#define TECHNIQUE_9_3(name, vsname, psname ) \
+	technique name { pass { VertexShader = compile vs_3_0 vsname (); PixelShader = compile ps_3_0 psname(); } }
+
+#define BEGIN_CONSTANTS
+#define MATRIX_CONSTANTS
+#define END_CONSTANTS
+
+#define _vs(r)  : register(vs, r)
+#define _ps(r)  : register(ps, r)
+#define _cb(r)
+
+#define DECLARE_TEXTURE(Name, index) \
+    sampler2D Name : register(s##index);
+
+#define DECLARE_CUBEMAP(Name, index) \
+    samplerCUBE Name : register(s##index);
+
+#define SAMPLE_TEXTURE(Name, texCoord)  tex2D(Name, texCoord)
+#define SAMPLE_CUBEMAP(Name, texCoord)  texCUBE(Name, texCoord)
+
+
+#endif

+ 4 - 0
Shaders/InfiniteGrid/packages.config

@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+  <package id="MonoGame.Framework.Portable" version="3.2.99.1-Beta" targetFramework="portable-net45+win+wp80+MonoAndroid10+xamarinios10+MonoTouch10" />
+</packages>

BIN
bin/Release/Windows.XNA/Aether.Shaders.InfiniteGrid.dll


BIN
bin/Release/Windows/Aether.Shaders.InfiniteGrid.dll