Browse Source

import

master
宮崎 哲 10 years ago
commit
5a572cf7c5
  1. 912
      Bushin.xcodeproj/project.pbxproj
  2. 7
      Bushin.xcodeproj/project.xcworkspace/contents.xcworkspacedata
  3. BIN
      Bushin.xcodeproj/project.xcworkspace/xcuserdata/miyazaki.xcuserdatad/UserInterfaceState.xcuserstate
  4. 193
      Bushin.xcodeproj/xcuserdata/miyazaki.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
  5. 96
      Bushin.xcodeproj/xcuserdata/miyazaki.xcuserdatad/xcschemes/Bushin.xcscheme
  6. 27
      Bushin.xcodeproj/xcuserdata/miyazaki.xcuserdatad/xcschemes/xcschememanagement.plist
  7. 42
      Bushin/Bushin-Info.plist
  8. 23
      Bushin/Bushin-Prefix.pch
  9. 23
      Bushin/Images.xcassets/AppIcon.appiconset/Contents.json
  10. 23
      Bushin/Images.xcassets/LaunchImage.launchimage/Contents.json
  11. 2
      Bushin/en.lproj/InfoPlist.strings
  12. BIN
      Bushin/images/facility1.png
  13. BIN
      Bushin/images/facility10.png
  14. BIN
      Bushin/images/facility11.png
  15. BIN
      Bushin/images/facility12.png
  16. BIN
      Bushin/images/facility13.png
  17. BIN
      Bushin/images/facility14.png
  18. BIN
      Bushin/images/facility15.png
  19. BIN
      Bushin/images/facility16.png
  20. BIN
      Bushin/images/facility17.png
  21. BIN
      Bushin/images/facility18.png
  22. BIN
      Bushin/images/facility19.png
  23. BIN
      Bushin/images/facility2.png
  24. BIN
      Bushin/images/facility20.png
  25. BIN
      Bushin/images/facility21.png
  26. BIN
      Bushin/images/facility22.png
  27. BIN
      Bushin/images/facility23.png
  28. BIN
      Bushin/images/facility24.png
  29. BIN
      Bushin/images/facility25.png
  30. BIN
      Bushin/images/facility3.png
  31. BIN
      Bushin/images/facility4.png
  32. BIN
      Bushin/images/facility5.png
  33. BIN
      Bushin/images/facility6.png
  34. BIN
      Bushin/images/facility7.png
  35. BIN
      Bushin/images/facility8.png
  36. BIN
      Bushin/images/facility9.png
  37. BIN
      Bushin/images/menu0.png
  38. BIN
      Bushin/images/menu1.png
  39. BIN
      Bushin/images/menu10.png
  40. BIN
      Bushin/images/menu11.png
  41. BIN
      Bushin/images/menu12.png
  42. BIN
      Bushin/images/menu13.png
  43. BIN
      Bushin/images/menu14.png
  44. BIN
      Bushin/images/menu15.png
  45. BIN
      Bushin/images/menu16.png
  46. BIN
      Bushin/images/menu2.png
  47. BIN
      Bushin/images/menu3.png
  48. BIN
      Bushin/images/menu4.png
  49. BIN
      Bushin/images/menu5.png
  50. BIN
      Bushin/images/menu6.png
  51. BIN
      Bushin/images/menu7.png
  52. BIN
      Bushin/images/menu8.png
  53. BIN
      Bushin/images/menu9.png
  54. 18
      Bushin/main.mm
  55. 219
      Bushin/media/RTShaderLib/FFPLib_Common.cg
  56. 227
      Bushin/media/RTShaderLib/FFPLib_Common.glsl
  57. 231
      Bushin/media/RTShaderLib/FFPLib_Common.glsles
  58. 219
      Bushin/media/RTShaderLib/FFPLib_Common.hlsl
  59. 138
      Bushin/media/RTShaderLib/FFPLib_Fog.cg
  60. 139
      Bushin/media/RTShaderLib/FFPLib_Fog.glsl
  61. 141
      Bushin/media/RTShaderLib/FFPLib_Fog.glsles
  62. 138
      Bushin/media/RTShaderLib/FFPLib_Fog.hlsl
  63. 225
      Bushin/media/RTShaderLib/FFPLib_Lighting.cg
  64. 226
      Bushin/media/RTShaderLib/FFPLib_Lighting.glsl
  65. 227
      Bushin/media/RTShaderLib/FFPLib_Lighting.glsles
  66. 225
      Bushin/media/RTShaderLib/FFPLib_Lighting.hlsl
  67. 319
      Bushin/media/RTShaderLib/FFPLib_Texturing.cg
  68. 334
      Bushin/media/RTShaderLib/FFPLib_Texturing.glsl
  69. 355
      Bushin/media/RTShaderLib/FFPLib_Texturing.glsles
  70. 319
      Bushin/media/RTShaderLib/FFPLib_Texturing.hlsl
  71. 72
      Bushin/media/RTShaderLib/FFPLib_Transform.cg
  72. 80
      Bushin/media/RTShaderLib/FFPLib_Transform.glsl
  73. 65
      Bushin/media/RTShaderLib/FFPLib_Transform.glsles
  74. 71
      Bushin/media/RTShaderLib/FFPLib_Transform.hlsl
  75. 81
      Bushin/media/RTShaderLib/SGXLib_IntegratedPSSM.cg
  76. 107
      Bushin/media/RTShaderLib/SGXLib_IntegratedPSSM.glsl
  77. 112
      Bushin/media/RTShaderLib/SGXLib_IntegratedPSSM.glsles
  78. 81
      Bushin/media/RTShaderLib/SGXLib_IntegratedPSSM.hlsl
  79. 728
      Bushin/media/RTShaderLib/SGXLib_LayeredBlending.cg
  80. 825
      Bushin/media/RTShaderLib/SGXLib_LayeredBlending.glsl
  81. 887
      Bushin/media/RTShaderLib/SGXLib_LayeredBlending.glsles
  82. 730
      Bushin/media/RTShaderLib/SGXLib_LayeredBlending.hlsl
  83. 257
      Bushin/media/RTShaderLib/SGXLib_NormalMapLighting.cg
  84. 269
      Bushin/media/RTShaderLib/SGXLib_NormalMapLighting.glsl
  85. 264
      Bushin/media/RTShaderLib/SGXLib_NormalMapLighting.glsles
  86. 257
      Bushin/media/RTShaderLib/SGXLib_NormalMapLighting.hlsl
  87. 226
      Bushin/media/RTShaderLib/SGXLib_PerPixelLighting.cg
  88. 228
      Bushin/media/RTShaderLib/SGXLib_PerPixelLighting.glsl
  89. 223
      Bushin/media/RTShaderLib/SGXLib_PerPixelLighting.glsles
  90. 226
      Bushin/media/RTShaderLib/SGXLib_PerPixelLighting.hlsl
  91. 98
      Bushin/media/RTShaderLib/SGXLib_TextureAtlas.cg
  92. 99
      Bushin/media/RTShaderLib/SGXLib_TextureAtlas.glsl
  93. 99
      Bushin/media/RTShaderLib/SGXLib_TextureAtlas.glsles
  94. 99
      Bushin/media/RTShaderLib/SGXLib_TextureAtlas.hlsl
  95. 76
      Bushin/media/RTShaderLib/SampleLib_InstancedViewports.cg
  96. 78
      Bushin/media/RTShaderLib/SampleLib_InstancedViewports.glsl
  97. 76
      Bushin/media/RTShaderLib/SampleLib_InstancedViewports.hlsl
  98. 62
      Bushin/media/RTShaderLib/SampleLib_ReflectionMap.cg
  99. 65
      Bushin/media/RTShaderLib/SampleLib_ReflectionMap.glsl
  100. 67
      Bushin/media/RTShaderLib/SampleLib_ReflectionMap.glsles

912
Bushin.xcodeproj/project.pbxproj

@ -0,0 +1,912 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
3E13CFF8193E146E003C6063 /* Scene.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3E13CFF6193E146E003C6063 /* Scene.cpp */; };
3E13CFFB193E179F003C6063 /* SceneState.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3E13CFF9193E179F003C6063 /* SceneState.cpp */; };
3E59CA991926F26500EE89D2 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3E59CA981926F26500EE89D2 /* Foundation.framework */; };
3E59CA9B1926F26500EE89D2 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3E59CA9A1926F26500EE89D2 /* CoreGraphics.framework */; };
3E59CA9D1926F26500EE89D2 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3E59CA9C1926F26500EE89D2 /* UIKit.framework */; };
3E59CA9F1926F26500EE89D2 /* GLKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3E59CA9E1926F26500EE89D2 /* GLKit.framework */; };
3E59CAA11926F26500EE89D2 /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3E59CAA01926F26500EE89D2 /* OpenGLES.framework */; };
3E59CAA71926F26600EE89D2 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 3E59CAA51926F26600EE89D2 /* InfoPlist.strings */; };
3E59CAA91926F26600EE89D2 /* main.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3E59CAA81926F26600EE89D2 /* main.mm */; };
3E59CAB91926F26600EE89D2 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3E59CAB81926F26600EE89D2 /* Images.xcassets */; };
3E59CAC01926F26700EE89D2 /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3E59CABF1926F26700EE89D2 /* XCTest.framework */; };
3E59CAC11926F26700EE89D2 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3E59CA981926F26500EE89D2 /* Foundation.framework */; };
3E59CAC21926F26700EE89D2 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3E59CA9C1926F26500EE89D2 /* UIKit.framework */; };
3E59CACA1926F26700EE89D2 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 3E59CAC81926F26700EE89D2 /* InfoPlist.strings */; };
3E59CACC1926F26700EE89D2 /* BushinTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 3E59CACB1926F26700EE89D2 /* BushinTests.m */; };
3E9EAE381951CA1B0083DBAA /* FacilitySelectMenuView.m in Sources */ = {isa = PBXBuildFile; fileRef = 3E9EAE371951CA1B0083DBAA /* FacilitySelectMenuView.m */; };
3E9EAE3E1951D6290083DBAA /* facility1.png in Resources */ = {isa = PBXBuildFile; fileRef = 3E9EAE391951D6280083DBAA /* facility1.png */; };
3E9EAE3F1951D6290083DBAA /* facility2.png in Resources */ = {isa = PBXBuildFile; fileRef = 3E9EAE3A1951D6290083DBAA /* facility2.png */; };
3E9EAE401951D6290083DBAA /* facility3.png in Resources */ = {isa = PBXBuildFile; fileRef = 3E9EAE3B1951D6290083DBAA /* facility3.png */; };
3E9EAE411951D6290083DBAA /* facility4.png in Resources */ = {isa = PBXBuildFile; fileRef = 3E9EAE3C1951D6290083DBAA /* facility4.png */; };
3E9EAE421951D6290083DBAA /* facility5.png in Resources */ = {isa = PBXBuildFile; fileRef = 3E9EAE3D1951D6290083DBAA /* facility5.png */; };
3E9EAE481951D9710083DBAA /* facility6.png in Resources */ = {isa = PBXBuildFile; fileRef = 3E9EAE431951D9710083DBAA /* facility6.png */; };
3E9EAE491951D9710083DBAA /* facility7.png in Resources */ = {isa = PBXBuildFile; fileRef = 3E9EAE441951D9710083DBAA /* facility7.png */; };
3E9EAE4A1951D9710083DBAA /* facility8.png in Resources */ = {isa = PBXBuildFile; fileRef = 3E9EAE451951D9710083DBAA /* facility8.png */; };
3E9EAE4B1951D9710083DBAA /* facility9.png in Resources */ = {isa = PBXBuildFile; fileRef = 3E9EAE461951D9710083DBAA /* facility9.png */; };
3E9EAE4C1951D9710083DBAA /* facility10.png in Resources */ = {isa = PBXBuildFile; fileRef = 3E9EAE471951D9710083DBAA /* facility10.png */; };
3E9EAE521951DBCF0083DBAA /* facility11.png in Resources */ = {isa = PBXBuildFile; fileRef = 3E9EAE4D1951DBCF0083DBAA /* facility11.png */; };
3E9EAE531951DBCF0083DBAA /* facility12.png in Resources */ = {isa = PBXBuildFile; fileRef = 3E9EAE4E1951DBCF0083DBAA /* facility12.png */; };
3E9EAE541951DBCF0083DBAA /* facility13.png in Resources */ = {isa = PBXBuildFile; fileRef = 3E9EAE4F1951DBCF0083DBAA /* facility13.png */; };
3E9EAE551951DBCF0083DBAA /* facility14.png in Resources */ = {isa = PBXBuildFile; fileRef = 3E9EAE501951DBCF0083DBAA /* facility14.png */; };
3E9EAE561951DBCF0083DBAA /* facility15.png in Resources */ = {isa = PBXBuildFile; fileRef = 3E9EAE511951DBCF0083DBAA /* facility15.png */; };
3E9EAE601951E1650083DBAA /* facility17.png in Resources */ = {isa = PBXBuildFile; fileRef = 3E9EAE571951E1650083DBAA /* facility17.png */; };
3E9EAE611951E1650083DBAA /* facility18.png in Resources */ = {isa = PBXBuildFile; fileRef = 3E9EAE581951E1650083DBAA /* facility18.png */; };
3E9EAE621951E1650083DBAA /* facility19.png in Resources */ = {isa = PBXBuildFile; fileRef = 3E9EAE591951E1650083DBAA /* facility19.png */; };
3E9EAE631951E1650083DBAA /* facility20.png in Resources */ = {isa = PBXBuildFile; fileRef = 3E9EAE5A1951E1650083DBAA /* facility20.png */; };
3E9EAE641951E1650083DBAA /* facility21.png in Resources */ = {isa = PBXBuildFile; fileRef = 3E9EAE5B1951E1650083DBAA /* facility21.png */; };
3E9EAE651951E1650083DBAA /* facility22.png in Resources */ = {isa = PBXBuildFile; fileRef = 3E9EAE5C1951E1650083DBAA /* facility22.png */; };
3E9EAE661951E1650083DBAA /* facility23.png in Resources */ = {isa = PBXBuildFile; fileRef = 3E9EAE5D1951E1650083DBAA /* facility23.png */; };
3E9EAE671951E1650083DBAA /* facility24.png in Resources */ = {isa = PBXBuildFile; fileRef = 3E9EAE5E1951E1650083DBAA /* facility24.png */; };
3E9EAE681951E1650083DBAA /* facility25.png in Resources */ = {isa = PBXBuildFile; fileRef = 3E9EAE5F1951E1650083DBAA /* facility25.png */; };
3E9EAE6A1951E1990083DBAA /* facility16.png in Resources */ = {isa = PBXBuildFile; fileRef = 3E9EAE691951E1990083DBAA /* facility16.png */; };
3E9EAE6D195254290083DBAA /* FacilityBuildView.m in Sources */ = {isa = PBXBuildFile; fileRef = 3E9EAE6C195254290083DBAA /* FacilityBuildView.m */; };
3EC85E471928FD0D006EDF6E /* AppDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3EC85E261928FD0D006EDF6E /* AppDelegate.mm */; };
3EC85E481928FD0D006EDF6E /* LoginViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3EC85E291928FD0D006EDF6E /* LoginViewController.mm */; };
3EC85E491928FD0D006EDF6E /* MainViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3EC85E2B1928FD0D006EDF6E /* MainViewController.mm */; };
3EC85E4A1928FD0D006EDF6E /* Entity.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3EC85E2C1928FD0D006EDF6E /* Entity.cpp */; };
3EC85E4B1928FD0D006EDF6E /* GameApp.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3EC85E2F1928FD0D006EDF6E /* GameApp.mm */; };
3EC85E4C1928FD0D006EDF6E /* GameBase.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3EC85E311928FD0D006EDF6E /* GameBase.mm */; };
3EC85E4D1928FD0D006EDF6E /* GameState.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3EC85E331928FD0D006EDF6E /* GameState.mm */; };
3EC85E4E1928FD0D006EDF6E /* ModeSelectViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3EC85E351928FD0D006EDF6E /* ModeSelectViewController.mm */; };
3EC85E501928FD0D006EDF6E /* InfoViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3EC85E3A1928FD0D006EDF6E /* InfoViewController.mm */; };
3EC85E511928FD0D006EDF6E /* StateMachine.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3EC85E3E1928FD0D006EDF6E /* StateMachine.cpp */; };
3EC85E521928FD0D006EDF6E /* WebView.m in Sources */ = {isa = PBXBuildFile; fileRef = 3EC85E411928FD0D006EDF6E /* WebView.m */; };
3EC85E5A1928FD4C006EDF6E /* ogre.cfg in Resources */ = {isa = PBXBuildFile; fileRef = 3EC85E571928FD4C006EDF6E /* ogre.cfg */; };
3EC85E5B1928FD4C006EDF6E /* plugins.cfg in Resources */ = {isa = PBXBuildFile; fileRef = 3EC85E581928FD4C006EDF6E /* plugins.cfg */; };
3EC85E5C1928FD4C006EDF6E /* resources.cfg in Resources */ = {isa = PBXBuildFile; fileRef = 3EC85E591928FD4C006EDF6E /* resources.cfg */; };
3EC85E5E192902C3006EDF6E /* boost.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3EC85E5D192902C3006EDF6E /* boost.framework */; };
3ECE24811939BC0C00049889 /* media in Resources */ = {isa = PBXBuildFile; fileRef = 3ECE24801939BC0C00049889 /* media */; };
3ECE2484193AA3B600049889 /* OpenningViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3ECE2483193AA3B600049889 /* OpenningViewController.mm */; };
3ECE248A193B1BCE00049889 /* User.m in Sources */ = {isa = PBXBuildFile; fileRef = 3ECE2489193B1BCE00049889 /* User.m */; };
3ECE248D193D378F00049889 /* MenuView.m in Sources */ = {isa = PBXBuildFile; fileRef = 3ECE248C193D378F00049889 /* MenuView.m */; };
3EDFB2741947D7B300CEA48D /* menu0.png in Resources */ = {isa = PBXBuildFile; fileRef = 3EDFB2631947D7B300CEA48D /* menu0.png */; };
3EDFB2751947D7B300CEA48D /* menu1.png in Resources */ = {isa = PBXBuildFile; fileRef = 3EDFB2641947D7B300CEA48D /* menu1.png */; };
3EDFB2761947D7B300CEA48D /* menu10.png in Resources */ = {isa = PBXBuildFile; fileRef = 3EDFB2651947D7B300CEA48D /* menu10.png */; };
3EDFB2771947D7B300CEA48D /* menu11.png in Resources */ = {isa = PBXBuildFile; fileRef = 3EDFB2661947D7B300CEA48D /* menu11.png */; };
3EDFB2781947D7B300CEA48D /* menu12.png in Resources */ = {isa = PBXBuildFile; fileRef = 3EDFB2671947D7B300CEA48D /* menu12.png */; };
3EDFB2791947D7B300CEA48D /* menu13.png in Resources */ = {isa = PBXBuildFile; fileRef = 3EDFB2681947D7B300CEA48D /* menu13.png */; };
3EDFB27A1947D7B300CEA48D /* menu14.png in Resources */ = {isa = PBXBuildFile; fileRef = 3EDFB2691947D7B300CEA48D /* menu14.png */; };
3EDFB27B1947D7B300CEA48D /* menu15.png in Resources */ = {isa = PBXBuildFile; fileRef = 3EDFB26A1947D7B300CEA48D /* menu15.png */; };
3EDFB27C1947D7B300CEA48D /* menu16.png in Resources */ = {isa = PBXBuildFile; fileRef = 3EDFB26B1947D7B300CEA48D /* menu16.png */; };
3EDFB27D1947D7B300CEA48D /* menu2.png in Resources */ = {isa = PBXBuildFile; fileRef = 3EDFB26C1947D7B300CEA48D /* menu2.png */; };
3EDFB27E1947D7B300CEA48D /* menu3.png in Resources */ = {isa = PBXBuildFile; fileRef = 3EDFB26D1947D7B300CEA48D /* menu3.png */; };
3EDFB27F1947D7B300CEA48D /* menu4.png in Resources */ = {isa = PBXBuildFile; fileRef = 3EDFB26E1947D7B300CEA48D /* menu4.png */; };
3EDFB2801947D7B300CEA48D /* menu5.png in Resources */ = {isa = PBXBuildFile; fileRef = 3EDFB26F1947D7B300CEA48D /* menu5.png */; };
3EDFB2811947D7B300CEA48D /* menu6.png in Resources */ = {isa = PBXBuildFile; fileRef = 3EDFB2701947D7B300CEA48D /* menu6.png */; };
3EDFB2821947D7B300CEA48D /* menu7.png in Resources */ = {isa = PBXBuildFile; fileRef = 3EDFB2711947D7B300CEA48D /* menu7.png */; };
3EDFB2831947D7B300CEA48D /* menu8.png in Resources */ = {isa = PBXBuildFile; fileRef = 3EDFB2721947D7B300CEA48D /* menu8.png */; };
3EDFB2841947D7B300CEA48D /* menu9.png in Resources */ = {isa = PBXBuildFile; fileRef = 3EDFB2731947D7B300CEA48D /* menu9.png */; };
3EEF741A194336350047C87C /* Base.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3EEF7418194336350047C87C /* Base.cpp */; };
3EEF741D194339160047C87C /* Facility.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3EEF741B194339160047C87C /* Facility.mm */; };
3EEF7420194496FA0047C87C /* FacilityState.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3EEF741E194496FA0047C87C /* FacilityState.mm */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
3E59CAC31926F26700EE89D2 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 3E59CA8D1926F26500EE89D2 /* Project object */;
proxyType = 1;
remoteGlobalIDString = 3E59CA941926F26500EE89D2;
remoteInfo = Bushin;
};
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
3E13CFF6193E146E003C6063 /* Scene.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Scene.cpp; sourceTree = "<group>"; };
3E13CFF7193E146E003C6063 /* Scene.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Scene.h; sourceTree = "<group>"; };
3E13CFF9193E179F003C6063 /* SceneState.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SceneState.cpp; sourceTree = "<group>"; };
3E13CFFA193E179F003C6063 /* SceneState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SceneState.h; sourceTree = "<group>"; };
3E59CA951926F26500EE89D2 /* Bushin.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Bushin.app; sourceTree = BUILT_PRODUCTS_DIR; };
3E59CA981926F26500EE89D2 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
3E59CA9A1926F26500EE89D2 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
3E59CA9C1926F26500EE89D2 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
3E59CA9E1926F26500EE89D2 /* GLKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GLKit.framework; path = System/Library/Frameworks/GLKit.framework; sourceTree = SDKROOT; };
3E59CAA01926F26500EE89D2 /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = System/Library/Frameworks/OpenGLES.framework; sourceTree = SDKROOT; };
3E59CAA41926F26600EE89D2 /* Bushin-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Bushin-Info.plist"; sourceTree = "<group>"; };
3E59CAA61926F26600EE89D2 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
3E59CAA81926F26600EE89D2 /* main.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = main.mm; sourceTree = "<group>"; };
3E59CAAA1926F26600EE89D2 /* Bushin-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Bushin-Prefix.pch"; sourceTree = "<group>"; };
3E59CAB81926F26600EE89D2 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
3E59CABE1926F26700EE89D2 /* BushinTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = BushinTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
3E59CABF1926F26700EE89D2 /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; };
3E59CAC71926F26700EE89D2 /* BushinTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "BushinTests-Info.plist"; sourceTree = "<group>"; };
3E59CAC91926F26700EE89D2 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
3E59CACB1926F26700EE89D2 /* BushinTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = BushinTests.m; sourceTree = "<group>"; };
3E9EAE361951CA1A0083DBAA /* FacilitySelectMenuView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FacilitySelectMenuView.h; sourceTree = "<group>"; };
3E9EAE371951CA1B0083DBAA /* FacilitySelectMenuView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FacilitySelectMenuView.m; sourceTree = "<group>"; };
3E9EAE391951D6280083DBAA /* facility1.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = facility1.png; sourceTree = "<group>"; };
3E9EAE3A1951D6290083DBAA /* facility2.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = facility2.png; sourceTree = "<group>"; };
3E9EAE3B1951D6290083DBAA /* facility3.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = facility3.png; sourceTree = "<group>"; };
3E9EAE3C1951D6290083DBAA /* facility4.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = facility4.png; sourceTree = "<group>"; };
3E9EAE3D1951D6290083DBAA /* facility5.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = facility5.png; sourceTree = "<group>"; };
3E9EAE431951D9710083DBAA /* facility6.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = facility6.png; sourceTree = "<group>"; };
3E9EAE441951D9710083DBAA /* facility7.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = facility7.png; sourceTree = "<group>"; };
3E9EAE451951D9710083DBAA /* facility8.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = facility8.png; sourceTree = "<group>"; };
3E9EAE461951D9710083DBAA /* facility9.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = facility9.png; sourceTree = "<group>"; };
3E9EAE471951D9710083DBAA /* facility10.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = facility10.png; sourceTree = "<group>"; };
3E9EAE4D1951DBCF0083DBAA /* facility11.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = facility11.png; sourceTree = "<group>"; };
3E9EAE4E1951DBCF0083DBAA /* facility12.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = facility12.png; sourceTree = "<group>"; };
3E9EAE4F1951DBCF0083DBAA /* facility13.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = facility13.png; sourceTree = "<group>"; };
3E9EAE501951DBCF0083DBAA /* facility14.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = facility14.png; sourceTree = "<group>"; };
3E9EAE511951DBCF0083DBAA /* facility15.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = facility15.png; sourceTree = "<group>"; };
3E9EAE571951E1650083DBAA /* facility17.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = facility17.png; sourceTree = "<group>"; };
3E9EAE581951E1650083DBAA /* facility18.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = facility18.png; sourceTree = "<group>"; };
3E9EAE591951E1650083DBAA /* facility19.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = facility19.png; sourceTree = "<group>"; };
3E9EAE5A1951E1650083DBAA /* facility20.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = facility20.png; sourceTree = "<group>"; };
3E9EAE5B1951E1650083DBAA /* facility21.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = facility21.png; sourceTree = "<group>"; };
3E9EAE5C1951E1650083DBAA /* facility22.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = facility22.png; sourceTree = "<group>"; };
3E9EAE5D1951E1650083DBAA /* facility23.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = facility23.png; sourceTree = "<group>"; };
3E9EAE5E1951E1650083DBAA /* facility24.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = facility24.png; sourceTree = "<group>"; };
3E9EAE5F1951E1650083DBAA /* facility25.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = facility25.png; sourceTree = "<group>"; };
3E9EAE691951E1990083DBAA /* facility16.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = facility16.png; sourceTree = "<group>"; };
3E9EAE6B195254290083DBAA /* FacilityBuildView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FacilityBuildView.h; sourceTree = "<group>"; };
3E9EAE6C195254290083DBAA /* FacilityBuildView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FacilityBuildView.m; sourceTree = "<group>"; };
3EC85E251928FD0D006EDF6E /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
3EC85E261928FD0D006EDF6E /* AppDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AppDelegate.mm; sourceTree = "<group>"; };
3EC85E281928FD0D006EDF6E /* LoginViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LoginViewController.h; sourceTree = "<group>"; };
3EC85E291928FD0D006EDF6E /* LoginViewController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = LoginViewController.mm; sourceTree = "<group>"; };
3EC85E2A1928FD0D006EDF6E /* MainViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MainViewController.h; sourceTree = "<group>"; };
3EC85E2B1928FD0D006EDF6E /* MainViewController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MainViewController.mm; sourceTree = "<group>"; };
3EC85E2C1928FD0D006EDF6E /* Entity.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Entity.cpp; sourceTree = "<group>"; };
3EC85E2D1928FD0D006EDF6E /* Entity.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Entity.h; sourceTree = "<group>"; };
3EC85E2E1928FD0D006EDF6E /* GameApp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GameApp.h; sourceTree = "<group>"; };
3EC85E2F1928FD0D006EDF6E /* GameApp.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = GameApp.mm; sourceTree = "<group>"; };
3EC85E301928FD0D006EDF6E /* GameBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GameBase.h; sourceTree = "<group>"; };
3EC85E311928FD0D006EDF6E /* GameBase.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = GameBase.mm; sourceTree = "<group>"; };
3EC85E321928FD0D006EDF6E /* GameState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GameState.h; sourceTree = "<group>"; };
3EC85E331928FD0D006EDF6E /* GameState.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = GameState.mm; sourceTree = "<group>"; };
3EC85E341928FD0D006EDF6E /* ModeSelectViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ModeSelectViewController.h; sourceTree = "<group>"; };
3EC85E351928FD0D006EDF6E /* ModeSelectViewController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ModeSelectViewController.mm; sourceTree = "<group>"; };
3EC85E391928FD0D006EDF6E /* InfoViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InfoViewController.h; sourceTree = "<group>"; };
3EC85E3A1928FD0D006EDF6E /* InfoViewController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = InfoViewController.mm; sourceTree = "<group>"; };
3EC85E3B1928FD0D006EDF6E /* ShaderGeneratorTechniqueResolverListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ShaderGeneratorTechniqueResolverListener.h; sourceTree = "<group>"; };
3EC85E3C1928FD0D006EDF6E /* Singleton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Singleton.h; sourceTree = "<group>"; };
3EC85E3D1928FD0D006EDF6E /* State.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = State.h; sourceTree = "<group>"; };
3EC85E3E1928FD0D006EDF6E /* StateMachine.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StateMachine.cpp; sourceTree = "<group>"; };
3EC85E3F1928FD0D006EDF6E /* StateMachine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StateMachine.h; sourceTree = "<group>"; };
3EC85E401928FD0D006EDF6E /* WebView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebView.h; sourceTree = "<group>"; };
3EC85E411928FD0D006EDF6E /* WebView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WebView.m; sourceTree = "<group>"; };
3EC85E571928FD4C006EDF6E /* ogre.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ogre.cfg; sourceTree = "<group>"; };
3EC85E581928FD4C006EDF6E /* plugins.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = plugins.cfg; sourceTree = "<group>"; };
3EC85E591928FD4C006EDF6E /* resources.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = resources.cfg; sourceTree = "<group>"; };
3EC85E5D192902C3006EDF6E /* boost.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = boost.framework; path = ../../boost_build/ios/framework/boost.framework; sourceTree = "<group>"; };
3ECE24801939BC0C00049889 /* media */ = {isa = PBXFileReference; lastKnownFileType = folder; path = media; sourceTree = "<group>"; };
3ECE2482193AA3B600049889 /* OpenningViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OpenningViewController.h; sourceTree = "<group>"; };
3ECE2483193AA3B600049889 /* OpenningViewController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = OpenningViewController.mm; sourceTree = "<group>"; };
3ECE2488193B1BCC00049889 /* User.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = User.h; sourceTree = "<group>"; };
3ECE2489193B1BCE00049889 /* User.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = User.m; sourceTree = "<group>"; };
3ECE248B193D378F00049889 /* MenuView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MenuView.h; sourceTree = "<group>"; };
3ECE248C193D378F00049889 /* MenuView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MenuView.m; sourceTree = "<group>"; };
3EDFB2631947D7B300CEA48D /* menu0.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = menu0.png; sourceTree = "<group>"; };
3EDFB2641947D7B300CEA48D /* menu1.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = menu1.png; sourceTree = "<group>"; };
3EDFB2651947D7B300CEA48D /* menu10.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = menu10.png; sourceTree = "<group>"; };
3EDFB2661947D7B300CEA48D /* menu11.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = menu11.png; sourceTree = "<group>"; };
3EDFB2671947D7B300CEA48D /* menu12.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = menu12.png; sourceTree = "<group>"; };
3EDFB2681947D7B300CEA48D /* menu13.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = menu13.png; sourceTree = "<group>"; };
3EDFB2691947D7B300CEA48D /* menu14.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = menu14.png; sourceTree = "<group>"; };
3EDFB26A1947D7B300CEA48D /* menu15.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = menu15.png; sourceTree = "<group>"; };
3EDFB26B1947D7B300CEA48D /* menu16.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = menu16.png; sourceTree = "<group>"; };
3EDFB26C1947D7B300CEA48D /* menu2.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = menu2.png; sourceTree = "<group>"; };
3EDFB26D1947D7B300CEA48D /* menu3.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = menu3.png; sourceTree = "<group>"; };
3EDFB26E1947D7B300CEA48D /* menu4.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = menu4.png; sourceTree = "<group>"; };
3EDFB26F1947D7B300CEA48D /* menu5.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = menu5.png; sourceTree = "<group>"; };
3EDFB2701947D7B300CEA48D /* menu6.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = menu6.png; sourceTree = "<group>"; };
3EDFB2711947D7B300CEA48D /* menu7.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = menu7.png; sourceTree = "<group>"; };
3EDFB2721947D7B300CEA48D /* menu8.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = menu8.png; sourceTree = "<group>"; };
3EDFB2731947D7B300CEA48D /* menu9.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = menu9.png; sourceTree = "<group>"; };
3EEF7418194336350047C87C /* Base.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Base.cpp; sourceTree = "<group>"; };
3EEF7419194336350047C87C /* Base.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Base.h; sourceTree = "<group>"; };
3EEF741B194339160047C87C /* Facility.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = Facility.mm; sourceTree = "<group>"; };
3EEF741C194339160047C87C /* Facility.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Facility.h; sourceTree = "<group>"; };
3EEF741E194496FA0047C87C /* FacilityState.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = FacilityState.mm; sourceTree = "<group>"; };
3EEF741F194496FA0047C87C /* FacilityState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FacilityState.h; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
3E59CA921926F26500EE89D2 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
3EC85E5E192902C3006EDF6E /* boost.framework in Frameworks */,
3E59CAA11926F26500EE89D2 /* OpenGLES.framework in Frameworks */,
3E59CA9B1926F26500EE89D2 /* CoreGraphics.framework in Frameworks */,
3E59CA9D1926F26500EE89D2 /* UIKit.framework in Frameworks */,
3E59CA9F1926F26500EE89D2 /* GLKit.framework in Frameworks */,
3E59CA991926F26500EE89D2 /* Foundation.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
3E59CABB1926F26700EE89D2 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
3E59CAC01926F26700EE89D2 /* XCTest.framework in Frameworks */,
3E59CAC21926F26700EE89D2 /* UIKit.framework in Frameworks */,
3E59CAC11926F26700EE89D2 /* Foundation.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
3E59CA8C1926F26500EE89D2 = {
isa = PBXGroup;
children = (
3E59CAA21926F26600EE89D2 /* Bushin */,
3E59CAC51926F26700EE89D2 /* BushinTests */,
3E59CA971926F26500EE89D2 /* Frameworks */,
3E59CA961926F26500EE89D2 /* Products */,
);
sourceTree = "<group>";
};
3E59CA961926F26500EE89D2 /* Products */ = {
isa = PBXGroup;
children = (
3E59CA951926F26500EE89D2 /* Bushin.app */,
3E59CABE1926F26700EE89D2 /* BushinTests.xctest */,
);
name = Products;
sourceTree = "<group>";
};
3E59CA971926F26500EE89D2 /* Frameworks */ = {
isa = PBXGroup;
children = (
3EC85E5D192902C3006EDF6E /* boost.framework */,
3E59CA981926F26500EE89D2 /* Foundation.framework */,
3E59CA9A1926F26500EE89D2 /* CoreGraphics.framework */,
3E59CA9C1926F26500EE89D2 /* UIKit.framework */,
3E59CA9E1926F26500EE89D2 /* GLKit.framework */,
3E59CAA01926F26500EE89D2 /* OpenGLES.framework */,
3E59CABF1926F26700EE89D2 /* XCTest.framework */,
);
name = Frameworks;
sourceTree = "<group>";
};
3E59CAA21926F26600EE89D2 /* Bushin */ = {
isa = PBXGroup;
children = (
3EDFB2621947D7B300CEA48D /* images */,
3ECE24801939BC0C00049889 /* media */,
3EC85E241928FD0D006EDF6E /* src */,
3E59CAB81926F26600EE89D2 /* Images.xcassets */,
3E59CAA31926F26600EE89D2 /* Supporting Files */,
);
path = Bushin;
sourceTree = "<group>";
};
3E59CAA31926F26600EE89D2 /* Supporting Files */ = {
isa = PBXGroup;
children = (
3EC85E571928FD4C006EDF6E /* ogre.cfg */,
3EC85E581928FD4C006EDF6E /* plugins.cfg */,
3EC85E591928FD4C006EDF6E /* resources.cfg */,
3E59CAA41926F26600EE89D2 /* Bushin-Info.plist */,
3E59CAA51926F26600EE89D2 /* InfoPlist.strings */,
3E59CAA81926F26600EE89D2 /* main.mm */,
3E59CAAA1926F26600EE89D2 /* Bushin-Prefix.pch */,
);
name = "Supporting Files";
sourceTree = "<group>";
};
3E59CAC51926F26700EE89D2 /* BushinTests */ = {
isa = PBXGroup;
children = (
3E59CACB1926F26700EE89D2 /* BushinTests.m */,
3E59CAC61926F26700EE89D2 /* Supporting Files */,
);
path = BushinTests;
sourceTree = "<group>";
};
3E59CAC61926F26700EE89D2 /* Supporting Files */ = {
isa = PBXGroup;
children = (
3E59CAC71926F26700EE89D2 /* BushinTests-Info.plist */,
3E59CAC81926F26700EE89D2 /* InfoPlist.strings */,
);
name = "Supporting Files";
sourceTree = "<group>";
};
3EC85E241928FD0D006EDF6E /* src */ = {
isa = PBXGroup;
children = (
3EC85E251928FD0D006EDF6E /* AppDelegate.h */,
3EC85E261928FD0D006EDF6E /* AppDelegate.mm */,
3EC85E271928FD0D006EDF6E /* engine */,
);
path = src;
sourceTree = "<group>";
};
3EC85E271928FD0D006EDF6E /* engine */ = {
isa = PBXGroup;
children = (
3EC85E281928FD0D006EDF6E /* LoginViewController.h */,
3EC85E291928FD0D006EDF6E /* LoginViewController.mm */,
3EC85E2A1928FD0D006EDF6E /* MainViewController.h */,
3EC85E2B1928FD0D006EDF6E /* MainViewController.mm */,
3ECE248B193D378F00049889 /* MenuView.h */,
3ECE248C193D378F00049889 /* MenuView.m */,
3E9EAE361951CA1A0083DBAA /* FacilitySelectMenuView.h */,
3E9EAE371951CA1B0083DBAA /* FacilitySelectMenuView.m */,
3E9EAE6B195254290083DBAA /* FacilityBuildView.h */,
3E9EAE6C195254290083DBAA /* FacilityBuildView.m */,
3EC85E2C1928FD0D006EDF6E /* Entity.cpp */,
3EC85E2D1928FD0D006EDF6E /* Entity.h */,
3ECE2488193B1BCC00049889 /* User.h */,
3ECE2489193B1BCE00049889 /* User.m */,
3EC85E2E1928FD0D006EDF6E /* GameApp.h */,
3EC85E2F1928FD0D006EDF6E /* GameApp.mm */,
3EC85E301928FD0D006EDF6E /* GameBase.h */,
3EC85E311928FD0D006EDF6E /* GameBase.mm */,
3EC85E321928FD0D006EDF6E /* GameState.h */,
3EC85E331928FD0D006EDF6E /* GameState.mm */,
3E13CFF7193E146E003C6063 /* Scene.h */,
3E13CFF6193E146E003C6063 /* Scene.cpp */,
3E13CFFA193E179F003C6063 /* SceneState.h */,
3E13CFF9193E179F003C6063 /* SceneState.cpp */,
3EEF7419194336350047C87C /* Base.h */,
3EEF7418194336350047C87C /* Base.cpp */,
3EEF741C194339160047C87C /* Facility.h */,
3EEF741B194339160047C87C /* Facility.mm */,
3EEF741F194496FA0047C87C /* FacilityState.h */,
3EEF741E194496FA0047C87C /* FacilityState.mm */,
3EC85E341928FD0D006EDF6E /* ModeSelectViewController.h */,
3EC85E351928FD0D006EDF6E /* ModeSelectViewController.mm */,
3EC85E391928FD0D006EDF6E /* InfoViewController.h */,
3EC85E3A1928FD0D006EDF6E /* InfoViewController.mm */,
3EC85E3B1928FD0D006EDF6E /* ShaderGeneratorTechniqueResolverListener.h */,
3EC85E3C1928FD0D006EDF6E /* Singleton.h */,
3EC85E3D1928FD0D006EDF6E /* State.h */,
3EC85E3F1928FD0D006EDF6E /* StateMachine.h */,
3EC85E3E1928FD0D006EDF6E /* StateMachine.cpp */,
3EC85E401928FD0D006EDF6E /* WebView.h */,
3EC85E411928FD0D006EDF6E /* WebView.m */,
3ECE2482193AA3B600049889 /* OpenningViewController.h */,
3ECE2483193AA3B600049889 /* OpenningViewController.mm */,
);
path = engine;
sourceTree = "<group>";
};
3EDFB2621947D7B300CEA48D /* images */ = {
isa = PBXGroup;
children = (
3E9EAE391951D6280083DBAA /* facility1.png */,
3E9EAE3A1951D6290083DBAA /* facility2.png */,
3E9EAE3B1951D6290083DBAA /* facility3.png */,
3E9EAE3C1951D6290083DBAA /* facility4.png */,
3E9EAE3D1951D6290083DBAA /* facility5.png */,
3E9EAE431951D9710083DBAA /* facility6.png */,
3E9EAE441951D9710083DBAA /* facility7.png */,
3E9EAE451951D9710083DBAA /* facility8.png */,
3E9EAE461951D9710083DBAA /* facility9.png */,
3E9EAE471951D9710083DBAA /* facility10.png */,
3E9EAE4D1951DBCF0083DBAA /* facility11.png */,
3E9EAE4E1951DBCF0083DBAA /* facility12.png */,
3E9EAE4F1951DBCF0083DBAA /* facility13.png */,
3E9EAE501951DBCF0083DBAA /* facility14.png */,
3E9EAE511951DBCF0083DBAA /* facility15.png */,
3E9EAE691951E1990083DBAA /* facility16.png */,
3E9EAE571951E1650083DBAA /* facility17.png */,
3E9EAE581951E1650083DBAA /* facility18.png */,
3E9EAE591951E1650083DBAA /* facility19.png */,
3E9EAE5A1951E1650083DBAA /* facility20.png */,
3E9EAE5B1951E1650083DBAA /* facility21.png */,
3E9EAE5C1951E1650083DBAA /* facility22.png */,
3E9EAE5D1951E1650083DBAA /* facility23.png */,
3E9EAE5E1951E1650083DBAA /* facility24.png */,
3E9EAE5F1951E1650083DBAA /* facility25.png */,
3EDFB2631947D7B300CEA48D /* menu0.png */,
3EDFB2641947D7B300CEA48D /* menu1.png */,
3EDFB2651947D7B300CEA48D /* menu10.png */,
3EDFB2661947D7B300CEA48D /* menu11.png */,
3EDFB2671947D7B300CEA48D /* menu12.png */,
3EDFB2681947D7B300CEA48D /* menu13.png */,
3EDFB2691947D7B300CEA48D /* menu14.png */,
3EDFB26A1947D7B300CEA48D /* menu15.png */,
3EDFB26B1947D7B300CEA48D /* menu16.png */,
3EDFB26C1947D7B300CEA48D /* menu2.png */,
3EDFB26D1947D7B300CEA48D /* menu3.png */,
3EDFB26E1947D7B300CEA48D /* menu4.png */,
3EDFB26F1947D7B300CEA48D /* menu5.png */,
3EDFB2701947D7B300CEA48D /* menu6.png */,
3EDFB2711947D7B300CEA48D /* menu7.png */,
3EDFB2721947D7B300CEA48D /* menu8.png */,
3EDFB2731947D7B300CEA48D /* menu9.png */,
);
path = images;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
3E59CA941926F26500EE89D2 /* Bushin */ = {
isa = PBXNativeTarget;
buildConfigurationList = 3E59CACF1926F26700EE89D2 /* Build configuration list for PBXNativeTarget "Bushin" */;
buildPhases = (
3E59CA911926F26500EE89D2 /* Sources */,
3E59CA921926F26500EE89D2 /* Frameworks */,
3E59CA931926F26500EE89D2 /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = Bushin;
productName = Bushin;
productReference = 3E59CA951926F26500EE89D2 /* Bushin.app */;
productType = "com.apple.product-type.application";
};
3E59CABD1926F26700EE89D2 /* BushinTests */ = {
isa = PBXNativeTarget;
buildConfigurationList = 3E59CAD21926F26700EE89D2 /* Build configuration list for PBXNativeTarget "BushinTests" */;
buildPhases = (
3E59CABA1926F26700EE89D2 /* Sources */,
3E59CABB1926F26700EE89D2 /* Frameworks */,
3E59CABC1926F26700EE89D2 /* Resources */,
);
buildRules = (
);
dependencies = (
3E59CAC41926F26700EE89D2 /* PBXTargetDependency */,
);
name = BushinTests;
productName = BushinTests;
productReference = 3E59CABE1926F26700EE89D2 /* BushinTests.xctest */;
productType = "com.apple.product-type.bundle.unit-test";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
3E59CA8D1926F26500EE89D2 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0510;
ORGANIZATIONNAME = venus;
TargetAttributes = {
3E59CABD1926F26700EE89D2 = {
TestTargetID = 3E59CA941926F26500EE89D2;
};
};
};
buildConfigurationList = 3E59CA901926F26500EE89D2 /* Build configuration list for PBXProject "Bushin" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = 3E59CA8C1926F26500EE89D2;
productRefGroup = 3E59CA961926F26500EE89D2 /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
3E59CA941926F26500EE89D2 /* Bushin */,
3E59CABD1926F26700EE89D2 /* BushinTests */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
3E59CA931926F26500EE89D2 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
3E9EAE601951E1650083DBAA /* facility17.png in Resources */,
3E9EAE521951DBCF0083DBAA /* facility11.png in Resources */,
3E9EAE661951E1650083DBAA /* facility23.png in Resources */,
3EDFB2771947D7B300CEA48D /* menu11.png in Resources */,
3E9EAE561951DBCF0083DBAA /* facility15.png in Resources */,
3EDFB2841947D7B300CEA48D /* menu9.png in Resources */,
3EDFB2801947D7B300CEA48D /* menu5.png in Resources */,
3E59CAB91926F26600EE89D2 /* Images.xcassets in Resources */,
3E9EAE611951E1650083DBAA /* facility18.png in Resources */,
3E9EAE631951E1650083DBAA /* facility20.png in Resources */,
3EDFB27B1947D7B300CEA48D /* menu15.png in Resources */,
3EDFB27D1947D7B300CEA48D /* menu2.png in Resources */,
3EDFB27E1947D7B300CEA48D /* menu3.png in Resources */,
3E9EAE6A1951E1990083DBAA /* facility16.png in Resources */,
3EC85E5B1928FD4C006EDF6E /* plugins.cfg in Resources */,
3EDFB2751947D7B300CEA48D /* menu1.png in Resources */,
3E9EAE651951E1650083DBAA /* facility22.png in Resources */,
3E9EAE541951DBCF0083DBAA /* facility13.png in Resources */,
3EDFB2781947D7B300CEA48D /* menu12.png in Resources */,
3EDFB2831947D7B300CEA48D /* menu8.png in Resources */,
3EDFB2821947D7B300CEA48D /* menu7.png in Resources */,
3EDFB2741947D7B300CEA48D /* menu0.png in Resources */,
3EDFB27F1947D7B300CEA48D /* menu4.png in Resources */,
3E9EAE641951E1650083DBAA /* facility21.png in Resources */,
3E9EAE4B1951D9710083DBAA /* facility9.png in Resources */,
3E9EAE3E1951D6290083DBAA /* facility1.png in Resources */,
3E9EAE4C1951D9710083DBAA /* facility10.png in Resources */,
3EDFB2811947D7B300CEA48D /* menu6.png in Resources */,
3E9EAE401951D6290083DBAA /* facility3.png in Resources */,
3E9EAE671951E1650083DBAA /* facility24.png in Resources */,
3E9EAE4A1951D9710083DBAA /* facility8.png in Resources */,
3EDFB27A1947D7B300CEA48D /* menu14.png in Resources */,
3E9EAE481951D9710083DBAA /* facility6.png in Resources */,
3E9EAE551951DBCF0083DBAA /* facility14.png in Resources */,
3E9EAE621951E1650083DBAA /* facility19.png in Resources */,
3E9EAE421951D6290083DBAA /* facility5.png in Resources */,
3E9EAE491951D9710083DBAA /* facility7.png in Resources */,
3E9EAE681951E1650083DBAA /* facility25.png in Resources */,
3EDFB2761947D7B300CEA48D /* menu10.png in Resources */,
3EC85E5A1928FD4C006EDF6E /* ogre.cfg in Resources */,
3E9EAE531951DBCF0083DBAA /* facility12.png in Resources */,
3EDFB27C1947D7B300CEA48D /* menu16.png in Resources */,
3E9EAE3F1951D6290083DBAA /* facility2.png in Resources */,
3ECE24811939BC0C00049889 /* media in Resources */,
3E59CAA71926F26600EE89D2 /* InfoPlist.strings in Resources */,
3EDFB2791947D7B300CEA48D /* menu13.png in Resources */,
3EC85E5C1928FD4C006EDF6E /* resources.cfg in Resources */,
3E9EAE411951D6290083DBAA /* facility4.png in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
3E59CABC1926F26700EE89D2 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
3E59CACA1926F26700EE89D2 /* InfoPlist.strings in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
3E59CA911926F26500EE89D2 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
3EEF741A194336350047C87C /* Base.cpp in Sources */,
3EC85E4D1928FD0D006EDF6E /* GameState.mm in Sources */,
3ECE2484193AA3B600049889 /* OpenningViewController.mm in Sources */,
3EC85E4E1928FD0D006EDF6E /* ModeSelectViewController.mm in Sources */,
3EEF7420194496FA0047C87C /* FacilityState.mm in Sources */,
3EC85E4C1928FD0D006EDF6E /* GameBase.mm in Sources */,
3EEF741D194339160047C87C /* Facility.mm in Sources */,
3EC85E511928FD0D006EDF6E /* StateMachine.cpp in Sources */,
3EC85E4B1928FD0D006EDF6E /* GameApp.mm in Sources */,
3EC85E521928FD0D006EDF6E /* WebView.m in Sources */,
3EC85E491928FD0D006EDF6E /* MainViewController.mm in Sources */,
3E13CFF8193E146E003C6063 /* Scene.cpp in Sources */,
3ECE248A193B1BCE00049889 /* User.m in Sources */,
3E9EAE381951CA1B0083DBAA /* FacilitySelectMenuView.m in Sources */,
3EC85E501928FD0D006EDF6E /* InfoViewController.mm in Sources */,
3E13CFFB193E179F003C6063 /* SceneState.cpp in Sources */,
3EC85E471928FD0D006EDF6E /* AppDelegate.mm in Sources */,
3EC85E481928FD0D006EDF6E /* LoginViewController.mm in Sources */,
3E9EAE6D195254290083DBAA /* FacilityBuildView.m in Sources */,
3EC85E4A1928FD0D006EDF6E /* Entity.cpp in Sources */,
3E59CAA91926F26600EE89D2 /* main.mm in Sources */,
3ECE248D193D378F00049889 /* MenuView.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
3E59CABA1926F26700EE89D2 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
3E59CACC1926F26700EE89D2 /* BushinTests.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
3E59CAC41926F26700EE89D2 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 3E59CA941926F26500EE89D2 /* Bushin */;
targetProxy = 3E59CAC31926F26700EE89D2 /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin PBXVariantGroup section */
3E59CAA51926F26600EE89D2 /* InfoPlist.strings */ = {
isa = PBXVariantGroup;
children = (
3E59CAA61926F26600EE89D2 /* en */,
);
name = InfoPlist.strings;
sourceTree = "<group>";
};
3E59CAC81926F26700EE89D2 /* InfoPlist.strings */ = {
isa = PBXVariantGroup;
children = (
3E59CAC91926F26700EE89D2 /* en */,
);
name = InfoPlist.strings;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
3E59CACD1926F26700EE89D2 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 7.1;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
};
name = Debug;
};
3E59CACE1926F26700EE89D2 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = YES;
ENABLE_NS_ASSERTIONS = NO;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 7.1;
SDKROOT = iphoneos;
VALIDATE_PRODUCT = YES;
};
name = Release;
};
3E59CAD01926F26700EE89D2 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD)";
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
CLANG_ENABLE_OBJC_ARC = NO;
CODE_SIGN_IDENTITY = "iPhone Developer: Satoshi Miyazaki (5XN2BGJ5LT)";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
/Users/miyazaki/boost_build/ios/framework,
);
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "Bushin/Bushin-Prefix.pch";
HEADER_SEARCH_PATHS = (
"$(inherited)",
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
/Users/miyazaki/temp/OgreSDk/include/,
/Users/miyazaki/temp/OgreSDK/include/OGRE,
/Users/miyazaki/temp/OgreSDk/include/OIS,
/Users/miyazaki/temp/OgreSDK/include/OGRE/Overlay,
/Users/miyazaki/temp/OgreSDK/include/OGRE/RTShaderSystem,
/Users/miyazaki/temp/OgreSDK/include/OGRE/RenderSystems/GLES,
/Users/miyazaki/temp/OgreSDK/include/OGRE/RenderSystems/GLES2,
/Users/miyazaki/temp/OgreSDK/include/OGRE/RenderSystems/GLES2/APPLE,
/Users/miyazaki/temp/OgreSDK/include/OGRE/Plugins/OctreeSceneManager,
/Users/miyazaki/temp/OgreSDK/include/OGRE/Plugins/OctreeZone,
/Users/miyazaki/temp/OgreSDK/include/OGRE/Plugins/ParticleFX,
/Users/miyazaki/temp/OgreSDK/include/OGRE/Plugins/PCZSceneManager,
/Users/miyazaki/temp/OgreSDK/include/OGRE/Plugins/BSPSceneManager,
/Users/miyazaki/temp/OgreSDK/include/OGRE/iOS,
/Users/miyazaki/temp/OgreSDK/include/OGRE/Volume,
/Users/miyazaki/temp/OgreSDK/include/OGRE/Threading,
/Users/miyazaki/temp/OgreSDK/include/OGRE/Terrain,
/Users/miyazaki/temp/OgreSDK/include/OGRE/Paging,
);
INFOPLIST_FILE = "Bushin/Bushin-Info.plist";
LIBRARY_SEARCH_PATHS = (
"$(SRCROOT)/../OgreSDk/lib",
"$(SRCROOT)/../OgreSDk/lib/Release",
);
ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = (
"-Wl,-search_paths_first",
"-Wl,-headerpad_max_install_names",
/Users/miyazaki/temp/OgreSDK/lib/Release/libOgreMainStatic.a,
/Users/miyazaki/temp/OgreSDK/lib/Release/libzzip.a,
/usr/lib/libz.dylib,
/Users/miyazaki/temp/OgreSDK/lib/Release/libFreeImage.a,
/Users/miyazaki/temp/OgreSDK/lib/Release/libFreeType.a,
/Users/miyazaki/temp/OgreSDK/lib/Release/libOgreRTShaderSystemStatic.a,
/Users/miyazaki/temp/OgreSDK/lib/Release/libOgreTerrainStatic.a,
/Users/miyazaki/temp/OgreSDK/lib/Release/libOgrePagingStatic.a,
/Users/miyazaki/temp/OgreSDK/lib/Release/libOgreVolumeStatic.a,
/Users/miyazaki/temp/OgreSDK/lib/Release/libOgreOverlayStatic.a,
/Users/miyazaki/temp/OgreSDK/lib/Release/libPlugin_BSPSceneManagerStatic.a,
/Users/miyazaki/temp/OgreSDK/lib/Release/libPlugin_OctreeSceneManagerStatic.a,
/Users/miyazaki/temp/OgreSDK/lib/Release/libPlugin_ParticleFXStatic.a,
/Users/miyazaki/temp/OgreSDK/lib/Release/libRenderSystem_GLESStatic.a,
/Users/miyazaki/temp/OgreSDK/lib/Release/libRenderSystem_GLES2Static.a,
/Users/miyazaki/temp/OgreSDK/lib/Release/libOIS.a,
);
PRODUCT_NAME = "$(TARGET_NAME)";
VALID_ARCHS = "armv7 armv7s arm64";
WRAPPER_EXTENSION = app;
};
name = Debug;
};
3E59CAD11926F26700EE89D2 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD)";
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
CLANG_ENABLE_OBJC_ARC = NO;
CODE_SIGN_IDENTITY = "iPhone Developer: Satoshi Miyazaki (5XN2BGJ5LT)";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
/Users/miyazaki/boost_build/ios/framework,
);
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "Bushin/Bushin-Prefix.pch";
HEADER_SEARCH_PATHS = (
"$(inherited)",
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
/Users/miyazaki/temp/OgreSDk/include/,
/Users/miyazaki/temp/OgreSDK/include/OGRE,
/Users/miyazaki/temp/OgreSDk/include/OIS,
/Users/miyazaki/temp/OgreSDK/include/OGRE/Overlay,
/Users/miyazaki/temp/OgreSDK/include/OGRE/RTShaderSystem,
/Users/miyazaki/temp/OgreSDK/include/OGRE/RenderSystems/GLES,
/Users/miyazaki/temp/OgreSDK/include/OGRE/RenderSystems/GLES2,
/Users/miyazaki/temp/OgreSDK/include/OGRE/RenderSystems/GLES2/APPLE,
/Users/miyazaki/temp/OgreSDK/include/OGRE/Plugins/OctreeSceneManager,
/Users/miyazaki/temp/OgreSDK/include/OGRE/Plugins/OctreeZone,
/Users/miyazaki/temp/OgreSDK/include/OGRE/Plugins/ParticleFX,
/Users/miyazaki/temp/OgreSDK/include/OGRE/Plugins/PCZSceneManager,
/Users/miyazaki/temp/OgreSDK/include/OGRE/Plugins/BSPSceneManager,
/Users/miyazaki/temp/OgreSDK/include/OGRE/iOS,
/Users/miyazaki/temp/OgreSDK/include/OGRE/Volume,
/Users/miyazaki/temp/OgreSDK/include/OGRE/Threading,
/Users/miyazaki/temp/OgreSDK/include/OGRE/Terrain,
/Users/miyazaki/temp/OgreSDK/include/OGRE/Paging,
);
INFOPLIST_FILE = "Bushin/Bushin-Info.plist";
LIBRARY_SEARCH_PATHS = (
"$(SRCROOT)/../OgreSDk/lib",
"$(SRCROOT)/../OgreSDk/lib/Release",
);
OTHER_LDFLAGS = (
"-Wl,-search_paths_first",
"-Wl,-headerpad_max_install_names",
/Users/miyazaki/temp/OgreSDK/lib/Release/libOgreMainStatic.a,
/Users/miyazaki/temp/OgreSDK/lib/Release/libzzip.a,
/usr/lib/libz.dylib,
/Users/miyazaki/temp/OgreSDK/lib/Release/libFreeImage.a,
/Users/miyazaki/temp/OgreSDK/lib/Release/libFreeType.a,
/Users/miyazaki/temp/OgreSDK/lib/Release/libOgreRTShaderSystemStatic.a,
/Users/miyazaki/temp/OgreSDK/lib/Release/libOgreTerrainStatic.a,
/Users/miyazaki/temp/OgreSDK/lib/Release/libOgrePagingStatic.a,
/Users/miyazaki/temp/OgreSDK/lib/Release/libOgreVolumeStatic.a,
/Users/miyazaki/temp/OgreSDK/lib/Release/libOgreOverlayStatic.a,
/Users/miyazaki/temp/OgreSDK/lib/Release/libPlugin_BSPSceneManagerStatic.a,
/Users/miyazaki/temp/OgreSDK/lib/Release/libPlugin_OctreeSceneManagerStatic.a,
/Users/miyazaki/temp/OgreSDK/lib/Release/libPlugin_ParticleFXStatic.a,
/Users/miyazaki/temp/OgreSDK/lib/Release/libRenderSystem_GLESStatic.a,
/Users/miyazaki/temp/OgreSDK/lib/Release/libRenderSystem_GLES2Static.a,
/Users/miyazaki/temp/OgreSDK/lib/Release/libOIS.a,
);
PRODUCT_NAME = "$(TARGET_NAME)";
VALID_ARCHS = "armv7 armv7s arm64";
WRAPPER_EXTENSION = app;
};
name = Release;
};
3E59CAD31926F26700EE89D2 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/Bushin.app/Bushin";
FRAMEWORK_SEARCH_PATHS = (
"$(SDKROOT)/Developer/Library/Frameworks",
"$(inherited)",
"$(DEVELOPER_FRAMEWORKS_DIR)",
);
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "Bushin/Bushin-Prefix.pch";
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
INFOPLIST_FILE = "BushinTests/BushinTests-Info.plist";
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUNDLE_LOADER)";
WRAPPER_EXTENSION = xctest;
};
name = Debug;
};
3E59CAD41926F26700EE89D2 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/Bushin.app/Bushin";
FRAMEWORK_SEARCH_PATHS = (
"$(SDKROOT)/Developer/Library/Frameworks",
"$(inherited)",
"$(DEVELOPER_FRAMEWORKS_DIR)",
);
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "Bushin/Bushin-Prefix.pch";
INFOPLIST_FILE = "BushinTests/BushinTests-Info.plist";
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUNDLE_LOADER)";
WRAPPER_EXTENSION = xctest;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
3E59CA901926F26500EE89D2 /* Build configuration list for PBXProject "Bushin" */ = {
isa = XCConfigurationList;
buildConfigurations = (
3E59CACD1926F26700EE89D2 /* Debug */,
3E59CACE1926F26700EE89D2 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
3E59CACF1926F26700EE89D2 /* Build configuration list for PBXNativeTarget "Bushin" */ = {
isa = XCConfigurationList;
buildConfigurations = (
3E59CAD01926F26700EE89D2 /* Debug */,
3E59CAD11926F26700EE89D2 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
3E59CAD21926F26700EE89D2 /* Build configuration list for PBXNativeTarget "BushinTests" */ = {
isa = XCConfigurationList;
buildConfigurations = (
3E59CAD31926F26700EE89D2 /* Debug */,
3E59CAD41926F26700EE89D2 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 3E59CA8D1926F26500EE89D2 /* Project object */;
}

7
Bushin.xcodeproj/project.xcworkspace/contents.xcworkspacedata

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:Bushin.xcodeproj">
</FileRef>
</Workspace>

BIN
Bushin.xcodeproj/project.xcworkspace/xcuserdata/miyazaki.xcuserdatad/UserInterfaceState.xcuserstate

193
Bushin.xcodeproj/xcuserdata/miyazaki.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

@ -0,0 +1,193 @@
<?xml version="1.0" encoding="UTF-8"?>
<Bucket
type = "1"
version = "2.0">
<Breakpoints>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Bushin/src/AppDelegate.mm"
timestampString = "423289676.98675"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "35"
endingLineNumber = "35"
landmarkName = "-application:didFinishLaunchingWithOptions:"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Bushin/src/engine/GameState.mm"
timestampString = "423562003.029043"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "213"
endingLineNumber = "213"
landmarkName = "OpenningState::execute(GameBase* entity,float elapsedTime)"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Bushin/src/engine/GameState.mm"
timestampString = "423562003.029043"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "198"
endingLineNumber = "198"
landmarkName = "OpenningState::execute(GameBase* entity,float elapsedTime)"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Bushin/src/engine/GameBase.mm"
timestampString = "423821552.486281"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "692"
endingLineNumber = "692"
landmarkName = "GameBase::removeModeSelectScene()"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Bushin/src/engine/GameBase.mm"
timestampString = "423214846.040085"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "207"
endingLineNumber = "207"
landmarkName = "GameBase::loadResources(void)"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Bushin/src/engine/GameState.mm"
timestampString = "423562003.029043"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "122"
endingLineNumber = "122"
landmarkName = "InitialState::entry(GameBase* entity)"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Bushin/src/engine/GameState.mm"
timestampString = "423562003.029043"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "87"
endingLineNumber = "87"
landmarkName = "InitialState::entry(GameBase* entity)"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Bushin/src/engine/GameBase.mm"
timestampString = "423225040.248106"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "92"
endingLineNumber = "92"
landmarkName = "GameBase::getInstance()"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Bushin/src/engine/GameBase.mm"
timestampString = "423821552.486281"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "438"
endingLineNumber = "438"
landmarkName = "GameBase::setupOpenningScene()"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Bushin/src/engine/GameState.mm"
timestampString = "423562003.029043"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "295"
endingLineNumber = "295"
landmarkName = "ModeSelectState::execute(GameBase* entity,float elapsedTime)"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.ExceptionBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
scope = "0"
stopOnStyle = "0">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Bushin/src/engine/MainViewController.mm"
timestampString = "425145553.666391"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "368"
endingLineNumber = "368"
landmarkName = "-selectMinka"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
</Bucket>

96
Bushin.xcodeproj/xcuserdata/miyazaki.xcuserdatad/xcschemes/Bushin.xcscheme

@ -0,0 +1,96 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0510"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "3E59CA941926F26500EE89D2"
BuildableName = "Bushin.app"
BlueprintName = "Bushin"
ReferencedContainer = "container:Bushin.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
buildConfiguration = "Debug">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "3E59CABD1926F26700EE89D2"
BuildableName = "BushinTests.xctest"
BlueprintName = "BushinTests"
ReferencedContainer = "container:Bushin.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "3E59CA941926F26500EE89D2"
BuildableName = "Bushin.app"
BlueprintName = "Bushin"
ReferencedContainer = "container:Bushin.xcodeproj">
</BuildableReference>
</MacroExpansion>
</TestAction>
<LaunchAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
allowLocationSimulation = "YES">
<BuildableProductRunnable>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "3E59CA941926F26500EE89D2"
BuildableName = "Bushin.app"
BlueprintName = "Bushin"
ReferencedContainer = "container:Bushin.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
buildConfiguration = "Release"
debugDocumentVersioning = "YES">
<BuildableProductRunnable>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "3E59CA941926F26500EE89D2"
BuildableName = "Bushin.app"
BlueprintName = "Bushin"
ReferencedContainer = "container:Bushin.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

27
Bushin.xcodeproj/xcuserdata/miyazaki.xcuserdatad/xcschemes/xcschememanagement.plist

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>Bushin.xcscheme</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>
<dict>
<key>3E59CA941926F26500EE89D2</key>
<dict>
<key>primary</key>
<true/>
</dict>
<key>3E59CABD1926F26700EE89D2</key>
<dict>
<key>primary</key>
<true/>
</dict>
</dict>
</dict>
</plist>

42
Bushin/Bushin-Info.plist

@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>com.venus-software.${PRODUCT_NAME:rfc1034identifier}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UIStatusBarHidden</key>
<true/>
<key>UIStatusBarStyle</key>
<string>UIStatusBarStyleBlackTranslucent</string>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<true/>
</dict>
</plist>

23
Bushin/Bushin-Prefix.pch

@ -0,0 +1,23 @@
//
// Prefix header
//
// The contents of this file are implicitly included at the beginning of every source file.
//
#import <Availability.h>
#ifndef __IPHONE_5_0
#warning "This project uses features only available in iOS SDK 5.0 and later."
#endif
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#endif
//#define OGRE_STATIC_LIB
#define OGRE_PLATFORM OGRE_PLATFORM_APPLE_IOS
#define OGRE_IS_IOS 1
#define OGRE_STATIC_GLES2 1
#define OGRE_STATIC_LIB 1
#define INCLUDE_RTSHADER_SYSTEM 1

23
Bushin/Images.xcassets/AppIcon.appiconset/Contents.json

@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

23
Bushin/Images.xcassets/LaunchImage.launchimage/Contents.json

@ -0,0 +1,23 @@
{
"images" : [
{
"orientation" : "portrait",
"idiom" : "iphone",
"extent" : "full-screen",
"minimum-system-version" : "7.0",
"scale" : "2x"
},
{
"orientation" : "portrait",
"idiom" : "iphone",
"subtype" : "retina4",
"extent" : "full-screen",
"minimum-system-version" : "7.0",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

2
Bushin/en.lproj/InfoPlist.strings

@ -0,0 +1,2 @@
/* Localized versions of Info.plist keys */

BIN
Bushin/images/facility1.png

After

Width: 109  |  Height: 112  |  Size: 17 KiB

BIN
Bushin/images/facility10.png

After

Width: 109  |  Height: 108  |  Size: 18 KiB

BIN
Bushin/images/facility11.png

After

Width: 108  |  Height: 109  |  Size: 18 KiB

BIN
Bushin/images/facility12.png

After

Width: 111  |  Height: 110  |  Size: 17 KiB

BIN
Bushin/images/facility13.png

After

Width: 127  |  Height: 111  |  Size: 18 KiB

BIN
Bushin/images/facility14.png

After

Width: 110  |  Height: 110  |  Size: 14 KiB

BIN
Bushin/images/facility15.png

After

Width: 110  |  Height: 110  |  Size: 14 KiB

BIN
Bushin/images/facility16.png

After

Width: 111  |  Height: 110  |  Size: 18 KiB

BIN
Bushin/images/facility17.png

After

Width: 112  |  Height: 113  |  Size: 18 KiB

BIN
Bushin/images/facility18.png

After

Width: 112  |  Height: 113  |  Size: 16 KiB

BIN
Bushin/images/facility19.png

After

Width: 126  |  Height: 113  |  Size: 18 KiB

BIN
Bushin/images/facility2.png

After

Width: 109  |  Height: 110  |  Size: 16 KiB

BIN
Bushin/images/facility20.png

After

Width: 109  |  Height: 111  |  Size: 15 KiB

BIN
Bushin/images/facility21.png

After

Width: 110  |  Height: 112  |  Size: 16 KiB

BIN
Bushin/images/facility22.png

After

Width: 110  |  Height: 111  |  Size: 15 KiB

BIN
Bushin/images/facility23.png

After

Width: 109  |  Height: 112  |  Size: 15 KiB

BIN
Bushin/images/facility24.png

After

Width: 110  |  Height: 112  |  Size: 14 KiB

BIN
Bushin/images/facility25.png

After

Width: 112  |  Height: 112  |  Size: 14 KiB

BIN
Bushin/images/facility3.png

After

Width: 108  |  Height: 109  |  Size: 12 KiB

BIN
Bushin/images/facility4.png

After

Width: 109  |  Height: 110  |  Size: 16 KiB

BIN
Bushin/images/facility5.png

After

Width: 109  |  Height: 109  |  Size: 14 KiB

BIN
Bushin/images/facility6.png

After

Width: 111  |  Height: 108  |  Size: 18 KiB

BIN
Bushin/images/facility7.png

After

Width: 111  |  Height: 109  |  Size: 14 KiB

BIN
Bushin/images/facility8.png

After

Width: 111  |  Height: 108  |  Size: 12 KiB

BIN
Bushin/images/facility9.png

After

Width: 111  |  Height: 107  |  Size: 19 KiB

BIN
Bushin/images/menu0.png

After

Width: 262  |  Height: 94  |  Size: 16 KiB

BIN
Bushin/images/menu1.png

After

Width: 100  |  Height: 98  |  Size: 16 KiB

BIN
Bushin/images/menu10.png

After

Width: 104  |  Height: 99  |  Size: 15 KiB

BIN
Bushin/images/menu11.png

After

Width: 100  |  Height: 100  |  Size: 18 KiB

BIN
Bushin/images/menu12.png

After

Width: 109  |  Height: 104  |  Size: 17 KiB

BIN
Bushin/images/menu13.png

After

Width: 101  |  Height: 104  |  Size: 17 KiB

BIN
Bushin/images/menu14.png

After

Width: 103  |  Height: 104  |  Size: 18 KiB

BIN
Bushin/images/menu15.png

After

Width: 103  |  Height: 101  |  Size: 18 KiB

BIN
Bushin/images/menu16.png

After

Width: 100  |  Height: 103  |  Size: 15 KiB

BIN
Bushin/images/menu2.png

After

Width: 101  |  Height: 101  |  Size: 17 KiB

BIN
Bushin/images/menu3.png

After

Width: 99  |  Height: 101  |  Size: 17 KiB

BIN
Bushin/images/menu4.png

After

Width: 104  |  Height: 102  |  Size: 18 KiB

BIN
Bushin/images/menu5.png

After

Width: 102  |  Height: 100  |  Size: 18 KiB

BIN
Bushin/images/menu6.png

After

Width: 100  |  Height: 101  |  Size: 17 KiB

BIN
Bushin/images/menu7.png

After

Width: 109  |  Height: 102  |  Size: 17 KiB

BIN
Bushin/images/menu8.png

After

Width: 108  |  Height: 102  |  Size: 19 KiB

BIN
Bushin/images/menu9.png

After

Width: 104  |  Height: 100  |  Size: 20 KiB

18
Bushin/main.mm

@ -0,0 +1,18 @@
//
// main.m
// Bushin
//
// Created by miyazaki on 2014/05/17.
// Copyright (c) 2014年 venus. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "AppDelegate.h"
int main(int argc, char * argv[])
{
@autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
}
}

219
Bushin/media/RTShaderLib/FFPLib_Common.cg

@ -0,0 +1,219 @@
/*
-----------------------------------------------------------------------------
This source file is part of OGRE
(Object-oriented Graphics Rendering Engine)
For the latest info, see http://www.ogre3d.org
Copyright (c) 2000-2012 Torus Knot Software Ltd
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-----------------------------------------------------------------------------
*/
//-----------------------------------------------------------------------------
// Program Name: FFPLib_Common
// Program Desc: Common functions of the FFP.
// Program Type: Vertex/Pixel shader
// Language: CG
// Notes: Common functions needed by all FFP implementation classes.
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
void FFP_Assign(in float vIn, out float vOut)
{
vOut = vIn;
}
//-----------------------------------------------------------------------------
void FFP_Assign(in float2 vIn, out float2 vOut)
{
vOut = vIn;
}
//-----------------------------------------------------------------------------
void FFP_Assign(in float3 vIn, out float3 vOut)
{
vOut = vIn;
}
//-----------------------------------------------------------------------------
void FFP_Assign(in float4 vIn, out float4 vOut)
{
vOut = vIn;
}
//-----------------------------------------------------------------------------
void FFP_Construct(in float r,
in float g,
in float b,
in float a,
out float4 vOut)
{
vOut = float4(r,g,b,a);
}
//-----------------------------------------------------------------------------
void FFP_Construct(in float r,
in float g,
out float2 vOut)
{
vOut = float2(r,g);
}
//-----------------------------------------------------------------------------
void FFP_Construct(in float r,
in float g,
in float b,
out float3 vOut)
{
vOut = float3(r,g,b);
}
//-----------------------------------------------------------------------------
void FFP_Construct(in float r,
out float4 vOut)
{
vOut = float4(r,r,r,r);
}
//-----------------------------------------------------------------------------
void FFP_Modulate(in float vIn0, in float vIn1, out float vOut)
{
vOut = vIn0 * vIn1;
}
//-----------------------------------------------------------------------------
void FFP_Modulate(in float2 vIn0, in float2 vIn1, out float2 vOut)
{
vOut = vIn0 * vIn1;
}
//-----------------------------------------------------------------------------
void FFP_Modulate(in float3 vIn0, in float3 vIn1, out float3 vOut)
{
vOut = vIn0 * vIn1;
}
//-----------------------------------------------------------------------------
void FFP_Modulate(in float4 vIn0, in float4 vIn1, out float4 vOut)
{
vOut = vIn0 * vIn1;
}
//-----------------------------------------------------------------------------
void FFP_Add(in float vIn0, in float vIn1, out float vOut)
{
vOut = vIn0 + vIn1;
}
//-----------------------------------------------------------------------------
void FFP_Add(in float2 vIn0, in float2 vIn1, out float2 vOut)
{
vOut = vIn0 + vIn1;
}
//-----------------------------------------------------------------------------
void FFP_Add(in float3 vIn0, in float3 vIn1, out float3 vOut)
{
vOut = vIn0 + vIn1;
}
//-----------------------------------------------------------------------------
void FFP_Add(in float4 vIn0, in float4 vIn1, out float4 vOut)
{
vOut = vIn0 + vIn1;
}
//-----------------------------------------------------------------------------
void FFP_Subtract(in float vIn0, in float vIn1, out float vOut)
{
vOut = vIn0 - vIn1;
}
//-----------------------------------------------------------------------------
void FFP_Subtract(in float2 vIn0, in float2 vIn1, out float2 vOut)
{
vOut = vIn0 - vIn1;
}
//-----------------------------------------------------------------------------
void FFP_Subtract(in float3 vIn0, in float3 vIn1, out float3 vOut)
{
vOut = vIn0 - vIn1;
}
//-----------------------------------------------------------------------------
void FFP_Subtract(in float4 vIn0, in float4 vIn1, out float4 vOut)
{
vOut = vIn0 - vIn1;
}
//-----------------------------------------------------------------------------
void FFP_Lerp(in float vIn0, in float vIn1, float T, out float vOut)
{
vOut = lerp(vIn0, vIn1, T);
}
//-----------------------------------------------------------------------------
void FFP_Lerp(in float2 vIn0, in float2 vIn1, float T, out float2 vOut)
{
vOut = lerp(vIn0, vIn1, T);
}
//-----------------------------------------------------------------------------
void FFP_Lerp(in float3 vIn0, in float3 vIn1, float T, out float3 vOut)
{
vOut = lerp(vIn0, vIn1, T);
}
//-----------------------------------------------------------------------------
void FFP_Lerp(in float4 vIn0, in float4 vIn1, float T, out float4 vOut)
{
vOut = lerp(vIn0, vIn1, T);
}
//-----------------------------------------------------------------------------
void FFP_Lerp(in float4 vIn0, in float4 vIn1, float4 T, out float4 vOut)
{
vOut = lerp(vIn0, vIn1, T);
}
//-----------------------------------------------------------------------------
void FFP_DotProduct(in float vIn0, in float vIn1, out float vOut)
{
vOut = dot(vIn0, vIn1);
}
//-----------------------------------------------------------------------------
void FFP_DotProduct(in float2 vIn0, in float2 vIn1, out float2 vOut)
{
vOut = dot(vIn0, vIn1);
}
//-----------------------------------------------------------------------------
void FFP_DotProduct(in float3 vIn0, in float3 vIn1, out float3 vOut)
{
vOut = dot(vIn0, vIn1);
}
//-----------------------------------------------------------------------------
void FFP_DotProduct(in float4 vIn0, in float4 vIn1, out float4 vOut)
{
vOut = dot(vIn0, vIn1);
}

227
Bushin/media/RTShaderLib/FFPLib_Common.glsl

@ -0,0 +1,227 @@
#version 120
/*
-----------------------------------------------------------------------------
This source file is part of OGRE
(Object-oriented Graphics Rendering Engine)
For the latest info, see http://www.ogre3d.org
Copyright (c) 2000-2012 Torus Knot Software Ltd
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-----------------------------------------------------------------------------
*/
//-----------------------------------------------------------------------------
// Program Name: FFPLib_Common
// Program Desc: Common functions of the FFP.
// Program Type: Vertex/Pixel shader
// Language: GLSL
// Notes: Common functions needed by all FFP implementation classes.
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
void FFP_Assign(in float vIn, out float vOut)
{
vOut = vIn;
}
//-----------------------------------------------------------------------------
void FFP_Assign(in vec2 vIn, out vec2 vOut)
{
vOut = vIn;
}
//-----------------------------------------------------------------------------
void FFP_Assign(in vec3 vIn, out vec3 vOut)
{
vOut = vIn;
}
//-----------------------------------------------------------------------------
void FFP_Assign(in vec4 vIn, out vec4 vOut)
{
vOut = vIn;
}
//-----------------------------------------------------------------------------
void FFP_Assign(in vec4 vIn, out vec2 vOut)
{
vOut = vIn.xy;
}
//-----------------------------------------------------------------------------
void FFP_Assign(in vec4 vIn, out vec3 vOut)
{
vOut = vIn.xyz;
}
//-----------------------------------------------------------------------------
void FFP_Construct(in float r,
in float g,
in float b,
in float a,
out vec4 vOut)
{
vOut = vec4(r,g,b,a);
}
//-----------------------------------------------------------------------------
void FFP_Construct(in float r,
in float g,
in float b,
out vec3 vOut)
{
vOut = vec3(r,g,b);
}
//-----------------------------------------------------------------------------
void FFP_Construct(in float r,
out vec4 vOut)
{
vOut = vec4(r,r,r,r);
}
//-----------------------------------------------------------------------------
void FFP_Construct(in float r,
in float g,
out vec2 vOut)
{
vOut = vec2(r,g);
}
//-----------------------------------------------------------------------------
void FFP_Modulate(in float vIn0, in float vIn1, out float vOut)
{
vOut = vIn0 * vIn1;
}
//-----------------------------------------------------------------------------
void FFP_Modulate(in vec2 vIn0, in vec2 vIn1, out vec2 vOut)
{
vOut = vIn0 * vIn1;
}
//-----------------------------------------------------------------------------
void FFP_Modulate(in vec3 vIn0, in vec3 vIn1, out vec3 vOut)
{
vOut = vIn0 * vIn1;
}
//-----------------------------------------------------------------------------
void FFP_Modulate(in vec4 vIn0, in vec4 vIn1, out vec4 vOut)
{
vOut = vIn0 * vIn1;
}
//-----------------------------------------------------------------------------
void FFP_Add(in float vIn0, in float vIn1, out float vOut)
{
vOut = vIn0 + vIn1;
}
//-----------------------------------------------------------------------------
void FFP_Add(in vec2 vIn0, in vec2 vIn1, out vec2 vOut)
{
vOut = vIn0 + vIn1;
}
//-----------------------------------------------------------------------------
void FFP_Add(in vec3 vIn0, in vec3 vIn1, out vec3 vOut)
{
vOut = vIn0 + vIn1;
}
//-----------------------------------------------------------------------------
void FFP_Add(in vec4 vIn0, in vec4 vIn1, out vec4 vOut)
{
vOut = vIn0 + vIn1;
}
//-----------------------------------------------------------------------------
void FFP_Subtract(in float vIn0, in float vIn1, out float vOut)
{
vOut = vIn0 - vIn1;
}
//-----------------------------------------------------------------------------
void FFP_Subtract(in vec2 vIn0, in vec2 vIn1, out vec2 vOut)
{
vOut = vIn0 - vIn1;
}
//-----------------------------------------------------------------------------
void FFP_Subtract(in vec3 vIn0, in vec3 vIn1, out vec3 vOut)
{
vOut = vIn0 - vIn1;
}
//-----------------------------------------------------------------------------
void FFP_Subtract(in vec4 vIn0, in vec4 vIn1, out vec4 vOut)
{
vOut = vIn0 - vIn1;
}
//-----------------------------------------------------------------------------
void FFP_Lerp(in float vIn0, in float vIn1, float T, out float vOut)
{
vOut = mix(vIn0, vIn1, T);
}
//-----------------------------------------------------------------------------
void FFP_Lerp(in vec2 vIn0, in vec2 vIn1, float T, out vec2 vOut)
{
vOut = mix(vIn0, vIn1, T);
}
//-----------------------------------------------------------------------------
void FFP_Lerp(in vec3 vIn0, in vec3 vIn1, float T, out vec3 vOut)
{
vOut = mix(vIn0, vIn1, T);
}
//-----------------------------------------------------------------------------
void FFP_Lerp(in vec4 vIn0, in vec4 vIn1, float T, out vec4 vOut)
{
vOut = mix(vIn0, vIn1, T);
}
//-----------------------------------------------------------------------------
void FFP_Lerp(in vec4 vIn0, in vec4 vIn1, vec4 T, out vec4 vOut)
{
vOut = mix(vIn0, vIn1, T);
}
//-----------------------------------------------------------------------------
void FFP_DotProduct(in float vIn0, in float vIn1, out float vOut)
{
vOut = dot(vIn0, vIn1);
}
//-----------------------------------------------------------------------------
void FFP_DotProduct(in vec2 vIn0, in vec2 vIn1, out vec2 vOut)
{
vOut = vec2(dot(vIn0, vIn1), 1.0);
}
//-----------------------------------------------------------------------------
void FFP_DotProduct(in vec3 vIn0, in vec3 vIn1, out vec3 vOut)
{
vOut = vec3(dot(vIn0, vIn1), 1.0, 1.0);
}
//-----------------------------------------------------------------------------
void FFP_DotProduct(in vec4 vIn0, in vec4 vIn1, out vec4 vOut)
{
vOut = vec4(dot(vIn0, vIn1), 1.0, 1.0, 1.0);
}

231
Bushin/media/RTShaderLib/FFPLib_Common.glsles

@ -0,0 +1,231 @@
#version 100
precision highp float;
precision highp int;
precision lowp sampler2D;
precision lowp samplerCube;
/*
-----------------------------------------------------------------------------
This source file is part of OGRE
(Object-oriented Graphics Rendering Engine)
For the latest info, see http://www.ogre3d.org
Copyright (c) 2000-2012 Torus Knot Software Ltd
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-----------------------------------------------------------------------------
*/
//-----------------------------------------------------------------------------
// Program Name: FFPLib_Common
// Program Desc: Common functions of the FFP.
// Program Type: Vertex/Pixel shader
// Language: GLSL ES
// Notes: Common functions needed by all FFP implementation classes.
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
void FFP_Assign(in float vIn, out float vOut)
{
vOut = vIn;
}
//-----------------------------------------------------------------------------
void FFP_Assign(in vec2 vIn, out vec2 vOut)
{
vOut = vIn;
}
//-----------------------------------------------------------------------------
void FFP_Assign(in vec3 vIn, out vec3 vOut)
{
vOut = vIn;
}
//-----------------------------------------------------------------------------
void FFP_Assign(in vec4 vIn, out vec4 vOut)
{
vOut = vIn;
}
//-----------------------------------------------------------------------------
void FFP_Assign(in vec4 vIn, out vec2 vOut)
{
vOut = vIn.xy;
}
//-----------------------------------------------------------------------------
void FFP_Assign(in vec4 vIn, out vec3 vOut)
{
vOut = vIn.xyz;
}
//-----------------------------------------------------------------------------
void FFP_Construct(in float r,
in float g,
in float b,
in float a,
out vec4 vOut)
{
vOut = vec4(r,g,b,a);
}
//-----------------------------------------------------------------------------
void FFP_Construct(in float r,
in float g,
in float b,
out vec3 vOut)
{
vOut = vec3(r,g,b);
}
//-----------------------------------------------------------------------------
void FFP_Construct(in float r,
out vec4 vOut)
{
vOut = vec4(r,r,r,r);
}
//-----------------------------------------------------------------------------
void FFP_Construct(in float r,
in float g,
out vec2 vOut)
{
vOut = vec2(r,g);
}
//-----------------------------------------------------------------------------
void FFP_Modulate(in float vIn0, in float vIn1, out float vOut)
{
vOut = vIn0 * vIn1;
}
//-----------------------------------------------------------------------------
void FFP_Modulate(in vec2 vIn0, in vec2 vIn1, out vec2 vOut)
{
vOut = vIn0 * vIn1;
}
//-----------------------------------------------------------------------------
void FFP_Modulate(in vec3 vIn0, in vec3 vIn1, out vec3 vOut)
{
vOut = vIn0 * vIn1;
}
//-----------------------------------------------------------------------------
void FFP_Modulate(in vec4 vIn0, in vec4 vIn1, out vec4 vOut)
{
vOut = vIn0 * vIn1;
}
//-----------------------------------------------------------------------------
void FFP_Add(in float vIn0, in float vIn1, out float vOut)
{
vOut = vIn0 + vIn1;
}
//-----------------------------------------------------------------------------
void FFP_Add(in vec2 vIn0, in vec2 vIn1, out vec2 vOut)
{
vOut = vIn0 + vIn1;
}
//-----------------------------------------------------------------------------
void FFP_Add(in vec3 vIn0, in vec3 vIn1, out vec3 vOut)
{
vOut = vIn0 + vIn1;
}
//-----------------------------------------------------------------------------
void FFP_Add(in vec4 vIn0, in vec4 vIn1, out vec4 vOut)
{
vOut = vIn0 + vIn1;
}
//-----------------------------------------------------------------------------
void FFP_Subtract(in float vIn0, in float vIn1, out float vOut)
{
vOut = vIn0 - vIn1;
}
//-----------------------------------------------------------------------------
void FFP_Subtract(in vec2 vIn0, in vec2 vIn1, out vec2 vOut)
{
vOut = vIn0 - vIn1;
}
//-----------------------------------------------------------------------------
void FFP_Subtract(in vec3 vIn0, in vec3 vIn1, out vec3 vOut)
{
vOut = vIn0 - vIn1;
}
//-----------------------------------------------------------------------------
void FFP_Subtract(in vec4 vIn0, in vec4 vIn1, out vec4 vOut)
{
vOut = vIn0 - vIn1;
}
//-----------------------------------------------------------------------------
void FFP_Lerp(in float vIn0, in float vIn1, in float T, out float vOut)
{
vOut = mix(vIn0, vIn1, T);
}
//-----------------------------------------------------------------------------
void FFP_Lerp(in vec2 vIn0, in vec2 vIn1, in float T, out vec2 vOut)
{
vOut = mix(vIn0, vIn1, T);
}
//-----------------------------------------------------------------------------
void FFP_Lerp(in vec3 vIn0, in vec3 vIn1, in float T, out vec3 vOut)
{
vOut = mix(vIn0, vIn1, T);
}
//-----------------------------------------------------------------------------
void FFP_Lerp(in vec4 vIn0, in vec4 vIn1, in float T, out vec4 vOut)
{
vOut = mix(vIn0, vIn1, T);
}
//-----------------------------------------------------------------------------
void FFP_Lerp(in vec4 vIn0, in vec4 vIn1, in vec4 T, out vec4 vOut)
{
vOut = mix(vIn0, vIn1, T);
}
//-----------------------------------------------------------------------------
void FFP_DotProduct(in float vIn0, in float vIn1, out float vOut)
{
vOut = dot(vIn0, vIn1);
}
//-----------------------------------------------------------------------------
void FFP_DotProduct(in vec2 vIn0, in vec2 vIn1, out vec2 vOut)
{
vOut = vec2(dot(vIn0, vIn1), 1.0);
}
//-----------------------------------------------------------------------------
void FFP_DotProduct(in vec3 vIn0, in vec3 vIn1, out vec3 vOut)
{
vOut = vec3(dot(vIn0, vIn1), 1.0, 1.0);
}
//-----------------------------------------------------------------------------
void FFP_DotProduct(in vec4 vIn0, in vec4 vIn1, out vec4 vOut)
{
vOut = vec4(dot(vIn0, vIn1), 1.0, 1.0, 1.0);
}

219
Bushin/media/RTShaderLib/FFPLib_Common.hlsl

@ -0,0 +1,219 @@
/*
-----------------------------------------------------------------------------
This source file is part of OGRE
(Object-oriented Graphics Rendering Engine)
For the latest info, see http://www.ogre3d.org
Copyright (c) 2000-2012 Torus Knot Software Ltd
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-----------------------------------------------------------------------------
*/
//-----------------------------------------------------------------------------
// Program Name: FFPLib_Common
// Program Desc: Common functions of the FFP.
// Program Type: Vertex/Pixel shader
// Language: HLSL
// Notes: Common functions needed by all FFP implementation classes.
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
void FFP_Assign(in float vIn, out float vOut)
{
vOut = vIn;
}
//-----------------------------------------------------------------------------
void FFP_Assign(in float2 vIn, out float2 vOut)
{
vOut = vIn;
}
//-----------------------------------------------------------------------------
void FFP_Assign(in float3 vIn, out float3 vOut)
{
vOut = vIn;
}
//-----------------------------------------------------------------------------
void FFP_Assign(in float4 vIn, out float4 vOut)
{
vOut = vIn;
}
//-----------------------------------------------------------------------------
void FFP_Construct(in float r,
in float g,
in float b,
in float a,
out float4 vOut)
{
vOut = float4(r,g,b,a);
}
//-----------------------------------------------------------------------------
void FFP_Construct(in float r,
in float g,
out float2 vOut)
{
vOut = float2(r,g);
}
//-----------------------------------------------------------------------------
void FFP_Construct(in float r,
in float g,
in float b,
out float3 vOut)
{
vOut = float3(r,g,b);
}
//-----------------------------------------------------------------------------
void FFP_Construct(in float r,
out float4 vOut)
{
vOut = float4(r,r,r,r);
}
//-----------------------------------------------------------------------------
void FFP_Modulate(in float vIn0, in float vIn1, out float vOut)
{
vOut = vIn0 * vIn1;
}
//-----------------------------------------------------------------------------
void FFP_Modulate(in float2 vIn0, in float2 vIn1, out float2 vOut)
{
vOut = vIn0 * vIn1;
}
//-----------------------------------------------------------------------------
void FFP_Modulate(in float3 vIn0, in float3 vIn1, out float3 vOut)
{
vOut = vIn0 * vIn1;
}
//-----------------------------------------------------------------------------
void FFP_Modulate(in float4 vIn0, in float4 vIn1, out float4 vOut)
{
vOut = vIn0 * vIn1;
}
//-----------------------------------------------------------------------------
void FFP_Add(in float vIn0, in float vIn1, out float vOut)
{
vOut = vIn0 + vIn1;
}
//-----------------------------------------------------------------------------
void FFP_Add(in float2 vIn0, in float2 vIn1, out float2 vOut)
{
vOut = vIn0 + vIn1;
}
//-----------------------------------------------------------------------------
void FFP_Add(in float3 vIn0, in float3 vIn1, out float3 vOut)
{
vOut = vIn0 + vIn1;
}
//-----------------------------------------------------------------------------
void FFP_Add(in float4 vIn0, in float4 vIn1, out float4 vOut)
{
vOut = vIn0 + vIn1;
}
//-----------------------------------------------------------------------------
void FFP_Subtract(in float vIn0, in float vIn1, out float vOut)
{
vOut = vIn0 - vIn1;
}
//-----------------------------------------------------------------------------
void FFP_Subtract(in float2 vIn0, in float2 vIn1, out float2 vOut)
{
vOut = vIn0 - vIn1;
}
//-----------------------------------------------------------------------------
void FFP_Subtract(in float3 vIn0, in float3 vIn1, out float3 vOut)
{
vOut = vIn0 - vIn1;
}
//-----------------------------------------------------------------------------
void FFP_Subtract(in float4 vIn0, in float4 vIn1, out float4 vOut)
{
vOut = vIn0 - vIn1;
}
//-----------------------------------------------------------------------------
void FFP_Lerp(in float vIn0, in float vIn1, float T, out float vOut)
{
vOut = lerp(vIn0, vIn1, T);
}
//-----------------------------------------------------------------------------
void FFP_Lerp(in float2 vIn0, in float2 vIn1, float T, out float2 vOut)
{
vOut = lerp(vIn0, vIn1, T);
}
//-----------------------------------------------------------------------------
void FFP_Lerp(in float3 vIn0, in float3 vIn1, float T, out float3 vOut)
{
vOut = lerp(vIn0, vIn1, T);
}
//-----------------------------------------------------------------------------
void FFP_Lerp(in float4 vIn0, in float4 vIn1, float T, out float4 vOut)
{
vOut = lerp(vIn0, vIn1, T);
}
//-----------------------------------------------------------------------------
void FFP_Lerp(in float4 vIn0, in float4 vIn1, float4 T, out float4 vOut)
{
vOut = lerp(vIn0, vIn1, T);
}
//-----------------------------------------------------------------------------
void FFP_DotProduct(in float vIn0, in float vIn1, out float vOut)
{
vOut = dot(vIn0, vIn1);
}
//-----------------------------------------------------------------------------
void FFP_DotProduct(in float2 vIn0, in float2 vIn1, out float2 vOut)
{
vOut = dot(vIn0, vIn1);
}
//-----------------------------------------------------------------------------
void FFP_DotProduct(in float3 vIn0, in float3 vIn1, out float3 vOut)
{
vOut = dot(vIn0, vIn1);
}
//-----------------------------------------------------------------------------
void FFP_DotProduct(in float4 vIn0, in float4 vIn1, out float4 vOut)
{
vOut = dot(vIn0, vIn1);
}

138
Bushin/media/RTShaderLib/FFPLib_Fog.cg

@ -0,0 +1,138 @@
/*
-----------------------------------------------------------------------------
This source file is part of OGRE
(Object-oriented Graphics Rendering Engine)
For the latest info, see http://www.ogre3d.org
Copyright (c) 2000-2012 Torus Knot Software Ltd
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-----------------------------------------------------------------------------
*/
//-----------------------------------------------------------------------------
// Program Name: FFPLib_Fog
// Program Desc: Fog functions of the FFP.
// Program Type: Vertex/Pixel shader
// Language: CG
// Notes: Implements cor functions needed by FFPFog class.
// Based on fog engine.
// See http://msdn.microsoft.com/en-us/library/bb173398.aspx
// Vertex based fog: the w component of the out position is used
// as the distance parameter to fog formulas. This is basically the z coordinate
// in world space. See pixel fog under D3D docs. The fog factor is computed according
// to each formula, then clamped and output to the pixel shader.
// Pixel based fog: the w component of the out position is passed to pixel shader
// that computes the fog factor based on it.
// Both techniques use the fog factor in the end of the pixel shader to blend
// the output color with the fog color.
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
void FFP_VertexFog_Linear(in float4x4 mWorldViewProj,
in float4 pos,
in float4 fogParams,
out float oFogFactor)
{
float4 vOutPos = mul(mWorldViewProj, pos);
float distance = abs(vOutPos.w);
float fogFactor = (fogParams.z - distance) * fogParams.w;
oFogFactor = saturate(fogFactor);
}
//-----------------------------------------------------------------------------
void FFP_VertexFog_Exp(in float4x4 mWorldViewProj,
in float4 pos,
in float4 fogParams,
out float oFogFactor)
{
float4 vOutPos = mul(mWorldViewProj, pos);
float distance = abs(vOutPos.w);
float exp = distance*fogParams.x;
float fogFactor = 1 / pow(2.71828, exp);
oFogFactor = saturate(fogFactor);
}
//-----------------------------------------------------------------------------
void FFP_VertexFog_Exp2(in float4x4 mWorldViewProj,
in float4 pos,
in float4 fogParams,
out float oFogFactor)
{
float4 vOutPos = mul(mWorldViewProj, pos);
float distance = abs(vOutPos.w);
float exp = (distance*fogParams.x*distance*fogParams.x);
float fogFactor = 1 / pow(2.71828, exp);
oFogFactor = saturate(fogFactor);
}
//-----------------------------------------------------------------------------
void FFP_PixelFog_Depth(in float4x4 mWorldViewProj,
in float4 pos,
out float oDepth)
{
float4 vOutPos = mul(mWorldViewProj, pos);
oDepth = vOutPos.w;
}
//-----------------------------------------------------------------------------
void FFP_PixelFog_Linear(in float depth,
in float4 fogParams,
in float4 fogColor,
in float4 baseColor,
out float4 oColor)
{
float distance = abs(depth);
float fogFactor = saturate((fogParams.z - distance) * fogParams.w);
oColor = lerp(fogColor, baseColor, fogFactor);
}
//-----------------------------------------------------------------------------
void FFP_PixelFog_Exp(in float depth,
in float4 fogParams,
in float4 fogColor,
in float4 baseColor,
out float4 oColor)
{
float distance = abs(depth);
float exp = (distance*fogParams.x);
float fogFactor = saturate(1 / pow(2.71828, exp));
oColor = lerp(fogColor, baseColor, fogFactor);
}
//-----------------------------------------------------------------------------
void FFP_PixelFog_Exp2(in float depth,
in float4 fogParams,
in float4 fogColor,
in float4 baseColor,
out float4 oColor)
{
float distance = abs(depth);
float exp = (distance*fogParams.x*distance*fogParams.x);
float fogFactor = saturate(1 / pow(2.71828, exp));
oColor = lerp(fogColor, baseColor, fogFactor);
}

139
Bushin/media/RTShaderLib/FFPLib_Fog.glsl

@ -0,0 +1,139 @@
#version 120
/*
-----------------------------------------------------------------------------
This source file is part of OGRE
(Object-oriented Graphics Rendering Engine)
For the latest info, see http://www.ogre3d.org
Copyright (c) 2000-2012 Torus Knot Software Ltd
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-----------------------------------------------------------------------------
*/
//-----------------------------------------------------------------------------
// Program Name: FFPLib_Fog
// Program Desc: Fog functions of the FFP.
// Program Type: Vertex/Pixel shader
// Language: GLSL
// Notes: Implements core functions needed by FFPFog class.
// Based on fog engine.
// See http://msdn.microsoft.com/en-us/library/bb173398.aspx
// Vertex based fog: the w component of the out position is used
// as the distance parameter to fog formulas. This is basically the z coordinate
// in world space. See pixel fog under D3D docs. The fog factor is computed according
// to each formula, then clamped and output to the pixel shader.
// Pixel based fog: the w component of the out position is passed to pixel shader
// that computes the fog factor based on it.
// Both techniques use the fog factor in the end of the pixel shader to blend
// the output color with the fog color.
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
void FFP_VertexFog_Linear(in mat4 mWorldViewProj,
in vec4 pos,
in vec4 fogParams,
out float oFogFactor)
{
vec4 vOutPos = mWorldViewProj * pos;
float distance = abs(vOutPos.w);
float fogFactor = (fogParams.z - distance) * fogParams.w;
oFogFactor = clamp(fogFactor, 0.0, 1.0);
}
//-----------------------------------------------------------------------------
void FFP_VertexFog_Exp(in mat4 mWorldViewProj,
in vec4 pos,
in vec4 fogParams,
out float oFogFactor)
{
vec4 vOutPos = mWorldViewProj * pos;
float distance = abs(vOutPos.w);
float exp = distance*fogParams.x;
float fogFactor = 1.0 / pow(2.71828, exp);
oFogFactor = clamp(fogFactor, 0.0, 1.0);
}
//-----------------------------------------------------------------------------
void FFP_VertexFog_Exp2(in mat4 mWorldViewProj,
in vec4 pos,
in vec4 fogParams,
out float oFogFactor)
{
vec4 vOutPos = mWorldViewProj * pos;
float distance = abs(vOutPos.w);
float exp = (distance*fogParams.x*distance*fogParams.x);
float fogFactor = 1.0 / pow(2.71828, exp);
oFogFactor = clamp(fogFactor, 0.0, 1.0);
}
//-----------------------------------------------------------------------------
void FFP_PixelFog_Depth(in mat4 mWorldViewProj,
in vec4 pos,
out float oDepth)
{
vec4 vOutPos = mWorldViewProj * pos;
oDepth = vOutPos.w;
}
//-----------------------------------------------------------------------------
void FFP_PixelFog_Linear(in float depth,
in vec4 fogParams,
in vec4 fogColor,
in vec4 baseColor,
out vec4 oColor)
{
float distance = abs(depth);
float fogFactor = clamp((fogParams.z - distance) * fogParams.w, 0.0, 1.0);
oColor = mix(fogColor, baseColor, fogFactor);
}
//-----------------------------------------------------------------------------
void FFP_PixelFog_Exp(in float depth,
in vec4 fogParams,
in vec4 fogColor,
in vec4 baseColor,
out vec4 oColor)
{
float distance = abs(depth);
float exp = (distance*fogParams.x);
float fogFactor = clamp(1.0 / pow(2.71828, exp), 0.0, 1.0);
oColor = mix(fogColor, baseColor, fogFactor);
}
//-----------------------------------------------------------------------------
void FFP_PixelFog_Exp2(in float depth,
in vec4 fogParams,
in vec4 fogColor,
in vec4 baseColor,
out vec4 oColor)
{
float distance = abs(depth);
float exp = (distance*fogParams.x*distance*fogParams.x);
float fogFactor = clamp(1.0 / pow(2.71828, exp), 0.0, 1.0);
oColor = mix(fogColor, baseColor, fogFactor);
}

141
Bushin/media/RTShaderLib/FFPLib_Fog.glsles

@ -0,0 +1,141 @@
#version 100
precision highp float;
precision highp int;
precision lowp sampler2D;
precision lowp samplerCube;
/*
-----------------------------------------------------------------------------
This source file is part of OGRE
(Object-oriented Graphics Rendering Engine)
For the latest info, see http://www.ogre3d.org
Copyright (c) 2000-2012 Torus Knot Software Ltd
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-----------------------------------------------------------------------------
*/
//-----------------------------------------------------------------------------
// Program Name: FFPLib_Fog
// Program Desc: Fog functions of the FFP.
// Program Type: Vertex/Pixel shader
// Language: GLSL ES
// Notes: Implements core functions needed by FFPFog class.
// Based on fog engine.
// See http://msdn.microsoft.com/en-us/library/bb173398.aspx
// Vertex based fog: the w component of the out position is used
// as the distance parameter to fog formulas. This is basically the z coordinate
// in world space. See pixel fog under D3D docs. The fog factor is computed according
// to each formula, then clamped and output to the pixel shader.
// Pixel based fog: the w component of the out position is passed to pixel shader
// that computes the fog factor based on it.
// Both techniques use the fog factor in the end of the pixel shader to blend
// the output color with the fog color.
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
void FFP_VertexFog_Linear(in mat4 mWorldViewProj,
in vec4 pos,
in vec4 fogParams,
out float oFogFactor)
{
vec4 vOutPos = mWorldViewProj * pos;
float distance = abs(vOutPos.w);
float fogFactor = (fogParams.z - distance) * fogParams.w;
oFogFactor = clamp(fogFactor, 0.0, 1.0);
}
//-----------------------------------------------------------------------------
void FFP_VertexFog_Exp(in mat4 mWorldViewProj,
in vec4 pos,
in vec4 fogParams,
out float oFogFactor)
{
vec4 vOutPos = mWorldViewProj * pos;
float distance = abs(vOutPos.w);
float exp = distance * fogParams.x;
float fogFactor = 1.0 / pow(2.71828, exp);
oFogFactor = clamp(fogFactor, 0.0, 1.0);
}
//-----------------------------------------------------------------------------
void FFP_VertexFog_Exp2(in mat4 mWorldViewProj,
in vec4 pos,
in vec4 fogParams,
out float oFogFactor)
{
vec4 vOutPos = mWorldViewProj * pos;
float distance = abs(vOutPos.w);
float exp = (distance * fogParams.x * distance * fogParams.x);
float fogFactor = 1.0 / pow(2.71828, exp);
oFogFactor = clamp(fogFactor, 0.0, 1.0);
}
//-----------------------------------------------------------------------------
void FFP_PixelFog_Depth(in mat4 mWorldViewProj,
in vec4 pos,
out float oDepth)
{
vec4 vOutPos = mWorldViewProj * pos;
oDepth = vOutPos.w;
}
//-----------------------------------------------------------------------------
void FFP_PixelFog_Linear(in float depth,
in vec4 fogParams,
in vec4 fogColor,
in vec4 baseColor,
out vec4 oColor)
{
float distance = abs(depth);
float fogFactor = clamp((fogParams.z - distance) * fogParams.w, 0.0, 1.0);
oColor = mix(fogColor, baseColor, fogFactor);
}
//-----------------------------------------------------------------------------
void FFP_PixelFog_Exp(in float depth,
in vec4 fogParams,
in vec4 fogColor,
in vec4 baseColor,
out vec4 oColor)
{
float distance = abs(depth);
float exp = (distance * fogParams.x);
float fogFactor = clamp(1.0 / pow(2.71828, exp), 0.0, 1.0);
oColor = mix(fogColor, baseColor, fogFactor);
}
//-----------------------------------------------------------------------------
void FFP_PixelFog_Exp2(in float depth,
in vec4 fogParams,
in vec4 fogColor,
in vec4 baseColor,
out vec4 oColor)
{
float distance = abs(depth);
float exp = (distance * fogParams.x * distance * fogParams.x);
float fogFactor = clamp(1.0 / pow(2.71828, exp), 0.0, 1.0);
oColor = mix(fogColor, baseColor, fogFactor);
}

138
Bushin/media/RTShaderLib/FFPLib_Fog.hlsl

@ -0,0 +1,138 @@
/*
-----------------------------------------------------------------------------
This source file is part of OGRE
(Object-oriented Graphics Rendering Engine)
For the latest info, see http://www.ogre3d.org
Copyright (c) 2000-2012 Torus Knot Software Ltd
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-----------------------------------------------------------------------------
*/
//-----------------------------------------------------------------------------
// Program Name: FFPLib_Fog
// Program Desc: Fog functions of the FFP.
// Program Type: Vertex/Pixel shader
// Language: HLSL
// Notes: Implements cor functions needed by FFPFog class.
// Based on fog engine.
// See http://msdn.microsoft.com/en-us/library/bb173398.aspx
// Vertex based fog: the w component of the out position is used
// as the distance parameter to fog formulas. This is basically the z coordinate
// in world space. See pixel fog under D3D docs. The fog factor is computed according
// to each formula, then clamped and output to the pixel shader.
// Pixel based fog: the w component of the out position is passed to pixel shader
// that computes the fog factor based on it.
// Both techniques use the fog factor in the end of the pixel shader to blend
// the output color with the fog color.
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
void FFP_VertexFog_Linear(in float4x4 mWorldViewProj,
in float4 pos,
in float4 fogParams,
out float oFogFactor)
{
float4 vOutPos = mul(mWorldViewProj, pos);
float distance = abs(vOutPos.w);
float fogFactor = (fogParams.z - distance) * fogParams.w;
oFogFactor = saturate(fogFactor);
}
//-----------------------------------------------------------------------------
void FFP_VertexFog_Exp(in float4x4 mWorldViewProj,
in float4 pos,
in float4 fogParams,
out float oFogFactor)
{
float4 vOutPos = mul(mWorldViewProj, pos);
float distance = abs(vOutPos.w);
float exp = distance*fogParams.x;
float fogFactor = 1 / pow(2.71828, exp);
oFogFactor = saturate(fogFactor);
}
//-----------------------------------------------------------------------------
void FFP_VertexFog_Exp2(in float4x4 mWorldViewProj,
in float4 pos,
in float4 fogParams,
out float oFogFactor)
{
float4 vOutPos = mul(mWorldViewProj, pos);
float distance = abs(vOutPos.w);
float exp = (distance*fogParams.x*distance*fogParams.x);
float fogFactor = 1 / pow(2.71828, exp);
oFogFactor = saturate(fogFactor);
}
//-----------------------------------------------------------------------------
void FFP_PixelFog_Depth(in float4x4 mWorldViewProj,
in float4 pos,
out float oDepth)
{
float4 vOutPos = mul(mWorldViewProj, pos);
oDepth = vOutPos.w;
}
//-----------------------------------------------------------------------------
void FFP_PixelFog_Linear(in float depth,
in float4 fogParams,
in float4 fogColor,
in float4 baseColor,
out float4 oColor)
{
float distance = abs(depth);
float fogFactor = saturate((fogParams.z - distance) * fogParams.w);
oColor = lerp(fogColor, baseColor, fogFactor);
}
//-----------------------------------------------------------------------------
void FFP_PixelFog_Exp(in float depth,
in float4 fogParams,
in float4 fogColor,
in float4 baseColor,
out float4 oColor)
{
float distance = abs(depth);
float exp = (distance*fogParams.x);
float fogFactor = saturate(1 / pow(2.71828, exp));
oColor = lerp(fogColor, baseColor, fogFactor);
}
//-----------------------------------------------------------------------------
void FFP_PixelFog_Exp2(in float depth,
in float4 fogParams,
in float4 fogColor,
in float4 baseColor,
out float4 oColor)
{
float distance = abs(depth);
float exp = (distance*fogParams.x*distance*fogParams.x);
float fogFactor = saturate(1 / pow(2.71828, exp));
oColor = lerp(fogColor, baseColor, fogFactor);
}

225
Bushin/media/RTShaderLib/FFPLib_Lighting.cg

@ -0,0 +1,225 @@
/*
-----------------------------------------------------------------------------
This source file is part of OGRE
(Object-oriented Graphics Rendering Engine)
For the latest info, see http://www.ogre3d.org
Copyright (c) 2000-2012 Torus Knot Software Ltd
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-----------------------------------------------------------------------------
*/
//-----------------------------------------------------------------------------
// Program Name: FFPLib_Lighting
// Program Desc: Lighting functions of the FFP.
// Program Type: Vertex shader
// Language: CG
// Notes: Implements core functions for FFPLighting class.
// based on lighting engine.
// See http://msdn.microsoft.com/en-us/library/bb147178.aspx
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
void FFP_Light_Directional_Diffuse(in float4x4 mWorldViewIT,
in float3 vNormal,
in float3 vNegLightDirView,
in float3 vDiffuseColour,
in float3 vBaseColour,
out float3 vOut)
{
float3 vNormalView = normalize(mul((float3x3)mWorldViewIT, vNormal));
float nDotL = dot(vNormalView, vNegLightDirView);
vOut = vBaseColour + vDiffuseColour * saturate(nDotL);
}
//-----------------------------------------------------------------------------
void FFP_Light_Directional_DiffuseSpecular(in float4x4 mWorldView,
in float4 vPos,
in float4x4 mWorldViewIT,
in float3 vNormal,
in float3 vNegLightDirView,
in float3 vDiffuseColour,
in float3 vSpecularColour,
in float fSpecularPower,
in float3 vBaseDiffuseColour,
in float3 vBaseSpecularColour,
out float3 vOutDiffuse,
out float3 vOutSpecular)
{
vOutDiffuse = vBaseDiffuseColour;
vOutSpecular = vBaseSpecularColour;
float3 vNormalView = normalize(mul((float3x3)mWorldViewIT, vNormal));
float nDotL = dot(vNormalView, vNegLightDirView);
float3 vView = -normalize(mul(mWorldView, vPos).xyz);
float3 vHalfWay = normalize(vView + vNegLightDirView);
float nDotH = dot(vNormalView, vHalfWay);
if (nDotL > 0)
{
vOutDiffuse += vDiffuseColour * nDotL;
vOutSpecular += vSpecularColour * pow(saturate(nDotH), fSpecularPower);
}
}
//-----------------------------------------------------------------------------
void FFP_Light_Point_Diffuse(in float4x4 mWorldView,
in float4 vPos,
in float4x4 mWorldViewIT,
in float3 vNormal,
in float3 vLightPosView,
in float4 vAttParams,
in float3 vDiffuseColour,
in float3 vBaseColour,
out float3 vOut)
{
vOut = vBaseColour;
float3 vViewPos = mul(mWorldView, vPos).xyz;
float3 vLightView = vLightPosView - vViewPos;
float fLightD = length(vLightView);
float3 vNormalView = normalize(mul((float3x3)mWorldViewIT, vNormal));
float nDotL = dot(vNormalView, normalize(vLightView));
if (nDotL > 0 && fLightD <= vAttParams.x)
{
float fAtten = 1 / (vAttParams.y + vAttParams.z*fLightD + vAttParams.w*fLightD*fLightD);
vOut += vDiffuseColour * nDotL * fAtten;
}
}
//-----------------------------------------------------------------------------
void FFP_Light_Point_DiffuseSpecular(in float4x4 mWorldView,
in float4 vPos,
in float4x4 mWorldViewIT,
in float3 vNormal,
in float3 vLightPosView,
in float4 vAttParams,
in float3 vDiffuseColour,
in float3 vSpecularColour,
in float fSpecularPower,
in float3 vBaseDiffuseColour,
in float3 vBaseSpecularColour,
out float3 vOutDiffuse,
out float3 vOutSpecular)
{
vOutDiffuse = vBaseDiffuseColour;
vOutSpecular = vBaseSpecularColour;
float3 vViewPos = mul(mWorldView, vPos).xyz;
float3 vLightView = vLightPosView - vViewPos;
float fLightD = length(vLightView);
vLightView = normalize(vLightView);
float3 vNormalView = normalize(mul((float3x3)mWorldViewIT, vNormal));
float nDotL = dot(vNormalView, vLightView);
if (nDotL > 0 && fLightD <= vAttParams.x)
{
float3 vView = -normalize(vViewPos);
float3 vHalfWay = normalize(vView + vLightView);
float nDotH = dot(vNormalView, vHalfWay);
float fAtten = 1 / (vAttParams.y + vAttParams.z*fLightD + vAttParams.w*fLightD*fLightD);
vOutDiffuse += vDiffuseColour * nDotL * fAtten;
vOutSpecular += vSpecularColour * pow(saturate(nDotH), fSpecularPower) * fAtten;
}
}
//-----------------------------------------------------------------------------
void FFP_Light_Spot_Diffuse(in float4x4 mWorldView,
in float4 vPos,
in float4x4 mWorldViewIT,
in float3 vNormal,
in float3 vLightPosView,
in float3 vNegLightDirView,
in float4 vAttParams,
in float3 vSpotParams,
in float3 vDiffuseColour,
in float3 vBaseColour,
out float3 vOut)
{
vOut = vBaseColour;
float3 vViewPos = mul(mWorldView, vPos).xyz;
float3 vLightView = vLightPosView - vViewPos;
float fLightD = length(vLightView);
vLightView = normalize(vLightView);
float3 vNormalView = normalize(mul((float3x3)mWorldViewIT, vNormal));
float nDotL = dot(vNormalView, vLightView);
if (nDotL > 0 && fLightD <= vAttParams.x)
{
float fAtten = 1 / (vAttParams.y + vAttParams.z*fLightD + vAttParams.w*fLightD*fLightD);
float rho = dot(vNegLightDirView, vLightView);
float fSpotE = saturate((rho - vSpotParams.y) / (vSpotParams.x - vSpotParams.y));
float fSpotT = pow(fSpotE, vSpotParams.z);
vOut += vDiffuseColour * nDotL * fAtten * fSpotT;
}
}
//-----------------------------------------------------------------------------
void FFP_Light_Spot_DiffuseSpecular(in float4x4 mWorldView,
in float4 vPos,
in float4x4 mWorldViewIT,
in float3 vNormal,
in float3 vLightPosView,
in float3 vNegLightDirView,
in float4 vAttParams,
in float3 vSpotParams,
in float3 vDiffuseColour,
in float3 vSpecularColour,
in float fSpecularPower,
in float3 vBaseDiffuseColour,
in float3 vBaseSpecularColour,
out float3 vOutDiffuse,
out float3 vOutSpecular)
{
vOutDiffuse = vBaseDiffuseColour;
vOutSpecular = vBaseSpecularColour;
float3 vViewPos = mul(mWorldView, vPos).xyz;
float3 vLightView = vLightPosView - vViewPos;
float fLightD = length(vLightView);
vLightView = normalize(vLightView);
float3 vNormalView = normalize(mul((float3x3)mWorldViewIT, vNormal));
float nDotL = dot(vNormalView, vLightView);
if (nDotL > 0 && fLightD <= vAttParams.x)
{
float3 vView = -normalize(vViewPos);
float3 vHalfWay = normalize(vView + vLightView);
float nDotH = dot(vNormalView, vHalfWay);
float fAtten = 1 / (vAttParams.y + vAttParams.z*fLightD + vAttParams.w*fLightD*fLightD);
float rho = dot(vNegLightDirView, vLightView);
float fSpotE = saturate((rho - vSpotParams.y) / (vSpotParams.x - vSpotParams.y));
float fSpotT = pow(fSpotE, vSpotParams.z);
vOutDiffuse += vDiffuseColour * nDotL * fAtten * fSpotT;
vOutSpecular += vSpecularColour * pow(saturate(nDotH), fSpecularPower) * fAtten * fSpotT;
}
}

226
Bushin/media/RTShaderLib/FFPLib_Lighting.glsl

@ -0,0 +1,226 @@
#version 120
/*
-----------------------------------------------------------------------------
This source file is part of OGRE
(Object-oriented Graphics Rendering Engine)
For the latest info, see http://www.ogre3d.org
Copyright (c) 2000-2012 Torus Knot Software Ltd
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-----------------------------------------------------------------------------
*/
//-----------------------------------------------------------------------------
// Program Name: FFPLib_Lighting
// Program Desc: Lighting functions of the FFP.
// Program Type: Vertex shader
// Language: GLSL
// Notes: Implements core functions for FFPLighting class.
// based on lighting engine.
// See http://msdn.microsoft.com/en-us/library/bb147178.aspx
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
void FFP_Light_Directional_Diffuse(in mat4 mWorldViewIT,
in vec3 vNormal,
in vec3 vNegLightDirView,
in vec3 vDiffuseColour,
in vec3 vBaseColour,
out vec3 vOut)
{
vec3 vNormalView = normalize((mWorldViewIT * vec4(vNormal.xyz, 1.0)).xyz);
float nDotL = dot(vNormalView, vNegLightDirView);
vOut = vBaseColour + vDiffuseColour * clamp(nDotL, 0.0, 1.0);
}
//-----------------------------------------------------------------------------
void FFP_Light_Directional_DiffuseSpecular(in mat4 mWorldView,
in vec4 vPos,
in mat4 mWorldViewIT,
in vec3 vNormal,
in vec3 vNegLightDirView,
in vec3 vDiffuseColour,
in vec3 vSpecularColour,
in float fSpecularPower,
in vec3 vBaseDiffuseColour,
in vec3 vBaseSpecularColour,
out vec3 vOutDiffuse,
out vec3 vOutSpecular)
{
vOutDiffuse = vBaseDiffuseColour;
vOutSpecular = vBaseSpecularColour;
vec3 vNormalView = normalize((mWorldViewIT * vec4(vNormal.xyz, 1.0)).xyz);
float nDotL = dot(vNormalView, vNegLightDirView);
vec3 vView = -normalize((mWorldView* vPos).xyz);
vec3 vHalfWay = normalize(vView + vNegLightDirView);
float nDotH = dot(vNormalView, vHalfWay);
if (nDotL > 0.0)
{
vOutDiffuse += vDiffuseColour * nDotL;
vOutSpecular += vSpecularColour * pow(clamp(nDotH, 0.0, 1.0), fSpecularPower);
}
}
//-----------------------------------------------------------------------------
void FFP_Light_Point_Diffuse(in mat4 mWorldView,
in vec4 vPos,
in mat4 mWorldViewIT,
in vec3 vNormal,
in vec3 vLightPosView,
in vec4 vAttParams,
in vec3 vDiffuseColour,
in vec3 vBaseColour,
out vec3 vOut)
{
vOut = vBaseColour;
vec3 vViewPos = (mWorldView * vPos).xyz;
vec3 vLightView = vLightPosView - vViewPos;
float fLightD = length(vLightView);
vec3 vNormalView = normalize((mWorldViewIT * vec4(vNormal.xyz, 1.0)).xyz);
float nDotL = dot(vNormalView, normalize(vLightView));
if (nDotL > 0.0 && fLightD <= vAttParams.x)
{
float fAtten = 1.0 / (vAttParams.y + vAttParams.z*fLightD + vAttParams.w*fLightD*fLightD);
vOut += vDiffuseColour * nDotL * fAtten;
}
}
//-----------------------------------------------------------------------------
void FFP_Light_Point_DiffuseSpecular(in mat4 mWorldView,
in vec4 vPos,
in mat4 mWorldViewIT,
in vec3 vNormal,
in vec3 vLightPosView,
in vec4 vAttParams,
in vec3 vDiffuseColour,
in vec3 vSpecularColour,
in float fSpecularPower,
in vec3 vBaseDiffuseColour,
in vec3 vBaseSpecularColour,
out vec3 vOutDiffuse,
out vec3 vOutSpecular)
{
vOutDiffuse = vBaseDiffuseColour;
vOutSpecular = vBaseSpecularColour;
vec3 vViewPos = (mWorldView * vPos).xyz;
vec3 vLightView = vLightPosView - vViewPos;
float fLightD = length(vLightView);
vLightView = normalize(vLightView);
vec3 vNormalView = normalize((mWorldViewIT * vec4(vNormal.xyz, 1.0)).xyz);
float nDotL = dot(vNormalView, vLightView);
if (nDotL > 0.0 && fLightD <= vAttParams.x)
{
vec3 vView = -normalize(vViewPos);
vec3 vHalfWay = normalize(vView + vLightView);
float nDotH = dot(vNormalView, vHalfWay);
float fAtten = 1.0 / (vAttParams.y + vAttParams.z*fLightD + vAttParams.w*fLightD*fLightD);
vOutDiffuse += vDiffuseColour * nDotL * fAtten;
vOutSpecular += vSpecularColour * pow(clamp(nDotH, 0.0, 1.0), fSpecularPower) * fAtten;
}
}
//-----------------------------------------------------------------------------
void FFP_Light_Spot_Diffuse(in mat4 mWorldView,
in vec4 vPos,
in mat4 mWorldViewIT,
in vec3 vNormal,
in vec3 vLightPosView,
in vec3 vNegLightDirView,
in vec4 vAttParams,
in vec3 vSpotParams,
in vec3 vDiffuseColour,
in vec3 vBaseColour,
out vec3 vOut)
{
vOut = vBaseColour;
vec3 vViewPos = (mWorldView * vPos).xyz;
vec3 vLightView = vLightPosView - vViewPos;
float fLightD = length(vLightView);
vLightView = normalize(vLightView);
vec3 vNormalView = normalize((mWorldViewIT * vec4(vNormal.xyz, 1.0)).xyz);
float nDotL = dot(vNormalView, vLightView);
if (nDotL > 0.0 && fLightD <= vAttParams.x)
{
float fAtten = 1.0 / (vAttParams.y + vAttParams.z*fLightD + vAttParams.w*fLightD*fLightD);
float rho = dot(vNegLightDirView, vLightView);
float fSpotE = clamp((rho - vSpotParams.y) / (vSpotParams.x - vSpotParams.y), 0.0, 1.0);
float fSpotT = pow(fSpotE, vSpotParams.z);
vOut += vDiffuseColour * nDotL * fAtten * fSpotT;
}
}
//-----------------------------------------------------------------------------
void FFP_Light_Spot_DiffuseSpecular(in mat4 mWorldView,
in vec4 vPos,
in mat4 mWorldViewIT,
in vec3 vNormal,
in vec3 vLightPosView,
in vec3 vNegLightDirView,
in vec4 vAttParams,
in vec3 vSpotParams,
in vec3 vDiffuseColour,
in vec3 vSpecularColour,
in float fSpecularPower,
in vec3 vBaseDiffuseColour,
in vec3 vBaseSpecularColour,
out vec3 vOutDiffuse,
out vec3 vOutSpecular)
{
vOutDiffuse = vBaseDiffuseColour;
vOutSpecular = vBaseSpecularColour;
vec3 vViewPos = (mWorldView * vPos).xyz;
vec3 vLightView = vLightPosView - vViewPos;
float fLightD = length(vLightView);
vLightView = normalize(vLightView);
vec3 vNormalView = normalize((mWorldViewIT * vec4(vNormal.xyz, 1.0)).xyz);
float nDotL = dot(vNormalView, vLightView);
if (nDotL > 0.0 && fLightD <= vAttParams.x)
{
vec3 vView = -normalize(vViewPos);
vec3 vHalfWay = normalize(vView + vLightView);
float nDotH = dot(vNormalView, vHalfWay);
float fAtten = 1.0 / (vAttParams.y + vAttParams.z*fLightD + vAttParams.w*fLightD*fLightD);
float rho = dot(vNegLightDirView, vLightView);
float fSpotE = clamp((rho - vSpotParams.y) / (vSpotParams.x - vSpotParams.y), 0.0, 1.0);
float fSpotT = pow(fSpotE, vSpotParams.z);
vOutDiffuse += vDiffuseColour * nDotL * fAtten * fSpotT;
vOutSpecular += vSpecularColour * pow(clamp(nDotH, 0.0, 1.0), fSpecularPower) * fAtten * fSpotT;
}
}

227
Bushin/media/RTShaderLib/FFPLib_Lighting.glsles

@ -0,0 +1,227 @@
#version 100
precision highp float;
precision highp int;
precision lowp sampler2D;
precision lowp samplerCube;
/*
-----------------------------------------------------------------------------
This source file is part of OGRE
(Object-oriented Graphics Rendering Engine)
For the latest info, see http://www.ogre3d.org
Copyright (c) 2000-2012 Torus Knot Software Ltd
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-----------------------------------------------------------------------------
*/
//-----------------------------------------------------------------------------
// Program Name: FFPLib_Lighting
// Program Desc: Lighting functions of the FFP.
// Program Type: Vertex shader
// Language: GLSL ES
// Notes: Implements core functions for FFPLighting class.
// based on lighting engine.
// See http://msdn.microsoft.com/en-us/library/bb147178.aspx
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
void FFP_Light_Directional_Diffuse(in mat4 mWorldViewIT,
in vec3 vNormal,
in vec3 vNegLightDirView,
in vec3 vDiffuseColour,
in vec3 vBaseColour,
out vec3 vOut)
{
vec3 vNormalView = normalize((mWorldViewIT * vec4(vNormal.xyz, 1.0)).xyz);
float nDotL = dot(vNormalView, vNegLightDirView);
vOut = vBaseColour + vDiffuseColour * clamp(nDotL, 0.0, 1.0);
}
//-----------------------------------------------------------------------------
void FFP_Light_Directional_DiffuseSpecular(in mat4 mWorldView,
in vec4 vPos,
in mat4 mWorldViewIT,
in vec3 vNormal,
in vec3 vNegLightDirView,
in vec3 vDiffuseColour,
in vec3 vSpecularColour,
in float fSpecularPower,
in vec3 vBaseDiffuseColour,
in vec3 vBaseSpecularColour,
out vec3 vOutDiffuse,
out vec3 vOutSpecular)
{
vOutDiffuse = vBaseDiffuseColour;
vOutSpecular = vBaseSpecularColour;
vec3 vNormalView = normalize((mWorldViewIT * vec4(vNormal.xyz, 1.0)).xyz);
float nDotL = dot(vNormalView, vNegLightDirView);
vec3 vView = -normalize((mWorldView * vPos).xyz);
vec3 vHalfWay = normalize(vView + vNegLightDirView);
float nDotH = dot(vNormalView, vHalfWay);
if (nDotL > 0.0)
{
vOutDiffuse += vDiffuseColour * nDotL;
vOutSpecular += vSpecularColour * pow(clamp(nDotH, 0.0, 1.0), fSpecularPower);
}
}
//-----------------------------------------------------------------------------
void FFP_Light_Point_Diffuse(in mat4 mWorldView,
in vec4 vPos,
in mat4 mWorldViewIT,
in vec3 vNormal,
in vec3 vLightPosView,
in vec4 vAttParams,
in vec3 vDiffuseColour,
in vec3 vBaseColour,
out vec3 vOut)
{
vOut = vBaseColour;
vec3 vViewPos = (mWorldView * vPos).xyz;
vec3 vLightView = vLightPosView - vViewPos;
float fLightD = length(vLightView);
vec3 vNormalView = normalize((mWorldViewIT * vec4(vNormal.xyz, 1.0)).xyz);
float nDotL = dot(vNormalView, normalize(vLightView));
if (nDotL > 0.0 && fLightD <= vAttParams.x)
{
float fAtten = 1.0 / (vAttParams.y + vAttParams.z * fLightD + vAttParams.w * fLightD * fLightD);
vOut += vDiffuseColour * nDotL * fAtten;
}
}
//-----------------------------------------------------------------------------
void FFP_Light_Point_DiffuseSpecular(in mat4 mWorldView,
in vec4 vPos,
in mat4 mWorldViewIT,
in vec3 vNormal,
in vec3 vLightPosView,
in vec4 vAttParams,
in vec3 vDiffuseColour,
in vec3 vSpecularColour,
in float fSpecularPower,
in vec3 vBaseDiffuseColour,
in vec3 vBaseSpecularColour,
out vec3 vOutDiffuse,
out vec3 vOutSpecular)
{
vOutDiffuse = vBaseDiffuseColour;
vOutSpecular = vBaseSpecularColour;
vec3 vViewPos = (mWorldView * vPos).xyz;
vec3 vLightView = vLightPosView - vViewPos;
float fLightD = length(vLightView);
vLightView = normalize(vLightView);
vec3 vNormalView = normalize((mWorldViewIT * vec4(vNormal.xyz, 1.0)).xyz);
float nDotL = dot(vNormalView, vLightView);
if (nDotL > 0.0 && fLightD <= vAttParams.x)
{
vec3 vView = -normalize(vViewPos);
vec3 vHalfWay = normalize(vView + vLightView);
float nDotH = dot(vNormalView, vHalfWay);
float fAtten = 1.0 / (vAttParams.y + vAttParams.z * fLightD + vAttParams.w * fLightD * fLightD);
vOutDiffuse += vDiffuseColour * nDotL * fAtten;
vOutSpecular += vSpecularColour * pow(clamp(nDotH, 0.0, 1.0), fSpecularPower) * fAtten;
}
}
//-----------------------------------------------------------------------------
void FFP_Light_Spot_Diffuse(in mat4 mWorldView,
in vec4 vPos,
in mat4 mWorldViewIT,
in vec3 vNormal,
in vec3 vLightPosView,
in vec3 vNegLightDirView,
in vec4 vAttParams,
in vec3 vSpotParams,
in vec3 vDiffuseColour,
in vec3 vBaseColour,
out vec3 vOut)
{
vOut = vBaseColour;
vec3 vViewPos = (mWorldView * vPos).xyz;
vec3 vLightView = vLightPosView - vViewPos;
float fLightD = length(vLightView);
vLightView = normalize(vLightView);
vec3 vNormalView = normalize((mWorldViewIT * vec4(vNormal.xyz, 1.0)).xyz);
float nDotL = dot(vNormalView, vLightView);
if (nDotL > 0.0 && fLightD <= vAttParams.x)
{
float fAtten = 1.0 / (vAttParams.y + vAttParams.z * fLightD + vAttParams.w * fLightD * fLightD);
float rho = dot(vNegLightDirView, vLightView);
float fSpotE = clamp((rho - vSpotParams.y) / (vSpotParams.x - vSpotParams.y), 0.0, 1.0);
float fSpotT = pow(fSpotE, vSpotParams.z);
vOut += vDiffuseColour * nDotL * fAtten * fSpotT;
}
}
//-----------------------------------------------------------------------------
void FFP_Light_Spot_DiffuseSpecular(in mat4 mWorldView,
in vec4 vPos,
in mat4 mWorldViewIT,
in vec3 vNormal,
in vec3 vLightPosView,
in vec3 vNegLightDirView,
in vec4 vAttParams,
in vec3 vSpotParams,
in vec3 vDiffuseColour,
in vec3 vSpecularColour,
in float fSpecularPower,
in vec3 vBaseDiffuseColour,
in vec3 vBaseSpecularColour,
out vec3 vOutDiffuse,
out vec3 vOutSpecular)
{
vOutDiffuse = vBaseDiffuseColour;
vOutSpecular = vBaseSpecularColour;
vec3 vViewPos = (mWorldView * vPos).xyz;
vec3 vLightView = vLightPosView - vViewPos;
float fLightD = length(vLightView);
vLightView = normalize(vLightView);
vec3 vNormalView = normalize((mWorldViewIT * vec4(vNormal.xyz, 1.0)).xyz);
float nDotL = dot(vNormalView, vLightView);
if (nDotL > 0.0 && fLightD <= vAttParams.x)
{
vec3 vView = -normalize(vViewPos);
vec3 vHalfWay = normalize(vView + vLightView);
float nDotH = dot(vNormalView, vHalfWay);
float fAtten = 1.0 / (vAttParams.y + vAttParams.z * fLightD + vAttParams.w * fLightD * fLightD);
float rho = dot(vNegLightDirView, vLightView);
float fSpotE = clamp((rho - vSpotParams.y) / (vSpotParams.x - vSpotParams.y), 0.0, 1.0);
float fSpotT = pow(fSpotE, vSpotParams.z);
vOutDiffuse += vDiffuseColour * nDotL * fAtten * fSpotT;
vOutSpecular += vSpecularColour * pow(clamp(nDotH, 0.0, 1.0), fSpecularPower) * fAtten * fSpotT;
}
}

225
Bushin/media/RTShaderLib/FFPLib_Lighting.hlsl

@ -0,0 +1,225 @@
/*
-----------------------------------------------------------------------------
This source file is part of OGRE
(Object-oriented Graphics Rendering Engine)
For the latest info, see http://www.ogre3d.org
Copyright (c) 2000-2012 Torus Knot Software Ltd
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-----------------------------------------------------------------------------
*/
//-----------------------------------------------------------------------------
// Program Name: FFPLib_Lighting
// Program Desc: Lighting functions of the FFP.
// Program Type: Vertex shader
// Language: HLSL
// Notes: Implements core functions for FFPLighting class.
// based on lighting engine.
// See http://msdn.microsoft.com/en-us/library/bb147178.aspx
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
void FFP_Light_Directional_Diffuse(in float4x4 mWorldViewIT,
in float3 vNormal,
in float3 vNegLightDirView,
in float3 vDiffuseColour,
in float3 vBaseColour,
out float3 vOut)
{
float3 vNormalView = normalize(mul((float3x3)mWorldViewIT, vNormal));
float nDotL = dot(vNormalView, vNegLightDirView);
vOut = vBaseColour + vDiffuseColour * saturate(nDotL);
}
//-----------------------------------------------------------------------------
void FFP_Light_Directional_DiffuseSpecular(in float4x4 mWorldView,
in float4 vPos,
in float4x4 mWorldViewIT,
in float3 vNormal,
in float3 vNegLightDirView,
in float3 vDiffuseColour,
in float3 vSpecularColour,
in float fSpecularPower,
in float3 vBaseDiffuseColour,
in float3 vBaseSpecularColour,
out float3 vOutDiffuse,
out float3 vOutSpecular)
{
vOutDiffuse = vBaseDiffuseColour;
vOutSpecular = vBaseSpecularColour;
float3 vNormalView = normalize(mul((float3x3)mWorldViewIT, vNormal));
float nDotL = dot(vNormalView, vNegLightDirView);
float3 vView = -normalize(mul(mWorldView, vPos).xyz);
float3 vHalfWay = normalize(vView + vNegLightDirView);
float nDotH = dot(vNormalView, vHalfWay);
if (nDotL > 0)
{
vOutDiffuse += vDiffuseColour * nDotL;
vOutSpecular += vSpecularColour * pow(saturate(nDotH), fSpecularPower);
}
}
//-----------------------------------------------------------------------------
void FFP_Light_Point_Diffuse(in float4x4 mWorldView,
in float4 vPos,
in float4x4 mWorldViewIT,
in float3 vNormal,
in float3 vLightPosView,
in float4 vAttParams,
in float3 vDiffuseColour,
in float3 vBaseColour,
out float3 vOut)
{
vOut = vBaseColour;
float3 vViewPos = mul(mWorldView, vPos).xyz;
float3 vLightView = vLightPosView - vViewPos;
float fLightD = length(vLightView);
float3 vNormalView = normalize(mul((float3x3)mWorldViewIT, vNormal));
float nDotL = dot(vNormalView, normalize(vLightView));
if (nDotL > 0 && fLightD <= vAttParams.x)
{
float fAtten = 1 / (vAttParams.y + vAttParams.z*fLightD + vAttParams.w*fLightD*fLightD);
vOut += vDiffuseColour * nDotL * fAtten;
}
}
//-----------------------------------------------------------------------------
void FFP_Light_Point_DiffuseSpecular(in float4x4 mWorldView,
in float4 vPos,
in float4x4 mWorldViewIT,
in float3 vNormal,
in float3 vLightPosView,
in float4 vAttParams,
in float3 vDiffuseColour,
in float3 vSpecularColour,
in float fSpecularPower,
in float3 vBaseDiffuseColour,
in float3 vBaseSpecularColour,
out float3 vOutDiffuse,
out float3 vOutSpecular)
{
vOutDiffuse = vBaseDiffuseColour;
vOutSpecular = vBaseSpecularColour;
float3 vViewPos = mul(mWorldView, vPos).xyz;
float3 vLightView = vLightPosView - vViewPos;
float fLightD = length(vLightView);
vLightView = normalize(vLightView);
float3 vNormalView = normalize(mul((float3x3)mWorldViewIT, vNormal));
float nDotL = dot(vNormalView, vLightView);
if (nDotL > 0 && fLightD <= vAttParams.x)
{
float3 vView = -normalize(vViewPos);
float3 vHalfWay = normalize(vView + vLightView);
float nDotH = dot(vNormalView, vHalfWay);
float fAtten = 1 / (vAttParams.y + vAttParams.z*fLightD + vAttParams.w*fLightD*fLightD);
vOutDiffuse += vDiffuseColour * nDotL * fAtten;
vOutSpecular += vSpecularColour * pow(saturate(nDotH), fSpecularPower) * fAtten;
}
}
//-----------------------------------------------------------------------------
void FFP_Light_Spot_Diffuse(in float4x4 mWorldView,
in float4 vPos,
in float4x4 mWorldViewIT,
in float3 vNormal,
in float3 vLightPosView,
in float3 vNegLightDirView,
in float4 vAttParams,
in float3 vSpotParams,
in float3 vDiffuseColour,
in float3 vBaseColour,
out float3 vOut)
{
vOut = vBaseColour;
float3 vViewPos = mul(mWorldView, vPos).xyz;
float3 vLightView = vLightPosView - vViewPos;
float fLightD = length(vLightView);
vLightView = normalize(vLightView);
float3 vNormalView = normalize(mul((float3x3)mWorldViewIT, vNormal));
float nDotL = dot(vNormalView, vLightView);
if (nDotL > 0 && fLightD <= vAttParams.x)
{
float fAtten = 1 / (vAttParams.y + vAttParams.z*fLightD + vAttParams.w*fLightD*fLightD);
float rho = dot(vNegLightDirView, vLightView);
float fSpotE = saturate((rho - vSpotParams.y) / (vSpotParams.x - vSpotParams.y));
float fSpotT = pow(fSpotE, vSpotParams.z);
vOut += vDiffuseColour * nDotL * fAtten * fSpotT;
}
}
//-----------------------------------------------------------------------------
void FFP_Light_Spot_DiffuseSpecular(in float4x4 mWorldView,
in float4 vPos,
in float4x4 mWorldViewIT,
in float3 vNormal,
in float3 vLightPosView,
in float3 vNegLightDirView,
in float4 vAttParams,
in float3 vSpotParams,
in float3 vDiffuseColour,
in float3 vSpecularColour,
in float fSpecularPower,
in float3 vBaseDiffuseColour,
in float3 vBaseSpecularColour,
out float3 vOutDiffuse,
out float3 vOutSpecular)
{
vOutDiffuse = vBaseDiffuseColour;
vOutSpecular = vBaseSpecularColour;
float3 vViewPos = mul(mWorldView, vPos).xyz;
float3 vLightView = vLightPosView - vViewPos;
float fLightD = length(vLightView);
vLightView = normalize(vLightView);
float3 vNormalView = normalize(mul((float3x3)mWorldViewIT, vNormal));
float nDotL = dot(vNormalView, vLightView);
if (nDotL > 0 && fLightD <= vAttParams.x)
{
float3 vView = -normalize(vViewPos);
float3 vHalfWay = normalize(vView + vLightView);
float nDotH = dot(vNormalView, vHalfWay);
float fAtten = 1 / (vAttParams.y + vAttParams.z*fLightD + vAttParams.w*fLightD*fLightD);
float rho = dot(vNegLightDirView, vLightView);
float fSpotE = saturate((rho - vSpotParams.y) / (vSpotParams.x - vSpotParams.y));
float fSpotT = pow(fSpotE, vSpotParams.z);
vOutDiffuse += vDiffuseColour * nDotL * fAtten * fSpotT;
vOutSpecular += vSpecularColour * pow(saturate(nDotH), fSpecularPower) * fAtten * fSpotT;
}
}

319
Bushin/media/RTShaderLib/FFPLib_Texturing.cg

@ -0,0 +1,319 @@
/*
-----------------------------------------------------------------------------
This source file is part of OGRE
(Object-oriented Graphics Rendering Engine)
For the latest info, see http://www.ogre3d.org
Copyright (c) 2000-2012 Torus Knot Software Ltd
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-----------------------------------------------------------------------------
*/
//-----------------------------------------------------------------------------
// Program Name: FFPLib_TextureStage
// Program Desc: Texture functions of the FFP.
// Program Type: Vertex/Pixel shader
// Language: CG
// Notes: Implements core functions for FFPTexturing class.
// based on texturing operations needed by render system.
// Implements texture coordinate processing:
// see http://msdn.microsoft.com/en-us/library/bb206247.aspx
// Implements texture blending operation:
// see http://msdn.microsoft.com/en-us/library/bb206241.aspx
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
void FFP_TransformTexCoord(in float4x4 m, in float2 v, out float2 vOut)
{
vOut = mul(m, float4(v, 0, 1)).xy;
}
//-----------------------------------------------------------------------------
void FFP_TransformTexCoord(in float4x4 m, in float3 v, out float3 vOut)
{
vOut = mul(m, float4(v, 1)).xyz;
}
//-----------------------------------------------------------------------------
void FFP_GenerateTexCoord_EnvMap_Normal(in float4x4 mWorldIT,
in float4x4 mView,
in float3 vNormal,
out float3 vOut)
{
float3 vWorldNormal = mul((float3x3)mWorldIT, vNormal);
float3 vViewNormal = mul((float3x3)mView, vWorldNormal);
vOut = vViewNormal;
}
//-----------------------------------------------------------------------------
void FFP_GenerateTexCoord_EnvMap_Normal(in float4x4 mWorldIT,
in float4x4 mView,
in float4x4 mTexture,
in float3 vNormal,
out float3 vOut)
{
float3 vWorldNormal = mul((float3x3)mWorldIT, vNormal);
float3 vViewNormal = mul((float3x3)mView, vWorldNormal);
vOut = mul(mTexture, float4(vViewNormal, 1)).xyz;
}
//-----------------------------------------------------------------------------
void FFP_GenerateTexCoord_EnvMap_Sphere(in float4x4 mWorld,
in float4x4 mView,
in float3 vNormal,
out float2 vOut)
{
float3 vWorldNormal = mul((float3x3)mWorld, vNormal);
float3 vViewNormal = mul((float3x3)mView, vWorldNormal);
vOut.x = vViewNormal.x/2 + 0.5;
vOut.y = -vViewNormal.y/2 + 0.5;
}
//-----------------------------------------------------------------------------
void FFP_GenerateTexCoord_EnvMap_Sphere(in float4x4 mWorld,
in float4x4 mView,
in float4x4 mTexture,
in float3 vNormal,
out float2 vOut)
{
float3 vWorldNormal = mul((float3x3)mWorld, vNormal);
float3 vViewNormal = mul((float3x3)mView, vWorldNormal);
float2 vSphereCoords;
vSphereCoords.x = vViewNormal.x/2 + 0.5;
vSphereCoords.y = -vViewNormal.y/2 + 0.5;
vOut = mul(mTexture, float4(vSphereCoords, 0, 0)).xy;
}
//-----------------------------------------------------------------------------
void FFP_GenerateTexCoord_EnvMap_Reflect(in float4x4 mWorld,
in float4x4 mWorldIT,
in float4x4 mView,
in float3 vNormal,
in float4 vPos,
out float3 vOut)
{
mView[2][0] = -mView[2][0];
mView[2][1] = -mView[2][1];
mView[2][2] = -mView[2][2];
mView[2][3] = -mView[2][3];
float4x4 matViewT = transpose(mView);
float3 vWorldNormal = mul((float3x3)mWorldIT, vNormal);
float3 vViewNormal = mul((float3x3)mView, vWorldNormal);
float4 vWorldPos = mul(mWorld, vPos);
float3 vNormViewPos = normalize(mul(mView, vWorldPos).xyz);
float3 vReflect = reflect(vNormViewPos, vViewNormal);
matViewT[2][0] = -matViewT[2][0];
matViewT[2][1] = -matViewT[2][1];
matViewT[2][2] = -matViewT[2][2];
vReflect = mul((float3x3)matViewT, vReflect);
vOut = vReflect;
}
//-----------------------------------------------------------------------------
void FFP_GenerateTexCoord_EnvMap_Reflect(in float4x4 mWorld,
in float4x4 mWorldIT,
in float4x4 mView,
in float4x4 mTexture,
in float3 vNormal,
in float4 vPos,
out float3 vOut)
{
mView[2][0] = -mView[2][0];
mView[2][1] = -mView[2][1];
mView[2][2] = -mView[2][2];
mView[2][3] = -mView[2][3];
float4x4 matViewT = transpose(mView);
float3 vWorldNormal = mul((float3x3)mWorldIT, vNormal);
float3 vViewNormal = mul((float3x3)mView, vWorldNormal);
float4 vWorldPos = mul(mWorld, vPos);
float3 vNormViewPos = normalize(mul(mView, vWorldPos).xyz);
float3 vReflect = reflect(vNormViewPos, vViewNormal);
matViewT[2][0] = -matViewT[2][0];
matViewT[2][1] = -matViewT[2][1];
matViewT[2][2] = -matViewT[2][2];
vReflect = mul((float3x3)matViewT, vReflect);
vReflect = mul(mTexture, float4(vReflect,1)).xyz;
vOut = vReflect;
}
//-----------------------------------------------------------------------------
void FFP_GenerateTexCoord_Projection(in float4x4 mWorld,
in float4x4 mTexViewProjImage,
in float4 vPos,
out float3 vOut)
{
float4 vWorldPos = mul(mWorld, vPos);
float4 vTexturePos = mul(mTexViewProjImage, vWorldPos);
vOut = float3(vTexturePos.xy, vTexturePos.w);
}
//-----------------------------------------------------------------------------
void FFP_SampleTexture(in sampler1D s,
in float f,
out float4 t)
{
t = tex1D(s, f);
}
//-----------------------------------------------------------------------------
void FFP_SampleTexture(in sampler2D s,
in float2 f,
out float4 t)
{
t = tex2D(s, f);
}
//-----------------------------------------------------------------------------
void FFP_SampleTextureProj(in sampler2D s,
in float3 f,
out float4 t)
{
t = tex2D(s, f.xy/f.z);
}
//-----------------------------------------------------------------------------
void FFP_SampleTexture(in sampler3D s,
in float3 f,
out float4 t)
{
t = tex3D(s, f);
}
//-----------------------------------------------------------------------------
void FFP_SampleTexture(in samplerCUBE s,
in float3 f,
out float4 t)
{
t = texCUBE(s, f);
}
//-----------------------------------------------------------------------------
void FFP_ModulateX2(in float vIn0, in float vIn1, out float vOut)
{
vOut = vIn0 * vIn1 * 2;
}
//-----------------------------------------------------------------------------
void FFP_ModulateX2(in float2 vIn0, in float2 vIn1, out float2 vOut)
{
vOut = vIn0 * vIn1 * 2;
}
//-----------------------------------------------------------------------------
void FFP_ModulateX2(in float3 vIn0, in float3 vIn1, out float3 vOut)
{
vOut = vIn0 * vIn1 * 2;
}
//-----------------------------------------------------------------------------
void FFP_ModulateX2(in float4 vIn0, in float4 vIn1, out float4 vOut)
{
vOut = vIn0 * vIn1 * 2;
}
//-----------------------------------------------------------------------------
void FFP_ModulateX4(in float vIn0, in float vIn1, out float vOut)
{
vOut = vIn0 * vIn1 * 4;
}
//-----------------------------------------------------------------------------
void FFP_ModulateX4(in float2 vIn0, in float2 vIn1, out float2 vOut)
{
vOut = vIn0 * vIn1 * 4;
}
//-----------------------------------------------------------------------------
void FFP_ModulateX4(in float3 vIn0, in float3 vIn1, out float3 vOut)
{
vOut = vIn0 * vIn1 * 4;
}
//-----------------------------------------------------------------------------
void FFP_ModulateX4(in float4 vIn0, in float4 vIn1, out float4 vOut)
{
vOut = vIn0 * vIn1 * 4;
}
//-----------------------------------------------------------------------------
void FFP_AddSigned(in float vIn0, in float vIn1, out float vOut)
{
vOut = vIn0 + vIn1 - 0.5;
}
//-----------------------------------------------------------------------------
void FFP_AddSigned(in float2 vIn0, in float2 vIn1, out float2 vOut)
{
vOut = vIn0 + vIn1 - 0.5;
}
//-----------------------------------------------------------------------------
void FFP_AddSigned(in float3 vIn0, in float3 vIn1, out float3 vOut)
{
vOut = vIn0 + vIn1 - 0.5;
}
//-----------------------------------------------------------------------------
void FFP_AddSigned(in float4 vIn0, in float4 vIn1, out float4 vOut)
{
vOut = vIn0 + vIn1 - 0.5;
}
//-----------------------------------------------------------------------------
void FFP_AddSmooth(in float vIn0, in float vIn1, out float vOut)
{
vOut = vIn0 + vIn1 - (vIn0 * vIn1);
}
//-----------------------------------------------------------------------------
void FFP_AddSmooth(in float2 vIn0, in float2 vIn1, out float2 vOut)
{
vOut = vIn0 + vIn1 - (vIn0 * vIn1);
}
//-----------------------------------------------------------------------------
void FFP_AddSmooth(in float3 vIn0, in float3 vIn1, out float3 vOut)
{
vOut = vIn0 + vIn1 - (vIn0 * vIn1);
}
//-----------------------------------------------------------------------------
void FFP_AddSmooth(in float4 vIn0, in float4 vIn1, out float4 vOut)
{
vOut = vIn0 + vIn1 - (vIn0 * vIn1);
}

334
Bushin/media/RTShaderLib/FFPLib_Texturing.glsl

@ -0,0 +1,334 @@
#version 120
/*
-----------------------------------------------------------------------------
This source file is part of OGRE
(Object-oriented Graphics Rendering Engine)
For the latest info, see http://www.ogre3d.org
Copyright (c) 2000-2012 Torus Knot Software Ltd
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-----------------------------------------------------------------------------
*/
//-----------------------------------------------------------------------------
// Program Name: FFPLib_TextureStage
// Program Desc: Texture functions of the FFP.
// Program Type: Vertex/Pixel shader
// Language: GLSL
// Notes: Implements core functions for FFPTexturing class.
// based on texturing operations needed by render system.
// Implements texture coordinate processing:
// see http://msdn.microsoft.com/en-us/library/bb206247.aspx
// Implements texture blending operation:
// see http://msdn.microsoft.com/en-us/library/bb206241.aspx
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
void FFP_TransformTexCoord(in mat4 m, in vec2 v, out vec2 vOut)
{
vOut = (m * vec4(v, 1.0, 1.0)).xy;
}
//-----------------------------------------------------------------------------
void FFP_TransformTexCoord(in mat4 m, in vec4 v, out vec2 vOut)
{
vOut = (m * v).xy;
}
//-----------------------------------------------------------------------------
void FFP_TransformTexCoord(in mat4 m, in vec3 v, out vec3 vOut)
{
vOut = (m * vec4(v, 1.0)).xyz;
}
//-----------------------------------------------------------------------------
void FFP_GenerateTexCoord_EnvMap_Normal(in mat4 mWorldIT,
in mat4 mView,
in vec3 vNormal,
out vec3 vOut)
{
vec3 vWorldNormal = (mWorldIT * vec4(vNormal, 1.0)).xyz;
vec3 vViewNormal = (mView * vec4(vWorldNormal, 1.0)).xyz;
vOut = vViewNormal;
}
//-----------------------------------------------------------------------------
void FFP_GenerateTexCoord_EnvMap_Normal(in mat4 mWorldIT,
in mat4 mView,
in mat4 mTexture,
in vec3 vNormal,
out vec3 vOut)
{
vec3 vWorldNormal = (mWorldIT * vec4(vNormal, 1.0)).xyz;
vec3 vViewNormal = (mView * vec4(vWorldNormal, 1.0)).xyz;
vOut = (mTexture * vec4(vViewNormal, 1.0)).xyz;
}
//-----------------------------------------------------------------------------
void FFP_GenerateTexCoord_EnvMap_Sphere(in mat4 mWorld,
in mat4 mView,
in vec3 vNormal,
out vec2 vOut)
{
vec3 vWorldNormal = (mWorld * vec4(vNormal, 1.0)).xyz;
vec3 vViewNormal = (mView * vec4(vWorldNormal, 1.0)).xyz;
vOut.x = vViewNormal.x/2.0 + 0.5;
vOut.y = -vViewNormal.y/2.0 + 0.5;
}
//-----------------------------------------------------------------------------
void FFP_GenerateTexCoord_EnvMap_Sphere(in mat4 mWorld,
in mat4 mView,
in mat4 mTexture,
in vec3 vNormal,
out vec2 vOut)
{
vec3 vWorldNormal = (mWorld* vec4(vNormal, 1.0)).xyz;
vec3 vViewNormal = (mView * vec4(vWorldNormal, 1.0)).xyz;
vec2 vSphereCoords;
vSphereCoords.x = vViewNormal.x/2.0 + 0.5;
vSphereCoords.y = -vViewNormal.y/2.0 + 0.5;
vOut = (mTexture * vec4(vSphereCoords, 0.0, 0.0)).xy;
}
//-----------------------------------------------------------------------------
void FFP_GenerateTexCoord_EnvMap_Reflect(in mat4 mWorld,
in mat4 mWorldIT,
in mat4 mView,
in vec3 vNormal,
in vec4 vPos,
out vec3 vOut)
{
mView[0][2] = -mView[0][2];
mView[1][2] = -mView[1][2];
mView[2][2] = -mView[2][2];
mView[3][2] = -mView[3][2];
mat4 matViewT = transpose(mView);
vec3 vWorldNormal = (mWorldIT * vec4(vNormal, 0.0)).xyz;
vec3 vViewNormal = (mView * vec4(vWorldNormal, 0.0)).xyz;
vec4 vWorldPos = mWorld * vPos;
vec3 vNormViewPos = normalize((mView * vWorldPos).xyz);
vec3 vReflect = reflect(vNormViewPos, vViewNormal);
matViewT[0][2] = -matViewT[0][2];
matViewT[1][2] = -matViewT[1][2];
matViewT[2][2] = -matViewT[2][2];
vReflect = (matViewT * vec4(vReflect, 1.0)).xyz;
vOut = vReflect;
}
//-----------------------------------------------------------------------------
void FFP_GenerateTexCoord_EnvMap_Reflect(in mat4 mWorld,
in mat4 mWorldIT,
in mat4 mView,
in mat4 mTexture,
in vec3 vNormal,
in vec4 vPos,
out vec3 vOut)
{
mView[0][2] = -mView[0][2];
mView[1][2] = -mView[1][2];
mView[2][2] = -mView[2][2];
mView[3][2] = -mView[3][2];
mat4 matViewT = transpose(mView);
vec3 vWorldNormal = (mWorldIT * vec4(vNormal, 0.0)).xyz;
vec3 vViewNormal = (mView * vec4(vWorldNormal, 0.0)).xyz;
vec4 vWorldPos = mWorld * vPos;
vec3 vNormViewPos = normalize((mView * vWorldPos).xyz);
vec3 vReflect = reflect(vNormViewPos, vViewNormal);
matViewT[0][2] = -matViewT[0][2];
matViewT[1][2] = -matViewT[1][2];
matViewT[2][2] = -matViewT[2][2];
vReflect = (matViewT * vec4(vReflect, 1.0)).xyz;
vReflect = (mTexture * vec4(vReflect, 1.0)).xyz;
vOut = vReflect;
}
//-----------------------------------------------------------------------------
void FFP_GenerateTexCoord_Projection(in mat4 mWorld,
in mat4 mTexViewProjImage,
in vec4 vPos,
out vec3 vOut)
{
vec4 vWorldPos = mWorld * vPos;
vec4 vTexturePos = mTexViewProjImage * vWorldPos;
vOut = vTexturePos.xyw;
}
//-----------------------------------------------------------------------------
void FFP_SampleTexture(in sampler1D s,
in float f,
out vec4 t)
{
t = texture1D(s, f);
}
//-----------------------------------------------------------------------------
void FFP_SampleTexture(in sampler2D s,
in vec2 f,
out vec4 t)
{
t = texture2D (s, f);
}
//-----------------------------------------------------------------------------
void FFP_SampleTexture(in sampler2D s,
in vec4 f,
out vec4 t)
{
t = texture2D (s, vec2(f.xy));
}
//-----------------------------------------------------------------------------
void FFP_SampleTextureProj(in sampler2D s,
in vec3 f,
out vec4 t)
{
t = texture2D(s, f.xy/f.z);
}
//-----------------------------------------------------------------------------
void FFP_SampleTexture(in sampler3D s,
in vec3 f,
out vec4 t)
{
t = texture3D(s, f);
}
//-----------------------------------------------------------------------------
void FFP_SampleTexture(in samplerCube s,
in vec3 f,
out vec4 t)
{
t = textureCube(s, f);
}
//-----------------------------------------------------------------------------
void FFP_ModulateX2(in float vIn0, in float vIn1, out float vOut)
{
vOut = vIn0 * vIn1 * 2.0;
}
//-----------------------------------------------------------------------------
void FFP_ModulateX2(in vec2 vIn0, in vec2 vIn1, out vec2 vOut)
{
vOut = vIn0 * vIn1 * 2.0;
}
//-----------------------------------------------------------------------------
void FFP_ModulateX2(in vec3 vIn0, in vec3 vIn1, out vec3 vOut)
{
vOut = vIn0 * vIn1 * 2.0;
}
//-----------------------------------------------------------------------------
void FFP_ModulateX2(in vec4 vIn0, in vec4 vIn1, out vec4 vOut)
{
vOut = vIn0 * vIn1 * 2.0;
}
//-----------------------------------------------------------------------------
void FFP_ModulateX4(in float vIn0, in float vIn1, out float vOut)
{
vOut = vIn0 * vIn1 * 4.0;
}
//-----------------------------------------------------------------------------
void FFP_ModulateX4(in vec2 vIn0, in vec2 vIn1, out vec2 vOut)
{
vOut = vIn0 * vIn1 * 4.0;
}
//-----------------------------------------------------------------------------
void FFP_ModulateX4(in vec3 vIn0, in vec3 vIn1, out vec3 vOut)
{
vOut = vIn0 * vIn1 * 4.0;
}
//-----------------------------------------------------------------------------
void FFP_ModulateX4(in vec4 vIn0, in vec4 vIn1, out vec4 vOut)
{
vOut = vIn0 * vIn1 * 4.0;
}
//-----------------------------------------------------------------------------
void FFP_AddSigned(in float vIn0, in float vIn1, out float vOut)
{
vOut = vIn0 + vIn1 - 0.5;
}
//-----------------------------------------------------------------------------
void FFP_AddSigned(in vec2 vIn0, in vec2 vIn1, out vec2 vOut)
{
vOut = vIn0 + vIn1 - 0.5;
}
//-----------------------------------------------------------------------------
void FFP_AddSigned(in vec3 vIn0, in vec3 vIn1, out vec3 vOut)
{
vOut = vIn0 + vIn1 - 0.5;
}
//-----------------------------------------------------------------------------
void FFP_AddSigned(in vec4 vIn0, in vec4 vIn1, out vec4 vOut)
{
vOut = vIn0 + vIn1 - 0.5;
}
//-----------------------------------------------------------------------------
void FFP_AddSmooth(in float vIn0, in float vIn1, out float vOut)
{
vOut = vIn0 + vIn1 - (vIn0 * vIn1);
}
//-----------------------------------------------------------------------------
void FFP_AddSmooth(in vec2 vIn0, in vec2 vIn1, out vec2 vOut)
{
vOut = vIn0 + vIn1 - (vIn0 * vIn1);
}
//-----------------------------------------------------------------------------
void FFP_AddSmooth(in vec3 vIn0, in vec3 vIn1, out vec3 vOut)
{
vOut = vIn0 + vIn1 - (vIn0 * vIn1);
}
//-----------------------------------------------------------------------------
void FFP_AddSmooth(in vec4 vIn0, in vec4 vIn1, out vec4 vOut)
{
vOut = vIn0 + vIn1 - (vIn0 * vIn1);
}

355
Bushin/media/RTShaderLib/FFPLib_Texturing.glsles

@ -0,0 +1,355 @@
#version 100
precision highp float;
precision highp int;
precision lowp sampler2D;
precision lowp samplerCube;
/*
-----------------------------------------------------------------------------
This source file is part of OGRE
(Object-oriented Graphics Rendering Engine)
For the latest info, see http://www.ogre3d.org
Copyright (c) 2000-2012 Torus Knot Software Ltd
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-----------------------------------------------------------------------------
*/
//-----------------------------------------------------------------------------
// Program Name: FFPLib_Texturing
// Program Desc: Texture functions of the FFP.
// Program Type: Vertex/Pixel shader
// Language: GLSL ES
// Notes: Implements core functions for FFPTexturing class.
// based on texturing operations needed by render system.
// Implements texture coordinate processing:
// see http://msdn.microsoft.com/en-us/library/bb206247.aspx
// Implements texture blending operation:
// see http://msdn.microsoft.com/en-us/library/bb206241.aspx
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
void FFP_TransformTexCoord(in mat4 m, in vec2 v, out vec2 vOut)
{
vOut = (m * vec4(v, 1.0, 1.0)).xy;
}
//-----------------------------------------------------------------------------
void FFP_TransformTexCoord(in mat4 m, in vec4 v, out vec2 vOut)
{
vOut = (m * v).xy;
}
//-----------------------------------------------------------------------------
void FFP_TransformTexCoord(in mat4 m, in vec3 v, out vec3 vOut)
{
vOut = (m * vec4(v, 1.0)).xyz;
}
//-----------------------------------------------------------------------------
void FFP_GenerateTexCoord_EnvMap_Normal(in mat4 mWorldIT,
in mat4 mView,
in vec3 vNormal,
out vec3 vOut)
{
vec3 vWorldNormal = (mWorldIT * vec4(vNormal, 1.0)).xyz;
vec3 vViewNormal = (mView * vec4(vWorldNormal, 1.0)).xyz;
vOut = vViewNormal;
}
//-----------------------------------------------------------------------------
void FFP_GenerateTexCoord_EnvMap_Normal(in mat4 mWorldIT,
in mat4 mView,
in mat4 mTexture,
in vec3 vNormal,
out vec3 vOut)
{
vec3 vWorldNormal = (mWorldIT * vec4(vNormal, 1.0)).xyz;
vec3 vViewNormal = (mView * vec4(vWorldNormal, 1.0)).xyz;
vOut = (mTexture * vec4(vViewNormal, 1.0)).xyz;
}
//-----------------------------------------------------------------------------
void FFP_GenerateTexCoord_EnvMap_Sphere(in mat4 mWorld,
in mat4 mView,
in vec3 vNormal,
out vec2 vOut)
{
vec3 vWorldNormal = (mWorld * vec4(vNormal, 1.0)).xyz;
vec3 vViewNormal = (mView * vec4(vWorldNormal, 1.0)).xyz;
vOut.x = vViewNormal.x/2.0 + 0.5;
vOut.y = -vViewNormal.y/2.0 + 0.5;
}
//-----------------------------------------------------------------------------
void FFP_GenerateTexCoord_EnvMap_Sphere(in mat4 mWorld,
in mat4 mView,
in mat4 mTexture,
in vec3 vNormal,
out vec2 vOut)
{
vec3 vWorldNormal = (mWorld * vec4(vNormal, 1.0)).xyz;
vec3 vViewNormal = (mView * vec4(vWorldNormal, 1.0)).xyz;
vec2 vSphereCoords;
vSphereCoords.x = vViewNormal.x/2.0 + 0.5;
vSphereCoords.y = -vViewNormal.y/2.0 + 0.5;
vOut = (mTexture * vec4(vSphereCoords, 0.0, 0.0)).xy;
}
//-----------------------------------------------------------------------------
void FFP_GenerateTexCoord_EnvMap_Reflect(in mat4 mWorld,
in mat4 mWorldIT,
in mat4 mView,
in vec3 vNormal,
in vec4 vPos,
out vec3 vOut)
{
mat4 matViewT;
matViewT[0][0] = mView[0][0];
matViewT[1][0] = mView[0][1];
matViewT[2][0] = -mView[0][2];
matViewT[3][0] = mView[0][3];
matViewT[0][1] = mView[1][0];
matViewT[1][1] = mView[1][1];
matViewT[2][1] = -mView[1][2];
matViewT[3][1] = mView[1][3];
matViewT[0][2] = mView[2][0];
matViewT[1][2] = mView[2][1];
matViewT[2][2] = -mView[2][2];
matViewT[3][2] = mView[2][3];
matViewT[0][3] = mView[3][0];
matViewT[1][3] = mView[3][1];
matViewT[2][3] = -mView[3][2];
matViewT[3][3] = mView[3][3];
vec3 vWorldNormal = (mWorldIT * vec4(vNormal, 0.0)).xyz;
vec3 vViewNormal = (mView * vec4(vWorldNormal, 0.0)).xyz;
vec4 vWorldPos = mWorld * vPos;
vec3 vNormViewPos = normalize((mView * vWorldPos).xyz);
vec3 vReflect = reflect(vNormViewPos, vViewNormal);
matViewT[0][2] = -matViewT[0][2];
matViewT[1][2] = -matViewT[1][2];
matViewT[2][2] = -matViewT[2][2];
vReflect = (matViewT * vec4(vReflect, 1.0)).xyz;
vOut = vReflect;
}
//-----------------------------------------------------------------------------
void FFP_GenerateTexCoord_EnvMap_Reflect(in mat4 mWorld,
in mat4 mWorldIT,
in mat4 mView,
in mat4 mTexture,
in vec3 vNormal,
in vec4 vPos,
out vec3 vOut)
{
mat4 matViewT;
matViewT[0][0] = mView[0][0];
matViewT[1][0] = mView[0][1];
matViewT[2][0] = -mView[0][2];
matViewT[3][0] = mView[0][3];
matViewT[0][1] = mView[1][0];
matViewT[1][1] = mView[1][1];
matViewT[2][1] = -mView[1][2];
matViewT[3][1] = mView[1][3];
matViewT[0][2] = mView[2][0];
matViewT[1][2] = mView[2][1];
matViewT[2][2] = -mView[2][2];
matViewT[3][2] = mView[2][3];
matViewT[0][3] = mView[3][0];
matViewT[1][3] = mView[3][1];
matViewT[2][3] = -mView[3][2];
matViewT[3][3] = mView[3][3];
vec3 vWorldNormal = (mWorldIT * vec4(vNormal, 0.0)).xyz;
vec3 vViewNormal = (mView * vec4(vWorldNormal, 0.0)).xyz;
vec4 vWorldPos = mWorld * vPos;
vec3 vNormViewPos = normalize((mView * vWorldPos).xyz);
vec3 vReflect = reflect(vNormViewPos, vViewNormal);
matViewT[0][2] = -matViewT[0][2];
matViewT[1][2] = -matViewT[1][2];
matViewT[2][2] = -matViewT[2][2];
vReflect = (matViewT * vec4(vReflect, 1.0)).xyz;
vReflect = (mTexture * vec4(vReflect, 1.0)).xyz;
vOut = vReflect;
}
//-----------------------------------------------------------------------------
void FFP_GenerateTexCoord_Projection(in mat4 mWorld,
in mat4 mTexViewProjImage,
in vec4 vPos,
out vec3 vOut)
{
vOut = (mTexViewProjImage * (mWorld * vPos)).xyw;
}
//-----------------------------------------------------------------------------
void FFP_SampleTexture(in sampler2D s,
in float f,
out vec4 t)
{
t = texture2D(s, vec2(f));
}
//-----------------------------------------------------------------------------
void FFP_SampleTexture(in sampler2D s,
in vec2 f,
out vec4 t)
{
t = texture2D(s, f);
}
//-----------------------------------------------------------------------------
void FFP_SampleTexture(in sampler2D s,
in vec4 f,
out vec4 t)
{
t = texture2D(s, vec2(f.xy));
}
//-----------------------------------------------------------------------------
void FFP_SampleTextureProj(in sampler2D s,
in vec3 f,
out vec4 t)
{
t = texture2D(s, f.xy / f.z);
}
//-----------------------------------------------------------------------------
void FFP_SampleTexture(in samplerCube s,
in vec3 f,
out vec4 t)
{
t = textureCube(s, f);
}
//-----------------------------------------------------------------------------
void FFP_ModulateX2(in float vIn0, in float vIn1, out float vOut)
{
vOut = vIn0 * vIn1 * 2.0;
}
//-----------------------------------------------------------------------------
void FFP_ModulateX2(in vec2 vIn0, in vec2 vIn1, out vec2 vOut)
{
vOut = vIn0 * vIn1 * 2.0;
}
//-----------------------------------------------------------------------------
void FFP_ModulateX2(in vec3 vIn0, in vec3 vIn1, out vec3 vOut)
{
vOut = vIn0 * vIn1 * 2.0;
}
//-----------------------------------------------------------------------------
void FFP_ModulateX2(in vec4 vIn0, in vec4 vIn1, out vec4 vOut)
{
vOut = vIn0 * vIn1 * 2.0;
}
//-----------------------------------------------------------------------------
void FFP_ModulateX4(in float vIn0, in float vIn1, out float vOut)
{
vOut = vIn0 * vIn1 * 4.0;
}
//-----------------------------------------------------------------------------
void FFP_ModulateX4(in vec2 vIn0, in vec2 vIn1, out vec2 vOut)
{
vOut = vIn0 * vIn1 * 4.0;
}
//-----------------------------------------------------------------------------
void FFP_ModulateX4(in vec3 vIn0, in vec3 vIn1, out vec3 vOut)
{
vOut = vIn0 * vIn1 * 4.0;
}
//-----------------------------------------------------------------------------
void FFP_ModulateX4(in vec4 vIn0, in vec4 vIn1, out vec4 vOut)
{
vOut = vIn0 * vIn1 * 4.0;
}
//-----------------------------------------------------------------------------
void FFP_AddSigned(in float vIn0, in float vIn1, out float vOut)
{
vOut = vIn0 + vIn1 - 0.5;
}
//-----------------------------------------------------------------------------
void FFP_AddSigned(in vec2 vIn0, in vec2 vIn1, out vec2 vOut)
{
vOut = vIn0 + vIn1 - 0.5;
}
//-----------------------------------------------------------------------------
void FFP_AddSigned(in vec3 vIn0, in vec3 vIn1, out vec3 vOut)
{
vOut = vIn0 + vIn1 - 0.5;
}
//-----------------------------------------------------------------------------
void FFP_AddSigned(in vec4 vIn0, in vec4 vIn1, out vec4 vOut)
{
vOut = vIn0 + vIn1 - 0.5;
}
//-----------------------------------------------------------------------------
void FFP_AddSmooth(in float vIn0, in float vIn1, out float vOut)
{
vOut = vIn0 + vIn1 - (vIn0 * vIn1);
}
//-----------------------------------------------------------------------------
void FFP_AddSmooth(in vec2 vIn0, in vec2 vIn1, out vec2 vOut)
{
vOut = vIn0 + vIn1 - (vIn0 * vIn1);
}
//-----------------------------------------------------------------------------
void FFP_AddSmooth(in vec3 vIn0, in vec3 vIn1, out vec3 vOut)
{
vOut = vIn0 + vIn1 - (vIn0 * vIn1);
}
//-----------------------------------------------------------------------------
void FFP_AddSmooth(in vec4 vIn0, in vec4 vIn1, out vec4 vOut)
{
vOut = vIn0 + vIn1 - (vIn0 * vIn1);
}

319
Bushin/media/RTShaderLib/FFPLib_Texturing.hlsl

@ -0,0 +1,319 @@
/*
-----------------------------------------------------------------------------
This source file is part of OGRE
(Object-oriented Graphics Rendering Engine)
For the latest info, see http://www.ogre3d.org
Copyright (c) 2000-2012 Torus Knot Software Ltd
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-----------------------------------------------------------------------------
*/
//-----------------------------------------------------------------------------
// Program Name: FFPLib_TextureStage
// Program Desc: Texture functions of the FFP.
// Program Type: Vertex/Pixel shader
// Language: HLSL
// Notes: Implements core functions for FFPTexturing class.
// based on texturing operations needed by render system.
// Implements texture coordinate processing:
// see http://msdn.microsoft.com/en-us/library/bb206247.aspx
// Implements texture blending operation:
// see http://msdn.microsoft.com/en-us/library/bb206241.aspx
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
void FFP_TransformTexCoord(in float4x4 m, in float2 v, out float2 vOut)
{
vOut = mul(m, float4(v, 0, 1)).xy;
}
//-----------------------------------------------------------------------------
void FFP_TransformTexCoord(in float4x4 m, in float3 v, out float3 vOut)
{
vOut = mul(m, float4(v, 1)).xyz;
}
//-----------------------------------------------------------------------------
void FFP_GenerateTexCoord_EnvMap_Normal(in float4x4 mWorldIT,
in float4x4 mView,
in float3 vNormal,
out float3 vOut)
{
float3 vWorldNormal = mul((float3x3)mWorldIT, vNormal);
float3 vViewNormal = mul((float3x3)mView, vWorldNormal);
vOut = vViewNormal;
}
//-----------------------------------------------------------------------------
void FFP_GenerateTexCoord_EnvMap_Normal(in float4x4 mWorldIT,
in float4x4 mView,
in float4x4 mTexture,
in float3 vNormal,
out float3 vOut)
{
float3 vWorldNormal = mul((float3x3)mWorldIT, vNormal);
float3 vViewNormal = mul((float3x3)mView, vWorldNormal);
vOut = mul(mTexture, float4(vViewNormal, 1)).xyz;
}
//-----------------------------------------------------------------------------
void FFP_GenerateTexCoord_EnvMap_Sphere(in float4x4 mWorld,
in float4x4 mView,
in float3 vNormal,
out float2 vOut)
{
float3 vWorldNormal = mul((float3x3)mWorld, vNormal);
float3 vViewNormal = mul((float3x3)mView, vWorldNormal);
vOut.x = vViewNormal.x/2 + 0.5;
vOut.y = -vViewNormal.y/2 + 0.5;
}
//-----------------------------------------------------------------------------
void FFP_GenerateTexCoord_EnvMap_Sphere(in float4x4 mWorld,
in float4x4 mView,
in float4x4 mTexture,
in float3 vNormal,
out float2 vOut)
{
float3 vWorldNormal = mul((float3x3)mWorld, vNormal);
float3 vViewNormal = mul((float3x3)mView, vWorldNormal);
float2 vSphereCoords;
vSphereCoords.x = vViewNormal.x/2 + 0.5;
vSphereCoords.y = -vViewNormal.y/2 + 0.5;
vOut = mul(mTexture, float4(vSphereCoords, 0, 0)).xy;
}
//-----------------------------------------------------------------------------
void FFP_GenerateTexCoord_EnvMap_Reflect(in float4x4 mWorld,
in float4x4 mWorldIT,
in float4x4 mView,
in float3 vNormal,
in float4 vPos,
out float3 vOut)
{
mView[2][0] = -mView[2][0];
mView[2][1] = -mView[2][1];
mView[2][2] = -mView[2][2];
mView[2][3] = -mView[2][3];
float4x4 matViewT = transpose(mView);
float3 vWorldNormal = mul((float3x3)mWorldIT, vNormal);
float3 vViewNormal = mul((float3x3)mView, vWorldNormal);
float4 vWorldPos = mul(mWorld, vPos);
float3 vNormViewPos = normalize(mul(mView, vWorldPos).xyz);
float3 vReflect = reflect(vNormViewPos, vViewNormal);
matViewT[2][0] = -matViewT[2][0];
matViewT[2][1] = -matViewT[2][1];
matViewT[2][2] = -matViewT[2][2];
vReflect = mul((float3x3)matViewT, vReflect);
vOut = vReflect;
}
//-----------------------------------------------------------------------------
void FFP_GenerateTexCoord_EnvMap_Reflect(in float4x4 mWorld,
in float4x4 mWorldIT,
in float4x4 mView,
in float4x4 mTexture,
in float3 vNormal,
in float4 vPos,
out float3 vOut)
{
mView[2][0] = -mView[2][0];
mView[2][1] = -mView[2][1];
mView[2][2] = -mView[2][2];
mView[2][3] = -mView[2][3];
float4x4 matViewT = transpose(mView);
float3 vWorldNormal = mul((float3x3)mWorldIT, vNormal);
float3 vViewNormal = mul((float3x3)mView, vWorldNormal);
float4 vWorldPos = mul(mWorld, vPos);
float3 vNormViewPos = normalize(mul(mView, vWorldPos).xyz);
float3 vReflect = reflect(vNormViewPos, vViewNormal);
matViewT[2][0] = -matViewT[2][0];
matViewT[2][1] = -matViewT[2][1];
matViewT[2][2] = -matViewT[2][2];
vReflect = mul((float3x3)matViewT, vReflect);
vReflect = mul(mTexture, float4(vReflect,1)).xyz;
vOut = vReflect;
}
//-----------------------------------------------------------------------------
void FFP_GenerateTexCoord_Projection(in float4x4 mWorld,
in float4x4 mTexViewProjImage,
in float4 vPos,
out float3 vOut)
{
float4 vWorldPos = mul(mWorld, vPos);
float4 vTexturePos = mul(mTexViewProjImage, vWorldPos);
vOut = float3(vTexturePos.xy, vTexturePos.w);
}
//-----------------------------------------------------------------------------
void FFP_SampleTexture(in sampler1D s,
in float f,
out float4 t)
{
t = tex1D(s, f);
}
//-----------------------------------------------------------------------------
void FFP_SampleTexture(in sampler2D s,
in float2 f,
out float4 t)
{
t = tex2D(s, f);
}
//-----------------------------------------------------------------------------
void FFP_SampleTextureProj(in sampler2D s,
in float3 f,
out float4 t)
{
t = tex2D(s, f.xy/f.z);
}
//-----------------------------------------------------------------------------
void FFP_SampleTexture(in sampler3D s,
in float3 f,
out float4 t)
{
t = tex3D(s, f);
}
//-----------------------------------------------------------------------------
void FFP_SampleTexture(in samplerCUBE s,
in float3 f,
out float4 t)
{
t = texCUBE(s, f);
}
//-----------------------------------------------------------------------------
void FFP_ModulateX2(in float vIn0, in float vIn1, out float vOut)
{
vOut = vIn0 * vIn1 * 2;
}
//-----------------------------------------------------------------------------
void FFP_ModulateX2(in float2 vIn0, in float2 vIn1, out float2 vOut)
{
vOut = vIn0 * vIn1 * 2;
}
//-----------------------------------------------------------------------------
void FFP_ModulateX2(in float3 vIn0, in float3 vIn1, out float3 vOut)
{
vOut = vIn0 * vIn1 * 2;
}
//-----------------------------------------------------------------------------
void FFP_ModulateX2(in float4 vIn0, in float4 vIn1, out float4 vOut)
{
vOut = vIn0 * vIn1 * 2;
}
//-----------------------------------------------------------------------------
void FFP_ModulateX4(in float vIn0, in float vIn1, out float vOut)
{
vOut = vIn0 * vIn1 * 4;
}
//-----------------------------------------------------------------------------
void FFP_ModulateX4(in float2 vIn0, in float2 vIn1, out float2 vOut)
{
vOut = vIn0 * vIn1 * 4;
}
//-----------------------------------------------------------------------------
void FFP_ModulateX4(in float3 vIn0, in float3 vIn1, out float3 vOut)
{
vOut = vIn0 * vIn1 * 4;
}
//-----------------------------------------------------------------------------
void FFP_ModulateX4(in float4 vIn0, in float4 vIn1, out float4 vOut)
{
vOut = vIn0 * vIn1 * 4;
}
//-----------------------------------------------------------------------------
void FFP_AddSigned(in float vIn0, in float vIn1, out float vOut)
{
vOut = vIn0 + vIn1 - 0.5;
}
//-----------------------------------------------------------------------------
void FFP_AddSigned(in float2 vIn0, in float2 vIn1, out float2 vOut)
{
vOut = vIn0 + vIn1 - 0.5;
}
//-----------------------------------------------------------------------------
void FFP_AddSigned(in float3 vIn0, in float3 vIn1, out float3 vOut)
{
vOut = vIn0 + vIn1 - 0.5;
}
//-----------------------------------------------------------------------------
void FFP_AddSigned(in float4 vIn0, in float4 vIn1, out float4 vOut)
{
vOut = vIn0 + vIn1 - 0.5;
}
//-----------------------------------------------------------------------------
void FFP_AddSmooth(in float vIn0, in float vIn1, out float vOut)
{
vOut = vIn0 + vIn1 - (vIn0 * vIn1);
}
//-----------------------------------------------------------------------------
void FFP_AddSmooth(in float2 vIn0, in float2 vIn1, out float2 vOut)
{
vOut = vIn0 + vIn1 - (vIn0 * vIn1);
}
//-----------------------------------------------------------------------------
void FFP_AddSmooth(in float3 vIn0, in float3 vIn1, out float3 vOut)
{
vOut = vIn0 + vIn1 - (vIn0 * vIn1);
}
//-----------------------------------------------------------------------------
void FFP_AddSmooth(in float4 vIn0, in float4 vIn1, out float4 vOut)
{
vOut = vIn0 + vIn1 - (vIn0 * vIn1);
}

72
Bushin/media/RTShaderLib/FFPLib_Transform.cg

@ -0,0 +1,72 @@
/*
-----------------------------------------------------------------------------
This source file is part of OGRE
(Object-oriented Graphics Rendering Engine)
For the latest info, see http://www.ogre3d.org
Copyright (c) 2000-2012 Torus Knot Software Ltd
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-----------------------------------------------------------------------------
*/
//-----------------------------------------------------------------------------
// Program Name: FFPLib_Transform
// Program Desc: Transform functions of the FFP.
// Program Type: Vertex shader
// Language: CG
// Notes: Implements core functions for FFPTransform class.
// based on transform engine.
// See http://msdn.microsoft.com/en-us/library/bb206269.aspx
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
void FFP_Transform(in float4x4 m,
in float4 v,
out float4 vOut)
{
vOut = mul(m, v);
}
//-----------------------------------------------------------------------------
#ifndef OPENGL_ES_2
//-----------------------------------------------------------------------------
void FFP_Transform(in float3x4 m,
in float4 v,
out float3 vOut)
{
vOut = mul(m, v);
}
//-----------------------------------------------------------------------------
void FFP_Transform(in float3x4 m,
in float3 v,
out float3 vOut)
{
vOut = mul((float3x3)m, v);
}
//-----------------------------------------------------------------------------
#endif
//-----------------------------------------------------------------------------
void FFP_Transform(in float4x4 m,
in float3 v,
out float3 vOut)
{
vOut = mul((float3x3)m, v);
}

80
Bushin/media/RTShaderLib/FFPLib_Transform.glsl

@ -0,0 +1,80 @@
#version 120
/*
-----------------------------------------------------------------------------
This source file is part of OGRE
(Object-oriented Graphics Rendering Engine)
For the latest info, see http://www.ogre3d.org
Copyright (c) 2000-2012 Torus Knot Software Ltd
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-----------------------------------------------------------------------------
*/
//-----------------------------------------------------------------------------
// Program Name: FFPLib_Transform
// Program Desc: Transform functions of the FFP.
// Program Type: Vertex shader
// Language: GLSL
// Notes: Implements core functions for FFPTransform class.
// based on transform engine.
// See http://msdn.microsoft.com/en-us/library/bb206269.aspx
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
void FFP_Transform(in mat4 m,
in vec4 v,
out vec4 vOut)
{
vOut = m * v;
}
//-----------------------------------------------------------------------------
void FFP_Transform(in mat4 m,
in vec4 v,
out vec3 vOut)
{
vOut = (m * v).xyz;
}
//-----------------------------------------------------------------------------
void FFP_Transform(in mat3x4 m,
in vec4 v,
out vec3 vOut)
{
vOut = m * v;
}
//-----------------------------------------------------------------------------
void FFP_Transform(in mat3x4 m,
in vec3 v,
out vec3 vOut)
{
vOut = mat3(m) * v;
}
//-----------------------------------------------------------------------------
void FFP_Transform(in mat4 m,
in vec3 v,
out vec3 vOut)
{
vOut = mat3(m) * v;
}

65
Bushin/media/RTShaderLib/FFPLib_Transform.glsles

@ -0,0 +1,65 @@
#version 100
precision highp float;
precision highp int;
precision lowp sampler2D;
precision lowp samplerCube;
/*
-----------------------------------------------------------------------------
This source file is part of OGRE
(Object-oriented Graphics Rendering Engine)
For the latest info, see http://www.ogre3d.org
Copyright (c) 2000-2012 Torus Knot Software Ltd
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-----------------------------------------------------------------------------
*/
//-----------------------------------------------------------------------------
// Program Name: FFPLib_Transform
// Program Desc: Transform functions of the FFP.
// Program Type: Vertex shader
// Language: GLSL ES
// Notes: Implements core functions for FFPTransform class.
// based on transform engine.
// See http://msdn.microsoft.com/en-us/library/bb206269.aspx
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
void FFP_Transform(in mat4 m,
in vec4 v,
out vec4 vOut)
{
vOut = m * v;
}
//-----------------------------------------------------------------------------
void FFP_Transform(in mat4 m,
in vec4 v,
out vec3 vOut)
{
vOut = (m * v).xyz;
}
//-----------------------------------------------------------------------------
void FFP_Transform(in mat4 m,
in vec3 v,
out vec3 vOut)
{
vOut = mat3(m) * v;
}

71
Bushin/media/RTShaderLib/FFPLib_Transform.hlsl

@ -0,0 +1,71 @@
/*
-----------------------------------------------------------------------------
This source file is part of OGRE
(Object-oriented Graphics Rendering Engine)
For the latest info, see http://www.ogre3d.org
Copyright (c) 2000-2012 Torus Knot Software Ltd
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-----------------------------------------------------------------------------
*/
//-----------------------------------------------------------------------------
// Program Name: FFPLib_Transform
// Program Desc: Transform functions of the FFP.
// Program Type: Vertex shader
// Language: HLSL
// Notes: Implements core functions for FFPTransform class.
// based on transform engine.
// See http://msdn.microsoft.com/en-us/library/bb206269.aspx
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
void FFP_Transform(in float4x4 m,
in float4 v,
out float4 vOut)
{
vOut = mul(m, v);
}
//-----------------------------------------------------------------------------
void FFP_Transform(in float3x4 m,
in float4 v,
out float3 vOut)
{
vOut = mul(m, v);
}
//-----------------------------------------------------------------------------
void FFP_Transform(in float3x4 m,
in float3 v,
out float3 vOut)
{
vOut = mul((float3x3)m, v);
}
//-----------------------------------------------------------------------------
void FFP_Transform(in float4x4 m,
in float3 v,
out float3 vOut)
{
vOut = mul((float3x3)m, v);
}

81
Bushin/media/RTShaderLib/SGXLib_IntegratedPSSM.cg

@ -0,0 +1,81 @@
//-----------------------------------------------------------------------------
// Program Name: SGXLib_IntegratedPSSM
// Program Desc: Integrated PSSM functions.
// Program Type: Vertex/Pixel shader
// Language: CG
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
void SGX_CopyDepth(in float4 clipSpacePos,
out float oDepth)
{
oDepth = clipSpacePos.z;
}
//-----------------------------------------------------------------------------
void SGX_ModulateScalar(in float vIn0, in float4 vIn1, out float4 vOut)
{
vOut = vIn0 * vIn1;
}
//-----------------------------------------------------------------------------
void SGX_ApplyShadowFactor_Diffuse(in float4 ambient,
in float4 lightSum,
in float fShadowFactor,
out float4 oLight)
{
oLight.rgb = ambient.rgb + (lightSum.rgb - ambient.rgb) * fShadowFactor;
oLight.a = lightSum.a;
}
//-----------------------------------------------------------------------------
float _SGX_ShadowPCF4(sampler2D shadowMap, float4 shadowMapPos, float2 offset)
{
shadowMapPos = shadowMapPos / shadowMapPos.w;
float2 uv = shadowMapPos.xy;
float3 o = float3(offset, -offset.x) * 0.3f;
// Note: We using 2x2 PCF. Good enough and is a lot faster.
float c = (shadowMapPos.z <= tex2D(shadowMap, uv.xy - o.xy).r) ? 1 : 0; // top left
c += (shadowMapPos.z <= tex2D(shadowMap, uv.xy + o.xy).r) ? 1 : 0; // bottom right
c += (shadowMapPos.z <= tex2D(shadowMap, uv.xy + o.zy).r) ? 1 : 0; // bottom left
c += (shadowMapPos.z <= tex2D(shadowMap, uv.xy - o.zy).r) ? 1 : 0; // top right
return c / 4;
}
//-----------------------------------------------------------------------------
void SGX_ComputeShadowFactor_PSSM3(in float fDepth,
in float4 vSplitPoints,
in float4 lightPosition0,
in float4 lightPosition1,
in float4 lightPosition2,
in sampler2D shadowMap0,
in sampler2D shadowMap1,
in sampler2D shadowMap2,
in float4 invShadowMapSize0,
in float4 invShadowMapSize1,
in float4 invShadowMapSize2,
out float oShadowFactor)
{
float shadowFactor0;
float shadowFactor1;
float shadowFactor2;
shadowFactor0 = _SGX_ShadowPCF4(shadowMap0, lightPosition0, invShadowMapSize0.xy);
shadowFactor1 = _SGX_ShadowPCF4(shadowMap1, lightPosition1, invShadowMapSize1.xy);
shadowFactor2 = _SGX_ShadowPCF4(shadowMap2, lightPosition2, invShadowMapSize2.xy);
if (fDepth <= vSplitPoints.x)
{
oShadowFactor = shadowFactor0;
}
else if (fDepth <= vSplitPoints.y)
{
oShadowFactor = shadowFactor1;
}
else
{
oShadowFactor = shadowFactor2;
}
}

107
Bushin/media/RTShaderLib/SGXLib_IntegratedPSSM.glsl

@ -0,0 +1,107 @@
/*
-----------------------------------------------------------------------------
This source file is part of OGRE
(Object-oriented Graphics Rendering Engine)
For the latest info, see http://www.ogre3d.org
Copyright (c) 2000-2012 Torus Knot Software Ltd
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-----------------------------------------------------------------------------
*/
//-----------------------------------------------------------------------------
// Program Name: SGXLib_IntegratedPSSM
// Program Desc: Integrated PSSM functions.
// Program Type: Vertex/Pixel shader
// Language: GLSL
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
void SGX_CopyDepth(in vec4 clipSpacePos,
out float oDepth)
{
oDepth = clipSpacePos.z;
}
//-----------------------------------------------------------------------------
void SGX_ModulateScalar(in float vIn0, in vec4 vIn1, out vec4 vOut)
{
vOut = vIn0 * vIn1;
}
//-----------------------------------------------------------------------------
void SGX_ApplyShadowFactor_Diffuse(in vec4 ambient,
in vec4 lightSum,
in float fShadowFactor,
out vec4 oLight)
{
oLight.rgb = ambient.rgb + (lightSum.rgb - ambient.rgb) * fShadowFactor;
oLight.a = lightSum.a;
}
//-----------------------------------------------------------------------------
float _SGX_ShadowPCF4(sampler2D shadowMap, vec4 shadowMapPos, vec2 offset)
{
shadowMapPos = shadowMapPos / shadowMapPos.w;
vec2 uv = shadowMapPos.xy;
vec3 o = vec3(offset, -offset.x) * 0.3;
// Note: We using 2x2 PCF. Good enough and is a lot faster.
float c = (shadowMapPos.z <= texture2D(shadowMap, uv.xy - o.xy).r) ? 1.0 : 0.0; // top left
c += (shadowMapPos.z <= texture2D(shadowMap, uv.xy + o.xy).r) ? 1.0 : 0.0; // bottom right
c += (shadowMapPos.z <= texture2D(shadowMap, uv.xy + o.zy).r) ? 1.0 : 0.0; // bottom left
c += (shadowMapPos.z <= texture2D(shadowMap, uv.xy - o.zy).r) ? 1.0 : 0.0; // top right
return c / 4.0;
}
//-----------------------------------------------------------------------------
void SGX_ComputeShadowFactor_PSSM3(in float fDepth,
in vec4 vSplitPoints,
in vec4 lightPosition0,
in vec4 lightPosition1,
in vec4 lightPosition2,
in sampler2D shadowMap0,
in sampler2D shadowMap1,
in sampler2D shadowMap2,
in vec4 invShadowMapSize0,
in vec4 invShadowMapSize1,
in vec4 invShadowMapSize2,
out float oShadowFactor)
{
float shadowFactor0;
float shadowFactor1;
float shadowFactor2;
shadowFactor0 = _SGX_ShadowPCF4(shadowMap0, lightPosition0, invShadowMapSize0.xy);
shadowFactor1 = _SGX_ShadowPCF4(shadowMap1, lightPosition1, invShadowMapSize1.xy);
shadowFactor2 = _SGX_ShadowPCF4(shadowMap2, lightPosition2, invShadowMapSize2.xy);
if (fDepth <= vSplitPoints.x)
{
oShadowFactor = shadowFactor0;
}
else if (fDepth <= vSplitPoints.y)
{
oShadowFactor = shadowFactor1;
}
else
{
oShadowFactor = shadowFactor2;
}
}

112
Bushin/media/RTShaderLib/SGXLib_IntegratedPSSM.glsles

@ -0,0 +1,112 @@
#version 100
precision highp float;
precision highp int;
precision lowp sampler2D;
precision lowp samplerCube;
/*
-----------------------------------------------------------------------------
This source file is part of OGRE
(Object-oriented Graphics Rendering Engine)
For the latest info, see http://www.ogre3d.org
Copyright (c) 2000-2012 Torus Knot Software Ltd
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-----------------------------------------------------------------------------
*/
//-----------------------------------------------------------------------------
// Program Name: SGXLib_IntegratedPSSM
// Program Desc: Integrated PSSM functions.
// Program Type: Vertex/Pixel shader
// Language: GLSL ES
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
void SGX_CopyDepth(in vec4 clipSpacePos,
out float oDepth)
{
oDepth = clipSpacePos.z;
}
//-----------------------------------------------------------------------------
void SGX_ModulateScalar(in float vIn0, in vec4 vIn1, out vec4 vOut)
{
vOut = vIn0 * vIn1;
}
//-----------------------------------------------------------------------------
void SGX_ApplyShadowFactor_Diffuse(in vec4 ambient,
in vec4 lightSum,
in float fShadowFactor,
out vec4 oLight)
{
oLight.rgb = ambient.rgb + (lightSum.rgb - ambient.rgb) * fShadowFactor;
oLight.a = lightSum.a;
}
//-----------------------------------------------------------------------------
float _SGX_ShadowPCF4(in sampler2D shadowMap, in vec4 shadowMapPos, in vec2 offset)
{
shadowMapPos = shadowMapPos / shadowMapPos.w;
vec2 uv = shadowMapPos.xy;
vec3 o = vec3(offset, -offset.x) * 0.3;
// Note: We using 2x2 PCF. Good enough and is a lot faster.
float c = (shadowMapPos.z <= texture2D(shadowMap, uv.xy - o.xy).r) ? 1.0 : 0.0; // top left
c += (shadowMapPos.z <= texture2D(shadowMap, uv.xy + o.xy).r) ? 1.0 : 0.0; // bottom right
c += (shadowMapPos.z <= texture2D(shadowMap, uv.xy + o.zy).r) ? 1.0 : 0.0; // bottom left
c += (shadowMapPos.z <= texture2D(shadowMap, uv.xy - o.zy).r) ? 1.0 : 0.0; // top right
return c / 4.0;
}
//-----------------------------------------------------------------------------
void SGX_ComputeShadowFactor_PSSM3(in float fDepth,
in vec4 vSplitPoints,
in vec4 lightPosition0,
in vec4 lightPosition1,
in vec4 lightPosition2,
in sampler2D shadowMap0,
in sampler2D shadowMap1,
in sampler2D shadowMap2,
in vec4 invShadowMapSize0,
in vec4 invShadowMapSize1,
in vec4 invShadowMapSize2,
out float oShadowFactor)
{
float shadowFactor0;
float shadowFactor1;
float shadowFactor2;
shadowFactor0 = _SGX_ShadowPCF4(shadowMap0, lightPosition0, invShadowMapSize0.xy);
shadowFactor1 = _SGX_ShadowPCF4(shadowMap1, lightPosition1, invShadowMapSize1.xy);
shadowFactor2 = _SGX_ShadowPCF4(shadowMap2, lightPosition2, invShadowMapSize2.xy);
if (fDepth <= vSplitPoints.x)
{
oShadowFactor = shadowFactor0;
}
else if (fDepth <= vSplitPoints.y)
{
oShadowFactor = shadowFactor1;
}
else
{
oShadowFactor = shadowFactor2;
}
}

81
Bushin/media/RTShaderLib/SGXLib_IntegratedPSSM.hlsl

@ -0,0 +1,81 @@
//-----------------------------------------------------------------------------
// Program Name: SGXLib_IntegratedPSSM
// Program Desc: Integrated PSSM functions.
// Program Type: Vertex/Pixel shader
// Language: HLSL
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
void SGX_CopyDepth(in float4 clipSpacePos,
out float oDepth)
{
oDepth = clipSpacePos.z;
}
//-----------------------------------------------------------------------------
void SGX_ModulateScalar(in float vIn0, in float4 vIn1, out float4 vOut)
{
vOut = vIn0 * vIn1;
}
//-----------------------------------------------------------------------------
void SGX_ApplyShadowFactor_Diffuse(in float4 ambient,
in float4 lightSum,
in float fShadowFactor,
out float4 oLight)
{
oLight.rgb = ambient.rgb + (lightSum.rgb - ambient.rgb) * fShadowFactor;
oLight.a = lightSum.a;
}
//-----------------------------------------------------------------------------
float _SGX_ShadowPCF4(sampler2D shadowMap, float4 shadowMapPos, float2 offset)
{
shadowMapPos = shadowMapPos / shadowMapPos.w;
float2 uv = shadowMapPos.xy;
float3 o = float3(offset, -offset.x) * 0.3f;
// Note: We using 2x2 PCF. Good enough and is a lot faster.
float c = (shadowMapPos.z <= tex2D(shadowMap, uv.xy - o.xy).r) ? 1 : 0; // top left
c += (shadowMapPos.z <= tex2D(shadowMap, uv.xy + o.xy).r) ? 1 : 0; // bottom right
c += (shadowMapPos.z <= tex2D(shadowMap, uv.xy + o.zy).r) ? 1 : 0; // bottom left
c += (shadowMapPos.z <= tex2D(shadowMap, uv.xy - o.zy).r) ? 1 : 0; // top right
return c / 4;
}
//-----------------------------------------------------------------------------
void SGX_ComputeShadowFactor_PSSM3(in float fDepth,
in float4 vSplitPoints,
in float4 lightPosition0,
in float4 lightPosition1,
in float4 lightPosition2,
in sampler2D shadowMap0,
in sampler2D shadowMap1,
in sampler2D shadowMap2,
in float4 invShadowMapSize0,
in float4 invShadowMapSize1,
in float4 invShadowMapSize2,
out float oShadowFactor)
{
float shadowFactor0;
float shadowFactor1;
float shadowFactor2;
shadowFactor0 = _SGX_ShadowPCF4(shadowMap0, lightPosition0, invShadowMapSize0.xy);
shadowFactor1 = _SGX_ShadowPCF4(shadowMap1, lightPosition1, invShadowMapSize1.xy);
shadowFactor2 = _SGX_ShadowPCF4(shadowMap2, lightPosition2, invShadowMapSize2.xy);
if (fDepth <= vSplitPoints.x)
{
oShadowFactor = shadowFactor0;
}
else if (fDepth <= vSplitPoints.y)
{
oShadowFactor = shadowFactor1;
}
else
{
oShadowFactor = shadowFactor2;
}
}

728
Bushin/media/RTShaderLib/SGXLib_LayeredBlending.cg

@ -0,0 +1,728 @@
/*
** layered blending & misc math
** Blending modes, RGB/HSL/Contrast/Desaturate
**
** The shaders below are base on the shaders created by:
** Romain Dura | Romz
** Blog: http://blog.mouaif.org
** Post: http://blog.mouaif.org/?p=94
*/
/*
** Desaturation
*/
float4 Desaturate(float3 color, float Desaturation)
{
float3 grayXfer = float3(0.3, 0.59, 0.11);
float grayf = dot(grayXfer, color);
float3 gray = float3(grayf, grayf, grayf);
return float4(lerp(color, gray, Desaturation), 1.0);
}
/*
** Hue, saturation, luminance
*/
float3 RGBToHSL(float3 color)
{
float3 hsl; // init to 0 to avoid warnings ? (and reverse if + remove first part)
float fmin = min(min(color.r, color.g), color.b); //Min. value of RGB
float fmax = max(max(color.r, color.g), color.b); //Max. value of RGB
float delta = fmax - fmin; //Delta RGB value
hsl.z = (fmax + fmin) / 2.0; // Luminance
if (delta == 0.0) //This is a gray, no chroma...
{
hsl.x = 0.0; // Hue
hsl.y = 0.0; // Saturation
}
else //Chromatic data...
{
if (hsl.z < 0.5)
hsl.y = delta / (fmax + fmin); // Saturation
else
hsl.y = delta / (2.0 - fmax - fmin); // Saturation
float deltaR = (((fmax - color.r) / 6.0) + (delta / 2.0)) / delta;
float deltaG = (((fmax - color.g) / 6.0) + (delta / 2.0)) / delta;
float deltaB = (((fmax - color.b) / 6.0) + (delta / 2.0)) / delta;
if (color.r == fmax )
hsl.x = deltaB - deltaG; // Hue
else if (color.g == fmax)
hsl.x = (1.0 / 3.0) + deltaR - deltaB; // Hue
else if (color.b == fmax)
hsl.x = (2.0 / 3.0) + deltaG - deltaR; // Hue
if (hsl.x < 0.0)
hsl.x += 1.0; // Hue
else if (hsl.x > 1.0)
hsl.x -= 1.0; // Hue
}
return hsl;
}
float HueToRGB(float f1, float f2, float hue)
{
if (hue < 0.0)
hue += 1.0;
else if (hue > 1.0)
hue -= 1.0;
float res;
if ((6.0 * hue) < 1.0)
res = f1 + (f2 - f1) * 6.0 * hue;
else if ((2.0 * hue) < 1.0)
res = f2;
else if ((3.0 * hue) < 2.0)
res = f1 + (f2 - f1) * ((2.0 / 3.0) - hue) * 6.0;
else
res = f1;
return res;
}
float3 HSLToRGB(float3 hsl)
{
float3 rgb;
if (hsl.y == 0.0)
rgb = float3(hsl.z, hsl.z, hsl.z); // Luminance
else
{
float f2;
if (hsl.z < 0.5)
f2 = hsl.z * (1.0 + hsl.y);
else
f2 = (hsl.z + hsl.y) - (hsl.y * hsl.z);
float f1 = 2.0 * hsl.z - f2;
rgb.r = HueToRGB(f1, f2, hsl.x + (1.0/3.0));
rgb.g = HueToRGB(f1, f2, hsl.x);
rgb.b= HueToRGB(f1, f2, hsl.x - (1.0/3.0));
}
return rgb;
}
/*
** Contrast, saturation, brightness
** Code of this function is from TGM's shader pack
** http://irrlicht.sourceforge.net/phpBB2/viewtopic.php?t=21057
*/
// For all settings: 1.0 = 100% 0.5=50% 1.5 = 150%
float3 ContrastSaturationBrightness(float3 color, float brt, float sat, float con)
{
// Increase or decrease these values to adjust r, g and b color channels separately
const float AvgLumR = 0.5;
const float AvgLumG = 0.5;
const float AvgLumB = 0.5;
const float3 LumCoeff = float3(0.2125, 0.7154, 0.0721);
float3 AvgLumin = float3(AvgLumR, AvgLumG, AvgLumB);
float3 brtColor = color * brt;
float intensityf = dot(brtColor, LumCoeff);
float3 intensity = float3(intensityf, intensityf, intensityf);
float3 satColor = lerp(intensity, brtColor, sat);
float3 conColor = lerp(AvgLumin, satColor, con);
return conColor;
}
/*
** Float blending modes
** Adapted from here: http://www.nathanm.com/photoshop-blending-math/
** But I modified the HardMix (wrong condition), Overlay, SoftLight, ColorDodge, ColorBurn, VividLight, PinLight (inverted layers) ones to have correct results
*/
#define BlendLinearDodgef BlendAddf
#define BlendLinearBurnf BlendSubtractf
#define BlendAddf(base, blend) min(base + blend, 1.0)
#define BlendSubtractf(base, blend) max(base + blend - 1.0, 0.0)
#define BlendLightenf(base, blend) max(blend, base)
#define BlendDarkenf(base, blend) min(blend, base)
#define BlendLinearLightf(base, blend) (blend < 0.5 ? BlendLinearBurnf(base, (2.0 * blend)) : BlendLinearDodgef(base, (2.0 * (blend - 0.5))))
#define BlendScreenf(base, blend) (1.0 - ((1.0 - base) * (1.0 - blend)))
#define BlendOverlayf(base, blend) (base < 0.5 ? (2.0 * base * blend) : (1.0 - 2.0 * (1.0 - base) * (1.0 - blend)))
#define BlendSoftLightf(base, blend) ((blend < 0.5) ? (2.0 * base * blend + base * base * (1.0 - 2.0 * blend)) : (sqrt(base) * (2.0 * blend - 1.0) + 2.0 * base * (1.0 - blend)))
#define BlendColorDodgef(base, blend) ((blend == 1.0) ? blend : min(base / (1.0 - blend), 1.0))
#define BlendColorBurnf(base, blend) ((blend == 0.0) ? blend : max((1.0 - ((1.0 - base) / blend)), 0.0))
#define BlendVividLightf(base, blend) ((blend < 0.5) ? BlendColorBurnf(base, (2.0 * blend)) : BlendColorDodgef(base, (2.0 * (blend - 0.5))))
#define BlendPinLightf(base, blend) ((blend < 0.5) ? BlendDarkenf(base, (2.0 * blend)) : BlendLightenf(base, (2.0 *(blend - 0.5))))
#define BlendHardMixf(base, blend) ((BlendVividLightf(base, blend) < 0.5) ? 0.0 : 1.0)
#define BlendReflectf(base, blend) ((blend == 1.0) ? blend : min(base * base / (1.0 - blend), 1.0))
/*
** Vector3 blending modes
*/
// Component wise blending
#define Blend1(base, blend, funcf) funcf(base, blend)
#define Blend3(base, blend, funcf) float3(funcf(base.r, blend.r), funcf(base.g, blend.g), funcf(base.b, blend.b))
#define Blend4(base, blend, funcf) float4(funcf(base.r, blend.r), funcf(base.g, blend.g), funcf(base.b, blend.b), funcf(base.a, blend.a))
#define BlendNormal(base, blend) (base)
#define BlendLighten BlendLightenf
#define BlendDarken BlendDarkenf
#define BlendMultiply(base, blend) (base * blend)
#define BlendAverage(base, blend) ((base + blend) / 2.0)
#define BlendAdd(base, blend) min(base + blend, 1.0)
#define BlendSubtract(base, blend) max(base + blend - 1.0, 0.0)
#define BlendDifference(base, blend) abs(base - blend)
#define BlendNegation(base, blend) (1.0 - abs(1.0 - base - blend))
#define BlendExclusion(base, blend) (base + blend - 2.0 * base * blend)
#define BlendScreen1(base, blend) Blend1(base, blend, BlendScreenf)
#define BlendOverlay1(base, blend) Blend1(base, blend, BlendOverlayf)
#define BlendSoftLight1(base, blend) Blend1(base, blend, BlendSoftLightf)
#define BlendHardLight1(base, blend) BlendOverlay1(blend, base)
#define BlendColorDodge1(base, blend) Blend1(base, blend, BlendColorDodgef)
#define BlendColorBurn1(base, blend) Blend1(base, blend, BlendColorBurnf)
// Linear Light is another contrast-increasing mode
// If the blend color is darker than midgray, Linear Light darkens the image by decreasing the brightness. If the blend color is lighter than midgray, the result is a brighter image due to increased brightness.
#define BlendLinearLight1(base, blend) Blend1(base, blend, BlendLinearLightf)
#define BlendVividLight1(base, blend) Blend1(base, blend, BlendVividLightf)
#define BlendPinLight1(base, blend) Blend1(base, blend, BlendPinLightf)
#define BlendHardMix1(base, blend) Blend1(base, blend, BlendHardMixf)
#define BlendReflect1(base, blend) Blend1(base, blend, BlendReflectf)
#define BlendGlow1(base, blend) BlendReflect1(blend, base)
#define BlendScreen3(base, blend) Blend3(base, blend, BlendScreenf)
#define BlendOverlay3(base, blend) Blend3(base, blend, BlendOverlayf)
#define BlendSoftLight3(base, blend) Blend3(base, blend, BlendSoftLightf)
#define BlendHardLight3(base, blend) BlendOverlay3(blend, base)
#define BlendColorDodge3(base, blend) Blend3(base, blend, BlendColorDodgef)
#define BlendColorBurn3(base, blend) Blend3(base, blend, BlendColorBurnf)
// Linear Light is another contrast-increasing mode
// If the blend color is darker than midgray, Linear Light darkens the image by decreasing the brightness. If the blend color is lighter than midgray, the result is a brighter image due to increased brightness.
#define BlendLinearLight3(base, blend) Blend3(base, blend, BlendLinearLightf)
#define BlendVividLight3(base, blend) Blend3(base, blend, BlendVividLightf)
#define BlendPinLight3(base, blend) Blend3(base, blend, BlendPinLightf)
#define BlendHardMix3(base, blend) Blend3(base, blend, BlendHardMixf)
#define BlendReflect3(base, blend) Blend3(base, blend, BlendReflectf)
#define BlendGlow3(base, blend) BlendReflect3(blend, base)
#define BlendScreen4(base, blend) Blend4(base, blend, BlendScreenf)
#define BlendOverlay4(base, blend) Blend4(base, blend, BlendOverlayf)
#define BlendSoftLight4(base, blend) Blend4(base, blend, BlendSoftLightf)
#define BlendHardLight4(base, blend) BlendOverlay4(blend, base)
#define BlendColorDodge4(base, blend) Blend4(base, blend, BlendColorDodgef)
#define BlendColorBurn4(base, blend) Blend4(base, blend, BlendColorBurnf)
// Linear Light is another contrast-increasing mode
// If the blend color is darker than midgray, Linear Light darkens the image by decreasing the brightness. If the blend color is lighter than midgray, the result is a brighter image due to increased brightness.
#define BlendLinearLight4(base, blend) Blend4(base, blend, BlendLinearLightf)
#define BlendVividLight4(base, blend) Blend4(base, blend, BlendVividLightf)
#define BlendPinLight4(base, blend) Blend4(base, blend, BlendPinLightf)
#define BlendHardMix4(base, blend) Blend4(base, blend, BlendHardMixf)
#define BlendReflect4(base, blend) Blend4(base, blend, BlendReflectf)
#define BlendGlow4(base, blend) BlendReflect4(blend, base)
#define BlendLinearDodge BlendAdd
#define BlendLinearBurn BlendSubtract
#define BlendPhoenix(base, blend) (min(base, blend) - max(base, blend) + 1.0)
#define BlendOpacity(base, blend, F, O) (F(base, blend) * O + blend * (1.0 - O))
// Hue Blend mode creates the result color by combining the luminance and saturation of the base color with the hue of the blend color.
float BlendHue1(float base, float blend)
{
return base;
}
float3 BlendHue3(float3 base, float3 blend)
{
float3 baseHSL = RGBToHSL(base);
return HSLToRGB(float3(RGBToHSL(blend).r, baseHSL.g, baseHSL.b));
}
float4 BlendHue4(float4 base, float4 blend)
{
float3 hue = BlendHue3(base.xyz, blend.xyz);
return float4(hue.x, hue.y, hue.z, BlendHue1(base.w, blend.w));
}
// Saturation Blend mode creates the result color by combining the luminance and hue of the base color with the saturation of the blend color.
float BlendSaturation1(float base, float blend)
{
return base;
}
float3 BlendSaturation3(float3 base, float3 blend)
{
float3 baseHSL = RGBToHSL(base);
return HSLToRGB(float3(baseHSL.r, RGBToHSL(blend).g, baseHSL.b));
}
float4 BlendSaturation4(float4 base, float4 blend)
{
float3 hue = BlendSaturation3(base.xyz, blend.xyz);
return float4(hue.x, hue.y, hue.z, BlendSaturation1(base.w, blend.w));
}
// Color Mode keeps the brightness of the base color and applies both the hue and saturation of the blend color.
float BlendColor1(float base, float blend)
{
return base;
}
float3 BlendColor3(float3 base, float3 blend)
{
float3 blendHSL = RGBToHSL(blend);
return HSLToRGB(float3(blendHSL.r, blendHSL.g, RGBToHSL(base).b));
}
float4 BlendColor4(float4 base, float4 blend)
{
float3 hue = BlendColor3(base.xyz, blend.xyz);
return float4(hue.x, hue.y, hue.z, BlendColor1(base.w, blend.w));
}
// Luminosity Blend mode creates the result color by combining the hue and saturation of the base color with the luminance of the blend color.
float BlendLuminosity1(float base, float blend)
{
return base;
}
float3 BlendLuminosity3(float3 base, float3 blend)
{
float3 baseHSL = RGBToHSL(base);
return HSLToRGB(float3(baseHSL.r, baseHSL.g, RGBToHSL(blend).b));
}
float4 BlendLuminosity4(float4 base, float4 blend)
{
float3 hue = BlendLuminosity3(base.xyz, blend.xyz);
return float4(hue.x, hue.y, hue.z, BlendLuminosity1(base.w, blend.w));
}
//------------------------------------
// Interface for RTShader
//------------------------------------
void SGX_blend_normal(float4 basePixel, float4 blendPixel, out float4 oColor)
{
oColor = BlendNormal(basePixel, blendPixel);
}
void SGX_blend_normal(float3 basePixel, float3 blendPixel, out float3 oColor)
{
oColor = BlendNormal(basePixel, blendPixel);
}
void SGX_blend_normal(float basePixel, float blendPixel, out float oColor)
{
oColor = BlendNormal(basePixel, blendPixel);
}
void SGX_blend_lighten(float4 basePixel, float4 blendPixel, out float4 oColor)
{
oColor = BlendLighten(basePixel, blendPixel);
}
void SGX_blend_lighten(float3 basePixel, float3 blendPixel, out float3 oColor)
{
oColor = BlendLighten(basePixel, blendPixel);
}
void SGX_blend_lighten(float basePixel, float blendPixel, out float oColor)
{
oColor = BlendLighten(basePixel, blendPixel);
}
void SGX_blend_darken(float4 basePixel, float4 blendPixel, out float4 oColor)
{
oColor = BlendDarken(basePixel, blendPixel);
}
void SGX_blend_darken(float3 basePixel, float3 blendPixel, out float3 oColor)
{
oColor = BlendDarken(basePixel, blendPixel);
}
void SGX_blend_darken(float basePixel, float blendPixel, out float oColor)
{
oColor = BlendDarken(basePixel, blendPixel);
}
void SGX_blend_multiply(float4 basePixel, float4 blendPixel, out float4 oColor)
{
oColor = BlendMultiply(basePixel, blendPixel);
}
void SGX_blend_multiply(float3 basePixel, float3 blendPixel, out float3 oColor)
{
oColor = BlendMultiply(basePixel, blendPixel);
}
void SGX_blend_multiply(float basePixel, float blendPixel, out float oColor)
{
oColor = BlendMultiply(basePixel, blendPixel);
}
void SGX_blend_average(float4 basePixel, float4 blendPixel, out float4 oColor)
{
oColor = BlendAverage(basePixel, blendPixel);
}
void SGX_blend_average(float3 basePixel, float3 blendPixel, out float3 oColor)
{
oColor = BlendAverage(basePixel, blendPixel);
}
void SGX_blend_average(float basePixel, float blendPixel, out float oColor)
{
oColor = BlendAverage(basePixel, blendPixel);
}
void SGX_blend_add(float4 basePixel, float4 blendPixel, out float4 oColor)
{
oColor = BlendAdd(basePixel, blendPixel);
}
void SGX_blend_add(float3 basePixel, float3 blendPixel, out float3 oColor)
{
oColor = BlendAdd(basePixel, blendPixel);
}
void SGX_blend_add(float basePixel, float blendPixel, out float oColor)
{
oColor = BlendAdd(basePixel, blendPixel);
}
void SGX_blend_subtract(float4 basePixel, float4 blendPixel, out float4 oColor)
{
oColor = BlendSubtract(basePixel, blendPixel);
}
void SGX_blend_subtract(float3 basePixel, float3 blendPixel, out float3 oColor)
{
oColor = BlendSubtract(basePixel, blendPixel);
}
void SGX_blend_subtract(float basePixel, float blendPixel, out float oColor)
{
oColor = BlendSubtract(basePixel, blendPixel);
}
void SGX_blend_difference(float4 basePixel, float4 blendPixel, out float4 oColor)
{
oColor = BlendDifference(basePixel, blendPixel);
}
void SGX_blend_difference(float3 basePixel, float3 blendPixel, out float3 oColor)
{
oColor = BlendDifference(basePixel, blendPixel);
}
void SGX_blend_difference(float basePixel, float blendPixel, out float oColor)
{
oColor = BlendDifference(basePixel, blendPixel);
}
void SGX_blend_negation(float4 basePixel, float4 blendPixel, out float4 oColor)
{
oColor = BlendNegation(basePixel, blendPixel);
}
void SGX_blend_negation(float3 basePixel, float3 blendPixel, out float3 oColor)
{
oColor = BlendNegation(basePixel, blendPixel);
}
void SGX_blend_negation(float basePixel, float blendPixel, out float oColor)
{
oColor = BlendNegation(basePixel, blendPixel);
}
void SGX_blend_exclusion(float4 basePixel, float4 blendPixel, out float4 oColor)
{
oColor = BlendExclusion(basePixel, blendPixel);
}
void SGX_blend_exclusion(float3 basePixel, float3 blendPixel, out float3 oColor)
{
oColor = BlendExclusion(basePixel, blendPixel);
}
void SGX_blend_exclusion(float basePixel, float blendPixel, out float oColor)
{
oColor = BlendExclusion(basePixel, blendPixel);
}
void SGX_blend_screen(float4 basePixel, float4 blendPixel, out float4 oColor)
{
oColor = Blend4(basePixel, blendPixel, BlendScreenf);
}
void SGX_blend_screen(float3 basePixel, float3 blendPixel, out float3 oColor)
{
oColor = Blend3(basePixel, blendPixel, BlendScreenf);
}
void SGX_blend_screen(float basePixel, float blendPixel, out float oColor)
{
oColor = Blend1(basePixel, blendPixel, BlendScreenf);
}
void SGX_blend_overlay(float4 basePixel, float4 blendPixel, out float4 oColor)
{
oColor = Blend4(basePixel, blendPixel, BlendOverlayf);
}
void SGX_blend_overlay(float3 basePixel, float3 blendPixel, out float3 oColor)
{
oColor = Blend3(basePixel, blendPixel, BlendOverlayf);
}
void SGX_blend_overlay(float basePixel, float blendPixel, out float oColor)
{
oColor = Blend1(basePixel, blendPixel, BlendOverlayf);
}
void SGX_blend_softLight(float4 basePixel, float4 blendPixel, out float4 oColor)
{
oColor = Blend4(basePixel, blendPixel, BlendSoftLightf);
}
void SGX_blend_softLight(float3 basePixel, float3 blendPixel, out float3 oColor)
{
oColor = Blend3(basePixel, blendPixel, BlendSoftLightf);
}
void SGX_blend_softLight(float basePixel, float blendPixel, out float oColor)
{
oColor = Blend1(basePixel, blendPixel, BlendSoftLightf);
}
void SGX_blend_hardLight(float4 basePixel, float4 blendPixel, out float4 oColor)
{
oColor = Blend4(basePixel, blendPixel, BlendOverlayf);
}
void SGX_blend_hardLight(float3 basePixel, float3 blendPixel, out float3 oColor)
{
oColor = Blend3(basePixel, blendPixel, BlendOverlayf);
}
void SGX_blend_hardLight(float basePixel, float blendPixel, out float oColor)
{
oColor = Blend1(basePixel, blendPixel, BlendOverlayf);
}
void SGX_blend_colorDodge(float4 basePixel, float4 blendPixel, out float4 oColor)
{
oColor = Blend4(basePixel, blendPixel, BlendColorDodgef);
}
void SGX_blend_colorDodge(float3 basePixel, float3 blendPixel, out float3 oColor)
{
oColor = Blend3(basePixel, blendPixel, BlendColorDodgef);
}
void SGX_blend_colorDodge(float basePixel, float blendPixel, out float oColor)
{
oColor = Blend1(basePixel, blendPixel, BlendColorDodgef);
}
void SGX_blend_colorBurn(float4 basePixel, float4 blendPixel, out float4 oColor)
{
oColor = Blend4(basePixel, blendPixel, BlendColorBurnf);
}
void SGX_blend_colorBurn(float3 basePixel, float3 blendPixel, out float3 oColor)
{
oColor = Blend3(basePixel, blendPixel, BlendColorBurnf);
}
void SGX_blend_colorBurn(float basePixel, float blendPixel, out float oColor)
{
oColor = Blend1(basePixel, blendPixel, BlendColorBurnf);
}
void SGX_blend_linearDodge(float4 basePixel, float4 blendPixel, out float4 oColor)
{
oColor = BlendLinearDodge(basePixel, blendPixel);
}
void SGX_blend_linearDodge(float3 basePixel, float3 blendPixel, out float3 oColor)
{
oColor = BlendLinearDodge(basePixel, blendPixel);
}
void SGX_blend_linearDodge(float basePixel, float blendPixel, out float oColor)
{
oColor = BlendLinearDodge(basePixel, blendPixel);
}
void SGX_blend_linearBurn(float4 basePixel, float4 blendPixel, out float4 oColor)
{
oColor = BlendLinearBurn(basePixel, blendPixel);
}
void SGX_blend_linearBurn(float3 basePixel, float3 blendPixel, out float3 oColor)
{
oColor = BlendLinearBurn(basePixel, blendPixel);
}
void SGX_blend_linearBurn(float basePixel, float blendPixel, out float oColor)
{
oColor = BlendLinearBurn(basePixel, blendPixel);
}
void SGX_blend_linearLight(float4 basePixel, float4 blendPixel, out float4 oColor)
{
oColor = Blend4(basePixel, blendPixel, BlendLinearLightf);
}
void SGX_blend_linearLight(float3 basePixel, float3 blendPixel, out float3 oColor)
{
oColor = Blend3(basePixel, blendPixel, BlendLinearLightf);
}
void SGX_blend_linearLight(float basePixel, float blendPixel, out float oColor)
{
oColor = Blend1(basePixel, blendPixel, BlendLinearLightf);
}
void SGX_blend_vividLight(float4 basePixel, float4 blendPixel, out float4 oColor)
{
oColor = Blend4(basePixel, blendPixel, BlendVividLightf);
}
void SGX_blend_vividLight(float3 basePixel, float3 blendPixel, out float3 oColor)
{
oColor = Blend3(basePixel, blendPixel, BlendVividLightf);
}
void SGX_blend_vividLight(float basePixel, float blendPixel, out float oColor)
{
oColor = Blend1(basePixel, blendPixel, BlendVividLightf);
}
void SGX_blend_pinLight(float4 basePixel, float4 blendPixel, out float4 oColor)
{
oColor = Blend4(basePixel, blendPixel, BlendPinLightf);
}
void SGX_blend_pinLight(float3 basePixel, float3 blendPixel, out float3 oColor)
{
oColor = Blend3(basePixel, blendPixel, BlendPinLightf);
}
void SGX_blend_pinLight(float basePixel, float blendPixel, out float oColor)
{
oColor = Blend1(basePixel, blendPixel, BlendPinLightf);
}
void SGX_blend_hardMix(float4 basePixel, float4 blendPixel, out float4 oColor)
{
oColor = Blend4(basePixel, blendPixel, BlendHardMixf);
}
void SGX_blend_hardMix(float3 basePixel, float3 blendPixel, out float3 oColor)
{
oColor = Blend3(basePixel, blendPixel, BlendHardMixf);
}
void SGX_blend_hardMix(float basePixel, float blendPixel, out float oColor)
{
oColor = Blend1(basePixel, blendPixel, BlendHardMixf);
}
void SGX_blend_reflect(float4 basePixel, float4 blendPixel, out float4 oColor)
{
oColor = Blend4(basePixel, blendPixel, BlendReflectf);
}
void SGX_blend_reflect(float3 basePixel, float3 blendPixel, out float3 oColor)
{
oColor = Blend3(basePixel, blendPixel, BlendReflectf);
}
void SGX_blend_reflect(float basePixel, float blendPixel, out float oColor)
{
oColor = Blend1(basePixel, blendPixel, BlendReflectf);
}
void SGX_blend_glow(float4 basePixel, float4 blendPixel, out float4 oColor)
{
oColor = Blend4(basePixel, blendPixel, BlendReflectf);
}
void SGX_blend_glow(float3 basePixel, float3 blendPixel, out float3 oColor)
{
oColor = Blend3(basePixel, blendPixel, BlendReflectf);
}
void SGX_blend_glow(float basePixel, float blendPixel, out float oColor)
{
oColor = Blend1(basePixel, blendPixel, BlendReflectf);
}
void SGX_blend_phoenix(float4 basePixel, float4 blendPixel, out float4 oColor)
{
oColor = BlendPhoenix(basePixel, blendPixel);
}
void SGX_blend_phoenix(float3 basePixel, float3 blendPixel, out float3 oColor)
{
oColor = BlendPhoenix(basePixel, blendPixel);
}
void SGX_blend_phoenix(float basePixel, float blendPixel, out float oColor)
{
oColor = BlendPhoenix(basePixel, blendPixel);
}
void SGX_blend_saturation(float4 basePixel, float4 blendPixel, out float4 oColor)
{
oColor = BlendSaturation4(basePixel, blendPixel);
}
void SGX_blend_saturation(float3 basePixel, float3 blendPixel, out float3 oColor)
{
oColor = BlendSaturation3(basePixel, blendPixel);
}
void SGX_blend_saturation(float basePixel, float blendPixel, out float oColor)
{
oColor = BlendSaturation1(basePixel, blendPixel);
}
void SGX_blend_color(float4 basePixel, float4 blendPixel, out float4 oColor)
{
oColor = BlendColor4(basePixel, blendPixel);
}
void SGX_blend_color(float3 basePixel, float3 blendPixel, out float3 oColor)
{
oColor = BlendColor3(basePixel, blendPixel);
}
void SGX_blend_color(float basePixel, float blendPixel, out float oColor)
{
oColor = BlendColor1(basePixel, blendPixel);
}
void SGX_blend_luminosity(float4 basePixel, float4 blendPixel, out float4 oColor)
{
oColor = BlendLuminosity4(basePixel, blendPixel);
}
void SGX_blend_luminosity(float3 basePixel, float3 blendPixel, out float3 oColor)
{
oColor = BlendLuminosity3(basePixel, blendPixel);
}
void SGX_blend_luminosity(float basePixel, float blendPixel, out float oColor)
{
oColor = BlendLuminosity1(basePixel, blendPixel);
}
////////////////////////////////////////////////////////////////////////////////////
/// Source modification functions
////////////////////////////////////////////////////////////////////////////////////
void SGX_src_mod_modulate(float4 iColor, float4 controlVal, out float4 oColor)
{
oColor = iColor * controlVal;
}
void SGX_src_mod_modulate(float3 iColor, float3 controlVal, out float3 oColor)
{
oColor = iColor * controlVal;
}
void SGX_src_mod_modulate(float iColor, float controlVal, out float oColor)
{
oColor = iColor * controlVal;
}
void SGX_src_mod_inv_modulate(float4 iColor, float4 controlVal, out float4 oColor)
{
oColor = lerp(iColor, 1, controlVal);
}
void SGX_src_mod_inv_modulate(float3 iColor, float3 controlVal, out float3 oColor)
{
oColor = lerp(iColor, 1, controlVal);
}
void SGX_src_mod_inv_modulate(float iColor, float controlVal, out float oColor)
{
oColor = lerp(iColor, 1, controlVal);
}

825
Bushin/media/RTShaderLib/SGXLib_LayeredBlending.glsl

@ -0,0 +1,825 @@
#version 120
/*
** layered blending & misc math
** Blending modes, RGB/HSL/Contrast/Desaturate, levels control
**
** The shaders below are base on the shaders created by:
** Romain Dura | Romz
** Blog: http://blog.mouaif.org
** Post: http://blog.mouaif.org/?p=94
*/
/*
** Desaturation
*/
vec4 Desaturate(in vec3 color, in float Desaturation)
{
vec3 grayXfer = vec3(0.3, 0.59, 0.11);
vec3 gray = vec3(dot(grayXfer, color));
return vec4(mix(color, gray, Desaturation), 1.0);
}
/*
** Hue, saturation, luminance
*/
vec3 RGBToHSL(in vec3 color)
{
vec3 hsl; // init to 0 to avoid warnings ? (and reverse if + remove first part)
float fmin = min(min(color.r, color.g), color.b); //Min. value of RGB
float fmax = max(max(color.r, color.g), color.b); //Max. value of RGB
float delta = fmax - fmin; //Delta RGB value
hsl.z = (fmax + fmin) / 2.0; // Luminance
if (delta == 0.0) //This is a gray, no chroma...
{
hsl.x = 0.0; // Hue
hsl.y = 0.0; // Saturation
}
else //Chromatic data...
{
if (hsl.z < 0.5)
hsl.y = delta / (fmax + fmin); // Saturation
else
hsl.y = delta / (2.0 - fmax - fmin); // Saturation
float deltaR = (((fmax - color.r) / 6.0) + (delta / 2.0)) / delta;
float deltaG = (((fmax - color.g) / 6.0) + (delta / 2.0)) / delta;
float deltaB = (((fmax - color.b) / 6.0) + (delta / 2.0)) / delta;
if (color.r == fmax )
hsl.x = deltaB - deltaG; // Hue
else if (color.g == fmax)
hsl.x = (1.0 / 3.0) + deltaR - deltaB; // Hue
else if (color.b == fmax)
hsl.x = (2.0 / 3.0) + deltaG - deltaR; // Hue
if (hsl.x < 0.0)
hsl.x += 1.0; // Hue
else if (hsl.x > 1.0)
hsl.x -= 1.0; // Hue
}
return hsl;
}
float HueToRGB(in float f1, in float f2, in float hue)
{
if (hue < 0.0)
hue += 1.0;
else if (hue > 1.0)
hue -= 1.0;
float res;
if ((6.0 * hue) < 1.0)
res = f1 + (f2 - f1) * 6.0 * hue;
else if ((2.0 * hue) < 1.0)
res = f2;
else if ((3.0 * hue) < 2.0)
res = f1 + (f2 - f1) * ((2.0 / 3.0) - hue) * 6.0;
else
res = f1;
return res;
}
vec3 HSLToRGB(in vec3 hsl)
{
vec3 rgb;
if (hsl.y == 0.0)
rgb = vec3(hsl.z); // Luminance
else
{
float f2;
if (hsl.z < 0.5)
f2 = hsl.z * (1.0 + hsl.y);
else
f2 = (hsl.z + hsl.y) - (hsl.y * hsl.z);
float f1 = 2.0 * hsl.z - f2;
rgb.r = HueToRGB(f1, f2, hsl.x + (1.0/3.0));
rgb.g = HueToRGB(f1, f2, hsl.x);
rgb.b = HueToRGB(f1, f2, hsl.x - (1.0/3.0));
}
return rgb;
}
/*
** Contrast, saturation, brightness
** Code of this function is from TGM's shader pack
** http://irrlicht.sourceforge.net/phpBB2/viewtopic.php?t=21057
*/
// For all settings: 1.0 = 100% 0.5=50% 1.5 = 150%
vec3 ContrastSaturationBrightness(in vec3 color, in float brt, in float sat, in float con)
{
// Increase or decrease these values to adjust r, g and b color channels separately
const float AvgLumR = 0.5;
const float AvgLumG = 0.5;
const float AvgLumB = 0.5;
const vec3 LumCoeff = vec3(0.2125, 0.7154, 0.0721);
vec3 AvgLumin = vec3(AvgLumR, AvgLumG, AvgLumB);
vec3 brtColor = color * brt;
vec3 intensity = vec3(dot(brtColor, LumCoeff));
vec3 satColor = mix(intensity, brtColor, sat);
vec3 conColor = mix(AvgLumin, satColor, con);
return conColor;
}
/*
** Float blending modes
** Adapted from here: http://www.nathanm.com/photoshop-blending-math/
** But I modified the HardMix (wrong condition), Overlay, SoftLight, ColorDodge, ColorBurn, VividLight, PinLight (inverted layers) ones to have correct results
*/
#define BlendLinearDodgef BlendAddf
#define BlendLinearBurnf BlendSubtractf
#define BlendAddf(base, blend) min(base + blend, 1.0)
#define BlendSubtractf(base, blend) max(base + blend - 1.0, 0.0)
#define BlendLightenf(base, blend) max(blend, base)
#define BlendDarkenf(base, blend) min(blend, base)
#define BlendScreenf(base, blend) (1.0 - ((1.0 - base) * (1.0 - blend)))
#define BlendOverlayf(base, blend) (base < 0.5 ? (2.0 * base * blend) : (1.0 - 2.0 * (1.0 - base) * (1.0 - blend)))
#define BlendSoftLightf(base, blend) ((blend < 0.5) ? (2.0 * base * blend + base * base * (1.0 - 2.0 * blend)) : (sqrt(base) * (2.0 * blend - 1.0) + 2.0 * base * (1.0 - blend)))
#define BlendColorDodgef(base, blend) ((blend == 1.0) ? blend : min(base / (1.0 - blend), 1.0))
#define BlendColorBurnf(base, blend) ((blend == 0.0) ? blend : max((1.0 - ((1.0 - base) / blend)), 0.0))
#define BlendHardMixf(base, blend) ((BlendVividLightf(base, blend) < 0.5) ? 0.0 : 1.0)
/*
** Vector3 blending modes
*/
// Component wise blending
#define Blend1(base, blend, funcf) funcf(base, blend)
#define Blend3(base, blend, funcf) vec3(funcf(base.r, blend.r), funcf(base.g, blend.g), funcf(base.b, blend.b))
#define Blend4(base, blend, funcf) vec4(funcf(base.r, blend.r), funcf(base.g, blend.g), funcf(base.b, blend.b), funcf(base.a, blend.a))
#define BlendNormal(base, blend) (base)
#define BlendMultiply(base, blend) (base * blend)
#define BlendAverage(base, blend) ((base + blend) / 2.0)
#define BlendAdd(base, blend) min(base + blend, 1.0)
#define BlendSubtract(base, blend) max(base + blend - 1.0, 0.0)
#define BlendDifference(base, blend) abs(base - blend)
#define BlendNegation(base, blend) (1.0 - abs(1.0 - base - blend))
#define BlendExclusion(base, blend) (base + blend - 2.0 * base * blend)
#define BlendPhoenix(base, blend) (min(base, blend) - max(base, blend) + 1.0)
#define BlendOpacity(base, blend, F, O) (F(base, blend) * O + blend * (1.0 - O))
// Hue Blend mode creates the result color by combining the luminance and saturation of the base color with the hue of the blend color.
float BlendHue1(in float base, in float blend)
{
return base;
}
vec3 BlendHue3(in vec3 base, in vec3 blend)
{
vec3 baseHSL = RGBToHSL(base);
return HSLToRGB(vec3(RGBToHSL(blend).r, baseHSL.g, baseHSL.b));
}
vec4 BlendHue4(in vec4 base, in vec4 blend)
{
vec3 hue = BlendHue3(base.xyz, blend.xyz);
return vec4(hue.x, hue.y, hue.z, BlendHue1(base.w, blend.w));
}
// Saturation Blend mode creates the result color by combining the luminance and hue of the base color with the saturation of the blend color.
float BlendSaturation1(in float base, in float blend)
{
return base;
}
vec3 BlendSaturation3(in vec3 base, in vec3 blend)
{
vec3 baseHSL = RGBToHSL(base);
return HSLToRGB(vec3(baseHSL.r, RGBToHSL(blend).g, baseHSL.b));
}
vec4 BlendSaturation4(in vec4 base, in vec4 blend)
{
vec3 hue = BlendSaturation3(base.xyz, blend.xyz);
return vec4(hue.x, hue.y, hue.z, BlendSaturation1(base.w, blend.w));
}
// Color Mode keeps the brightness of the base color and applies both the hue and saturation of the blend color.
float BlendColor1(in float base, in float blend)
{
return base;
}
vec3 BlendColor3(in vec3 base, in vec3 blend)
{
vec3 blendHSL = RGBToHSL(blend);
return HSLToRGB(vec3(blendHSL.r, blendHSL.g, RGBToHSL(base).b));
}
vec4 BlendColor4(in vec4 base, in vec4 blend)
{
vec3 hue = BlendColor3(base.xyz, blend.xyz);
return vec4(hue.x, hue.y, hue.z, BlendColor1(base.w, blend.w));
}
// Luminosity Blend mode creates the result color by combining the hue and saturation of the base color with the luminance of the blend color.
float BlendLuminosity1(in float base, in float blend)
{
return base;
}
vec3 BlendLuminosity3(in vec3 base, in vec3 blend)
{
vec3 baseHSL = RGBToHSL(base);
return HSLToRGB(vec3(baseHSL.r, baseHSL.g, RGBToHSL(blend).b));
}
vec4 BlendLuminosity4(in vec4 base, in vec4 blend)
{
vec3 hue = BlendLuminosity3(base.xyz, blend.xyz);
return vec4(hue.x, hue.y, hue.z, BlendLuminosity1(base.w, blend.w));
}
float BlendLinearLightf(in float s1, in float s2)
{
float oColor;
if (s2 < 0.5)
{
float s2x = (2.0 * s2);
oColor = BlendSubtractf(s1, s2x);
}
else
{
float s2x = (2.0 * (s2 - 0.5));
oColor = BlendAddf(s1, s2x);
}
return oColor;
}
float BlendVividLightf(in float s1, in float s2)
{
float oColor;
if (s2 < 0.5)
{
float s2x = (2.0 * s2);
oColor = BlendColorBurnf(s1, s2x);
}
else
{
float s2x = (2.0 * (s2 - 0.5));
oColor = BlendColorDodgef(s1, s2x);
}
return oColor;
}
float BlendPinLightf(in float s1, in float s2)
{
float oColor;
if (s2 < 0.5)
{
float s2x = (2.0 * s2);
oColor = BlendDarkenf(s1, s2x);
}
else
{
float s2x = (2.0 * (s2 - 0.5));
oColor = BlendLightenf(s1, s2x);
}
return oColor;
}
float BlendReflectf(in float s1, in float s2)
{
float oColor;
if (s2 == 1.0)
{
oColor = s2;
}
else
{
float s1x = (s1 * s1) / (1.0 - s2);
oColor = min(s1x, 1.0);
}
return oColor;
}
//------------------------------------
// Interface for RTShader
//------------------------------------
void SGX_blend_normal(in vec4 basePixel, in vec4 blendPixel, out vec4 oColor)
{
oColor = BlendNormal(basePixel, blendPixel);
}
void SGX_blend_normal(in vec3 basePixel, in vec3 blendPixel, out vec3 oColor)
{
oColor = BlendNormal(basePixel, blendPixel);
}
void SGX_blend_normal(in float basePixel, in float blendPixel, out float oColor)
{
oColor = BlendNormal(basePixel, blendPixel);
}
void SGX_blend_lighten(in vec4 basePixel, in vec4 blendPixel, out vec4 oColor)
{
oColor = BlendLightenf(basePixel, blendPixel);
}
void SGX_blend_lighten(in vec3 basePixel, in vec3 blendPixel, out vec3 oColor)
{
oColor = BlendLightenf(basePixel, blendPixel);
}
void SGX_blend_lighten(in float basePixel, in float blendPixel, out float oColor)
{
oColor = BlendLightenf(basePixel, blendPixel);
}
void SGX_blend_darken(in vec4 basePixel, in vec4 blendPixel, out vec4 oColor)
{
oColor = BlendDarkenf(basePixel, blendPixel);
}
void SGX_blend_darken(in vec3 basePixel, in vec3 blendPixel, out vec3 oColor)
{
oColor = BlendDarkenf(basePixel, blendPixel);
}
void SGX_blend_darken(in float basePixel, in float blendPixel, out float oColor)
{
oColor = BlendDarkenf(basePixel, blendPixel);
}
void SGX_blend_multiply(in vec4 basePixel, in vec4 blendPixel, out vec4 oColor)
{
oColor = BlendMultiply(basePixel, blendPixel);
}
void SGX_blend_multiply(in vec3 basePixel, in vec3 blendPixel, out vec3 oColor)
{
oColor = BlendMultiply(basePixel, blendPixel);
}
void SGX_blend_multiply(in float basePixel, in float blendPixel, out float oColor)
{
oColor = BlendMultiply(basePixel, blendPixel);
}
void SGX_blend_average(in vec4 basePixel, in vec4 blendPixel, out vec4 oColor)
{
oColor = BlendAverage(basePixel, blendPixel);
}
void SGX_blend_average(in vec3 basePixel, in vec3 blendPixel, out vec3 oColor)
{
oColor = BlendAverage(basePixel, blendPixel);
}
void SGX_blend_average(in float basePixel, in float blendPixel, out float oColor)
{
oColor = BlendAverage(basePixel, blendPixel);
}
void SGX_blend_add(in vec4 basePixel, in vec4 blendPixel, out vec4 oColor)
{
oColor = BlendAdd(basePixel, blendPixel);
}
void SGX_blend_add(in vec3 basePixel, in vec3 blendPixel, out vec3 oColor)
{
oColor = BlendAdd(basePixel, blendPixel);
}
void SGX_blend_add(in float basePixel, in float blendPixel, out float oColor)
{
oColor = BlendAdd(basePixel, blendPixel);
}
void SGX_blend_subtract(in vec4 basePixel, in vec4 blendPixel, out vec4 oColor)
{
oColor = BlendSubtract(basePixel, blendPixel);
}
void SGX_blend_subtract(in vec3 basePixel, in vec3 blendPixel, out vec3 oColor)
{
oColor = BlendSubtract(basePixel, blendPixel);
}
void SGX_blend_subtract(in float basePixel, in float blendPixel, out float oColor)
{
oColor = BlendSubtract(basePixel, blendPixel);
}
void SGX_blend_difference(in vec4 basePixel, in vec4 blendPixel, out vec4 oColor)
{
oColor = BlendDifference(basePixel, blendPixel);
}
void SGX_blend_difference(in vec3 basePixel, in vec3 blendPixel, out vec3 oColor)
{
oColor = BlendDifference(basePixel, blendPixel);
}
void SGX_blend_difference(in float basePixel, in float blendPixel, out float oColor)
{
oColor = BlendDifference(basePixel, blendPixel);
}
void SGX_blend_negation(in vec4 basePixel, in vec4 blendPixel, out vec4 oColor)
{
oColor = BlendNegation(basePixel, blendPixel);
}
void SGX_blend_negation(in vec3 basePixel, in vec3 blendPixel, out vec3 oColor)
{
oColor = BlendNegation(basePixel, blendPixel);
}
void SGX_blend_negation(in float basePixel, in float blendPixel, out float oColor)
{
oColor = BlendNegation(basePixel, blendPixel);
}
void SGX_blend_exclusion(in vec4 basePixel, in vec4 blendPixel, out vec4 oColor)
{
oColor = BlendExclusion(basePixel, blendPixel);
}
void SGX_blend_exclusion(in vec3 basePixel, in vec3 blendPixel, out vec3 oColor)
{
oColor = BlendExclusion(basePixel, blendPixel);
}
void SGX_blend_exclusion(in float basePixel, in float blendPixel, out float oColor)
{
oColor = BlendExclusion(basePixel, blendPixel);
}
void SGX_blend_screen(in vec4 s1, in vec4 s2, out vec4 oColor)
{
oColor = vec4(BlendScreenf(s1.r, s2.r),
BlendScreenf(s1.g, s2.g),
BlendScreenf(s1.b, s2.b),
BlendScreenf(s1.a, s2.a));
}
void SGX_blend_screen(in vec3 s1, in vec3 s2, out vec3 oColor)
{
oColor = vec3(BlendScreenf(s1.r, s2.r),
BlendScreenf(s1.g, s2.g),
BlendScreenf(s1.b, s2.b));
}
void SGX_blend_screen(in float s1, in float s2, out float oColor)
{
oColor = BlendScreenf(s1, s2);
}
void SGX_blend_overlay(in vec4 s1, in vec4 s2, out vec4 oColor)
{
oColor = vec4(BlendOverlayf(s1.r, s2.r),
BlendOverlayf(s1.g, s2.g),
BlendOverlayf(s1.b, s2.b),
BlendOverlayf(s1.a, s2.a));
}
void SGX_blend_overlay(in vec3 s1, in vec3 s2, out vec3 oColor)
{
oColor = vec3(BlendOverlayf(s1.r, s2.r),
BlendOverlayf(s1.g, s2.g),
BlendOverlayf(s1.b, s2.b));
}
void SGX_blend_overlay(in float s1, in float s2, out float oColor)
{
oColor = BlendOverlayf(s1, s2);
}
void SGX_blend_softLight(in vec4 s1, in vec4 s2, out vec4 oColor)
{
oColor = vec4(BlendSoftLightf(s1.r, s2.r),
BlendSoftLightf(s1.g, s2.g),
BlendSoftLightf(s1.b, s2.b),
BlendSoftLightf(s1.a, s2.a));
}
void SGX_blend_softLight(in vec3 s1, in vec3 s2, out vec3 oColor)
{
oColor = vec3(BlendSoftLightf(s1.r, s2.r),
BlendSoftLightf(s1.g, s2.g),
BlendSoftLightf(s1.b, s2.b));
}
void SGX_blend_softLight(in float s1, in float s2, out float oColor)
{
oColor = BlendSoftLightf(s1, s2);
}
void SGX_blend_hardLight(in vec4 s1, in vec4 s2, out vec4 oColor)
{
oColor = vec4(BlendOverlayf(s1.r, s2.r),
BlendOverlayf(s1.g, s2.g),
BlendOverlayf(s1.b, s2.b),
BlendOverlayf(s1.a, s2.a));
}
void SGX_blend_hardLight(in vec3 s1, in vec3 s2, out vec3 oColor)
{
oColor = vec3(BlendOverlayf(s1.r, s2.r),
BlendOverlayf(s1.g, s2.g),
BlendOverlayf(s1.b, s2.b));
}
void SGX_blend_hardLight(in float s1, in float s2, out float oColor)
{
oColor = BlendOverlayf(s1, s2);
}
void SGX_blend_colorDodge(in vec4 s1, in vec4 s2, out vec4 oColor)
{
oColor = vec4(BlendColorDodgef(s1.r, s2.r),
BlendColorDodgef(s1.g, s2.g),
BlendColorDodgef(s1.b, s2.b),
BlendColorDodgef(s1.a, s2.a));
}
void SGX_blend_colorDodge(in vec3 s1, in vec3 s2, out vec3 oColor)
{
oColor = vec3(BlendColorDodgef(s1.r, s2.r),
BlendColorDodgef(s1.g, s2.g),
BlendColorDodgef(s1.b, s2.b));
}
void SGX_blend_colorDodge(in float s1, in float s2, out float oColor)
{
oColor = BlendColorDodgef(s1, s2);
}
void SGX_blend_colorBurn(in vec4 s1, in vec4 s2, out vec4 oColor)
{
oColor = vec4(BlendColorBurnf(s1.r, s2.r),
BlendColorBurnf(s1.g, s2.g),
BlendColorBurnf(s1.b, s2.b),
BlendColorBurnf(s1.a, s2.a));
}
void SGX_blend_colorBurn(in vec3 s1, in vec3 s2, out vec3 oColor)
{
oColor = vec3(BlendColorBurnf(s1.r, s2.r),
BlendColorBurnf(s1.g, s2.g),
BlendColorBurnf(s1.b, s2.b));
}
void SGX_blend_colorBurn(in float s1, in float s2, out float oColor)
{
oColor = BlendColorBurnf(s1, s2);
}
void SGX_blend_linearDodge(in vec4 basePixel, in vec4 blendPixel, out vec4 oColor)
{
oColor = BlendAddf(basePixel, blendPixel);
}
void SGX_blend_linearDodge(in vec3 basePixel, in vec3 blendPixel, out vec3 oColor)
{
oColor = BlendAddf(basePixel, blendPixel);
}
void SGX_blend_linearDodge(in float basePixel, in float blendPixel, out float oColor)
{
oColor = BlendAddf(basePixel, blendPixel);
}
void SGX_blend_linearBurn(in vec4 basePixel, in vec4 blendPixel, out vec4 oColor)
{
oColor = BlendSubtractf(basePixel, blendPixel);
}
void SGX_blend_linearBurn(in vec3 basePixel, in vec3 blendPixel, out vec3 oColor)
{
oColor = BlendSubtractf(basePixel, blendPixel);
}
void SGX_blend_linearBurn(in float basePixel, in float blendPixel, out float oColor)
{
oColor = BlendSubtractf(basePixel, blendPixel);
}
void SGX_blend_linearLight(in vec4 s1, in vec4 s2, out vec4 oColor)
{
oColor = vec4(BlendLinearLightf(s1.r, s2.r),
BlendLinearLightf(s1.g, s2.g),
BlendLinearLightf(s1.b, s2.b),
BlendLinearLightf(s1.a, s2.a));
}
void SGX_blend_linearLight(in vec3 s1, in vec3 s2, out vec3 oColor)
{
oColor = vec3(BlendLinearLightf(s1.r, s2.r),
BlendLinearLightf(s1.g, s2.g),
BlendLinearLightf(s1.b, s2.b));
}
void SGX_blend_linearLight(in float s1, in float s2, out float oColor)
{
oColor = BlendLinearLightf(s1, s2);
}
void SGX_blend_vividLight(in vec4 s1, in vec4 s2, out vec4 oColor)
{
oColor = vec4(BlendVividLightf(s1.r, s2.r),
BlendVividLightf(s1.g, s2.g),
BlendVividLightf(s1.b, s2.b),
BlendVividLightf(s1.a, s2.a));
}
void SGX_blend_vividLight(in vec3 s1, in vec3 s2, out vec3 oColor)
{
oColor = vec3(BlendVividLightf(s1.r, s2.r),
BlendVividLightf(s1.g, s2.g),
BlendVividLightf(s1.b, s2.b));
}
void SGX_blend_vividLight(in float s1, in float s2, out float oColor)
{
oColor = BlendVividLightf(s1, s2);
}
void SGX_blend_pinLight(in vec4 s1, in vec4 s2, out vec4 oColor)
{
oColor = vec4(BlendPinLightf(s1.r, s2.r),
BlendPinLightf(s1.g, s2.g),
BlendPinLightf(s1.b, s2.b),
BlendPinLightf(s1.a, s2.a));
}
void SGX_blend_pinLight(in vec3 s1, in vec3 s2, out vec3 oColor)
{
oColor = vec3(BlendPinLightf(s1.r, s2.r),
BlendPinLightf(s1.g, s2.g),
BlendPinLightf(s1.b, s2.b));
}
void SGX_blend_pinLight(in float s1, in float s2, out float oColor)
{
oColor = BlendPinLightf(s1, s2);
}
void SGX_blend_hardMix(in vec4 s1, in vec4 s2, out vec4 oColor)
{
oColor = vec4(BlendHardMixf(s1.r, s2.r),
BlendHardMixf(s1.g, s2.g),
BlendHardMixf(s1.b, s2.b),
BlendHardMixf(s1.a, s2.a));
}
void SGX_blend_hardMix(in vec3 s1, in vec3 s2, out vec3 oColor)
{
oColor = vec3(BlendHardMixf(s1.r, s2.r),
BlendHardMixf(s1.g, s2.g),
BlendHardMixf(s1.b, s2.b));
}
void SGX_blend_hardMix(in float s1, in float s2, out float oColor)
{
oColor = BlendHardMixf(s1, s2);
}
void SGX_blend_reflect(in vec4 s1, in vec4 s2, out vec4 oColor)
{
oColor = vec4(BlendReflectf(s1.r, s2.r),
BlendReflectf(s1.g, s2.g),
BlendReflectf(s1.b, s2.b),
BlendReflectf(s1.a, s2.a));
}
void SGX_blend_reflect(in vec3 s1, in vec3 s2, out vec3 oColor)
{
oColor = vec3(BlendReflectf(s1.r, s2.r),
BlendReflectf(s1.g, s2.g),
BlendReflectf(s1.b, s2.b));
}
void SGX_blend_reflect(in float s1, in float s2, out float oColor)
{
oColor = BlendReflectf(s1, s2);
}
void SGX_blend_glow(in vec4 s1, in vec4 s2, out vec4 oColor)
{
oColor = vec4(BlendReflectf(s1.r, s2.r),
BlendReflectf(s1.g, s2.g),
BlendReflectf(s1.b, s2.b),
BlendReflectf(s1.a, s2.a));
}
void SGX_blend_glow(in vec3 s1, in vec3 s2, out vec3 oColor)
{
oColor = vec3(BlendReflectf(s1.r, s2.r),
BlendReflectf(s1.g, s2.g),
BlendReflectf(s1.b, s2.b));
}
void SGX_blend_glow(in float s1, in float s2, out float oColor)
{
oColor = BlendReflectf(s1, s2);
}
void SGX_blend_phoenix(in vec4 basePixel, in vec4 blendPixel, out vec4 oColor)
{
oColor = BlendPhoenix(basePixel, blendPixel);
}
void SGX_blend_phoenix(in vec3 basePixel, in vec3 blendPixel, out vec3 oColor)
{
oColor = BlendPhoenix(basePixel, blendPixel);
}
void SGX_blend_phoenix(in float basePixel, in float blendPixel, out float oColor)
{
oColor = BlendPhoenix(basePixel, blendPixel);
}
void SGX_blend_saturation(in vec4 basePixel, in vec4 blendPixel, out vec4 oColor)
{
oColor = BlendSaturation4(basePixel, blendPixel);
}
void SGX_blend_saturation(in vec3 basePixel, in vec3 blendPixel, out vec3 oColor)
{
oColor = BlendSaturation3(basePixel, blendPixel);
}
void SGX_blend_saturation(in float basePixel, in float blendPixel, out float oColor)
{
oColor = BlendSaturation1(basePixel, blendPixel);
}
void SGX_blend_color(in vec4 basePixel, in vec4 blendPixel, out vec4 oColor)
{
oColor = BlendColor4(basePixel, blendPixel);
}
void SGX_blend_color(in vec3 basePixel, in vec3 blendPixel, out vec3 oColor)
{
oColor = BlendColor3(basePixel, blendPixel);
}
void SGX_blend_color(in float basePixel, in float blendPixel, out float oColor)
{
oColor = BlendColor1(basePixel, blendPixel);
}
void SGX_blend_luminosity(in vec4 basePixel, in vec4 blendPixel, out vec4 oColor)
{
oColor = BlendLuminosity4(basePixel, blendPixel);
}
void SGX_blend_luminosity(in vec3 basePixel, in vec3 blendPixel, out vec3 oColor)
{
oColor = BlendLuminosity3(basePixel, blendPixel);
}
void SGX_blend_luminosity(in float basePixel, in float blendPixel, out float oColor)
{
oColor = BlendLuminosity1(basePixel, blendPixel);
}
////////////////////////////////////////////////////////////////////////////////////
/// Source modification functions
////////////////////////////////////////////////////////////////////////////////////
void SGX_src_mod_modulate(in vec4 iColor, in vec4 controlVal, out vec4 oColor)
{
oColor = iColor * controlVal;
}
void SGX_src_mod_modulate(in vec3 iColor, in vec3 controlVal, out vec3 oColor)
{
oColor = iColor * controlVal;
}
void SGX_src_mod_modulate(in float iColor, in float controlVal, out float oColor)
{
oColor = iColor * controlVal;
}
void SGX_src_mod_inv_modulate(in vec4 iColor, in vec4 controlVal, out vec4 oColor)
{
oColor = mix(iColor, vec4(1.0,1.0,1.0,1.0), controlVal);
}
void SGX_src_mod_inv_modulate(in vec3 iColor, in vec3 controlVal, out vec3 oColor)
{
oColor = mix(iColor, vec3(1.0,1.0,1.0), controlVal);
}
void SGX_src_mod_inv_modulate(in float iColor, in float controlVal, out float oColor)
{
oColor = mix(iColor, 1, controlVal);
}

887
Bushin/media/RTShaderLib/SGXLib_LayeredBlending.glsles

@ -0,0 +1,887 @@
#version 100
precision highp float;
precision highp int;
precision lowp sampler2D;
precision lowp samplerCube;
/*
** layered blending & misc math
** Blending modes, RGB/HSL/Contrast/Desaturate, levels control
**
** The shaders below are base on the shaders created by:
** Romain Dura | Romz
** Blog: http://blog.mouaif.org
** Post: http://blog.mouaif.org/?p=94
*/
/*
** Desaturation
*/
vec4 Desaturate(in vec3 color, in float Desaturation)
{
vec3 grayXfer = vec3(0.3, 0.59, 0.11);
vec3 gray = vec3(dot(grayXfer, color));
return vec4(mix(color, gray, Desaturation), 1.0);
}
/*
** Hue, saturation, luminance
*/
vec3 _RGBToHSL(in vec3 color)
{
vec3 hsl; // init to 0 to avoid warnings ? (and reverse if + remove first part)
float fmin = min(min(color.r, color.g), color.b); //Min. value of RGB
float fmax = max(max(color.r, color.g), color.b); //Max. value of RGB
float delta = fmax - fmin; //Delta RGB value
hsl.z = (fmax + fmin) / 2.0; // Luminance
if (delta == 0.0) //This is a gray, no chroma...
{
hsl.x = 0.0; // Hue
hsl.y = 0.0; // Saturation
}
else //Chromatic data...
{
if (hsl.z < 0.5)
hsl.y = delta / (fmax + fmin); // Saturation
else
hsl.y = delta / (2.0 - fmax - fmin); // Saturation
float deltaR = (((fmax - color.r) / 6.0) + (delta / 2.0)) / delta;
float deltaG = (((fmax - color.g) / 6.0) + (delta / 2.0)) / delta;
float deltaB = (((fmax - color.b) / 6.0) + (delta / 2.0)) / delta;
if (color.r == fmax )
hsl.x = deltaB - deltaG; // Hue
else if (color.g == fmax)
hsl.x = (1.0 / 3.0) + deltaR - deltaB; // Hue
else if (color.b == fmax)
hsl.x = (2.0 / 3.0) + deltaG - deltaR; // Hue
if (hsl.x < 0.0)
hsl.x += 1.0; // Hue
else if (hsl.x > 1.0)
hsl.x -= 1.0; // Hue
}
return hsl;
}
float _HueToRGB(in float f1, in float f2, in float hue)
{
if (hue < 0.0)
hue += 1.0;
else if (hue > 1.0)
hue -= 1.0;
float res;
if ((6.0 * hue) < 1.0)
res = f1 + (f2 - f1) * 6.0 * hue;
else if ((2.0 * hue) < 1.0)
res = f2;
else if ((3.0 * hue) < 2.0)
res = f1 + (f2 - f1) * ((2.0 / 3.0) - hue) * 6.0;
else
res = f1;
return res;
}
/*
** Contrast, saturation, brightness
** Code of this function is from TGM's shader pack
** http://irrlicht.sourceforge.net/phpBB2/viewtopic.php?t=21057
*/
// For all settings: 1.0 = 100% 0.5=50% 1.5 = 150%
vec3 ContrastSaturationBrightness(in vec3 color, in float brt, in float sat, in float con)
{
// Increase or decrease these values to adjust r, g and b color channels separately
const float AvgLumR = 0.5;
const float AvgLumG = 0.5;
const float AvgLumB = 0.5;
const vec3 LumCoeff = vec3(0.2125, 0.7154, 0.0721);
vec3 AvgLumin = vec3(AvgLumR, AvgLumG, AvgLumB);
vec3 brtColor = color * brt;
vec3 intensity = vec3(dot(brtColor, LumCoeff));
vec3 satColor = mix(intensity, brtColor, sat);
vec3 conColor = mix(AvgLumin, satColor, con);
return conColor;
}
/*
** Float blending modes
** Adapted from here: http://www.nathanm.com/photoshop-blending-math/
** But I modified the HardMix (wrong condition), Overlay, SoftLight, ColorDodge, ColorBurn, VividLight, PinLight (inverted layers) ones to have correct results
*/
#define BlendLinearDodgef BlendAddf
#define BlendLinearBurnf BlendSubtractf
#define BlendAddf(base, blend) min(base + blend, 1.0)
#define BlendSubtractf(base, blend) max(base + blend - 1.0, 0.0)
#define BlendLightenf(base, blend) max(blend, base)
#define BlendDarkenf(base, blend) min(blend, base)
#define BlendScreenf(base, blend) (1.0 - ((1.0 - base) * (1.0 - blend)))
#define BlendOverlayf(base, blend) (base < 0.5 ? (2.0 * base * blend) : (1.0 - 2.0 * (1.0 - base) * (1.0 - blend)))
#define BlendSoftLightf(base, blend) ((blend < 0.5) ? (2.0 * base * blend + base * base * (1.0 - 2.0 * blend)) : (sqrt(base) * (2.0 * blend - 1.0) + 2.0 * base * (1.0 - blend)))
#define BlendColorDodgef(base, blend) ((blend == 1.0) ? blend : min(base / (1.0 - blend), 1.0))
#define BlendColorBurnf(base, blend) ((blend == 0.0) ? blend : max((1.0 - ((1.0 - base) / blend)), 0.0))
#define BlendHardMixf(base, blend) ((BlendVividLightf(base, blend) < 0.5) ? 0.0 : 1.0)
/*
** Vector3 blending modes
*/
// Component wise blending
#define Blend1(base, blend, funcf) funcf(base, blend)
#define Blend3(base, blend, funcf) vec3(funcf(base.r, blend.r), funcf(base.g, blend.g), funcf(base.b, blend.b))
#define Blend4(base, blend, funcf) vec4(funcf(base.r, blend.r), funcf(base.g, blend.g), funcf(base.b, blend.b), funcf(base.a, blend.a))
#define BlendNormal(base, blend) (base)
#define BlendMultiply(base, blend) (base * blend)
#define BlendAverage(base, blend) ((base + blend) / 2.0)
#define BlendAdd(base, blend) min(base + blend, 1.0)
#define BlendSubtract(base, blend) max(base + blend - 1.0, 0.0)
#define BlendDifference(base, blend) abs(base - blend)
#define BlendNegation(base, blend) (1.0 - abs(1.0 - base - blend))
#define BlendExclusion(base, blend) (base + blend - 2.0 * base * blend)
#define BlendPhoenix(base, blend) (min(base, blend) - max(base, blend) + 1.0)
#define BlendOpacity(base, blend, F, O) (F(base, blend) * O + blend * (1.0 - O))
// Hue Blend mode creates the result color by combining the luminance and saturation of the base color with the hue of the blend color.
float BlendHue1(in float base, in float blend)
{
return base;
}
vec3 BlendHue3(in vec3 base, in vec3 blend)
{
vec3 baseHSL = _RGBToHSL(base);
vec3 rgb, inHSL = vec3(_RGBToHSL(blend).r, baseHSL.g, baseHSL.b);
// The HSLToRGB function has been inlined to here
if (inHSL.y == 0.0)
rgb = vec3(inHSL.z); // Luminance
else
{
float f2;
if (inHSL.z < 0.5)
f2 = inHSL.z * (1.0 + inHSL.y);
else
f2 = (inHSL.z + inHSL.y) - (inHSL.y * inHSL.z);
float f1 = 2.0 * inHSL.z - f2;
rgb.r = _HueToRGB(f1, f2, inHSL.x + (1.0/3.0));
rgb.g = _HueToRGB(f1, f2, inHSL.x);
rgb.b = _HueToRGB(f1, f2, inHSL.x - (1.0/3.0));
}
return rgb;
}
vec4 BlendHue4(in vec4 base, in vec4 blend)
{
vec3 hue = BlendHue3(base.xyz, blend.xyz);
return vec4(hue.x, hue.y, hue.z, BlendHue1(base.w, blend.w));
}
// Saturation Blend mode creates the result color by combining the luminance and hue of the base color with the saturation of the blend color.
float BlendSaturation1(in float base, in float blend)
{
return base;
}
vec3 BlendSaturation3(in vec3 base, in vec3 blend)
{
vec3 baseHSL = _RGBToHSL(base);
vec3 rgb, inHSL = vec3(baseHSL.r, _RGBToHSL(blend).g, baseHSL.b);
// The HSLToRGB function has been inlined to here
if (inHSL.y == 0.0)
rgb = vec3(inHSL.z); // Luminance
else
{
float f2;
if (inHSL.z < 0.5)
f2 = inHSL.z * (1.0 + inHSL.y);
else
f2 = (inHSL.z + inHSL.y) - (inHSL.y * inHSL.z);
float f1 = 2.0 * inHSL.z - f2;
rgb.r = _HueToRGB(f1, f2, inHSL.x + (1.0/3.0));
rgb.g = _HueToRGB(f1, f2, inHSL.x);
rgb.b = _HueToRGB(f1, f2, inHSL.x - (1.0/3.0));
}
return rgb;
}
vec4 BlendSaturation4(in vec4 base, in vec4 blend)
{
vec3 hue = BlendSaturation3(base.xyz, blend.xyz);
return vec4(hue.x, hue.y, hue.z, BlendSaturation1(base.w, blend.w));
}
// Color Mode keeps the brightness of the base color and applies both the hue and saturation of the blend color.
float BlendColor1(in float base, in float blend)
{
return base;
}
vec3 BlendColor3(in vec3 base, in vec3 blend)
{
vec3 blendHSL = _RGBToHSL(blend);
vec3 rgb, inHSL = vec3(blendHSL.r, blendHSL.g, _RGBToHSL(base).b);
// The HSLToRGB function has been inlined to here
if (inHSL.y == 0.0)
rgb = vec3(inHSL.z); // Luminance
else
{
float f2;
if (inHSL.z < 0.5)
f2 = inHSL.z * (1.0 + inHSL.y);
else
f2 = (inHSL.z + inHSL.y) - (inHSL.y * inHSL.z);
float f1 = 2.0 * inHSL.z - f2;
rgb.r = _HueToRGB(f1, f2, inHSL.x + (1.0/3.0));
rgb.g = _HueToRGB(f1, f2, inHSL.x);
rgb.b = _HueToRGB(f1, f2, inHSL.x - (1.0/3.0));
}
return rgb;
}
vec4 BlendColor4(in vec4 base, in vec4 blend)
{
vec3 hue = BlendColor3(base.xyz, blend.xyz);
return vec4(hue.x, hue.y, hue.z, BlendColor1(base.w, blend.w));
}
// Luminosity Blend mode creates the result color by combining the hue and saturation of the base color with the luminance of the blend color.
float BlendLuminosity1(in float base, in float blend)
{
return base;
}
vec3 BlendLuminosity3(in vec3 base, in vec3 blend)
{
vec3 baseHSL = _RGBToHSL(base);
vec3 rgb, inHSL = vec3(baseHSL.r, baseHSL.g, _RGBToHSL(blend).b);
// The HSLToRGB function has been inlined to here
if (inHSL.y == 0.0)
rgb = vec3(inHSL.z); // Luminance
else
{
float f2;
if (inHSL.z < 0.5)
f2 = inHSL.z * (1.0 + inHSL.y);
else
f2 = (inHSL.z + inHSL.y) - (inHSL.y * inHSL.z);
float f1 = 2.0 * inHSL.z - f2;
rgb.r = _HueToRGB(f1, f2, inHSL.x + (1.0/3.0));
rgb.g = _HueToRGB(f1, f2, inHSL.x);
rgb.b = _HueToRGB(f1, f2, inHSL.x - (1.0/3.0));
}
return rgb;
}
vec4 BlendLuminosity4(in vec4 base, in vec4 blend)
{
vec3 hue = BlendLuminosity3(base.xyz, blend.xyz);
return vec4(hue.x, hue.y, hue.z, BlendLuminosity1(base.w, blend.w));
}
float BlendLinearLightf(in float s1, in float s2)
{
float oColor;
if (s2 < 0.5)
{
float s2x = (2.0 * s2);
oColor = BlendSubtractf(s1, s2x);
}
else
{
float s2x = (2.0 * (s2 - 0.5));
oColor = BlendAddf(s1, s2x);
}
return oColor;
}
float BlendVividLightf(in float s1, in float s2)
{
float oColor;
if (s2 < 0.5)
{
float s2x = (2.0 * s2);
oColor = BlendColorBurnf(s1, s2x);
}
else
{
float s2x = (2.0 * (s2 - 0.5));
oColor = BlendColorDodgef(s1, s2x);
}
return oColor;
}
float BlendPinLightf(in float s1, in float s2)
{
float oColor;
if (s2 < 0.5)
{
float s2x = (2.0 * s2);
oColor = BlendDarkenf(s1, s2x);
}
else
{
float s2x = (2.0 * (s2 - 0.5));
oColor = BlendLightenf(s1, s2x);
}
return oColor;
}
float BlendReflectf(in float s1, in float s2)
{
float oColor;
if (s2 == 1.0)
{
oColor = s2;
}
else
{
float s1x = (s1 * s1) / (1.0 - s2);
oColor = min(s1x, 1.0);
}
return oColor;
}
//------------------------------------
// Interface for RTShader
//------------------------------------
void SGX_blend_normal(in vec4 basePixel, in vec4 blendPixel, out vec4 oColor)
{
oColor = BlendNormal(basePixel, blendPixel);
}
void SGX_blend_normal(in vec3 basePixel, in vec3 blendPixel, out vec3 oColor)
{
oColor = BlendNormal(basePixel, blendPixel);
}
void SGX_blend_normal(in float basePixel, in float blendPixel, out float oColor)
{
oColor = BlendNormal(basePixel, blendPixel);
}
void SGX_blend_lighten(in vec4 basePixel, in vec4 blendPixel, out vec4 oColor)
{
oColor = BlendLightenf(basePixel, blendPixel);
}
void SGX_blend_lighten(in vec3 basePixel, in vec3 blendPixel, out vec3 oColor)
{
oColor = BlendLightenf(basePixel, blendPixel);
}
void SGX_blend_lighten(in float basePixel, in float blendPixel, out float oColor)
{
oColor = BlendLightenf(basePixel, blendPixel);
}
void SGX_blend_darken(in vec4 basePixel, in vec4 blendPixel, out vec4 oColor)
{
oColor = BlendDarkenf(basePixel, blendPixel);
}
void SGX_blend_darken(in vec3 basePixel, in vec3 blendPixel, out vec3 oColor)
{
oColor = BlendDarkenf(basePixel, blendPixel);
}
void SGX_blend_darken(in float basePixel, in float blendPixel, out float oColor)
{
oColor = BlendDarkenf(basePixel, blendPixel);
}
void SGX_blend_multiply(in vec4 basePixel, in vec4 blendPixel, out vec4 oColor)
{
oColor = BlendMultiply(basePixel, blendPixel);
}
void SGX_blend_multiply(in vec3 basePixel, in vec3 blendPixel, out vec3 oColor)
{
oColor = BlendMultiply(basePixel, blendPixel);
}
void SGX_blend_multiply(in float basePixel, in float blendPixel, out float oColor)
{
oColor = BlendMultiply(basePixel, blendPixel);
}
void SGX_blend_average(in vec4 basePixel, in vec4 blendPixel, out vec4 oColor)
{
oColor = BlendAverage(basePixel, blendPixel);
}
void SGX_blend_average(in vec3 basePixel, in vec3 blendPixel, out vec3 oColor)
{
oColor = BlendAverage(basePixel, blendPixel);
}
void SGX_blend_average(in float basePixel, in float blendPixel, out float oColor)
{
oColor = BlendAverage(basePixel, blendPixel);
}
void SGX_blend_add(in vec4 basePixel, in vec4 blendPixel, out vec4 oColor)
{
oColor = BlendAdd(basePixel, blendPixel);
}
void SGX_blend_add(in vec3 basePixel, in vec3 blendPixel, out vec3 oColor)
{
oColor = BlendAdd(basePixel, blendPixel);
}
void SGX_blend_add(in float basePixel, in float blendPixel, out float oColor)
{
oColor = BlendAdd(basePixel, blendPixel);
}
void SGX_blend_subtract(in vec4 basePixel, in vec4 blendPixel, out vec4 oColor)
{
oColor = BlendSubtract(basePixel, blendPixel);
}
void SGX_blend_subtract(in vec3 basePixel, in vec3 blendPixel, out vec3 oColor)
{
oColor = BlendSubtract(basePixel, blendPixel);
}
void SGX_blend_subtract(in float basePixel, in float blendPixel, out float oColor)
{
oColor = BlendSubtract(basePixel, blendPixel);
}
void SGX_blend_difference(in vec4 basePixel, in vec4 blendPixel, out vec4 oColor)
{
oColor = BlendDifference(basePixel, blendPixel);
}
void SGX_blend_difference(in vec3 basePixel, in vec3 blendPixel, out vec3 oColor)
{
oColor = BlendDifference(basePixel, blendPixel);
}
void SGX_blend_difference(in float basePixel, in float blendPixel, out float oColor)
{
oColor = BlendDifference(basePixel, blendPixel);
}
void SGX_blend_negation(in vec4 basePixel, in vec4 blendPixel, out vec4 oColor)
{
oColor = BlendNegation(basePixel, blendPixel);
}
void SGX_blend_negation(in vec3 basePixel, in vec3 blendPixel, out vec3 oColor)
{
oColor = BlendNegation(basePixel, blendPixel);
}
void SGX_blend_negation(in float basePixel, in float blendPixel, out float oColor)
{
oColor = BlendNegation(basePixel, blendPixel);
}
void SGX_blend_exclusion(in vec4 basePixel, in vec4 blendPixel, out vec4 oColor)
{
oColor = BlendExclusion(basePixel, blendPixel);
}
void SGX_blend_exclusion(in vec3 basePixel, in vec3 blendPixel, out vec3 oColor)
{
oColor = BlendExclusion(basePixel, blendPixel);
}
void SGX_blend_exclusion(in float basePixel, in float blendPixel, out float oColor)
{
oColor = BlendExclusion(basePixel, blendPixel);
}
void SGX_blend_screen(in vec4 s1, in vec4 s2, out vec4 oColor)
{
oColor = vec4(BlendScreenf(s1.r, s2.r),
BlendScreenf(s1.g, s2.g),
BlendScreenf(s1.b, s2.b),
BlendScreenf(s1.a, s2.a));
}
void SGX_blend_screen(in vec3 s1, in vec3 s2, out vec3 oColor)
{
oColor = vec3(BlendScreenf(s1.r, s2.r),
BlendScreenf(s1.g, s2.g),
BlendScreenf(s1.b, s2.b));
}
void SGX_blend_screen(in float s1, in float s2, out float oColor)
{
oColor = BlendScreenf(s1, s2);
}
void SGX_blend_overlay(in vec4 s1, in vec4 s2, out vec4 oColor)
{
oColor = vec4(BlendOverlayf(s1.r, s2.r),
BlendOverlayf(s1.g, s2.g),
BlendOverlayf(s1.b, s2.b),
BlendOverlayf(s1.a, s2.a));
}
void SGX_blend_overlay(in vec3 s1, in vec3 s2, out vec3 oColor)
{
oColor = vec3(BlendOverlayf(s1.r, s2.r),
BlendOverlayf(s1.g, s2.g),
BlendOverlayf(s1.b, s2.b));
}
void SGX_blend_overlay(in float s1, in float s2, out float oColor)
{
oColor = BlendOverlayf(s1, s2);
}
void SGX_blend_softLight(in vec4 s1, in vec4 s2, out vec4 oColor)
{
oColor = vec4(BlendSoftLightf(s1.r, s2.r),
BlendSoftLightf(s1.g, s2.g),
BlendSoftLightf(s1.b, s2.b),
BlendSoftLightf(s1.a, s2.a));
}
void SGX_blend_softLight(in vec3 s1, in vec3 s2, out vec3 oColor)
{
oColor = vec3(BlendSoftLightf(s1.r, s2.r),
BlendSoftLightf(s1.g, s2.g),
BlendSoftLightf(s1.b, s2.b));
}
void SGX_blend_softLight(in float s1, in float s2, out float oColor)
{
oColor = BlendSoftLightf(s1, s2);
}
void SGX_blend_hardLight(in vec4 s1, in vec4 s2, out vec4 oColor)
{
oColor = vec4(BlendOverlayf(s1.r, s2.r),
BlendOverlayf(s1.g, s2.g),
BlendOverlayf(s1.b, s2.b),
BlendOverlayf(s1.a, s2.a));
}
void SGX_blend_hardLight(in vec3 s1, in vec3 s2, out vec3 oColor)
{
oColor = vec3(BlendOverlayf(s1.r, s2.r),
BlendOverlayf(s1.g, s2.g),
BlendOverlayf(s1.b, s2.b));
}
void SGX_blend_hardLight(in float s1, in float s2, out float oColor)
{
oColor = BlendOverlayf(s1, s2);
}
void SGX_blend_colorDodge(in vec4 s1, in vec4 s2, out vec4 oColor)
{
oColor = vec4(BlendColorDodgef(s1.r, s2.r),
BlendColorDodgef(s1.g, s2.g),
BlendColorDodgef(s1.b, s2.b),
BlendColorDodgef(s1.a, s2.a));
}
void SGX_blend_colorDodge(in vec3 s1, in vec3 s2, out vec3 oColor)
{
oColor = vec3(BlendColorDodgef(s1.r, s2.r),
BlendColorDodgef(s1.g, s2.g),
BlendColorDodgef(s1.b, s2.b));
}
void SGX_blend_colorDodge(in float s1, in float s2, out float oColor)
{
oColor = BlendColorDodgef(s1, s2);
}
void SGX_blend_colorBurn(in vec4 s1, in vec4 s2, out vec4 oColor)
{
oColor = vec4(BlendColorBurnf(s1.r, s2.r),
BlendColorBurnf(s1.g, s2.g),
BlendColorBurnf(s1.b, s2.b),
BlendColorBurnf(s1.a, s2.a));
}
void SGX_blend_colorBurn(in vec3 s1, in vec3 s2, out vec3 oColor)
{
oColor = vec3(BlendColorBurnf(s1.r, s2.r),
BlendColorBurnf(s1.g, s2.g),
BlendColorBurnf(s1.b, s2.b));
}
void SGX_blend_colorBurn(in float s1, in float s2, out float oColor)
{
oColor = BlendColorBurnf(s1, s2);
}
void SGX_blend_linearDodge(in vec4 basePixel, in vec4 blendPixel, out vec4 oColor)
{
oColor = BlendAddf(basePixel, blendPixel);
}
void SGX_blend_linearDodge(in vec3 basePixel, in vec3 blendPixel, out vec3 oColor)
{
oColor = BlendAddf(basePixel, blendPixel);
}
void SGX_blend_linearDodge(in float basePixel, in float blendPixel, out float oColor)
{
oColor = BlendAddf(basePixel, blendPixel);
}
void SGX_blend_linearBurn(in vec4 basePixel, in vec4 blendPixel, out vec4 oColor)
{
oColor = BlendSubtractf(basePixel, blendPixel);
}
void SGX_blend_linearBurn(in vec3 basePixel, in vec3 blendPixel, out vec3 oColor)
{
oColor = BlendSubtractf(basePixel, blendPixel);
}
void SGX_blend_linearBurn(in float basePixel, in float blendPixel, out float oColor)
{
oColor = BlendSubtractf(basePixel, blendPixel);
}
void SGX_blend_linearLight(in vec4 s1, in vec4 s2, out vec4 oColor)
{
oColor = vec4(BlendLinearLightf(s1.r, s2.r),
BlendLinearLightf(s1.g, s2.g),
BlendLinearLightf(s1.b, s2.b),
BlendLinearLightf(s1.a, s2.a));
}
void SGX_blend_linearLight(in vec3 s1, in vec3 s2, out vec3 oColor)
{
oColor = vec3(BlendLinearLightf(s1.r, s2.r),
BlendLinearLightf(s1.g, s2.g),
BlendLinearLightf(s1.b, s2.b));
}
void SGX_blend_linearLight(in float s1, in float s2, out float oColor)
{
oColor = BlendLinearLightf(s1, s2);
}
void SGX_blend_vividLight(in vec4 s1, in vec4 s2, out vec4 oColor)
{
oColor = vec4(BlendVividLightf(s1.r, s2.r),
BlendVividLightf(s1.g, s2.g),
BlendVividLightf(s1.b, s2.b),
BlendVividLightf(s1.a, s2.a));
}
void SGX_blend_vividLight(in vec3 s1, in vec3 s2, out vec3 oColor)
{
oColor = vec3(BlendVividLightf(s1.r, s2.r),
BlendVividLightf(s1.g, s2.g),
BlendVividLightf(s1.b, s2.b));
}
void SGX_blend_vividLight(in float s1, in float s2, out float oColor)
{
oColor = BlendVividLightf(s1, s2);
}
void SGX_blend_pinLight(in vec4 s1, in vec4 s2, out vec4 oColor)
{
oColor = vec4(BlendPinLightf(s1.r, s2.r),
BlendPinLightf(s1.g, s2.g),
BlendPinLightf(s1.b, s2.b),
BlendPinLightf(s1.a, s2.a));
}
void SGX_blend_pinLight(in vec3 s1, in vec3 s2, out vec3 oColor)
{
oColor = vec3(BlendPinLightf(s1.r, s2.r),
BlendPinLightf(s1.g, s2.g),
BlendPinLightf(s1.b, s2.b));
}
void SGX_blend_pinLight(in float s1, in float s2, out float oColor)
{
oColor = BlendPinLightf(s1, s2);
}
void SGX_blend_hardMix(in vec4 s1, in vec4 s2, out vec4 oColor)
{
oColor = vec4(BlendHardMixf(s1.r, s2.r),
BlendHardMixf(s1.g, s2.g),
BlendHardMixf(s1.b, s2.b),
BlendHardMixf(s1.a, s2.a));
}
void SGX_blend_hardMix(in vec3 s1, in vec3 s2, out vec3 oColor)
{
oColor = vec3(BlendHardMixf(s1.r, s2.r),
BlendHardMixf(s1.g, s2.g),
BlendHardMixf(s1.b, s2.b));
}
void SGX_blend_hardMix(in float s1, in float s2, out float oColor)
{
oColor = BlendHardMixf(s1, s2);
}
void SGX_blend_reflect(in vec4 s1, in vec4 s2, out vec4 oColor)
{
oColor = vec4(BlendReflectf(s1.r, s2.r),
BlendReflectf(s1.g, s2.g),
BlendReflectf(s1.b, s2.b),
BlendReflectf(s1.a, s2.a));
}
void SGX_blend_reflect(in vec3 s1, in vec3 s2, out vec3 oColor)
{
oColor = vec3(BlendReflectf(s1.r, s2.r),
BlendReflectf(s1.g, s2.g),
BlendReflectf(s1.b, s2.b));
}
void SGX_blend_reflect(in float s1, in float s2, out float oColor)
{
oColor = BlendReflectf(s1, s2);
}
void SGX_blend_glow(in vec4 s1, in vec4 s2, out vec4 oColor)
{
oColor = vec4(BlendReflectf(s1.r, s2.r),
BlendReflectf(s1.g, s2.g),
BlendReflectf(s1.b, s2.b),
BlendReflectf(s1.a, s2.a));
}
void SGX_blend_glow(in vec3 s1, in vec3 s2, out vec3 oColor)
{
oColor = vec3(BlendReflectf(s1.r, s2.r),
BlendReflectf(s1.g, s2.g),
BlendReflectf(s1.b, s2.b));
}
void SGX_blend_glow(in float s1, in float s2, out float oColor)
{
oColor = BlendReflectf(s1, s2);
}
void SGX_blend_phoenix(in vec4 basePixel, in vec4 blendPixel, out vec4 oColor)
{
oColor = BlendPhoenix(basePixel, blendPixel);
}
void SGX_blend_phoenix(in vec3 basePixel, in vec3 blendPixel, out vec3 oColor)
{
oColor = BlendPhoenix(basePixel, blendPixel);
}
void SGX_blend_phoenix(in float basePixel, in float blendPixel, out float oColor)
{
oColor = BlendPhoenix(basePixel, blendPixel);
}
void SGX_blend_saturation(in vec4 basePixel, in vec4 blendPixel, out vec4 oColor)
{
oColor = BlendSaturation4(basePixel, blendPixel);
}
void SGX_blend_saturation(in vec3 basePixel, in vec3 blendPixel, out vec3 oColor)
{
oColor = BlendSaturation3(basePixel, blendPixel);
}
void SGX_blend_saturation(in float basePixel, in float blendPixel, out float oColor)
{
oColor = BlendSaturation1(basePixel, blendPixel);
}
void SGX_blend_color(in vec4 basePixel, in vec4 blendPixel, out vec4 oColor)
{
oColor = BlendColor4(basePixel, blendPixel);
}
void SGX_blend_color(in vec3 basePixel, in vec3 blendPixel, out vec3 oColor)
{
oColor = BlendColor3(basePixel, blendPixel);
}
void SGX_blend_color(in float basePixel, in float blendPixel, out float oColor)
{
oColor = BlendColor1(basePixel, blendPixel);
}
void SGX_blend_luminosity(in vec4 basePixel, in vec4 blendPixel, out vec4 oColor)
{
oColor = BlendLuminosity4(basePixel, blendPixel);
}
void SGX_blend_luminosity(in vec3 basePixel, in vec3 blendPixel, out vec3 oColor)
{
oColor = BlendLuminosity3(basePixel, blendPixel);
}
void SGX_blend_luminosity(in float basePixel, in float blendPixel, out float oColor)
{
oColor = BlendLuminosity1(basePixel, blendPixel);
}
////////////////////////////////////////////////////////////////////////////////////
/// Source modification functions
////////////////////////////////////////////////////////////////////////////////////
void SGX_src_mod_modulate(in vec4 iColor, in vec4 controlVal, out vec4 oColor)
{
oColor = iColor * controlVal;
}
void SGX_src_mod_modulate(in vec3 iColor, in vec3 controlVal, out vec3 oColor)
{
oColor = iColor * controlVal;
}
void SGX_src_mod_modulate(in float iColor, in float controlVal, out float oColor)
{
oColor = iColor * controlVal;
}
void SGX_src_mod_inv_modulate(in vec4 iColor, in vec4 controlVal, out vec4 oColor)
{
oColor = mix(iColor, vec4(1.0), controlVal);
}
void SGX_src_mod_inv_modulate(in vec3 iColor, in vec3 controlVal, out vec3 oColor)
{
oColor = mix(iColor, vec3(1.0), controlVal);
}
void SGX_src_mod_inv_modulate(in float iColor, in float controlVal, out float oColor)
{
oColor = mix(iColor, 1.0, controlVal);
}

730
Bushin/media/RTShaderLib/SGXLib_LayeredBlending.hlsl

@ -0,0 +1,730 @@
/*
** layered blending & misc math
** Blending modes, RGB/HSL/Contrast/Desaturate
**
** The shaders below are base on the shaders created by:
** Romain Dura | Romz
** Blog: http://blog.mouaif.org
** Post: http://blog.mouaif.org/?p=94
*/
/*
** Desaturation
*/
float4 Desaturate(float3 color, float Desaturation)
{
float3 grayXfer = float3(0.3, 0.59, 0.11);
float grayf = dot(grayXfer, color);
float3 gray = float3(grayf, grayf, grayf);
return float4(lerp(color, gray, Desaturation), 1.0);
}
/*
** Hue, saturation, luminance
*/
float3 RGBToHSL(float3 color)
{
float3 hsl; // init to 0 to avoid warnings ? (and reverse if + remove first part)
float fmin = min(min(color.r, color.g), color.b); //Min. value of RGB
float fmax = max(max(color.r, color.g), color.b); //Max. value of RGB
float delta = fmax - fmin; //Delta RGB value
hsl.z = (fmax + fmin) / 2.0; // Luminance
if (delta == 0.0) //This is a gray, no chroma...
{
hsl.x = 0.0; // Hue
hsl.y = 0.0; // Saturation
}
else //Chromatic data...
{
if (hsl.z < 0.5)
hsl.y = delta / (fmax + fmin); // Saturation
else
hsl.y = delta / (2.0 - fmax - fmin); // Saturation
float deltaR = (((fmax - color.r) / 6.0) + (delta / 2.0)) / delta;
float deltaG = (((fmax - color.g) / 6.0) + (delta / 2.0)) / delta;
float deltaB = (((fmax - color.b) / 6.0) + (delta / 2.0)) / delta;
if (color.r == fmax )
hsl.x = deltaB - deltaG; // Hue
else if (color.g == fmax)
hsl.x = (1.0 / 3.0) + deltaR - deltaB; // Hue
else if (color.b == fmax)
hsl.x = (2.0 / 3.0) + deltaG - deltaR; // Hue
if (hsl.x < 0.0)
hsl.x += 1.0; // Hue
else if (hsl.x > 1.0)
hsl.x -= 1.0; // Hue
}
return hsl;
}
float HueToRGB(float f1, float f2, float hue)
{
if (hue < 0.0)
hue += 1.0;
else if (hue > 1.0)
hue -= 1.0;
float res;
if ((6.0 * hue) < 1.0)
res = f1 + (f2 - f1) * 6.0 * hue;
else if ((2.0 * hue) < 1.0)
res = f2;
else if ((3.0 * hue) < 2.0)
res = f1 + (f2 - f1) * ((2.0 / 3.0) - hue) * 6.0;
else
res = f1;
return res;
}
float3 HSLToRGB(float3 hsl)
{
float3 rgb;
if (hsl.y == 0.0)
rgb = float3(hsl.z, hsl.z, hsl.z); // Luminance
else
{
float f2;
if (hsl.z < 0.5)
f2 = hsl.z * (1.0 + hsl.y);
else
f2 = (hsl.z + hsl.y) - (hsl.y * hsl.z);
float f1 = 2.0 * hsl.z - f2;
rgb.r = HueToRGB(f1, f2, hsl.x + (1.0/3.0));
rgb.g = HueToRGB(f1, f2, hsl.x);
rgb.b= HueToRGB(f1, f2, hsl.x - (1.0/3.0));
}
return rgb;
}
/*
** Contrast, saturation, brightness
** Code of this function is from TGM's shader pack
** http://irrlicht.sourceforge.net/phpBB2/viewtopic.php?t=21057
*/
// For all settings: 1.0 = 100% 0.5=50% 1.5 = 150%
float3 ContrastSaturationBrightness(float3 color, float brt, float sat, float con)
{
// Increase or decrease these values to adjust r, g and b color channels separately
const float AvgLumR = 0.5;
const float AvgLumG = 0.5;
const float AvgLumB = 0.5;
const float3 LumCoeff = float3(0.2125, 0.7154, 0.0721);
float3 AvgLumin = float3(AvgLumR, AvgLumG, AvgLumB);
float3 brtColor = color * brt;
float intensityf = dot(brtColor, LumCoeff);
float3 intensity = float3(intensityf, intensityf, intensityf);
float3 satColor = lerp(intensity, brtColor, sat);
float3 conColor = lerp(AvgLumin, satColor, con);
return conColor;
}
/*
** Float blending modes
** Adapted from here: http://www.nathanm.com/photoshop-blending-math/
** But I modified the HardMix (wrong condition), Overlay, SoftLight, ColorDodge, ColorBurn, VividLight, PinLight (inverted layers) ones to have correct results
*/
#define BlendLinearDodgef BlendAddf
#define BlendLinearBurnf BlendSubtractf
#define BlendAddf(base, blend) min(base + blend, 1.0)
#define BlendSubtractf(base, blend) max(base + blend - 1.0, 0.0)
#define BlendLightenf(base, blend) max(blend, base)
#define BlendDarkenf(base, blend) min(blend, base)
#define BlendLinearLightf(base, blend) (blend < 0.5 ? BlendLinearBurnf(base, (2.0 * blend)) : BlendLinearDodgef(base, (2.0 * (blend - 0.5))))
#define BlendScreenf(base, blend) (1.0 - ((1.0 - base) * (1.0 - blend)))
#define BlendOverlayf(base, blend) (base < 0.5 ? (2.0 * base * blend) : (1.0 - 2.0 * (1.0 - base) * (1.0 - blend)))
#define BlendSoftLightf(base, blend) ((blend < 0.5) ? (2.0 * base * blend + base * base * (1.0 - 2.0 * blend)) : (sqrt(base) * (2.0 * blend - 1.0) + 2.0 * base * (1.0 - blend)))
#define BlendColorDodgef(base, blend) ((blend == 1.0) ? blend : min(base / (1.0 - blend), 1.0))
#define BlendColorBurnf(base, blend) ((blend == 0.0) ? blend : max((1.0 - ((1.0 - base) / blend)), 0.0))
#define BlendVividLightf(base, blend) ((blend < 0.5) ? BlendColorBurnf(base, (2.0 * blend)) : BlendColorDodgef(base, (2.0 * (blend - 0.5))))
#define BlendPinLightf(base, blend) ((blend < 0.5) ? BlendDarkenf(base, (2.0 * blend)) : BlendLightenf(base, (2.0 *(blend - 0.5))))
#define BlendHardMixf(base, blend) ((BlendVividLightf(base, blend) < 0.5) ? 0.0 : 1.0)
#define BlendReflectf(base, blend) ((blend == 1.0) ? blend : min(base * base / (1.0 - blend), 1.0))
/*
** Vector3 blending modes
*/
// Component wise blending
#define Blend1(base, blend, funcf) funcf(base, blend)
#define Blend3(base, blend, funcf) float3(funcf(base.r, blend.r), funcf(base.g, blend.g), funcf(base.b, blend.b))
#define Blend4(base, blend, funcf) float4(funcf(base.r, blend.r), funcf(base.g, blend.g), funcf(base.b, blend.b), funcf(base.a, blend.a))
#define BlendNormal(base, blend) (base)
#define BlendLighten BlendLightenf
#define BlendDarken BlendDarkenf
#define BlendMultiply(base, blend) (base * blend)
#define BlendAverage(base, blend) ((base + blend) / 2.0)
#define BlendAdd(base, blend) min(base + blend, 1.0)
#define BlendSubtract(base, blend) max(base + blend - 1.0, 0.0)
#define BlendDifference(base, blend) abs(base - blend)
#define BlendNegation(base, blend) (1.0 - abs(1.0 - base - blend))
#define BlendExclusion(base, blend) (base + blend - 2.0 * base * blend)
#define BlendScreen1(base, blend) Blend1(base, blend, BlendScreenf)
#define BlendOverlay1(base, blend) Blend1(base, blend, BlendOverlayf)
#define BlendSoftLight1(base, blend) Blend1(base, blend, BlendSoftLightf)
#define BlendHardLight1(base, blend) BlendOverlay1(blend, base)
#define BlendColorDodge1(base, blend) Blend1(base, blend, BlendColorDodgef)
#define BlendColorBurn1(base, blend) Blend1(base, blend, BlendColorBurnf)
// Linear Light is another contrast-increasing mode
// If the blend color is darker than midgray, Linear Light darkens the image by decreasing the brightness. If the blend color is lighter than midgray, the result is a brighter image due to increased brightness.
#define BlendLinearLight1(base, blend) Blend1(base, blend, BlendLinearLightf)
#define BlendVividLight1(base, blend) Blend1(base, blend, BlendVividLightf)
#define BlendPinLight1(base, blend) Blend1(base, blend, BlendPinLightf)
#define BlendHardMix1(base, blend) Blend1(base, blend, BlendHardMixf)
#define BlendReflect1(base, blend) Blend1(base, blend, BlendReflectf)
#define BlendGlow1(base, blend) BlendReflect1(blend, base)
#define BlendScreen3(base, blend) Blend3(base, blend, BlendScreenf)
#define BlendOverlay3(base, blend) Blend3(base, blend, BlendOverlayf)
#define BlendSoftLight3(base, blend) Blend3(base, blend, BlendSoftLightf)
#define BlendHardLight3(base, blend) BlendOverlay3(blend, base)
#define BlendColorDodge3(base, blend) Blend3(base, blend, BlendColorDodgef)
#define BlendColorBurn3(base, blend) Blend3(base, blend, BlendColorBurnf)
// Linear Light is another contrast-increasing mode
// If the blend color is darker than midgray, Linear Light darkens the image by decreasing the brightness. If the blend color is lighter than midgray, the result is a brighter image due to increased brightness.
#define BlendLinearLight3(base, blend) Blend3(base, blend, BlendLinearLightf)
#define BlendVividLight3(base, blend) Blend3(base, blend, BlendVividLightf)
#define BlendPinLight3(base, blend) Blend3(base, blend, BlendPinLightf)
#define BlendHardMix3(base, blend) Blend3(base, blend, BlendHardMixf)
#define BlendReflect3(base, blend) Blend3(base, blend, BlendReflectf)
#define BlendGlow3(base, blend) BlendReflect3(blend, base)
#define BlendScreen4(base, blend) Blend4(base, blend, BlendScreenf)
#define BlendOverlay4(base, blend) Blend4(base, blend, BlendOverlayf)
#define BlendSoftLight4(base, blend) Blend4(base, blend, BlendSoftLightf)
#define BlendHardLight4(base, blend) BlendOverlay4(blend, base)
#define BlendColorDodge4(base, blend) Blend4(base, blend, BlendColorDodgef)
#define BlendColorBurn4(base, blend) Blend4(base, blend, BlendColorBurnf)
// Linear Light is another contrast-increasing mode
// If the blend color is darker than midgray, Linear Light darkens the image by decreasing the brightness. If the blend color is lighter than midgray, the result is a brighter image due to increased brightness.
#define BlendLinearLight4(base, blend) Blend4(base, blend, BlendLinearLightf)
#define BlendVividLight4(base, blend) Blend4(base, blend, BlendVividLightf)
#define BlendPinLight4(base, blend) Blend4(base, blend, BlendPinLightf)
#define BlendHardMix4(base, blend) Blend4(base, blend, BlendHardMixf)
#define BlendReflect4(base, blend) Blend4(base, blend, BlendReflectf)
#define BlendGlow4(base, blend) BlendReflect4(blend, base)
#define BlendLinearDodge BlendAdd
#define BlendLinearBurn BlendSubtract
#define BlendPhoenix(base, blend) (min(base, blend) - max(base, blend) + 1.0)
#define BlendOpacity(base, blend, F, O) (F(base, blend) * O + blend * (1.0 - O))
// Hue Blend mode creates the result color by combining the luminance and saturation of the base color with the hue of the blend color.
float BlendHue1(float base, float blend)
{
return base;
}
float3 BlendHue3(float3 base, float3 blend)
{
float3 baseHSL = RGBToHSL(base);
return HSLToRGB(float3(RGBToHSL(blend).r, baseHSL.g, baseHSL.b));
}
float4 BlendHue4(float4 base, float4 blend)
{
float3 hue = BlendHue3(base.xyz, blend.xyz);
return float4(hue.x, hue.y, hue.z, BlendHue1(base.w, blend.w));
}
// Saturation Blend mode creates the result color by combining the luminance and hue of the base color with the saturation of the blend color.
float BlendSaturation1(float base, float blend)
{
return base;
}
float3 BlendSaturation3(float3 base, float3 blend)
{
float3 baseHSL = RGBToHSL(base);
return HSLToRGB(float3(baseHSL.r, RGBToHSL(blend).g, baseHSL.b));
}
float4 BlendSaturation4(float4 base, float4 blend)
{
float3 hue = BlendSaturation3(base.xyz, blend.xyz);
return float4(hue.x, hue.y, hue.z, BlendSaturation1(base.w, blend.w));
}
// Color Mode keeps the brightness of the base color and applies both the hue and saturation of the blend color.
float BlendColor1(float base, float blend)
{
return base;
}
float3 BlendColor3(float3 base, float3 blend)
{
float3 blendHSL = RGBToHSL(blend);
return HSLToRGB(float3(blendHSL.r, blendHSL.g, RGBToHSL(base).b));
}
float4 BlendColor4(float4 base, float4 blend)
{
float3 hue = BlendColor3(base.xyz, blend.xyz);
return float4(hue.x, hue.y, hue.z, BlendColor1(base.w, blend.w));
}
// Luminosity Blend mode creates the result color by combining the hue and saturation of the base color with the luminance of the blend color.
float BlendLuminosity1(float base, float blend)
{
return base;
}
float3 BlendLuminosity3(float3 base, float3 blend)
{
float3 baseHSL = RGBToHSL(base);
return HSLToRGB(float3(baseHSL.r, baseHSL.g, RGBToHSL(blend).b));
}
float4 BlendLuminosity4(float4 base, float4 blend)
{
float3 hue = BlendLuminosity3(base.xyz, blend.xyz);
return float4(hue.x, hue.y, hue.z, BlendLuminosity1(base.w, blend.w));
}
//------------------------------------
// Interface for RTShader
//------------------------------------
void SGX_blend_normal(float4 basePixel, float4 blendPixel, out float4 oColor)
{
oColor = BlendNormal(basePixel, blendPixel);
}
void SGX_blend_normal(float3 basePixel, float3 blendPixel, out float3 oColor)
{
oColor = BlendNormal(basePixel, blendPixel);
}
void SGX_blend_normal(float basePixel, float blendPixel, out float oColor)
{
oColor = BlendNormal(basePixel, blendPixel);
}
void SGX_blend_lighten(float4 basePixel, float4 blendPixel, out float4 oColor)
{
oColor = BlendLighten(basePixel, blendPixel);
}
void SGX_blend_lighten(float3 basePixel, float3 blendPixel, out float3 oColor)
{
oColor = BlendLighten(basePixel, blendPixel);
}
void SGX_blend_lighten(float basePixel, float blendPixel, out float oColor)
{
oColor = BlendLighten(basePixel, blendPixel);
}
void SGX_blend_darken(float4 basePixel, float4 blendPixel, out float4 oColor)
{
oColor = BlendDarken(basePixel, blendPixel);
}
void SGX_blend_darken(float3 basePixel, float3 blendPixel, out float3 oColor)
{
oColor = BlendDarken(basePixel, blendPixel);
}
void SGX_blend_darken(float basePixel, float blendPixel, out float oColor)
{
oColor = BlendDarken(basePixel, blendPixel);
}
void SGX_blend_multiply(float4 basePixel, float4 blendPixel, out float4 oColor)
{
oColor = BlendMultiply(basePixel, blendPixel);
}
void SGX_blend_multiply(float3 basePixel, float3 blendPixel, out float3 oColor)
{
oColor = BlendMultiply(basePixel, blendPixel);
}
void SGX_blend_multiply(float basePixel, float blendPixel, out float oColor)
{
oColor = BlendMultiply(basePixel, blendPixel);
}
void SGX_blend_average(float4 basePixel, float4 blendPixel, out float4 oColor)
{
oColor = BlendAverage(basePixel, blendPixel);
}
void SGX_blend_average(float3 basePixel, float3 blendPixel, out float3 oColor)
{
oColor = BlendAverage(basePixel, blendPixel);
}
void SGX_blend_average(float basePixel, float blendPixel, out float oColor)
{
oColor = BlendAverage(basePixel, blendPixel);
}
void SGX_blend_add(float4 basePixel, float4 blendPixel, out float4 oColor)
{
oColor = BlendAdd(basePixel, blendPixel);
}
void SGX_blend_add(float3 basePixel, float3 blendPixel, out float3 oColor)
{
oColor = BlendAdd(basePixel, blendPixel);
}
void SGX_blend_add(float basePixel, float blendPixel, out float oColor)
{
oColor = BlendAdd(basePixel, blendPixel);
}
void SGX_blend_subtract(float4 basePixel, float4 blendPixel, out float4 oColor)
{
oColor = BlendSubtract(basePixel, blendPixel);
}
void SGX_blend_subtract(float3 basePixel, float3 blendPixel, out float3 oColor)
{
oColor = BlendSubtract(basePixel, blendPixel);
}
void SGX_blend_subtract(float basePixel, float blendPixel, out float oColor)
{
oColor = BlendSubtract(basePixel, blendPixel);
}
void SGX_blend_difference(float4 basePixel, float4 blendPixel, out float4 oColor)
{
oColor = BlendDifference(basePixel, blendPixel);
}
void SGX_blend_difference(float3 basePixel, float3 blendPixel, out float3 oColor)
{
oColor = BlendDifference(basePixel, blendPixel);
}
void SGX_blend_difference(float basePixel, float blendPixel, out float oColor)
{
oColor = BlendDifference(basePixel, blendPixel);
}
void SGX_blend_negation(float4 basePixel, float4 blendPixel, out float4 oColor)
{
oColor = BlendNegation(basePixel, blendPixel);
}
void SGX_blend_negation(float3 basePixel, float3 blendPixel, out float3 oColor)
{
oColor = BlendNegation(basePixel, blendPixel);
}
void SGX_blend_negation(float basePixel, float blendPixel, out float oColor)
{
oColor = BlendNegation(basePixel, blendPixel);
}
void SGX_blend_exclusion(float4 basePixel, float4 blendPixel, out float4 oColor)
{
oColor = BlendExclusion(basePixel, blendPixel);
}
void SGX_blend_exclusion(float3 basePixel, float3 blendPixel, out float3 oColor)
{
oColor = BlendExclusion(basePixel, blendPixel);
}
void SGX_blend_exclusion(float basePixel, float blendPixel, out float oColor)
{
oColor = BlendExclusion(basePixel, blendPixel);
}
void SGX_blend_screen(float4 basePixel, float4 blendPixel, out float4 oColor)
{
oColor = Blend4(basePixel, blendPixel, BlendScreenf);
}
void SGX_blend_screen(float3 basePixel, float3 blendPixel, out float3 oColor)
{
oColor = Blend3(basePixel, blendPixel, BlendScreenf);
}
void SGX_blend_screen(float basePixel, float blendPixel, out float oColor)
{
oColor = Blend1(basePixel, blendPixel, BlendScreenf);
}
void SGX_blend_overlay(float4 basePixel, float4 blendPixel, out float4 oColor)
{
oColor = Blend4(basePixel, blendPixel, BlendOverlayf);
}
void SGX_blend_overlay(float3 basePixel, float3 blendPixel, out float3 oColor)
{
oColor = Blend3(basePixel, blendPixel, BlendOverlayf);
}
void SGX_blend_overlay(float basePixel, float blendPixel, out float oColor)
{
oColor = Blend1(basePixel, blendPixel, BlendOverlayf);
}
void SGX_blend_softLight(float4 basePixel, float4 blendPixel, out float4 oColor)
{
oColor = Blend4(basePixel, blendPixel, BlendSoftLightf);
}
void SGX_blend_softLight(float3 basePixel, float3 blendPixel, out float3 oColor)
{
oColor = Blend3(basePixel, blendPixel, BlendSoftLightf);
}
void SGX_blend_softLight(float basePixel, float blendPixel, out float oColor)
{
oColor = Blend1(basePixel, blendPixel, BlendSoftLightf);
}
void SGX_blend_hardLight(float4 basePixel, float4 blendPixel, out float4 oColor)
{
oColor = Blend4(basePixel, blendPixel, BlendOverlayf);
}
void SGX_blend_hardLight(float3 basePixel, float3 blendPixel, out float3 oColor)
{
oColor = Blend3(basePixel, blendPixel, BlendOverlayf);
}
void SGX_blend_hardLight(float basePixel, float blendPixel, out float oColor)
{
oColor = Blend1(basePixel, blendPixel, BlendOverlayf);
}
void SGX_blend_colorDodge(float4 basePixel, float4 blendPixel, out float4 oColor)
{
oColor = Blend4(basePixel, blendPixel, BlendColorDodgef);
}
void SGX_blend_colorDodge(float3 basePixel, float3 blendPixel, out float3 oColor)
{
oColor = Blend3(basePixel, blendPixel, BlendColorDodgef);
}
void SGX_blend_colorDodge(float basePixel, float blendPixel, out float oColor)
{
oColor = Blend1(basePixel, blendPixel, BlendColorDodgef);
}
void SGX_blend_colorBurn(float4 basePixel, float4 blendPixel, out float4 oColor)
{
oColor = Blend4(basePixel, blendPixel, BlendColorBurnf);
}
void SGX_blend_colorBurn(float3 basePixel, float3 blendPixel, out float3 oColor)
{
oColor = Blend3(basePixel, blendPixel, BlendColorBurnf);
}
void SGX_blend_colorBurn(float basePixel, float blendPixel, out float oColor)
{
oColor = Blend1(basePixel, blendPixel, BlendColorBurnf);
}
void SGX_blend_linearDodge(float4 basePixel, float4 blendPixel, out float4 oColor)
{
oColor = BlendLinearDodge(basePixel, blendPixel);
}
void SGX_blend_linearDodge(float3 basePixel, float3 blendPixel, out float3 oColor)
{
oColor = BlendLinearDodge(basePixel, blendPixel);
}
void SGX_blend_linearDodge(float basePixel, float blendPixel, out float oColor)
{
oColor = BlendLinearDodge(basePixel, blendPixel);
}
void SGX_blend_linearBurn(float4 basePixel, float4 blendPixel, out float4 oColor)
{
oColor = BlendLinearBurn(basePixel, blendPixel);
}
void SGX_blend_linearBurn(float3 basePixel, float3 blendPixel, out float3 oColor)
{
oColor = BlendLinearBurn(basePixel, blendPixel);
}
void SGX_blend_linearBurn(float basePixel, float blendPixel, out float oColor)
{
oColor = BlendLinearBurn(basePixel, blendPixel);
}
void SGX_blend_linearLight(float4 basePixel, float4 blendPixel, out float4 oColor)
{
oColor = Blend4(basePixel, blendPixel, BlendLinearLightf);
}
void SGX_blend_linearLight(float3 basePixel, float3 blendPixel, out float3 oColor)
{
oColor = Blend3(basePixel, blendPixel, BlendLinearLightf);
}
void SGX_blend_linearLight(float basePixel, float blendPixel, out float oColor)
{
oColor = Blend1(basePixel, blendPixel, BlendLinearLightf);
}
void SGX_blend_vividLight(float4 basePixel, float4 blendPixel, out float4 oColor)
{
oColor = Blend4(basePixel, blendPixel, BlendVividLightf);
}
void SGX_blend_vividLight(float3 basePixel, float3 blendPixel, out float3 oColor)
{
oColor = Blend3(basePixel, blendPixel, BlendVividLightf);
}
void SGX_blend_vividLight(float basePixel, float blendPixel, out float oColor)
{
oColor = Blend1(basePixel, blendPixel, BlendVividLightf);
}
void SGX_blend_pinLight(float4 basePixel, float4 blendPixel, out float4 oColor)
{
oColor = Blend4(basePixel, blendPixel, BlendPinLightf);
}
void SGX_blend_pinLight(float3 basePixel, float3 blendPixel, out float3 oColor)
{
oColor = Blend3(basePixel, blendPixel, BlendPinLightf);
}
void SGX_blend_pinLight(float basePixel, float blendPixel, out float oColor)
{
oColor = Blend1(basePixel, blendPixel, BlendPinLightf);
}
void SGX_blend_hardMix(float4 basePixel, float4 blendPixel, out float4 oColor)
{
oColor = Blend4(basePixel, blendPixel, BlendHardMixf);
}
void SGX_blend_hardMix(float3 basePixel, float3 blendPixel, out float3 oColor)
{
oColor = Blend3(basePixel, blendPixel, BlendHardMixf);
}
void SGX_blend_hardMix(float basePixel, float blendPixel, out float oColor)
{
oColor = Blend1(basePixel, blendPixel, BlendHardMixf);
}
void SGX_blend_reflect(float4 basePixel, float4 blendPixel, out float4 oColor)
{
oColor = Blend4(basePixel, blendPixel, BlendReflectf);
}
void SGX_blend_reflect(float3 basePixel, float3 blendPixel, out float3 oColor)
{
oColor = Blend3(basePixel, blendPixel, BlendReflectf);
}
void SGX_blend_reflect(float basePixel, float blendPixel, out float oColor)
{
oColor = Blend1(basePixel, blendPixel, BlendReflectf);
}
void SGX_blend_glow(float4 basePixel, float4 blendPixel, out float4 oColor)
{
oColor = Blend4(basePixel, blendPixel, BlendReflectf);
}
void SGX_blend_glow(float3 basePixel, float3 blendPixel, out float3 oColor)
{
oColor = Blend3(basePixel, blendPixel, BlendReflectf);
}
void SGX_blend_glow(float basePixel, float blendPixel, out float oColor)
{
oColor = Blend1(basePixel, blendPixel, BlendReflectf);
}
void SGX_blend_phoenix(float4 basePixel, float4 blendPixel, out float4 oColor)
{
oColor = BlendPhoenix(basePixel, blendPixel);
}
void SGX_blend_phoenix(float3 basePixel, float3 blendPixel, out float3 oColor)
{
oColor = BlendPhoenix(basePixel, blendPixel);
}
void SGX_blend_phoenix(float basePixel, float blendPixel, out float oColor)
{
oColor = BlendPhoenix(basePixel, blendPixel);
}
void SGX_blend_saturation(float4 basePixel, float4 blendPixel, out float4 oColor)
{
oColor = BlendSaturation4(basePixel, blendPixel);
}
void SGX_blend_saturation(float3 basePixel, float3 blendPixel, out float3 oColor)
{
oColor = BlendSaturation3(basePixel, blendPixel);
}
void SGX_blend_saturation(float basePixel, float blendPixel, out float oColor)
{
oColor = BlendSaturation1(basePixel, blendPixel);
}
void SGX_blend_color(float4 basePixel, float4 blendPixel, out float4 oColor)
{
oColor = BlendColor4(basePixel, blendPixel);
}
void SGX_blend_color(float3 basePixel, float3 blendPixel, out float3 oColor)
{
oColor = BlendColor3(basePixel, blendPixel);
}
void SGX_blend_color(float basePixel, float blendPixel, out float oColor)
{
oColor = BlendColor1(basePixel, blendPixel);
}
void SGX_blend_luminosity(float4 basePixel, float4 blendPixel, out float4 oColor)
{
oColor = BlendLuminosity4(basePixel, blendPixel);
}
void SGX_blend_luminosity(float3 basePixel, float3 blendPixel, out float3 oColor)
{
oColor = BlendLuminosity3(basePixel, blendPixel);
}
void SGX_blend_luminosity(float basePixel, float blendPixel, out float oColor)
{
oColor = BlendLuminosity1(basePixel, blendPixel);
}
////////////////////////////////////////////////////////////////////////////////////
/// Source modification functions
////////////////////////////////////////////////////////////////////////////////////
void SGX_src_mod_modulate(float4 iColor, float4 controlVal, out float4 oColor)
{
oColor = iColor * controlVal;
}
void SGX_src_mod_modulate(float3 iColor, float3 controlVal, out float3 oColor)
{
oColor = iColor * controlVal;
}
void SGX_src_mod_modulate(float iColor, float controlVal, out float oColor)
{
oColor = iColor * controlVal;
}
void SGX_src_mod_inv_modulate(float4 iColor, float4 controlVal, out float4 oColor)
{
oColor = lerp(iColor, 1, controlVal);
}
void SGX_src_mod_inv_modulate(float3 iColor, float3 controlVal, out float3 oColor)
{
oColor = lerp(iColor, 1, controlVal);
}
void SGX_src_mod_inv_modulate(float iColor, float controlVal, out float oColor)
{
oColor = lerp(iColor, 1, controlVal);
}

257
Bushin/media/RTShaderLib/SGXLib_NormalMapLighting.cg

@ -0,0 +1,257 @@
/*
-----------------------------------------------------------------------------
This source file is part of OGRE
(Object-oriented Graphics Rendering Engine)
For the latest info, see http://www.ogre3d.org
Copyright (c) 2000-2012 Torus Knot Software Ltd
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-----------------------------------------------------------------------------
*/
//-----------------------------------------------------------------------------
// Program Name: SGXLib_NormalMapLighting
// Program Desc: Normal map lighting functions.
// Program Type: Vertex/Pixel shader
// Language: CG
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
void SGX_ConstructTBNMatrix(in float3 vNormal,
in float3 vTangent,
out float3x3 vOut)
{
float3 vBinormal = cross(vTangent, vNormal);
vOut = float3x3(vTangent, vBinormal, vNormal);
}
//-----------------------------------------------------------------------------
void SGX_TransformNormal(in float3x3 m,
in float3 v,
out float3 vOut)
{
vOut = mul(m, v);
}
//-----------------------------------------------------------------------------
void SGX_TransformNormal(in float4x4 m,
in float3 v,
out float3 vOut)
{
vOut = mul((float3x3)m, v);
}
//-----------------------------------------------------------------------------
void SGX_TransformPosition(in float4x4 m,
in float4 v,
out float3 vOut)
{
vOut = mul(m, v).xyz;
}
//-----------------------------------------------------------------------------
void SGX_FetchNormal(in sampler2D s,
in float2 uv,
out float3 vOut)
{
vOut = 2 * tex2D(s, uv).xyz - 1;
}
//-----------------------------------------------------------------------------
void SGX_Generate_Parallax_Texcoord(in sampler2D normalHeightMap,
in float2 texCoord,
in float3 eyeVec,
in float2 scaleBias,
out float2 newTexCoord)
{
eyeVec = normalize(eyeVec);
float height = tex2D(normalHeightMap, texCoord).a;
float displacement = (height * scaleBias.x) + scaleBias.y;
float3 scaledEyeDir = eyeVec * displacement;
newTexCoord = (scaledEyeDir + float3(texCoord, 1.0)).xy;
}
//-----------------------------------------------------------------------------
void SGX_Light_Directional_Diffuse(
in float3 vTSNormal,
in float3 vTSNegLightDir,
in float3 vDiffuseColour,
in float3 vBaseColour,
out float3 vOut)
{
float3 vTSNegLightDirNorm = normalize(vTSNegLightDir);
float nDotL = dot(vTSNormal, vTSNegLightDirNorm);
vOut = vBaseColour + vDiffuseColour * saturate(nDotL);
}
//-----------------------------------------------------------------------------
void SGX_Light_Directional_DiffuseSpecular(
in float3 vTSNormal,
in float3 vTSView,
in float3 vTSNegLightDir,
in float3 vDiffuseColour,
in float3 vSpecularColour,
in float fSpecularPower,
in float3 vBaseDiffuseColour,
in float3 vBaseSpecularColour,
out float3 vOutDiffuse,
out float3 vOutSpecular)
{
vOutDiffuse = vBaseDiffuseColour;
vOutSpecular = vBaseSpecularColour;
float3 vTSNegLightDirNorm = normalize(vTSNegLightDir);
float nDotL = dot(vTSNormal, vTSNegLightDirNorm);
float3 vTSViewNorm = normalize(vTSView);
float3 vHalfWay = normalize(vTSView + vTSNegLightDir);
float nDotH = dot(vTSNormal, vHalfWay);
if (nDotL > 0)
{
vOutDiffuse += vDiffuseColour * nDotL;
vOutSpecular += vSpecularColour * pow(saturate(nDotH), fSpecularPower);
}
}
//-----------------------------------------------------------------------------
void SGX_Light_Point_Diffuse(
in float3 vTSNormal,
in float3 vTSToLight,
in float4 vAttParams,
in float3 vDiffuseColour,
in float3 vBaseColour,
out float3 vOut)
{
vOut = vBaseColour;
float fLightD = length(vTSToLight);
float nDotL = dot(vTSNormal, normalize(vTSToLight));
if (nDotL > 0 && fLightD <= vAttParams.x)
{
float fAtten = 1 / (vAttParams.y + vAttParams.z*fLightD + vAttParams.w*fLightD*fLightD);
vOut += vDiffuseColour * nDotL * fAtten;
}
}
//-----------------------------------------------------------------------------
void SGX_Light_Point_DiffuseSpecular(
in float3 vTSNormal,
in float3 vTSView,
in float3 vTSToLight,
in float4 vAttParams,
in float3 vDiffuseColour,
in float3 vSpecularColour,
in float fSpecularPower,
in float3 vBaseDiffuseColour,
in float3 vBaseSpecularColour,
out float3 vOutDiffuse,
out float3 vOutSpecular)
{
vOutDiffuse = vBaseDiffuseColour;
vOutSpecular = vBaseSpecularColour;
float fLightD = length(vTSToLight);
float3 vTSNegLightDirNorm = normalize(vTSToLight);
float nDotL = dot(vTSNormal, vTSNegLightDirNorm);
if (nDotL > 0 && fLightD <= vAttParams.x)
{
float3 vTSViewNorm = normalize(vTSView);
float3 vHalfWay = normalize(vTSViewNorm + vTSNegLightDirNorm);
float nDotH = dot(vTSNormal, vHalfWay);
float fAtten = 1 / (vAttParams.y + vAttParams.z*fLightD + vAttParams.w*fLightD*fLightD);
vOutDiffuse += vDiffuseColour * nDotL * fAtten;
vOutSpecular += vSpecularColour * pow(saturate(nDotH), fSpecularPower) * fAtten;
}
}
//-----------------------------------------------------------------------------
void SGX_Light_Spot_Diffuse(
in float3 vTSNormal,
in float3 vTSToLight,
in float3 vTSNegLightDir,
in float4 vAttParams,
in float3 vSpotParams,
in float3 vDiffuseColour,
in float3 vBaseColour,
out float3 vOut)
{
vOut = vBaseColour;
float fLightD = length(vTSToLight);
float3 vTSToLightNorm = normalize(vTSToLight);
float nDotL = dot(vTSNormal, vTSToLightNorm);
if (nDotL > 0 && fLightD <= vAttParams.x)
{
float3 vTSNegLightDirNorm = normalize(vTSNegLightDir);
float fAtten = 1 / (vAttParams.y + vAttParams.z*fLightD + vAttParams.w*fLightD*fLightD);
float rho = dot(vTSNegLightDirNorm, vTSToLightNorm);
float fSpotE = saturate((rho - vSpotParams.y) / (vSpotParams.x - vSpotParams.y));
float fSpotT = pow(fSpotE, vSpotParams.z);
vOut += vDiffuseColour * nDotL * fAtten * fSpotT;
}
}
//-----------------------------------------------------------------------------
void SGX_Light_Spot_DiffuseSpecular(
in float3 vTSNormal,
in float3 vTSView,
in float3 vTSToLight,
in float3 vTSNegLightDir,
in float4 vAttParams,
in float3 vSpotParams,
in float3 vDiffuseColour,
in float3 vSpecularColour,
in float fSpecularPower,
in float3 vBaseDiffuseColour,
in float3 vBaseSpecularColour,
out float3 vOutDiffuse,
out float3 vOutSpecular)
{
vOutDiffuse = vBaseDiffuseColour;
vOutSpecular = vBaseSpecularColour;
float fLightD = length(vTSToLight);
float3 vTSToLightNorm = normalize(vTSToLight);
float nDotL = dot(vTSNormal, vTSToLightNorm);
if (nDotL > 0 && fLightD <= vAttParams.x)
{
float3 vTSNegLightDirNorm = normalize(vTSNegLightDir);
float3 vTSViewNorm = normalize(vTSView);
float3 vHalfWay = normalize(vTSViewNorm + vTSNegLightDirNorm);
float nDotH = dot(vTSNormal, vHalfWay);
float fAtten = 1 / (vAttParams.y + vAttParams.z*fLightD + vAttParams.w*fLightD*fLightD);
float rho = dot(vTSNegLightDirNorm, vTSToLightNorm);
float fSpotE = saturate((rho - vSpotParams.y) / (vSpotParams.x - vSpotParams.y));
float fSpotT = pow(fSpotE, vSpotParams.z);
vOutDiffuse += vDiffuseColour * nDotL * fAtten * fSpotT;
vOutSpecular += vSpecularColour * pow(saturate(nDotH), fSpecularPower) * fAtten * fSpotT;
}
}

269
Bushin/media/RTShaderLib/SGXLib_NormalMapLighting.glsl

@ -0,0 +1,269 @@
#version 120
/*
-----------------------------------------------------------------------------
This source file is part of OGRE
(Object-oriented Graphics Rendering Engine)
For the latest info, see http://www.ogre3d.org
Copyright (c) 2000-2012 Torus Knot Software Ltd
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-----------------------------------------------------------------------------
*/
//-----------------------------------------------------------------------------
// Program Name: SGXLib_NormalMapLighting
// Program Desc: Normal map lighting functions.
// Program Type: Vertex/Pixel shader
// Language: GLSL
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
void SGX_ConstructTBNMatrix(in vec3 vNormal,
in vec3 vTangent,
out mat3 vOut)
{
vec3 vBinormal = cross(vTangent, vNormal);
vOut[0][0] = vTangent.x;
vOut[1][0] = vTangent.y;
vOut[2][0] = vTangent.z;
vOut[0][1] = vBinormal.x;
vOut[1][1] = vBinormal.y;
vOut[2][1] = vBinormal.z;
vOut[0][2] = vNormal.x;
vOut[1][2] = vNormal.y;
vOut[2][2] = vNormal.z;
}
//-----------------------------------------------------------------------------
void SGX_TransformNormal(in mat3 m,
in vec3 v,
out vec3 vOut)
{
vOut = (m * v) ;
}
//-----------------------------------------------------------------------------
void SGX_TransformNormal(in mat4 m,
in vec3 v,
out vec3 vOut)
{
vOut = (m * vec4(v, 1.0)).xyz ;
}
//-----------------------------------------------------------------------------
void SGX_TransformPosition(in mat4 m,
in vec4 v,
out vec3 vOut)
{
vOut = (m * v).xyz;
}
//-----------------------------------------------------------------------------
void SGX_FetchNormal(in sampler2D s,
in vec2 uv,
out vec3 vOut)
{
vOut = 2.0 * texture2D(s, uv).xyz - 1.0;
}
//-----------------------------------------------------------------------------
void SGX_Light_Directional_Diffuse(
in vec3 vTSNormal,
in vec3 vTSNegLightDir,
in vec3 vDiffuseColour,
in vec3 vBaseColour,
out vec3 vOut)
{
vec3 vTSNegLightDirNorm = normalize(vTSNegLightDir);
float nDotL = dot(vTSNormal, vTSNegLightDirNorm);
vOut = vBaseColour + vDiffuseColour * clamp(nDotL, 0.0, 1.0);
}
//-----------------------------------------------------------------------------
void SGX_Generate_Parallax_Texcoord(in sampler2D normalHeightMap,
in vec2 texCoord,
in vec3 eyeVec,
in vec2 scaleBias,
out vec2 newTexCoord)
{
eyeVec = normalize(eyeVec);
float height = texture2D(normalHeightMap, texCoord).a;
float displacement = (height * scaleBias.x) + scaleBias.y;
vec3 scaledEyeDir = eyeVec * displacement;
newTexCoord = (scaledEyeDir + vec3(texCoord, 1.0)).xy;
}
//-----------------------------------------------------------------------------
void SGX_Light_Directional_DiffuseSpecular(
in vec3 vTSNormal,
in vec3 vTSView,
in vec3 vTSNegLightDir,
in vec3 vDiffuseColour,
in vec3 vSpecularColour,
in float fSpecularPower,
in vec3 vBaseDiffuseColour,
in vec3 vBaseSpecularColour,
out vec3 vOutDiffuse,
out vec3 vOutSpecular)
{
vOutDiffuse = vBaseDiffuseColour;
vOutSpecular = vBaseSpecularColour;
vec3 vTSNegLightDirNorm = normalize(vTSNegLightDir);
float nDotL = dot(vTSNormal, vTSNegLightDirNorm);
vec3 vTSViewNorm = normalize(vTSView);
vec3 vHalfWay = normalize(vTSView + vTSNegLightDir);
float nDotH = dot(vTSNormal, vHalfWay);
if (nDotL > 0.0)
{
vOutDiffuse += vDiffuseColour * nDotL;
vOutSpecular += vSpecularColour * pow(clamp(nDotH, 0.0, 1.0), fSpecularPower);
}
}
//-----------------------------------------------------------------------------
void SGX_Light_Point_Diffuse(
in vec3 vTSNormal,
in vec3 vTSToLight,
in vec4 vAttParams,
in vec3 vDiffuseColour,
in vec3 vBaseColour,
out vec3 vOut)
{
vOut = vBaseColour;
float fLightD = length(vTSToLight);
float nDotL = dot(vTSNormal, normalize(vTSToLight));
if (nDotL > 0.0 && fLightD <= vAttParams.x)
{
float fAtten = 1.0 / (vAttParams.y + vAttParams.z*fLightD + vAttParams.w*fLightD*fLightD);
vOut += vDiffuseColour * nDotL * fAtten;
}
}
//-----------------------------------------------------------------------------
void SGX_Light_Point_DiffuseSpecular(
in vec3 vTSNormal,
in vec3 vTSView,
in vec3 vTSToLight,
in vec4 vAttParams,
in vec3 vDiffuseColour,
in vec3 vSpecularColour,
in float fSpecularPower,
in vec3 vBaseDiffuseColour,
in vec3 vBaseSpecularColour,
out vec3 vOutDiffuse,
out vec3 vOutSpecular)
{
vOutDiffuse = vBaseDiffuseColour;
vOutSpecular = vBaseSpecularColour;
float fLightD = length(vTSToLight);
vec3 vTSNegLightDirNorm = normalize(vTSToLight);
float nDotL = dot(vTSNormal, vTSNegLightDirNorm);
if (nDotL > 0.0 && fLightD <= vAttParams.x)
{
vec3 vTSViewNorm = normalize(vTSView);
vec3 vHalfWay = normalize(vTSViewNorm + vTSNegLightDirNorm);
float nDotH = dot(vTSNormal, vHalfWay);
float fAtten = 1.0 / (vAttParams.y + vAttParams.z*fLightD + vAttParams.w*fLightD*fLightD);
vOutDiffuse += vDiffuseColour * nDotL * fAtten;
vOutSpecular += vSpecularColour * pow(clamp(nDotH, 0.0, 1.0), fSpecularPower) * fAtten;
}
}
//-----------------------------------------------------------------------------
void SGX_Light_Spot_Diffuse(
in vec3 vTSNormal,
in vec3 vTSToLight,
in vec3 vTSNegLightDir,
in vec4 vAttParams,
in vec3 vSpotParams,
in vec3 vDiffuseColour,
in vec3 vBaseColour,
out vec3 vOut)
{
vOut = vBaseColour;
float fLightD = length(vTSToLight);
vec3 vTSToLightNorm = normalize(vTSToLight);
float nDotL = dot(vTSNormal, vTSToLightNorm);
if (nDotL > 0.0 && fLightD <= vAttParams.x)
{
vec3 vTSNegLightDirNorm = normalize(vTSNegLightDir);
float fAtten = 1.0 / (vAttParams.y + vAttParams.z*fLightD + vAttParams.w*fLightD*fLightD);
float rho = dot(vTSNegLightDirNorm, vTSToLightNorm);
float fSpotE = clamp((rho - vSpotParams.y) / (vSpotParams.x - vSpotParams.y), 0.0, 1.0);
float fSpotT = pow(fSpotE, vSpotParams.z);
vOut += vDiffuseColour * nDotL * fAtten * fSpotT;
}
}
//-----------------------------------------------------------------------------
void SGX_Light_Spot_DiffuseSpecular(
in vec3 vTSNormal,
in vec3 vTSView,
in vec3 vTSToLight,
in vec3 vTSNegLightDir,
in vec4 vAttParams,
in vec3 vSpotParams,
in vec3 vDiffuseColour,
in vec3 vSpecularColour,
in float fSpecularPower,
in vec3 vBaseDiffuseColour,
in vec3 vBaseSpecularColour,
out vec3 vOutDiffuse,
out vec3 vOutSpecular)
{
vOutDiffuse = vBaseDiffuseColour;
vOutSpecular = vBaseSpecularColour;
float fLightD = length(vTSToLight);
vec3 vTSToLightNorm = normalize(vTSToLight);
float nDotL = dot(vTSNormal, vTSToLightNorm);
if (nDotL > 0.0 && fLightD <= vAttParams.x)
{
vec3 vTSNegLightDirNorm = normalize(vTSNegLightDir);
vec3 vTSViewNorm = normalize(vTSView);
vec3 vHalfWay = normalize(vTSViewNorm + vTSNegLightDirNorm);
float nDotH = dot(vTSNormal, vHalfWay);
float fAtten = 1.0 / (vAttParams.y + vAttParams.z*fLightD + vAttParams.w*fLightD*fLightD);
float rho = dot(vTSNegLightDirNorm, vTSToLightNorm);
float fSpotE = clamp((rho - vSpotParams.y) / (vSpotParams.x - vSpotParams.y), 0.0, 1.0);
float fSpotT = pow(fSpotE, vSpotParams.z);
vOutDiffuse += vDiffuseColour * nDotL * fAtten * fSpotT;
vOutSpecular += vSpecularColour * pow(clamp(nDotH, 0.0, 1.0), fSpecularPower) * fAtten * fSpotT;
}
}

264
Bushin/media/RTShaderLib/SGXLib_NormalMapLighting.glsles

@ -0,0 +1,264 @@
#version 100
precision highp float;
precision highp int;
precision lowp sampler2D;
precision lowp samplerCube;
/*
-----------------------------------------------------------------------------
This source file is part of OGRE
(Object-oriented Graphics Rendering Engine)
For the latest info, see http://www.ogre3d.org
Copyright (c) 2000-2012 Torus Knot Software Ltd
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-----------------------------------------------------------------------------
*/
//-----------------------------------------------------------------------------
// Program Name: SGXLib_NormalMapLighting
// Program Desc: Normal map lighting functions.
// Program Type: Vertex/Pixel shader
// Language: GLSL ES
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
void SGX_ConstructTBNMatrix(in vec3 vNormal,
in vec3 vTangent,
out mat3 vOut)
{
vec3 vBinormal = cross(vTangent, vNormal);
vOut[0][0] = vTangent.x;
vOut[1][0] = vTangent.y;
vOut[2][0] = vTangent.z;
vOut[0][1] = vBinormal.x;
vOut[1][1] = vBinormal.y;
vOut[2][1] = vBinormal.z;
vOut[0][2] = vNormal.x;
vOut[1][2] = vNormal.y;
vOut[2][2] = vNormal.z;
}
//-----------------------------------------------------------------------------
void SGX_TransformNormal(in mat3 m,
in vec3 v,
out vec3 vOut)
{
vOut = (m * v) ;
}
//-----------------------------------------------------------------------------
void SGX_TransformNormal(in mat4 m,
in vec3 v,
out vec3 vOut)
{
vOut = (m * vec4(v, 1.0)).xyz ;
}
//-----------------------------------------------------------------------------
void SGX_TransformPosition(in mat4 m,
in vec4 v,
out vec3 vOut)
{
vOut = (m * v).xyz;
}
//-----------------------------------------------------------------------------
void SGX_FetchNormal(in sampler2D s,
in vec2 uv,
out vec3 vOut)
{
vOut = 2.0 * texture2D(s, uv).xyz - 1.0;
}
//-----------------------------------------------------------------------------
void SGX_Light_Directional_Diffuse(in vec3 vTSNormal,
in vec3 vTSNegLightDir,
in vec3 vDiffuseColour,
in vec3 vBaseColour,
out vec3 vOut)
{
vec3 vTSNegLightDirNorm = normalize(vTSNegLightDir);
float nDotL = dot(vTSNormal, vTSNegLightDirNorm);
vOut = vBaseColour + vDiffuseColour * clamp(nDotL, 0.0, 1.0);
}
//-----------------------------------------------------------------------------
void SGX_Generate_Parallax_Texcoord(in sampler2D normalHeightMap,
in vec2 texCoord,
in vec3 eyeVec,
in vec2 scaleBias,
out vec2 newTexCoord)
{
eyeVec = normalize(eyeVec);
float height = texture2D(normalHeightMap, texCoord).a;
float displacement = (height * scaleBias.x) + scaleBias.y;
vec3 scaledEyeDir = eyeVec * displacement;
newTexCoord = (scaledEyeDir + vec3(texCoord, 1.0)).xy;
}
//-----------------------------------------------------------------------------
void SGX_Light_Directional_DiffuseSpecular(in vec3 vTSNormal,
in vec3 vTSView,
in vec3 vTSNegLightDir,
in vec3 vDiffuseColour,
in vec3 vSpecularColour,
in float fSpecularPower,
in vec3 vBaseDiffuseColour,
in vec3 vBaseSpecularColour,
out vec3 vOutDiffuse,
out vec3 vOutSpecular)
{
vOutDiffuse = vBaseDiffuseColour;
vOutSpecular = vBaseSpecularColour;
vec3 vTSNegLightDirNorm = normalize(vTSNegLightDir);
float nDotL = dot(vTSNormal, vTSNegLightDirNorm);
vec3 vTSViewNorm = normalize(vTSView);
vec3 vHalfWay = normalize(vTSView + vTSNegLightDir);
float nDotH = dot(vTSNormal, vHalfWay);
if (nDotL > 0.0)
{
vOutDiffuse += vDiffuseColour * nDotL;
vOutSpecular += vSpecularColour * pow(clamp(nDotH, 0.0, 1.0), fSpecularPower);
}
}
//-----------------------------------------------------------------------------
void SGX_Light_Point_Diffuse(in vec3 vTSNormal,
in vec3 vTSToLight,
in vec4 vAttParams,
in vec3 vDiffuseColour,
in vec3 vBaseColour,
out vec3 vOut)
{
vOut = vBaseColour;
float fLightD = length(vTSToLight);
float nDotL = dot(vTSNormal, normalize(vTSToLight));
if (nDotL > 0.0 && fLightD <= vAttParams.x)
{
float fAtten = 1.0 / (vAttParams.y + vAttParams.z * fLightD + vAttParams.w * fLightD * fLightD);
vOut += vDiffuseColour * nDotL * fAtten;
}
}
//-----------------------------------------------------------------------------
void SGX_Light_Point_DiffuseSpecular(in vec3 vTSNormal,
in vec3 vTSView,
in vec3 vTSToLight,
in vec4 vAttParams,
in vec3 vDiffuseColour,
in vec3 vSpecularColour,
in float fSpecularPower,
in vec3 vBaseDiffuseColour,
in vec3 vBaseSpecularColour,
out vec3 vOutDiffuse,
out vec3 vOutSpecular)
{
vOutDiffuse = vBaseDiffuseColour;
vOutSpecular = vBaseSpecularColour;
float fLightD = length(vTSToLight);
vec3 vTSNegLightDirNorm = normalize(vTSToLight);
float nDotL = dot(vTSNormal, vTSNegLightDirNorm);
if (nDotL > 0.0 && fLightD <= vAttParams.x)
{
vec3 vTSViewNorm = normalize(vTSView);
vec3 vHalfWay = normalize(vTSViewNorm + vTSNegLightDirNorm);
float nDotH = dot(vTSNormal, vHalfWay);
float fAtten = 1.0 / (vAttParams.y + vAttParams.z * fLightD + vAttParams.w * fLightD * fLightD);
vOutDiffuse += vDiffuseColour * nDotL * fAtten;
vOutSpecular += vSpecularColour * pow(clamp(nDotH, 0.0, 1.0), fSpecularPower) * fAtten;
}
}
//-----------------------------------------------------------------------------
void SGX_Light_Spot_Diffuse(in vec3 vTSNormal,
in vec3 vTSToLight,
in vec3 vTSNegLightDir,
in vec4 vAttParams,
in vec3 vSpotParams,
in vec3 vDiffuseColour,
in vec3 vBaseColour,
out vec3 vOut)
{
vOut = vBaseColour;
float fLightD = length(vTSToLight);
vec3 vTSToLightNorm = normalize(vTSToLight);
float nDotL = dot(vTSNormal, vTSToLightNorm);
if (nDotL > 0.0 && fLightD <= vAttParams.x)
{
vec3 vTSNegLightDirNorm = normalize(vTSNegLightDir);
float fAtten = 1.0 / (vAttParams.y + vAttParams.z * fLightD + vAttParams.w * fLightD * fLightD);
float rho = dot(vTSNegLightDirNorm, vTSToLightNorm);
float fSpotE = clamp((rho - vSpotParams.y) / (vSpotParams.x - vSpotParams.y), 0.0, 1.0);
float fSpotT = pow(fSpotE, vSpotParams.z);
vOut += vDiffuseColour * nDotL * fAtten * fSpotT;
}
}
//-----------------------------------------------------------------------------
void SGX_Light_Spot_DiffuseSpecular(in vec3 vTSNormal,
in vec3 vTSView,
in vec3 vTSToLight,
in vec3 vTSNegLightDir,
in vec4 vAttParams,
in vec3 vSpotParams,
in vec3 vDiffuseColour,
in vec3 vSpecularColour,
in float fSpecularPower,
in vec3 vBaseDiffuseColour,
in vec3 vBaseSpecularColour,
out vec3 vOutDiffuse,
out vec3 vOutSpecular)
{
vOutDiffuse = vBaseDiffuseColour;
vOutSpecular = vBaseSpecularColour;
float fLightD = length(vTSToLight);
vec3 vTSToLightNorm = normalize(vTSToLight);
float nDotL = dot(vTSNormal, vTSToLightNorm);
if (nDotL > 0.0 && fLightD <= vAttParams.x)
{
vec3 vTSNegLightDirNorm = normalize(vTSNegLightDir);
vec3 vTSViewNorm = normalize(vTSView);
vec3 vHalfWay = normalize(vTSViewNorm + vTSNegLightDirNorm);
float nDotH = dot(vTSNormal, vHalfWay);
float fAtten = 1.0 / (vAttParams.y + vAttParams.z * fLightD + vAttParams.w * fLightD * fLightD);
float rho = dot(vTSNegLightDirNorm, vTSToLightNorm);
float fSpotE = clamp((rho - vSpotParams.y) / (vSpotParams.x - vSpotParams.y), 0.0, 1.0);
float fSpotT = pow(fSpotE, vSpotParams.z);
vOutDiffuse += vDiffuseColour * nDotL * fAtten * fSpotT;
vOutSpecular += vSpecularColour * pow(clamp(nDotH, 0.0, 1.0), fSpecularPower) * fAtten * fSpotT;
}
}

257
Bushin/media/RTShaderLib/SGXLib_NormalMapLighting.hlsl

@ -0,0 +1,257 @@
/*
-----------------------------------------------------------------------------
This source file is part of OGRE
(Object-oriented Graphics Rendering Engine)
For the latest info, see http://www.ogre3d.org
Copyright (c) 2000-2012 Torus Knot Software Ltd
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-----------------------------------------------------------------------------
*/
//-----------------------------------------------------------------------------
// Program Name: SGXLib_NormalMapLighting
// Program Desc: Normal map lighting functions.
// Program Type: Vertex/Pixel shader
// Language: HLSL
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
void SGX_ConstructTBNMatrix(in float3 vNormal,
in float3 vTangent,
out float3x3 vOut)
{
float3 vBinormal = cross(vTangent, vNormal);
vOut = float3x3(vTangent, vBinormal, vNormal);
}
//-----------------------------------------------------------------------------
void SGX_TransformNormal(in float3x3 m,
in float3 v,
out float3 vOut)
{
vOut = mul(m, v);
}
//-----------------------------------------------------------------------------
void SGX_TransformNormal(in float4x4 m,
in float3 v,
out float3 vOut)
{
vOut = mul((float3x3)m, v);
}
//-----------------------------------------------------------------------------
void SGX_TransformPosition(in float4x4 m,
in float4 v,
out float3 vOut)
{
vOut = mul(m, v).xyz;
}
//-----------------------------------------------------------------------------
void SGX_FetchNormal(in sampler2D s,
in float2 uv,
out float3 vOut)
{
vOut = 2 * tex2D(s, uv).xyz - 1;
}
//-----------------------------------------------------------------------------
void SGX_Generate_Parallax_Texcoord(in sampler2D normalHeightMap,
in float2 texCoord,
in float3 eyeVec,
in float2 scaleBias,
out float2 newTexCoord)
{
eyeVec = normalize(eyeVec);
float height = tex2D(normalHeightMap, texCoord).a;
float displacement = (height * scaleBias.x) + scaleBias.y;
float3 scaledEyeDir = eyeVec * displacement;
newTexCoord = (scaledEyeDir + float3(texCoord, 1.0)).xy;
}
//-----------------------------------------------------------------------------
void SGX_Light_Directional_Diffuse(
in float3 vTSNormal,
in float3 vTSNegLightDir,
in float3 vDiffuseColour,
in float3 vBaseColour,
out float3 vOut)
{
float3 vTSNegLightDirNorm = normalize(vTSNegLightDir);
float nDotL = dot(vTSNormal, vTSNegLightDirNorm);
vOut = vBaseColour + vDiffuseColour * saturate(nDotL);
}
//-----------------------------------------------------------------------------
void SGX_Light_Directional_DiffuseSpecular(
in float3 vTSNormal,
in float3 vTSView,
in float3 vTSNegLightDir,
in float3 vDiffuseColour,
in float3 vSpecularColour,
in float fSpecularPower,
in float3 vBaseDiffuseColour,
in float3 vBaseSpecularColour,
out float3 vOutDiffuse,
out float3 vOutSpecular)
{
vOutDiffuse = vBaseDiffuseColour;
vOutSpecular = vBaseSpecularColour;
float3 vTSNegLightDirNorm = normalize(vTSNegLightDir);
float nDotL = dot(vTSNormal, vTSNegLightDirNorm);
float3 vTSViewNorm = normalize(vTSView);
float3 vHalfWay = normalize(vTSView + vTSNegLightDir);
float nDotH = dot(vTSNormal, vHalfWay);
if (nDotL > 0)
{
vOutDiffuse += vDiffuseColour * nDotL;
vOutSpecular += vSpecularColour * pow(saturate(nDotH), fSpecularPower);
}
}
//-----------------------------------------------------------------------------
void SGX_Light_Point_Diffuse(
in float3 vTSNormal,
in float3 vTSToLight,
in float4 vAttParams,
in float3 vDiffuseColour,
in float3 vBaseColour,
out float3 vOut)
{
vOut = vBaseColour;
float fLightD = length(vTSToLight);
float nDotL = dot(vTSNormal, normalize(vTSToLight));
if (nDotL > 0 && fLightD <= vAttParams.x)
{
float fAtten = 1 / (vAttParams.y + vAttParams.z*fLightD + vAttParams.w*fLightD*fLightD);
vOut += vDiffuseColour * nDotL * fAtten;
}
}
//-----------------------------------------------------------------------------
void SGX_Light_Point_DiffuseSpecular(
in float3 vTSNormal,
in float3 vTSView,
in float3 vTSToLight,
in float4 vAttParams,
in float3 vDiffuseColour,
in float3 vSpecularColour,
in float fSpecularPower,
in float3 vBaseDiffuseColour,
in float3 vBaseSpecularColour,
out float3 vOutDiffuse,
out float3 vOutSpecular)
{
vOutDiffuse = vBaseDiffuseColour;
vOutSpecular = vBaseSpecularColour;
float fLightD = length(vTSToLight);
float3 vTSNegLightDirNorm = normalize(vTSToLight);
float nDotL = dot(vTSNormal, vTSNegLightDirNorm);
if (nDotL > 0 && fLightD <= vAttParams.x)
{
float3 vTSViewNorm = normalize(vTSView);
float3 vHalfWay = normalize(vTSViewNorm + vTSNegLightDirNorm);
float nDotH = dot(vTSNormal, vHalfWay);
float fAtten = 1 / (vAttParams.y + vAttParams.z*fLightD + vAttParams.w*fLightD*fLightD);
vOutDiffuse += vDiffuseColour * nDotL * fAtten;
vOutSpecular += vSpecularColour * pow(saturate(nDotH), fSpecularPower) * fAtten;
}
}
//-----------------------------------------------------------------------------
void SGX_Light_Spot_Diffuse(
in float3 vTSNormal,
in float3 vTSToLight,
in float3 vTSNegLightDir,
in float4 vAttParams,
in float3 vSpotParams,
in float3 vDiffuseColour,
in float3 vBaseColour,
out float3 vOut)
{
vOut = vBaseColour;
float fLightD = length(vTSToLight);
float3 vTSToLightNorm = normalize(vTSToLight);
float nDotL = dot(vTSNormal, vTSToLightNorm);
if (nDotL > 0 && fLightD <= vAttParams.x)
{
float3 vTSNegLightDirNorm = normalize(vTSNegLightDir);
float fAtten = 1 / (vAttParams.y + vAttParams.z*fLightD + vAttParams.w*fLightD*fLightD);
float rho = dot(vTSNegLightDirNorm, vTSToLightNorm);
float fSpotE = saturate((rho - vSpotParams.y) / (vSpotParams.x - vSpotParams.y));
float fSpotT = pow(fSpotE, vSpotParams.z);
vOut += vDiffuseColour * nDotL * fAtten * fSpotT;
}
}
//-----------------------------------------------------------------------------
void SGX_Light_Spot_DiffuseSpecular(
in float3 vTSNormal,
in float3 vTSView,
in float3 vTSToLight,
in float3 vTSNegLightDir,
in float4 vAttParams,
in float3 vSpotParams,
in float3 vDiffuseColour,
in float3 vSpecularColour,
in float fSpecularPower,
in float3 vBaseDiffuseColour,
in float3 vBaseSpecularColour,
out float3 vOutDiffuse,
out float3 vOutSpecular)
{
vOutDiffuse = vBaseDiffuseColour;
vOutSpecular = vBaseSpecularColour;
float fLightD = length(vTSToLight);
float3 vTSToLightNorm = normalize(vTSToLight);
float nDotL = dot(vTSNormal, vTSToLightNorm);
if (nDotL > 0 && fLightD <= vAttParams.x)
{
float3 vTSNegLightDirNorm = normalize(vTSNegLightDir);
float3 vTSViewNorm = normalize(vTSView);
float3 vHalfWay = normalize(vTSViewNorm + vTSNegLightDirNorm);
float nDotH = dot(vTSNormal, vHalfWay);
float fAtten = 1 / (vAttParams.y + vAttParams.z*fLightD + vAttParams.w*fLightD*fLightD);
float rho = dot(vTSNegLightDirNorm, vTSToLightNorm);
float fSpotE = saturate((rho - vSpotParams.y) / (vSpotParams.x - vSpotParams.y));
float fSpotT = pow(fSpotE, vSpotParams.z);
vOutDiffuse += vDiffuseColour * nDotL * fAtten * fSpotT;
vOutSpecular += vSpecularColour * pow(saturate(nDotH), fSpecularPower) * fAtten * fSpotT;
}
}

226
Bushin/media/RTShaderLib/SGXLib_PerPixelLighting.cg

@ -0,0 +1,226 @@
/*
-----------------------------------------------------------------------------
This source file is part of OGRE
(Object-oriented Graphics Rendering Engine)
For the latest info, see http://www.ogre3d.org
Copyright (c) 2000-2012 Torus Knot Software Ltd
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-----------------------------------------------------------------------------
*/
//-----------------------------------------------------------------------------
// Program Name: SGXLib_Lighting
// Program Desc: Per pixel lighting functions.
// Program Type: Vertex/Pixel shader
// Language: CG
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
void SGX_TransformNormal(in float4x4 m,
in float3 v,
out float3 vOut)
{
vOut = mul((float3x3)m, v);
}
//-----------------------------------------------------------------------------
void SGX_TransformPosition(in float4x4 mWorldView,
in float4 vPos,
out float3 vOut)
{
vOut = mul(mWorldView, vPos).xyz;
}
//-----------------------------------------------------------------------------
void SGX_Light_Directional_Diffuse(
in float3 vNormal,
in float3 vNegLightDirView,
in float3 vDiffuseColour,
in float3 vBaseColour,
out float3 vOut)
{
float3 vNormalView = normalize(vNormal);
float nDotL = dot(vNormalView, vNegLightDirView);
vOut = vBaseColour + vDiffuseColour * saturate(nDotL);
}
//-----------------------------------------------------------------------------
void SGX_Light_Directional_DiffuseSpecular(
in float3 vNormal,
in float3 vViewPos,
in float3 vNegLightDirView,
in float3 vDiffuseColour,
in float3 vSpecularColour,
in float fSpecularPower,
in float3 vBaseDiffuseColour,
in float3 vBaseSpecularColour,
out float3 vOutDiffuse,
out float3 vOutSpecular)
{
vOutDiffuse = vBaseDiffuseColour;
vOutSpecular = vBaseSpecularColour;
float3 vNormalView = normalize(vNormal);
float nDotL = dot(vNormalView, vNegLightDirView);
float3 vView = -normalize(vViewPos);
float3 vHalfWay = normalize(vView + vNegLightDirView);
float nDotH = dot(vNormalView, vHalfWay);
if (nDotL > 0)
{
vOutDiffuse += vDiffuseColour * nDotL;
vOutSpecular += vSpecularColour * pow(saturate(nDotH), fSpecularPower);
}
}
//-----------------------------------------------------------------------------
void SGX_Light_Point_Diffuse(
in float3 vNormal,
in float3 vViewPos,
in float3 vLightPosView,
in float4 vAttParams,
in float3 vDiffuseColour,
in float3 vBaseColour,
out float3 vOut)
{
vOut = vBaseColour;
float3 vLightView = vLightPosView - vViewPos;
float fLightD = length(vLightView);
float3 vNormalView = normalize(vNormal);
float nDotL = dot(vNormalView, normalize(vLightView));
if (nDotL > 0 && fLightD <= vAttParams.x)
{
float fAtten = 1 / (vAttParams.y + vAttParams.z*fLightD + vAttParams.w*fLightD*fLightD);
vOut += vDiffuseColour * nDotL * fAtten;
}
}
//-----------------------------------------------------------------------------
void SGX_Light_Point_DiffuseSpecular(
in float3 vNormal,
in float3 vViewPos,
in float3 vLightPosView,
in float4 vAttParams,
in float3 vDiffuseColour,
in float3 vSpecularColour,
in float fSpecularPower,
in float3 vBaseDiffuseColour,
in float3 vBaseSpecularColour,
out float3 vOutDiffuse,
out float3 vOutSpecular)
{
vOutDiffuse = vBaseDiffuseColour;
vOutSpecular = vBaseSpecularColour;
float3 vLightView = vLightPosView - vViewPos;
float fLightD = length(vLightView);
vLightView = normalize(vLightView);
float3 vNormalView = normalize(vNormal);
float nDotL = dot(vNormalView, vLightView);
if (nDotL > 0 && fLightD <= vAttParams.x)
{
float3 vView = -normalize(vViewPos);
float3 vHalfWay = normalize(vView + vLightView);
float nDotH = dot(vNormalView, vHalfWay);
float fAtten = 1 / (vAttParams.y + vAttParams.z*fLightD + vAttParams.w*fLightD*fLightD);
vOutDiffuse += vDiffuseColour * nDotL * fAtten;
vOutSpecular += vSpecularColour * pow(saturate(nDotH), fSpecularPower) * fAtten;
}
}
//-----------------------------------------------------------------------------
void SGX_Light_Spot_Diffuse(
in float3 vNormal,
in float3 vViewPos,
in float3 vLightPosView,
in float3 vNegLightDirView,
in float4 vAttParams,
in float3 vSpotParams,
in float3 vDiffuseColour,
in float3 vBaseColour,
out float3 vOut)
{
vOut = vBaseColour;
float3 vLightView = vLightPosView - vViewPos;
float fLightD = length(vLightView);
vLightView = normalize(vLightView);
float3 vNormalView = normalize(vNormal);
float nDotL = dot(vNormalView, vLightView);
if (nDotL > 0 && fLightD <= vAttParams.x)
{
float fAtten = 1 / (vAttParams.y + vAttParams.z*fLightD + vAttParams.w*fLightD*fLightD);
float rho = dot(vNegLightDirView, vLightView);
float fSpotE = saturate((rho - vSpotParams.y) / (vSpotParams.x - vSpotParams.y));
float fSpotT = pow(fSpotE, vSpotParams.z);
vOut += vDiffuseColour * nDotL * fAtten * fSpotT;
}
}
//-----------------------------------------------------------------------------
void SGX_Light_Spot_DiffuseSpecular(
in float3 vNormal,
in float3 vViewPos,
in float3 vLightPosView,
in float3 vNegLightDirView,
in float4 vAttParams,
in float3 vSpotParams,
in float3 vDiffuseColour,
in float3 vSpecularColour,
in float fSpecularPower,
in float3 vBaseDiffuseColour,
in float3 vBaseSpecularColour,
out float3 vOutDiffuse,
out float3 vOutSpecular)
{
vOutDiffuse = vBaseDiffuseColour;
vOutSpecular = vBaseSpecularColour;
float3 vLightView = vLightPosView - vViewPos;
float fLightD = length(vLightView);
vLightView = normalize(vLightView);
float3 vNormalView = normalize(vNormal);
float nDotL = dot(vNormalView, vLightView);
if (nDotL > 0 && fLightD <= vAttParams.x)
{
float3 vView = -normalize(vViewPos);
float3 vHalfWay = normalize(vView + vLightView);
float nDotH = dot(vNormalView, vHalfWay);
float fAtten = 1 / (vAttParams.y + vAttParams.z*fLightD + vAttParams.w*fLightD*fLightD);
float rho = dot(vNegLightDirView, vLightView);
float fSpotE = saturate((rho - vSpotParams.y) / (vSpotParams.x - vSpotParams.y));
float fSpotT = pow(fSpotE, vSpotParams.z);
vOutDiffuse += vDiffuseColour * nDotL * fAtten * fSpotT;
vOutSpecular += vSpecularColour * pow(saturate(nDotH), fSpecularPower) * fAtten * fSpotT;
}
}

228
Bushin/media/RTShaderLib/SGXLib_PerPixelLighting.glsl

@ -0,0 +1,228 @@
#version 120
/*
-----------------------------------------------------------------------------
This source file is part of OGRE
(Object-oriented Graphics Rendering Engine)
For the latest info, see http://www.ogre3d.org
Copyright (c) 2000-2012 Torus Knot Software Ltd
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-----------------------------------------------------------------------------
*/
//-----------------------------------------------------------------------------
// Program Name: SGXLib_Lighting
// Program Desc: Per pixel lighting functions.
// Program Type: Vertex/Pixel shader
// Language: GLSL
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
void SGX_TransformNormal(in mat4 m,
in vec3 v,
out vec3 vOut)
{
vOut = (m * vec4(v, 1.0)).xyz;
}
//-----------------------------------------------------------------------------
void SGX_TransformPosition(in mat4 mWorldView,
in vec4 vPos,
out vec3 vOut)
{
vOut = (mWorldView * vPos).xyz;
}
//-----------------------------------------------------------------------------
void SGX_Light_Directional_Diffuse(
in vec3 vNormal,
in vec3 vNegLightDirView,
in vec3 vDiffuseColour,
in vec3 vBaseColour,
out vec3 vOut)
{
vec3 vNormalView = normalize(vNormal);
float nDotL = dot(vNormalView, vNegLightDirView);
vOut = vBaseColour + vDiffuseColour * clamp(nDotL, 0.0, 1.0);
}
//-----------------------------------------------------------------------------
void SGX_Light_Directional_DiffuseSpecular(
in vec3 vNormal,
in vec3 vViewPos,
in vec3 vNegLightDirView,
in vec3 vDiffuseColour,
in vec3 vSpecularColour,
in float fSpecularPower,
in vec3 vBaseDiffuseColour,
in vec3 vBaseSpecularColour,
out vec3 vOutDiffuse,
out vec3 vOutSpecular)
{
vOutDiffuse = vBaseDiffuseColour;
vOutSpecular = vBaseSpecularColour;
vec3 vNormalView = normalize(vNormal);
float nDotL = dot(vNormalView, vNegLightDirView);
vec3 vView = -normalize(vViewPos);
vec3 vHalfWay = normalize(vView + vNegLightDirView);
float nDotH = dot(vNormalView, vHalfWay);
if (nDotL > 0.0)
{
vOutDiffuse += vDiffuseColour * nDotL;
vOutSpecular += vSpecularColour * pow(clamp(nDotH, 0.0, 1.0), fSpecularPower);
}
}
//-----------------------------------------------------------------------------
void SGX_Light_Point_Diffuse(
in vec3 vNormal,
in vec3 vViewPos,
in vec3 vLightPosView,
in vec4 vAttParams,
in vec3 vDiffuseColour,
in vec3 vBaseColour,
out vec3 vOut)
{
vOut = vBaseColour;
vec3 vLightView = vLightPosView - vViewPos;
float fLightD = length(vLightView);
vec3 vNormalView = normalize(vNormal);
float nDotL = dot(vNormalView, normalize(vLightView));
if (nDotL > 0.0 && fLightD <= vAttParams.x)
{
float fAtten = 1.0 / (vAttParams.y + vAttParams.z*fLightD + vAttParams.w*fLightD*fLightD);
vOut += vDiffuseColour * nDotL * fAtten;
}
}
//-----------------------------------------------------------------------------
void SGX_Light_Point_DiffuseSpecular(
in vec3 vNormal,
in vec3 vViewPos,
in vec3 vLightPosView,
in vec4 vAttParams,
in vec3 vDiffuseColour,
in vec3 vSpecularColour,
in float fSpecularPower,
in vec3 vBaseDiffuseColour,
in vec3 vBaseSpecularColour,
out vec3 vOutDiffuse,
out vec3 vOutSpecular)
{
vOutDiffuse = vBaseDiffuseColour;
vOutSpecular = vBaseSpecularColour;
vec3 vLightView = vLightPosView - vViewPos;
float fLightD = length(vLightView);
vLightView = normalize(vLightView);
vec3 vNormalView = normalize(vNormal);
float nDotL = dot(vNormalView, vLightView);
if (nDotL > 0.0 && fLightD <= vAttParams.x)
{
vec3 vView = -normalize(vViewPos);
vec3 vHalfWay = normalize(vView + vLightView);
float nDotH = dot(vNormalView, vHalfWay);
float fAtten = 1.0 / (vAttParams.y + vAttParams.z*fLightD + vAttParams.w*fLightD*fLightD);
vOutDiffuse += vDiffuseColour * nDotL * fAtten;
vOutSpecular += vSpecularColour * pow(clamp(nDotH, 0.0, 1.0), fSpecularPower) * fAtten;
}
}
//-----------------------------------------------------------------------------
void SGX_Light_Spot_Diffuse(
in vec3 vNormal,
in vec3 vViewPos,
in vec3 vLightPosView,
in vec3 vNegLightDirView,
in vec4 vAttParams,
in vec3 vSpotParams,
in vec3 vDiffuseColour,
in vec3 vBaseColour,
out vec3 vOut)
{
vOut = vBaseColour;
vec3 vLightView = vLightPosView - vViewPos;
float fLightD = length(vLightView);
vLightView = normalize(vLightView);
vec3 vNormalView = normalize(vNormal);
float nDotL = dot(vNormalView, vLightView);
if (nDotL > 0.0 && fLightD <= vAttParams.x)
{
float fAtten = 1.0 / (vAttParams.y + vAttParams.z*fLightD + vAttParams.w*fLightD*fLightD);
float rho = dot(vNegLightDirView, vLightView);
float fSpotE = clamp((rho - vSpotParams.y) / (vSpotParams.x - vSpotParams.y), 0.0, 1.0);
float fSpotT = pow(fSpotE, vSpotParams.z);
vOut += vDiffuseColour * nDotL * fAtten * fSpotT;
}
}
//-----------------------------------------------------------------------------
void SGX_Light_Spot_DiffuseSpecular(
in vec3 vNormal,
in vec3 vViewPos,
in vec3 vLightPosView,
in vec3 vNegLightDirView,
in vec4 vAttParams,
in vec3 vSpotParams,
in vec3 vDiffuseColour,
in vec3 vSpecularColour,
in float fSpecularPower,
in vec3 vBaseDiffuseColour,
in vec3 vBaseSpecularColour,
out vec3 vOutDiffuse,
out vec3 vOutSpecular)
{
vOutDiffuse = vBaseDiffuseColour;
vOutSpecular = vBaseSpecularColour;
vec3 vLightView = vLightPosView - vViewPos;
float fLightD = length(vLightView);
vLightView = normalize(vLightView);
vec3 vNormalView = normalize(vNormal);
float nDotL = dot(vNormalView, vLightView);
if (nDotL > 0.0 && fLightD <= vAttParams.x)
{
vec3 vView = -normalize(vViewPos);
vec3 vHalfWay = normalize(vView + vLightView);
float nDotH = dot(vNormalView, vHalfWay);
float fAtten = 1.0 / (vAttParams.y + vAttParams.z*fLightD + vAttParams.w*fLightD*fLightD);
float rho = dot(vNegLightDirView, vLightView);
float fSpotE = clamp((rho - vSpotParams.y) / (vSpotParams.x - vSpotParams.y), 0.0, 1.0);
float fSpotT = pow(fSpotE, vSpotParams.z);
vOutDiffuse += vDiffuseColour * nDotL * fAtten * fSpotT;
vOutSpecular += vSpecularColour * pow(clamp(nDotH, 0.0, 1.0), fSpecularPower) * fAtten * fSpotT;
}
}

223
Bushin/media/RTShaderLib/SGXLib_PerPixelLighting.glsles

@ -0,0 +1,223 @@
#version 100
precision highp float;
precision highp int;
precision lowp sampler2D;
precision lowp samplerCube;
/*
-----------------------------------------------------------------------------
This source file is part of OGRE
(Object-oriented Graphics Rendering Engine)
For the latest info, see http://www.ogre3d.org
Copyright (c) 2000-2012 Torus Knot Software Ltd
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-----------------------------------------------------------------------------
*/
//-----------------------------------------------------------------------------
// Program Name: SGXLib_Lighting
// Program Desc: Per pixel lighting functions.
// Program Type: Vertex/Pixel shader
// Language: GLSL ES
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
void SGX_TransformNormal(in mat4 m,
in vec3 v,
out vec3 vOut)
{
vOut = (m * vec4(v, 1.0)).xyz;
}
//-----------------------------------------------------------------------------
void SGX_TransformPosition(in mat4 mWorldView,
in vec4 vPos,
out vec3 vOut)
{
vOut = (mWorldView * vPos).xyz;
}
//-----------------------------------------------------------------------------
void SGX_Light_Directional_Diffuse(in vec3 vNormal,
in vec3 vNegLightDirView,
in vec3 vDiffuseColour,
in vec3 vBaseColour,
out vec3 vOut)
{
vec3 vNormalView = normalize(vNormal);
float nDotL = dot(vNormalView, vNegLightDirView);
vOut = vBaseColour + vDiffuseColour * clamp(nDotL, 0.0, 1.0);
}
//-----------------------------------------------------------------------------
void SGX_Light_Directional_DiffuseSpecular(in vec3 vNormal,
in vec3 vViewPos,
in vec3 vNegLightDirView,
in vec3 vDiffuseColour,
in vec3 vSpecularColour,
in float fSpecularPower,
in vec3 vBaseDiffuseColour,
in vec3 vBaseSpecularColour,
out vec3 vOutDiffuse,
out vec3 vOutSpecular)
{
vOutDiffuse = vBaseDiffuseColour;
vOutSpecular = vBaseSpecularColour;
vec3 vNormalView = normalize(vNormal);
float nDotL = dot(vNormalView, vNegLightDirView);
vec3 vView = -normalize(vViewPos);
vec3 vHalfWay = normalize(vView + vNegLightDirView);
float nDotH = dot(vNormalView, vHalfWay);
if (nDotL > 0.0)
{
vOutDiffuse += vDiffuseColour * nDotL;
vOutSpecular += vSpecularColour * pow(clamp(nDotH, 0.0, 1.0), fSpecularPower);
}
}
//-----------------------------------------------------------------------------
void SGX_Light_Point_Diffuse(in vec3 vNormal,
in vec3 vViewPos,
in vec3 vLightPosView,
in vec4 vAttParams,
in vec3 vDiffuseColour,
in vec3 vBaseColour,
out vec3 vOut)
{
vOut = vBaseColour;
vec3 vLightView = vLightPosView - vViewPos;
float fLightD = length(vLightView);
vec3 vNormalView = normalize(vNormal);
float nDotL = dot(vNormalView, normalize(vLightView));
if (nDotL > 0.0 && fLightD <= vAttParams.x)
{
float fAtten = 1.0 / (vAttParams.y + vAttParams.z * fLightD + vAttParams.w * fLightD * fLightD);
vOut += vDiffuseColour * nDotL * fAtten;
}
}
//-----------------------------------------------------------------------------
void SGX_Light_Point_DiffuseSpecular(in vec3 vNormal,
in vec3 vViewPos,
in vec3 vLightPosView,
in vec4 vAttParams,
in vec3 vDiffuseColour,
in vec3 vSpecularColour,
in float fSpecularPower,
in vec3 vBaseDiffuseColour,
in vec3 vBaseSpecularColour,
out vec3 vOutDiffuse,
out vec3 vOutSpecular)
{
vOutDiffuse = vBaseDiffuseColour;
vOutSpecular = vBaseSpecularColour;
vec3 vLightView = vLightPosView - vViewPos;
float fLightD = length(vLightView);
vLightView = normalize(vLightView);
vec3 vNormalView = normalize(vNormal);
float nDotL = dot(vNormalView, vLightView);
if (nDotL > 0.0 && fLightD <= vAttParams.x)
{
vec3 vView = -normalize(vViewPos);
vec3 vHalfWay = normalize(vView + vLightView);
float nDotH = dot(vNormalView, vHalfWay);
float fAtten = 1.0 / (vAttParams.y + vAttParams.z * fLightD + vAttParams.w * fLightD * fLightD);
vOutDiffuse += vDiffuseColour * nDotL * fAtten;
vOutSpecular += vSpecularColour * pow(clamp(nDotH, 0.0, 1.0), fSpecularPower) * fAtten;
}
}
//-----------------------------------------------------------------------------
void SGX_Light_Spot_Diffuse(in vec3 vNormal,
in vec3 vViewPos,
in vec3 vLightPosView,
in vec3 vNegLightDirView,
in vec4 vAttParams,
in vec3 vSpotParams,
in vec3 vDiffuseColour,
in vec3 vBaseColour,
out vec3 vOut)
{
vOut = vBaseColour;
vec3 vLightView = vLightPosView - vViewPos;
float fLightD = length(vLightView);
vLightView = normalize(vLightView);
vec3 vNormalView = normalize(vNormal);
float nDotL = dot(vNormalView, vLightView);
if (nDotL > 0.0 && fLightD <= vAttParams.x)
{
float fAtten = 1.0 / (vAttParams.y + vAttParams.z * fLightD + vAttParams.w * fLightD * fLightD);
float rho = dot(vNegLightDirView, vLightView);
float fSpotE = clamp((rho - vSpotParams.y) / (vSpotParams.x - vSpotParams.y), 0.0, 1.0);
float fSpotT = pow(fSpotE, vSpotParams.z);
vOut += vDiffuseColour * nDotL * fAtten * fSpotT;
}
}
//-----------------------------------------------------------------------------
void SGX_Light_Spot_DiffuseSpecular(in vec3 vNormal,
in vec3 vViewPos,
in vec3 vLightPosView,
in vec3 vNegLightDirView,
in vec4 vAttParams,
in vec3 vSpotParams,
in vec3 vDiffuseColour,
in vec3 vSpecularColour,
in float fSpecularPower,
in vec3 vBaseDiffuseColour,
in vec3 vBaseSpecularColour,
out vec3 vOutDiffuse,
out vec3 vOutSpecular)
{
vOutDiffuse = vBaseDiffuseColour;
vOutSpecular = vBaseSpecularColour;
vec3 vLightView = vLightPosView - vViewPos;
float fLightD = length(vLightView);
vLightView = normalize(vLightView);
vec3 vNormalView = normalize(vNormal);
float nDotL = dot(vNormalView, vLightView);
if (nDotL > 0.0 && fLightD <= vAttParams.x)
{
vec3 vView = -normalize(vViewPos);
vec3 vHalfWay = normalize(vView + vLightView);
float nDotH = dot(vNormalView, vHalfWay);
float fAtten = 1.0 / (vAttParams.y + vAttParams.z * fLightD + vAttParams.w * fLightD * fLightD);
float rho = dot(vNegLightDirView, vLightView);
float fSpotE = clamp((rho - vSpotParams.y) / (vSpotParams.x - vSpotParams.y), 0.0, 1.0);
float fSpotT = pow(fSpotE, vSpotParams.z);
vOutDiffuse += vDiffuseColour * nDotL * fAtten * fSpotT;
vOutSpecular += vSpecularColour * pow(clamp(nDotH, 0.0, 1.0), fSpecularPower) * fAtten * fSpotT;
}
}

226
Bushin/media/RTShaderLib/SGXLib_PerPixelLighting.hlsl

@ -0,0 +1,226 @@
/*
-----------------------------------------------------------------------------
This source file is part of OGRE
(Object-oriented Graphics Rendering Engine)
For the latest info, see http://www.ogre3d.org
Copyright (c) 2000-2012 Torus Knot Software Ltd
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-----------------------------------------------------------------------------
*/
//-----------------------------------------------------------------------------
// Program Name: SGXLib_Lighting
// Program Desc: Per pixel lighting functions.
// Program Type: Vertex/Pixel shader
// Language: HLSL
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
void SGX_TransformNormal(in float4x4 m,
in float3 v,
out float3 vOut)
{
vOut = mul((float3x3)m, v);
}
//-----------------------------------------------------------------------------
void SGX_TransformPosition(in float4x4 mWorldView,
in float4 vPos,
out float3 vOut)
{
vOut = mul(mWorldView, vPos).xyz;
}
//-----------------------------------------------------------------------------
void SGX_Light_Directional_Diffuse(
in float3 vNormal,
in float3 vNegLightDirView,
in float3 vDiffuseColour,
in float3 vBaseColour,
out float3 vOut)
{
float3 vNormalView = normalize(vNormal);
float nDotL = dot(vNormalView, vNegLightDirView);
vOut = vBaseColour + vDiffuseColour * saturate(nDotL);
}
//-----------------------------------------------------------------------------
void SGX_Light_Directional_DiffuseSpecular(
in float3 vNormal,
in float3 vViewPos,
in float3 vNegLightDirView,
in float3 vDiffuseColour,
in float3 vSpecularColour,
in float fSpecularPower,
in float3 vBaseDiffuseColour,
in float3 vBaseSpecularColour,
out float3 vOutDiffuse,
out float3 vOutSpecular)
{
vOutDiffuse = vBaseDiffuseColour;
vOutSpecular = vBaseSpecularColour;
float3 vNormalView = normalize(vNormal);
float nDotL = dot(vNormalView, vNegLightDirView);
float3 vView = -normalize(vViewPos);
float3 vHalfWay = normalize(vView + vNegLightDirView);
float nDotH = dot(vNormalView, vHalfWay);
if (nDotL > 0)
{
vOutDiffuse += vDiffuseColour * nDotL;
vOutSpecular += vSpecularColour * pow(saturate(nDotH), fSpecularPower);
}
}
//-----------------------------------------------------------------------------
void SGX_Light_Point_Diffuse(
in float3 vNormal,
in float3 vViewPos,
in float3 vLightPosView,
in float4 vAttParams,
in float3 vDiffuseColour,
in float3 vBaseColour,
out float3 vOut)
{
vOut = vBaseColour;
float3 vLightView = vLightPosView - vViewPos;
float fLightD = length(vLightView);
float3 vNormalView = normalize(vNormal);
float nDotL = dot(vNormalView, normalize(vLightView));
if (nDotL > 0 && fLightD <= vAttParams.x)
{
float fAtten = 1 / (vAttParams.y + vAttParams.z*fLightD + vAttParams.w*fLightD*fLightD);
vOut += vDiffuseColour * nDotL * fAtten;
}
}
//-----------------------------------------------------------------------------
void SGX_Light_Point_DiffuseSpecular(
in float3 vNormal,
in float3 vViewPos,
in float3 vLightPosView,
in float4 vAttParams,
in float3 vDiffuseColour,
in float3 vSpecularColour,
in float fSpecularPower,
in float3 vBaseDiffuseColour,
in float3 vBaseSpecularColour,
out float3 vOutDiffuse,
out float3 vOutSpecular)
{
vOutDiffuse = vBaseDiffuseColour;
vOutSpecular = vBaseSpecularColour;
float3 vLightView = vLightPosView - vViewPos;
float fLightD = length(vLightView);
vLightView = normalize(vLightView);
float3 vNormalView = normalize(vNormal);
float nDotL = dot(vNormalView, vLightView);
if (nDotL > 0 && fLightD <= vAttParams.x)
{
float3 vView = -normalize(vViewPos);
float3 vHalfWay = normalize(vView + vLightView);
float nDotH = dot(vNormalView, vHalfWay);
float fAtten = 1 / (vAttParams.y + vAttParams.z*fLightD + vAttParams.w*fLightD*fLightD);
vOutDiffuse += vDiffuseColour * nDotL * fAtten;
vOutSpecular += vSpecularColour * pow(saturate(nDotH), fSpecularPower) * fAtten;
}
}
//-----------------------------------------------------------------------------
void SGX_Light_Spot_Diffuse(
in float3 vNormal,
in float3 vViewPos,
in float3 vLightPosView,
in float3 vNegLightDirView,
in float4 vAttParams,
in float3 vSpotParams,
in float3 vDiffuseColour,
in float3 vBaseColour,
out float3 vOut)
{
vOut = vBaseColour;
float3 vLightView = vLightPosView - vViewPos;
float fLightD = length(vLightView);
vLightView = normalize(vLightView);
float3 vNormalView = normalize(vNormal);
float nDotL = dot(vNormalView, vLightView);
if (nDotL > 0 && fLightD <= vAttParams.x)
{
float fAtten = 1 / (vAttParams.y + vAttParams.z*fLightD + vAttParams.w*fLightD*fLightD);
float rho = dot(vNegLightDirView, vLightView);
float fSpotE = saturate((rho - vSpotParams.y) / (vSpotParams.x - vSpotParams.y));
float fSpotT = pow(fSpotE, vSpotParams.z);
vOut += vDiffuseColour * nDotL * fAtten * fSpotT;
}
}
//-----------------------------------------------------------------------------
void SGX_Light_Spot_DiffuseSpecular(
in float3 vNormal,
in float3 vViewPos,
in float3 vLightPosView,
in float3 vNegLightDirView,
in float4 vAttParams,
in float3 vSpotParams,
in float3 vDiffuseColour,
in float3 vSpecularColour,
in float fSpecularPower,
in float3 vBaseDiffuseColour,
in float3 vBaseSpecularColour,
out float3 vOutDiffuse,
out float3 vOutSpecular)
{
vOutDiffuse = vBaseDiffuseColour;
vOutSpecular = vBaseSpecularColour;
float3 vLightView = vLightPosView - vViewPos;
float fLightD = length(vLightView);
vLightView = normalize(vLightView);
float3 vNormalView = normalize(vNormal);
float nDotL = dot(vNormalView, vLightView);
if (nDotL > 0 && fLightD <= vAttParams.x)
{
float3 vView = -normalize(vViewPos);
float3 vHalfWay = normalize(vView + vLightView);
float nDotH = dot(vNormalView, vHalfWay);
float fAtten = 1 / (vAttParams.y + vAttParams.z*fLightD + vAttParams.w*fLightD*fLightD);
float rho = dot(vNegLightDirView, vLightView);
float fSpotE = saturate((rho - vSpotParams.y) / (vSpotParams.x - vSpotParams.y));
float fSpotT = pow(fSpotE, vSpotParams.z);
vOutDiffuse += vDiffuseColour * nDotL * fAtten * fSpotT;
vOutSpecular += vSpecularColour * pow(saturate(nDotH), fSpecularPower) * fAtten * fSpotT;
}
}

98
Bushin/media/RTShaderLib/SGXLib_TextureAtlas.cg

@ -0,0 +1,98 @@
//-----------------------------------------------------------------------------
// Program Name: SGXLib_IntegratedPSSM
// Program Desc: Texture Atlas functions.
// Program Type: Vertex/Pixel shader
// Language: CG
//-----------------------------------------------------------------------------
float mipmapLevel(float2 coords, float2 texSize)
{
float2 coordInPix = coords * texSize;
float2 dx = ddx(coordInPix);
float2 dy = ddy(coordInPix);
float d = max(dot(dx, dx), dot(dy, dy));
return 0.4 * log2(d);
}
//-----------------------------------------------------------------------------
void SGX_Atlas_Sample(in sampler2D sample,
in float2 origTexcoord,
in float2 atlasTexcoord,
in float4 textureData,
in float2 imageSize,
out float4 texel)
{
//
// Most of the idea for this function has been taken from the code under the webpage:
// http://www.gamedev.net/topic/534149-solved-texture-seams-using-atlas-with-screenshots/
// origTexcoord - original texture coordintates as recived from the vertex buffer.
// atlasTexcoord - texture coordinates that have gone through on which diffrent mathematical
// functions to simulate diffrent texture addressing modes (wrap, mirror, clamp)
// textureData.xy - top left corner (in 0-1 units) where the needed texture in the texture atlas begins
// textureData.zw - width and height in power of 2 for the needed texture in the texture atlas
// imageSize - size of the image in pixels
// texel - [Output] The color of the pixel at the requested position
float2 startPos = textureData.xy;
// calculate the tileSize by using the power of 2 value
//float2 pwrs = float2(6,6);
float2 pwrs = textureData.zw;
float pwr = min(pwrs.x,pwrs.y) - 2;
float2 tileSize = pow(float2(2.0,2.0),pwrs);
// retrieve the mipmap level for this pixel clamped by the power of 2 value
float lod = clamp(mipmapLevel(origTexcoord, tileSize), 0, pwr);
// get the width/height of the mip surface we've decided on
float mipSize = pow(2.0, pwr - lod);
// compute the inverse fraction size for the tile
//float2 lodSize = mipSize * imageSize / tileSize;
float2 lodSizeInv = tileSize / (mipSize * imageSize);
//compute the new coordinates
//atlasTexcoord = atlasTexcoord * ((lodSize * (tileSize / imageSize) - 1.0) / lodSize) + (0.5 / lodSize) + startPos;
atlasTexcoord = atlasTexcoord * ((tileSize / imageSize) - lodSizeInv) + (0.5 * lodSizeInv) + startPos;
//return the pixel from the correct mip surface of the atlas
texel = tex2Dlod(sample, float4(atlasTexcoord, 0, lod));
}
//-----------------------------------------------------------------------------
void SGX_Atlas_Wrap(in float inpCoord, out float outCoord)
{
outCoord = frac(inpCoord);
}
//-----------------------------------------------------------------------------
void SGX_Atlas_Clamp(in float inpCoord, out float outCoord)
{
outCoord = saturate(inpCoord);
}
//-----------------------------------------------------------------------------
void SGX_Atlas_Mirror(in float inpCoord, out float outCoord)
{
outCoord = (inpCoord + 1) * 0.5;
outCoord = abs(frac(outCoord) * 2 - 1);
}
//-----------------------------------------------------------------------------
void SGX_Atlas_Border(in float inpCoord, out float outCoord)
{
//
//The shader needs to check whether the original texcoord are beyond the 0,1 range.
//The shader attempts to do so without using if statments which are complicated for shaders
//
//if texcoord is in the 0,1 range then check will equal 0,
//Otherwise it will equal the number 1 or greater
float check = step(inpCoord, 0) + step(1, inpCoord);
//using the check value transport the value of the texcoord beyond the 0,1 range so it will
//recive the border color
outCoord = abs(inpCoord) + check * 2;
}

99
Bushin/media/RTShaderLib/SGXLib_TextureAtlas.glsl

@ -0,0 +1,99 @@
//-----------------------------------------------------------------------------
// Program Name: SGXLib_IntegratedPSSM
// Program Desc: Texture Atlas functions.
// Program Type: Vertex/Pixel shader
// Language: GLSL
//-----------------------------------------------------------------------------
float mipmapLevel(vec2 coords, vec2 texSize)
{
float2 coordInPix = coords * texSize;
float2 dx = ddx(coordInPix);
float2 dy = ddy(coordInPix);
float d = max(dot(dx, dx), dot(dy, dy));
return 0.4 * log2(d);
}
//-----------------------------------------------------------------------------
void SGX_Atlas_Sample(in sampler2D sample,
in vec2 origTexcoord,
in vec2 atlasTexcoord,
in vec4 textureData,
in vec2 imageSize,
out vec4 texel)
{
//
// Most of the idea for this function has been taken from the code under the webpage:
// http://www.gamedev.net/topic/534149-solved-texture-seams-using-atlas-with-screenshots/
// origTexcoord - original texture coordintates as recived from the vertex buffer.
// atlasTexcoord - texture coordinates that have gone through on which diffrent mathematical
// functions to simulate diffrent texture addressing modes (wrap, mirror, clamp)
// textureData.xy - top left corner (in 0-1 units) where the needed texture in the texture atlas begins
// textureData.zw - width and height in power of 2 for the needed texture in the texture atlas
// imageSize - size of the image in pixels
// texel - [Output] The color of the pixel at the requested position
float2 startPos = textureData.xy;
// calculate the tileSize by using the power of 2 value
//float2 pwrs = float2(6,6);
float2 pwrs = textureData.zw;
float pwr = min(pwrs.x,pwrs.y) - 2;
float2 tileSize = pow(float2(2.0,2.0),pwrs);
// retrieve the mipmap level for this pixel clamped by the power of 2 value
float lod = clamp(mipmapLevel(origTexcoord, tileSize), 0, pwr);
// get the width/height of the mip surface we've decided on
float mipSize = pow(2.0, pwr - lod);
// compute the inverse fraction size for the tile
//float2 lodSize = mipSize * imageSize / tileSize;
float2 lodSizeInv = tileSize / (mipSize * imageSize);
//compute the new coordinates
//atlasTexcoord = atlasTexcoord * ((lodSize * (tileSize / imageSize) - 1.0) / lodSize) + (0.5 / lodSize) + startPos;
atlasTexcoord = atlasTexcoord * ((tileSize / imageSize) - lodSizeInv) + (0.5 * lodSizeInv) + startPos;
//return the pixel from the correct mip surface of the atlas
texel = texture2DLod(sample, float4(atlasTexcoord, 0, lod));
}
//-----------------------------------------------------------------------------
void SGX_Atlas_Wrap(in float inpCoord, out float outCoord)
{
outCoord = frac(inpCoord);
}
//-----------------------------------------------------------------------------
void SGX_Atlas_Clamp(in float inpCoord, out float outCoord)
{
outCoord = clamp(inpCoord, 0.0, 1.0);
}
//-----------------------------------------------------------------------------
void SGX_Atlas_Mirror(in float inpCoord, out float outCoord)
{
outCoord = (inpCoord + 1) * 0.5;
outCoord = abs(frac(outCoord) * 2 - 1);
}
//-----------------------------------------------------------------------------
void SGX_Atlas_Border(in float inpCoord, out float outCoord)
{
//
//The shader needs to check whether the original texcoord are beyond the 0,1 range.
//The shader attempts to do so without using if statments which are complicated for shaders
//
//if texcoord is in the 0,1 range then check will equal 0,
//Otherwise it will equal the number 1 or greater
float check = step(inpCoord, 0) + step(1, inpCoord);
//using the check value transport the value of the texcoord beyond the 0,1 range so it will
//recive the border color
outCoord = abs(inpCoord) + check * 2;
}

99
Bushin/media/RTShaderLib/SGXLib_TextureAtlas.glsles

@ -0,0 +1,99 @@
//-----------------------------------------------------------------------------
// Program Name: SGXLib_IntegratedPSSM
// Program Desc: Texture Atlas functions.
// Program Type: Vertex/Pixel shader
// Language: GLSLES
//-----------------------------------------------------------------------------
float mipmapLevel(vec2 coords, vec2 texSize)
{
float2 coordInPix = coords * texSize;
float2 dx = ddx(coordInPix);
float2 dy = ddy(coordInPix);
float d = max(dot(dx, dx), dot(dy, dy));
return 0.4 * log2(d);
}
//-----------------------------------------------------------------------------
void SGX_Atlas_Sample(in sampler2D sample,
in vec2 origTexcoord,
in vec2 atlasTexcoord,
in vec4 textureData,
in vec2 imageSize,
out vec4 texel)
{
//
// Most of the idea for this function has been taken from the code under the webpage:
// http://www.gamedev.net/topic/534149-solved-texture-seams-using-atlas-with-screenshots/
// origTexcoord - original texture coordintates as recived from the vertex buffer.
// atlasTexcoord - texture coordinates that have gone through on which diffrent mathematical
// functions to simulate diffrent texture addressing modes (wrap, mirror, clamp)
// textureData.xy - top left corner (in 0-1 units) where the needed texture in the texture atlas begins
// textureData.zw - width and height in power of 2 for the needed texture in the texture atlas
// imageSize - size of the image in pixels
// texel - [Output] The color of the pixel at the requested position
float2 startPos = textureData.xy;
// calculate the tileSize by using the power of 2 value
//float2 pwrs = float2(6,6);
float2 pwrs = textureData.zw;
float pwr = min(pwrs.x,pwrs.y) - 2;
float2 tileSize = pow(float2(2.0,2.0),pwrs);
// retrieve the mipmap level for this pixel clamped by the power of 2 value
float lod = clamp(mipmapLevel(origTexcoord, tileSize), 0, pwr);
// get the width/height of the mip surface we've decided on
float mipSize = pow(2.0, pwr - lod);
// compute the inverse fraction size for the tile
//float2 lodSize = mipSize * imageSize / tileSize;
float2 lodSizeInv = tileSize / (mipSize * imageSize);
//compute the new coordinates
//atlasTexcoord = atlasTexcoord * ((lodSize * (tileSize / imageSize) - 1.0) / lodSize) + (0.5 / lodSize) + startPos;
atlasTexcoord = atlasTexcoord * ((tileSize / imageSize) - lodSizeInv) + (0.5 * lodSizeInv) + startPos;
//return the pixel from the correct mip surface of the atlas
texel = texture2DLod(sample, float4(atlasTexcoord, 0, lod));
}
//-----------------------------------------------------------------------------
void SGX_Atlas_Wrap(in float inpCoord, out float outCoord)
{
outCoord = frac(inpCoord);
}
//-----------------------------------------------------------------------------
void SGX_Atlas_Clamp(in float inpCoord, out float outCoord)
{
outCoord = clamp(inpCoord, 0.0, 1.0);
}
//-----------------------------------------------------------------------------
void SGX_Atlas_Mirror(in float inpCoord, out float outCoord)
{
outCoord = (inpCoord + 1) * 0.5;
outCoord = abs(frac(outCoord) * 2 - 1);
}
//-----------------------------------------------------------------------------
void SGX_Atlas_Border(in float inpCoord, out float outCoord)
{
//
//The shader needs to check whether the original texcoord are beyond the 0,1 range.
//The shader attempts to do so without using if statments which are complicated for shaders
//
//if texcoord is in the 0,1 range then check will equal 0,
//Otherwise it will equal the number 1 or greater
float check = step(inpCoord, 0) + step(1, inpCoord);
//using the check value transport the value of the texcoord beyond the 0,1 range so it will
//recive the border color
outCoord = abs(inpCoord) + check * 2;
}

99
Bushin/media/RTShaderLib/SGXLib_TextureAtlas.hlsl

@ -0,0 +1,99 @@
//-----------------------------------------------------------------------------
// Program Name: SGXLib_IntegratedPSSM
// Program Desc: Texture Atlas functions.
// Program Type: Vertex/Pixel shader
// Language: HLSL
//-----------------------------------------------------------------------------
float mipmapLevel(float2 coords, float2 texSize)
{
float2 coordInPix = coords * texSize;
float2 dx = ddx(coordInPix);
float2 dy = ddy(coordInPix);
float d = max(dot(dx, dx), dot(dy, dy));
return 0.4 * log2(d);
}
//-----------------------------------------------------------------------------
void SGX_Atlas_Sample(in sampler2D sample,
in float2 origTexcoord,
in float2 atlasTexcoord,
in float4 textureData,
in float2 imageSize,
out float4 texel)
{
//
// Most of the idea for this function has been taken from the code under the webpage:
// http://www.gamedev.net/topic/534149-solved-texture-seams-using-atlas-with-screenshots/
// origTexcoord - original texture coordintates as recived from the vertex buffer.
// atlasTexcoord - texture coordinates that have gone through on which diffrent mathematical
// functions to simulate diffrent texture addressing modes (wrap, mirror, clamp)
// textureData.xy - top left corner (in 0-1 units) where the needed texture in the texture atlas begins
// textureData.zw - width and height in power of 2 for the needed texture in the texture atlas
// imageSize - size of the image in pixels
// texel - [Output] The color of the pixel at the requested position
float2 startPos = textureData.xy;
// calculate the tileSize by using the power of 2 value
//float2 pwrs = float2(6,6);
float2 pwrs = textureData.zw;
float pwr = min(pwrs.x,pwrs.y) - 2;
float2 tileSize = pow(float2(2.0,2.0),pwrs);
// retrieve the mipmap level for this pixel clamped by the power of 2 value
float lod = clamp(mipmapLevel(origTexcoord, tileSize), 0, pwr);
// get the width/height of the mip surface we've decided on
float mipSize = pow(2.0, pwr - lod);
// compute the inverse fraction size for the tile
//float2 lodSize = mipSize * imageSize / tileSize;
float2 lodSizeInv = tileSize / (mipSize * imageSize);
//compute the new coordinates
//atlasTexcoord = atlasTexcoord * ((lodSize * (tileSize / imageSize) - 1.0) / lodSize) + (0.5 / lodSize) + startPos;
atlasTexcoord = atlasTexcoord * ((tileSize / imageSize) - lodSizeInv) + (0.5 * lodSizeInv) + startPos;
//return the pixel from the correct mip surface of the atlas
texel = tex2Dlod(sample, float4(atlasTexcoord, 0, lod));
}
//-----------------------------------------------------------------------------
void SGX_Atlas_Wrap(in float inpCoord, out float outCoord)
{
outCoord = frac(inpCoord);
}
//-----------------------------------------------------------------------------
void SGX_Atlas_Clamp(in float inpCoord, out float outCoord)
{
outCoord = saturate(inpCoord);
}
//-----------------------------------------------------------------------------
void SGX_Atlas_Mirror(in float inpCoord, out float outCoord)
{
outCoord = (inpCoord + 1) * 0.5;
outCoord = abs(frac(outCoord) * 2 - 1);
}
//-----------------------------------------------------------------------------
void SGX_Atlas_Border(in float inpCoord, out float outCoord)
{
//
//The shader needs to check whether the original texcoord are beyond the 0,1 range.
//The shader attempts to do so without using if statments which are complicated for shaders
//
//if texcoord is in the 0,1 range then check will equal 0,
//Otherwise it will equal the number 1 or greater
float check = step(inpCoord, 0) + step(1, inpCoord);
//using the check value transport the value of the texcoord beyond the 0,1 range so it will
//recive the border color
outCoord = abs(inpCoord) + check * 2;
}

76
Bushin/media/RTShaderLib/SampleLib_InstancedViewports.cg

@ -0,0 +1,76 @@
/*
-----------------------------------------------------------------------------
This source file is part of OGRE
(Object-oriented Graphics Rendering Engine)
For the latest info, see http://www.ogre3d.org
Copyright (c) 2000-2012 Torus Knot Software Ltd
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-----------------------------------------------------------------------------
*/
//-----------------------------------------------------------------------------
// Transform the output position to the current "monitor"
//-----------------------------------------------------------------------------
void SGX_InstancedViewportsTransform(
in float4 i_position,
in float4x4 i_worldViewMatrix,
in float4x4 i_projectionMatrix,
in float4 i_viewportOffsetMatrixR0,
in float4 i_viewportOffsetMatrixR1,
in float4 i_viewportOffsetMatrixR2,
in float4 i_viewportOffsetMatrixR3,
in float2 i_monitorsCount,
in float4 i_monitorIndex,
out float4 o_position)
{
o_position = mul(i_worldViewMatrix, i_position);
float4x4 viewportOffset = float4x4(i_viewportOffsetMatrixR0,
i_viewportOffsetMatrixR1,
i_viewportOffsetMatrixR2,
i_viewportOffsetMatrixR3
);
o_position = mul(viewportOffset, o_position);
o_position = mul(i_projectionMatrix, o_position);
float2 monitorIndexNorm =i_monitorIndex.xy - ((i_monitorsCount - 1.0)/ 2.0) ;
o_position.xy =
(o_position.xy + (o_position.w * monitorIndexNorm)*2.0) / i_monitorsCount ;
};
//-----------------------------------------------------------------------------
// Discard any pixel that is outside the bounds of the current "monitor"
//-----------------------------------------------------------------------------
void SGX_InstancedViewportsDiscardOutOfBounds(
in float2 i_monitorsCount,
in float4 i_monitorIndex,
in float4 i_positionProjectiveSpace)
{
float2 boxedXY = i_positionProjectiveSpace.xy / (i_positionProjectiveSpace.w * 2);
boxedXY = (boxedXY + 0.5) * i_monitorsCount;
float2 middleMonitor = ((i_monitorIndex.xy + 0.5));
boxedXY = abs(boxedXY - middleMonitor);
float maxM = max(boxedXY.x,boxedXY.y);
if (maxM >= 0.5)
{
discard;
}
}

78
Bushin/media/RTShaderLib/SampleLib_InstancedViewports.glsl

@ -0,0 +1,78 @@
/*
-----------------------------------------------------------------------------
This source file is part of OGRE
(Object-oriented Graphics Rendering Engine)
For the latest info, see http://www.ogre3d.org
Copyright (c) 2000-2012 Torus Knot Software Ltd
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-----------------------------------------------------------------------------
*/
//-----------------------------------------------------------------------------
// Transform the output position to the current "monitor"
//-----------------------------------------------------------------------------
void SGX_InstancedViewportsTransform(
in vec4 i_position,
in mat4 i_worldViewMatrix,
in mat4 i_projectionMatrix,
in vec4 i_viewportOffsetMatrixR0,
in vec4 i_viewportOffsetMatrixR1,
in vec4 i_viewportOffsetMatrixR2,
in vec4 i_viewportOffsetMatrixR3,
in vec2 i_monitorsCount,
in vec4 i_monitorIndex,
out vec4 o_position)
{
o_position = i_worldViewMatrix * i_position;
mat4 viewportOffset = mat4(i_viewportOffsetMatrixR0,
i_viewportOffsetMatrixR1,
i_viewportOffsetMatrixR2,
i_viewportOffsetMatrixR3
);
o_position = viewportOffset * o_position;
o_position = i_projectionMatrix * o_position;
vec2 monitorIndexNorm = i_monitorIndex.xy - (i_monitorsCount - 1.0)/2.0;
o_position.xy =
(o_position.xy + (o_position.w * monitorIndexNorm)*2.0) / i_monitorsCount;
};
//-----------------------------------------------------------------------------
// Discard any pixel that is outside the bounds of the current "monitor"
//-----------------------------------------------------------------------------
void SGX_InstancedViewportsDiscardOutOfBounds(
in vec2 i_monitorsCount,
in vec4 i_monitorIndex,
in vec4 i_positionProjectiveSpace)
{
vec2 boxedXY = i_positionProjectiveSpace.xy / (i_positionProjectiveSpace.w * 2.0);
boxedXY = (boxedXY + 0.5) * i_monitorsCount;
vec2 middleMonitor = ((i_monitorIndex.xy + 0.5));
boxedXY = abs(boxedXY - middleMonitor);
float maxM = max(boxedXY.x,boxedXY.y);
if (maxM >= 0.5)
{
discard;
}
}

76
Bushin/media/RTShaderLib/SampleLib_InstancedViewports.hlsl

@ -0,0 +1,76 @@
/*
-----------------------------------------------------------------------------
This source file is part of OGRE
(Object-oriented Graphics Rendering Engine)
For the latest info, see http://www.ogre3d.org
Copyright (c) 2000-2012 Torus Knot Software Ltd
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-----------------------------------------------------------------------------
*/
//-----------------------------------------------------------------------------
// Transform the output position to the current "monitor"
//-----------------------------------------------------------------------------
void SGX_InstancedViewportsTransform(
in float4 i_position,
in float4x4 i_worldViewMatrix,
in float4x4 i_projectionMatrix,
in float4 i_viewportOffsetMatrixR0,
in float4 i_viewportOffsetMatrixR1,
in float4 i_viewportOffsetMatrixR2,
in float4 i_viewportOffsetMatrixR3,
in float2 i_monitorsCount,
in float4 i_monitorIndex,
out float4 o_position)
{
o_position = mul(i_worldViewMatrix, i_position);
float4x4 viewportOffset = float4x4(i_viewportOffsetMatrixR0,
i_viewportOffsetMatrixR1,
i_viewportOffsetMatrixR2,
i_viewportOffsetMatrixR3
);
o_position = mul(viewportOffset, o_position);
o_position = mul(i_projectionMatrix, o_position);
float2 monitorIndexNorm =i_monitorIndex.xy - ((i_monitorsCount - 1.0)/ 2.0) ;
o_position.xy =
(o_position.xy + (o_position.w * monitorIndexNorm)*2.0) / i_monitorsCount ;
};
//-----------------------------------------------------------------------------
// Discard any pixel that is outside the bounds of the current "monitor"
//-----------------------------------------------------------------------------
void SGX_InstancedViewportsDiscardOutOfBounds(
in float2 i_monitorsCount,
in float4 i_monitorIndex,
in float4 i_positionProjectiveSpace)
{
float2 boxedXY = i_positionProjectiveSpace.xy / (i_positionProjectiveSpace.w * 2);
boxedXY = (boxedXY + 0.5) * i_monitorsCount;
float2 middleMonitor = ((i_monitorIndex.xy + 0.5));
boxedXY = abs(boxedXY - middleMonitor);
float maxM = max(boxedXY.x,boxedXY.y);
if (maxM >= 0.5)
{
discard;
}
}

62
Bushin/media/RTShaderLib/SampleLib_ReflectionMap.cg

@ -0,0 +1,62 @@
/*
-----------------------------------------------------------------------------
This source file is part of OGRE
(Object-oriented Graphics Rendering Engine)
For the latest info, see http://www.ogre3d.org
Copyright (c) 2000-2012 Torus Knot Software Ltd
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-----------------------------------------------------------------------------
*/
//-----------------------------------------------------------------------------
// Simple masked reflection map effect.
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
void SGX_ApplyReflectionMap(in sampler2D maskSampler,
in float2 maskSamplerTexCoord,
in sampler2D reflectionSampler,
in float2 reflectionSamplerTexCoord,
in float3 baseColor,
in float reflectionPower,
out float3 vOut)
{
float3 maskTexel = tex2D(maskSampler, maskSamplerTexCoord).xyz;
float3 reflectionTexel = tex2D(reflectionSampler, reflectionSamplerTexCoord).xyz;
vOut = baseColor + reflectionTexel.xyz*maskTexel.xyz*reflectionPower;
}
//-----------------------------------------------------------------------------
void SGX_ApplyReflectionMap(in sampler2D maskSampler,
in float2 maskSamplerTexCoord,
in samplerCUBE reflectionSampler,
in float3 reflectionSamplerTexCoord,
in float3 baseColor,
in float reflectionPower,
out float3 vOut)
{
float3 maskTexel = tex2D(maskSampler, maskSamplerTexCoord).xyz;
float3 reflectionTexel = texCUBE(reflectionSampler, reflectionSamplerTexCoord).xyz;
vOut = baseColor + reflectionTexel.xyz*maskTexel.xyz*reflectionPower;
}

65
Bushin/media/RTShaderLib/SampleLib_ReflectionMap.glsl

@ -0,0 +1,65 @@
#version 120
/*
-----------------------------------------------------------------------------
This source file is part of OGRE
(Object-oriented Graphics Rendering Engine)
For the latest info, see http://www.ogre3d.org
Copyright (c) 2000-2012 Torus Knot Software Ltd
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-----------------------------------------------------------------------------
*/
//-----------------------------------------------------------------------------
// Simple masked reflection map effect.
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
void SGX_ApplyReflectionMap(in sampler2D maskSampler,
in vec2 maskSamplerTexCoord,
in sampler2D reflectionSampler,
in vec2 reflectionSamplerTexCoord,
in vec3 baseColor,
in float reflectionPower,
out vec3 vOut)
{
vec3 maskTexel = texture2D(maskSampler, maskSamplerTexCoord).xyz;
reflectionSamplerTexCoord.y = -reflectionSamplerTexCoord.y; // Hack for gl
vec3 reflectionTexel = texture2D(reflectionSampler, reflectionSamplerTexCoord).xyz;
vOut = baseColor + reflectionTexel.xyz*maskTexel.xyz*reflectionPower;
}
//-----------------------------------------------------------------------------
void SGX_ApplyReflectionMap(in sampler2D maskSampler,
in vec2 maskSamplerTexCoord,
in samplerCube reflectionSampler,
in vec3 reflectionSamplerTexCoord,
in vec3 baseColor,
in float reflectionPower,
out vec3 vOut)
{
vec3 maskTexel = texture2D(maskSampler, maskSamplerTexCoord).xyz;
reflectionSamplerTexCoord.z = -reflectionSamplerTexCoord.z; // Hack for gl
vec3 reflectionTexel = textureCube(reflectionSampler, reflectionSamplerTexCoord).xyz;
vOut = baseColor + reflectionTexel.xyz*maskTexel.xyz*reflectionPower;
}

67
Bushin/media/RTShaderLib/SampleLib_ReflectionMap.glsles

@ -0,0 +1,67 @@
#version 100
precision highp float;
precision highp int;
precision lowp sampler2D;
precision lowp samplerCube;
/*
-----------------------------------------------------------------------------
This source file is part of OGRE
(Object-oriented Graphics Rendering Engine)
For the latest info, see http://www.ogre3d.org
Copyright (c) 2000-2012 Torus Knot Software Ltd
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-----------------------------------------------------------------------------
*/
//-----------------------------------------------------------------------------
// Simple masked reflection map effect.
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
void SGX_ApplyReflectionMap(in sampler2D maskSampler,
in vec2 maskSamplerTexCoord,
in sampler2D reflectionSampler,
in vec2 reflectionSamplerTexCoord,
in vec3 baseColor,
in float reflectionPower,
out vec3 vOut)
{
vec3 maskTexel = texture2D(maskSampler, maskSamplerTexCoord).xyz;
reflectionSamplerTexCoord.y = -reflectionSamplerTexCoord.y; // Hack for gl
vec3 reflectionTexel = texture2D(reflectionSampler, reflectionSamplerTexCoord).xyz;
vOut = baseColor + reflectionTexel.xyz * maskTexel.xyz * reflectionPower;
}
//-----------------------------------------------------------------------------
void SGX_ApplyReflectionMap(in sampler2D maskSampler,
in vec2 maskSamplerTexCoord,
in samplerCube reflectionSampler,
in vec3 reflectionSamplerTexCoord,
in vec3 baseColor,
in float reflectionPower,
out vec3 vOut)
{
vec3 maskTexel = texture2D(maskSampler, maskSamplerTexCoord).xyz;
reflectionSamplerTexCoord.z = -reflectionSamplerTexCoord.z; // Hack for gl
vec3 reflectionTexel = textureCube(reflectionSampler, reflectionSamplerTexCoord).xyz;
vOut = baseColor + reflectionTexel.xyz * maskTexel.xyz * reflectionPower;
}

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save