glow for gino
authorhgn <hgodden00@gmail.com>
Wed, 7 May 2025 20:21:52 +0000 (21:21 +0100)
committerhgn <hgodden00@gmail.com>
Wed, 7 May 2025 20:21:52 +0000 (21:21 +0100)
content_skaterift/models/gino.mdl
src/npc_gino.c

index 36e5cdd6f41fe9d2632d8926f965bc0543ad6c5d..3d581d351bd226ae58d5e8b12c83c8a6f820dad7 100644 (file)
Binary files a/content_skaterift/models/gino.mdl and b/content_skaterift/models/gino.mdl differ
index 11f6706d2758da6fbc669be77f7f375c809ad0a0..b5d44a14c75dbc1d2f5e2f8abc56caf04dd8a3c7 100644 (file)
@@ -11,7 +11,7 @@ struct
    state;
 
    mdl_context mdl;
-   i32 sm_main, sm_hat;
+   i32 sm_main, sm_hat, sm_glow;
 
    f64 command_t;
    v3f co, p0, p1;
@@ -75,6 +75,7 @@ void _npc_gino_init(void)
    mdl_async_full_load_std( mdl, NULL );
    _gino.sm_main = mdl_get_submesh_index( mdl, "gino" );
    _gino.sm_hat = mdl_get_submesh_index( mdl, "gino.hat" );
+   _gino.sm_glow = mdl_get_submesh_index( mdl, "gino.spt" );
    mdl_close( mdl );
 }
 
@@ -197,10 +198,6 @@ void _npc_gino_render( vg_camera *cam )
    if( _gino.state == k_gino_none )
       return;
 
-   mesh_bind( &_gino.mdl.mesh );
-   glActiveTexture( GL_TEXTURE0 );
-   glBindTexture( GL_TEXTURE_2D, _gino.mdl.textures[0].glname );
-
    world_instance *world = &_world.main;
    shader_model_entity_use();
    shader_model_entity_uTexMain( 0 );
@@ -208,7 +205,27 @@ void _npc_gino_render( vg_camera *cam )
    shader_model_entity_uPv( cam->mtx.pv );
    WORLD_BIND_LIGHT_BUFFERS_UB0_TEX234( world, model_entity );
 
+   mesh_bind( &_gino.mdl.mesh );
+   glActiveTexture( GL_TEXTURE0 );
+
+   glDepthMask(GL_FALSE);
+   glEnable(GL_BLEND);
+   glBlendFunc(GL_ONE, GL_ONE);
+   glBlendEquation(GL_FUNC_ADD);
+   glBindTexture( GL_TEXTURE_2D, _gino.mdl.textures[1].glname );
+
    m4x3f mmdl;
+   m3x3_copy( cam->transform, mmdl );
+   v3_copy( _gino.co, mmdl[3] );
+   shader_model_entity_uMdl( mmdl );
+   glDrawBuffers( 1, (GLenum[]){ GL_COLOR_ATTACHMENT0 } );
+   mdl_draw_submesh( &_gino.mdl.submeshes[ _gino.sm_glow ] );
+   glDrawBuffers( 2, (GLenum[]){ GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1 } );
+
+   glDepthMask(GL_TRUE);
+   glDisable(GL_BLEND);
+   glBindTexture( GL_TEXTURE_2D, _gino.mdl.textures[0].glname );
+
    v3f v0 = { localplayer.rb.co[0] - _gino.co[0], 0.0f, localplayer.rb.co[2] - _gino.co[2] };
    v3_normalize( v0 );
    v3_copy( v0, mmdl[0] );