204 lines
7.0 KiB
C
204 lines
7.0 KiB
C
/*
|
|
MODULE : PRT (Particle system Library)
|
|
AUTHOR : Frederic PHILIPPE
|
|
UBI R&D
|
|
FILE : PRT.h (Principal header file)
|
|
*/
|
|
#ifndef D_THROW_PRT
|
|
|
|
#ifndef PRT_PRTSRC_H
|
|
#define PRT_PRTSRC_H
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif /* __cplusplus */
|
|
|
|
#include "cpa_expt.h"
|
|
|
|
/* For Global declaration in C files : */
|
|
#ifdef PRT_GLOBALS
|
|
#define PRT_EXTERN extern
|
|
#else /* !PRT_GLOBALS */
|
|
#define PRT_EXTERN
|
|
#endif /* !PRT_GLOBALS */
|
|
|
|
/*
|
|
-----------------------------------------------------------------------------
|
|
INCLUDES FILES
|
|
-----------------------------------------------------------------------------
|
|
*/
|
|
|
|
/*#include "Futil.h"*/
|
|
|
|
/*
|
|
-----------------------------------------------------------------------------
|
|
CONSTANT DECLARATION
|
|
-----------------------------------------------------------------------------
|
|
*/
|
|
|
|
#define PRT_C_ucNoGeneration 0
|
|
#define PRT_C_ucContinousGeneration 1
|
|
#define PRT_C_ucProbabilistGeneration 2
|
|
#define PRT_C_ucCrenelGeneration 3
|
|
|
|
#define PRT_C_ucConstantNb 0
|
|
#define PRT_C_ucProbabilistNb 1
|
|
|
|
#define PRT_C_ucPoint 0
|
|
#define PRT_C_ucQuad 1
|
|
#define PRT_C_ucParallelepipede 2
|
|
|
|
#define PRT_C_ucRotationLink 0
|
|
#define PRT_C_ucTranslationLink 1
|
|
#define PRT_C_ucRotAndTransLink 2
|
|
|
|
#define PRT_C_ucNoLifeTime 0
|
|
#define PRT_C_ucConstantLifeTime 1
|
|
#define PRT_C_ucProbabilistLifeTime 2
|
|
|
|
/*
|
|
-----------------------------------------------------------------------------
|
|
TYPES DEFINITION
|
|
-----------------------------------------------------------------------------
|
|
*/
|
|
|
|
/* source particules structure */
|
|
typedef struct PRT_tdstParticlesSource_
|
|
{
|
|
/* parametres de generation */
|
|
unsigned char ucGenerationMode;
|
|
MTH_tdxReal xGenerationProbability;
|
|
ACP_tdxIndex xNbFramesNoGeneration;
|
|
ACP_tdxIndex xNbFramesTotal;
|
|
ACP_tdxIndex xFramesCounter;
|
|
|
|
unsigned char ucNbParticlesToGenerateMode;
|
|
ACP_tdxIndex xNbParticlesToGenerate;
|
|
ACP_tdxIndex xNbMin;
|
|
ACP_tdxIndex xNbMax;
|
|
|
|
/* parametres geometriques */
|
|
/* source parallelelogramme */
|
|
/* 3_____________ */
|
|
/* N_ |\__ | */
|
|
/* / \ | \__ | */
|
|
/* |*| | \__ | */
|
|
/* \_/ | \__ | */
|
|
/* 1|____________\2 */
|
|
/* */
|
|
unsigned char ucGeometryMode;
|
|
unsigned char ucLinkMode;
|
|
MTH3D_tdstVector stVertex1;
|
|
MTH3D_tdstVector stVertex2;
|
|
MTH3D_tdstVector stVertex3;
|
|
MTH3D_tdstVector stNormal;
|
|
MTH3D_tdstVector stVertex4;
|
|
|
|
/* vitesse initiale */
|
|
MTH_tdxReal xSpeed;
|
|
MTH_tdxReal xSpeedRange;
|
|
|
|
unsigned char ucLifeMode;
|
|
MTH_tdxReal xMinTime;
|
|
MTH_tdxReal xMaxTime;
|
|
}
|
|
PRT_tdstParticlesSource;
|
|
|
|
/*
|
|
-----------------------------------------------------------------------------
|
|
GLOBAL VARIABLE DECLARATION
|
|
-----------------------------------------------------------------------------
|
|
*/
|
|
|
|
extern MTH_tdxReal PRT_g_xNbParticlesFactor;
|
|
|
|
/*
|
|
-----------------------------------------------------------------------------
|
|
FUNCTIONS DECLARATION
|
|
-----------------------------------------------------------------------------
|
|
*/
|
|
|
|
#define PRT_M_vCopyCloneParticlesSource( _p_stDstParticlesSource, _p_stSrcParticlesSource )\
|
|
memcpy ( _p_stDstParticlesSource, _p_stSrcParticlesSource, sizeof ( PRT_tdstParticlesSource ) )
|
|
|
|
#define PRT_M_vSetGenerationModeParticlesSource( _p_stParticlesSource, _ucGenerationMode )\
|
|
( (_p_stParticlesSource)->ucGenerationMode = ( _ucGenerationMode ) )
|
|
|
|
#define PRT_M_vSetGenerationProbabilityParticlesSource( _p_stParticlesSource, _xGenerationProbability )\
|
|
( (_p_stParticlesSource)->xGenerationProbability = ( _xGenerationProbability ) )
|
|
|
|
#define PRT_M_vSetNbFramesCrenelParticlesSource( _p_stParticlesSource, _xNbFramesNoGeneration, _xNbFramesGeneration )\
|
|
{\
|
|
(_p_stParticlesSource)->xNbFramesNoGeneration = (ACP_tdxIndex) ( _xNbFramesNoGeneration );\
|
|
(_p_stParticlesSource)->xNbFramesTotal = (ACP_tdxIndex) (( _xNbFramesNoGeneration ) + ( _xNbFramesGeneration ));\
|
|
(_p_stParticlesSource)->xFramesCounter = 0;\
|
|
}
|
|
|
|
#define PRT_M_vSetNbParticlesToGenerateModeParticlesSource( _p_stParticlesSource, _ucNbParticlesToGenerateMode )\
|
|
( (_p_stParticlesSource)->ucNbParticlesToGenerateMode = ( _ucNbParticlesToGenerateMode ) )
|
|
|
|
#define PRT_M_vSetNbParticlesToGenerateParticlesSource( _p_stParticlesSource, _xNbParticlesToGenerate )\
|
|
( (_p_stParticlesSource)->xNbParticlesToGenerate = ( _xNbParticlesToGenerate ) )
|
|
|
|
#define PRT_M_vSetFlowParticlesSource( _p_stParticlesSource, _xFlow, _xDeltaT )\
|
|
( (_p_stParticlesSource)->xNbParticlesToGenerate = MTH_M_xRealToLong ( MTH_M_xMul ( ( _xFlow ), ( _xDeltaT ) ) ) )
|
|
|
|
#define PRT_M_vSetNbMinMaxParticlesSource( _p_stParticlesSource, _xNbMin, _xNbMax )\
|
|
{\
|
|
(_p_stParticlesSource)->xNbMin = ( _xNbMin );\
|
|
(_p_stParticlesSource)->xNbMax = ( _xNbMax );\
|
|
}
|
|
|
|
#define PRT_M_vSetGeometryModeParticlesSource( _p_stParticlesSource, _ucGeometryMode )\
|
|
( (_p_stParticlesSource)->ucGeometryMode = ( _ucGeometryMode ) )
|
|
|
|
#define PRT_M_vSetLinkModeParticlesSource( _p_stParticlesSource, _ucLinkMode )\
|
|
( (_p_stParticlesSource)->ucLinkMode = ( _ucLinkMode ) )
|
|
|
|
#define PRT_M_vSetSpeedParticlesSource( _p_stParticlesSource, _xSpeed )\
|
|
( (_p_stParticlesSource)->xSpeed = ( _xSpeed ) )
|
|
|
|
#define PRT_M_vSetVertex4ParticlesSource( _p_stParticlesSource, _p_stVertex4 )\
|
|
{\
|
|
MTH3D_M_vCopyVector ( &((_p_stParticlesSource)->stVertex4), ( _p_stVertex4 ) );\
|
|
}
|
|
|
|
#define PRT_M_vSetSpeedRangeParticlesSource( _p_stParticlesSource, _xSpeedRange )\
|
|
( (_p_stParticlesSource)->xSpeedRange = ( _xSpeedRange ) )
|
|
|
|
#define PRT_M_vSetLifeModeParticlesSource( _p_stParticlesSource, _ucLifeMode )\
|
|
( (_p_stParticlesSource)->ucLifeMode = ( _ucLifeMode ) )
|
|
|
|
#define PRT_M_vSetLifeTimeParticlesSource( _p_stParticlesSource, _xLifeTime )\
|
|
( (_p_stParticlesSource)->xMinTime = ( _xLifeTime ) )
|
|
|
|
#define PRT_M_vSetMinMaxLifeTimeParticlesSource( _p_stParticlesSource, _xMinTime, _xMaxTime )\
|
|
{\
|
|
(_p_stParticlesSource)->xMinTime = ( _xMinTime );\
|
|
(_p_stParticlesSource)->xMaxTime = ( _xMaxTime );\
|
|
}
|
|
|
|
extern CPA_EXPORT void PRT_fn_vCreateParticlesSource ( PRT_tdstParticlesSource **_p_pstParticlesSource );
|
|
|
|
extern CPA_EXPORT void PRT_fn_vDestructParticlesSource ( PRT_tdstParticlesSource *_p_stParticlesSource );
|
|
|
|
extern CPA_EXPORT void PRT_fn_vSetQuadParticlesSource ( PRT_tdstParticlesSource *_p_stParticlesSource,
|
|
MTH3D_tdstVector *_p_stVertex1,
|
|
MTH3D_tdstVector *_p_stVertex2,
|
|
MTH3D_tdstVector *_p_stVertex3 );
|
|
|
|
extern CPA_EXPORT void PRT_fn_vSetPointParticlesSource ( PRT_tdstParticlesSource *_p_stParticlesSource, MTH3D_tdstVector *_p_stVertex );
|
|
|
|
extern CPA_EXPORT ACP_tdxBool PRT_fn_bComputeParticlesGeneration ( PRT_tdstParticlesSource *_p_stParticlesSource );
|
|
|
|
extern CPA_EXPORT ACP_tdxIndex PRT_fn_xComputeNbParticlesToInject ( PRT_tdstParticlesSource *_p_stParticlesSource );
|
|
|
|
extern CPA_EXPORT void PRT_fn_vSetNbParticlesFactor ( MTH_tdxReal _xNbParticlesFactor );
|
|
|
|
#ifdef __cplusplus
|
|
};
|
|
#endif /* __cplusplus */
|
|
|
|
#endif /* PRT_PRTSRC_H */
|
|
#endif /* D_THROW_PRT */
|