Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /////////////////////////////// Source file 0/////////////////////////////
- #version 330
- /////////////////////////////// Source file 1/////////////////////////////
- #define GLES_OVER_GL
- /////////////////////////////// Source file 2/////////////////////////////
- /////////////////////////////// Source file 3/////////////////////////////
- #define USE_TEXTURE_RECT
- /////////////////////////////// Source file 4/////////////////////////////
- /////////////////////////////// Source file 5/////////////////////////////
- /////////////////////////////// Source file 6/////////////////////////////
- /////////////////////////////// Source file 7/////////////////////////////
- /////////////////////////////// Source file 8/////////////////////////////
- /////////////////////////////// Source file 9/////////////////////////////
- /////////////////////////////// Source file 10/////////////////////////////
- /////////////////////////////// Source file 11/////////////////////////////
- /////////////////////////////// Source file 12/////////////////////////////
- /////////////////////////////// Source file 13/////////////////////////////
- /////////////////////////////// Source file 14/////////////////////////////
- /////////////////////////////// Source file 15/////////////////////////////
- /////////////////////////////// Source file 16/////////////////////////////
- /////////////////////////////// Source file 17/////////////////////////////
- /////////////////////////////// Source file 18/////////////////////////////
- /////////////////////////////// Source file 19/////////////////////////////
- /////////////////////////////// Source file 20/////////////////////////////
- /////////////////////////////// Source file 21/////////////////////////////
- precision highp float;
- /////////////////////////////// Source file 22/////////////////////////////
- precision highp int;
- /////////////////////////////// Source file 23/////////////////////////////
- layout(location=0) in highp vec2 vertex;
- layout(location=3) in vec4 color_attrib;
- #ifdef USE_SKELETON
- layout(location=6) in uvec4 bone_indices; // attrib:6
- layout(location=7) in vec4 bone_weights; // attrib:7
- #endif
- #ifdef USE_TEXTURE_RECT
- uniform vec4 dst_rect;
- uniform vec4 src_rect;
- #else
- #ifdef USE_INSTANCING
- layout(location=8) in highp vec4 instance_xform0;
- layout(location=9) in highp vec4 instance_xform1;
- layout(location=10) in highp vec4 instance_xform2;
- layout(location=11) in lowp vec4 instance_color;
- #ifdef USE_INSTANCE_CUSTOM
- layout(location=12) in highp vec4 instance_custom_data;
- #endif
- #endif
- layout(location=4) in highp vec2 uv_attrib;
- //skeletn
- #endif
- uniform highp vec2 color_texpixel_size;
- layout(std140) uniform CanvasItemData { //ubo:0
- highp mat4 projection_matrix;
- highp float time;
- };
- uniform highp mat4 modelview_matrix;
- uniform highp mat4 extra_matrix;
- out highp vec2 uv_interp;
- out mediump vec4 color_interp;
- #ifdef USE_NINEPATCH
- out highp vec2 pixel_size_interp;
- #endif
- #ifdef USE_SKELETON
- uniform mediump sampler2D skeleton_texture; // texunit:-1
- uniform highp mat4 skeleton_transform;
- uniform highp mat4 skeleton_transform_inverse;
- #endif
- #ifdef USE_LIGHTING
- layout(std140) uniform LightData { //ubo:1
- //light matrices
- highp mat4 light_matrix;
- highp mat4 light_local_matrix;
- highp mat4 shadow_matrix;
- highp vec4 light_color;
- highp vec4 light_shadow_color;
- highp vec2 light_pos;
- highp float shadowpixel_size;
- highp float shadow_gradient;
- highp float light_height;
- highp float light_outside_alpha;
- highp float shadow_distance_mult;
- };
- out vec4 light_uv_interp;
- out vec4 local_rot;
- #ifdef USE_SHADOWS
- out highp vec2 pos;
- #endif
- const bool at_light_pass = true;
- #else
- const bool at_light_pass = false;
- #endif
- #ifdef USE_PARTICLES
- uniform int h_frames;
- uniform int v_frames;
- #endif
- #if defined(USE_MATERIAL)
- layout(std140) uniform UniformData { //ubo:2
- /////////////////////////////// Source file 24/////////////////////////////
- };
- #endif
- /////////////////////////////// Source file 25/////////////////////////////
- void main() {
- vec4 color = color_attrib;
- #ifdef USE_INSTANCING
- mat4 extra_matrix2 = extra_matrix * transpose(mat4(instance_xform0,instance_xform1,instance_xform2,vec4(0.0,0.0,0.0,1.0)));
- color*=instance_color;
- vec4 instance_custom = instance_custom_data;
- #else
- mat4 extra_matrix2 = extra_matrix;
- vec4 instance_custom = vec4(0.0);
- #endif
- #ifdef USE_TEXTURE_RECT
- if (dst_rect.z < 0.0) { // Transpose is encoded as negative dst_rect.z
- uv_interp = src_rect.xy + abs(src_rect.zw) * vertex.yx;
- } else {
- uv_interp = src_rect.xy + abs(src_rect.zw) * vertex;
- }
- highp vec4 outvec = vec4(dst_rect.xy + abs(dst_rect.zw) * mix(vertex,vec2(1.0,1.0)-vertex,lessThan(src_rect.zw,vec2(0.0,0.0))),0.0,1.0);
- #else
- uv_interp = uv_attrib;
- highp vec4 outvec = vec4(vertex,0.0,1.0);
- #endif
- #ifdef USE_PARTICLES
- //scale by texture size
- outvec.xy/=color_texpixel_size;
- //compute h and v frames and adjust UV interp for animation
- int total_frames = h_frames * v_frames;
- int frame = min(int(float(total_frames) *instance_custom.z),total_frames-1);
- float frame_w = 1.0/float(h_frames);
- float frame_h = 1.0/float(v_frames);
- uv_interp.x = uv_interp.x * frame_w + frame_w * float(frame % h_frames);
- uv_interp.y = uv_interp.y * frame_h + frame_h * float(frame / h_frames);
- #endif
- #define extra_matrix extra_matrix2
- {
- /////////////////////////////// Source file 26/////////////////////////////
- }
- #ifdef USE_NINEPATCH
- pixel_size_interp=abs(dst_rect.zw) * vertex;
- #endif
- #if !defined(SKIP_TRANSFORM_USED)
- outvec = extra_matrix * outvec;
- outvec = modelview_matrix * outvec;
- #endif
- #undef extra_matrix
- color_interp = color;
- #ifdef USE_PIXEL_SNAP
- outvec.xy=floor(outvec+0.5).xy;
- #endif
- #ifdef USE_SKELETON
- if (bone_weights!=vec4(0.0)){ //must be a valid bone
- //skeleton transform
- ivec4 bone_indicesi = ivec4(bone_indices);
- ivec2 tex_ofs = ivec2( bone_indicesi.x%256, (bone_indicesi.x/256)*2 );
- highp mat2x4 m = mat2x4(
- texelFetch(skeleton_texture,tex_ofs,0),
- texelFetch(skeleton_texture,tex_ofs+ivec2(0,1),0)
- ) * bone_weights.x;
- tex_ofs = ivec2( bone_indicesi.y%256, (bone_indicesi.y/256)*2 );
- m+= mat2x4(
- texelFetch(skeleton_texture,tex_ofs,0),
- texelFetch(skeleton_texture,tex_ofs+ivec2(0,1),0)
- ) * bone_weights.y;
- tex_ofs = ivec2( bone_indicesi.z%256, (bone_indicesi.z/256)*2 );
- m+= mat2x4(
- texelFetch(skeleton_texture,tex_ofs,0),
- texelFetch(skeleton_texture,tex_ofs+ivec2(0,1),0)
- ) * bone_weights.z;
- tex_ofs = ivec2( bone_indicesi.w%256, (bone_indicesi.w/256)*2 );
- m+= mat2x4(
- texelFetch(skeleton_texture,tex_ofs,0),
- texelFetch(skeleton_texture,tex_ofs+ivec2(0,1),0)
- ) * bone_weights.w;
- mat4 bone_matrix = skeleton_transform * transpose(mat4(m[0],m[1],vec4(0.0,0.0,1.0,0.0),vec4(0.0,0.0,0.0,1.0))) * skeleton_transform_inverse;
- outvec = bone_matrix * outvec;
- }
- #endif
- gl_Position = projection_matrix * outvec;
- #ifdef USE_LIGHTING
- light_uv_interp.xy = (light_matrix * outvec).xy;
- light_uv_interp.zw =(light_local_matrix * outvec).xy;
- #ifdef USE_SHADOWS
- pos=outvec.xy;
- #endif
- local_rot.xy=normalize( (modelview_matrix * ( extra_matrix * vec4(1.0,0.0,0.0,0.0) )).xy );
- local_rot.zw=normalize( (modelview_matrix * ( extra_matrix * vec4(0.0,1.0,0.0,0.0) )).xy );
- #ifdef USE_TEXTURE_RECT
- local_rot.xy*=sign(src_rect.z);
- local_rot.zw*=sign(src_rect.w);
- #endif
- #endif
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement