From: hgn Date: Sat, 31 Dec 2022 16:05:13 +0000 (+0000) Subject: update compiler for blender 3.4.1 X-Git-Url: https://harrygodden.com/git/?a=commitdiff_plain;ds=sidebyside;h=cbce8a9ec86c6f061c292eec1855eacafc6a3a4f;p=carveJwlIkooP6JGAAIwe30JlM.git update compiler for blender 3.4.1 --- diff --git a/blender_export.py b/blender_export.py index cf6d3f7..8cd60ea 100644 --- a/blender_export.py +++ b/blender_export.py @@ -1009,8 +1009,8 @@ cxr_graph_mapping = \ }, "Mix": { - "Color1": material_tex_image("tex_diffuse"), - "Color2": material_tex_image("tex_decal") + "A": material_tex_image("tex_diffuse"), + "B": material_tex_image("tex_decal") }, }, "Normal": @@ -1063,9 +1063,20 @@ def material_info(mat): if isinstance( link_def, dict ): #{ - node_link = node.inputs[link] + node_link = None + for x in node.inputs: + #{ + if isinstance( x, bpy.types.NodeSocketColor ): + #{ + if link == x.name: + #{ + node_link = x + break + #} + #} + #} - if node_link.is_linked: + if node_link and node_link.is_linked: #{ # look for definitions for the connected node type # @@ -2551,6 +2562,12 @@ class CV_MATERIAL_PANEL(bpy.types.Panel): info = material_info( active_mat ) + if 'tex_diffuse' in info: + #{ + _.layout.label( icon='INFO', \ + text=F"{info['tex_diffuse'].name} will be compiled" ) + #} + _.layout.prop( active_mat.cv_data, "shader" ) _.layout.prop( active_mat.cv_data, "surface_prop" ) _.layout.prop( active_mat.cv_data, "collision" ) diff --git a/maps_src/mp_mtzero.mdl b/maps_src/mp_mtzero.mdl index 33fda35..7654fcb 100644 Binary files a/maps_src/mp_mtzero.mdl and b/maps_src/mp_mtzero.mdl differ diff --git a/menu.h b/menu.h index 162b76e..d8b6864 100644 --- a/menu.h +++ b/menu.h @@ -488,7 +488,7 @@ VG_STATIC void menu_page_map(void) audio_play_oneshot( &audio_rewind[4], 1.0f ); audio_unlock(); - if( v < 0.0f ) + if( v > 0.0f ) { game_menu.selected_map --; diff --git a/player.h b/player.h index 8e4ae82..2325f72 100644 --- a/player.h +++ b/player.h @@ -48,6 +48,7 @@ VG_STATIC float VG_STATIC int freecam = 0; VG_STATIC int walk_grid_iterations = 1; VG_STATIC float fc_speed = 10.0f; +VG_STATIC int cl_thirdperson = 0; /* * ----------------------------------------------------------------------------- @@ -347,6 +348,14 @@ VG_STATIC void player_init(void) /* 1 */ .persistent = 1 }); + vg_convar_push( (struct vg_convar){ + .name = "cl_thirdperson", + .data = &cl_thirdperson, + .data_type = k_convar_dtype_i32, + .opt_i32 = { .min=0, .max=1, .clamp=1 }, + .persistent = 1 + }); + vg_convar_push( (struct vg_convar){ .name = "fcs", .data = &fc_speed, @@ -614,7 +623,12 @@ VG_STATIC void player_update_post(void) player_animate(); if( !freecam ) - player_animate_camera(); + { + if( cl_thirdperson ) + player_animate_camera_thirdperson(); + else + player_animate_camera(); + } } if( freecam ) diff --git a/player_animation.h b/player_animation.h index e089910..98aa256 100644 --- a/player_animation.h +++ b/player_animation.h @@ -318,6 +318,53 @@ VG_STATIC void player_animate_death_cam(void) player.angles[1] = -asinf( delta[1] ); } +VG_STATIC void player_animate_follow_cam( v3f target, float dist, float speed ) +{ + v3f delta; + + v3_sub( target, player.camera_pos, delta ); + v3_normalize( delta ); + + v3f follow_pos; + v3_muladds( target, delta, -dist, follow_pos ); + v3_lerp( player.camera_pos, follow_pos, + speed * vg.time_delta, player.camera_pos ); + + /* + * Make sure the camera stays above the ground + */ + v3f min_height = {0.0f,1.0f,0.0f}; + + v3f sample; + v3_add( player.camera_pos, min_height, sample ); + ray_hit hit; + hit.dist = min_height[1]*2.0f; + + if( ray_world( sample, (v3f){0.0f,-1.0f,0.0f}, &hit )) + v3_add( hit.pos, min_height, player.camera_pos ); + +#if 0 + if( world.water.enabled ) + { + player.camera_pos[1] = + vg_maxf( world.water.height + 2.0f, player.camera_pos[1] ); + } +#endif + + player.angles[0] = atan2f( delta[0], -delta[2] ); + player.angles[1] = -asinf( delta[1] ); +} + +VG_STATIC void player_animate_camera_thirdperson(void) +{ + static v3f lerp_cam = { 0.0f, 0.0f, 0.0f }; + v3f target; + + v3_muladds( player.phys.rb.co, player.phys.rb.up, 1.2f, target ); + + player_animate_follow_cam( target, 1.5f, 20.0f ); +} + VG_STATIC void player_animate_camera(void) { struct player_phys *phys = &player.phys;