File: particlepathhandler.h

package info (click to toggle)
amoeba 1.1-13
  • links: PTS
  • area: contrib
  • in suites: sarge
  • size: 732 kB
  • ctags: 971
  • sloc: cpp: 8,315; makefile: 178
file content (50 lines) | stat: -rw-r--r-- 1,172 bytes parent folder | download | duplicates (11)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#ifndef _PARTICLEPATHHANDLER_H
#define _PARTICLEPATHHANDLER_H 1

#include "opengl/texture.h"
#include "main/object.h"
#include "main/event.h"
#include "main/mainloop.h"

struct particle {
	float progress;
	float angle_sin, angle_cos;
};
struct particle_sort {
	int num;
	float z;
};

typedef void (APIENTRY *PFNGLLOCKARRAYSEXTPROC)(GLint first, GLsizei count);
typedef void (APIENTRY *PFNGLUNLOCKARRAYSEXTPROC)(void);

class ParticlePathHandler : public Event {
protected:
	Texture *tex;
	particle *particles;
	int num_particles;
	float size, speed, radius;
	float last_progress, headstart, streamlength;
	vertex *vert;
	texcoord *tc;
	particle_sort *particle_sortdata;

        bool has_compiled_vertex_array;
        PFNGLLOCKARRAYSEXTPROC glLockArraysEXT;
        PFNGLUNLOCKARRAYSEXTPROC glUnlockArraysEXT;
	
	void spawn_particle(int i, float progress);
	inline float find_roty_from_deriv(float t);

	bool uniform;
	
public:
	ParticlePathHandler(MainLoop *ml, const char *title, const char *elem, Hashtable *attr);
	~ParticlePathHandler();
	
	void start_effect();
	void draw_scene(float progress);
	void end_effect();
};

#endif /* !defined(_PARTICLEPATHHANDLER_H) */