Tramway SDK
particle.h
Go to the documentation of this file.
1// TRAMWAY DRIFT AND DUNGEON EXPLORATION SIMULATOR 2022
2// All rights reserved.
3
4#ifndef TRAM_SDK_COMPONENTS_PARTICLECOMPONENT_H
5#define TRAM_SDK_COMPONENTS_PARTICLECOMPONENT_H
6
7#include <render/render.h>
8#include <render/sprite.h>
9
10namespace tram {
11
13public:
14 struct Particle {
17 uint32_t age;
18 };
19
22 inline name_t GetSprite() { return sprite->GetName(); }
23
25 this->sprite = sprite;
26 }
27
28 void Start();
29
30 void Update();
31
33
34 void UpdateLocation(vec3 nlocation){
35 location = nlocation;
37 }
38
39 void EventHandler(Event &event){return;}
40
41 void EmitParticle (const Particle& particle);
42
43 // put these behind getter/setter methods, maybe?
44 uint32_t emission_rate = 1;
45 uint32_t particle_max_age = 120;
46 vec3 gravity = vec3(0.0f, -0.005f, 0.0f);
47 vec3 initial_velocity = vec3(0.0f, 0.15f, 0.0f);
49protected:
50 std::vector<Particle> particles;
52
54
57};
58
59}
60
61#endif // TRAM_SDK_COMPONENTS_PARTICLECOMPONENT_H
Definition: entitycomponent.h:18
Definition: particle.h:12
~ParticleComponent()
Definition: particle.cpp:16
ResourceProxy< Render::Sprite > sprite
Definition: particle.h:51
name_t GetSprite()
Definition: particle.h:22
void EmitParticle(const Particle &particle)
Definition: particle.cpp:22
uint32_t emission_rate
Definition: particle.h:44
vec3 initial_velocity
Definition: particle.h:47
vec3 gravity
Definition: particle.h:46
ParticleComponent()
Definition: particle.h:20
void EventHandler(Event &event)
Definition: particle.h:39
void UpdateRenderListObject()
Definition: particle.cpp:77
void SetSprite(Render::Sprite *sprite)
Definition: particle.h:24
void Update()
Definition: particle.cpp:44
uint32_t particle_max_age
Definition: particle.h:45
Render::drawlistentry_t draw_list_entry
Definition: particle.h:55
vec3 location
Definition: particle.h:53
void Start()
Definition: particle.cpp:26
float initial_velocity_randomness
Definition: particle.h:48
std::vector< Particle > particles
Definition: particle.h:50
Render::vertexarray_t vertex_array
Definition: particle.h:56
void UpdateLocation(vec3 nlocation)
Definition: particle.h:34
Definition: sprite.h:24
Definition: resource.h:47
Definition: api.h:9
glm::vec3 vec3
Definition: math.h:12
Definition: event.h:24
Definition: particle.h:14
uint32_t age
Definition: particle.h:17
vec3 coords
Definition: particle.h:15
vec3 velocity
Definition: particle.h:16
Definition: render.h:131
void * generic
Definition: render.h:136
Definition: render.h:101
void * generic
Definition: render.h:112
Definition: uid.h:11