From: hgn Date: Wed, 7 May 2025 20:21:52 +0000 (+0100) Subject: glow for gino X-Git-Url: https://harrygodden.com/git/?a=commitdiff_plain;h=b76ad8d43355b895bbb4479a51bd56aa48b466f4;p=carveJwlIkooP6JGAAIwe30JlM.git glow for gino --- diff --git a/content_skaterift/models/gino.mdl b/content_skaterift/models/gino.mdl index 36e5cdd..3d581d3 100644 Binary files a/content_skaterift/models/gino.mdl and b/content_skaterift/models/gino.mdl differ diff --git a/src/npc_gino.c b/src/npc_gino.c index 11f6706..b5d44a1 100644 --- a/src/npc_gino.c +++ b/src/npc_gino.c @@ -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] );