Advertisement
Guest User

Untitled

a guest
Dec 14th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.90 KB | None | 0 0
  1. 01-01 02:48:18.633 16822-16989/? I/PRNT: VPROG_TEXT:
  2. #if MOBILE
  3. #if FSHADER
  4. precision mediump float; // The SGS II device (the Mali 400MP) cannot support highp in the fragment shader.
  5. precision mediump int;
  6. #else
  7. precision highp float;
  8. precision highp int;
  9. #endif
  10. #define HIGHP highp
  11. #define MEDIUMP mediump
  12. #define LOWP lowp
  13. #else
  14. #include "prefix.glsl"
  15. #if TONE_MAP
  16. #define VSHADER_TONE_ONLY 1
  17. #include "tone_map.glsl"
  18. #endif
  19. #define HIGHP
  20. #define MEDIUMP
  21. #define LOWP
  22. #endif
  23.  
  24. #line 15
  25.  
  26. #define BILLBOARD_MODE_SQUARE 0
  27. #define BILLBOARD_MODE_AXIAL 1
  28. #define BILLBOARD_MODE_RIBBON 2
  29.  
  30. uniform mat4 u_mv_matrix;
  31. uniform mat4 u_proj_matrix;
  32.  
  33. uniform vec4 u_grid; // x-count, y-count, recip x, recip y grid x, grid y, 1/ grid x, 1/grid y
  34.  
  35. uniform vec3 u_diffuse;
  36. uniform vec3 u_ambient;
  37.  
  38.  
  39.  
  40.  
  41. varying MEDIUMP vec2 v_texcoord0;
  42. varying MEDIUMP vec2 v_texcoord1;
  43. varying LOWP float v_blend; // inter-texture blend, rgb blend, alpha blend
  44. varying LOWP vec4 v_color;
  45.  
  46. #define fog_ratio2 0.00001
  47.  
  48. #if VSHADER
  49.  
  50. // PER-VERTEX IN VBO
  51. attribu
  52. 01-01 02:48:18.633 16822-16989/? I/PRNT: te vec4 a_vertex;
  53. attribute vec3 a_normal; // velocity vector
  54. attribute vec4 a_color; // RGBA
  55. attribute vec3 a_texcoord0; // time, size, emissive
  56. attribute vec2 a_texcoord1; // semi xy, rotation
  57.  
  58. // IMMEDIATE MODE FOR FAST TURN-AROUND
  59. attribute vec4 a_texcoord2; // first cell, cell count, diffuse, ambient
  60. attribute vec4 a_texcoord3; // axial coeff, 1/grid x, 1/grid y
  61.  
  62. #define a_time a_texcoord0.x
  63. #define a_size a_texcoord0.y
  64. #define a_emissive a_texcoord0.z
  65.  
  66. #define a_semi_xy a_texcoord1.x
  67. #define a_rotation a_texcoord1.y
  68.  
  69.  
  70.  
  71. #define k_cell_first a_texcoord2.x
  72. #define k_cell_count a_texcoord2.y
  73. #define k_diffuse a_texcoord2.z
  74. #define k_ambient a_texcoord2.w
  75.  
  76. #define a_grid_x a_texcoord3.x
  77. #define a_grid_y a_texcoord3.y
  78. #define a_grid_xy a_texcoord3.xy
  79.  
  80. void main (void)
  81. {
  82. vec4 eye_pos = u_mv_matrix * a_vertex;
  83.  
  84. vec2 semi = vec2(
  85. 4.0*fract(a_semi_xy)-1.0,
  86. 2.0*floor(a_semi_xy)-1.0);
  87.  
  88. #if BILLBOARD_MODE == BILLBOARD_MODE_AXIAL || BILLBOARD_
  89. 01-01 02:48:18.633 16822-16989/? I/PRNT: MODE == BILLBOARD_MODE_RIBBON
  90.  
  91. vec3 semi_y = mat3(u_mv_matrix) * a_normal;
  92. vec3 to_cam = -eye_pos.xyz;
  93. vec3 semi_x = a_size * normalize(cross(semi_y,to_cam));
  94. eye_pos.xyz += (semi_x * semi.x + semi_y * semi.y);
  95.  
  96. #endif
  97.  
  98. #if BILLBOARD_MODE == BILLBOARD_MODE_SQUARE
  99.  
  100. float s = sin(a_rotation);
  101. float c = cos(a_rotation);
  102. mat2 spin = mat2(vec2(c,s),vec2(-s,c));
  103.  
  104. eye_pos.xy += (spin * semi * a_size);
  105.  
  106. #endif
  107.  
  108. gl_Position = u_proj_matrix * eye_pos;
  109.  
  110. #if MOBILE
  111. v_color.rgb = u_diffuse * k_diffuse +
  112. u_ambient * k_ambient +
  113. a_emissive;
  114. #else
  115. v_color.rgb = gl_LightSource[0].diffuse.rgb * k_diffuse +
  116. gl_LightSource[0].ambient.rgb * k_ambient +
  117. a_emissive;
  118. #endif
  119.  
  120. v_color.rgb *= a_color.rgb;
  121.  
  122. v_color.a = a_color.a;
  123.  
  124. float anim_cell = a_time * k_cell_count;
  125.  
  126. v_blend = fract(anim_cell);
  127.  
  128. float cell_0 = mod(anim_cell , k_cell_count) + k_cell_first;
  129. float cell_1 = mod(anim_cell+1.0, k_cell_count) + k_cell_first;
  130.  
  131.  
  132.  
  133. 01-01 02:48:18.633 16822-16989/? I/PRNT: vec2 cell_0_xy, cell_1_xy;
  134.  
  135. cell_0_xy.y = floor(cell_0 * a_grid_x);
  136. cell_0_xy.x = floor(cell_0 - cell_0_xy.y / a_grid_x);
  137.  
  138. cell_1_xy.y = floor(cell_1 * a_grid_x);
  139. cell_1_xy.x = floor(cell_1 - cell_1_xy.y / a_grid_x);
  140.  
  141. v_texcoord0 = a_grid_xy * (vec2(0.5,-0.5) * semi + 0.5 + cell_0_xy);
  142. v_texcoord1 = a_grid_xy * (vec2(0.5,-0.5) * semi + 0.5 + cell_1_xy);
  143.  
  144. v_texcoord0.y = 1.0 - v_texcoord0.y;
  145. v_texcoord1.y = 1.0 - v_texcoord1.y;
  146.  
  147.  
  148. #if TONE_MAP
  149. vshader_tone_map(v_color.rgb);
  150. #endif
  151. }
  152.  
  153. #endif
  154.  
  155. #if FSHADER
  156.  
  157. uniform LOWP sampler2D u_tex;
  158.  
  159. void main()
  160. {
  161. #if CROSSFADE
  162.  
  163. gl_FragColor = v_color * mix(
  164. texture2D(u_tex, v_texcoord0.st),
  165. texture2D(u_tex, v_texcoord1.st),
  166. v_blend);
  167.  
  168. #else
  169.  
  170. // No-crossfade case: processing of the sample is done entirely in the blending hardware;
  171. // on IOS cutting sw ALU ops is (surprisingly) worth it.
  172. gl_FragColor = v_color * texture2D(u_tex, v_texcoord0.st);
  173.  
  174. #endif
  175.  
  176. #if DEBUG
  177. gl_FragCol
  178. 01-01 02:48:18.633 16822-16989/? I/PRNT: or = vec4(0.1, 0.01, 0.004, 1.0);
  179. #endif
  180.  
  181. }
  182.  
  183. #endif
  184. 01-01 02:48:18.633 16822-16989/? I/PRNT: particle.glsl: 3:13: L0001: Unknown character '"'(34)
  185. 3:13: L0001: Unknown character '"'(34)
  186. 3:16: L0001: Unknown character '"'(34)
  187. 3:16: L0001: Unknown character '"'(34)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement