Advertisement
General_101

lightmap_perpixel_tex_detail_vertex_shader

May 22nd, 2020
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.79 KB | None | 0 0
  1. struct VS_OUTPUT
  2. {
  3. float4 oD0 : COLOR0;
  4. float4 oD1 : COLOR1;
  5. float4 oT0 : TEXCOORD0;
  6. float4 oT1 : TEXCOORD1;
  7. float4 oT2 : TEXCOORD2;
  8. float4 oT3 : TEXCOORD3;
  9. float4 oPos : POSITION;
  10. float4 oT7 : TEXCOORD7;
  11. };
  12. //global vs 2.0 vertex shader header for asm conversions. (preceded by VS_INPUT/VS_OUTPUT struct)
  13. //not used if #define HLSL is at the top of the .vsc file.
  14.  
  15. #pragma ruledisable 0x02040101
  16. #pragma ruledisable 0x02040102
  17. #pragma ruledisable 0x02040103
  18. #pragma ruledisable 0x04010100
  19. #pragma ruledisable 0x04010101
  20. #pragma ruledisable 0x04010102
  21. #pragma ruledisable 0x04010103
  22. #pragma ruledisable 0x04010104
  23.  
  24.  
  25. float4 c[96*2+16] : register(c0); // grab all the xbox specific constant register space
  26.  
  27. void hsge(out float4 dest, float4 src0, float4 src1)
  28. {
  29. dest.x = (src0.x >= src1.x) ? 1.0f : 0.0f;
  30. dest.y = (src0.y >= src1.y) ? 1.0f : 0.0f;
  31. dest.z = (src0.z >= src1.z) ? 1.0f : 0.0f;
  32. dest.w = (src0.w >= src1.w) ? 1.0f : 0.0f;
  33. }
  34.  
  35. void hslt(out float4 dest, float4 src0, float4 src1)
  36. {
  37. dest.x = (src0.x < src1.x) ? 1.0f : 0.0f;
  38. dest.y = (src0.y < src1.y) ? 1.0f : 0.0f;
  39. dest.z = (src0.z < src1.z) ? 1.0f : 0.0f;
  40. dest.w = (src0.w < src1.w) ? 1.0f : 0.0f;
  41. }
  42.  
  43. void hsincos(out float2 dest, in float angle)
  44. {
  45. sincos(angle, dest.y, dest.x);
  46. }
  47.  
  48. float dp2(float4 a, float4 b)
  49. {
  50. return a.x*b.x+a.y*b.y;
  51. }
  52.  
  53. float dp3(float4 a, float4 b)
  54. {
  55. return a.x*b.x+a.y*b.y+a.z*b.z;
  56. }
  57.  
  58. float dp4(float4 a, float4 b)
  59. {
  60. return a.x*b.x+a.y*b.y+a.z*b.z+a.w*b.w;
  61. }
  62.  
  63. float rand_1_05(in float2 uv)
  64. {
  65. float2 noise = (frac(sin(dot(uv ,float2(12.9898,78.233)*2.0)) * 43758.5453));
  66. return abs(noise.x + noise.y) * 2.0;
  67. }
  68.  
  69. VS_OUTPUT main(//input registers
  70. float4 va_position: POSITION0,
  71. float4 va_node_indices: BLENDINDICES0,
  72. float4 va_node_weights: BLENDWEIGHT0,
  73. float4 va_texcoord: TEXCOORD0,
  74. float4 va_normal: NORMAL0,
  75. float4 va_binormal: BINORMAL0,
  76. float4 va_tangent: TANGENT0,
  77. float4 va_anisotropic_binormal: BINORMAL1,
  78. float4 va_incident_radiosity: COLOR1,
  79. float4 va_secondary_texcoord: TEXCOORD1,
  80. float4 va_isq_secondary_position: POSITION1,
  81. float4 va_isq_secondary_node_indices: BLENDINDICES1,
  82. float4 va_isq_secondary_node_weights: BLENDWEIGHT1,
  83. float4 va_isq_select: TEXCOORD2,
  84. float4 va_color: COLOR0,
  85. float4 va_tint_factor: COLOR2,
  86. float4 va_dsq_plane: TEXCOORD3,
  87. float4 va_billboard_offset: TEXCOORD4,
  88. float4 va_billboard_axis: TEXCOORD5,
  89. float4 va_pca_cluster_id: TEXCOORD6,
  90. float4 va_pca_weights: TEXCOORD7)
  91. {
  92. VS_OUTPUT output;
  93.  
  94. //temps
  95. float4 r0 = float4(1.0f, 1.0f, 1.0f, 1.0f);
  96. float4 r1 = float4(1.0f, 1.0f, 1.0f, 1.0f);
  97. float4 r2 = float4(1.0f, 1.0f, 1.0f, 1.0f);
  98. float4 r3 = float4(1.0f, 1.0f, 1.0f, 1.0f);
  99. float4 r4 = float4(1.0f, 1.0f, 1.0f, 1.0f);
  100. float4 r5 = float4(1.0f, 1.0f, 1.0f, 1.0f);
  101. float4 r6 = float4(1.0f, 1.0f, 1.0f, 1.0f);
  102. float4 r7 = float4(1.0f, 1.0f, 1.0f, 1.0f);
  103. float4 r8 = float4(1.0f, 1.0f, 1.0f, 1.0f);
  104. float4 r9 = float4(1.0f, 1.0f, 1.0f, 1.0f);
  105. float4 r10 = float4(1.0f, 1.0f, 1.0f, 1.0f);
  106. float4 r11 = float4(1.0f, 1.0f, 1.0f, 1.0f);
  107. float4 oPos = float4(1.0f, 1.0f, 1.0f, 1.0f);
  108. #define r12 oPos
  109. int4 a0; //only use .x
  110.  
  111. //output registers
  112. float4 oT0 = float4(1.0f, 1.0f, 1.0f, 1.0f);
  113. float4 oT1 = float4(1.0f, 1.0f, 1.0f, 1.0f);
  114. float4 oT2 = float4(1.0f, 1.0f, 1.0f, 1.0f);
  115. float4 oT3 = float4(1.0f, 1.0f, 1.0f, 1.0f);
  116. float4 oT4 = float4(1.0f, 1.0f, 1.0f, 1.0f);
  117. float4 oT5 = float4(1.0f, 1.0f, 1.0f, 1.0f);
  118. float4 oT6 = float4(1.0f, 1.0f, 1.0f, 1.0f);
  119. float4 oT7 = float4(1.0f, 1.0f, 1.0f, 1.0f);
  120.  
  121. float oFog = 1.0f;
  122. float oPts = 1.0f;
  123.  
  124. float4 oD0 = float4(1.0f, 1.0f, 1.0f, 1.0f);
  125. float4 oD1 = float4(1.0f, 1.0f, 1.0f, 1.0f);
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133. #define _POSITION va_position
  134.  
  135. #define _NORMAL va_normal
  136. #define _BINORMAL va_binormal
  137. #define _TANGENT va_tangent
  138.  
  139.  
  140. {
  141. float temptemp;
  142. temptemp = dp3(_POSITION , c[0] );
  143. temptemp = temptemp + c[0].wwww ;
  144. {
  145. float4 temp = (float4)(temptemp );
  146. oPos.x=temp.x;
  147. }
  148. }
  149. {
  150. float temptemp;
  151. temptemp = dp3(_POSITION , c[1] );
  152. temptemp = temptemp + c[1].wwww ;
  153. {
  154. float4 temp = (float4)(temptemp );
  155. oPos.y=temp.y;
  156. }
  157. }
  158. {
  159. float temptemp;
  160. temptemp = dp3(_POSITION , c[2] );
  161. temptemp = temptemp + c[2].wwww ;
  162. {
  163. float4 temp = (float4)(temptemp );
  164. oPos.z=temp.z;
  165. }
  166. }
  167. {
  168. float temptemp;
  169. temptemp = dp3(_POSITION , c[3] );
  170. temptemp = temptemp + c[3].wwww ;
  171. {
  172. float4 temp = (float4)(temptemp );
  173. oPos.w=temp.w;
  174. }
  175. }
  176.  
  177.  
  178.  
  179. {
  180. float4 temp = (float4)((va_texcoord * c[172].xyyy ) + c[172].zwww );
  181. r9.x=temp.x;
  182. r9.y=temp.y;
  183. }
  184. {
  185. float4 temp = (float4)((r9 * c[18 + 0].xyyy ) + c[18 + 0].zwww );
  186. r9.x=temp.x;
  187. r9.y=temp.y;
  188. }
  189. {
  190. float4 temp = (float4)(r9 );
  191. oT0.x=temp.x;
  192. oT0.y=temp.y;
  193. }
  194. {
  195. float4 temp = (float4)((r9 * c[18 + 1].xyyy ) + c[18 + 1].zwww );
  196. oT1.x=temp.x;
  197. oT1.y=temp.y;
  198. }
  199.  
  200.  
  201. {
  202. float4 temp = (float4)(va_incident_radiosity );
  203. r11.x=temp.x;
  204. r11.y=temp.y;
  205. r11.z=temp.z;
  206. }
  207. {
  208. float4 temp = (float4)(dp3(r11 , r11 ));
  209. r11.w=temp.w;
  210. }
  211. {
  212. float4 temp = (float4)(rsqrt(r11.wwww ));
  213. r11.w=temp.w;
  214. }
  215. {
  216. float4 temp = (float4)(1.0f / (r11.wwww ));
  217. oD1.w=temp.w;
  218. }
  219.  
  220.  
  221. {
  222. float4 temp = (float4)(dp3(r11 , _TANGENT ));
  223. r10.x=temp.x;
  224. }
  225. {
  226. float4 temp = (float4)(dp3(r11 , _BINORMAL ));
  227. r10.y=temp.y;
  228. }
  229. {
  230. float4 temp = (float4)(dp3(r11 , _NORMAL ));
  231. r10.z=temp.z;
  232. }
  233. {
  234. float4 temp = (float4)(dp3(r10 , r10 ));
  235. r10.w=temp.w;
  236. }
  237. {
  238. float4 temp = (float4)(rsqrt(r10.wwww ));
  239. r10.w=temp.w;
  240. }
  241. {
  242. float4 temp = (float4)(r10 * r10.wwww );
  243. r10.x=temp.x;
  244. r10.y=temp.y;
  245. r10.z=temp.z;
  246. }
  247. {
  248. float4 temp = (float4)((r10 * c[5].wwww ) + c[5].wwww );
  249. oD1.x=temp.x;
  250. oD1.y=temp.y;
  251. oD1.z=temp.z;
  252. }
  253.  
  254.  
  255. {
  256. float4 temp = (float4)((r9 * c[18 + 2].xyyy ) + c[18 + 2].zwww );
  257. oT2.x=temp.x;
  258. oT2.y=temp.y;
  259. }
  260.  
  261.  
  262. {
  263. float4 temp = (float4)(va_secondary_texcoord );
  264. oT3.x=temp.x;
  265. oT3.y=temp.y;
  266. }
  267.  
  268.  
  269. {
  270. float4 temp = (float4)(dp3(c[6] , _TANGENT ));
  271. r10.x=temp.x;
  272. }
  273. {
  274. float4 temp = (float4)(dp3(c[6] , _BINORMAL ));
  275. r10.y=temp.y;
  276. }
  277. {
  278. float4 temp = (float4)(dp3(c[6] , _NORMAL ));
  279. r10.z=temp.z;
  280. }
  281. {
  282. float4 temp = (float4)((r10 * c[5].wwww ) + c[5].wwww );
  283. oD0.x=temp.x;
  284. oD0.y=temp.y;
  285. oD0.z=temp.z;
  286. }
  287.  
  288.  
  289. output.oD0=oD0;
  290. output.oD1=oD1;
  291. output.oT0=oT0;
  292. output.oT1=oT1;
  293. output.oT2=oT2;
  294. output.oT3=oT3;
  295. output.oPos=oPos;
  296. // cram anything additional here that needs to happen at the end of all vertex shaders.
  297.  
  298. output.oT7.xyzw = oPos; //float4(oPos.z, oPos.w);
  299.  
  300.  
  301. return output;
  302. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement