player: use sprite_particle shader for better batching

This commit is contained in:
Andrei Alexeyev 2024-10-03 18:31:16 +02:00
parent bcc5b17430
commit 5610ecb6b7
No known key found for this signature in database
GPG key ID: 72D26128040B9690

View file

@ -261,9 +261,14 @@ static void ent_draw_player(EntityInterface *ent) {
return;
}
ShaderCustomParams shader_params = { 1.0f };
ShaderProgram *shader = res_shader("sprite_particle");
if(plr->focus_circle_alpha) {
r_draw_sprite(&(SpriteParams) {
.sprite_ptr = res_sprite("fairy_circle"),
.shader_ptr = shader,
.shader_params = &shader_params,
.rotation.angle = DEG2RAD * global.frames * 10,
.color = RGBA_MUL_ALPHA(1, 1, 1, 0.2 * plr->focus_circle_alpha),
.pos = { re(plr->pos), im(plr->pos) },
@ -281,6 +286,8 @@ static void ent_draw_player(EntityInterface *ent) {
r_draw_sprite(&(SpriteParams) {
.sprite_ptr = aniplayer_get_frame(&plr->ani),
.shader_ptr = shader,
.shader_params = &shader_params,
.pos.as_cmplx = plr->pos,
.color = &c,
});