dungeon_crawler
changeset 53:1ea56011c1ff
stuff + streaming start
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Wed, 19 Sep 2012 01:08:41 +0300 |
parents | bcdea26c8f27 |
children | 995191474cc0 |
files | prototype/data/fire.psys prototype/doc/notes prototype/src/audio/ovstream.cc prototype/src/audio/ovstream.h prototype/src/audio/stream.cc prototype/src/audio/stream.h prototype/src/tile.cc |
diffstat | 7 files changed, 83 insertions(+), 10 deletions(-) [+] |
line diff
1.1 --- a/prototype/data/fire.psys Tue Sep 18 18:34:28 2012 +0300 1.2 +++ b/prototype/data/fire.psys Wed Sep 19 01:08:41 2012 +0300 1.3 @@ -11,17 +11,16 @@ 1.4 # center ~ range. If the range is missing, it's assumed to be 0. 1.5 1.6 texture = "fire_particle.png" 1.7 -rate = 20 1.8 -life = 0.9 1.9 -grav = [0 0.5 0] 1.10 +rate = 50 1.11 +life = 0.9 ~ 0.1 1.12 +grav = [0 0.3 0] 1.13 spawn_range = 0.025 1.14 1.15 -size = 0.1 1.16 +size(0) = 0.2 1.17 +size(1s) = 0.075 1.18 1.19 -pcolor(0) = [1.0 0.5 0.2] 1.20 -pcolor(700) = [1.0 0.3 0.2] 1.21 -pcolor(900) = [0.4 0.4 0.4] 1.22 +pcolor(0) = [1.0 0.7 0.1] 1.23 +pcolor(1s) = [1.0 0.27 0.15] 1.24 1.25 palpha(0) = 1 1.26 -palpha(700) = 0.8 1.27 -palpha(900) = 0 1.28 +palpha(1s) = 0.1
2.1 --- a/prototype/doc/notes Tue Sep 18 18:34:28 2012 +0300 2.2 +++ b/prototype/doc/notes Wed Sep 19 01:08:41 2012 +0300 2.3 @@ -1,3 +1,8 @@ 2.4 - The approach of preallocating OpenAL sources for each sound source is plainly 2.5 wrong. There's a limit to the number of OpenAL source objects, and that limit 2.6 is probably 255 on the implementation I'm using now. 2.7 + 2.8 +== particles == 2.9 + 2.10 +- blend mode in config 2.11 +- parameter animation relative to lifetime of particle not absolute time
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 3.2 +++ b/prototype/src/audio/ovstream.cc Wed Sep 19 01:08:41 2012 +0300 3.3 @@ -0,0 +1,16 @@ 3.4 +#include "ovstream.h" 3.5 + 3.6 +OggVorbisStream::OggVorbisStream() 3.7 +{ 3.8 + ov_clear(&vf); 3.9 +} 3.10 + 3.11 +OggVorbisStream::~OggVorbisStream() 3.12 +{ 3.13 + ov_clear(&vf); 3.14 +} 3.15 + 3.16 +bool OggVorbisStream::more_samples() 3.17 +{ 3.18 + return false; 3.19 +}
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 4.2 +++ b/prototype/src/audio/ovstream.h Wed Sep 19 01:08:41 2012 +0300 4.3 @@ -0,0 +1,21 @@ 4.4 +#ifndef OVSTREAM_H_ 4.5 +#define OVSTREAM_H_ 4.6 + 4.7 +#include <vorbis/vorbisfile.h> 4.8 +#include "stream.h" 4.9 + 4.10 +class OggVorbisStream : public AudioStream { 4.11 +private: 4.12 + OggVorbis_File vf; 4.13 + 4.14 + virtual bool more_samples(); 4.15 + 4.16 +public: 4.17 + OggVorbisStream(); 4.18 + virtual ~OggVorbisStream(); 4.19 + 4.20 + bool open(const char *fname); 4.21 + void close(); 4.22 +}; 4.23 + 4.24 +#endif // OVSTREAM_H_
5.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 5.2 +++ b/prototype/src/audio/stream.cc Wed Sep 19 01:08:41 2012 +0300 5.3 @@ -0,0 +1,13 @@ 5.4 +#include "stream.h" 5.5 + 5.6 +AudioStream::~AudioStream() 5.7 +{ 5.8 +} 5.9 + 5.10 +void AudioStream::play() 5.11 +{ 5.12 +} 5.13 + 5.14 +void AudioStream::stop() 5.15 +{ 5.16 +}
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 6.2 +++ b/prototype/src/audio/stream.h Wed Sep 19 01:08:41 2012 +0300 6.3 @@ -0,0 +1,19 @@ 6.4 +#ifndef AUDIO_STREAM_H_ 6.5 +#define AUDIO_STREAM_H_ 6.6 + 6.7 +#include <thread> 6.8 + 6.9 +class AudioStream { 6.10 +private: 6.11 + std::thread play_thread; 6.12 + 6.13 + virtual bool more_samples() = 0; 6.14 + 6.15 +public: 6.16 + virtual ~AudioStream(); 6.17 + 6.18 + void play(); 6.19 + void stop(); 6.20 +}; 6.21 + 6.22 +#endif // AUDIO_STREAM_H_
7.1 --- a/prototype/src/tile.cc Tue Sep 18 18:34:28 2012 +0300 7.2 +++ b/prototype/src/tile.cc Wed Sep 19 01:08:41 2012 +0300 7.3 @@ -279,7 +279,7 @@ 7.4 struct psys_emitter *ps = psys_create(); 7.5 if(ps && psys_load_attr(&ps->attr, datafile_path("fire.psys")) == 0) { 7.6 Vector3 lpos = lt->get_position(); 7.7 - psys_set_pos(ps, v3_cons(lpos.x, lpos.y, lpos.z), 0); 7.8 + psys_set_pos(ps, v3_cons(lpos.x, lpos.y + 0.01, lpos.z), 0); 7.9 psys_global.push_back(ps); 7.10 psys_side.push_back(side); 7.11 } else {