ExamplePostEffect.cs 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. //-----------------------------------------------------------------------------
  2. // Copyright (c) 2012 GarageGames, LLC
  3. //
  4. // Permission is hereby granted, free of charge, to any person obtaining a copy
  5. // of this software and associated documentation files (the "Software"), to
  6. // deal in the Software without restriction, including without limitation the
  7. // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  8. // sell copies of the Software, and to permit persons to whom the Software is
  9. // furnished to do so, subject to the following conditions:
  10. //
  11. // The above copyright notice and this permission notice shall be included in
  12. // all copies or substantial portions of the Software.
  13. //
  14. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  19. // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  20. // IN THE SOFTWARE.
  21. //-----------------------------------------------------------------------------
  22. singleton ShaderData( ExamplePostEffect_Shader )
  23. {
  24. DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl";
  25. DXPixelShaderFile = $Core:modulePath @ "ExamplePostEffectP.hlsl";
  26. OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl";
  27. OGLPixelShaderFile = $Core:modulePath @ "ExamplePostEffectP.glsl";
  28. samplerNames[0] = "$inputTex";
  29. pixVersion = 3.0;
  30. };
  31. singleton GFXStateBlockData( ExamplePostEffect_StateBlock )
  32. {
  33. samplersDefined = true;
  34. samplerStates[0] = SamplerClampLinear;
  35. samplerStates[1] = SamplerClampLinear;
  36. samplerStates[2] = SamplerClampLinear;
  37. samplerStates[3] = SamplerClampLinear;
  38. blendDefined = true;
  39. blendDest = GFXBlendOne;
  40. blendSrc = GFXBlendZero;
  41. zDefined = true;
  42. zEnable = false;
  43. zWriteEnable = false;
  44. cullDefined = true;
  45. cullMode = GFXCullNone;
  46. };
  47. function ExamplePostEffect::setShaderConsts( %this )
  48. {
  49. }
  50. function ExamplePostEffect::preProcess( %this )
  51. {
  52. }
  53. function ExamplePostEffect::onEnabled( %this )
  54. {
  55. return true;
  56. }
  57. function ExamplePostEffect::onDisabled( %this )
  58. {
  59. }
  60. singleton PostEffect( ExamplePostEffect )
  61. {
  62. isEnabled = false;
  63. allowReflectPass = false;
  64. // Resolve the HDR before we render any editor stuff
  65. // and before we resolve the scene to the backbuffer.
  66. renderTime = "PFXBeforeBin";
  67. renderBin = "EditorBin";
  68. renderPriority = 9999;
  69. // The bright pass generates a bloomed version of
  70. // the scene for pixels which are brighter than a
  71. // fixed threshold value.
  72. //
  73. // This is then used in the final HDR combine pass
  74. // at the end of this post effect chain.
  75. shader = ExamplePostEffect_Shader;
  76. stateBlock = ExamplePostEffect_StateBlock;
  77. texture[0] = "$backBuffer";
  78. target = "$outTex";
  79. targetFormat = "GFXFormatR16G16B16A16F";
  80. targetScale = "1 1";
  81. };