DI-Guy SDK Documentation  13.2
diguyParticleSystem.h
Go to the documentation of this file.
1 
2 /*********************************************************************
3 ** Copyright (c) 1992-2019 VT MAK
4 ** All rights reserved.
5 *********************************************************************/
6 
7 /*********************************************************************/
14 #ifndef __diguyParticleSystem_H
15 #define __diguyParticleSystem_H
16 
17 #ifdef SWIG
18 %module diguyParticleSystem
19 #else
20 #define CPLUSPLUS_ONLY
21 #endif
22 
23 #ifdef CPLUSPLUS_ONLY
24 #include <diguy_constants.h>
25 #include <stdlib.h>
26 #include <memory.h>
27 
28 class diguyCharacter;
29 class diguyParticleManager;
33 class diguyViewCamera;
35 
36 #endif
37 
38 #include <declspec_diguy.h>
39 
40 //------------------------------------------------------------------------------
53 class BDI_DECLSPEC_diguy diguyParticleSystem
54 {
55 
56 public:
57  diguyParticleSystem(const char * effect_name) : m_particle_manager(NULL), m_renderer(NULL),
58  m_character(NULL), m_system_life_time_override(-1.0f), m_age(0.0f), m_visible(1), m_ready_for_garbage_collection(0),
59  m_spawned_system(0)
60  {
61  ;
62  }
63  virtual ~diguyParticleSystem(){ ; }
64  virtual const char * get_name() = 0;
65  virtual void set_name(const char * name) = 0;
66 
68  virtual int update(float dt)
69  {
70  m_age += dt;
71  if (m_system_life_time_override > 0.0 && m_age > m_system_life_time_override){
72  m_ready_for_garbage_collection = 1;
73  return 0;
74  }
75  return 1;
76  }
77 
78  virtual void start_emitting() = 0;
79  virtual void stop_emitting() = 0;
80  virtual void pause_emitting() = 0;
81  virtual void stop_all_particles() = 0;
82  virtual void restart_particle_system() = 0;
83 
84  virtual int get_emitting() = 0;
86  virtual int get_active_count() = 0;
87 
88  virtual void set_position(double x, double y, double z) = 0;
89  virtual void get_position(double *x, double *y, double *z) = 0;
90 
91  virtual int set_visible(int visible){ m_visible = visible; return 0; }
92  virtual int get_visible(){ return m_visible; }
93 
95  virtual void set_orientation(float * matrix) = 0;
96  virtual void set_scale(float scale) = 0;
97  virtual void set_scale(float scale_x, float scale_y, float scale_z) = 0;
98  virtual void set_time_scale(float t) = 0;
99 
103  virtual void reset_prev_position_next_update() = 0;
104 
105  //internally defined
106  diguyCharacter * get_character() { return m_character; }
107  void set_character(diguyCharacter * character) { m_character = character; }
108  void set_particle_manager(diguyParticleManager * manager){ m_particle_manager = manager; }
109  diguyParticleManager * get_particle_manager() { return m_particle_manager; }
110 
112  virtual void render(diguyGraphicsShaderProgram * shader){ ; }
114  void set_particle_renderer(diguyParticleSystemRenderer* renderer){
115  m_renderer = renderer;
116  }
117  diguyParticleSystemRenderer* get_particle_renderer(){ return m_renderer; }
119  virtual int get_ready_for_garbage_collection(){ return m_ready_for_garbage_collection; }
120  virtual void set_ready_for_garbage_collection(int value){ m_ready_for_garbage_collection = value; }
121  virtual float get_system_life_time_override(){ return m_system_life_time_override; }
122  virtual void set_system_life_time_override(float value){ m_system_life_time_override = value; }
124  virtual int get_spawned_system(){ return m_spawned_system; }
125  virtual void set_spawned_system(int value){ m_spawned_system = value; }
126 
127 protected:
128  diguyParticleManager * m_particle_manager;
130  diguyCharacter * m_character;
131  int m_visible;
132  float m_age;
133  float m_system_life_time_override;
134  int m_ready_for_garbage_collection;
135  int m_spawned_system;
136 };
137 
138 
139 //------------------------------------------------------------------------------
150 {
151 public:
153  memset(m_camera_matrix, 0, 16 * sizeof(float));
154  memset(m_world_rotation_matrix, 0, 16 * sizeof(float));
155 
158  }
159 
161  virtual void setup_particle_rendering(int render_pass_flags) = 0;
162 
164  virtual void end_particle_rendering(int render_pass_flags) = 0;
165 
167  virtual void draw_particle_buffer(const diguyParticleDrawDesc * draw_desc, void * particle_data) = 0;
169  float m_camera_matrix[16];
170  float m_world_rotation_matrix[16];
171 };
172 
173 
174 //------------------------------------------------------------------------------
183 {
184  diguyParticleDrawDesc() : m_shader(NULL), m_texture(NULL), m_system(NULL), m_camera(NULL),
185  m_depth_write(0), m_world_space(1), m_scale_x(1.0f), m_scale_y(1.0f), m_scale_z(1.0f), m_blend(0),
188  ;
189  }
190 
193 
196 
199 
202 
204  int m_depth_write;
205 
207  int m_world_space;
208 
210  float m_scale_x, m_scale_y, m_scale_z;
211 
213  int m_blend;
214 
216  int m_src_blend_func;
217 
219  int m_dst_blend_func;
220 
222  float m_alpha_thresh;
223 
232 
235 
237  int m_active_count;
238 
241 
244 
245 };
246 
247 
248 
249 #endif
An interface class that represents a particle system that has been created by diguy's appearance effe...
Definition: diguyParticleSystem.h:52
int m_num_verts_per_primitive
Normally 4 for GL_QUADS, but can also be 2 for GL_LINES.
Definition: diguyParticleSystem.h:230
float m_brightness_multiplier
optional per particle system override for IR shader
Definition: diguyParticleSystem.h:236
int m_src_blend_func
OpenGL src blending function constant.
Definition: diguyParticleSystem.h:212
int m_particle_data_size
How large in bytes each particle is, needed for VBO stride calculations.
Definition: diguyParticleSystem.h:221
diguyParticleDrawDesc()
Definition: diguyParticleSystem.h:180
virtual void setup_particle_rendering(int render_pass_flags)=0
Function is called before individual particle systems are rendered.
int m_active_count
number of active particles for this draw call
Definition: diguyParticleSystem.h:233
int m_particle_offset_for_normals
Definition: diguyParticleSystem.h:226
float m_alpha_thresh
alpha threshold for clipping the edges of particle system
Definition: diguyParticleSystem.h:218
float m_camera_matrix[16]
Definition: diguyParticleSystem.h:167
diguyViewCamera * m_camera
Pointer to current diguy camera.
Definition: diguyParticleSystem.h:197
An Structure that represents a particle system draw state. This struct allows you to feed rendering i...
Definition: diguyParticleSystem.h:178
virtual void draw_particle_buffer(const diguyParticleDrawDesc *draw_desc, void *particle_data)=0
Function is called whenever a buffer of particles is ready to be drawn.
A class that represents a shared texture.
Definition: diguyGraphicsTexture.h:122
float m_world_rotation_matrix[16]
Definition: diguyParticleSystem.h:168
int m_render_pass_flags
current render pass flags (shadow/intersection pass etc)
Definition: diguyParticleSystem.h:239
diguyGraphicsTexture * m_texture
Texture to bind for rendering this particle system.
Definition: diguyParticleSystem.h:191
virtual void end_particle_rendering(int render_pass_flags)=0
Function is called after all individual particle systems are rendered.
int m_particle_offset_for_colors
Following are needed for VBO stride and offset calculations.
Definition: diguyParticleSystem.h:224
The class that represents a DI-Guy Entity in the world.
Definition: diguyCharacter.h:80
int m_dst_blend_func
OpenGL dst blending function constant.
Definition: diguyParticleSystem.h:215
int m_particle_offset_for_textures
Definition: diguyParticleSystem.h:227
int m_depth_write
Should depth writing be active for this particle.
Definition: diguyParticleSystem.h:200
int m_world_space
Is this particle in world space (usually yes)
Definition: diguyParticleSystem.h:203
An interface class that allows diguy to trigger an immediate mode rendering of a diguy particle syste...
Definition: diguyParticleSystem.h:147
The class that represents a camera in the world.
Definition: diguyViewCamera.h:260
static double t
4 Header files and forward declarations
Definition: simple_playback_ogl.cpp:55
float m_scale_x
Scale values for non world space particles.
Definition: diguyParticleSystem.h:206
float m_scale_y
Definition: diguyParticleSystem.h:206
diguyGraphicsShaderProgram * m_shader
Shader that should be used to draw particle system. If null then use the Fixed Function Pipeline...
Definition: diguyParticleSystem.h:188
float m_scale_z
Definition: diguyParticleSystem.h:206
int m_particle_offset_for_verts
Definition: diguyParticleSystem.h:225
diguyParticleSystem * m_system
Pointer to actual particle system interface class.
Definition: diguyParticleSystem.h:194
This class implements shader programs for use with DI-Guy character graphics.
Definition: diguyGraphicsShaderProgram.h:96
diguyParticleSystemRenderer()
Definition: diguyParticleSystem.h:150
int m_blend
Should blending be enabled.
Definition: diguyParticleSystem.h:209