src/2d.c

changeset 223
4f32c7755138
parent 222
2cb9a71df7a6
child 226
18327d2df79d
equal deleted inserted replaced
222:2cb9a71df7a6 223:4f32c7755138
59 asc_shader_init_uniform_loc_nice(shader, AscRectangleShader, radius); 59 asc_shader_init_uniform_loc_nice(shader, AscRectangleShader, radius);
60 } 60 }
61 } 61 }
62 62
63 static AscShaderProgram *asc_rectangle_shader_create(int flags) { 63 static AscShaderProgram *asc_rectangle_shader_create(int flags) {
64 const char * const defines[] = { 64 return asc_shader_create((AscShaderCodes){
65 "#define FILL\n", 65 .vtx = {.source_file = "sprite_vtx.glsl"},
66 "#define ROUNDED_CORNERS\n", 66 .frag = {
67 "#define BORDER\n" 67 .source_file = "rectangle_frag.glsl",
68 }; 68 .preamble_code = (const char *[]) {
69 return asc_shader_create((AscShaderCodeInfo){ 69 "#define FILL",
70 .files.vtx = "sprite_vtx.glsl", 70 "#define ROUNDED_CORNERS",
71 .files.frag = "rectangle_frag.glsl", 71 "#define BORDER"
72 .defines.frag_list = defines, 72 },
73 .defines.frag_list_select = flags 73 .preamble_code_flags = flags,
74 },
74 }, sizeof(AscRectangleShader), asc_rectangle_shader_init, flags); 75 }, sizeof(AscRectangleShader), asc_rectangle_shader_init, flags);
75 } 76 }
76 77
77 static void asc_rectangle_destroy(AscSceneNode *node) { 78 static void asc_rectangle_destroy(AscSceneNode *node) {
78 asc_ptr_cast(AscRectangle, rectangle, node); 79 asc_ptr_cast(AscRectangle, rectangle, node);
213 asc_shader_init_uniform_loc_nice(shader, AscEllipsisShader, border_color); 214 asc_shader_init_uniform_loc_nice(shader, AscEllipsisShader, border_color);
214 } 215 }
215 } 216 }
216 217
217 static AscShaderProgram *asc_ellipsis_shader_create(int flags) { 218 static AscShaderProgram *asc_ellipsis_shader_create(int flags) {
218 const char * const defines[] = { 219 return asc_shader_create((AscShaderCodes){
219 "#define FILL\n", 220 .vtx = {.source_file = "sprite_vtx.glsl"},
220 "#define BORDER\n" 221 .frag = {
221 }; 222 .source_file = "ellipsis_frag.glsl",
222 return asc_shader_create((AscShaderCodeInfo){ 223 .preamble_code = (const char *[]) {
223 .files.vtx = "sprite_vtx.glsl", 224 "#define FILL",
224 .files.frag = "ellipsis_frag.glsl", 225 "#define BORDER"
225 .defines.frag_list = defines, 226 },
226 .defines.frag_list_select = flags 227 .preamble_code_flags = flags,
228 },
227 }, sizeof(AscEllipsisShader), asc_ellipsis_shader_init, flags); 229 }, sizeof(AscEllipsisShader), asc_ellipsis_shader_init, flags);
228 } 230 }
229 231
230 static void asc_ellipsis_draw(const AscCamera *camera, const AscSceneNode *node) { 232 static void asc_ellipsis_draw(const AscCamera *camera, const AscSceneNode *node) {
231 asc_cptr_cast(AscEllipsis, ellipsis, node); 233 asc_cptr_cast(AscEllipsis, ellipsis, node);

mercurial