| 575 | } |
| 576 | |
| 577 | void setMatricesWindowPersp( int screenWidth, int screenHeight, float fovDegrees, float nearPlane, float farPlane, bool originUpperLeft ) |
| 578 | { |
| 579 | auto ctx = gl::context(); |
| 580 | |
| 581 | CameraPersp cam( screenWidth, screenHeight, fovDegrees, nearPlane, farPlane ); |
| 582 | ctx->getModelMatrixStack().back() = mat4(); |
| 583 | ctx->getProjectionMatrixStack().back() = cam.getProjectionMatrix(); |
| 584 | ctx->getViewMatrixStack().back() = cam.getViewMatrix(); |
| 585 | if( originUpperLeft ) { |
| 586 | ctx->getViewMatrixStack().back() *= glm::scale( vec3( 1, -1, 1 ) ); // invert Y axis so increasing Y goes down. |
| 587 | ctx->getViewMatrixStack().back() *= glm::translate( vec3( 0, (float) - screenHeight, 0 ) ); // shift origin up to upper-left corner. |
| 588 | } |
| 589 | } |
| 590 | |
| 591 | void setMatricesWindowPersp( const ci::ivec2& screenSize, float fovDegrees, float nearPlane, float farPlane, bool originUpperLeft ) |
| 592 | { |
no test coverage detected