DI-Guy SDK Documentation  13.7.1
diguyParticleSystem.h
Go to the documentation of this file.
1 
2 /*********************************************************************
3 ** Copyright (c) 1992-2022 MAK Technologies, Inc.
4 ** All rights reserved.
5 *********************************************************************/
6 
7 /*********************************************************************/
14 #pragma once
15 
16 #ifdef SWIG
17 %module diguyParticleSystem
18 #else
19 #define CPLUSPLUS_ONLY
20 #endif
21 
22 #ifdef CPLUSPLUS_ONLY
23 #include <diguy_constants.h>
24 #include <stdlib.h>
25 #include <memory.h>
26 
27 class diguyCharacter;
28 class diguyParticleManager;
32 class diguyViewCamera;
33 class bdiVec3f;
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);
58  virtual ~diguyParticleSystem() { ; }
59  virtual const char * get_name() = 0;
60  virtual void set_name(const char * name) = 0;
61 
63  virtual int update(float dt);
64 
65  virtual void start_emitting() = 0;
66  virtual void stop_emitting() = 0;
67  virtual void pause_emitting() = 0;
68  virtual void stop_all_particles() = 0;
69  virtual void restart_particle_system() = 0;
70 
71  // optional
72  virtual void pause_update() { ; }
73  virtual void resume_update() { ; }
74 
75  virtual int get_emitting() = 0;
77  virtual int get_active_count() = 0;
78 
79  virtual void set_position(double x, double y, double z) = 0;
80  virtual void get_position(double *x, double *y, double *z) = 0;
81 
82  virtual int set_visible(int visible){ m_visible = visible; return 0; }
83  virtual int get_visible(){ return m_visible; }
84 
86  virtual void set_orientation(float * matrix) = 0;
87  virtual void set_scale(float scale) = 0;
88  virtual void set_scale(float scale_x, float scale_y, float scale_z) = 0;
89  virtual void set_time_scale(float t) = 0;
90 
94  virtual void reset_prev_position_next_update() = 0;
95 
96  //internally defined
97  diguyCharacter * get_character() { return m_character; }
98  void set_character(diguyCharacter * character) { m_character = character; }
99  void set_particle_manager(diguyParticleManager * manager){ m_particle_manager = manager; }
100  diguyParticleManager * get_particle_manager() { return m_particle_manager; }
101 
103  virtual void render(diguyGraphicsShaderProgram * shader){ ; }
105  void set_particle_renderer(diguyParticleSystemRenderer* renderer){
106  m_renderer = renderer;
107  }
108  diguyParticleSystemRenderer* get_particle_renderer(){ return m_renderer; }
110  virtual int get_ready_for_garbage_collection(){ return m_ready_for_garbage_collection; }
111  virtual void set_ready_for_garbage_collection(int value){ m_ready_for_garbage_collection = value; }
112  virtual float get_system_life_time_override(){ return m_system_life_time_override; }
113  virtual void set_system_life_time_override(float value){ m_system_life_time_override = value; }
115  virtual int get_spawned_system(){ return m_spawned_system; }
116  virtual void set_spawned_system(int value) { m_spawned_system = value; }
117 
118  // optional
119  virtual void add_collision_plane(const bdiVec3f & vPlaneNormal, const bdiVec3f & vPoint,
120  float fBounceFactor = 1.0f, int nCollisionResult = 0) {
121  ;
122  }
123 
124 protected:
125  diguyParticleManager * m_particle_manager;
127  diguyCharacter * m_character;
128  int m_visible;
129  float m_age;
130  float m_system_life_time_override;
131  int m_ready_for_garbage_collection;
132  int m_spawned_system;
133 };
134 
135 
136 //------------------------------------------------------------------------------
146 class BDI_DECLSPEC_diguy diguyParticleSystemRenderer
147 {
148 public:
151  virtual ~diguyParticleSystemRenderer() { ; }
152 
154  virtual void setup_particle_rendering(int render_pass_flags) = 0;
155 
157  virtual void end_particle_rendering(int render_pass_flags) = 0;
158 
160  virtual void draw_particle_buffer(const diguyParticleDrawDesc * draw_desc, void * particle_data) = 0;
162 public:
163  float m_camera_matrix[16];
164  float m_world_rotation_matrix[16];
165 };
166 
167 
168 //------------------------------------------------------------------------------
177 {
178  diguyParticleDrawDesc() : m_shader(NULL), m_texture(NULL), m_system(NULL), m_camera(NULL),
179  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),
183  {
184  ;
185  }
186 
189 
192 
195 
198 
200  int m_depth_write;
201 
203  int m_world_space;
204 
206  float m_scale_x, m_scale_y, m_scale_z;
207 
209  int m_blend;
210 
212  int m_src_blend_func;
213 
215  int m_dst_blend_func;
216 
218  float m_alpha_thresh;
219 
228 
231 
233  int m_active_count;
234 
237 
240 
241 };
242 
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:226
float m_brightness_multiplier
optional per particle system override for IR shader
Definition: diguyParticleSystem.h:232
int m_src_blend_func
OpenGL src blending function constant.
Definition: diguyParticleSystem.h:208
int m_particle_data_size
How large in bytes each particle is, needed for VBO stride calculations.
Definition: diguyParticleSystem.h:217
diguyParticleDrawDesc()
Definition: diguyParticleSystem.h:174
int m_active_count
number of active particles for this draw call
Definition: diguyParticleSystem.h:229
int m_particle_offset_for_normals
Definition: diguyParticleSystem.h:222
float m_alpha_thresh
alpha threshold for clipping the edges of particle system
Definition: diguyParticleSystem.h:214
diguyViewCamera * m_camera
Pointer to current diguy camera.
Definition: diguyParticleSystem.h:193
An Structure that represents a particle system draw state. This struct allows you to feed rendering i...
Definition: diguyParticleSystem.h:172
A class that represents a shared texture.
Definition: diguyGraphicsTexture.h:124
int m_render_pass_flags
current render pass flags (shadow/intersection pass etc)
Definition: diguyParticleSystem.h:235
diguyGraphicsTexture * m_texture
Texture to bind for rendering this particle system.
Definition: diguyParticleSystem.h:187
int m_particle_offset_for_colors
Following are needed for VBO stride and offset calculations.
Definition: diguyParticleSystem.h:220
The class that represents a DI-Guy Entity in the world.
Definition: diguyCharacter.h:81
int m_dst_blend_func
OpenGL dst blending function constant.
Definition: diguyParticleSystem.h:211
int m_particle_offset_for_textures
Definition: diguyParticleSystem.h:223
int m_depth_write
Should depth writing be active for this particle.
Definition: diguyParticleSystem.h:196
int m_world_space
Is this particle in world space (usually yes)
Definition: diguyParticleSystem.h:199
An interface class that allows diguy to trigger an immediate mode rendering of a diguy particle syste...
Definition: diguyParticleSystem.h:144
The class that represents a camera in the world.
Definition: diguyViewCamera.h:260
static double t
Definition: simple_playback_ogl.cpp:58
float m_scale_x
Scale values for non world space particles.
Definition: diguyParticleSystem.h:202
float m_scale_y
Definition: diguyParticleSystem.h:202
diguyGraphicsShaderProgram * m_shader
Shader that should be used to draw particle system. If null then use the Fixed Function Pipeline...
Definition: diguyParticleSystem.h:184
float m_scale_z
Definition: diguyParticleSystem.h:202
int m_particle_offset_for_verts
Definition: diguyParticleSystem.h:221
diguyParticleSystem * m_system
Pointer to actual particle system interface class.
Definition: diguyParticleSystem.h:190
This class implements shader programs for use with DI-Guy character graphics.
Definition: diguyGraphicsShaderProgram.h:94
int m_blend
Should blending be enabled.
Definition: diguyParticleSystem.h:205