diff options
author | Stijn Buys <ingar@osirion.org> | 2008-07-14 22:42:10 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2008-07-14 22:42:10 +0000 |
commit | d10188594d789796fbc9f5c147aa999a2dc58725 (patch) | |
tree | 0ad90f7d2a303bdb8a3517a89bc8f3c195653cc6 /src | |
parent | c297e7f00dc8dae522afe816365a282fae40d254 (diff) |
fix camera position in track mode, fix z-buffer issues, added draw_location
Diffstat (limited to 'src')
-rw-r--r-- | src/client/view.cc | 16 | ||||
-rw-r--r-- | src/render/camera.cc | 4 | ||||
-rw-r--r-- | src/render/draw.cc | 18 |
3 files changed, 22 insertions, 16 deletions
diff --git a/src/client/view.cc b/src/client/view.cc index c74c83e..fa96096 100644 --- a/src/client/view.cc +++ b/src/client/view.cc @@ -31,9 +31,11 @@ namespace client core::Cvar *draw_ui = 0; core::Cvar *draw_stats = 0; -core::Cvar *cl_crosshaircolor = 0; +core::Cvar *draw_location = 0; core::Cvar *draw_radar = 0; +core::Cvar *cl_crosshaircolor = 0; + namespace view { @@ -44,6 +46,9 @@ void init() draw_stats = core::Cvar::get("draw_stats", "0", core::Cvar::Archive); draw_stats->set_info("[bool] draw network and render statistics"); + draw_location = core::Cvar::get("draw_location", "0", core::Cvar::Archive); + draw_location->set_info("[bool] draw world location"); + draw_ui = core::Cvar::get("draw_ui", "1", core::Cvar::Archive); draw_ui->set_info("[bool] draw the user interface"); @@ -178,6 +183,15 @@ void draw_status() << std::setprecision(2) << core::localcontrol()->speed(); Text::draw(4, video::height - Text::fontheight() -4, status); + + if (draw_location->value()) { + std::stringstream location; + location << "^Nloc ^B" << std::fixed << std::setprecision(2) << std::setfill(' ') << + std::setw(7) << core::localcontrol()->location().x << " " << + std::setw(7) << core::localcontrol()->location().y << " " << + std::setw(7) << core::localcontrol()->location().z; + Text::draw(4, video::height - Text::fontheight()*2 -4, location); + } } } diff --git a/src/render/camera.cc b/src/render/camera.cc index a55038d..287e4ad 100644 --- a/src/render/camera.cc +++ b/src/render/camera.cc @@ -265,8 +265,8 @@ void Camera::draw(float seconds) } if (core::localcontrol()->model()) { - camera_target -= (core::localcontrol()->model()->maxbbox().x + 0.1f) * camera_axis.forward(); - camera_target += (core::localcontrol()->model()->maxbbox().z + 0.1f ) * camera_axis.up(); + camera_target -= (core::localcontrol()->model()->maxbbox().x + core::localcontrol()->model()->radius() + 0.1f) * 0.5f * camera_axis.forward(); + camera_target += (core::localcontrol()->model()->maxbbox().z + core::localcontrol()->model()->radius() + 0.1f) * 0.5f * camera_axis.up(); } } else if (mode() == Free) { diff --git a/src/render/draw.cc b/src/render/draw.cc index d1b06ea..c650169 100644 --- a/src/render/draw.cc +++ b/src/render/draw.cc @@ -716,14 +716,14 @@ void draw_pass_sky() if (!(r_sky && r_sky->value())) return; - size_t flare_texture = Textures::load("textures/env/sky"); - Textures::bind(flare_texture); + size_t sky_texture = Textures::load("textures/env/sky"); + Textures::bind(sky_texture); gl::enable(GL_TEXTURE_2D); gl::push(); gl::translate(Camera::eye()); - draw_sphere_inside(math::Color(), 16000); + draw_sphere_inside(math::Color(), 8192); gl::pop(); gl::disable(GL_TEXTURE_2D); @@ -784,7 +784,7 @@ void draw(float seconds) gl::matrixmode(GL_PROJECTION); gl::loadidentity(); gl::frustum(-frustum_size*Camera::aspect(), frustum_size*Camera::aspect(), - -frustum_size, frustum_size, frustum_front, 16384.0f); + -frustum_size, frustum_size, frustum_front, 8192.0f); gl::matrixmode(GL_MODELVIEW); gl::loadidentity(); @@ -826,16 +826,8 @@ void draw(float seconds) draw_pass_default(); // draw entities without model - gl::disable(GL_RESCALE_NORMAL); - - // adjust the projection matrix for local world view - gl::matrixmode(GL_PROJECTION); - gl::loadidentity(); - gl::frustum(-frustum_size*Camera::aspect(), frustum_size*Camera::aspect(), - -frustum_size, frustum_size, frustum_front, 1024.0f); - gl::matrixmode(GL_MODELVIEW); - glEnableClientState(GL_COLOR_ARRAY); + gl::disable(GL_RESCALE_NORMAL); draw_pass_model_vertex(); // draw entities with model |