1 /* guile-irrlicht --- GNU Guile bindings for Irrlicht Engine
3 Copyright (C) 2020 Javier Sancho <jsf@jsancho.org>
5 This file is part of guile-irrlicht.
7 guile-irrlicht is free software; you can redistribute it and/or modify
8 it under the terms of the GNU Lesser General Public License as
9 published by the Free Software Foundation; either version 3 of the
10 License, or (at your option) any later version.
12 guile-irrlicht is distributed in the hope that it will be useful, but
13 WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 General Public License for more details.
17 You should have received a copy of the GNU Lesser General Public
18 License along with guile-irrlicht. If not, see
19 <http://www.gnu.org/licenses/>.
22 #include <irrlicht/irrlicht.h>
29 scm_from_matrix4 (core::matrix4 cmatrix)
31 return scm_list_4 (scm_list_4 (scm_from_double (cmatrix[0]),
32 scm_from_double (cmatrix[1]),
33 scm_from_double (cmatrix[2]),
34 scm_from_double (cmatrix[3])),
35 scm_list_4 (scm_from_double (cmatrix[4]),
36 scm_from_double (cmatrix[5]),
37 scm_from_double (cmatrix[6]),
38 scm_from_double (cmatrix[7])),
39 scm_list_4 (scm_from_double (cmatrix[8]),
40 scm_from_double (cmatrix[9]),
41 scm_from_double (cmatrix[10]),
42 scm_from_double (cmatrix[11])),
43 scm_list_4 (scm_from_double (cmatrix[12]),
44 scm_from_double (cmatrix[13]),
45 scm_from_double (cmatrix[14]),
46 scm_from_double (cmatrix[15])));
50 scm_to_matrix4 (SCM matrix)
52 core::matrix4 cmatrix;
54 cmatrix[0] = scm_to_double (scm_car (scm_car (matrix)));
55 cmatrix[1] = scm_to_double (scm_cadr (scm_car (matrix)));
56 cmatrix[2] = scm_to_double (scm_caddr (scm_car (matrix)));
57 cmatrix[3] = scm_to_double (scm_cadddr (scm_car (matrix)));
59 cmatrix[4] = scm_to_double (scm_car (scm_cadr (matrix)));
60 cmatrix[5] = scm_to_double (scm_cadr (scm_cadr (matrix)));
61 cmatrix[6] = scm_to_double (scm_caddr (scm_cadr (matrix)));
62 cmatrix[7] = scm_to_double (scm_cadddr (scm_cadr (matrix)));
64 cmatrix[8] = scm_to_double (scm_car (scm_caddr (matrix)));
65 cmatrix[9] = scm_to_double (scm_cadr (scm_caddr (matrix)));
66 cmatrix[10] = scm_to_double (scm_caddr (scm_caddr (matrix)));
67 cmatrix[11] = scm_to_double (scm_cadddr (scm_caddr (matrix)));
69 cmatrix[12] = scm_to_double (scm_car (scm_cadddr (matrix)));
70 cmatrix[13] = scm_to_double (scm_cadr (scm_cadddr (matrix)));
71 cmatrix[14] = scm_to_double (scm_caddr (scm_cadddr (matrix)));
72 cmatrix[15] = scm_to_double (scm_cadddr (scm_cadddr (matrix)));