src/2d.c

changeset 204
be5cf64b5c29
parent 189
2c063b225183
--- a/src/2d.c	Sun Jul 13 14:22:40 2025 +0200
+++ b/src/2d.c	Sun Jul 13 15:09:04 2025 +0200
@@ -34,6 +34,8 @@
 
 #include <assert.h>
 
+// TODO: add "origin" arguments to 2D primitives
+
 typedef struct asc_rectangle_shader_s {
     AscShaderProgram program;
     asc_uniform_loc color;
@@ -188,9 +190,9 @@
     }
 
     AscSceneNode *node = &rectangle->node;
-    asc_transform_identity(node->transform);
-    asc_transform_translate3f(node->transform,
-        ASC_VEC3F(pos_x, pos_y, ASC_SCENE_2D_DEPTH_OFFSET));
+    node->position = ASC_VEC3F(pos_x, pos_y, ASC_SCENE_2D_DEPTH_OFFSET);
+    node->scale = ASC_VEC3F_1;
+    asc_mat4f_unit(node->rotation);
     node->render_group = asc_context.ink.alpha < 255
                              ? ASC_RENDER_GROUP_2D_BLEND
                              : ASC_RENDER_GROUP_2D_OPAQUE;
@@ -344,9 +346,9 @@
     }
 
     AscSceneNode *node = &ellipsis->node;
-    asc_transform_identity(node->transform);
-    asc_transform_translate3f(node->transform,
-        ASC_VEC3F(pos_x, pos_y, ASC_SCENE_2D_DEPTH_OFFSET));
+    node->position = ASC_VEC3F(pos_x, pos_y, ASC_SCENE_2D_DEPTH_OFFSET);
+    node->scale = ASC_VEC3F_1;
+    asc_mat4f_unit(node->rotation);
     node->render_group = asc_context.ink.alpha < 255
                              ? ASC_RENDER_GROUP_2D_BLEND
                              : ASC_RENDER_GROUP_2D_OPAQUE;

mercurial