DI-Guy SDK Documentation  13.8
diguyParticleSystem.h
Go to the documentation of this file.
1 /****************************************************************************
2  * Copyright (c) 2024 MAK Technologies, Inc.
3  * All rights reserved.
4  ****************************************************************************/
5 
6 /*********************************************************************/
13 #pragma once
14 
15 #ifdef SWIG
16 %module diguyParticleSystem
17 #else
18 #define CPLUSPLUS_ONLY
19 #endif
20 
21 #ifdef CPLUSPLUS_ONLY
22 #include <diguy_constants.h>
23 #include <stdlib.h>
24 #include <memory.h>
25 
26 class diguyCharacter;
27 class diguyParticleManager;
31 class diguyViewCamera;
32 class bdiVec3f;
34 
35 #endif
36 
37 #include <declspec_diguy.h>
38 
39 //------------------------------------------------------------------------------
52 class BDI_DECLSPEC_diguy diguyParticleSystem
53 {
54 
55 public:
56  diguyParticleSystem(const char * effect_name);
57  virtual ~diguyParticleSystem() { ; }
58  virtual const char * get_name() = 0;
59  virtual void set_name(const char * name) = 0;
60 
62  virtual int update(float dt);
63 
64  virtual void start_emitting() = 0;
65  virtual void stop_emitting() = 0;
66  virtual void pause_emitting() = 0;
67  virtual void stop_all_particles() = 0;
68  virtual void restart_particle_system() = 0;
69 
70  // optional
71  virtual void pause_update() {}
72  virtual void resume_update() {}
73 
74  virtual int get_emitting() = 0;
76  virtual int get_active_count() = 0;
77 
78  virtual void set_position( double x, double y, double z ) = 0;
79  virtual void get_position( double* x, double* y, double* z ) = 0;
80 
81  virtual int set_visible( int visible ) { m_visible = visible; return 0; }
82  virtual int get_visible() { return m_visible; }
83 
85  virtual void set_orientation(float * matrix) = 0;
86  virtual void set_scale(float scale) = 0;
87  virtual void set_scale(float scale_x, float scale_y, float scale_z) = 0;
88  virtual void set_time_scale(float t) = 0;
89 
93  virtual void reset_prev_position_next_update() = 0;
94 
95  //internally defined
96  diguyCharacter * get_character() { return m_character; }
97  void set_character(diguyCharacter * character) { m_character = character; }
98  void set_particle_manager(diguyParticleManager * manager){ m_particle_manager = manager; }
99  diguyParticleManager * get_particle_manager() { return m_particle_manager; }
100 
102  virtual void render(diguyGraphicsShaderProgram * shader){ ; }
104  void set_particle_renderer(diguyParticleSystemRenderer* renderer){
105  m_renderer = renderer;
106  }
107  diguyParticleSystemRenderer* get_particle_renderer(){ return m_renderer; }
109  virtual int get_ready_for_garbage_collection(){ return m_ready_for_garbage_collection; }
110  virtual void set_ready_for_garbage_collection(int value){ m_ready_for_garbage_collection = value; }
111  virtual float get_system_life_time_override(){ return m_system_life_time_override; }
112  virtual void set_system_life_time_override(float value){ m_system_life_time_override = value; }
114  virtual int get_spawned_system(){ return m_spawned_system; }
115  virtual void set_spawned_system(int value) { m_spawned_system = value; }
116 
117  // optional
118  virtual void add_collision_plane(const bdiVec3f & vPlaneNormal, const bdiVec3f & vPoint,
119  float fBounceFactor = 1.0f, int nCollisionResult = 0) {
120  ;
121  }
122 
123 protected:
124  diguyParticleManager * m_particle_manager;
126  diguyCharacter * m_character;
127  int m_visible;
128  float m_age;
129  float m_system_life_time_override;
130  int m_ready_for_garbage_collection;
131  int m_spawned_system;
132 };
133 
134 
135 //------------------------------------------------------------------------------
145 class BDI_DECLSPEC_diguy diguyParticleSystemRenderer
146 {
147 public:
150  virtual ~diguyParticleSystemRenderer() { ; }
151 
153  virtual void setup_particle_rendering(int render_pass_flags) = 0;
154 
156  virtual void end_particle_rendering(int render_pass_flags) = 0;
157 
159  virtual void draw_particle_buffer(const diguyParticleDrawDesc * draw_desc, void * particle_data) = 0;
161 public:
162  float m_camera_matrix[16];
163  float m_world_rotation_matrix[16];
164 };
165 
166 
167 //------------------------------------------------------------------------------
176 {
177  diguyParticleDrawDesc() : m_shader(NULL), m_texture(NULL), m_system(NULL), m_camera(NULL),
178  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),
182  {
183  ;
184  }
185 
188 
191 
194 
197 
199  int m_depth_write;
200 
202  int m_world_space;
203 
205  float m_scale_x, m_scale_y, m_scale_z;
206 
208  int m_blend;
209 
211  int m_src_blend_func;
212 
214  int m_dst_blend_func;
215 
217  float m_alpha_thresh;
218 
227 
230 
232  int m_active_count;
233 
236 
239 
240 };
An interface class that represents a particle system that has been created by diguy's appearance effe...
Definition: diguyParticleSystem.h:51
int m_num_verts_per_primitive
Normally 4 for GL_QUADS, but can also be 2 for GL_LINES.
Definition: diguyParticleSystem.h:225
float m_brightness_multiplier
optional per particle system override for IR shader
Definition: diguyParticleSystem.h:231
int m_src_blend_func
OpenGL src blending function constant.
Definition: diguyParticleSystem.h:207
int m_particle_data_size
How large in bytes each particle is, needed for VBO stride calculations.
Definition: diguyParticleSystem.h:216
diguyParticleDrawDesc()
Definition: diguyParticleSystem.h:173
int m_active_count
number of active particles for this draw call
Definition: diguyParticleSystem.h:228
int m_particle_offset_for_normals
Definition: diguyParticleSystem.h:221
float m_alpha_thresh
alpha threshold for clipping the edges of particle system
Definition: diguyParticleSystem.h:213
diguyViewCamera * m_camera
Pointer to current diguy camera.
Definition: diguyParticleSystem.h:192
An Structure that represents a particle system draw state. This struct allows you to feed rendering i...
Definition: diguyParticleSystem.h:171
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:234
diguyGraphicsTexture * m_texture
Texture to bind for rendering this particle system.
Definition: diguyParticleSystem.h:186
int m_particle_offset_for_colors
Following are needed for VBO stride and offset calculations.
Definition: diguyParticleSystem.h:219
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:210
int m_particle_offset_for_textures
Definition: diguyParticleSystem.h:222
int m_depth_write
Should depth writing be active for this particle.
Definition: diguyParticleSystem.h:195
int m_world_space
Is this particle in world space (usually yes)
Definition: diguyParticleSystem.h:198
An interface class that allows diguy to trigger an immediate mode rendering of a diguy particle syste...
Definition: diguyParticleSystem.h:143
The class that represents a camera in the world.
Definition: diguyViewCamera.h:260
float m_scale_x
Scale values for non world space particles.
Definition: diguyParticleSystem.h:201
float m_scale_y
Definition: diguyParticleSystem.h:201
diguyGraphicsShaderProgram * m_shader
Shader that should be used to draw particle system. If null then use the Fixed Function Pipeline...
Definition: diguyParticleSystem.h:183
float m_scale_z
Definition: diguyParticleSystem.h:201
int m_particle_offset_for_verts
Definition: diguyParticleSystem.h:220
diguyParticleSystem * m_system
Pointer to actual particle system interface class.
Definition: diguyParticleSystem.h:189
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:204