# HG changeset patch
# User John Tsiombikas <nuclear@member.fsf.org>
# Date 1348006121 -10800
# Node ID 1ea56011c1ff181858f92b68a87dfc96929b7a82
# Parent  bcdea26c8f27b95c3e10f600996b01ceab88b181
stuff + streaming start

diff -r bcdea26c8f27 -r 1ea56011c1ff prototype/data/fire.psys
--- a/prototype/data/fire.psys	Tue Sep 18 18:34:28 2012 +0300
+++ b/prototype/data/fire.psys	Wed Sep 19 01:08:41 2012 +0300
@@ -11,17 +11,16 @@
 # center ~ range. If the range is missing, it's assumed to be 0.
 
 texture = "fire_particle.png"
-rate = 20
-life = 0.9
-grav = [0 0.5 0]
+rate = 50
+life = 0.9 ~ 0.1
+grav = [0 0.3 0]
 spawn_range = 0.025
 
-size = 0.1
+size(0) = 0.2
+size(1s) = 0.075
 
-pcolor(0) = [1.0 0.5 0.2]
-pcolor(700) = [1.0 0.3 0.2]
-pcolor(900) = [0.4 0.4 0.4]
+pcolor(0) = [1.0 0.7 0.1]
+pcolor(1s) = [1.0 0.27 0.15]
 
 palpha(0) = 1
-palpha(700) = 0.8
-palpha(900) = 0
+palpha(1s) = 0.1
diff -r bcdea26c8f27 -r 1ea56011c1ff prototype/doc/notes
--- a/prototype/doc/notes	Tue Sep 18 18:34:28 2012 +0300
+++ b/prototype/doc/notes	Wed Sep 19 01:08:41 2012 +0300
@@ -1,3 +1,8 @@
 - The approach of preallocating OpenAL sources for each sound source is plainly
   wrong. There's a limit to the number of OpenAL source objects, and that limit
   is probably 255 on the implementation I'm using now.
+
+== particles ==
+
+- blend mode in config
+- parameter animation relative to lifetime of particle not absolute time
diff -r bcdea26c8f27 -r 1ea56011c1ff prototype/src/audio/ovstream.cc
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/prototype/src/audio/ovstream.cc	Wed Sep 19 01:08:41 2012 +0300
@@ -0,0 +1,16 @@
+#include "ovstream.h"
+
+OggVorbisStream::OggVorbisStream()
+{
+	ov_clear(&vf);
+}
+
+OggVorbisStream::~OggVorbisStream()
+{
+	ov_clear(&vf);
+}
+
+bool OggVorbisStream::more_samples()
+{
+	return false;
+}
diff -r bcdea26c8f27 -r 1ea56011c1ff prototype/src/audio/ovstream.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/prototype/src/audio/ovstream.h	Wed Sep 19 01:08:41 2012 +0300
@@ -0,0 +1,21 @@
+#ifndef OVSTREAM_H_
+#define OVSTREAM_H_
+
+#include <vorbis/vorbisfile.h>
+#include "stream.h"
+
+class OggVorbisStream : public AudioStream {
+private:
+	OggVorbis_File vf;
+
+	virtual bool more_samples();
+
+public:
+	OggVorbisStream();
+	virtual ~OggVorbisStream();
+
+	bool open(const char *fname);
+	void close();
+};
+
+#endif	// OVSTREAM_H_
diff -r bcdea26c8f27 -r 1ea56011c1ff prototype/src/audio/stream.cc
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/prototype/src/audio/stream.cc	Wed Sep 19 01:08:41 2012 +0300
@@ -0,0 +1,13 @@
+#include "stream.h"
+
+AudioStream::~AudioStream()
+{
+}
+
+void AudioStream::play()
+{
+}
+
+void AudioStream::stop()
+{
+}
diff -r bcdea26c8f27 -r 1ea56011c1ff prototype/src/audio/stream.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/prototype/src/audio/stream.h	Wed Sep 19 01:08:41 2012 +0300
@@ -0,0 +1,19 @@
+#ifndef AUDIO_STREAM_H_
+#define AUDIO_STREAM_H_
+
+#include <thread>
+
+class AudioStream {
+private:
+	std::thread play_thread;
+
+	virtual bool more_samples() = 0;
+
+public:
+	virtual ~AudioStream();
+
+	void play();
+	void stop();
+};
+
+#endif	// AUDIO_STREAM_H_
diff -r bcdea26c8f27 -r 1ea56011c1ff prototype/src/tile.cc
--- a/prototype/src/tile.cc	Tue Sep 18 18:34:28 2012 +0300
+++ b/prototype/src/tile.cc	Wed Sep 19 01:08:41 2012 +0300
@@ -279,7 +279,7 @@
 			struct psys_emitter *ps = psys_create();
 			if(ps && psys_load_attr(&ps->attr, datafile_path("fire.psys")) == 0) {
 				Vector3 lpos = lt->get_position();
-				psys_set_pos(ps, v3_cons(lpos.x, lpos.y, lpos.z), 0);
+				psys_set_pos(ps, v3_cons(lpos.x, lpos.y + 0.01, lpos.z), 0);
 				psys_global.push_back(ps);
 				psys_side.push_back(side);
 			} else {