diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/audio/audio.cc | 7 | ||||
-rw-r--r-- | src/audio/audio.h | 2 | ||||
-rw-r--r-- | src/client/view.cc | 9 | ||||
-rw-r--r-- | src/render/Makefile.am | 7 | ||||
-rw-r--r-- | src/render/draw.cc | 4 | ||||
-rw-r--r-- | src/render/render.cc | 5 |
6 files changed, 21 insertions, 13 deletions
diff --git a/src/audio/audio.cc b/src/audio/audio.cc index ff0918d..20f6b1d 100644 --- a/src/audio/audio.cc +++ b/src/audio/audio.cc @@ -116,20 +116,17 @@ void loop( size_t source_index, const char *name, float pitch, float gain) alSourcePlay(source); } -void update_listener(math::Vector3f const &location, math::Axis const &axis, float speed) +void update_listener(math::Vector3f const &location, math::Axis const &axis, math::Vector3f const & velocity) { alListenerfv(AL_POSITION, location.ptr()); - math::Vector3f velocity(axis.forward()); - velocity = velocity * speed; - //alListenerfv(AL_VELOCITY, velocity.ptr()); - ALfloat orientation[6]; for (size_t i =0; i <3; i++) { orientation[i] = axis.forward()[i]; orientation[i+3] = axis.up()[i]; } alListenerfv(AL_ORIENTATION, orientation); + //alListenerfv(AL_VELOCITY, velocity.ptr()); } } diff --git a/src/audio/audio.h b/src/audio/audio.h index 629ae88..a3d4010 100644 --- a/src/audio/audio.h +++ b/src/audio/audio.h @@ -42,7 +42,7 @@ void loop( size_t source_index, const char *name, float pitch=1.0f, float gain=1 void update_source(size_t source_index, math::Vector3f const & location, math::Vector3f const & velocity, float pitch=1.0f, float gain=1.0f); /// update listener parameters -void update_listener(math::Vector3f const &location, math::Axis const &axis, float speed); +void update_listener(math::Vector3f const &location, math::Axis const &axis, math::Vector3f const & velocity); } #endif // __INCLUDED_AUDIO_AUDIO_H__ diff --git a/src/client/view.cc b/src/client/view.cc index 7038a47..56c692e 100644 --- a/src/client/view.cc +++ b/src/client/view.cc @@ -61,7 +61,7 @@ void init() cl_crosshaircolor = core::Cvar::get("cl_crosshaircolor", "1 1 1", core::Cvar::Archive); cl_crosshaircolor->set_info("[r g b] crosshairs color"); - snd_engines = core::Cvar::get("snd_engines", "0", core::Cvar::Archive); + snd_engines = core::Cvar::get("snd_engines", "1", core::Cvar::Archive); snd_engines->set_info("[bool] enable or disable engine sounds"); } @@ -294,12 +294,13 @@ void render_sound() if (!(snd_engines && snd_engines->value())) return; - float speed = 0; + math::Vector3f velocity(0, 0 ,0); + if (core::localcontrol()) { - speed = core::localcontrol()->speed(); + velocity.assign(core::localcontrol()->state()->axis().forward() * core::localcontrol()->speed()); } - audio::update_listener(render::Camera::eye(), render::Camera::axis(), speed); + audio::update_listener(render::Camera::eye(), render::Camera::axis(), velocity); for (std::map<unsigned int, core::Entity *>::iterator it=core::Entity::registry.begin(); it != core::Entity::registry.end(); it++) { core::Entity *entity = (*it).second; diff --git a/src/render/Makefile.am b/src/render/Makefile.am index 166aa99..7069f97 100644 --- a/src/render/Makefile.am +++ b/src/render/Makefile.am @@ -9,6 +9,7 @@ endif librender_la_LDFLAGS = -avoid-version -no-undefined @GL_LIBS@ librender_la_LIBADD = $(top_builddir)/src/math/libmath.la -librender_la_SOURCES = camera.cc draw.cc gl.cc image.cc render.cc text.cc \ - textures.cc tga.cc -noinst_HEADERS = camera.h draw.h gl.h image.h render.h text.h textures.h tga.h +librender_la_SOURCES = camera.cc draw.cc dust.cc gl.cc image.cc render.cc \ + text.cc textures.cc tga.cc +noinst_HEADERS = camera.h draw.h dust.h gl.h image.h render.h text.h textures.h \ + tga.h diff --git a/src/render/draw.cc b/src/render/draw.cc index 18c3d73..1f920b0 100644 --- a/src/render/draw.cc +++ b/src/render/draw.cc @@ -12,6 +12,7 @@ #include "render/render.h" #include "render/textures.h" #include "render/draw.h" +#include "render/dust.h" #include "render/gl.h" namespace render @@ -317,6 +318,7 @@ void pass_prepare(float seconds) // load entity models and light flare textures if (!entity->model() && entity->modelname().size()) { entity->entity_model = model::Model::load(entity->modelname()); + entity->entity_radius = entity->model()->radius(); if (!entity->model()) { entity->entity_modelname.clear(); @@ -865,6 +867,8 @@ void draw(float seconds) draw_pass_spacegrid(); // draw the blue spacegrid + Dust::draw(); // draw spacedust + draw_pass_model_fx(); // draw entity lights and engines gl::enable(GL_LIGHTING); diff --git a/src/render/render.cc b/src/render/render.cc index ea70dbf..cb0d4dd 100644 --- a/src/render/render.cc +++ b/src/render/render.cc @@ -10,6 +10,7 @@ #include <iomanip> #include "render/gl.h" +#include "render/dust.h" #include "render/textures.h" #include "render/tga.h" #include "render/render.h" @@ -98,6 +99,8 @@ void init() Textures::init(); Text::init(); + + Dust::init(); } void shutdown() @@ -123,6 +126,8 @@ void shutdown() Textures::shutdown(); Camera::shutdown(); + + Dust::shutdown(); } } |