0% found this document useful (0 votes)
34 views7 pages

Bad P 0

D

Uploaded by

ujangumek
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views7 pages

Bad P 0

D

Uploaded by

ujangumek
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 7

#version 320 es

#define FORCE_EARLY_Z layout(early_fragment_tests) in

#define ATTRIBUTE_LOCATION(x)
#define FRAGMENT_OUTPUT_LOCATION(x)
#define FRAGMENT_OUTPUT_LOCATION_INDEXED(x, y)
#define UBO_BINDING(packing, x) layout(packing, binding = x)
#define SAMPLER_BINDING(x) layout(binding = x)
#define TEXEL_BUFFER_BINDING(x) layout(binding = x)
#define SSBO_BINDING(x) layout(binding = x)
#define IMAGE_BINDING(format, x) layout(format, binding = x)

#define VARYING_LOCATION(x)

#extension GL_ANDROID_extension_pack_es31a : enable

#extension GL_EXT_blend_func_extended : enable

#extension GL_EXT_shader_framebuffer_fetch: enable


#define FB_FETCH_VALUE real_ocol0
#define FRAGMENT_INOUT inout

precision highp float;


precision highp int;
precision highp sampler2DArray;
precision highp usamplerBuffer;
precision highp sampler2DMS;
precision highp image2DArray;
#define API_OPENGL 1
#define float2 vec2
#define float3 vec3
#define float4 vec4
#define uint2 uvec2
#define uint3 uvec3
#define uint4 uvec4
#define int2 ivec2
#define int3 ivec3
#define int4 ivec4
#define frac fract
#define lerp mix
struct Light {
int4 color;
float4 cosatt;
float4 distatt;
float4 pos;
float4 dir;
};
UBO_BINDING(std140, 2) uniform VSBlock {
float4 cpnmtx[6];
float4 cproj[4];
int4 cmtrl[4];
Light clights[8];
float4 ctexmtx[24];
float4 ctrmtx[64];
float4 cnmtx[32];
float4 cpostmtx[64];
float4 cpixelcenter;
float2 cviewport;
};
struct VS_OUTPUT {
float4 pos;
float4 colors_0;
float4 colors_1;
float3 tex0;
float3 Normal;
float3 WorldPos;
float clipDist0;
float clipDist1;
};
ATTRIBUTE_LOCATION(0) in float4 rawpos;
ATTRIBUTE_LOCATION(2) in float3 rawnorm0;
ATTRIBUTE_LOCATION(5) in float4 rawcolor0;
ATTRIBUTE_LOCATION(8) in float2 rawtex0;
VARYING_LOCATION(0) out VertexData {
float4 pos;
float4 colors_0;
float4 colors_1;
float3 tex0;
float3 Normal;
float3 WorldPos;
float clipDist0;
float clipDist1;
} vs;
void main()
{
VS_OUTPUT o;
float4 pos = float4(dot(cpnmtx[0], rawpos), dot(cpnmtx[1], rawpos), dot(cpnmtx[2],
rawpos), 1.0);
float3 _norm0 = normalize(float3(dot(cpnmtx[3].xyz, rawnorm0), dot(cpnmtx[4].xyz,
rawnorm0), dot(cpnmtx[5].xyz, rawnorm0)));
o.pos = float4(dot(cproj[0], pos), dot(cproj[1], pos), dot(cproj[2], pos),
dot(cproj[3], pos));
int4 lacc;
float3 ldir, h, cosAttn, distAttn;
float dist, dist2, attn;
{
int4 mat = cmtrl[2];
lacc = cmtrl[0];
lacc.w = 255;
ldir = clights[0].pos.xyz - pos.xyz;
dist2 = dot(ldir, ldir);
dist = sqrt(dist2);
ldir = ldir / dist;
attn = max(0.0, dot(ldir, clights[0].dir.xyz));
attn = max(0.0, clights[0].cosatt.x + clights[0].cosatt.y*attn +
clights[0].cosatt.z*attn*attn) / dot(clights[0].distatt.xyz,
float3(1.0,dist,dist2));
lacc.rgb += int3(round(attn * max(0.0,dot(ldir, _norm0)) *
float3(clights[0].color.rgb)));
lacc = clamp(lacc, 0, 255);
o.colors_0 = float4((mat * (lacc + (lacc >> 7))) >> 8) / 255.0;
}
{
int4 mat = cmtrl[3];
lacc = int4(255, 255, 255, 255);
lacc.w = 255;
lacc = clamp(lacc, 0, 255);
o.colors_1 = float4((mat * (lacc + (lacc >> 7))) >> 8) / 255.0;
}
int tmp;
float4 coord, P0, P1, P2;
//{
coord = float4(0.0, 0.0, 1.0, 1.0);
coord = float4(rawtex0.x, rawtex0.y, 1.0, 1.0);
coord.z = 1.0;
o.tex0.xyz = float3(dot(coord, ctexmtx[0]), dot(coord, ctexmtx[1]), 1);
P0 = cpostmtx[61];
P1 = cpostmtx[62];
P2 = cpostmtx[63];
o.tex0.xyz = float3(dot(P0.xyz, o.tex0.xyz) + P0.w, dot(P1.xyz, o.tex0.xyz) + P1.w,
dot(P2.xyz, o.tex0.xyz) + P2.w);
if(o.tex0.z == 0.0f)
o.tex0.xy = clamp(o.tex0.xy / 2.0f, float2(-1.0f, -1.0f), float2(1.0f,
1.0f));
//}
o.colors_1 = o.colors_0;
o.Normal = _norm0;
o.WorldPos = pos.xyz;
o.colors_0 = rawcolor0;
o.pos.z = o.pos.w * cpixelcenter.w - o.pos.z * cpixelcenter.z;
o.pos.z = o.pos.z * 2.0 - o.pos.w;
o.pos.xy *= sign(cpixelcenter.xy * float2(1.0, -1.0));
o.pos.xy = o.pos.xy - o.pos.w * cpixelcenter.xy;
vs.pos = o.pos;
vs.colors_0 = o.colors_0;
vs.colors_1 = o.colors_1;
vs.tex0 = o.tex0;
vs.Normal = o.Normal;
vs.WorldPos = o.WorldPos;
vs.clipDist0 = o.clipDist0;
vs.clipDist1 = o.clipDist1;
gl_Position = o.pos;
}

#version 320 es

#define FORCE_EARLY_Z layout(early_fragment_tests) in

#define ATTRIBUTE_LOCATION(x)
#define FRAGMENT_OUTPUT_LOCATION(x)
#define FRAGMENT_OUTPUT_LOCATION_INDEXED(x, y)
#define UBO_BINDING(packing, x) layout(packing, binding = x)
#define SAMPLER_BINDING(x) layout(binding = x)
#define TEXEL_BUFFER_BINDING(x) layout(binding = x)
#define SSBO_BINDING(x) layout(binding = x)
#define IMAGE_BINDING(format, x) layout(format, binding = x)
#define VARYING_LOCATION(x)

#extension GL_ANDROID_extension_pack_es31a : enable

#extension GL_EXT_blend_func_extended : enable

#extension GL_EXT_shader_framebuffer_fetch: enable


#define FB_FETCH_VALUE real_ocol0
#define FRAGMENT_INOUT inout

precision highp float;


precision highp int;
precision highp sampler2DArray;
precision highp usamplerBuffer;
precision highp sampler2DMS;
precision highp image2DArray;
#define API_OPENGL 1
#define float2 vec2
#define float3 vec3
#define float4 vec4
#define uint2 uvec2
#define uint3 uvec3
#define uint4 uvec4
#define int2 ivec2
#define int3 ivec3
#define int4 ivec4
#define frac fract
#define lerp mix
//Pixel Shader for TEV stages
//3 TEV stages, 1 texgens, 0 IND stages
int idot(int3 x, int3 y)
{
int3 tmp = x * y;
return tmp.x + tmp.y + tmp.z;
}
int idot(int4 x, int4 y)
{
int4 tmp = x * y;
return tmp.x + tmp.y + tmp.z + tmp.w;
}

int iround(float x) { return int (round(x)); }


int2 iround(float2 x) { return int2(round(x)); }
int3 iround(float3 x) { return int3(round(x)); }
int4 iround(float4 x) { return int4(round(x)); }

SAMPLER_BINDING(0) uniform sampler2DArray samp[8];

UBO_BINDING(std140, 1) uniform PSBlock {


int4 color[4];
int4 k[4];
int4 alphaRef;
float4 texdim[8];
int4 czbias[2];
int4 cindscale[2];
int4 cindmtx[6];
int4 cfogcolor;
int4 cfogi;
float4 cfogf;
float4 cfogrange[3];
float4 czslope;
float2 cefbscale;
};

