helpers[4];
u32 helper_count;
+ char location[64];
+ f64 location_time;
+
f32 factive;
font3d font;
}
render_fsquad1();
}
+ f64 loc_t = (vg.time - gui.location_time) / 5.0;
+ if( (loc_t < 1.0) && (gui.location_time != 0.0) ){
+ /* yep this code is a mess, i dont care anymore */
+ glEnable(GL_BLEND);
+ glDisable(GL_DEPTH_TEST);
+ glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
+ glBlendEquation(GL_FUNC_ADD);
+
+ f32 t = 1.0f-vg_minf(1.0f,vg_minf(loc_t*20.0f,2.0f-loc_t*2.0f)),
+ o = 1.0f-t*t*(2.0f-t);
+
+ shader_blitcolour_use();
+ shader_blitcolour_uColour( (v4f){ 0.0f, 0.0f, 0.0f, o*0.5f } );
+ render_fsquad2();
+
+ f32 dy = ft/0.79f,
+ scale = dy*0x1p-4f*0.5f;
+
+ m4x3f mmdl;
+ m3x3_identity( mmdl );
+ m3x3_scale( mmdl, (v3f){scale,scale,scale} );
+ v3_zero( mmdl[3] );
+
+ f32 pad = dy*0x1p-4f*0.125f;
+ f32 w = font3d_string_width( &gui.font,2,gui.location );
+
+ mmdl[3][0] = fr*0.5f - w*scale*0.5f;
+ mmdl[3][1] = 0.3f*ft+pad*2.0f;
+
+ font3d_bind( &gui.font, &ortho );
+ shader_model_font_uColour( (v4f){1.2f,1.2f,1.2f,o} );
+ font3d_simple_draw( &gui.font, 2, gui.location, &ortho, mmdl );
+ }
+
font3d_bind( &gui.font, &ortho );
float dy = ft/0.79f,
scale = dy*0x1p-4f*0.75f;
m4x3f mmdl;
- v4f q;
m3x3_identity( mmdl );
m3x3_scale( mmdl, (v3f){scale,scale,scale} );
v3_zero( mmdl[3] );
helper->text = text;
}
+VG_STATIC
+int gui_location_print_ccmd( int argc, const char *argv[] ){
+ if( argc > 0 ){
+ char new_loc[64];
+ vg_str str;
+ vg_strnull( &str, new_loc, 64 );
+ for( int i=0; i<argc; i++ ){
+ vg_strcat( &str, argv[i] );
+ vg_strcat( &str, " " );
+ }
+ if( !strcmp(gui.location,new_loc) ) return 0;
+ vg_strncpy( new_loc, gui.location, 64, k_strncpy_always_add_null );
+ gui.location_time = vg.time;
+ }
+ return 0;
+}
+
VG_STATIC void gui_init(void)
{
font3d_load( &gui.font, "models/rs_font.mdl", vg_mem.rtmemory );
+ vg_console_reg_cmd( "gui_location", gui_location_print_ccmd, NULL );
}
#endif /* GUI_H */
k_cam_spring = 20.0f,
k_cam_damp = 6.7f,
k_cam_punch = -1.0f,
- k_cam_shake_strength = 1.0f,
- k_cam_shake_trackspeed = 1.0f;
+ k_cam_shake_strength = 0.0001f,
+ k_cam_shake_trackspeed = 0.2f;
VG_STATIC void player_look( player_instance *player, v3f angles );
VG_STATIC void player__cam_iterate( player_instance *player );
render_fb_allocate( fb );
}
+ f32 rh = 0x1p-4f, ih = 0.3f;
+
float quad[] = {
0.00f,0.00f, 1.00f,1.00f, 0.00f,1.00f, /* fsquad */
0.00f,0.00f, 1.00f,0.00f, 1.00f,1.00f,
- 0.00f,0.00f, 1.00f,0x1p-4f,0.00f,0x1p-4f, /* fsquad1 */
- 0.00f,0.00f, 1.00f,0.00f, 1.00f,0x1p-4f,
+ 0.00f,0.00f, 1.00f,rh, 0.00f,rh, /* fsquad1 */
+ 0.00f,0.00f, 1.00f,0.00f, 1.00f,rh,
/* 9x9 debug grid */
/* row0 */
0.30f,0.60f, 0.60f,0.60f, 0.60f,0.90f,
0.60f,0.60f, 0.90f,0.90f, 0.60f,0.90f,
0.60f,0.60f, 0.90f,0.60f, 0.90f,0.90f,
+
+ 0.00f,ih, 1.00f,ih+rh, 0.00f,ih+rh, /* fsquad2 */
+ 0.00f,ih, 1.00f,ih, 1.00f,ih+rh,
};
vg_console_reg_cmd( "fb", render_framebuffer_control,
glDrawArrays( GL_TRIANGLES, 6, 6 );
}
+VG_STATIC void render_fsquad2(void)
+{
+ glBindVertexArray( gpipeline.fsquad.vao );
+ glDrawArrays( GL_TRIANGLES, 66,6 );
+}
+
/*
* Call this inside the UI function
*/
}
sfd_update();
+ /* volumes
+ * -------------------------------------------------------------------------
+ */
+
+ /* filter and check the existing ones
+ * TODO: on change world, clear volumes list */
+ u32 j=0;
+ for( u32 i=0; i<world_static.active_trigger_volume_count; i++ ){
+ i32 idx = world_static.active_trigger_volumes[i];
+ ent_volume *volume = mdl_arritm( &world->ent_volume, idx );
+
+ v3f local;
+ m4x3_mulv( volume->to_local, pos, local );
+ if( (fabsf(local[0]) <= 1.0f) &&
+ (fabsf(local[1]) <= 1.0f) &&
+ (fabsf(local[2]) <= 1.0f) )
+ {
+ world_static.active_trigger_volumes[ j ++ ] = idx;
+ boxf cube = {{-1.0f,-1.0f,-1.0f},{1.0f,1.0f,1.0f}};
+ vg_line_boxf_transformed( volume->to_world, cube, 0xff00ccff );
+ /* triggr on stay ..... */
+ }
+ else{
+ /* trigger on exit...... */
+ }
+ }
+ world_static.active_trigger_volume_count = j;
+
static float random_accum = 0.0f;
random_accum += vg.time_delta;
bh_iter_init_box( 0, &it, volume_proximity );
i32 idx;
- int in_volume = 0;
-
while( bh_next( world->volume_bh, &it, &idx ) ){
ent_volume *volume = mdl_arritm( &world->ent_volume, idx );
boxf cube = {{-1.0f,-1.0f,-1.0f},{1.0f,1.0f,1.0f}};
if( volume->type == k_volume_subtype_trigger ){
+ for( u32 i=0; i<world_static.active_trigger_volume_count; i++ )
+ if( world_static.active_trigger_volumes[i] == idx )
+ goto next_volume;
+
+ if( world_static.active_trigger_volume_count >
+ vg_list_size(world_static.active_trigger_volumes) ) continue;
+
v3f local;
m4x3_mulv( volume->to_local, pos, local );
(fabsf(local[1]) <= 1.0f) &&
(fabsf(local[2]) <= 1.0f) )
{
- in_volume = 1;
- vg_line_boxf_transformed( volume->to_world, cube, 0xff00ff00 );
-
- if( !world_static.in_volume ){
- ent_call basecall;
- basecall.function = k_ent_function_trigger;
- basecall.id = mdl_entity_id( k_ent_volume, idx );
- basecall.data = NULL;
+ ent_call basecall;
+ basecall.function = k_ent_function_trigger;
+ basecall.id = mdl_entity_id( k_ent_volume, idx );
+ basecall.data = NULL;
- entity_call( world, &basecall );
- }
+ entity_call( world, &basecall );
+ world_static.active_trigger_volumes[
+ world_static.active_trigger_volume_count ++ ] = idx;
}
else
- vg_line_boxf_transformed( volume->to_world, cube, 0xff0000ff );
+ vg_line_boxf_transformed( volume->to_world, cube, 0xffcccccc );
}
else if( volume->type == k_volume_subtype_particle ){
vg_line_boxf_transformed( volume->to_world, cube, 0xff00c0ff );
entity_call( world, &basecall );
}
}
+next_volume:;
}
- world_static.in_volume = in_volume;
#if 0
if( k_debug_light_indices )
vg_line_pt3( light->node->co, 0.25f, colour );
}
}
-
#endif
}
u32 current_run_version;
double time, rewind_from, rewind_to, last_use;
- int in_volume;
+ u32 active_trigger_volumes[8];
+ u32 active_trigger_volume_count;
world_instance worlds[4];
- u32 active_world;
+ i32 active_world;
}
static world_static;
distances[si] = dist;
- if( vg_lines.draw ){
+ if( vg_audio.debug_ui && vg_lines.draw ){
for( int i=0; i<14; i++ ){
if( distances[i] != 200.0f ){
u32 colours[] = { VG__RED, VG__BLUE, VG__GREEN,