},
"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":
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
#
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" )
audio_play_oneshot( &audio_rewind[4], 1.0f );
audio_unlock();
- if( v < 0.0f )
+ if( v > 0.0f )
{
game_menu.selected_map --;
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;
/*
* -----------------------------------------------------------------------------
.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,
player_animate();
if( !freecam )
- player_animate_camera();
+ {
+ if( cl_thirdperson )
+ player_animate_camera_thirdperson();
+ else
+ player_animate_camera();
+ }
}
if( freecam )
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;