Created
October 29, 2014 17:03
-
-
Save shakesoda/429679fd0a9ba3afd39d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <glm/glm.hpp> | |
| #include <glm/gtc/matrix_transform.hpp> | |
| #include <cstdio> | |
| #ifdef _MSC_VER | |
| // I really don't give a shit about your deprecation warnings, MSVC. | |
| #pragma warning(disable: 4996) | |
| #define usleep _sleep | |
| #else | |
| #include <unistd.h> | |
| #endif | |
| int main(int argc, char* argv[]) { | |
| using namespace glm; | |
| vec3 position = vec3(-17.509939642822,17.390961881204,5.8447955086467); | |
| mat4 model = mat4( | |
| vec4(0.79490, 0.60673, 0.00450, 0.00000), | |
| vec4(-0.60206, 0.78782, 0.12990, 0.00000), | |
| vec4(0.07527, -0.10596, 0.99152, 0.00000), | |
| vec4(-17.50994, 17.39096, 5.84480, 1.00000) | |
| ); | |
| mat4 view = mat4( | |
| vec4(0.79455, -0.14571, 0.58946, 0.00000), | |
| vec4(0.60720, 0.19067, -0.77133, 0.00000), | |
| vec4(0.00000, 0.97078, 0.23997, 0.00000), | |
| vec4(3.35266, -13.48294, 14.68204, 1.00000) | |
| ); | |
| mat4 proj = mat4( | |
| vec4(1.35800, 0.00000, 0.00000, 0.00000), | |
| vec4(0.00000, 2.41421, 0.00000, 0.00000), | |
| vec4(0.00000, 0.00000, -1.00002, -1.00000), | |
| vec4(0.00000, 0.00000, -0.00020, 1.00000) | |
| ); | |
| vec4 viewport = vec4(0.000000, 0.000000, 1280.000000, 720.000000); | |
| vec3 out = glm::project(position, view * model, proj, viewport); | |
| // CPML: | |
| // PROJECTED POSITION: (835.46074528246,350.04778221494,0.11878528947687) | |
| // This thing: ...something totally different (and probably correct!) | |
| printf("[ %3.4f %3.4f %3.4f ]\n", out[0], out[1], out[2]); | |
| usleep(10000); | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
[ -29.9487, 732.8279, 0.9780 ]