Advertisement
Guest User

shadron UK flag

a guest
Jul 7th, 2017
229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.71 KB | None | 0 0
  1. #define H 0.3
  2. #define W 0.6
  3.  
  4. #define rw 0.06
  5. #define rh 0.06
  6. #define bw 0.25
  7. #define bh 0.10
  8. #define ww 0.02
  9. #define wh 0.02
  10. #define x 0.06
  11. #define x1 0.011111111111111
  12.  
  13. const vec3 RED = vec3(0.77647058823529411764705882352941, 0.06274509803921568627450980392157, 0.09411764705882352941176470588235);
  14. const vec3 BLUE = vec3(0.0, 0.15294117647058823529411764705882, 0.46274509803921568627450980392157);
  15. const vec3 WHITE = vec3(1.0, 1.0, 1.0);
  16.  
  17. const ivec2 DIMENSIONS = ivec2(1200, 600);
  18.  
  19. glsl vec3 UnitedKingdomFlag ( vec2 coord ) {
  20. vec2 pos = vec2( W, H ) * coord;
  21.  
  22. if ( pos.x >= bw + ww && pos.r <= bw + ww + rw || pos.y >= bh + wh && pos.y < bh + wh + rh ) {
  23. return RED;
  24. } else if ( pos.r >= bw && pos.r <= bw + ww + rw + ww || pos.y >= bh && pos.y <= bh + wh + rh + wh ) {
  25. return WHITE;
  26. }
  27. if ( pos.y < 0.15 ) {
  28. if ( pos.y < 0.5 * pos.r + -x1 - x1 && pos.y > 0.5 * pos.r - x1 - x1 - x1 ) {
  29. return WHITE;
  30. } else if ( pos.y > 0.5 * pos.r + -x1 - x1 && pos.y < 0.5 * pos.r + 0 ) {
  31. return RED;
  32. } else if ( pos.y > 0.5 * pos.r + 0 && pos.y < 0.5 * pos.r + x1 + x1 + x1 ) {
  33. return WHITE;
  34. }
  35. if ( pos.y < -0.5 * pos.r + 0.3 - 0 && pos.y > -0.5 * pos.r + 0.3 - x1 - x1 - x1 ) {
  36. return WHITE;
  37. } else if ( pos.y > -0.5 * pos.r + 0.3 - x1 + x1 && pos.y < -0.5 * pos.r + 0.3 + x1 + x1 ) {
  38. return RED;
  39. } else if ( pos.y > -0.5 * pos.r + 0.3 - x1 && pos.y < -0.5 * pos.r + 0.3 + x1 + x1 + x1 ) {
  40. return WHITE;
  41. }
  42. } else if ( pos.y > 0.15 ) {
  43. if ( pos.y < 0.5 * pos.r -0 && pos.y > 0.5 * pos.r - x1 - x1 - x1) {
  44. return WHITE;
  45. } else if ( pos.y > 0.5 * pos.r - x1+x1 && pos.y < 0.5 * pos.r + x1+x1 ) {
  46. return RED;
  47. } else if ( pos.y > 0.5 * pos.r - x1 && pos.y < 0.5 * pos.r + x1 + x1 + x1 ) {
  48. return WHITE;
  49. }
  50. if ( pos.y < -0.5 * pos.r + 0.3 + -x1 - x1 && pos.y > -0.5 * pos.r + 0.3 - x1 - x1 - x1 ) {
  51. return WHITE;
  52. } else if ( pos.y > -0.5 * pos.r + 0.3 + -x1 - x1 && pos.y < -0.5 * pos.r + 0.3 + 0 ) {
  53. return RED;
  54. } else if ( pos.y > -0.5 * pos.r + 0.3 + 0 && pos.y < -0.5 * pos.r + 0.3 + x1 + x1 + x1 ) {
  55. return WHITE;
  56. }
  57. }
  58. return BLUE;
  59. }
  60.  
  61. image UnitedKingdom = glsl(UnitedKingdomFlag, DIMENSIONS);
  62.  
  63. param float diffFactor = 1.0 : logrange (1.0, 256.0);
  64. //image Reference = file();
  65.  
  66. glsl vec3 Compare(vec2 coord) {
  67. vec3 a = texture( Reference, coord ).rgb;
  68. vec3 b = texture( UnitedKingdom, coord ).rgb;
  69. return diffFactor * abs( b - a );
  70. }
  71.  
  72. //image Differance = glsl(Compare, DIMENSIONS);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement