Changeset 1073
 Timestamp:
 Nov 16, 2011, 4:55:43 PM (11 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/test/tutorial/tut03.cpp
r1072 r1073 136 136 double oldradius = m_radius; 137 137 #ifdef __CELLOS_LV2__ 138 m_radius *= pow(2.0, deltams * 0.000 15);138 m_radius *= pow(2.0, deltams * 0.0005); 139 139 m_center = f64cmplx(0.001643721971153, 0.822467633298876); 140 140 #else … … 315 315 * an exact texel boundary. This would lead to visual 316 316 * artifacts. */ 317 " coord = 0.1 * in_PixelDelta.x;"317 " coord = 0.1 * in_PixelDelta.xy;" 318 318 /* Get a pixel from each slice */ 319 319 " vec4 p0 = texture2D(in_Texture, nearest0(coord).xy);" … … 333 333 "}", 334 334 335 "void main(float4 in_FragCoord : WPOS," 336 " float2 in_TexCoord : TEXCOORD0," 335 "float3 nearest0(float2 p, float4 in_PixelDelta) {" 336 " float2 q = p + 0.5 * in_PixelDelta.xy;" 337 " q = fmod(q, 2.0 * in_PixelDelta.xy);" 338 " q += 0.5 * in_PixelDelta.xy;" 339 " return float3(q * float2(1.0, 0.25)," 340 " length(q  p));" 341 "}" 342 "" 343 "float3 nearest1(float2 p, float4 in_PixelDelta) {" 344 " float2 q = p  0.5 * in_PixelDelta.xy;" 345 " q = fmod(q, 2.0 * in_PixelDelta.xy);" 346 " q += 1.5 * in_PixelDelta.xy;" 347 " return float3(q * float2(1.0, 0.25) + float2(0.0, 0.25)," 348 " length(q  p));" 349 "}" 350 "" 351 "float3 nearest2(float2 p, float4 in_PixelDelta) {" 352 " float2 q = p + float2(0.5, 0.5) * in_PixelDelta.xy;" 353 " q = fmod(q, 2.0 * in_PixelDelta.xy);" 354 " q += float2(0.5, 1.5) * in_PixelDelta.xy;" 355 " return float3(q * float2(1.0, 0.25) + float2(0.0, 0.50)," 356 " length(q  p));" 357 "}" 358 "" 359 "float3 nearest3(float2 p, float4 in_PixelDelta) {" 360 " float2 q = p + float2(0.5, 0.5) * in_PixelDelta.xy;" 361 " q = fmod(q, 2.0 * in_PixelDelta.xy);" 362 " q += float2(1.5, 0.5) * in_PixelDelta.xy;" 363 " return float3(q * float2(1.0, 0.25) + float2(0.0, 0.75)," 364 " length(q  p));" 365 "}" 366 "" 367 "void main(float2 in_TexCoord : TEXCOORD0," 337 368 " uniform float4 in_PixelDelta," 338 369 " uniform sampler2D in_Texture," … … 340 371 "{" 341 372 " float2 coord = in_TexCoord.xy;" 342 " float i = frac((in_FragCoord.x  0.5) * 0.5) * 2.0;"343 " float j = frac((in_FragCoord.y  0.5 + i) * 0.5) * 2.0;"344 " coord.y += i + j * 2;"345 " coord.y *= 0.25;"346 " float4 p = tex2D(in_Texture, coord);"347 " out_FragColor = p;"373 " coord = 0.1 * in_PixelDelta.xy;" 374 " float4 p0 = tex2D(in_Texture, nearest0(coord, in_PixelDelta).xy);" 375 " float4 p1 = tex2D(in_Texture, nearest1(coord, in_PixelDelta).xy);" 376 " float4 p2 = tex2D(in_Texture, nearest2(coord, in_PixelDelta).xy);" 377 " float4 p3 = tex2D(in_Texture, nearest3(coord, in_PixelDelta).xy);" 378 " out_FragColor = 0.25 * (p0 + p1 + p2 + p3);" 348 379 "}" 349 380 #endif
Note: See TracChangeset
for help on using the changeset viewer.