src/2d.c

changeset 232
4c43b9de3294
parent 228
ecda73508be6
equal deleted inserted replaced
231:0da563c4e39c 232:4c43b9de3294
89 const bool filled = rectangle->filled; 89 const bool filled = rectangle->filled;
90 const bool round = rectangle->radius > 0; 90 const bool round = rectangle->radius > 0;
91 const bool border = rectangle->thickness > 0; 91 const bool border = rectangle->thickness > 0;
92 92
93 // Compute shader flags 93 // Compute shader flags
94 int flags = asc_create_flags(1, 3, filled, round, border); 94 int flags = 0;
95 asc_set_flag_if(flags, ASC_RECTANGLE_SHADER_FLAG_FILL, filled);
96 asc_set_flag_if(flags, ASC_RECTANGLE_SHADER_FLAG_ROUND, round);
97 asc_set_flag_if(flags, ASC_RECTANGLE_SHADER_FLAG_BORDER, border);
95 98
96 // Look up and activate the shader 99 // Look up and activate the shader
97 const AscShaderProgram *shader = asc_shader_lookup_or_create( 100 const AscShaderProgram *shader = asc_shader_lookup_or_create(
98 ASC_SHADER_RECTANGLE(flags), 101 ASC_SHADER_RECTANGLE(flags),
99 asc_rectangle_shader_create, flags 102 asc_rectangle_shader_create, flags
220 223
221 const bool filled = ellipsis->filled; 224 const bool filled = ellipsis->filled;
222 const bool border = ellipsis->thickness > 0; 225 const bool border = ellipsis->thickness > 0;
223 226
224 // Compute shader flags 227 // Compute shader flags
225 int shader_flags = asc_create_flags(1, 2, filled, border); 228 int flags = 0;
229 asc_set_flag_if(flags, ASC_ELLIPSIS_SHADER_FLAG_FILL, filled);
230 asc_set_flag_if(flags, ASC_ELLIPSIS_SHADER_FLAG_BORDER, border);
226 231
227 // Look up and activate the shader 232 // Look up and activate the shader
228 const AscShaderProgram *shader = asc_shader_lookup_or_create( 233 const AscShaderProgram *shader = asc_shader_lookup_or_create(
229 ASC_SHADER_ELLIPSIS(shader_flags), 234 ASC_SHADER_ELLIPSIS(flags),
230 asc_ellipsis_shader_create, shader_flags 235 asc_ellipsis_shader_create, flags
231 ); 236 );
232 if (asc_shader_use(shader, camera)) return; 237 if (asc_shader_use(shader, camera)) return;
233 asc_cptr_cast(AscEllipsisShader, ellipsis_shader, shader); 238 asc_cptr_cast(AscEllipsisShader, ellipsis_shader, shader);
234 239
235 // Upload uniforms 240 // Upload uniforms

mercurial