20 void draw(glm::mat4 proj);
22 void setTexture(std::shared_ptr<Texture> tex) { texture = tex; }
28 glDeleteVertexArrays(1, &vao);
29 glDeleteBuffers(1, &a_position);
30 glDeleteBuffers(1, &a_colour);
31 glDeleteBuffers(1, &a_texCoord);
36 GLuint vao, a_position, a_colour, a_texCoord;
38 std::vector<float> position;
39 std::vector<float> colour;
40 std::vector<float> texCoord;
42 std::shared_ptr<Texture> texture =
nullptr;
49 const char * vertexShader =
50 "#version " GLSL_VERSION
"\n"
51 "precision lowp float; precision lowp int;\n"
52 "layout(location=0) in vec4 a_position;\n"
53 "layout(location=1) in vec4 a_colour;\n"
54 "layout(location=2) in vec4 a_texCoord;\n"
55 "uniform mat4 proj;\n"
56 "uniform float scale;\n"
58 "out vec4 o_colour;\n"
60 "o_colour = a_colour;\n"
61 "theta = a_position.z;\n"
62 "gl_Position = proj*vec4(a_position.xy,0.0,1.0);\n"
63 "gl_PointSize = a_position.w*scale;\n"
66 const char * fragmentShader =
67 "#version " GLSL_VERSION
"\n"
68 "precision lowp float; precision lowp int;\n"
69 "uniform sampler2D sampler;\n"
70 "uniform int textureless;\n"
73 "layout(location=0) out vec4 colour;\n"
75 "vec2 coord = 2.0 * gl_PointCoord - 1.0;"
76 "float ct = cos(theta); float st = sin(theta);\n"
77 "mat2 rot = mat2(ct, -st, st, ct);\n"
78 "vec2 pos = rot * coord;\n"
79 "colour = o_colour * texture(sampler, (pos+1.0)*0.5);\n"
Definition glParticles.h:12
void setTexture(std::shared_ptr< Texture > tex)
Definition glParticles.h:22
void draw(glm::mat4 proj)
Definition glParticles.cpp:212
~glParticles()
Definition glParticles.h:26
void update(Particles::UpdateInfo info)
Definition glParticles.cpp:141
Definition particles.h:14
Definition particles.h:19