mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-28 18:45:54 -05:00
48 lines
1 KiB
Text
48 lines
1 KiB
Text
struct v2f_vertex_lit {
|
|
vec2 uv;
|
|
vec4 diff;
|
|
vec4 spec;
|
|
};
|
|
struct v2f_img {
|
|
vec4 pos;
|
|
vec2 uv;
|
|
};
|
|
struct appdata_img {
|
|
vec4 vertex;
|
|
vec2 texcoord;
|
|
};
|
|
struct v2f {
|
|
vec4 pos;
|
|
vec2 uv;
|
|
vec2 uvOrig;
|
|
};
|
|
uniform vec4 _CenterRadius;
|
|
|
|
|
|
vec2 MultiplyUV( in mat4 mat, in vec2 inUV );
|
|
v2f vert( in appdata_img v );
|
|
vec2 MultiplyUV( in mat4 mat, in vec2 inUV ) {
|
|
vec4 temp;
|
|
temp = vec4( inUV.x , inUV.y , 0.000000, 0.000000);
|
|
temp = ( mat * temp );
|
|
return temp.xy ;
|
|
}
|
|
v2f vert( in appdata_img v ) {
|
|
v2f o;
|
|
vec2 uv;
|
|
o.pos = ( gl_ModelViewProjectionMatrix * v.vertex );
|
|
uv = (v.texcoord.xy - _CenterRadius.xy );
|
|
o.uv = MultiplyUV( gl_TextureMatrix[0], uv);
|
|
o.uvOrig = uv;
|
|
return o;
|
|
}
|
|
void main() {
|
|
v2f xl_retval;
|
|
appdata_img xlt_v;
|
|
xlt_v.vertex = vec4( gl_Vertex);
|
|
xlt_v.texcoord = vec2( gl_MultiTexCoord0);
|
|
xl_retval = vert( xlt_v);
|
|
gl_Position = vec4( xl_retval.pos);
|
|
gl_TexCoord[0] = vec4( xl_retval.uv, 0.0, 0.0);
|
|
gl_TexCoord[1] = vec4( xl_retval.uvOrig, 0.0, 0.0);
|
|
}
|