VG_STATIC void audio_ambient_sprites_update( world_instance *world, v3f co )
{
static float accum = 0.0f;
- accum += vg.frame_delta;
+ accum += vg.time_delta;
if( accum > 0.1f )
accum -= 0.1f;
if( set_value ){
float h = input_menu_h.axis.value;
if( fabsf(h) > 0.04f )
- *value += h * vg.frame_delta;
+ *value += h * vg.time_frame_delta;
*value = vg_clampf( *value, 0.0f, 1.0f );
}
m3x3_mul( player->basis, menu_mdl_mtx, menu_mdl_mtx );
menu_smooth_fov = vg_lerpf( menu_smooth_fov, menu_fov_target,
- vg.frame_delta * 8.2f );
+ vg.time_frame_delta * 8.2f );
}
/* Extra */
float y = atan2f( delta[0], delta[2] ),
p = -sinf(delta[1]),
- dt = vg.frame_delta;
+ dt = vg.time_frame_delta;
menu_extra_angles[0] = vg_lerpf( menu_extra_angles[0], y, dt );
menu_extra_angles[1] = vg_lerpf( menu_extra_angles[1], p, dt );
menu_camera_angles[0] = fmodf( menu_camera_angles[0], VG_TAUf );
}
- float dt = vg.frame_delta * 6.0f;
+ float dt = vg.time_frame_delta * 6.0f;
menu_opacity = vg_lerpf( menu_opacity, cl_menu&&!cl_menu_go_away, dt );
if( menu_opacity <= 0.01f ){
vg.time_rate = 1.0-(double)menu_opacity;
if( cl_menu ){
- menu_input_cooldown -= vg.frame_delta;
+ menu_input_cooldown -= vg.time_frame_delta;
}
}
tsize1 = i==game_menu.loc? 0.07f: 0.0f,
tsize = tsize0+tsize1;
- btn->falpha = vg_lerpf( btn->falpha, talpha, vg.frame_delta * 14.0f );
- btn->fsize = vg_lerpf( btn->fsize, tsize, vg.frame_delta * 7.0f );
+ btn->falpha = vg_lerpf( btn->falpha, talpha, vg.time_frame_delta * 14.0f);
+ btn->fsize = vg_lerpf( btn->fsize, tsize, vg.time_frame_delta * 7.0f );
/* Colour */
v4f vselected = {0.95f*1.3f,0.45f*1.3f,0.095f*1.3f, 1.0f},
_player_post_update[ player->subsystem ]( player );
if((player->subsystem != k_player_subsystem_dead) && !player->gate_waiting){
- player->rewind_accum += vg.frame_delta;
+ player->rewind_accum += vg.time_frame_delta;
if( player->rewind_accum > 0.25f ){
player->rewind_accum -= 0.25f;
if( player->holdout_time > 0.0f ){
skeleton_lerp_pose( sk, res.pose, player->holdout_pose,
player->holdout_time, res.pose );
- player->holdout_time -= vg.frame_delta * 2.0f;
+ player->holdout_time -= vg.time_frame_delta * 2.0f;
}
skeleton_apply_pose( sk, res.pose, k_anim_apply_defer_ik );
player->cam_velocity_influence_smooth = vg_lerpf(
player->cam_velocity_influence_smooth,
player->cam_velocity_influence,
- vg.frame_delta * 8.0f );
+ vg.time_frame_delta * 8.0f );
player->cam_velocity_coefficient_smooth = vg_lerpf(
player->cam_velocity_coefficient_smooth,
player->cam_velocity_coefficient,
- vg.frame_delta * 8.0f );
+ vg.time_frame_delta * 8.0f );
player->cam_velocity_constant_smooth = vg_lerpf(
player->cam_velocity_constant_smooth,
player->cam_velocity_constant,
- vg.frame_delta * 8.0f );
+ vg.time_frame_delta * 8.0f );
enum camera_mode target_mode = player->camera_mode;
player->camera_type_blend =
vg_lerpf( player->camera_type_blend,
(target_mode == k_cam_firstperson)? 1.0f: 0.0f,
- 5.0f * vg.frame_delta );
+ 5.0f * vg.time_frame_delta );
v3_lerp( player->fpv_viewpoint_smooth, player->fpv_viewpoint,
- vg.frame_delta * 8.0f, player->fpv_viewpoint_smooth );
+ vg.time_frame_delta * 8.0f, player->fpv_viewpoint_smooth );
v3_lerp( player->fpv_offset_smooth, player->fpv_offset,
- vg.frame_delta * 8.0f, player->fpv_offset_smooth );
+ vg.time_frame_delta * 8.0f, player->fpv_offset_smooth );
v3_lerp( player->tpv_offset_smooth, player->tpv_offset,
- vg.frame_delta * 8.0f, player->tpv_offset_smooth );
+ vg.time_frame_delta * 8.0f, player->tpv_offset_smooth );
/* fov -- simple blend */
float fov_skate = vg_lerpf( 97.0f, 135.0f, cl_fov ),
/* angles */
v3f velocity_angles;
- v3_lerp( player->cam_velocity_smooth, player->rb.v, 4.0f*vg.frame_delta,
+ v3_lerp( player->cam_velocity_smooth, player->rb.v, 4.0f*vg.time_frame_delta,
player->cam_velocity_smooth );
v3f velocity_local;
* it is done in the local basis then transformed back */
v3f future;
- v3_muls( player->rb.v, 0.4f*vg.frame_delta, future );
+ v3_muls( player->rb.v, 0.4f*vg.time_frame_delta, future );
m3x3_mulv( player->invbasis, future, future );
v3f camera_follow_dir =
v3f pco;
v4f pq;
rb_extrapolate( &player->rb, pco, pq );
- v3_lerp( player->tpv_lpf, pco, 20.0f*vg.frame_delta, player->tpv_lpf );
+ v3_lerp( player->tpv_lpf, pco, 20.0f*vg.time_frame_delta, player->tpv_lpf );
/* now move into world */
float Fd = -player->cam_land_punch_v * k_cam_damp,
Fs = -player->cam_land_punch * k_cam_spring;
- player->cam_land_punch += player->cam_land_punch_v * vg.frame_delta;
- player->cam_land_punch_v += ( Fd + Fs ) * vg.frame_delta;
+ player->cam_land_punch += player->cam_land_punch_v * vg.time_frame_delta;
+ player->cam_land_punch_v += ( Fd + Fs ) * vg.time_frame_delta;
player->cam.angles[1] += player->cam_land_punch;
/* override camera */
struct ragdoll_part *part = &player->ragdoll.parts[ av->id_hip-1 ];
- v3_lerp( d->co_lpf, part->obj.rb.co, vg.frame_delta*4.0f, d->co_lpf );
- v3_lerp( d->v_lpf, part->obj.rb.v, vg.frame_delta*4.0f, d->v_lpf );
- v3_lerp( d->w_lpf, part->obj.rb.w, vg.frame_delta*4.0f, d->w_lpf );
+ v3_lerp( d->co_lpf, part->obj.rb.co, vg.time_frame_delta*4.0f, d->co_lpf );
+ v3_lerp( d->v_lpf, part->obj.rb.v, vg.time_frame_delta*4.0f, d->v_lpf );
+ v3_lerp( d->w_lpf, part->obj.rb.w, vg.time_frame_delta*4.0f, d->w_lpf );
v3_copy( d->co_lpf, player->rb.co );
v3_copy( d->v_lpf, player->rb.v );
}
static float menu_gate = 1.0f;
- menu_gate = vg_lerpf( menu_gate, 1-cl_menu, vg.frame_delta*4.0f );
+ menu_gate = vg_lerpf( menu_gate, 1-cl_menu, vg.time_frame_delta*4.0f );
float
vol_main = sqrtf( (1.0f-air)*attn*(1.0f-slide) * 0.4f ) * menu_gate,
vg_lerpf( 250.0f, 80.0f, attn ) );
if( s->sample_change_cooldown > 0.0f ){
- s->sample_change_cooldown -= vg.frame_delta;
+ s->sample_change_cooldown -= vg.time_frame_delta;
}
else{
int sample_type = k_skate_sample_concrete;
(vg.time - s->state.cur_push) < 0.125,
6.0f*vg.time_delta );
- float pt = push_time + vg.accumulator;
if( s->state.reverse > 0.0f )
- skeleton_sample_anim( sk, s->anim_push, pt, bpose );
+ skeleton_sample_anim( sk, s->anim_push, push_time, bpose );
else
- skeleton_sample_anim( sk, s->anim_push_reverse, pt, bpose );
+ skeleton_sample_anim( sk, s->anim_push_reverse, push_time, bpose );
skeleton_lerp_pose( sk, apose, bpose, s->blend_push, apose );
vg_warn( "FIX THIS! CARROT\n" );
v4_copy( player->rb.q, s->state.smoothed_rotation );
}
- v4_lerp( s->state.smoothed_rotation, player->rb.q, 2.0f*vg.frame_delta,
+ v4_lerp( s->state.smoothed_rotation, player->rb.q,
+ 2.0f*vg.time_frame_delta,
s->state.smoothed_rotation );
q_normalize( s->state.smoothed_rotation );
rb_extrapolate( &player->rb, dest->root_co, dest->root_q );
v3_muladds( dest->root_co, player->rb.to_world[1], -0.1f, dest->root_co );
- float substep = vg_clampf( vg.accumulator / VG_TIMESTEP_FIXED, 0.0f, 1.0f );
+ float substep = vg.time_fixed_extrapolate;
v4f qflip;
if( (s->state.activity <= k_skate_activity_air_to_grind) &&
m3x3_copy( player->rb.to_world, mtx );
v3_add( player->rb.co, player->basis[1], mtx[3] );
- float substep = vg_clampf( vg.accumulator / k_rb_delta, 0.0f, 1.0f );
+ float substep = vg.time_fixed_extrapolate;
v3_muladds( mtx[3], player->rb.v, k_rb_delta*substep, mtx[3] );
debug_capsule( mtx, w->collider.radius, w->collider.height, VG__YELOW );
enum framebuffer_attachment_type{
k_framebuffer_attachment_type_none,
- k_framebuffer_attachment_type_colour,
- k_framebuffer_attachment_type_renderbuffer
+ k_framebuffer_attachment_type_texture,
+ k_framebuffer_attachment_type_renderbuffer,
+ k_framebuffer_attachment_type_texture_depth
}
purpose;
.attachments =
{
{
- "colour", k_framebuffer_attachment_type_colour,
+ "colour", k_framebuffer_attachment_type_texture,
.internalformat = GL_RGB,
.format = GL_RGB,
.attachment = GL_COLOR_ATTACHMENT0
},
{
- "motion", k_framebuffer_attachment_type_colour,
+ "motion", k_framebuffer_attachment_type_texture,
.quality = k_framebuffer_quality_high_only,
.internalformat = GL_RG16F,
.internalformat = GL_DEPTH24_STENCIL8,
#else
- "depth_stencil", k_framebuffer_attachment_type_colour,
+ "depth_stencil", k_framebuffer_attachment_type_texture_depth,
.internalformat = GL_DEPTH24_STENCIL8,
.format = GL_DEPTH_STENCIL,
.type = GL_UNSIGNED_INT_24_8,
.attachments =
{
{
- "colour", k_framebuffer_attachment_type_colour,
+ "colour", k_framebuffer_attachment_type_texture,
.internalformat = GL_RGB,
.format = GL_RGB,
.type = GL_UNSIGNED_BYTE,
.attachments =
{
{
- "colour", k_framebuffer_attachment_type_colour,
+ "colour", k_framebuffer_attachment_type_texture,
.internalformat = GL_RED,
.format = GL_RED,
.type = GL_UNSIGNED_BYTE,
{
struct framebuffer_attachment *at = &fb->attachments[attachment];
- if( at->purpose != k_framebuffer_attachment_type_colour ){
- vg_fatal_exit_loop( "illegal operation: bind non-colour framebuffer"
+ if( (at->purpose != k_framebuffer_attachment_type_texture) &&
+ (at->purpose != k_framebuffer_attachment_type_texture_depth) )
+ {
+ vg_fatal_exit_loop( "illegal operation: bind non-texture framebuffer"
" attachment to texture slot" );
}
glBindRenderbuffer( GL_RENDERBUFFER, a->id );
glRenderbufferStorage( GL_RENDERBUFFER, a->internalformat, rx, ry );
}
- else if( a->purpose == k_framebuffer_attachment_type_colour ){
+ else if( a->purpose == k_framebuffer_attachment_type_texture ||
+ a->purpose == k_framebuffer_attachment_type_texture_depth )
+ {
glBindTexture( GL_TEXTURE_2D, a->id );
glTexImage2D( GL_TEXTURE_2D, 0, a->internalformat, rx, ry,
0, a->format, a->type, NULL );
GL_DEPTH_STENCIL_ATTACHMENT,
GL_RENDERBUFFER, attachment->id );
}
- else if( attachment->purpose == k_framebuffer_attachment_type_colour ){
+ else if( attachment->purpose == k_framebuffer_attachment_type_texture ||
+ attachment->purpose == k_framebuffer_attachment_type_texture_depth )
+ {
glGenTextures( 1, &attachment->id );
render_fb_allocate_texture( fb, attachment );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
glFramebufferTexture2D( GL_FRAMEBUFFER, attachment->attachment,
GL_TEXTURE_2D, attachment->id, 0 );
- colour_attachments[ colour_count ++ ] = attachment->attachment;
+ if( attachment->purpose == k_framebuffer_attachment_type_texture )
+ colour_attachments[ colour_count ++ ] = attachment->attachment;
}
}
*/
VG_STATIC void rb_extrapolate( rigidbody *rb, v3f co, v4f q )
{
- float substep = vg_clampf( vg.accumulator / k_rb_delta, 0.0f, 1.0f );
-
+ float substep = vg.time_fixed_extrapolate;
v3_muladds( rb->co, rb->v, k_rb_delta*substep, co );
if( v3_length2( rb->w ) > 0.0f ){
*/
#define SR_NETWORKED
-#define VG_DEVWINDOW
+//#define VG_DEVWINDOW
#include "common.h"
#include "conf.h"
#include "steam.h"
/* 'systems' are completely loaded now */
/* load home world */
+#if 0
world_load( 0, "maps/mp_spawn.mdl" );
- world_load( 1, "maps/mp_mtzero.mdl" );
+#endif
+
+ world_load( 0, "maps/mp_mtzero.mdl" );
#if 0
world_load( &world_global.worlds[1], "maps/mp_gridmap.mdl" );
shader_blitblur_use();
shader_blitblur_uTexMain( 0 );
shader_blitblur_uTexMotion( 1 );
- shader_blitblur_uBlurStrength(cl_blur_strength / (vg.frame_delta*60.0f));
+ shader_blitblur_uBlurStrength( cl_blur_strength /
+ (vg.time_frame_delta*60.0) );
shader_blitblur_uInverseRatio( inverse );
v2f menu_blurring;
fb->resolution_div = 0;
fb->attachments[0].display_name = NULL;
- fb->attachments[0].purpose = k_framebuffer_attachment_type_colour;
+ fb->attachments[0].purpose = k_framebuffer_attachment_type_texture;
fb->attachments[0].internalformat = GL_RG16F;
fb->attachments[0].format = GL_RG;
fb->attachments[0].type = GL_FLOAT;
}
last_version = rg->timing_version;
- vg_info( "%u %f\n", rg, rg->timing_version, rg->timing_time );
+ vg_info( "%u %f\n", rg->timing_version, rg->timing_time );
}
if( world_global.current_run_version == last_version+1 ){