--- a/src/2d.c Mon Jul 07 22:41:48 2025 +0200 +++ b/src/2d.c Mon Jul 07 22:51:06 2025 +0200 @@ -157,14 +157,15 @@ AscSceneNode *asc_rectangle_create(struct asc_rectangle_create_args args) { AscRectangle *rectangle = cxZallocDefault(sizeof(AscRectangle)); + float pos_x, pos_y; if (args.bounds.size.width + args.bounds.size.height > 0) { - rectangle->node.position.x = (float) args.bounds.pos.x; - rectangle->node.position.y = (float) args.bounds.pos.y; + pos_x = (float) args.bounds.pos.x; + pos_y = (float) args.bounds.pos.y; rectangle->size.width = (float) args.bounds.size.width; rectangle->size.height = (float) args.bounds.size.height; } else { - rectangle->node.position.x = (float) args.x; - rectangle->node.position.y = (float) args.y; + pos_x = (float) args.x; + pos_y = (float) args.y; rectangle->size.width = (float) args.width; rectangle->size.height = (float) args.height; } @@ -187,8 +188,9 @@ } AscSceneNode *node = &rectangle->node; - node->position.z = ASC_SCENE_2D_DEPTH_OFFSET; - node->scale = ASC_VEC3F_1; + asc_transform_identity(node->transform); + asc_transform_translate3f(node->transform, + ASC_VEC3F(pos_x, pos_y, ASC_SCENE_2D_DEPTH_OFFSET)); node->render_group = asc_context.ink.alpha < 255 ? ASC_RENDER_GROUP_2D_BLEND : ASC_RENDER_GROUP_2D_OPAQUE; @@ -308,9 +310,10 @@ AscSceneNode *asc_ellipsis_create(struct asc_ellipsis_create_args args) { AscEllipsis *ellipsis = cxZallocDefault(sizeof(AscEllipsis)); + float pos_x, pos_y; if (args.bounds.size.width + args.bounds.size.height > 0) { - ellipsis->node.position.x = (float) args.bounds.pos.x; - ellipsis->node.position.y = (float) args.bounds.pos.y; + pos_x = (float) args.bounds.pos.x; + pos_y = (float) args.bounds.pos.y; ellipsis->radii.x = (float) args.bounds.size.width / 2.f; ellipsis->radii.y = (float) args.bounds.size.height / 2.f; } else { @@ -318,8 +321,8 @@ const unsigned cy = ASC_NONZERO_OR(args.y, args.center.y); const unsigned rx = ASC_NONZERO_OR(args.radius, args.radius_x); const unsigned ry = ASC_NONZERO_OR(args.radius, args.radius_y); - ellipsis->node.position.x = (float) (cx-rx); - ellipsis->node.position.y = (float) (cy-ry); + pos_x = (float) (cx-rx); + pos_y = (float) (cy-ry); ellipsis->radii.x = (float) rx; ellipsis->radii.y = (float) ry; } @@ -341,8 +344,9 @@ } AscSceneNode *node = &ellipsis->node; - node->position.z = ASC_SCENE_2D_DEPTH_OFFSET; - node->scale = ASC_VEC3F_1; + asc_transform_identity(node->transform); + asc_transform_translate3f(node->transform, + ASC_VEC3F(pos_x, pos_y, ASC_SCENE_2D_DEPTH_OFFSET)); node->render_group = asc_context.ink.alpha < 255 ? ASC_RENDER_GROUP_2D_BLEND : ASC_RENDER_GROUP_2D_OPAQUE;