home *** CD-ROM | disk | FTP | other *** search
/ GameStar Special 2004 September / GSSH0904CD2.iso / Doom3 / Mods / parallaxmappingmod / parallaxmappingmod.exe / pak_Parallax.pk4 / glprogs / interaction.vfp
Text File  |  2004-08-14  |  4KB  |  103 lines

  1. !!ARBvp1.0 OPTION ARB_position_invariant ;
  2.  
  3. # Parallax Mapping Mod v1.0
  4. # by Junkguy
  5. # junkguy@gmail.com
  6. # www.junkguy.tk
  7. # Released on August 14, 2004
  8. #
  9. #   YOU -MAY- MAKE YOUR OWN LEVEL AND ITS TEXTURES BE COMPATIBLE WITH THIS MOD AND
  10. #      MAKE USE OF THE PARALLAX MAPPING TECHNOLOGY.  SEE THE README FOR DETAILS.
  11. #
  12. #   YOU MAY -NOT- USE THIS MOD AS A BASE FOR YOUR OWN MODS OR LEVELS.
  13. #
  14. #   YOU MAY -NOT- INCLUDE THIS MOD, THIS SHADER, THE TEXTURES, 
  15. #      OR ANY OF THIS CODE IN YOUR OWN MOD OR LEVEL WITHOUT PERMISSION FROM JUNKGUY.
  16.  
  17. TEMP    R0, R1, R2;
  18. PARAM    defaultTexCoord = { 0, 0.5, 0, 1 };
  19. SUB        R0, program.env[4], vertex.position;
  20. DP3        result.texcoord[0].x, vertex.attrib[9], R0;
  21. DP3        result.texcoord[0].y, vertex.attrib[10], R0;
  22. DP3        result.texcoord[0].z, vertex.attrib[11], R0;
  23. MOV        result.texcoord[1], defaultTexCoord;
  24. DP4        result.texcoord[1].x, vertex.attrib[8], program.env[10];
  25. DP4        result.texcoord[1].y, vertex.attrib[8], program.env[11];
  26. MOV        result.texcoord[2], defaultTexCoord;
  27. DP4        result.texcoord[2].x, vertex.position, program.env[9];
  28. DP4        result.texcoord[3].x, vertex.position, program.env[6];
  29. DP4        result.texcoord[3].y, vertex.position, program.env[7];
  30. DP4        result.texcoord[3].w, vertex.position, program.env[8];
  31. MOV        result.texcoord[4], defaultTexCoord;
  32. DP4        result.texcoord[4].x, vertex.attrib[8], program.env[12];
  33. DP4        result.texcoord[4].y, vertex.attrib[8], program.env[13];
  34. MOV        result.texcoord[5], defaultTexCoord;
  35. DP4        result.texcoord[5].x, vertex.attrib[8], program.env[14];
  36. DP4        result.texcoord[5].y, vertex.attrib[8], program.env[15];
  37. SUB        R0, program.env[4], vertex.position;
  38. DP3        R1, R0, R0;
  39. RSQ        R1, R1.x;
  40. MUL        R0, R0, R1.x;
  41. SUB        R1, program.env[5], vertex.position;
  42. DP3        R2, R1, R1;
  43. RSQ        R2, R2.x;
  44. MUL        R1, R1, R2.x;
  45. ADD        R0, R0, R1;
  46. DP3        result.texcoord[6].x, vertex.attrib[9], R0;
  47. DP3        result.texcoord[6].y, vertex.attrib[10], R0;
  48. DP3        result.texcoord[6].z, vertex.attrib[11], R0;
  49. SUB        R1, program.env[5], vertex.position;
  50. DP3        result.texcoord[7].x, vertex.attrib[9], R1;
  51. DP3        result.texcoord[7].y, vertex.attrib[10], R1;
  52. DP3        result.texcoord[7].z, vertex.attrib[11], R1;
  53. MOV        result.texcoord[7].w, 1.0;
  54. MAD        result.color, vertex.color, program.env[16], program.env[17];
  55.  
  56. END
  57.  
  58.  
  59. #======================================================================
  60.  
  61. !!ARBfp1.0 
  62. OPTION ARB_precision_hint_fastest;
  63.  
  64. TEMP    light, color, R1, R2, localNormal, specular, eye, height, newtexcoord, newbumpcoord, newspeccoord, newspeclook;
  65. PARAM    subOne = { -1, -1, -1, -1 };
  66. PARAM    scaleTwo = { 2, 2, 2, 2 };
  67. DP3    R1, fragment.texcoord[7], fragment.texcoord[7];
  68. RSQ    R1, R1.x;
  69. MUL    eye, fragment.texcoord[7], R1;
  70. TEX    height, fragment.texcoord[1], texture[1], 2D;
  71. MAD    height.x, height.z, -0.05, 0.05;
  72. MAD    newbumpcoord, height.xxxx, eye, fragment.texcoord[1];
  73. MAD    newtexcoord, height.xxxx, eye, fragment.texcoord[4];
  74. MAD    newspeccoord, height.xxxx, eye, fragment.texcoord[5];
  75. MAD    newspeclook, height.xxxx, eye, fragment.texcoord[6];
  76. DP3    specular, newspeclook,newspeclook;
  77. RSQ    specular, specular.x;
  78. MUL    specular, specular.x, newspeclook;
  79. TEX    light, fragment.texcoord[0], texture[0], CUBE;
  80. MAD    light, light, scaleTwo, subOne;
  81. TEX    localNormal, newbumpcoord, texture[1], 2D;
  82. MOV    localNormal.x, localNormal.a;
  83. MOV    localNormal.z, 0.99;
  84. MAD    localNormal, localNormal, scaleTwo, subOne;
  85. DP3    light, light, localNormal;
  86. TXP    R1, fragment.texcoord[3], texture[3], 2D;
  87. MUL    light, light, R1;
  88. TXP    R1, fragment.texcoord[2], texture[2], 2D;
  89. MUL    light, light, R1;
  90. TEX    R1, newtexcoord, texture[4], 2D;
  91. MUL    color, R1, program.env[0];
  92. DP3    specular, specular, localNormal;
  93. TEX    R1, specular, texture[6], 2D;
  94. MUL    R1, R1, program.env[1];
  95. TEX    R2, newspeccoord, texture[5], 2D;
  96. ADD    R2, R2, R2;
  97. MAD    color, R1, R2, color;
  98. MUL    color, light, color;
  99. MUL    result.color, color, fragment.color;
  100.  
  101. END
  102.  
  103.