Skip to content

Commit

Permalink
unlit plasma projectile
Browse files Browse the repository at this point in the history
  • Loading branch information
computermouth committed Nov 25, 2023
1 parent 0ac7184 commit 1473517
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
17 changes: 17 additions & 0 deletions entity_projectile_plasma.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@ void entity_projectile_plasma_init(entity_t * e);
void entity_projectile_plasma_update(entity_t * e);
void entity_projectile_plasma_did_collide(entity_t * e, int axis);
void entity_projectile_plasma_did_collide_with_entity(entity_t * e, entity_t * other);
void entity_projectile_plasma_draw_model(entity_t * e);

void entity_projectile_plasma_constructor(entity_t * e) {
entity_constructor(e);

e->_update = entity_projectile_plasma_update;
e->_did_collide = entity_projectile_plasma_did_collide;
e->_did_collide_with_entity = entity_projectile_plasma_did_collide_with_entity;
e->_draw_model = entity_projectile_plasma_draw_model;

entity_projectile_plasma_init(e);
}
Expand Down Expand Up @@ -64,4 +66,19 @@ void entity_projectile_plasma_did_collide(entity_t * e, int axis) {
void entity_projectile_plasma_did_collide_with_entity(entity_t * e, entity_t * other) {
e->_kill(e);
other->_receive_damage(other, e, 15);
}

void entity_projectile_plasma_draw_model(entity_t * e) {
draw_call_t call = {
.pos = e->p,
.yaw = e->_yaw,
.pitch = e->_pitch,
.texture = e->_texture,
.f1 = e->_model.frames[0],
.f2 = e->_model.frames[0],
.mix = 0.0f,
.unlit = 1,
.num_verts = e->_model.nv
};
r_draw(call);
}
2 changes: 1 addition & 1 deletion shader.frag
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
// "vl = vec3(2,2,2);"

"vec3 p = pow(vl,vec3(0.75));"
"if (f_unlit != 0.) { p = vec3(0.75); }"
"if (f_unlit != 0.) { p = vec3(1.25); }"

"gl_FragColor.rgb=floor("
"gl_FragColor.rgb*p" // Light, Gamma
Expand Down

0 comments on commit 1473517

Please sign in to comment.