VR-Forces 4.6.1 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtTacticalSmokeEmitter.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2012 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <vrvOsg/vrvOsg.h>
13 
15 #include <osgParticle/range>
16 
17 #include <osg/CopyOp>
18 #include <osg/Object>
19 #include <osg/Vec3>
20 #include <osg/Vec4>
21 
22 #include <algorithm>
23 #include <vector>
24 
25 namespace makVrv
26 {
27 
31  {
32  public:
35 
38  const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY );
39 
40  META_Object( osgParticle, DtTacticalSmokeEmitter );
41 
45  void setPosition( int puffIndex, const osg::Vec3d& pos );
46 
50  void setDensity( int puffIndex, float dens );
51 
55  void setOneSigma( int puffIndex, const osg::Vec3& sigmas );
56 
64  void setIntensityRange( float mn, float mx );
65 
71  void setParticleSizeRange( float isz, float fsz );
72 
78  void setParticleColorRange( const osg::Vec4& icl, const osg::Vec4& fcl );
79 
85  void setParticleAlphaMultiplier( float alpha );
86 
87  protected:
92  virtual void emitParticles( double dt );
93 
96 
99  { return *this; }
100 
101  private:
103  struct PuffData
104  {
105  int index;
106  osg::Vec3d position;
107  osgParticle::rangef density;
108  osg::Vec3f sigmas;
109 
110  PuffData( int idx = 0 )
111  : index( idx )
112  , position( 0.0, 0.f, 0.0 )
113  , density( 1.0f, 0.0f )
114  , sigmas( 1.0f, 1.0f, 1.0f )
115  {}
116 
117  PuffData( const PuffData& other )
118  : index( other.index )
119  , position( other.position )
120  , density( other.density )
121  , sigmas( other.sigmas )
122  {}
123 
124  void swap( PuffData& other )
125  {
126  std::swap( index, other.index );
127  std::swap( position, other.position );
128  std::swap( density, other.density );
129  std::swap( sigmas, other.sigmas );
130  }
131 
132  PuffData& operator=( PuffData other )
133  {
134  swap( other );
135  return *this;
136  }
137  };
138 
141  typedef std::vector<PuffData> Puffs;
142 
148  PuffData& puffData( int puffIndex );
149 
150  private:
152  osgParticle::rangef myParticlesPerSec;
154  };
155 
156 }

Document ID: Generated on Wed Jul 25 16:57:45 EDT 2018 from SVN revision 190790
Copyright © 2005-2018 VT MÄK. All Rights Reserved (www.mak.com)