Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- attribute float cameraPosX;
- attribute float cameraPosY;
- attribute float cameraPosZ;
- in vec4 MCvertex;
- out float sphIndex;
- void main()
- {
- vec3 cartesian;
- vec3 spherical;
- vec3 v = vec3(MCvertex);
- vec3 cameraPos;
- cameraPos.x = cameraPosX;
- cameraPos.y = cameraPosY;
- cameraPos.z = cameraPosZ;
- vec3 cameraDir = normalize(v - cameraPos);
- spherical.x = 1.0;
- spherical.y = acos(cameraDir.z / sqrt(cameraDir.x*cameraDir.x +
- cameraDir.y*cameraDir.y +
- cameraDir.z*cameraDir.z));
- spherical.y = spherical.y * 180.0 / 3.14159265;
- spherical.z = atan(cameraDir.y,
- sqrt(cameraDir.x*cameraDir.x + cameraDir.y*cameraDir.y));
- spherical.z = spherical.z * 180.0 / 3.14159265;
- sphIndex = (spherical.y*179.0 + spherical.z) / (180.0*180.0);
- gl_Position = ftransform();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement