3 This file is part of libmspgl
4 Copyright © 2007 Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
10 #include "projection.h"
15 extern MatrixStack *active_stack;
17 void ortho(double left, double right, double bottom, double top, double nearr, double farr)
19 *active_stack *= Matrix::ortho(left, right, bottom, top, nearr, farr);
22 void ortho_centered(double width, double height)
24 ortho(-width/2, width/2, -height/2, height/2, 0, 1);
27 void ortho_bottomleft(double width, double height)
29 ortho(0, width, 0, height, 0, 1);
32 void ortho_topleft(double width, double height)
34 ortho(0, width, height, 0, 0, 1);
37 void frustum(double left, double right, double bottom, double top, double nearr, double farr)
39 *active_stack *= Matrix::frustum(left, right, bottom, top, nearr, farr);
42 void frustum_centered(double width, double height, double nearr, double farr)
44 frustum(-width/2, width/2, -height/2, height/2, nearr, farr);
47 void perspective(double fov_y, double aspect, double nearr, double farr)
49 double hh = tan(fov_y*M_PI/360)*nearr;
50 frustum(-hh*aspect, hh*aspect, -hh, hh, nearr, farr);