40 lines
677 B
GLSL
40 lines
677 B
GLSL
#version 120
|
|
|
|
attribute vec3 pos;
|
|
attribute vec2 tex;
|
|
|
|
uniform float theta1;
|
|
uniform float theta2;
|
|
|
|
vec3 rotate(vec3 v)
|
|
{
|
|
float ct1 = cos(theta1);
|
|
float st1 = sin(theta1);
|
|
|
|
float ct2 = cos(theta2);
|
|
float st2 = sin(theta2);
|
|
|
|
float x0 = v.x;
|
|
float y0 = v.y;
|
|
float z0 = v.z;
|
|
|
|
float x1 = x0;
|
|
float y1 = y0 * ct1 - z0 * st1;
|
|
float z1 = y0 * st1 + z0 * ct1;
|
|
|
|
float x2 = x1 * ct2 - z1 * st2;
|
|
float y2 = y1;
|
|
float z2 = x1 * st2 + z1 * ct2;
|
|
|
|
return vec3(x2 * 0.2,
|
|
y2 * 0.2,
|
|
z2 * 0.2 + 0.5);
|
|
}
|
|
|
|
void main()
|
|
{
|
|
vec3 rpos = rotate(pos);
|
|
gl_Position = vec4(rpos.xy, -rpos.z * rpos.z, rpos.z);
|
|
gl_TexCoord[0] = vec4(tex, 0, 0);
|
|
}
|