Advertisement
Guest User

Untitled

a guest
Jul 20th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. #pragma optimize (on)
  3. #pragma debug (off)
  4.  
  5. uniform sampler2D color_texture;
  6. uniform sampler2D colortable_texture;
  7. uniform vec2      colortable_sz;         // orig size for full bgr
  8. uniform vec2      colortable_pow2_sz;    // orig size for full bgr
  9.  
  10. void main()
  11. {
  12.     vec4 color_tex;
  13.     vec2 color_map_coord;
  14.     float color_map_pos;
  15.     float colortable_scale = (colortable_sz.x*colortable_sz.y/3.0);
  16.  
  17.     // normalized texture coordinates ..
  18.     color_tex = texture2D(color_texture, gl_TexCoord[0].st) * ((colortable_sz.x*colortable_sz.y/3.0)-1.0);// lookup space
  19.  
  20.     color_map_pos     = color_tex.b;
  21.     color_map_coord.y = floor(color_map_pos/colortable_sz.x);
  22.     color_map_coord.x = mod(color_map_pos,colortable_sz.x);
  23.     gl_FragColor.b    = texture2D(colortable_texture, color_map_coord/colortable_pow2_sz).b;
  24.  
  25.     color_map_pos     = color_tex.g + colortable_scale;
  26.     color_map_coord.y = floor(color_map_pos/colortable_sz.x);
  27.     color_map_coord.x = mod(color_map_pos,colortable_sz.x);
  28.     gl_FragColor.g    = texture2D(colortable_texture, color_map_coord/colortable_pow2_sz).g;
  29.  
  30.     color_map_pos     = color_tex.r + 2.0 * colortable_scale;
  31.     color_map_coord.y = floor(color_map_pos/colortable_sz.x);
  32.     color_map_coord.x = mod(color_map_pos,colortable_sz.x);
  33.     gl_FragColor.r    = texture2D(colortable_texture, color_map_coord/colortable_pow2_sz).r;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement