-
Notifications
You must be signed in to change notification settings - Fork 28
/
box-max.glsl
executable file
·181 lines (97 loc) · 2.44 KB
/
box-max.glsl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
// GLSL shader autogenerated by cg2glsl.py.
#if defined(VERTEX)
struct input_dummy {
vec2 _video_size;
vec2 _texture_size;
vec2 _output_dummy_size;
};
vec4 _oPosition1;
uniform mat4 MVPMatrix;
input_dummy _IN1;
vec4 _r0004;
vec2 _x0014;
float _TMP15;
attribute vec4 VertexCoord;
attribute vec4 COLOR;
varying vec4 COL0;
attribute vec4 TexCoord;
varying vec4 TEX0;
mat4 transpose_(mat4 matrix)
{
mat4 ret;
for (int i = 0; i != 4; i++)
for (int j = 0; j != 4; j++)
ret[i][j] = matrix[j][i];
return ret;
}
uniform int FrameDirection;
uniform int FrameCount;
#ifdef GL_ES
uniform mediump vec2 OutputSize;
uniform mediump vec2 TextureSize;
uniform mediump vec2 InputSize;
#else
uniform vec2 OutputSize;
uniform vec2 TextureSize;
uniform vec2 InputSize;
#endif
void main()
{
mat4 MVPMatrix_ = transpose_(MVPMatrix);
vec4 _oColor;
vec2 _oTex;
vec2 _box_scale;
vec2 _scale;
vec2 _middle;
vec2 _diff;
_r0004.x = dot(MVPMatrix_[0], VertexCoord);
_r0004.y = dot(MVPMatrix_[1], VertexCoord);
_r0004.z = dot(MVPMatrix_[2], VertexCoord);
_r0004.w = dot(MVPMatrix_[3], VertexCoord);
_oPosition1 = _r0004;
_oColor = COLOR;
_x0014 = OutputSize/InputSize;
_box_scale = floor(_x0014);
if (_box_scale.x > _box_scale.y) {
_TMP15 = _box_scale.y;
} else {
_TMP15 = _box_scale.x;
}
_scale = (OutputSize/InputSize)/vec2(_TMP15, _TMP15);
_middle = (5.00000000E-001*InputSize)/TextureSize;
_diff = TexCoord.xy - _middle;
_oTex = _middle + _diff*_scale;
gl_Position = _r0004;
COL0 = COLOR;
TEX0.xy = _oTex;
}
#elif defined(FRAGMENT)
#ifdef GL_ES
precision mediump float;
#endif
struct input_dummy {
vec2 _video_size;
vec2 _texture_size;
vec2 _output_dummy_size;
};
vec4 _ret_0;
uniform sampler2D Texture;
varying vec4 TEX0;
uniform int FrameDirection;
uniform int FrameCount;
#ifdef GL_ES
uniform mediump vec2 OutputSize;
uniform mediump vec2 TextureSize;
uniform mediump vec2 InputSize;
#else
uniform vec2 OutputSize;
uniform vec2 TextureSize;
uniform vec2 InputSize;
#endif
void main()
{
_ret_0 = texture2D(Texture, TEX0.xy);
gl_FragColor = _ret_0;
return;
}
#endif