| 247 | } |
| 248 | |
| 249 | void ShaderBagCG::LoadDisplayShaders() |
| 250 | { |
| 251 | s_copy_key = new ProgramCG( |
| 252 | "void main(float4 TexCoord0 : TEXCOORD0, out float4 FragColor : COLOR0, uniform samplerRECT tex){\n" |
| 253 | "FragColor.rg= texRECT(tex, TexCoord0.xy).rg; FragColor.ba = float2(0,1); }"); |
| 254 | |
| 255 | //shader used to write a vertex buffer object |
| 256 | //which is used to draw the quads of each feature |
| 257 | ProgramCG * program; |
| 258 | s_vertex_list = program = new ProgramCG( |
| 259 | "void main(in float4 TexCoord0: TEXCOORD0,\n" |
| 260 | "uniform float4 sizes, \n" |
| 261 | "uniform samplerRECT tex, \n" |
| 262 | "out float4 FragColor: COLOR0){\n" |
| 263 | "float fwidth = sizes.y; \n" |
| 264 | "float twidth = sizes.z; \n" |
| 265 | "float rwidth = sizes.w; \n" |
| 266 | "float index = 0.1*(fwidth*floor(TexCoord0.y) + TexCoord0.x);\n" |
| 267 | "float px = fmod(index, twidth);\n" |
| 268 | "float2 tpos= floor(float2(px, index*rwidth))+0.5;\n" |
| 269 | "float4 cc = texRECT(tex, tpos );\n" |
| 270 | "float size = cc.a * 3.0f;//sizes.x;// \n" |
| 271 | "FragColor.zw = float2(0.0, 1.0);\n" |
| 272 | "if(any(cc.xy <=0)) {FragColor.xy = cc.xy;}else \n" |
| 273 | "{\n" |
| 274 | " float type = frac(px);\n" |
| 275 | " float2 dxy; float s, c;\n" |
| 276 | " dxy.x = type < 0.1 ? 0 : ((type <0.5 || type > 0.9)? size : -size);\n" |
| 277 | " dxy.y = type < 0.2 ? 0 : ((type < 0.3 || type > 0.7 )? -size :size); \n" |
| 278 | " sincos(cc.b, s, c);\n" |
| 279 | " FragColor.x = cc.x + c*dxy.x-s*dxy.y;\n" |
| 280 | " FragColor.y = cc.y + c*dxy.y+s*dxy.x;}\n" |
| 281 | "}\n\0"); |
| 282 | /*FragColor = float4(tpos, 0.0, 1.0);}\n\0");*/ |
| 283 | |
| 284 | _param_genvbo_size = cgGetNamedParameter(*program, "sizes"); |
| 285 | |
| 286 | |
| 287 | s_display_gaussian = new ProgramCG( |
| 288 | "void main(float4 TexCoord0 : TEXCOORD0, out float4 FragColor : COLOR0, uniform samplerRECT tex){\n" |
| 289 | "float r = texRECT(tex, TexCoord0.xy).r;\n" |
| 290 | "FragColor = float4(r, r, r, 1.0);}"); |
| 291 | |
| 292 | |
| 293 | s_display_dog = new ProgramCG( |
| 294 | "void main(float4 TexCoord0 : TEXCOORD0, out float4 FragColor : COLOR0, uniform samplerRECT tex){\n" |
| 295 | "float g = (0.5+20.0*texRECT(tex, TexCoord0.xy).g);\n" |
| 296 | "FragColor = float4(g, g, g, 1.0);}" ); |
| 297 | |
| 298 | |
| 299 | s_display_grad = new ProgramCG( |
| 300 | "void main(float4 TexCoord0 : TEXCOORD0, out float4 FragColor : COLOR0, uniform samplerRECT tex){\n" |
| 301 | "float4 cc = texRECT(tex, TexCoord0.xy); FragColor = float4(5.0 * cc.bbb, 1.0); }"); |
| 302 | |
| 303 | |
| 304 | s_display_keys= new ProgramCG( |
| 305 | "void main(float4 TexCoord0 : TEXCOORD0, out float4 FragColor : COLOR0, uniform samplerRECT tex){\n" |
| 306 | "float4 cc = texRECT(tex, TexCoord0.xy);\n" |