src/sprite.c

changeset 90
aa8e7a38905c
parent 89
e1f682a8a145
equal deleted inserted replaced
89:e1f682a8a145 90:aa8e7a38905c
61 return node; 61 return node;
62 } 62 }
63 63
64 void asc_sprite_draw(AscSprite const *node) { 64 void asc_sprite_draw(AscSprite const *node) {
65 // Obtain shader 65 // Obtain shader
66 AscShaderSprite *shader = &ASC_DEFAULT_SHADER.sprite; 66 AscShaderSprite *shader = ASC_SHADER_SPRITE;
67 67
68 // Upload model matrix 68 // Upload model matrix
69 glUniformMatrix4fv(shader->program.model, 1, 69 glUniformMatrix4fv(shader->program.model, 1,
70 GL_FALSE, node->data.world_transform); 70 GL_FALSE, node->data.world_transform);
71 71
72 // Bind texture 72 // Bind texture
73 if (node->texture->target == GL_TEXTURE_RECTANGLE) { 73 if (node->texture->target == GL_TEXTURE_RECTANGLE) {
74 asc_texture_bind(node->texture, shader->rect_tex, 0); 74 asc_texture_bind(node->texture, shader->rect_tex, 0);
75 asc_texture_bind(&ASC_DEFAULT_TEXTURES.empty_1x1_2d, shader->uv_tex, 1); 75 asc_texture_bind(ASC_TEXTURE_2D_EMPTY_1X1, shader->uv_tex, 1);
76 } else { 76 } else {
77 asc_texture_bind(&ASC_DEFAULT_TEXTURES.empty_1x1_rect, shader->rect_tex, 0); 77 asc_texture_bind(ASC_TEXTURE_RECT_EMPTY_1X1, shader->rect_tex, 0);
78 asc_texture_bind(node->texture, shader->uv_tex, 1); 78 asc_texture_bind(node->texture, shader->uv_tex, 1);
79 } 79 }
80 80
81 // Apply depth 81 // Apply depth
82 glUniform1f(shader->depth, (float)(node->data.depth)); 82 glUniform1f(shader->depth, (float)(node->data.depth));
83 83
84 // Draw mesh 84 // Draw mesh
85 asc_mesh_draw_triangle_strip(&ASC_PRIMITIVES.plane); 85 asc_mesh_draw_triangle_strip(ASC_PRIMITIVE_PLANE);
86 } 86 }

mercurial