Advertisement
DEKTEN

SDF-018-BUFFER

Dec 2nd, 2020 (edited)
1,648
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //[ THIS_FILE_IS[ SDF_018.BUFFER._ ]                 ]//
  2. /** ************************************************ ***
  3. ***                                                  ***
  4. ***     Live Stream Of Me Working On This Code:      ***
  5. ***                                                  ***
  6. *** ************************************************ ***
  7.  
  8.                 twitch.com/kanjicoder    
  9.  
  10. *** ************************************************ ***
  11. ***                                                  ***
  12. *** SELF___________URL:  tinyurl.com/SDF-018-BUFFER  ***
  13. *** DOCUMENTATION__URL:  tinyurl.com/SDF-018         ***
  14. *** SOURCE_CODE_BUFFER:  tinyurl.com/SDF-018-BUFFER  ***
  15. *** SOURCE_CODE__IMAGE:  tinyurl.com/SDF-018-IMAGE   ***
  16. *** LIVE__________DEMO:  tinyurl.com/SDF-018-DEMO    ***
  17. *** SETUP________VIDEO:  tinyurl.com/SDF-018-SETUP   ***
  18. ***                                                  ***
  19. *** ************************************************ **/
  20. //:INSTRUCTIONS:IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII://
  21. /** ************************************************ ***
  22.  
  23.     Click And Drag on the canvas to set pixels.
  24.  
  25. *** ************************************************ **/
  26. //:IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII:INSTRUCTIONS://
  27. //:MACROS:MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM://
  28.  
  29.     #define IV2 ivec2
  30.     #define V_4  vec4
  31.     #define V_3  vec3
  32.     #define V_2  vec2
  33.     #define F32 float
  34.     #define I32   int
  35.     #define U32  uint
  36.  
  37. //:MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM:MACROS://
  38. //:DATA:DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD://
  39.  
  40.     //:NO DATA
  41.  
  42. //:DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD:DATA://
  43. //:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF://
  44. //:FUNCTIONS:BELOW:____DO_NOT_INDENT____OUTER_SCOPE!!://
  45. //:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF://
  46.  
  47. void mainImage( out vec4 fragColor, in vec2 fragCoord )
  48. {
  49.     V_4 c4d;
  50.  
  51.     IV2 f_c = IV2( I32( fragCoord.x - 0.5 ) ,
  52.                    I32( fragCoord.y - 0.5 ) );;
  53.  
  54.     //:Initialize Data?
  55.     V_4 rfp = texelFetch( iChannel0 ,ivec2(127,127),0);
  56.     U32 rfb = U32( rfp.w * 255.0 );
  57.     if( rfb >= U32( 1 ) ){
  58.  
  59.         c4d = texelFetch( iChannel0 , f_c , 0 );
  60.  
  61.     }else{
  62.         if( f_c.x != 127 && f_c.y != 127 ){
  63.             c4d=vec4(1.0,1.0,1.0    ,1);
  64.         }else{
  65.             c4d=vec4(1.0,1.0,1.0    ,1);
  66.         };;
  67.     };;
  68.  
  69.     //:Set [pixel/tile] ?
  70.     if( iMouse.z > 0.0 ){ //:Mouse Down?
  71.     if( I32( iMouse.x ) == f_c.x ){
  72.     if( I32( iMouse.y ) == f_c.y ){
  73.  
  74.        
  75.         c4d=vec4( 0,0,1  ,1);
  76.  
  77.     };;};;};;
  78.  
  79.    
  80.     fragColor = c4d;
  81.  
  82. }
  83.  
  84. //:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF://
  85. //:FUNCTIONS:ABOVE:____DO_NOT_INDENT____OUTER_SCOPE!!://
  86. //:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF://
  87. //:MACROS:MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM://
  88.  
  89.     #undef  IV2  
  90.     #undef  V_4  
  91.     #undef  V_3  
  92.     #undef  V_2  
  93.     #undef  F32  
  94.     #undef  I32  
  95.     #undef  U32  
  96.  
  97. //:MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM:MACROS://
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement