NLSOUND::CEnvEffect Class Reference

#include <env_effect.h>


Detailed Description

Environmental effects and where they are applied

Deprecated:
Author:
Olivier Cado

Nevrax France

Date:
2001

Definition at line 98 of file env_effect.h.

Public Member Functions

void addEnvNum (TEnvEffectPreset num, const std::string &tag="", float customsize=-1.0f)
 CEnvEffect ()
 Constructor.

IBoundingShape * getBoundingShape ()
 Access the bounding shape (EDIT).

TEnvEffectPreset getEnvNum () const
 Return the environment type.

float getEnvSize () const
 Return the environment size.

bool include (const NLMISC::CVector &pos)
 Return true if the environment includes the specified point.

void selectEnv (const std::string &tag)
 Select the current environment.

void serial (NLMISC::IStream &s)
 Serialize.

void setBoundingShape (IBoundingShape *bs)
 Set the bounding shape (EDIT).

virtual ~CEnvEffect ()
 Destructor.


Static Public Member Functions

uint32 load (std::vector< CEnvEffect * > &container, NLMISC::IStream &s)
 Load several EnvEffects and return the number of effects loaded.

void save (const std::vector< CEnvEffect > &container, NLMISC::IStream &s)
 Save (output stream only) (EDIT).

void serialFileHeader (NLMISC::IStream &s, uint32 &nb)
 Serialize file header.


Private Attributes

IBoundingShape * _BoundingShape
uint8 _Current
std::vector< TEnvEffectRoom_EnvNums
std::vector< std::string > _Tags


Constructor & Destructor Documentation

NLSOUND::CEnvEffect::CEnvEffect  ) 
 

Constructor.

Definition at line 39 of file env_effect.cpp.

Referenced by load().

00039                        : _Current(0), _BoundingShape(NULL)
00040 {
00041 }

virtual NLSOUND::CEnvEffect::~CEnvEffect  )  [inline, virtual]
 

Destructor.

Definition at line 105 of file env_effect.h.

00105 {}


Member Function Documentation

IKsPropertySet_QuerySupport void NLSOUND::CEnvEffect::addEnvNum TEnvEffectPreset  num,
const std::string &  tag = "",
float  customsize = -1.0f
 

Set the environment type (EDIT). The size of the environment is computed with the bounding shape, unless the argument customshape is positive.

Definition at line 87 of file env_effect.cpp.

References _EnvNums, _Tags, and num.

00088 {
00089         _EnvNums.push_back( TEnvEffectRoom(num,customsize) );
00090         _Tags.push_back( tag );
00091 }

IBoundingShape* NLSOUND::CEnvEffect::getBoundingShape  )  [inline]
 

Access the bounding shape (EDIT).

Definition at line 135 of file env_effect.h.

References _BoundingShape.

00135 { return _BoundingShape; }

TEnvEffectPreset NLSOUND::CEnvEffect::getEnvNum  )  const [inline]
 

Return the environment type.

Definition at line 124 of file env_effect.h.

References _Current, _EnvNums, and NLSOUND::TEnvEffectPreset.

00124 { return _EnvNums[_Current].Preset; }

float NLSOUND::CEnvEffect::getEnvSize  )  const
 

Return the environment size.

Definition at line 97 of file env_effect.cpp.

References _BoundingShape, _Current, and _EnvNums.

00098 {
00099         if ( _EnvNums[_Current].Size > 0 )
00100         {
00101                 return _EnvNums[_Current].Size;
00102         }
00103         else
00104         {
00105                 return _BoundingShape->getDiameter();
00106         }
00107 }

bool NLSOUND::CEnvEffect::include const NLMISC::CVector pos  )  [inline]
 

Return true if the environment includes the specified point.

Definition at line 120 of file env_effect.h.

References _BoundingShape.

00120 { return _BoundingShape->include( pos ); }

uint32 NLSOUND::CEnvEffect::load std::vector< CEnvEffect * > &  container,
NLMISC::IStream s
[static]
 

Load several EnvEffects and return the number of effects loaded.

Definition at line 62 of file env_effect.cpp.

