diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/client/input.cc | 8 | ||||
-rw-r--r-- | src/client/targets.cc | 2 | ||||
-rw-r--r-- | src/model/map.cc | 7 | ||||
-rw-r--r-- | src/render/camera.cc | 15 | ||||
-rw-r--r-- | src/render/draw.cc | 33 | ||||
-rw-r--r-- | src/render/dust.cc | 9 | ||||
-rw-r--r-- | src/render/render.cc | 7 |
7 files changed, 37 insertions, 44 deletions
diff --git a/src/client/input.cc b/src/client/input.cc index f1d9464..b281b8e 100644 --- a/src/client/input.cc +++ b/src/client/input.cc @@ -234,10 +234,10 @@ void init() input_mousecontrol = core::Cvar::get("input_mousecontrol", 1.0f, core::Cvar::Archive); input_mousecontrol->set_info("[bool] enable or disable mouse control"); - input_keydelay = core::Cvar::get("input_keydelay", 150.0f, core::Cvar::Archive); + input_keydelay = core::Cvar::get("input_keydelay", 200.0f, core::Cvar::Archive); input_keydelay->set_info("[int] keyboard delay time-out in milliseconds"); - input_keyrepeat = core::Cvar::get("input_keyrepeat", 15.0f, core::Cvar::Archive); + input_keyrepeat = core::Cvar::get("input_keyrepeat", 30.0f, core::Cvar::Archive); input_keyrepeat->set_info("[int] keyboard repeat time-out in milliseconds"); core::Func *func = 0; @@ -628,13 +628,13 @@ void frame(float seconds) } /* -- handle key repeat --------------------------- */ - float delay = 150.0f; // key delay time-out in milliseconds + float delay = 200.0f; // key delay time-out in milliseconds if (input_keydelay) { delay = input_keydelay->value(); math::clamp(delay, 50.0f, 500.0f); } - float repeat = 10.0f; // key repeat time-out in milliseconds + float repeat = 30.0f; // key repeat time-out in milliseconds if (input_keyrepeat) { repeat = input_keyrepeat->value(); math::clamp(repeat, 10.0f, 250.0f); diff --git a/src/client/targets.cc b/src/client/targets.cc index 541206d..8dc5c07 100644 --- a/src/client/targets.cc +++ b/src/client/targets.cc @@ -364,7 +364,7 @@ void draw_target() + plane_normal.y * (entity->state()->location().y - render::Camera::eye().y) + plane_normal.z * (entity->state()->location().z - render::Camera::eye().z); - Vector3f intersection = (entity->state()->location() - render::Camera::eye()) * t; + Vector3f intersection = render::Camera::eye() + (entity->state()->location() - render::Camera::eye()) * t; // draw the target cursor in the frustum front plane, but in real world coordinates const float r = 0.05; diff --git a/src/model/map.cc b/src/model/map.cc index 62604ea..e902cfd 100644 --- a/src/model/map.cc +++ b/src/model/map.cc @@ -916,16 +916,15 @@ Model * Map::load(std::string const &name) mapfile.close(); - con_debug << " " << mapfile.name() << " " << mapfile.map_materials.size() << " mat " << - mapfile.map_brushes << " brushes " << + con_debug << " " << mapfile.name() << " " << mapfile.map_brushes << " brushes " << mapfile.map_faces << "/" << mapfile.map_faces_detail << " faces/detail " << std::endl; mapfile.load_fragments(model); - con_debug << " " << mapfile.name() << " " << model->fragments().size() << " frags " << +/* con_debug << " " << mapfile.name() << " " << model->fragments().size() << " frags " << model->model_tris_count << "/" << model->model_tris_detail_count << " tris/detail " << model->model_quad_count << "/" << model->model_quad_detail_count << " quads/detail" << std::endl; - +*/ mapfile.clear_materials(); return model; diff --git a/src/render/camera.cc b/src/render/camera.cc index a9aa1ca..e708b71 100644 --- a/src/render/camera.cc +++ b/src/render/camera.cc @@ -300,10 +300,8 @@ void Camera::draw() // Change to the projection matrix and set our viewing volume large enough for the skysphere gl::matrixmode(GL_PROJECTION); gl::loadidentity(); -// gl::frustum(-camera_frustum_size*Camera::aspect(), camera_frustum_size*Camera::aspect(), -// -camera_frustum_size, camera_frustum_size, camera_frustum_front, 2048.0f); - gl::frustum(-camera_frustum_size, camera_frustum_size, -camera_frustum_size/Camera::aspect(), camera_frustum_size/Camera::aspect(), camera_frustum_front, 2048.0f); + gl::frustum(-camera_frustum_size, camera_frustum_size, -camera_frustum_size/Camera::aspect(), camera_frustum_size/Camera::aspect(), camera_frustum_front, 1023.0f); gl::matrixmode(GL_MODELVIEW); gl::loadidentity(); @@ -315,15 +313,8 @@ void Camera::draw() math::Matrix4f matrix; matrix.assign(camera_axis); gl::multmatrix(matrix.transpose()); -/* - // match the camera with the current target - gl::translate(-1.0f * camera_target); - - // apply camera offset - gl::translate(distance * camera_axis.forward()); -*/ - // camera sticks at 0,0,0 - //gl::translate(camera_target - camera_eye); + + gl::translate(-1.0f * camera_eye); } void Camera::set_direction(float direction) diff --git a/src/render/draw.cc b/src/render/draw.cc index 2752030..d440706 100644 --- a/src/render/draw.cc +++ b/src/render/draw.cc @@ -403,7 +403,6 @@ void pass_prepare(float seconds) Light *light = (*lit); // load light texture - // FIXME optimize std::stringstream flarename; flarename << "bitmaps/fx/flare" << std::setfill('0') << std::setw(2) << light->flare(); light->render_texture = Textures::load(flarename.str()); @@ -415,7 +414,6 @@ void pass_prepare(float seconds) if (!engine->flare()) engine->engine_flare = 1; // load engine texture - // FIXME optimize std::stringstream flarename; flarename << "bitmaps/fx/flare" << std::setfill('0') << std::setw(2) << engine->flare(); engine->render_texture = Textures::load(flarename.str()); @@ -425,7 +423,6 @@ void pass_prepare(float seconds) Flare *flare = (*flit); // load flare texture - // FIXME optimize std::stringstream flarename; flarename << "bitmaps/fx/flare" << std::setfill('0') << std::setw(2) << flare->flare(); flare->render_texture = Textures::load(flarename.str()); @@ -461,7 +458,8 @@ void pass_prepare(float seconds) entity->state()->state_visible = true; if (entity->type() == core::Entity::Globe) { - core::EntityGlobe *globe = (core::EntityGlobe *) entity; + + core::EntityGlobe *globe = static_cast<core::EntityGlobe *>(entity); if (flag_is_set(globe->flags(), core::Entity::Bright)) { @@ -472,7 +470,7 @@ void pass_prepare(float seconds) GLfloat specular_light[] = { 0.2f, 0.2f, 0.2f, 1.0f }; for (size_t i=0; i <3; i++) { - light_position[i] = globe->location()[i] - render::Camera::eye()[i]; + light_position[i] = globe->location()[i]; diffuse_light[i] = globe->color()[i] * 0.4; } light_position[3] = 1.0f; @@ -486,11 +484,12 @@ void pass_prepare(float seconds) } else { // load globe textures - // FIXME optimize - if (globe->texture().size()) { + if (!globe->render_texture && globe->texture().size()) { std::stringstream texname; texname << "textures/" << globe->texture(); globe->render_texture = Textures::load(texname.str()); + if (!globe->render_texture) + globe->entity_texture.clear(); } } } @@ -507,7 +506,7 @@ void draw_pass_default() // draw entities without model if (!entity->model()) { gl::push(); - gl::translate(entity->state()->location() - Camera::eye()); + gl::translate(entity->state()->location()); gl::multmatrix(entity->state()->axis()); if (flag_is_set(entity->flags(), core::Entity::Bright)) { @@ -548,7 +547,7 @@ void draw_pass_default() gl::color(entity->color()); gl::push(); - gl::translate(entity->state()->location() - Camera::eye()); + gl::translate(entity->state()->location()); gl::multmatrix(entity->state()->axis()); // top @@ -592,7 +591,7 @@ void draw_pass_model_fragments() if (entity->model() && entity->state()->visible()) { gl::push(); - gl::translate(entity->state()->location() - Camera::eye()); + gl::translate(entity->state()->location()); gl::multmatrix(entity->state()->axis()); draw_model_fragments(entity); @@ -645,7 +644,7 @@ void draw_pass_model_fx(float elapsed) if (light->strobe()) t = (core::application()->time() + entity->state()->fuzz() - light->offset()) * light->frequency(); if ((!light->strobe()) || (( t - floorf(t)) <= light->time())) { - location.assign(entity->state()->location() - Camera::eye() + (entity->state()->axis() * light->location())); + location.assign(entity->state()->location() + (entity->state()->axis() * light->location())); light_size = 0.0625 * light->radius(); if (current_texture != light->texture()) { @@ -688,7 +687,7 @@ void draw_pass_model_fx(float elapsed) if (flare->angle()) flare_axis.change_direction(flare->angle()); - location.assign(entity->state()->location() - Camera::eye() + (entity->state()->axis() * flare->location())); + location.assign(entity->state()->location() + (entity->state()->axis() * flare->location())); light_size = 0.0625 * flare->radius(); if (current_texture != flare->texture()) { @@ -740,7 +739,7 @@ void draw_pass_model_fx(float elapsed) for(model::Model::Engines::iterator eit = entity->model()->engines().begin(); eit != entity->model()->engines().end(); eit++) { engine = (*eit); - location.assign(entity->state()->location() - Camera::eye() + (entity->state()->axis() * engine->location())); + location.assign(entity->state()->location() + (entity->state()->axis() * engine->location())); engine_size = 0.0625 * engine->radius(); if (current_texture != engine->texture() ) { @@ -833,7 +832,7 @@ void draw_pass_model_corona() if (entity->model() && entity->state()->visible()) { gl::push(); - gl::translate(entity->state()->location() - Camera::eye()); + gl::translate(entity->state()->location()); math::Color color = entity->color(); color.a = 0.25f; draw_sphere(color, entity->model()->radius()); @@ -867,8 +866,8 @@ void draw_pass_sky() gl::enable(GL_TEXTURE_2D); gl::push(); - //gl::translate(Camera::eye()); - draw_sphere_inside(math::Color(), 128); + gl::translate(Camera::eye()); + draw_sphere_inside(math::Color(), 1016.0f); gl::pop(); gl::disable(GL_TEXTURE_2D); @@ -887,7 +886,7 @@ void draw_pass_spacegrid() float dy = Camera::target().y - floorf(Camera::target().y); gl::push(); - gl::translate(Camera::target() - Camera::eye()); + gl::translate(Camera::target()); gl::color(0,0, 1.0f); gl::normal(0, 0, 1.0f); diff --git a/src/render/dust.cc b/src/render/dust.cc index d58be1b..96a9d67 100644 --- a/src/render/dust.cc +++ b/src/render/dust.cc @@ -125,18 +125,17 @@ void Dust::draw() float dsquare = 0; for (size_t j = 0; j < 3; j++) { dsquare += (core::localcontrol()->location()[j] - dust[i*3+j]) * (core::localcontrol()->location()[j] - dust[i*3+j]); - v[j] = dust[i*3+j] - Camera::eye()[j]; + v[j] = dust[i*3+j] - core::localcontrol()->state()->axis().forward()[j] * traillength; } if (dsquare > (core::localcontrol()->radius() + DUSTDISTANCE)*(core::localcontrol()->radius() + DUSTDISTANCE)) { for (size_t j = 0; j < 3; j++) { dust[i*3+j] = core::localcontrol()->location()[j] + (math::randomf(2) - 1) * (DUSTDISTANCE + core::localcontrol()->radius()); - v[j] = dust[i*3+j] - Camera::eye()[j]; + v[j] = dust[i*3+j] - core::localcontrol()->state()->axis().forward()[j] * traillength; } } - gl::vertex(v); - - v -= core::localcontrol()->state()->axis().forward() * traillength; + + glVertex3fv(&dust[i*3]); gl::vertex(v); } diff --git a/src/render/render.cc b/src/render/render.cc index c8c6225..e91be23 100644 --- a/src/render/render.cc +++ b/src/render/render.cc @@ -113,12 +113,17 @@ void shutdown() zone->set_sky_texture(0); } - // clear entity models, this will force a reload + // clear entity models, and globe textures, this will force a reload for (core::Entity::Registry::iterator it = core::Entity::registry().begin(); it != core::Entity::registry().end(); it++) { core::Entity *entity = (*it).second; if (entity->model()) entity->entity_model = 0; + + if (entity->type() == core::Entity::Globe) { + core::EntityGlobe *globe = static_cast<core::EntityGlobe *>(entity); + globe->render_texture = 0; + } } // clear models |