mirror of
https://github.com/jmarshall23/DoomRTX.git
synced 2026-08-17 11:00:38 +02:00
Fixed particles for Prey.
This commit is contained in:
@@ -39,14 +39,23 @@ If you have questions concerning this license or the applicable additional terms
|
||||
|
||||
class idParticleParm {
|
||||
public:
|
||||
idParticleParm( void ) { table = NULL; from = to = 0.0f; }
|
||||
idParticleParm(void) {
|
||||
table = NULL;
|
||||
from = to = 0.0f;
|
||||
#ifdef PREY
|
||||
randomp = 0.0f;
|
||||
#endif
|
||||
}
|
||||
|
||||
const idDeclTable * table;
|
||||
const idDeclTable* table;
|
||||
float from;
|
||||
float to;
|
||||
|
||||
float Eval( float frac, idRandom &rand ) const;
|
||||
float Integrate( float frac, idRandom &rand ) const;
|
||||
#ifdef PREY
|
||||
float randomp; // HUMANHEAD bjk
|
||||
#endif
|
||||
|
||||
float Eval(float frac, idRandom& rand) const;
|
||||
float Integrate(float frac, idRandom& rand) const;
|
||||
};
|
||||
|
||||
|
||||
@@ -83,15 +92,14 @@ typedef struct renderEntity_s renderEntity_t;
|
||||
typedef struct renderView_s renderView_t;
|
||||
|
||||
typedef struct {
|
||||
const renderEntity_t * renderEnt; // for shaderParms, etc
|
||||
const renderView_t * renderView;
|
||||
const renderEntity_t* renderEnt; // for shaderParms, etc
|
||||
const renderView_t* renderView;
|
||||
int index; // particle number in the system
|
||||
float frac; // 0.0 to 1.0
|
||||
idRandom random;
|
||||
idVec3 origin; // dynamic smoke particles can have individual origins and axis
|
||||
idMat3 axis;
|
||||
|
||||
|
||||
float age; // in seconds, calculated as fraction * stage->particleLife
|
||||
idRandom originalRandom; // needed so aimed particles can reset the random for another origin calculation
|
||||
float animationFrameFrac; // set by ParticleTexCoords, used to make the cross faded version
|
||||
@@ -103,33 +111,33 @@ typedef struct {
|
||||
//
|
||||
class idParticleStage {
|
||||
public:
|
||||
idParticleStage( void );
|
||||
virtual ~idParticleStage( void ) {}
|
||||
idParticleStage(void);
|
||||
virtual ~idParticleStage(void) {}
|
||||
|
||||
void Default();
|
||||
virtual int NumQuadsPerParticle() const; // includes trails and cross faded animations
|
||||
// returns the number of verts created, which will range from 0 to 4*NumQuadsPerParticle()
|
||||
virtual int CreateParticle( particleGen_t *g, idDrawVert *verts ) const;
|
||||
virtual int CreateParticle(particleGen_t* g, idDrawVert* verts) const;
|
||||
|
||||
void ParticleOrigin( particleGen_t *g, idVec3 &origin ) const;
|
||||
int ParticleVerts( particleGen_t *g, const idVec3 origin, idDrawVert *verts ) const;
|
||||
void ParticleTexCoords( particleGen_t *g, idDrawVert *verts ) const;
|
||||
void ParticleColors( particleGen_t *g, idDrawVert *verts ) const;
|
||||
void ParticleOrigin(particleGen_t* g, idVec3& origin) const;
|
||||
int ParticleVerts(particleGen_t* g, const idVec3 origin, idDrawVert* verts) const;
|
||||
void ParticleTexCoords(particleGen_t* g, idDrawVert* verts) const;
|
||||
void ParticleColors(particleGen_t* g, idDrawVert* verts) const;
|
||||
|
||||
const char * GetCustomPathName();
|
||||
const char * GetCustomPathDesc();
|
||||
const char* GetCustomPathName();
|
||||
const char* GetCustomPathDesc();
|
||||
int NumCustomPathParms();
|
||||
void SetCustomPathType( const char *p );
|
||||
void operator=( const idParticleStage &src );
|
||||
void SetCustomPathType(const char* p);
|
||||
void operator=(const idParticleStage& src);
|
||||
|
||||
|
||||
//------------------------------
|
||||
|
||||
const idMaterial * material;
|
||||
const idMaterial* material;
|
||||
|
||||
int totalParticles; // total number of particles, although some may be invisible at a given time
|
||||
float cycles; // allows things to oneShot ( 1 cycle ) or run for a set number of cycles
|
||||
// on a per stage basis
|
||||
// on a per stage basis
|
||||
|
||||
int cycleMsec; // ( particleLife + deadTime ) in msec
|
||||
|
||||
@@ -137,37 +145,37 @@ public:
|
||||
float particleLife; // total seconds of life for each particle
|
||||
float timeOffset; // time offset from system start for the first particle to spawn
|
||||
float deadTime; // time after particleLife before respawning
|
||||
|
||||
|
||||
//------------------------------- // standard path parms
|
||||
|
||||
|
||||
prtDistribution_t distributionType;
|
||||
float distributionParms[4];
|
||||
|
||||
|
||||
prtDirection_t directionType;
|
||||
float directionParms[4];
|
||||
|
||||
|
||||
idParticleParm speed;
|
||||
float gravity; // can be negative to float up
|
||||
bool worldGravity; // apply gravity in world space
|
||||
bool randomDistribution; // randomly orient the quad on emission ( defaults to true )
|
||||
bool entityColor; // force color from render entity ( fadeColor is still valid )
|
||||
|
||||
|
||||
//------------------------------ // custom path will completely replace the standard path calculations
|
||||
|
||||
|
||||
prtCustomPth_t customPathType; // use custom C code routines for determining the origin
|
||||
float customPathParms[8];
|
||||
|
||||
|
||||
//--------------------------------
|
||||
|
||||
|
||||
idVec3 offset; // offset from origin to spawn all particles, also applies to customPath
|
||||
|
||||
|
||||
int animationFrames; // if > 1, subdivide the texture S axis into frames and crossfade
|
||||
float animationRate; // frames per second
|
||||
|
||||
float initialAngle; // in degrees, random angle is used if zero ( default )
|
||||
idParticleParm rotationSpeed; // half the particles will have negative rotation speeds
|
||||
|
||||
prtOrientation_t orientation; // view, aimed, or axis fixed
|
||||
|
||||
prtOrientation_t orientation; // view, aimed, or axis fixed
|
||||
float orientationParms[4];
|
||||
|
||||
idParticleParm size;
|
||||
@@ -185,6 +193,10 @@ public:
|
||||
float boundsExpansion; // user tweak to fix poorly calculated bounds
|
||||
|
||||
idBounds bounds; // derived
|
||||
|
||||
#ifdef PREY
|
||||
bool lowSkippable; // HUMANHEAD bjk
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
@@ -194,25 +206,38 @@ public:
|
||||
class idDeclParticle : public idDecl {
|
||||
public:
|
||||
|
||||
virtual size_t Size( void ) const;
|
||||
virtual const char * DefaultDefinition( void ) const;
|
||||
virtual bool Parse( const char *text, const int textLength );
|
||||
virtual void FreeData( void );
|
||||
virtual size_t Size(void) const;
|
||||
virtual const char* DefaultDefinition(void) const;
|
||||
virtual bool Parse(const char* text, const int textLength);
|
||||
virtual void FreeData(void);
|
||||
|
||||
bool Save( const char *fileName = NULL );
|
||||
bool Save(const char* fileName = NULL);
|
||||
|
||||
idList<idParticleStage *>stages;
|
||||
idList<idParticleStage*>stages;
|
||||
idBounds bounds;
|
||||
float depthHack;
|
||||
|
||||
private:
|
||||
bool RebuildTextSource( void );
|
||||
void GetStageBounds( idParticleStage *stage );
|
||||
idParticleStage * ParseParticleStage( idLexer &src );
|
||||
void ParseParms( idLexer &src, float *parms, int maxParms );
|
||||
void ParseParametric( idLexer &src, idParticleParm *parm );
|
||||
void WriteStage( idFile *f, idParticleStage *stage );
|
||||
void WriteParticleParm( idFile *f, idParticleParm *parm, const char *name );
|
||||
bool RebuildTextSource(void);
|
||||
|
||||
#ifdef PREY
|
||||
void CalcBounds(void); // HUMANHEAD bjk
|
||||
|
||||
# ifdef PARTICLE_BOUNDS
|
||||
void GetStageBounds(idParticleStage* stage, idDrawVert* particleVerts);
|
||||
# else
|
||||
void GetStageBounds(idParticleStage* stage);
|
||||
# endif
|
||||
|
||||
#else
|
||||
void GetStageBounds(idParticleStage* stage);
|
||||
#endif
|
||||
|
||||
idParticleStage* ParseParticleStage(idLexer& src);
|
||||
void ParseParms(idLexer& src, float* parms, int maxParms);
|
||||
void ParseParametric(idLexer& src, idParticleParm* parm);
|
||||
void WriteStage(idFile* f, idParticleStage* stage);
|
||||
void WriteParticleParm(idFile* f, idParticleParm* parm, const char* name);
|
||||
};
|
||||
|
||||
#endif /* !__DECLPARTICLE_H__ */
|
||||
|
||||
Reference in New Issue
Block a user