src/sprite.c

changeset 102
0d94fd280c6e
parent 97
f9a55457b26f
equal deleted inserted replaced
101:febf3dc10011 102:0d94fd280c6e
52 : ASC_RENDER_GROUP_SPRITE_BLEND; 52 : ASC_RENDER_GROUP_SPRITE_BLEND;
53 node->free_func = asc_sprite_free; 53 node->free_func = asc_sprite_free;
54 54
55 node->position.x = (float) args.x; 55 node->position.x = (float) args.x;
56 node->position.y = (float) args.y; 56 node->position.y = (float) args.y;
57 node->scale.x = (float) (args.width == 0 ? args.texture->width : args.width); 57 node->position.z = ASC_SCENE_2D_DEPTH_OFFSET;
58 node->scale.y = (float) (args.height == 0 ? args.texture->height : args.height); 58 node->scale.width = (float) (args.width == 0 ? args.texture->width : args.width);
59 node->scale.height = (float) (args.height == 0 ? args.texture->height : args.height);
60 node->scale.depth = 1.f;
59 asc_node_update_transform(node); 61 asc_node_update_transform(node);
60 62
61 return node; 63 return node;
62 } 64 }
63 65
76 } else { 78 } else {
77 asc_texture_bind(ASC_TEXTURE_RECT_EMPTY_1X1, shader->rect_tex, 0); 79 asc_texture_bind(ASC_TEXTURE_RECT_EMPTY_1X1, shader->rect_tex, 0);
78 asc_texture_bind(node->texture, shader->uv_tex, 1); 80 asc_texture_bind(node->texture, shader->uv_tex, 1);
79 } 81 }
80 82
81 // Apply depth
82 glUniform1f(shader->depth, (float)(node->data.depth));
83
84 // Draw mesh 83 // Draw mesh
85 asc_mesh_draw_triangle_strip(ASC_PRIMITIVE_PLANE); 84 asc_mesh_draw_triangle_strip(ASC_PRIMITIVE_PLANE);
86 } 85 }

mercurial