References CEnvEffect(), nlstop, s, serialFileHeader(), and uint32.

00063 {
00064         if ( s.isReading() )
00065         {
00066                 uint32 i, nb;
00067                 serialFileHeader( s, nb );
00068                 for ( i=0; i!=nb; i++ )
00069                 {
00070                         CEnvEffect *enveffect = new CEnvEffect();
00071                         s.serial( *enveffect );
00072                         container.push_back( enveffect );
00073                 }
00074                 return nb;
00075         }
00076         else
00077         {
00078                 nlstop;
00079                 return 0;
00080         }
00081 }

void NLSOUND::CEnvEffect::save const std::vector< CEnvEffect > &  container,
NLMISC::IStream s
[static]
 

Save (output stream only) (EDIT).

Definition at line 133 of file env_effect.cpp.

References nlassert, s, serialFileHeader(), and uint32.

00134 {
00135         nlassert( ! s.isReading() );
00136 
00137         uint32 nb=container.size(), i;
00138         serialFileHeader( s, nb );
00139         for ( i=0; i!=nb; i++ )
00140         {
00141                 s.serial( const_cast<CEnvEffect&>(container[i]) );
00142         }
00143 }

void NLSOUND::CEnvEffect::selectEnv const std::string &  tag  ) 
 

Select the current environment.

Definition at line 113 of file env_effect.cpp.

References _Current, _Tags, nldebug, and uint.

00114 {
00115         uint i;
00116         for ( i=0; i!= _Tags.size(); i++ )
00117         {
00118                 if ( _Tags[i] == tag )
00119                 {
00120                         _Current = i;
00121                         nldebug( "AM: EnvEffect: Environment changed to %s", tag.c_str() );
00122                         return;
00123                 }
00124         }
00125         nldebug( "AM: EnvEffect: Environment %s not found", tag.c_str() );
00126         // Don't change _Current if not found
00127 }

void NLSOUND::CEnvEffect::serial NLMISC::IStream s  )  [inline]
 

Serialize.

Definition at line 107 of file env_effect.h.

References _BoundingShape, _EnvNums, _Tags, and s.

00108         {
00109                 // If you change this, increment the version number in serialFileHeader()
00110                 s.serialPolyPtr( _BoundingShape );
00111                 s.serialCont( _EnvNums );
00112                 s.serialCont( _Tags );
00113         }

void NLSOUND::CEnvEffect::serialFileHeader NLMISC::IStream s,
uint32 nb
[static]
 

Serialize file header.

Definition at line 47 of file env_effect.cpp.

References s, and uint32.

Referenced by load(), and save().

00048 {
00049         s.serialCheck( (uint32)'FEN' ); // NeL Environment FX
00050         if ( s.serialVersion( 2 ) < 2 )
00051         {
00052                 throw EOlderStream(s);
00053         }
00054         
00055         s.serial( nb );
00056 }

void NLSOUND::CEnvEffect::setBoundingShape IBoundingShape *  bs  )  [inline]
 

Set the bounding shape (EDIT).

Definition at line 137 of file env_effect.h.

References _BoundingShape.

00137 { _BoundingShape = bs; }


Field Documentation

IBoundingShape* NLSOUND::CEnvEffect::_BoundingShape [private]
 

Definition at line 154 of file env_effect.h.

Referenced by getBoundingShape(), getEnvSize(), include(), serial(), and setBoundingShape().

uint8 NLSOUND::CEnvEffect::_Current [private]
 

Definition at line 145 of file env_effect.h.

Referenced by getEnvNum(), getEnvSize(), and selectEnv().

std::vector<TEnvEffectRoom> NLSOUND::CEnvEffect::_EnvNums [private]
 

Definition at line 148 of file env_effect.h.

Referenced by addEnvNum(), getEnvNum(), getEnvSize(), and serial().

std::vector<std::string> NLSOUND::CEnvEffect::_Tags [private]
 

Definition at line 151 of file env_effect.h.

Referenced by addEnvNum(), selectEnv(), and serial().


The documentation for this class was generated from the following files:
Generated on Tue Mar 16 14:38:15 2004 for NeL by doxygen 1.3.6