shader_playfield.g.pica 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. ; MegaZeux
  2. ;
  3. ; Copyright (C) 2004-2006 Gilead Kutnick <exophase@adelphia.net>
  4. ; Copyright (C) 2007 Alistair John Strachan <alistair@devzero.co.uk>
  5. ; Copyright (C) 2007 Alan Williams <mralert@gmail.com>
  6. ;
  7. ; This program is free software; you can redistribute it and/or
  8. ; modify it under the terms of the GNU General Public License as
  9. ; published by the Free Software Foundation; either version 2 of
  10. ; the License, or (at your option) any later version.
  11. ;
  12. ; This program is distributed in the hope that it will be useful,
  13. ; but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. ; General Public License for more details.
  16. ;
  17. ; You should have received a copy of the GNU General Public License
  18. ; along with this program; if not, write to the Free Software
  19. ; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  20. .gsh point c0
  21. .fvec projection[4]
  22. .fvec offset
  23. .out outpos position
  24. .out outtc0 texcoord0
  25. .out outclr color
  26. .alias inpos v0
  27. .alias intc0 v1
  28. .alias inclr v2
  29. .constf SCALES(0.0009765625, 0.001953125, -1, 1)
  30. .constf UVOFF(8, -14, 0, 0)
  31. .constf POSSCALE(8.0, 14.0, 1.0, 1.0)
  32. .entry gmain
  33. .proc gmain
  34. mov r4, POSSCALE
  35. mov r2, intc0
  36. mov r3.xy, inpos
  37. mov r3.z, UVOFF.z
  38. mad r0, r3, r4, offset
  39. mov r11, SCALES
  40. mov r0.w, POSSCALE.w
  41. mul r5.xy, UVOFF.xy, r11.xy
  42. mul r6, r2, r11
  43. setemit 0
  44. add r8.xy, r0.xy, r4.xy
  45. add r10.xy, r6.xy, r5.xy
  46. call emit_vertex
  47. emit
  48. setemit 1
  49. mov r8.y, r0.y
  50. add r8.x, r0.x, r4.x
  51. mov r10.y, r6.y
  52. add r10.x, r6.x, r5.x
  53. call emit_vertex
  54. emit
  55. setemit 2, prim
  56. mov r8, r0
  57. mov r10, r6
  58. call emit_vertex
  59. emit
  60. setemit 1, prim inv
  61. mov r8.x, r0.x
  62. add r8.y, r0.y, r4.y
  63. mov r10.x, r6.x
  64. add r10.y, r6.y, r5.y
  65. call emit_vertex
  66. emit
  67. end
  68. .end
  69. .proc emit_vertex
  70. dp4 outpos.x, projection[0], r8
  71. dp4 outpos.y, projection[1], r8
  72. dp4 outpos.z, projection[2], r8
  73. dp4 outpos.w, projection[3], r8
  74. mov outclr, inclr
  75. mov outtc0, r10
  76. .end