#include <libguile.h>
#include "matrix4.h"
-extern "C" {
-
- SCM
- scm_from_matrix4 (irr::core::matrix4 cmatrix)
- {
- return scm_list_4 (scm_list_4 (scm_from_double (cmatrix[0]),
- scm_from_double (cmatrix[1]),
- scm_from_double (cmatrix[2]),
- scm_from_double (cmatrix[3])),
- scm_list_4 (scm_from_double (cmatrix[4]),
- scm_from_double (cmatrix[5]),
- scm_from_double (cmatrix[6]),
- scm_from_double (cmatrix[7])),
- scm_list_4 (scm_from_double (cmatrix[8]),
- scm_from_double (cmatrix[9]),
- scm_from_double (cmatrix[10]),
- scm_from_double (cmatrix[11])),
- scm_list_4 (scm_from_double (cmatrix[12]),
- scm_from_double (cmatrix[13]),
- scm_from_double (cmatrix[14]),
- scm_from_double (cmatrix[15])));
- }
-
- irr::core::matrix4
- scm_to_matrix4 (SCM matrix)
- {
- irr::core::matrix4 cmatrix;
-
- cmatrix[0] = scm_to_double (scm_car (scm_car (matrix)));
- cmatrix[1] = scm_to_double (scm_cadr (scm_car (matrix)));
- cmatrix[2] = scm_to_double (scm_caddr (scm_car (matrix)));
- cmatrix[3] = scm_to_double (scm_cadddr (scm_car (matrix)));
-
- cmatrix[4] = scm_to_double (scm_car (scm_cadr (matrix)));
- cmatrix[5] = scm_to_double (scm_cadr (scm_cadr (matrix)));
- cmatrix[6] = scm_to_double (scm_caddr (scm_cadr (matrix)));
- cmatrix[7] = scm_to_double (scm_cadddr (scm_cadr (matrix)));
-
- cmatrix[8] = scm_to_double (scm_car (scm_caddr (matrix)));
- cmatrix[9] = scm_to_double (scm_cadr (scm_caddr (matrix)));
- cmatrix[10] = scm_to_double (scm_caddr (scm_caddr (matrix)));
- cmatrix[11] = scm_to_double (scm_cadddr (scm_caddr (matrix)));
-
- cmatrix[12] = scm_to_double (scm_car (scm_cadddr (matrix)));
- cmatrix[13] = scm_to_double (scm_cadr (scm_cadddr (matrix)));
- cmatrix[14] = scm_to_double (scm_caddr (scm_cadddr (matrix)));
- cmatrix[15] = scm_to_double (scm_cadddr (scm_cadddr (matrix)));
-
- return cmatrix;
- }
+using namespace irr;
+
+
+SCM
+scm_from_matrix4 (core::matrix4 cmatrix)
+{
+ return scm_list_4 (scm_list_4 (scm_from_double (cmatrix[0]),
+ scm_from_double (cmatrix[1]),
+ scm_from_double (cmatrix[2]),
+ scm_from_double (cmatrix[3])),
+ scm_list_4 (scm_from_double (cmatrix[4]),
+ scm_from_double (cmatrix[5]),
+ scm_from_double (cmatrix[6]),
+ scm_from_double (cmatrix[7])),
+ scm_list_4 (scm_from_double (cmatrix[8]),
+ scm_from_double (cmatrix[9]),
+ scm_from_double (cmatrix[10]),
+ scm_from_double (cmatrix[11])),
+ scm_list_4 (scm_from_double (cmatrix[12]),
+ scm_from_double (cmatrix[13]),
+ scm_from_double (cmatrix[14]),
+ scm_from_double (cmatrix[15])));
+}
+
+
+core::matrix4
+scm_to_matrix4 (SCM matrix)
+{
+ core::matrix4 cmatrix;
+
+ cmatrix[0] = scm_to_double (scm_car (scm_car (matrix)));
+ cmatrix[1] = scm_to_double (scm_cadr (scm_car (matrix)));
+ cmatrix[2] = scm_to_double (scm_caddr (scm_car (matrix)));
+ cmatrix[3] = scm_to_double (scm_cadddr (scm_car (matrix)));
+
+ cmatrix[4] = scm_to_double (scm_car (scm_cadr (matrix)));
+ cmatrix[5] = scm_to_double (scm_cadr (scm_cadr (matrix)));
+ cmatrix[6] = scm_to_double (scm_caddr (scm_cadr (matrix)));
+ cmatrix[7] = scm_to_double (scm_cadddr (scm_cadr (matrix)));
+
+ cmatrix[8] = scm_to_double (scm_car (scm_caddr (matrix)));
+ cmatrix[9] = scm_to_double (scm_cadr (scm_caddr (matrix)));
+ cmatrix[10] = scm_to_double (scm_caddr (scm_caddr (matrix)));
+ cmatrix[11] = scm_to_double (scm_cadddr (scm_caddr (matrix)));
+
+ cmatrix[12] = scm_to_double (scm_car (scm_cadddr (matrix)));
+ cmatrix[13] = scm_to_double (scm_cadr (scm_cadddr (matrix)));
+ cmatrix[14] = scm_to_double (scm_caddr (scm_cadddr (matrix)));
+ cmatrix[15] = scm_to_double (scm_cadddr (scm_cadddr (matrix)));
+
+ return cmatrix;
}