Jamie Slowgrove - PGG Assignment 2
 All Classes Namespaces Files Functions Variables Typedefs Macros
ParticleEffect.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <iostream>
4 #include <glm.hpp>
5 #include <gtc/type_ptr.hpp>
6 #include <gtc/matrix_transform.hpp>
7 #include <memory>
8 #include <vector>
9 #include <time.h>
10 #include <string.h>
11 #include <unordered_map>
12 #include "glew.h"
13 #include "Particle.h"
14 
16 #define MAX_NUMBER_OF_PARTICLES 100
17 
23 {
24 private:
26  std::vector<Particle*> particles;
28  std::unordered_map<std::string, Object*> objects;
29  /*The loaded Shader files*/
30  std::unordered_map<std::string, Shader*> shaders;
38  float moveSpeed;
40  glm::vec3 emitter;
42  bool emit;
43 
44 public:
55  ParticleEffect(std::string fileName, std::unordered_map<std::string, Object*> &objects,
56  std::unordered_map<std::string, Shader*> &shaders, std::string vertexShaderName,
57  std::string fragmentShaderName, glm::vec3 emitter, bool emit);
58 
64 
69  void update(float dt);
70 
76  void draw(glm::mat4 &viewMatrix, glm::mat4 &projMatrix);
77 
83  void makeNewParticles(std::unordered_map<std::string, Object*> &objects,
84  std::unordered_map<std::string, Shader*> &shaders);
85 
90  void setEmitter(glm::vec3 emitter);
91 
96  void setEmitting(bool emit);
97 };
void makeNewParticles(std::unordered_map< std::string, Object * > &objects, std::unordered_map< std::string, Shader * > &shaders)
Definition: ParticleEffect.cpp:93
std::string objectName
Definition: ParticleEffect.h:32
bool emit
Definition: ParticleEffect.h:42
std::unordered_map< std::string, Object * > objects
Definition: ParticleEffect.h:28
Creates a ParticleEffect object that handles Particle objects.
Definition: ParticleEffect.h:22
ParticleEffect(std::string fileName, std::unordered_map< std::string, Object * > &objects, std::unordered_map< std::string, Shader * > &shaders, std::string vertexShaderName, std::string fragmentShaderName, glm::vec3 emitter, bool emit)
Definition: ParticleEffect.cpp:6
glm::vec3 emitter
Definition: ParticleEffect.h:40
std::string fragmentShaderName
Definition: ParticleEffect.h:36
~ParticleEffect()
Definition: ParticleEffect.cpp:32
void setEmitting(bool emit)
Definition: ParticleEffect.cpp:139
void update(float dt)
Definition: ParticleEffect.cpp:44
void setEmitter(glm::vec3 emitter)
Definition: ParticleEffect.cpp:130
void draw(glm::mat4 &viewMatrix, glm::mat4 &projMatrix)
Definition: ParticleEffect.cpp:80
std::unordered_map< std::string, Shader * > shaders
Definition: ParticleEffect.h:30
std::string vertexShaderName
Definition: ParticleEffect.h:34
GLsizei const GLchar *const * string
Definition: glew.h:1843
std::vector< Particle * > particles
Definition: ParticleEffect.h:26
float moveSpeed
Definition: ParticleEffect.h:38