• R/O
  • HTTP
  • SSH
  • HTTPS

コミット

タグ
未設定

よく使われているワード(クリックで追加)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

packages/wallpapers/Basic


コミットメタ情報

リビジョン4ace270249d25302d027edd3a471aef94ab4e759 (tree)
日時2010-03-03 06:47:20
作者Jason Sams <rjsams@andr...>
コミッターJason Sams

ログメッセージ

Clean up fall vertex shader.

変更サマリ

差分

--- a/src/com/android/wallpaper/fall/FallRS.java
+++ b/src/com/android/wallpaper/fall/FallRS.java
@@ -350,158 +350,52 @@ class FallRS extends RenderScriptScene {
350350 mUniformAlloc = Allocation.createSized(mRS, e, 1);
351351
352352 ProgramVertex.ShaderBuilder sb = new ProgramVertex.ShaderBuilder(mRS);
353-
354- String t = "void main() {\n" +
355- " vec4 pos;\n" +
356- " pos.x = ATTRIB_position.x;\n" +
357- " pos.y = ATTRIB_position.y;\n" +
358- " pos.z = 0.0;\n" +
359- " pos.w = 1.0;\n" +
360- " gl_Position = pos;\n" +
361-
362- " if (UNI_Rotate < 0.9) {\n" +
363- " varTex0.x = (pos.x + 1.0) * 0.25;\n" +
364- " varTex0.x += UNI_Offset.x * 0.5;\n" +
365- " varTex0.y = (pos.y + 1.6666) * 0.33;\n" +
366- " } else {\n" +
367- " varTex0.x = (pos.x + 1.0) * 0.5;\n" +
368- " varTex0.y = (pos.y + 1.666) * 0.3125;\n" +
353+
354+ String t = "\n" +
355+ "vec2 addDrop(vec4 d, vec2 pos, float dxMul) {\n" +
356+ " vec2 ret = vec2(0.0, 0.0);\n" +
357+ " vec2 delta = d.xy - pos;\n" +
358+ " delta.x *= dxMul;\n" +
359+ " float dist = length(delta);\n" +
360+ " if (dist < d.w) { \n" +
361+ " float amp = d.z * dist;\n" +
362+ " amp /= d.w * d.w;\n" +
363+ " amp *= sin(d.w - dist);\n" +
364+ " ret = delta * amp;\n" +
369365 " }\n" +
366+ " return ret;\n" +
367+ "}\n" +
368+
369+ "void main() {\n" +
370+ " vec2 pos = ATTRIB_position.xy;\n" +
371+ " gl_Position = vec4(pos.x, pos.y, 0.0, 1.0);\n" +
372+ " float dxMul = 1.0;\n" +
373+
374+ " varTex0 = vec4((pos.x + 1.0), (pos.y + 1.6666), 0.0, 0.0);\n" +
370375
371- " varTex0.w = 0.0;\n" +
372- " varColor = vec4(1.0, 1.0, 1.0, 1.0);\n" +
373-
374376 " if (UNI_Rotate < 0.9) {\n" +
377+ " varTex0.xy *= vec2(0.25, 0.33);\n" +
378+ " varTex0.x += UNI_Offset.x * 0.5;\n" +
375379 " pos.x += UNI_Offset.x * 2.0;\n" +
380+ " } else {\n" +
381+ " varTex0.xy *= vec2(0.5, 0.3125);\n" +
382+ " dxMul = 2.5;\n" +
376383 " }\n" +
377- " pos.x += 1.0;\n" +
378- " pos.x *= 25.0;\n" +
379- " pos.y += 1.0;\n" +
380- " pos.y *= 42.0;\n" +
381-
382- " vec2 delta;\n" +
383- " float dist;\n" +
384- " float amp;\n" +
385-
386- " delta = UNI_Drop01.xy - pos.xy;\n" +
387- " if (UNI_Rotate > 0.9) {\n" +
388- " delta.x *= 2.5;\n" +
389- " }\n" +
390- " dist = length(delta);\n" +
391- " if (dist < UNI_Drop01.w) { \n" +
392- " amp = UNI_Drop01.z * dist;\n" +
393- " amp /= UNI_Drop01.w * UNI_Drop01.w;\n" +
394- " amp *= sin(UNI_Drop01.w - dist);\n" +
395- " varTex0.xy += delta * amp;\n" +
396- " }\n" +
397-
398- " delta = UNI_Drop02.xy - pos.xy;\n" +
399- " if (UNI_Rotate > 0.9) {\n" +
400- " delta.x *= 2.5;\n" +
401- " }\n" +
402- " dist = length(delta);\n" +
403- " if (dist < UNI_Drop02.w) { \n" +
404- " amp = UNI_Drop02.z * dist;\n" +
405- " amp /= UNI_Drop02.w * UNI_Drop02.w;\n" +
406- " amp *= sin(UNI_Drop02.w - dist);\n" +
407- " varTex0.xy += delta * amp;\n" +
408- " }\n" +
409-
410- " delta = UNI_Drop03.xy - pos.xy;\n" +
411- " if (UNI_Rotate > 0.9) {\n" +
412- " delta.x *= 2.5;\n" +
413- " }\n" +
414- " dist = length(delta);\n" +
415- " if (dist < UNI_Drop03.w) { \n" +
416- " amp = UNI_Drop03.z * dist;\n" +
417- " amp /= UNI_Drop03.w * UNI_Drop03.w;\n" +
418- " amp *= sin(UNI_Drop03.w - dist);\n" +
419- " varTex0.xy += delta * amp;\n" +
420- " }\n" +
421-
422- " delta = UNI_Drop04.xy - pos.xy;\n" +
423- " if (UNI_Rotate > 0.9) {\n" +
424- " delta.x *= 2.5;\n" +
425- " }\n" +
426- " dist = length(delta);\n" +
427- " if (dist < UNI_Drop04.w) { \n" +
428- " amp = UNI_Drop04.z * dist;\n" +
429- " amp /= UNI_Drop04.w * UNI_Drop04.w;\n" +
430- " amp *= sin(UNI_Drop04.w - dist);\n" +
431- " varTex0.xy += delta * amp;\n" +
432- " }\n" +
433-
434- " delta = UNI_Drop05.xy - pos.xy;\n" +
435- " if (UNI_Rotate > 0.9) {\n" +
436- " delta.x *= 2.5;\n" +
437- " }\n" +
438- " dist = length(delta);\n" +
439- " if (dist < UNI_Drop05.w) { \n" +
440- " amp = UNI_Drop05.z * dist;\n" +
441- " amp /= UNI_Drop05.w * UNI_Drop05.w;\n" +
442- " amp *= sin(UNI_Drop05.w - dist);\n" +
443- " varTex0.xy += delta * amp;\n" +
444- " }\n" +
445-
446- " delta = UNI_Drop06.xy - pos.xy;\n" +
447- " if (UNI_Rotate > 0.9) {\n" +
448- " delta.x *= 2.5;\n" +
449- " }\n" +
450- " dist = length(delta);\n" +
451- " if (dist < UNI_Drop06.w) { \n" +
452- " amp = UNI_Drop06.z * dist;\n" +
453- " amp /= UNI_Drop06.w * UNI_Drop06.w;\n" +
454- " amp *= sin(UNI_Drop06.w - dist);\n" +
455- " varTex0.xy += delta * amp;\n" +
456- " }\n" +
457-
458- " delta = UNI_Drop07.xy - pos.xy;\n" +
459- " if (UNI_Rotate > 0.9) {\n" +
460- " delta.x *= 2.5;\n" +
461- " }\n" +
462- " dist = length(delta);\n" +
463- " if (dist < UNI_Drop07.w) { \n" +
464- " amp = UNI_Drop07.z * dist;\n" +
465- " amp /= UNI_Drop07.w * UNI_Drop07.w;\n" +
466- " amp *= sin(UNI_Drop07.w - dist);\n" +
467- " varTex0.xy += delta * amp;\n" +
468- " }\n" +
469-
470- " delta = UNI_Drop08.xy - pos.xy;\n" +
471- " if (UNI_Rotate > 0.9) {\n" +
472- " delta.x *= 2.5;\n" +
473- " }\n" +
474- " dist = length(delta);\n" +
475- " if (dist < UNI_Drop08.w) { \n" +
476- " amp = UNI_Drop08.z * dist;\n" +
477- " amp /= UNI_Drop08.w * UNI_Drop08.w;\n" +
478- " amp *= sin(UNI_Drop08.w - dist);\n" +
479- " varTex0.xy += delta * amp;\n" +
480- " }\n" +
481-
482- " delta = UNI_Drop09.xy - pos.xy;\n" +
483- " if (UNI_Rotate > 0.9) {\n" +
484- " delta.x *= 2.5;\n" +
485- " }\n" +
486- " dist = length(delta);\n" +
487- " if (dist < UNI_Drop09.w) { \n" +
488- " amp = UNI_Drop09.z * dist;\n" +
489- " amp /= UNI_Drop09.w * UNI_Drop09.w;\n" +
490- " amp *= sin(UNI_Drop09.w - dist);\n" +
491- " varTex0.xy += delta * amp;\n" +
492- " }\n" +
493-
494- " delta = UNI_Drop10.xy - pos.xy;\n" +
495- " if (UNI_Rotate > 0.9) {\n" +
496- " delta.x *= 2.5;\n" +
497- " }\n" +
498- " dist = length(delta);\n" +
499- " if (dist < UNI_Drop10.w) { \n" +
500- " amp = UNI_Drop10.z * dist;\n" +
501- " amp /= UNI_Drop10.w * UNI_Drop10.w;\n" +
502- " amp *= sin(UNI_Drop10.w - dist);\n" +
503- " varTex0.xy += delta * amp;\n" +
504- " }\n" +
384+
385+ " varColor = vec4(1.0, 1.0, 1.0, 1.0);\n" +
386+ " pos.xy += vec2(1.0, 1.0);\n" +
387+ " pos.xy *= vec2(25.0, 42.0);\n" +
388+
389+ " varTex0.xy += addDrop(UNI_Drop01, pos, dxMul);\n" +
390+ " varTex0.xy += addDrop(UNI_Drop02, pos, dxMul);\n" +
391+ " varTex0.xy += addDrop(UNI_Drop03, pos, dxMul);\n" +
392+ " varTex0.xy += addDrop(UNI_Drop04, pos, dxMul);\n" +
393+ " varTex0.xy += addDrop(UNI_Drop05, pos, dxMul);\n" +
394+ " varTex0.xy += addDrop(UNI_Drop06, pos, dxMul);\n" +
395+ " varTex0.xy += addDrop(UNI_Drop07, pos, dxMul);\n" +
396+ " varTex0.xy += addDrop(UNI_Drop08, pos, dxMul);\n" +
397+ " varTex0.xy += addDrop(UNI_Drop09, pos, dxMul);\n" +
398+ " varTex0.xy += addDrop(UNI_Drop10, pos, dxMul);\n" +
505399 "}\n";
506400 sb.setShader(t);
507401 sb.addConstant(mUniformAlloc.getType());