summaryrefslogtreecommitdiff
path: root/src/transform.c
diff options
context:
space:
mode:
authorsanine <sanine.not@pm.me>2022-11-27 01:19:14 -0600
committersanine <sanine.not@pm.me>2022-11-27 01:19:14 -0600
commit6053d87cd02cd5aec9da5bc46039ec4cca181dec (patch)
tree81dd8f2fd0fc5bef5951bee324a8ceb0bf419613 /src/transform.c
parentc42d9264aed8da3a057719cab7390fa55904bda6 (diff)
add scale parsing
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)