PostFragShader.cpp 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. // This file was created by Filewrap 1.1
  2. // Little endian mode
  3. // DO NOT EDIT
  4. #include "../PVRTMemoryFileSystem.h"
  5. // using 32 bit to guarantee alignment.
  6. #ifndef A32BIT
  7. #define A32BIT static const unsigned int
  8. #endif
  9. // ******** Start: PostFragShader.fsh ********
  10. // File data
  11. static const char _PostFragShader_fsh[] =
  12. "uniform sampler2D sColorBufferTexture;\t// Texture containing color info in rgb and an object ID value in the alpha channel.\r\n"
  13. "varying mediump vec2 t1;\t\t\t\t// Texture coordinate for this fragment.\r\n"
  14. "//#define EDGE_DETECTION\r\n"
  15. "//#define INVERSE\t\t\tThese are for editing only, leave disabled as they are passed in by the main program\r\n"
  16. "//#define BLUR\r\n"
  17. "\r\n"
  18. "#ifdef EDGE_DETECTION\r\n"
  19. "varying mediump vec2 t2;\t\t\t\t// Texel directly above this fragment's.\r\n"
  20. "varying mediump vec2 t3;\t\t\t\t// Texel directly to the right of this fragment's.\r\n"
  21. "#endif\r\n"
  22. "\r\n"
  23. "const lowp vec3 black = vec3(0.0);\r\n"
  24. "\r\n"
  25. "void main()\r\n"
  26. "{\r\n"
  27. "\t// Gets the color from the render texture.\r\n"
  28. "\tlowp vec4 Color = texture2D(sColorBufferTexture, t1);\r\n"
  29. "\t\t\r\n"
  30. "\t// Temporary color store to be written to, data transferred to gl_FragColor at the end.\r\n"
  31. "\tlowp vec3 newColor=Color.rgb;\r\n"
  32. "\t\r\n"
  33. "#ifdef EDGE_DETECTION\r\n"
  34. "\t// Reads in values from the color texture, for two surrounding texels;\r\n"
  35. "\tlowp vec4 upFrag = texture2D(sColorBufferTexture, t2);\r\n"
  36. "\tlowp vec4 rightFrag = texture2D(sColorBufferTexture, t3);\r\n"
  37. "\t\r\n"
  38. "\t// If the object IDs covering this area differ, draw an edge\r\n"
  39. "\tif(upFrag.a-Color.a!=0.0 || rightFrag.a-Color.a!=0.0)\r\n"
  40. "\t{\r\n"
  41. "\t#ifdef INVERSE\r\n"
  42. "\t\t// Sets edge color to inverse of original color.\r\n"
  43. "\t\tnewColor=1.0-Color.rgb;\r\n"
  44. "\t#else \r\n"
  45. "\t#ifdef BLUR\r\n"
  46. "\t\t// Sets edge to a mixture of surrounding colors.\r\n"
  47. "\t\tnewColor=(2.0*Color.rgb+upFrag.rgb+rightFrag.rgb)*0.25;\r\n"
  48. "\t#else\r\n"
  49. "\t\t// Sets edge to black\r\n"
  50. "\t\tnewColor=black;\r\n"
  51. "\t#endif\r\n"
  52. "\t#endif\r\n"
  53. "\t}\r\n"
  54. "\telse\r\n"
  55. "\t{\r\n"
  56. "\t#ifdef INVERSE\r\n"
  57. "\t\t//Sets non-edges to black\r\n"
  58. "\t\tnewColor=black;\r\n"
  59. "\t#endif\r\n"
  60. "\t}\r\n"
  61. "#endif\r\n"
  62. "\r\n"
  63. "\t// Finally assigns gl_FragColor, with a default alpha value of 1.\r\n"
  64. "\tgl_FragColor=vec4(newColor,1.0);\r\n"
  65. "}";
  66. // Register PostFragShader.fsh in memory file system at application startup time
  67. static CPVRTMemoryFileSystem RegisterFile_PostFragShader_fsh("PostFragShader.fsh", _PostFragShader_fsh, 1659);
  68. // ******** End: PostFragShader.fsh ********
  69. // This file was created by Filewrap 1.1
  70. // Little endian mode
  71. // DO NOT EDIT
  72. #include "../PVRTMemoryFileSystem.h"
  73. // using 32 bit to guarantee alignment.
  74. #ifndef A32BIT
  75. #define A32BIT static const unsigned int
  76. #endif
  77. // ******** Start: PostFragShader.fsc ********
  78. // File data
  79. A32BIT _PostFragShader_fsc[] = {
  80. 0x10fab438,0xd7c19769,0x30050100,0x2501,0xd363e337,0x2000000,0x20000000,0x3030000,0x1000000,0x4000000,0x0,0x8000000,0x2,0x0,0x20000,0x0,0x0,0x44010000,0x55535020,0x20,0x138,0x1,0x0,0x0,0x224,0x0,0x2,0x7d,0x0,0x8,0x0,0xffffffff,0x0,0x770009,0xffff,0x1,0x0,0x10000,0x0,0x0,0x0,0x0,0x0,0x3fffc,0x40000,0x1,0x0,0xffff0003,0xffffffff,0x10001,0x800000,0x0,0x1,0x10000,0x9120c038,0x4083103e,0xffffffff,0xffffffff,0x0,0x0,0x4,0x20003,0x10000,0x80010002,
  81. 0x80018001,0x8001,0x0,0x40000,0xa0000000,0x28031000,0x5,0x20001,0x80018001,0x80018001,0x0,0x0,0x10,0x70007,0x3060a,0x30003,0x0,0x0,0x40000,0x40004,0x0,0x20001,0x10000,0x1,0x10000,0x20002,0x10000,0x80010002,0x80018001,0x8001,0x0,0x100000,0xe0030480,0x40811022,0x6,0x44010000,0x55535020,0x20,0x138,0x1,0x0,0x0,0x2a4,0x0,0x2,0x7d,0x0,0x8,0x0,0xffffffff,0x0,0x770009,0xffff,0x10001,0x0,0x10000,0x0,0x0,0x0,0x0,0x0,0x1fffc,0x40000,0x1,
  82. 0x0,0xffff0003,0xffffffff,0x10001,0x800000,0x0,0x1,0x10000,0x9120c038,0x4083103e,0xffffffff,0xffffffff,0x0,0x0,0x4,0x20003,0x10000,0x80010002,0x80018001,0x8001,0x0,0x0,0xa0000000,0x28831000,0x5,0x20001,0x80018001,0x80018001,0x0,0x0,0x0,0x70007,0x1060a,0x10001,0x0,0x0,0x40000,0x40004,0x0,0x20001,0x10000,0x1,0x10000,0x20002,0x10000,0x80010002,0x80018001,0x8001,0x0,0x0,0xe0030480,0x40811020,0x6,0x400,0x0,0x0,0x803f0000,0x2000000,0x6c6f4373,0x7542726f,0x72656666,0x74786554,0x657275,0x3180000,
  83. 0x1000001,0x20000,0x1000100,0x31740000,0x3000000,0x206,0x1000001,0x20000,0x3,
  84. };
  85. // Register PostFragShader.fsc in memory file system at application startup time
  86. static CPVRTMemoryFileSystem RegisterFile_PostFragShader_fsc("PostFragShader.fsc", _PostFragShader_fsc, 803);
  87. // ******** End: PostFragShader.fsc ********