Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma optimize (on)
- #pragma debug (off)
- uniform sampler2D color_texture;
- uniform sampler2D colortable_texture;
- uniform vec2 colortable_sz; // orig size for full bgr
- uniform vec2 colortable_pow2_sz; // orig size for full bgr
- void main()
- {
- vec4 color_tex;
- vec2 color_map_coord;
- float color_map_pos;
- float colortable_scale = (colortable_sz.x*colortable_sz.y/3.0);
- // normalized texture coordinates ..
- color_tex = texture2D(color_texture, gl_TexCoord[0].st) * ((colortable_sz.x*colortable_sz.y/3.0)-1.0);// lookup space
- color_map_pos = color_tex.b;
- color_map_coord.y = floor(color_map_pos/colortable_sz.x);
- color_map_coord.x = mod(color_map_pos,colortable_sz.x);
- gl_FragColor.b = texture2D(colortable_texture, color_map_coord/colortable_pow2_sz).b;
- color_map_pos = color_tex.g + colortable_scale;
- color_map_coord.y = floor(color_map_pos/colortable_sz.x);
- color_map_coord.x = mod(color_map_pos,colortable_sz.x);
- gl_FragColor.g = texture2D(colortable_texture, color_map_coord/colortable_pow2_sz).g;
- color_map_pos = color_tex.r + 2.0 * colortable_scale;
- color_map_coord.y = floor(color_map_pos/colortable_sz.x);
- color_map_coord.x = mod(color_map_pos,colortable_sz.x);
- gl_FragColor.r = texture2D(colortable_texture, color_map_coord/colortable_pow2_sz).r;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement