diff options
| author | Magnus Auvinen <magnus.auvinen@gmail.com> | 2008-03-29 11:44:03 +0000 |
|---|---|---|
| committer | Magnus Auvinen <magnus.auvinen@gmail.com> | 2008-03-29 11:44:03 +0000 |
| commit | 7a3874745ca370a799d95b5f86e85fcc8eadefbb (patch) | |
| tree | 16f1e28f2f499279496866a63cabf88e2f2ad6c4 /src/engine | |
| parent | 171d6b1c206c0488b59d157bc266319bf4ab482b (diff) | |
| download | zcatch-7a3874745ca370a799d95b5f86e85fcc8eadefbb.tar.gz zcatch-7a3874745ca370a799d95b5f86e85fcc8eadefbb.zip | |
fixed loads of graphical optimizations
Diffstat (limited to 'src/engine')
| -rw-r--r-- | src/engine/client/ec_client.c | 4 | ||||
| -rw-r--r-- | src/engine/client/ec_gfx.c | 50 | ||||
| -rw-r--r-- | src/engine/e_config_variables.h | 1 | ||||
| -rw-r--r-- | src/engine/e_engine.c | 9 | ||||
| -rw-r--r-- | src/engine/e_if_gfx.h | 17 | ||||
| -rw-r--r-- | src/engine/e_system.c | 6 | ||||
| -rw-r--r-- | src/engine/server/es_register.c | 2 |
7 files changed, 67 insertions, 22 deletions
diff --git a/src/engine/client/ec_client.c b/src/engine/client/ec_client.c index a8da7457..72b5536f 100644 --- a/src/engine/client/ec_client.c +++ b/src/engine/client/ec_client.c @@ -585,7 +585,9 @@ const char *client_error_string() static void client_render() { - gfx_clear(0.0f,0.0f,0.0f); + if(config.gfx_clear) + gfx_clear(1,1,0); + modc_render(); client_debug_render(); } diff --git a/src/engine/client/ec_gfx.c b/src/engine/client/ec_gfx.c index 53fe1790..3efcdac7 100644 --- a/src/engine/client/ec_gfx.c +++ b/src/engine/client/ec_gfx.c @@ -88,7 +88,7 @@ static void flush() if(num_vertices == 0) return; - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glVertexPointer(3, GL_FLOAT, @@ -216,11 +216,14 @@ int gfx_init() glDisable(GL_DEPTH_TEST); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); -/* glAlphaFunc(GL_GREATER, 0); - glEnable(GL_ALPHA_TEST);*/ - - + + glAlphaFunc(GL_GREATER, 0); + glEnable(GL_ALPHA_TEST); + glDepthMask(0); + gfx_mask_op(MASK_NONE, 0); + /*glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);*/ + /* Set all z to -5.0f */ for (i = 0; i < vertex_buffer_size; i++) @@ -342,13 +345,21 @@ int gfx_unload_texture(int index) return 0; } +void gfx_blend_none() +{ + glDisable(GL_BLEND); +} + + void gfx_blend_normal() { + glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); } void gfx_blend_additive() { + glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE); } @@ -636,24 +647,27 @@ void gfx_swap() { static PERFORMACE_INFO pscope = {"glfwSwapBuffers", 0}; perf_start(&pscope); - glFinish(); glfwSwapBuffers(); perf_end(); } - - { - static PERFORMACE_INFO pscope = {"glFlush", 0}; - perf_start(&pscope); - glFlush(); - perf_end(); - } + /* + if(inp_key_pressed('P')) { - static PERFORMACE_INFO pscope = {"glFinish", 0}; - perf_start(&pscope); - glFinish(); - perf_end(); - } + { + static PERFORMACE_INFO pscope = {"glFlush", 0}; + perf_start(&pscope); + glFlush(); + perf_end(); + } + + { + static PERFORMACE_INFO pscope = {"glFinish", 0}; + perf_start(&pscope); + glFinish(); + perf_end(); + } + }*/ { static PERFORMACE_INFO pscope = {"glfwPollEvents", 0}; diff --git a/src/engine/e_config_variables.h b/src/engine/e_config_variables.h index 773093dc..5e355492 100644 --- a/src/engine/e_config_variables.h +++ b/src/engine/e_config_variables.h @@ -34,6 +34,7 @@ MACRO_CONFIG_INT(gfx_screen_width, 800, 0, 0) MACRO_CONFIG_INT(gfx_screen_height, 600, 0, 0) MACRO_CONFIG_INT(gfx_fullscreen, 1, 0, 1) MACRO_CONFIG_INT(gfx_color_depth, 24, 16, 24) +MACRO_CONFIG_INT(gfx_clear, 0, 0, 1) MACRO_CONFIG_INT(gfx_vsync, 1, 0, 1) MACRO_CONFIG_INT(gfx_display_all_modes, 0, 0, 1) MACRO_CONFIG_INT(gfx_texture_compression, 0, 0, 1) diff --git a/src/engine/e_engine.c b/src/engine/e_engine.c index a9e0e86e..d356fd4b 100644 --- a/src/engine/e_engine.c +++ b/src/engine/e_engine.c @@ -300,7 +300,9 @@ void mastersrv_update() { /* we got a result from the lookup ready */ if(master_servers[i].lookup.result == 0) + { master_servers[i].addr = master_servers[i].lookup.addr; + } master_servers[i].lookup.state = STATE_PROCESSED; } @@ -311,6 +313,13 @@ void mastersrv_update() if(!needs_update) { + /* make sure to destroy the threads */ + for(i = 0; i < NUM_LOOKUP_THREADS; i++) + { + thread_destroy(master_servers[i].lookup.thread); + master_servers[i].lookup.thread = 0; + } + dbg_msg("engine/mastersrv", "saving addresses"); mastersrv_save(); } diff --git a/src/engine/e_if_gfx.h b/src/engine/e_if_gfx.h index 265d41d3..525633b4 100644 --- a/src/engine/e_if_gfx.h +++ b/src/engine/e_if_gfx.h @@ -455,7 +455,7 @@ void gfx_mapscreen(float tl_x, float tl_y, float br_x, float br_y); This is equal to glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA). See Also: - <gfx_blend_additive> + <gfx_blend_additive,gfx_blend_none> */ void gfx_blend_normal(); @@ -468,11 +468,24 @@ void gfx_blend_normal(); This is equal to glBlendFunc(GL_SRC_ALPHA, GL_ONE). See Also: - <gfx_blend_normal> + <gfx_blend_normal,gfx_blend_none> */ void gfx_blend_additive(); /* + Function: gfx_blend_none + Disables blending + + Remarks: + This must be used before calling <gfx_quads_begin>. + + See Also: + <gfx_blend_normal,gfx_blend_additive> +*/ +void gfx_blend_none(); + + +/* Function: gfx_setcolorvertex Sets the color of a vertex. diff --git a/src/engine/e_system.c b/src/engine/e_system.c index ef1ddda2..5075c062 100644 --- a/src/engine/e_system.c +++ b/src/engine/e_system.c @@ -330,6 +330,12 @@ void thread_wait(void *thread) void thread_destroy(void *thread) { +#if defined(CONF_FAMILY_UNIX) + void *r = 0; + pthread_join((pthread_t)thread, &r); +#else + /*#error not implemented*/ +#endif } void thread_yield() diff --git a/src/engine/server/es_register.c b/src/engine/server/es_register.c index 2d482359..fe8cd959 100644 --- a/src/engine/server/es_register.c +++ b/src/engine/server/es_register.c @@ -202,7 +202,7 @@ void register_update() register_first = 0; /* check if we should send new heartbeat again */ - if(now > register_state_start+freq*30) + if(now > register_state_start+freq) { if(register_count == 120) /* redo the whole process after 60 minutes to balance out the master servers */ register_new_state(REGISTERSTATE_START); |