doom3-gpl
Doom 3 GPL source release
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SmokeParticles.h
Go to the documentation of this file.
1 /*
2 ===========================================================================
3 
4 Doom 3 GPL Source Code
5 Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
6 
7 This file is part of the Doom 3 GPL Source Code (?Doom 3 Source Code?).
8 
9 Doom 3 Source Code is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
13 
14 Doom 3 Source Code is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18 
19 You should have received a copy of the GNU General Public License
20 along with Doom 3 Source Code. If not, see <http://www.gnu.org/licenses/>.
21 
22 In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below.
23 
24 If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
25 
26 ===========================================================================
27 */
28 
29 #ifndef __SMOKEPARTICLES_H__
30 #define __SMOKEPARTICLES_H__
31 
32 /*
33 ===============================================================================
34 
35  Smoke systems are for particles that are emitted off of things that are
36  constantly changing position and orientation, like muzzle smoke coming
37  from a bone on a weapon, blood spurting from a wound, or particles
38  trailing from a monster limb.
39 
40  The smoke particles are always evaluated and rendered each tic, so there
41  is a performance cost with using them for continuous effects. The general
42  particle systems are completely parametric, and have no performance
43  overhead when not in view.
44 
45  All smoke systems share the same shaderparms, so any coloration must be
46  done in the particle definition.
47 
48  Each particle model has its own shaderparms, which can be used by the
49  particle materials.
50 
51 ===============================================================================
52 */
53 
54 typedef struct singleSmoke_s {
55  struct singleSmoke_s * next;
56  int privateStartTime; // start time for this particular particle
57  int index; // particle index in system, 0 <= index < stage->totalParticles
61 #ifdef _D3XP
62  int timeGroup;
63 #endif
65 
66 typedef struct {
70 
71 
73 public:
74  idSmokeParticles( void );
75 
76  // creats an entity covering the entire world that will call back each rendering
77  void Init( void );
78  void Shutdown( void );
79 
80  // spits out a particle, returning false if the system will not emit any more particles in the future
81  bool EmitSmoke( const idDeclParticle *smoke, const int startTime, const float diversity,
82  const idVec3 &origin, const idMat3 &axis, int timeGroup /*_D3XP*/ );
83 
84  // free old smokes
85  void FreeSmokes( void );
86 
87 private:
89 
90  renderEntity_t renderEntity; // used to present a model to the renderer
91  int renderEntityHandle; // handle to static renderer model
92 
93  static const int MAX_SMOKE_PARTICLES = 10000;
95 
99  int currentParticleTime; // don't need to recalculate if == view time
100 
101  bool UpdateRenderEntity( renderEntity_s *renderEntity, const renderView_t *renderView );
102  static bool ModelCallback( renderEntity_s *renderEntity, const renderView_t *renderView );
103 };
104 
105 #endif /* !__SMOKEPARTICLES_H__ */
bool EmitSmoke(const idDeclParticle *smoke, const int startTime, const float diversity, const idVec3 &origin, const idMat3 &axis, int timeGroup)
struct singleSmoke_s singleSmoke_t
Definition: Vector.h:316
renderEntity_t renderEntity
singleSmoke_t * smokes
struct singleSmoke_s * next
singleSmoke_t smokes[MAX_SMOKE_PARTICLES]
static bool ModelCallback(renderEntity_s *renderEntity, const renderView_t *renderView)
idRandom random
singleSmoke_t * freeSmokes
bool UpdateRenderEntity(renderEntity_s *renderEntity, const renderView_t *renderView)
Definition: Matrix.h:333
static const int MAX_SMOKE_PARTICLES
const idParticleStage * stage
idList< activeSmokeStage_t > activeStages