summaryrefslogtreecommitdiff
path: root/src/transform.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/transform.c')
-rw-r--r--src/transform.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/transform.c b/src/transform.c
index 6e4db56..465841d 100644
--- a/src/transform.c
+++ b/src/transform.c
@@ -83,6 +83,30 @@ int kai_parse_rotate(ka_matrix_t *m, ezxml_t tag)
}
+int kai_parse_scale(ka_matrix_t *m, ezxml_t tag)
+{
+ if (strcmp("scale", ezxml_name(tag)) != 0)
+ return -1;
+
+ char *str = ezxml_txt(tag);
+ char *end;
+ int i;
+ double scale[3];
+ for (i=0; i<3; i++) {
+ scale[i] = strtod(str, &end);
+ str = end;
+ }
+
+ memset(*m, 0, 16*sizeof(double));
+ (*m)[0] = scale[0];
+ (*m)[5] = scale[1];
+ (*m)[10] = scale[2];
+ (*m)[15] = 1.0f;
+
+ return 0;
+}
+
+
int kai_parse_translate(ka_matrix_t *m, ezxml_t tag)
{
if (strcmp("translate", ezxml_name(tag)) != 0)