struct Light {
int4 color;
float4 cosatt;
float4 distatt;
float4 pos;
float4 dir;
};
UBO_BINDING(std140, 2) uniform VSBlock {
float4 cpnmtx[6];
float4 cproj[4];
int4 cmtrl[4];
Light clights[8];
float4 ctexmtx[24];
float4 ctrmtx[64];
float4 cnmtx[32];
float4 cpostmtx[64];
float4 cpixelcenter;
float2 cviewport;
};
FRAGMENT_OUTPUT_LOCATION_INDEXED(0, 0) out vec4 ocol0;
FRAGMENT_OUTPUT_LOCATION_INDEXED(0, 1) out vec4 ocol1;
VARYING_LOCATION(0) in VertexData {
float4 pos;
float4 colors_0;
float4 colors_1;
float3 tex0;
float3 Normal;
float3 WorldPos;
float clipDist0;
float clipDist1;
};
void main()
{
float4 rawpos = gl_FragCoord;
int4 c0 = color[1], c1 = color[2], c2 = color[3], prev = color[0];
int4 rastemp, textemp, konsttemp;
int3 comp16 = int3(1, 256, 0), comp24 = int3(1, 256, 256*256);
int alphabump = 0;
int2 tevcoord = int2(0, 0);
int2 wrappedcoord, tempcoord;
int4 tevin_a, tevin_b, tevin_c, tevin_d, tevin_temp;

float4 col0 = colors_0;


float4 col1 = colors_1;
float3 _norm0 = normalize(Normal.xyz);

float3 pos = WorldPos;


int4 lacc;
float3 ldir, h, cosAttn, distAttn;
float dist, dist2, attn;
{
int4 mat = cmtrl[2];
lacc = cmtrl[0];
lacc.w = 255;
ldir = clights[0].pos.xyz - pos.xyz;
dist2 = dot(ldir, ldir);
dist = sqrt(dist2);
ldir = ldir / dist;
attn = max(0.0, dot(ldir, clights[0].dir.xyz));
attn = max(0.0, clights[0].cosatt.x + clights[0].cosatt.y*attn +
clights[0].cosatt.z*attn*attn) / dot(clights[0].distatt.xyz,
float3(1.0,dist,dist2));
lacc.rgb += int3(round(attn * max(0.0,dot(ldir, _norm0)) *
float3(clights[0].color.rgb)));

lacc = clamp(lacc, 0, 255);


col0 = float4((mat * (lacc + (lacc >> 7))) >> 8) / 255.0;
}
{
int4 mat = cmtrl[3];
lacc = int4(255, 255, 255, 255);
lacc.w = 255;
lacc = clamp(lacc, 0, 255);
col1 = float4((mat * (lacc + (lacc >> 7))) >> 8) / 255.0;
}
int2 fixpoint_uv0 = int2((tex0.z == 0.0 ? tex0.xy : tex0.xy / tex0.z) *
texdim[0].zw);

// TEV stage 0
rastemp = iround(col0 * 255.0).rgba;
tevcoord = fixpoint_uv0;
textemp = iround(255.0 * texture(samp[0], float3(float2(tevcoord).xy *
texdim[0].xy, 0.0))).rgba;
tevin_a = int4(int3(0,0,0), 0) & 255;
tevin_b = int4(textemp.rgb, 0) & 255;
tevin_c = int4(rastemp.rgb, 0) & 255;
tevin_d = int4(int3(0,0,0), rastemp.a);
tevin_temp = (tevin_a<<8) + (tevin_b-tevin_a) * (tevin_c + (tevin_c>>7));
// tev combine
prev = (((tevin_d.rgba ) ) + ((((tevin_temp.rgba) ) + 128) >> 8)) ;
prev = clamp(prev, int4(0, 0, 0, 0), int4(255, 255, 255, 255));

// TEV stage 1
tevcoord = fixpoint_uv0;
textemp = iround(255.0 * texture(samp[1], float3(float2(tevcoord).xy *
texdim[1].xy, 0.0))).rgba;
tevin_a = int4(int3(0,0,0), 0) & 255;
tevin_b = int4(int3(0,0,0), textemp.a) & 255;
tevin_c = int4(int3(0,0,0), prev.a) & 255;
tevin_d = int4(prev.rgb, 0);
tevin_temp = (tevin_a<<8) + (tevin_b-tevin_a) * (tevin_c + (tevin_c>>7));
// tev combine
prev = (((tevin_d.rgba ) ) + ((((tevin_temp.rgba) ) + 128) >> 8)) ;
prev = clamp(prev, int4(0, 0, 0, 0), int4(255, 255, 255, 255));

// TEV stage 2
textemp = int4(255, 255, 255, 255);
tevin_a = int4(int3(0,0,0), 0) & 255;
tevin_b = int4(int3(0,0,0), 0) & 255;
tevin_c = int4(int3(0,0,0), 0) & 255;
tevin_d = int4(prev.rgb, prev.a);
tevin_temp = (tevin_a<<8) + (tevin_b-tevin_a) * (tevin_c + (tevin_c>>7));
// color combine
prev.rgb = (((tevin_d.rgb ) << 2) + ((((tevin_temp.rgb) << 2) + 128) >>
8)) ;
// alpha combine
prev.a = (((tevin_d.a ) ) + ((((tevin_temp.a) ) + 128) >> 8)) ;
prev = clamp(prev, int4(0, 0, 0, 0), int4(255, 255, 255, 255));
prev = prev & 255;
if(( (prev.a > alphaRef.r) || (prev.a > alphaRef.g)) == false) {
ocol0 = float4(0.0, 0.0, 0.0, 0.0);
ocol1 = float4(0.0, 0.0, 0.0, 0.0);
discard;
}
ocol1 = float4(0.0, 0.0, 0.0, float(prev.a) / 255.0);
prev.a = alphaRef.a;
ocol0 = float4(prev) / 255.0;
}

You might also like