summaryrefslogtreecommitdiff
path: root/src/transform.c
diff options
context:
space:
mode:
authorsanine <sanine.not@pm.me>2022-11-26 23:33:32 -0600
committersanine <sanine.not@pm.me>2022-11-26 23:33:32 -0600
commit29f9921b919497be4d652ce963c8afbb2c1cd1e7 (patch)
treeaae2f98de4e64829a12b577d13aa48a84d9b23d6 /src/transform.c
parentd087821a142558865675653a016f654eb66db730 (diff)
implement basic matrix parsing
Diffstat (limited to 'src/transform.c')
-rw-r--r--src/transform.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/transform.c b/src/transform.c
new file mode 100644
index 0000000..7c50a5e
--- /dev/null
+++ b/src/transform.c
@@ -0,0 +1,23 @@
+#include <stdlib.h>
+#include <string.h>
+
+#include <kalmia.h>
+#include <ezxml.h>
+#include "transform.h"
+
+
+int kai_parse_matrix(ka_matrix_t *m, ezxml_t tag)
+{
+ if (strcmp("matrix", ezxml_name(tag)) != 0)
+ return -1;
+
+ char *str = ezxml_txt(tag);
+ char *end;
+ int i;
+ for (i=0; i<16; i++) {
+ (*m)[i] = strtod(str, &end);
+ str = end;
+ }
+
+ return 0;
+}