2#include"../res-management/texManager.h"
3#include"../res-management/meshManager.h"
4#include"../res-management/terrain.h"
5#include"shaderProgram.h"
31 glm::vec3 rightBottom;
36 glm::vec3 v1 = leftTop - leftBottom;
37 glm::vec3 v2 = leftTop - rightTop;
38 return glm::cross(v1, v2);
41 Rectangle():leftTop(0.0f),leftBottom(0.0f),rightBottom(0.0f),rightTop(0.0f){}
49 Rectangle(
float width,
float length,
float height, RectangleType type, glm::vec2 initialPosition = glm::vec2(0.0f))
53 leftBottom = glm::vec3(initialPosition.x - width / 2.0f, initialPosition.y - length / 2.0f,height);
54 leftTop = glm::vec3(initialPosition.x - width / 2.0f, initialPosition.y + length / 2.0f, height);
55 rightTop = glm::vec3(initialPosition.x + width / 2.0f, initialPosition.y + length / 2.0f, height);
56 rightBottom = glm::vec3(initialPosition.x + width / 2.0f, initialPosition.y - length / 2.0f, height);
58 else if (type == XZ_PLANE)
60 leftBottom = glm::vec3(initialPosition.x - width / 2.0f, height, initialPosition.y - length / 2.0f);
61 leftTop = glm::vec3(initialPosition.x - width / 2.0f, height, initialPosition.y + length / 2.0f);
62 rightTop = glm::vec3(initialPosition.x + width / 2.0f, height, initialPosition.y + length / 2.0f);
63 rightBottom = glm::vec3(initialPosition.x + width / 2.0f, height, initialPosition.y - length / 2.0f);
65 else if (type == YZ_PLANE)
67 leftBottom = glm::vec3(height, initialPosition.x - width / 2.0f, initialPosition.y - length / 2.0f);
68 leftTop = glm::vec3(height, initialPosition.x - width / 2.0f, initialPosition.y + length / 2.0f);
69 rightTop = glm::vec3(height, initialPosition.x + width / 2.0f, initialPosition.y + length / 2.0f);
70 rightBottom = glm::vec3(height, initialPosition.x + width / 2.0f, initialPosition.y - length / 2.0f);
83 Particle(
Model* m) : Velocity(0.1f), model(m), position(glm::vec3()), Life(10.0f),isEmitted(
false) { }
84 Particle(
Model* m, glm::vec3 position, glm::vec3 v,
float l) : Velocity(v), model(m), position(position), Life(l), isEmitted(
false) { }
86 void setRigidbody(
float radius) {
108 const glm::vec3& direction,
float interval);
123 std::vector<Particle>& getParticles() {
return particles; }
125 Terrain* getTerrain() {
return terrain; }
139 std::vector<Particle> particles;
147 float countDown = 0.0f;
151 GeneratorType generatorType;
161 std::default_random_engine generatorOne, generatorTwo;
165 std::uniform_real_distribution<float> distributionOne;
166 std::uniform_real_distribution<float> distributionTwo;
170 void respawnParticle(
Particle& particle);
Mesh manager. Handles mesh creation, storage, and deletion.
Definition meshManager.h:28
void Update(float dt)
Definition Particle.cpp:65
void renderParticles(ShaderProgram &shader, Camera &playCamera)
Definition Particle.cpp:104
std::vector< Model * > models
Models for the particles.
Definition Particle.h:127
void setSpeed(float speed)
Definition Particle.cpp:138
ParticleGenerator(std::vector< Model * > models, Terrain *terrain, unsigned int amount, MeshManager &meshManager, const glm::vec3 &position, const glm::vec3 &direction, float interval)
Definition Particle.cpp:4
A singleton class used to handle all rigid bodies in the scene.
Definition rigidbodyHandler.h:13
static RigidbodyHandler * getInstance()
Definition rigidbodyHandler.h:30
Rigidbody * createRigidbodyBall(float aRadius, glm::vec3 pos=glm::vec3(0, 0.1, 0), glm::mat3 rot=glm::mat3(1.0))
Definition rigidbodyHandler.cpp:33
A linked OpenGL program.
Definition shaderProgram.h:16
A class that represents a terrain object.
Definition terrain.h:28
A particle in the world. It can be animated and has a fixed lifetime, after which it disappears.
Definition Particle.h:76
A 2D rectangle in 3D space.
Definition Particle.h:28
Rectangle(float width, float length, float height, RectangleType type, glm::vec2 initialPosition=glm::vec2(0.0f))
Definition Particle.h:49