src/sprite.c

changeset 102
0d94fd280c6e
parent 97
f9a55457b26f
--- a/src/sprite.c	Tue Apr 29 21:51:29 2025 +0200
+++ b/src/sprite.c	Thu May 01 15:26:01 2025 +0200
@@ -54,8 +54,10 @@
 
     node->position.x = (float) args.x;
     node->position.y = (float) args.y;
-    node->scale.x = (float) (args.width == 0 ? args.texture->width : args.width);
-    node->scale.y = (float) (args.height == 0 ? args.texture->height : args.height);
+    node->position.z = ASC_SCENE_2D_DEPTH_OFFSET;
+    node->scale.width = (float) (args.width == 0 ? args.texture->width : args.width);
+    node->scale.height = (float) (args.height == 0 ? args.texture->height : args.height);
+    node->scale.depth = 1.f;
     asc_node_update_transform(node);
 
     return node;
@@ -78,9 +80,6 @@
         asc_texture_bind(node->texture, shader->uv_tex, 1);
     }
 
-    // Apply depth
-    glUniform1f(shader->depth, (float)(node->data.depth));
-
     // Draw mesh
     asc_mesh_draw_triangle_strip(ASC_PRIMITIVE_PLANE);
 }

mercurial