GRAnimated

DV_Nohara .SHARC file

Apr 21st, 2018
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 39.95 KB | None | 0 0
  1. /** @file wii_pipleline_vs.sh
  2. * @brief wiiВ╠ГpГCГvГЙГCГУГGГ~ГЕГМБ[Г^БiТ╕У_Бj
  3. * @author Takuhiro Dohta
  4. */
  5. //------------------------------------------------------------------------------
  6. #version 150
  7.  
  8. //------------------------------------------------------------------------------
  9. // ГnБ[ГhОdЧl
  10. //------------------------------------------------------------------------------
  11. #define CHANNEL_MAX ( 2 )
  12. #define LIGHT_OBJ_MAX ( 8 )
  13. #define FOG_MAX ( 8 )
  14.  
  15. //@@ group="priority" label="Х`ЙцЧDРцУx" order="110"
  16. //@@ renderinfo="priority" group="priority" label="Х`ЙцЧDРцУx" type="int" default="0"
  17.  
  18. //------------------------------------------------------------------------------
  19. // Г}ГNГНТшЛ`
  20. //------------------------------------------------------------------------------
  21. #define chan_ctrl_rgb( n ) chan_ctrl##n##_color.rgb
  22. #define chan_ctrl_a( n ) chan_ctrl##n##_alpha.a
  23. #define reg_color0 mat_color0
  24. #define reg_color1 mat_color1
  25. #define vtx_color0 aColor0
  26. #define vtx_color1 aColor1
  27.  
  28. #define calc_channel( n ) \
  29. { \
  30. vec3 enable_light_rgb = vec3( chan_ctrl##n##_color_light_enable, chan_ctrl##n##_color_light_enable, chan_ctrl##n##_color_light_enable ); \
  31. vec3 light_color_rgb = clamp( diffuse_light.rgb + amb_color##n.rgb * cAmbColor[##n].rgb, 0.0, 1.0 ); \
  32. float light_color_a = clamp( diffuse_light.a + amb_color##n.a, 0.0, 1.0 ); \
  33. color##n##a##n.rgb = chan_ctrl##n##_color.rgb * max( enable_light_rgb, light_color_rgb ); \
  34. color##n##a##n.a = chan_ctrl##n##_alpha.a * max( 1.0 - chan_ctrl##0##_alpha_light_enable, light_color_a ); \
  35. } \
  36.  
  37. //------------------------------------------------------------------------------
  38. #define src_tex0 vec4 tex_coord = vec4( aTexCoord0, 1.0, 1.0 )
  39. #define src_tex1 vec4 tex_coord = vec4( aTexCoord1, 1.0, 1.0 )
  40. #define src_tex2 vec4 tex_coord = vec4( aTexCoord2, 1.0, 1.0 )
  41. #define src_tex3 vec4 tex_coord = vec4( aTexCoord3, 1.0, 1.0 )
  42. #define src_tex4 vec4 tex_coord = vec4( aTexCoord4, 1.0, 1.0 )
  43. #define src_tex5 vec4 tex_coord = vec4( aTexCoord5, 1.0, 1.0 )
  44. #define src_tex6 vec4 tex_coord = vec4( aTexCoord6, 1.0, 1.0 )
  45. #define src_tex7 vec4 tex_coord = vec4( aTexCoord7, 1.0, 1.0 )
  46. #define src_pos vec4 tex_coord = vec4( posv.x, posv.y, posv.z, 1.0 )
  47. #define src_nrm vec4 tex_coord = vec4( nrmv.x * 0.5 + 0.5, nrmv.y * -0.5 + 0.5, 1.0, 1.0 ) // NW4R makes z to 1.0
  48.  
  49. #define expand_tex_func( n ) tex_coord##n##_src_param
  50. #define expand_tex_mtx( n ) tex_coord##n##_mtx
  51.  
  52. #define calc_tex_coord( n ) \
  53. { \
  54. expand_tex_func( n ); \
  55. tex_coord##n##.x = dot( expand_tex_mtx( n )[ 0 ], tex_coord ); \
  56. tex_coord##n##.y = dot( expand_tex_mtx( n )[ 1 ], tex_coord ); \
  57. float tw = dot( expand_tex_mtx( n )[ 2 ], tex_coord ); \
  58. }
  59.  
  60. //------------------------------------------------------------------------------
  61. // Р├УIГoГКГGБ[ГVГЗГУЧpГ}ГNГН
  62. //------------------------------------------------------------------------------
  63. // tag : "chan_ctrl_array"
  64. // attr : "size"
  65. // "2" : "1"
  66. // "4" : "2"
  67. #define channel_num 1
  68.  
  69. // tag : "chan_ctrl"
  70. // attr : channel
  71. // "reg" : mat_color
  72. // "vtx" : vtx_color
  73. #define chan_ctrl0_color mat_color0
  74. #define chan_ctrl0_color_light_enable light_on
  75.  
  76. #define chan_ctrl0_alpha mat_color0
  77. #define chan_ctrl0_alpha_light_enable light_off
  78.  
  79. #define chan_ctrl1_color chan_ctrl0_color
  80. #define chan_ctrl1_alpha chan_ctrl0_ctrl_alpha
  81. #define chan_ctrl1_color_light_enable chan_ctrl0_color_light_enable
  82. #define chan_ctrl1_alpha_light_enable chan_ctrl0_alpha_light_enable
  83.  
  84. //------------------------------------------------------------------------------
  85. // tag : "material"
  86.  
  87. // attr : "fog_index"
  88. // "-1"-"128" : "-1"-"128"
  89. #define fog_index 0
  90.  
  91. //------------------------------------------------------------------------------
  92. // tag : "tex_coord_array"
  93.  
  94. // attr : "size"
  95. // "0"-"15" : "0" - "15"
  96. #define tex_coord_num 1
  97.  
  98. // tag : "tex_coord"
  99.  
  100. // attr : "func"
  101. // "mtx24" : "tex_mtx24"
  102. // "mtx34" : "tex_mtx34"
  103. #define tex_coord0_func tex_mtx24
  104.  
  105. // attr : "src_param"
  106. // "tex0" - "tex7" : "tex0" - "tex7"
  107. // "nrm" : "nrm"
  108. // "pos" : "pos"
  109. #define tex_coord0_src_param src_tex0
  110.  
  111. // attr : "mtx"
  112. // "texmtx0" - "texmtx7" : "texmtx0" - "texmtx7"
  113. #define tex_coord0_mtx texmtx0
  114.  
  115. #define tex_coord1_func tex_mtx24
  116. #define tex_coord1_src_param src_tex0
  117. #define tex_coord1_mtx texmtx0
  118.  
  119. #define tex_coord2_func tex_mtx24
  120. #define tex_coord2_src_param src_tex0
  121. #define tex_coord2_mtx texmtx0
  122.  
  123. #define tex_coord3_func tex_mtx24
  124. #define tex_coord3_src_param src_tex0
  125. #define tex_coord3_mtx texmtx0
  126.  
  127. #define tex_coord4_func tex_mtx24
  128. #define tex_coord4_src_param src_tex0
  129. #define tex_coord4_mtx texmtx0
  130.  
  131. #define tex_coord5_func tex_mtx24
  132. #define tex_coord5_src_param src_tex0
  133. #define tex_coord5_mtx texmtx0
  134.  
  135. #define tex_coord6_func tex_mtx24
  136. #define tex_coord6_src_param src_tex0
  137. #define tex_coord6_mtx texmtx0
  138.  
  139. #define tex_coord7_func tex_mtx24
  140. #define tex_coord7_src_param src_tex0
  141. #define tex_coord7_mtx texmtx0
  142.  
  143. //------------------------------------------------------------------------------
  144. // К┬ЛлВ╞ОЛУ_ВЁНЗВэВ╣В╜ГfБ[Г^
  145. //------------------------------------------------------------------------------
  146. layout(std140) uniform MdlEnvView
  147. {
  148. vec4 cView[ 3 ];
  149. vec4 cViewProj[ 4 ];
  150. vec3 cLightDiffDir[ LIGHT_OBJ_MAX ];
  151. vec4 cLightDiffColor[ LIGHT_OBJ_MAX ];
  152. vec4 cAmbColor[ CHANNEL_MAX ];
  153. vec3 cFogColor[ FOG_MAX ];
  154. float cFogStart[ FOG_MAX ];
  155. float cFogStartEndInv[ FOG_MAX ];
  156. };
  157.  
  158. //------------------------------------------------------------------------------
  159. // SkeletonВ▓В╞В╠uniform
  160. //------------------------------------------------------------------------------
  161. layout(std140) uniform MdlMtx
  162. {
  163. vec4 cMtxPalette[ 64 * 3 ];
  164. };
  165.  
  166. //------------------------------------------------------------------------------
  167. // ShapeВ▓В╞В╠uniform
  168. //------------------------------------------------------------------------------
  169. #if 0
  170.  
  171. layout(std140) uniform Shp
  172. {
  173. int cWeightNum;
  174. };
  175.  
  176. #else
  177.  
  178. layout(std140) uniform Shp
  179. {
  180. vec4 cShpMtx[ 3 ];
  181. int cWeightNum;
  182. };
  183.  
  184. #endif
  185.  
  186. //------------------------------------------------------------------------------
  187. // Г}ГeГКГAГЛ
  188. //------------------------------------------------------------------------------
  189. layout(std140) uniform Mat
  190. {
  191. vec4 mat_color0; // @@ id="mat_color0" item="color" default="1 1 1 1"
  192. vec4 mat_color1; // @@ id="mat_color1" item="color" default="1 1 1 1"
  193. vec4 amb_color0; // @@ id="amb_color0" item="color" default="1 1 1 1"
  194. vec4 amb_color1; // @@ id="amb_color1" item="color" default="1 1 1 1"
  195. vec4 tev_color0; // @@ id="tev_color0" item="color" default="1 1 1 1"
  196. vec4 tev_color1; // @@ id="tev_color1" item="color" default="1 1 1 1"
  197. vec4 tev_color2; // @@ id="tev_color2" item="color" default="1 1 1 1"
  198. vec4 konst0; // @@ id="konst0" item="color" default="1 1 1 1"
  199. vec4 konst1; // @@ id="konst1" item="color" default="1 1 1 1"
  200. vec4 konst2; // @@ id="konst2" item="color" default="1 1 1 1"
  201. vec4 konst3; // @@ id="konst3" item="color" default="1 1 1 1"
  202. vec4 ind_texmtx0[ 2 ]; // @@ id="ind_texmtx0" type="srt2d" default="1 1 0 0 0"
  203. vec4 ind_texmtx1[ 2 ]; // @@ id="ind_texmtx1" type="srt2d" default="1 1 0 0 0"
  204. vec4 ind_texmtx2[ 2 ]; // @@ id="ind_texmtx2" type="srt2d" default="1 1 0 0 0"
  205. vec4 texmtx0[ 3 ]; // @@ id="texmtx0" type="texsrt_ex" default="0 1 1 0 0 0" hint="albedo0"
  206. vec4 texmtx1[ 3 ]; // @@ id="texmtx1" type="texsrt_ex" default="0 1 1 0 0 0" hint="albedo1"
  207. vec4 texmtx2[ 3 ]; // @@ id="texmtx2" type="texsrt_ex" default="0 1 1 0 0 0" hint="albedo2"
  208. vec4 texmtx3[ 3 ]; // @@ id="texmtx3" type="texsrt_ex" default="0 1 1 0 0 0" hint="albedo3"
  209. vec4 texmtx4[ 3 ]; // @@ id="texmtx4" type="texsrt_ex" default="0 1 1 0 0 0" hint="albedo4"
  210. vec4 texmtx5[ 3 ]; // @@ id="texmtx5" type="texsrt_ex" default="0 1 1 0 0 0" hint="albedo5"
  211. vec4 texmtx6[ 3 ]; // @@ id="texmtx6" type="texsrt_ex" default="0 1 1 0 0 0" hint="albedo6"
  212. vec4 texmtx7[ 3 ]; // @@ id="texmtx7" type="texsrt_ex" default="0 1 1 0 0 0" hint="albedo7"
  213. };
  214.  
  215. //------------------------------------------------------------------------------
  216. in vec3 aPosition; // @@ id="_p0" hint="position0"
  217. in vec3 aNormal; // @@ id="_n0" hint="normal0"
  218. in vec4 aBlendWeight; // @@ id="_w0" hint="blendweight0"
  219. in ivec4 aBlendIndex; // @@ id="_i0" hint="blendindex0"
  220. in vec2 aTexCoord0; // @@ id="_u0" hint="uv0"
  221. in vec2 aTexCoord1; // @@ id="_u1" hint="uv1"
  222. in vec2 aTexCoord2; // @@ id="_u2" hint="uv2"
  223. in vec2 aTexCoord3; // @@ id="_u3" hint="uv3"
  224. in vec2 aTexCoord4; // @@ id="_u4" hint="uv4"
  225. in vec2 aTexCoord5; // @@ id="_u5" hint="uv5"
  226. in vec2 aTexCoord6; // @@ id="_u6" hint="uv6"
  227. in vec2 aTexCoord7; // @@ id="_u7" hint="uv7"
  228. in vec4 aColor0; // @@ id="_c0" hint="color0"
  229. in vec4 aColor1; // @@ id="_c1" hint="color1"
  230.  
  231. out vec2 tex_coord0;
  232. out vec2 tex_coord1;
  233. out vec2 tex_coord2;
  234. out vec2 tex_coord3;
  235. out vec2 tex_coord4;
  236. out vec2 tex_coord5;
  237. out vec2 tex_coord6;
  238. out vec2 tex_coord7;
  239. out vec4 color0a0;
  240. out vec4 color1a1;
  241. out vec4 fog_color;
  242. // red-pro2
  243. out vec3 normal;
  244.  
  245. const float light_on = 0.0;
  246. const float light_off = 1.0;
  247.  
  248. #define calc_weight_skining( weight_index ) \
  249. { \
  250. int index = aBlendIndex[ weight_index ] * 3; \
  251. float weight = aBlendWeight[ weight_index ]; \
  252. posw.x += weight * dot( cMtxPalette[ index + 0 ], pos ); \
  253. posw.y += weight * dot( cMtxPalette[ index + 1 ], pos ); \
  254. posw.z += weight * dot( cMtxPalette[ index + 2 ], pos ); \
  255. nrmw.x += weight * dot( cMtxPalette[ index + 0 ], nrm ); \
  256. nrmw.y += weight * dot( cMtxPalette[ index + 1 ], nrm ); \
  257. nrmw.z += weight * dot( cMtxPalette[ index + 2 ], nrm ); \
  258. }
  259.  
  260. void main()
  261. {
  262. vec4 pos = vec4( aPosition, 1 );
  263. vec4 nrm = vec4( aNormal, 0 );
  264.  
  265. vec4 posw = vec4( 0.0, 0.0, 0.0, 1.0 );
  266. vec4 nrmw = vec4( 0.0 );
  267.  
  268. // GLSLВ╠Н┼УKЙ╗В╔ВцВщХ╧В╚ЛУУоВЁЦhВоВ╜В▀В╔4В┬В▄В┼В═ГxГ^ПСВлВ╡В─ВиВн
  269. switch ( cWeightNum )
  270. {
  271. case 0:
  272. {
  273. posw.x = dot( cShpMtx[ 0 ], pos );
  274. posw.y = dot( cShpMtx[ 1 ], pos );
  275. posw.z = dot( cShpMtx[ 2 ], pos );
  276.  
  277. nrmw.x = dot( cShpMtx[ 0 ], nrm );
  278. nrmw.y = dot( cShpMtx[ 1 ], nrm );
  279. nrmw.z = dot( cShpMtx[ 2 ], nrm );
  280. break;
  281. }
  282. case 1:
  283. {
  284. int index = aBlendIndex[ 0 ] * 3;
  285.  
  286. posw.x = dot( cMtxPalette[ index + 0 ], pos );
  287. posw.y = dot( cMtxPalette[ index + 1 ], pos );
  288. posw.z = dot( cMtxPalette[ index + 2 ], pos );
  289.  
  290. nrmw.x = dot( cMtxPalette[ index + 0 ], nrm );
  291. nrmw.y = dot( cMtxPalette[ index + 1 ], nrm );
  292. nrmw.z = dot( cMtxPalette[ index + 2 ], nrm );
  293. break;
  294. }
  295. case 2:
  296. {
  297. calc_weight_skining( 0 );
  298. calc_weight_skining( 1 );
  299. break;
  300. }
  301. case 3:
  302. {
  303. calc_weight_skining( 0 );
  304. calc_weight_skining( 1 );
  305. calc_weight_skining( 2 );
  306. break;
  307. }
  308. case 4:
  309. {
  310. calc_weight_skining( 0 );
  311. calc_weight_skining( 1 );
  312. calc_weight_skining( 2 );
  313. calc_weight_skining( 3 );
  314. break;
  315. }
  316. default:
  317. {
  318. // ИъЙЮОcВ╡В─ВиВнВкБAВ▒В▒В╔ЧИВщВ╠В═ФёРДПз
  319. for ( int i = 0; i < cWeightNum; ++i )
  320. {
  321. calc_weight_skining( i );
  322. }
  323. break;
  324. }
  325. }
  326.  
  327. nrmw = normalize( nrmw );
  328.  
  329. vec3 nrmv = vec3( dot( cView[ 0 ], nrmw ), dot( cView[ 1 ], nrmw ), dot( cView[ 2 ], nrmw ) );
  330. vec3 posv = vec3( dot( cView[ 0 ], posw ), dot( cView[ 1 ], posw ), dot( cView[ 2 ], posw ) );
  331.  
  332. vec4 diffuse_light = vec4( 0.0 );
  333. for ( int i = 0; i < LIGHT_OBJ_MAX; ++i )
  334. {
  335. diffuse_light += clamp( -dot( nrmv, cLightDiffDir[ i ] ), 0.0, 1.0 ) * cLightDiffColor[ i ];
  336. }
  337. diffuse_light = clamp( diffuse_light, 0.0, 1.0 );
  338.  
  339. #if ( 0 < channel_num )
  340. calc_channel( 0 );
  341. #endif
  342.  
  343. #if ( 1 < channel_num )
  344. calc_channel( 1 );
  345. #endif
  346.  
  347. #if ( 0 < tex_coord_num )
  348. calc_tex_coord( 0 );
  349. #endif
  350.  
  351. #if ( 1 < tex_coord_num )
  352. calc_tex_coord( 1 );
  353. #endif
  354.  
  355. #if ( 2 < tex_coord_num )
  356. calc_tex_coord( 2 );
  357. #endif
  358.  
  359. #if ( 3 < tex_coord_num )
  360. calc_tex_coord( 3 );
  361. #endif
  362.  
  363. #if ( 4 < tex_coord_num )
  364. calc_tex_coord( 4 );
  365. #endif
  366.  
  367. #if ( 5 < tex_coord_num )
  368. calc_tex_coord( 5 );
  369. #endif
  370.  
  371. #if ( 6 < tex_coord_num )
  372. calc_tex_coord( 6 );
  373. #endif
  374.  
  375. #if ( 7 < tex_coord_num )
  376. calc_tex_coord( 7 );
  377. #endif
  378.  
  379. #if ( 0 <= fog_index )
  380.  
  381. // if vertex color
  382. fog_color.rgb = cFogColor[ fog_index ].rgb;
  383. fog_color.a = clamp( ( -posv.z - cFogStart[ fog_index ] ) * cFogStartEndInv[ fog_index ], 0.0, 1.0 );
  384.  
  385. #else
  386.  
  387. fog_color.rgb = vec3( 1.0 );
  388. fog_color.a = 0.0;
  389.  
  390. #endif
  391.  
  392. gl_Position.x = dot( cViewProj[ 0 ], posw );
  393. gl_Position.y = dot( cViewProj[ 1 ], posw );
  394. gl_Position.z = dot( cViewProj[ 2 ], posw );
  395. gl_Position.w = dot( cViewProj[ 3 ], posw );
  396.  
  397. normal.xyz = nrmw.xyz;
  398. }
  399.  
  400.  
  401. Еa  ba ba wii_pipeline_fs.sh //------------------------------------------------------------------------------
  402. /** @file wii_pipleline_fs.sh
  403. * @brief wiiВ╠ГpГCГvГЙГCГУГGГ~ГЕГМБ[Г^БiГtГЙГOГБГУГgБj
  404. * @author Takuhiro Dohta
  405. */
  406. //------------------------------------------------------------------------------
  407. //------------------------------------------------------------------------------
  408. // ГnБ[ГhОdЧl
  409. //------------------------------------------------------------------------------
  410. #define TEV_STAGE_MAX ( 8 )
  411. #define IND_STAGE_MAX ( 4 )
  412.  
  413. //------------------------------------------------------------------------------
  414. // Г}ГNГНТшЛ`
  415. //------------------------------------------------------------------------------
  416. #define konst_color8( x ) vec4( x / 8.0 )
  417. #define expand_swap_table( n ) swap_table##n
  418. #define swap_table( c, n ) c.expand_swap_table( n )
  419. #define tev_tex_coord( n ) stage_ind##n##_offset( stage##n##_tex_coord_order, textureSize( stage##n##_tex_map_order, 0 ) )
  420. #define tev_tex_fetch( n ) texture( stage##n##_tex_map_order, tev_tex_coord( n ) )
  421. #define ind_tex_fetch( n ) texture( ind_stage##n##_tex_map_order, ind_stage##n##_tex_coord_order )
  422.  
  423. #define ind_offset0( tex_coord, tex_size ) ( ( tex_coord ) + ( ind_offset0_ ) / ( tex_size ) )
  424. #define ind_offset1( tex_coord, tex_size ) ( ( tex_coord ) + ( ind_offset1_ ) / ( tex_size ) )
  425. #define ind_offset2( tex_coord, tex_size ) ( ( tex_coord ) + ( ind_offset2_ ) / ( tex_size ) )
  426. #define ind_offset3( tex_coord, tex_size ) ( ( tex_coord ) + ( ind_offset3_ ) / ( tex_size ) )
  427. #define ind_offset_null( tex_coord, tex_size ) ( ( tex_coord ) )
  428. #define divide_2( stage ) ( ( stage ) * 0.5 )
  429. #define scale_1( stage ) ( ( stage ) )
  430. #define scale_2( stage ) ( ( stage ) * 2.0 )
  431. #define scale_4( stage ) ( ( stage ) * 4.0 )
  432. #define op_add( a, b ) ( ( a ) + ( b ) )
  433. #define op_sub( a, b ) ( ( a ) - ( b ) )
  434. #define bias_zero_rgb( stage ) ( ( stage ) )
  435. #define bias_add_half_rgb( stage ) ( ( stage ) + vec3( 0.5 ) )
  436. #define bias_sub_half_rgb( stage ) ( ( stage ) - vec3( 0.5 ) )
  437. #define bias_zero_a( stage ) ( ( stage ) )
  438. #define bias_add_half_a( stage ) ( ( stage ) + 0.5 )
  439. #define bias_sub_half_a( stage ) ( ( stage ) - 0.5 )
  440.  
  441. #define calc_tev_rgb( ca, cb, cc, cd, op, bias, scale ) \
  442. clamp( scale( bias( op( ( cd ), ( ( one.rgb - ( cc ) ) * ( ca ) + ( cc ) * ( cb ) ) ) ) ), 0.0, 1.0 )
  443.  
  444. #define calc_tev_alpha( aa, ab, ac, ad, op, bias, scale ) \
  445. clamp( scale( bias( op( ( ad ), ( ( one.a - ( ac ) ) * ( aa ) + ( ac ) * ( ab ) ) ) ) ), 0.0, 1.0 )
  446.  
  447. #define calc_tev_stage( n ) \
  448. { \
  449. vec4 ras = swap_table( stage##n##_ras_order, stage##n##_ras_swap ); \
  450. vec4 tex = tev_tex_fetch( n ); \
  451. tex = swap_table( tex, stage##n##_tex_map_swap ); \
  452. \
  453. vec3 konst_color = stage_color##n##_konst; \
  454. float konst_alpha = stage_alpha##n##_konst; \
  455. \
  456. stage_color##n##_out_reg.rgb = calc_tev_rgb( stage_color##n##_a, \
  457. stage_color##n##_b, \
  458. stage_color##n##_c, \
  459. stage_color##n##_d, \
  460. stage_color##n##_op, \
  461. stage_color##n##_bias, \
  462. stage_color##n##_scale \
  463. ); \
  464. \
  465. stage_alpha##n##_out_reg.a = calc_tev_alpha( stage_alpha##n##_a, \
  466. stage_alpha##n##_b, \
  467. stage_alpha##n##_c, \
  468. stage_alpha##n##_d, \
  469. stage_alpha##n##_op, \
  470. stage_alpha##n##_bias, \
  471. stage_alpha##n##_scale \
  472. ); \
  473. }
  474.  
  475. #define calc_ind_stage( n ) \
  476. { \
  477. vec4 tex = ind_tex_fetch( n ) - vec4( 0.5 ); \
  478. ind_offset##n##_ = ind_texmtx##n[ 0 ].xy * tex.a + ind_texmtx##n[ 0 ].zw * tex.r + ind_texmtx##n[ 1 ].xy * tex.r; \
  479. ind_offset##n##_ = ( ind_offset##n##_ ) * 255.0; \
  480. }
  481.  
  482. //------------------------------------------------------------------------------
  483. // tag : "indirect_stage_array"
  484.  
  485. // attr : "size"
  486.  
  487. // "0"-"15" : "0" - "15"
  488. #define ind_stage_num 0
  489.  
  490. // attr : "tex_map_order"
  491.  
  492. // "-1", "0" - "7" : "ind_tex_map0", "ind_tex_map0" - "ind_tex_map7"
  493. #define ind_stage0_tex_map_order tex_map0
  494.  
  495. // attr : "tex_coord_order"
  496.  
  497. // "-1", "0" - "7" : "ind_tex_coord0", "ind_tex_coord0" - "ind_tex_coord7"
  498. #define ind_stage0_tex_coord_order tex_coord0
  499.  
  500. #define ind_stage1_tex_map_order tex_map1
  501. #define ind_stage1_tex_coord_order tex_coord1
  502. #define ind_stage2_tex_map_order tex_map2
  503. #define ind_stage2_tex_coord_order tex_coord2
  504. #define ind_stage3_tex_map_order tex_map3
  505. #define ind_stage3_tex_coord_order tex_coord3
  506.  
  507. //------------------------------------------------------------------------------
  508. // tag : "add_indirect_combination_array"
  509.  
  510. // attr : "size"
  511.  
  512. // "0"-"15" : "0" - "15"
  513. #define ind_combination_num 0
  514.  
  515. //------------------------------------------------------------------------------
  516. // tag : "tev_stage_array"
  517.  
  518. // attr : "size"
  519.  
  520. // "0"-"15" : "0" - "15"
  521. #define tev_stage_num 8
  522.  
  523. // attr : "swap_table0" - "swap_table3"
  524.  
  525. // ex."r g b a" : "rgba"
  526. // ex."r r r b" : "rrrb"
  527. #define swap_table0 rgba
  528. #define swap_table1 rgba
  529. #define swap_table2 rgba
  530. #define swap_table3 rgba
  531.  
  532. //------------------------------------------------------------------------------
  533. // tag : "tev_stage"
  534.  
  535. // attr : "ras_order"
  536.  
  537. // "color0a0" : "color0a0"
  538. // "color1a1" : "color1a1"
  539. // "color_null" : "color_null"
  540. #define stage0_ras_order color0a0
  541.  
  542. // attr : "tex_map_order"
  543.  
  544. // "-1", "0" - "7" : "tex_map0", "tex_map0" - "tex_map7"
  545. #define stage0_tex_map_order tex_map0
  546.  
  547. // attr : "tex_coord_order"
  548.  
  549. // "-1", "0" - "7" : "tex_coord0", "tex_coord0" - "tex_coord7"
  550. #define stage0_tex_coord_order tex_coord0
  551.  
  552. // attr : "ras_swap"
  553.  
  554. // "0" - "3" : "0" - "3"
  555. #define stage0_ras_swap 0
  556.  
  557. // attr : "tex_map_swap"
  558.  
  559. // "0" - "3" : "0"-"3"
  560. #define stage0_tex_map_swap 0
  561.  
  562. //------------------------------------------------------------------------------
  563. // tag : "tev_stage_color"
  564.  
  565. // attr : "a", "b", "c", "d"
  566.  
  567. // "rasc" : "ras.rgb"
  568. // "rasa" : "ras.a"
  569. // "texc" : "tex.rgb"
  570. // "texa" : "tex.a"
  571. // "c0" : "reg0.rgb"
  572. // "a0" : "reg0.aaa"
  573. // "c1" : "reg1.rgb"
  574. // "a1" : "reg1.aaa"
  575. // "c2" : "reg2.rgb"
  576. // "a2" : "reg2.aaa"
  577. // "cprev" : "prev.rgb"
  578. // "aprev" : "prev.aaa"
  579. // "konst" : "konst_color.rgb"
  580. // "zero" : "zero.rgb"
  581. // "half" : "half_rgb"
  582. // "one" : "one.rgb"
  583. #define stage_color0_a zero.rgb
  584. #define stage_color0_b tex.rgb
  585. #define stage_color0_c ras.rgb
  586. #define stage_color0_d zero.rgb
  587.  
  588. // attr : "constant"
  589.  
  590. // "k0" : "konst0.rgb"
  591. // "k0_r" : "konst0.rrr"
  592. // "k0_g" : "konst0.ggg"
  593. // "k0_b" : "konst0.bbb"
  594. // "k0_a" : "konst0.aaa"
  595. // "k1" : "konst1.rgb"
  596. // "k1_r" : "konst1.rrr"
  597. // "k1_g" : "konst1.ggg"
  598. // "k1_b" : "konst1.bbb"
  599. // "k1_a" : "konst1.aaa"
  600. // "k2" : "konst2.rgb"
  601. // "k2_r" : "konst2.rrr"
  602. // "k2_g" : "konst2.ggg"
  603. // "k2_b" : "konst2.bbb"
  604. // "k2_a" : "konst2.aaa"
  605. // "k3" : "konst3.rgb"
  606. // "k3_r" : "konst3.rrr"
  607. // "k3_g" : "konst3.ggg"
  608. // "k3_b" : "konst3.bbb"
  609. // "k3_a" : "konst3.aaa"
  610. // "8_8" : "konst_8_8.rgb"
  611. // "7_8" : "konst_7_8.rgb"
  612. // "6_8" : "konst_6_8.rgb"
  613. // "5_8" : "konst_5_8.rgb"
  614. // "4_8" : "konst_4_8.rgb"
  615. // "3_8" : "konst_3_8.rgb"
  616. // "2_8" : "konst_2_8.rgb"
  617. // "1_8" : "konst_1_8.rgb"
  618. #define stage_color0_konst konst_8_8.rgb
  619.  
  620. // attr : "op"
  621.  
  622. // "add" : "op_add"
  623. // "sub" : "op_sub"
  624. #define stage_color0_op op_add
  625.  
  626. // attr : "bias"
  627.  
  628. // "zero" : "bias_zero_rgb"
  629. // "sub_half" : "bias_sub_half_rgb"
  630. // "add_half" : "bias_add_half_rgb"
  631. #define stage_color0_bias bias_zero_rgb
  632.  
  633. // attr : "scale"
  634.  
  635. // "divide_2" : "divide_2
  636. // "scale_1" : "scale_1
  637. // "scale_2" : "scale_2
  638. // "scale_4" : "scale_4
  639. #define stage_color0_scale scale_1
  640.  
  641. // attr : "out_reg"
  642.  
  643. // "reg0" : "reg0"
  644. // "reg1" : "reg1"
  645. // "reg2" : "reg2"
  646. // "prev" : "prev"
  647. #define stage_color0_out_reg prev
  648.  
  649. //------------------------------------------------------------------------------
  650. // tag : "tev_stage_alpha"
  651.  
  652. // attr : "a", "b", "c", "d"
  653.  
  654. // "rasa" : "ras.a"
  655. // "texa" : "tex.a"
  656. // "a0" : "reg0.a"
  657. // "a1" : "reg1.a"
  658. // "a2" : "reg2.a"
  659. // "aprev" : "prev.a"
  660. // "konst" : "konst_alpha"
  661. // "zero" : "zero.a"
  662. #define stage_alpha0_a zero.a
  663. #define stage_alpha0_b tex.a
  664. #define stage_alpha0_c ras.a
  665. #define stage_alpha0_d zero.a
  666. #define stage_alpha0_op op_add
  667.  
  668. // attr : "constant"
  669.  
  670. // "k0_r" : "konst0.r"
  671. // "k0_g" : "konst0.g"
  672. // "k0_b" : "konst0.b"
  673. // "k0_a" : "konst0.a"
  674. // "k1_r" : "konst1.r"
  675. // "k1_g" : "konst1.g"
  676. // "k1_b" : "konst1.b"
  677. // "k1_a" : "konst1.a"
  678. // "k2_r" : "konst2.r"
  679. // "k2_g" : "konst2.g"
  680. // "k2_b" : "konst2.b"
  681. // "k2_a" : "konst2.a"
  682. // "k3_r" : "konst3.r"
  683. // "k3_g" : "konst3.g"
  684. // "k3_b" : "konst3.b"
  685. // "k3_a" : "konst3.a"
  686. // "8_8" : "konst_8_8.a"
  687. // "7_8" : "konst_7_8.a"
  688. // "6_8" : "konst_6_8.a"
  689. // "5_8" : "konst_5_8.a"
  690. // "4_8" : "konst_4_8.a"
  691. // "3_8" : "konst_3_8.a"
  692. // "2_8" : "konst_2_8.a"
  693. // "1_8" : "konst_1_8.a"
  694. #define stage_alpha0_konst konst_8_8.a
  695.  
  696. #define stage_alpha0_bias bias_zero_a
  697. #define stage_alpha0_scale scale_1
  698. #define stage_alpha0_out_reg prev
  699.  
  700. //------------------------------------------------------------------------------
  701. #define stage_ind0_offset ind_offset_null
  702.  
  703. //------------------------------------------------------------------------------
  704. #define stage1_tex_map_order stage0_tex_map_order
  705. #define stage1_tex_coord_order stage0_tex_coord_order
  706. #define stage1_ras_order stage0_ras_order
  707. #define stage1_ras_swap stage0_ras_swap
  708. #define stage1_tex_map_swap stage0_tex_map_swap
  709. #define stage_color1_a stage_color0_a
  710. #define stage_color1_b stage_color0_b
  711. #define stage_color1_c stage_color0_c
  712. #define stage_color1_d stage_color0_d
  713. #define stage_color1_konst stage_color0_konst
  714. #define stage_color1_op stage_color0_op
  715. #define stage_color1_bias stage_color0_bias
  716. #define stage_color1_scale stage_color0_scale
  717. #define stage_color1_out_reg stage_color0_out_reg
  718. #define stage_alpha1_a stage_alpha0_a
  719. #define stage_alpha1_b stage_alpha0_b
  720. #define stage_alpha1_c stage_alpha0_c
  721. #define stage_alpha1_d stage_alpha0_d
  722. #define stage_alpha1_konst stage_alpha0_konst
  723. #define stage_alpha1_op stage_alpha0_op
  724. #define stage_alpha1_bias stage_alpha0_bias
  725. #define stage_alpha1_scale stage_alpha0_scale
  726. #define stage_alpha1_out_reg stage_alpha0_out_reg
  727. #define stage_ind1_offset ind_offset_null
  728.  
  729. //------------------------------------------------------------------------------
  730. #define stage2_tex_map_order stage0_tex_map_order
  731. #define stage2_tex_coord_order stage0_tex_coord_order
  732. #define stage2_ras_order stage0_ras_order
  733. #define stage2_ras_swap stage0_ras_swap
  734. #define stage2_tex_map_swap stage0_tex_map_swap
  735. #define stage_color2_a stage_color0_a
  736. #define stage_color2_b stage_color0_b
  737. #define stage_color2_c stage_color0_c
  738. #define stage_color2_d stage_color0_d
  739. #define stage_color2_konst stage_color0_konst
  740. #define stage_color2_op stage_color0_op
  741. #define stage_color2_bias stage_color0_bias
  742. #define stage_color2_scale stage_color0_scale
  743. #define stage_color2_out_reg stage_color0_out_reg
  744. #define stage_alpha2_a stage_alpha0_a
  745. #define stage_alpha2_b stage_alpha0_b
  746. #define stage_alpha2_c stage_alpha0_c
  747. #define stage_alpha2_d stage_alpha0_d
  748. #define stage_alpha2_konst stage_alpha0_konst
  749. #define stage_alpha2_op stage_alpha0_op
  750. #define stage_alpha2_bias stage_alpha0_bias
  751. #define stage_alpha2_scale stage_alpha0_scale
  752. #define stage_alpha2_out_reg stage_alpha0_out_reg
  753. #define stage_ind2_offset ind_offset_null
  754.  
  755. //------------------------------------------------------------------------------
  756. #define stage3_tex_map_order stage0_tex_map_order
  757. #define stage3_tex_coord_order stage0_tex_coord_order
  758. #define stage3_ras_order stage0_ras_order
  759. #define stage3_ras_swap stage0_ras_swap
  760. #define stage3_tex_map_swap stage0_tex_map_swap
  761. #define stage_color3_a stage_color0_a
  762. #define stage_color3_b stage_color0_b
  763. #define stage_color3_c stage_color0_c
  764. #define stage_color3_d stage_color0_d
  765. #define stage_color3_konst stage_color0_konst
  766. #define stage_color3_op stage_color0_op
  767. #define stage_color3_bias stage_color0_bias
  768. #define stage_color3_scale stage_color0_scale
  769. #define stage_color3_out_reg stage_color0_out_reg
  770. #define stage_alpha3_a stage_alpha0_a
  771. #define stage_alpha3_b stage_alpha0_b
  772. #define stage_alpha3_c stage_alpha0_c
  773. #define stage_alpha3_d stage_alpha0_d
  774. #define stage_alpha3_konst stage_alpha0_konst
  775. #define stage_alpha3_op stage_alpha0_op
  776. #define stage_alpha3_bias stage_alpha0_bias
  777. #define stage_alpha3_scale stage_alpha0_scale
  778. #define stage_alpha3_out_reg stage_alpha0_out_reg
  779. #define stage_ind3_offset ind_offset_null
  780.  
  781. //------------------------------------------------------------------------------
  782. #define stage4_tex_map_order stage0_tex_map_order
  783. #define stage4_tex_coord_order stage0_tex_coord_order
  784. #define stage4_ras_order stage0_ras_order
  785. #define stage4_ras_swap stage0_ras_swap
  786. #define stage4_tex_map_swap stage0_tex_map_swap
  787. #define stage_color4_a stage_color0_a
  788. #define stage_color4_b stage_color0_b
  789. #define stage_color4_c stage_color0_c
  790. #define stage_color4_d stage_color0_d
  791. #define stage_color4_konst stage_color0_konst
  792. #define stage_color4_op stage_color0_op
  793. #define stage_color4_bias stage_color0_bias
  794. #define stage_color4_scale stage_color0_scale
  795. #define stage_color4_out_reg stage_color0_out_reg
  796. #define stage_alpha4_a stage_alpha0_a
  797. #define stage_alpha4_b stage_alpha0_b
  798. #define stage_alpha4_c stage_alpha0_c
  799. #define stage_alpha4_d stage_alpha0_d
  800. #define stage_alpha4_konst stage_alpha0_konst
  801. #define stage_alpha4_op stage_alpha0_op
  802. #define stage_alpha4_bias stage_alpha0_bias
  803. #define stage_alpha4_scale stage_alpha0_scale
  804. #define stage_alpha4_out_reg stage_alpha0_out_reg
  805. #define stage_ind4_offset ind_offset_null
  806.  
  807. //------------------------------------------------------------------------------
  808. #define stage5_tex_map_order stage0_tex_map_order
  809. #define stage5_tex_coord_order stage0_tex_coord_order
  810. #define stage5_ras_order stage0_ras_order
  811. #define stage5_ras_swap stage0_ras_swap
  812. #define stage5_tex_map_swap stage0_tex_map_swap
  813. #define stage_color5_a stage_color0_a
  814. #define stage_color5_b stage_color0_b
  815. #define stage_color5_c stage_color0_c
  816. #define stage_color5_d stage_color0_d
  817. #define stage_color5_konst stage_color0_konst
  818. #define stage_color5_op stage_color0_op
  819. #define stage_color5_bias stage_color0_bias
  820. #define stage_color5_scale stage_color0_scale
  821. #define stage_color5_out_reg stage_color0_out_reg
  822. #define stage_alpha5_a stage_alpha0_a
  823. #define stage_alpha5_b stage_alpha0_b
  824. #define stage_alpha5_c stage_alpha0_c
  825. #define stage_alpha5_d stage_alpha0_d
  826. #define stage_alpha5_konst stage_alpha0_konst
  827. #define stage_alpha5_op stage_alpha0_op
  828. #define stage_alpha5_bias stage_alpha0_bias
  829. #define stage_alpha5_scale stage_alpha0_scale
  830. #define stage_alpha5_out_reg stage_alpha0_out_reg
  831. #define stage_ind5_offset ind_offset_null
  832.  
  833. //------------------------------------------------------------------------------
  834. #define stage6_tex_map_order stage0_tex_map_order
  835. #define stage6_tex_coord_order stage0_tex_coord_order
  836. #define stage6_ras_order stage0_ras_order
  837. #define stage6_ras_swap stage0_ras_swap
  838. #define stage6_tex_map_swap stage0_tex_map_swap
  839. #define stage_color6_a stage_color0_a
  840. #define stage_color6_b stage_color0_b
  841. #define stage_color6_c stage_color0_c
  842. #define stage_color6_d stage_color0_d
  843. #define stage_color6_konst stage_color0_konst
  844. #define stage_color6_op stage_color0_op
  845. #define stage_color6_bias stage_color0_bias
  846. #define stage_color6_scale stage_color0_scale
  847. #define stage_color6_out_reg stage_color0_out_reg
  848. #define stage_alpha6_a stage_alpha0_a
  849. #define stage_alpha6_b stage_alpha0_b
  850. #define stage_alpha6_c stage_alpha0_c
  851. #define stage_alpha6_d stage_alpha0_d
  852. #define stage_alpha6_konst stage_alpha0_konst
  853. #define stage_alpha6_op stage_alpha0_op
  854. #define stage_alpha6_bias stage_alpha0_bias
  855. #define stage_alpha6_scale stage_alpha0_scale
  856. #define stage_alpha6_out_reg stage_alpha0_out_reg
  857. #define stage_ind6_offset ind_offset_null
  858.  
  859. //------------------------------------------------------------------------------
  860. #define stage7_tex_map_order stage0_tex_map_order
  861. #define stage7_tex_coord_order stage0_tex_coord_order
  862. #define stage7_ras_order stage0_ras_order
  863. #define stage7_ras_swap stage0_ras_swap
  864. #define stage7_tex_map_swap stage0_tex_map_swap
  865. #define stage_color7_a stage_color0_a
  866. #define stage_color7_b stage_color0_b
  867. #define stage_color7_c stage_color0_c
  868. #define stage_color7_d stage_color0_d
  869. #define stage_color7_konst stage_color0_konst
  870. #define stage_color7_op stage_color0_op
  871. #define stage_color7_bias stage_color0_bias
  872. #define stage_color7_scale stage_color0_scale
  873. #define stage_color7_out_reg stage_color0_out_reg
  874. #define stage_alpha7_a stage_alpha0_a
  875. #define stage_alpha7_b stage_alpha0_b
  876. #define stage_alpha7_c stage_alpha0_c
  877. #define stage_alpha7_d stage_alpha0_d
  878. #define stage_alpha7_konst stage_alpha0_konst
  879. #define stage_alpha7_op stage_alpha0_op
  880. #define stage_alpha7_bias stage_alpha0_bias
  881. #define stage_alpha7_scale stage_alpha0_scale
  882. #define stage_alpha7_out_reg stage_alpha0_out_reg
  883. #define stage_ind7_offset ind_offset_null
  884.  
  885. //------------------------------------------------------------------------------
  886. // Г}ГeГКГAГЛ
  887. //------------------------------------------------------------------------------
  888. layout(std140) uniform Mat
  889. {
  890. vec4 mat_color0; // @@ id="mat_color0" item="color" default="1 1 1 1"
  891. vec4 mat_color1; // @@ id="mat_color1" item="color" default="1 1 1 1"
  892. vec4 amb_color0; // @@ id="amb_color0" item="color" default="1 1 1 1"
  893. vec4 amb_color1; // @@ id="amb_color1" item="color" default="1 1 1 1"
  894. vec4 tev_color0; // @@ id="tev_color0" item="color" default="1 1 1 1"
  895. vec4 tev_color1; // @@ id="tev_color1" item="color" default="1 1 1 1"
  896. vec4 tev_color2; // @@ id="tev_color2" item="color" default="1 1 1 1"
  897. vec4 konst0; // @@ id="konst0" item="color" default="1 1 1 1"
  898. vec4 konst1; // @@ id="konst1" item="color" default="1 1 1 1"
  899. vec4 konst2; // @@ id="konst2" item="color" default="1 1 1 1"
  900. vec4 konst3; // @@ id="konst3" item="color" default="1 1 1 1"
  901. vec4 ind_texmtx0[ 2 ]; // @@ id="ind_texmtx0" type="srt2d" default="1 1 0 0 0"
  902. vec4 ind_texmtx1[ 2 ]; // @@ id="ind_texmtx1" type="srt2d" default="1 1 0 0 0"
  903. vec4 ind_texmtx2[ 2 ]; // @@ id="ind_texmtx2" type="srt2d" default="1 1 0 0 0"
  904. vec4 texmtx0[ 3 ]; // @@ id="texmtx0" type="texsrt_ex" default="0 1 1 0 0 0" hint="albedo0"
  905. vec4 texmtx1[ 3 ]; // @@ id="texmtx1" type="texsrt_ex" default="0 1 1 0 0 0" hint="albedo1"
  906. vec4 texmtx2[ 3 ]; // @@ id="texmtx2" type="texsrt_ex" default="0 1 1 0 0 0" hint="albedo2"
  907. vec4 texmtx3[ 3 ]; // @@ id="texmtx3" type="texsrt_ex" default="0 1 1 0 0 0" hint="albedo3"
  908. vec4 texmtx4[ 3 ]; // @@ id="texmtx4" type="texsrt_ex" default="0 1 1 0 0 0" hint="albedo4"
  909. vec4 texmtx5[ 3 ]; // @@ id="texmtx5" type="texsrt_ex" default="0 1 1 0 0 0" hint="albedo5"
  910. vec4 texmtx6[ 3 ]; // @@ id="texmtx6" type="texsrt_ex" default="0 1 1 0 0 0" hint="albedo6"
  911. vec4 texmtx7[ 3 ]; // @@ id="texmtx7" type="texsrt_ex" default="0 1 1 0 0 0" hint="albedo7"
  912. };
  913.  
  914. //------------------------------------------------------------------------------
  915. // ГeГNГXГ`ГГ
  916. //------------------------------------------------------------------------------
  917. uniform sampler2D tex_map0; // @@ id="_a0" hint="albedo0"
  918. uniform sampler2D tex_map1; // @@ id="_a1" hint="albedo1"
  919. uniform sampler2D tex_map2; // @@ id="_a2" hint="albedo2"
  920. uniform sampler2D tex_map3; // @@ id="_a3" hint="albedo3"
  921. uniform sampler2D tex_map4; // @@ id="_a4" hint="albedo4"
  922. uniform sampler2D tex_map5; // @@ id="_a5" hint="albedo5"
  923. uniform sampler2D tex_map6; // @@ id="_a6" hint="albedo6"
  924. uniform sampler2D tex_map7; // @@ id="_a7" hint="albedo7"
  925.  
  926. in vec2 tex_coord0;
  927. in vec2 tex_coord1;
  928. in vec2 tex_coord2;
  929. in vec2 tex_coord3;
  930. in vec2 tex_coord4;
  931. in vec2 tex_coord5;
  932. in vec2 tex_coord6;
  933. in vec2 tex_coord7;
  934. in vec4 color0a0;
  935. in vec4 color1a1;
  936. in vec4 fog_color;
  937. // red-pro2
  938. in vec3 normal;
  939.  
  940. #define one const_one
  941. #define zero const_zero
  942. #define half const_half
  943.  
  944. // for swizzle accsess
  945. const vec4 const_zero = vec4( 0.0 );
  946. const vec4 const_half = vec4( 0.5 );
  947. const vec4 const_one = vec4( 1.0 );
  948. const vec4 konst_8_8 = konst_color8( 8.0 );
  949. const vec4 konst_7_8 = konst_color8( 7.0 );
  950. const vec4 konst_6_8 = konst_color8( 6.0 );
  951. const vec4 konst_5_8 = konst_color8( 5.0 );
  952. const vec4 konst_4_8 = konst_color8( 4.0 );
  953. const vec4 konst_3_8 = konst_color8( 3.0 );
  954. const vec4 konst_2_8 = konst_color8( 2.0 );
  955. const vec4 konst_1_8 = konst_color8( 1.0 );
  956. const vec4 color_null = const_one;
  957.  
  958. void main( void )
  959. {
  960. #if ( tev_stage_num < 0 || TEV_STAGE_MAX < tev_stage_num )
  961. # error
  962. #endif
  963.  
  964. #if ( ind_stage_num < 0 || IND_STAGE_MAX < ind_stage_num )
  965. # error
  966. #endif
  967.  
  968. vec2 ind_offset0_ = vec2( 0.0 );
  969. vec2 ind_offset1_ = vec2( 0.0 );
  970. vec2 ind_offset2_ = vec2( 0.0 );
  971. vec2 ind_offset3_ = vec2( 0.0 );
  972.  
  973. // indirect
  974. #if ( 0 < ind_stage_num )
  975. calc_ind_stage( 0 );
  976. #endif
  977.  
  978. #if ( 1 < ind_stage_num )
  979. calc_ind_stage( 1 );
  980. #endif
  981.  
  982. #if ( 2 < ind_stage_num )
  983. calc_ind_stage( 2 );
  984. #endif
  985.  
  986. #if ( 3 < ind_stage_num )
  987. calc_ind_stage( 3 );
  988. #endif
  989.  
  990. // tev stage
  991. vec4 reg0 = tev_color0;
  992. vec4 reg1 = tev_color1;
  993. vec4 reg2 = tev_color2;
  994. vec4 prev = one;
  995.  
  996. #if ( 0 < tev_stage_num )
  997. calc_tev_stage( 0 );
  998. #endif
  999.  
  1000. #if ( 1 < tev_stage_num )
  1001. calc_tev_stage( 1 );
  1002. #endif
  1003.  
  1004. #if ( 2 < tev_stage_num )
  1005. calc_tev_stage( 2 );
  1006. #endif
  1007.  
  1008. #if ( 3 < tev_stage_num )
  1009. calc_tev_stage( 3 );
  1010. #endif
  1011.  
  1012. #if ( 4 < tev_stage_num )
  1013. calc_tev_stage( 4 );
  1014. #endif
  1015.  
  1016. #if ( 5 < tev_stage_num )
  1017. calc_tev_stage( 5 );
  1018. #endif
  1019.  
  1020. #if ( 6 < tev_stage_num )
  1021. calc_tev_stage( 6 );
  1022. #endif
  1023.  
  1024. #if ( 7 < tev_stage_num )
  1025. calc_tev_stage( 7 );
  1026. #endif
  1027.  
  1028. gl_FragData[ 0 ].rgb = mix( prev.rgb, fog_color.rgb, fog_color.a );
  1029. gl_FragData[ 0 ].a = prev.a;
  1030.  
  1031. gl_FragData[ 1 ].rgb = normalize( normal ) * 0.5 + 0.5;
  1032. gl_FragData[ 1 ].a = 1.0;
  1033. }
Advertisement
Add Comment
Please, Sign In to add comment