123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418 |
- #ifndef __GAME_PLAYERVIEW_H__
- #define __GAME_PLAYERVIEW_H__
- class idMenuHandler_HUD;
- typedef struct {
- const idMaterial * material;
- float x, y, w, h;
- float s1, t1, s2, t2;
- int finishTime;
- int startFadeTime;
- float driftAmount;
- } screenBlob_t;
- #define MAX_SCREEN_BLOBS 8
- class WarpPolygon_t {
- public:
- idVec4 outer1;
- idVec4 outer2;
- idVec4 center;
- };
- class Warp_t {
- public:
- int id;
- bool active;
- int startTime;
- float initialRadius;
- idVec3 worldOrigin;
- idVec2 screenOrigin;
- int durationMsec;
- idList<WarpPolygon_t, TAG_IDLIB_LIST_PLAYER> polys;
- };
- class idPlayerView;
- class FullscreenFXManager;
- class FxFader {
- enum {
- FX_STATE_OFF,
- FX_STATE_RAMPUP,
- FX_STATE_RAMPDOWN,
- FX_STATE_ON
- };
- int time;
- int state;
- float alpha;
- int msec;
- public:
- FxFader();
-
- bool SetTriggerState( bool active );
- virtual void Save( idSaveGame *savefile );
- virtual void Restore( idRestoreGame *savefile );
-
- void SetFadeTime( int t ) { msec = t; };
- int GetFadeTime() { return msec; };
-
- float GetAlpha() { return alpha; };
- };
- class FullscreenFX {
- protected:
- idStr name;
- FxFader fader;
- FullscreenFXManager *fxman;
- public:
- FullscreenFX() { fxman = NULL; };
- virtual ~FullscreenFX() { };
- virtual void Initialize() = 0;
- virtual bool Active() = 0;
- virtual void HighQuality() = 0;
- virtual void LowQuality() { };
- virtual void AccumPass( const renderView_t *view ) { };
- virtual bool HasAccum() { return false; };
- void SetName( idStr n ) { name = n; };
- idStr GetName() { return name; };
- void SetFXManager( FullscreenFXManager *fx ) { fxman = fx; };
- bool SetTriggerState( bool state ) { return fader.SetTriggerState( state ); };
- void SetFadeSpeed( int msec ) { fader.SetFadeTime( msec ); };
- float GetFadeAlpha() { return fader.GetAlpha(); };
- virtual void Save( idSaveGame *savefile );
- virtual void Restore( idRestoreGame *savefile );
- };
- class FullscreenFX_Helltime : public FullscreenFX {
- const idMaterial * initMaterial;
- const idMaterial * captureMaterials[3];
- const idMaterial * drawMaterial;
- bool clearAccumBuffer;
- int DetermineLevel();
- public:
- virtual void Initialize();
- virtual bool Active();
- virtual void HighQuality();
- virtual void AccumPass( const renderView_t *view );
- virtual bool HasAccum() { return true; };
- virtual void Restore( idRestoreGame *savefile );
- };
- class FullscreenFX_Multiplayer : public FullscreenFX {
- const idMaterial * initMaterial;
- const idMaterial * captureMaterial;
- const idMaterial * drawMaterial;
- bool clearAccumBuffer;
- int DetermineLevel();
- public:
- virtual void Initialize();
- virtual bool Active();
- virtual void HighQuality();
- virtual void AccumPass( const renderView_t *view );
- virtual bool HasAccum() { return true; };
- virtual void Restore( idRestoreGame *savefile );
- };
- class FullscreenFX_Warp : public FullscreenFX {
- const idMaterial* material;
- bool grabberEnabled;
- int startWarpTime;
- void DrawWarp( WarpPolygon_t wp, float interp );
- public:
- virtual void Initialize();
- virtual bool Active();
- virtual void HighQuality();
- void EnableGrabber( bool active ) { grabberEnabled = active; startWarpTime = gameLocal.slow.time; };
- virtual void Save( idSaveGame *savefile );
- virtual void Restore( idRestoreGame *savefile );
- };
- class FullscreenFX_EnviroSuit : public FullscreenFX {
- const idMaterial* material;
- public:
- virtual void Initialize();
- virtual bool Active();
- virtual void HighQuality();
- };
- class FullscreenFX_DoubleVision : public FullscreenFX {
- const idMaterial* material;
- public:
- virtual void Initialize();
- virtual bool Active();
- virtual void HighQuality();
- };
- class FullscreenFX_InfluenceVision : public FullscreenFX {
- public:
- virtual void Initialize();
- virtual bool Active();
- virtual void HighQuality();
- };
- class FullscreenFX_Bloom : public FullscreenFX {
- const idMaterial* drawMaterial;
- const idMaterial* initMaterial;
- float currentIntensity;
- float targetIntensity;
- public:
- virtual void Initialize();
- virtual bool Active();
- virtual void HighQuality();
- virtual void Save( idSaveGame *savefile );
- virtual void Restore( idRestoreGame *savefile );
- };
- class FullscreenFXManager {
- idList<FullscreenFX*, TAG_FX> fx;
- idPlayerView * playerView;
- const idMaterial* blendBackMaterial;
- void CreateFX( idStr name, idStr fxtype, int fade );
- public:
- FullscreenFXManager();
- virtual ~FullscreenFXManager();
- void Initialize( idPlayerView *pv );
- void Process( const renderView_t *view );
- void Blendback( float alpha );
- idPlayerView* GetPlayerView() { return playerView; };
- idPlayer* GetPlayer() { return gameLocal.GetLocalPlayer(); };
- int GetNum() { return fx.Num(); };
- FullscreenFX* GetFX( int index ) { return fx[index]; };
- FullscreenFX* FindFX( idStr name );
- void Save( idSaveGame *savefile );
- void Restore( idRestoreGame *savefile );
- };
- class idPlayerView {
- public:
- idPlayerView();
- ~idPlayerView();
- void Save( idSaveGame *savefile ) const;
- void Restore( idRestoreGame *savefile );
- void SetPlayerEntity( class idPlayer *playerEnt );
- void ClearEffects();
- void DamageImpulse( idVec3 localKickDir, const idDict *damageDef );
- void WeaponFireFeedback( const idDict *weaponDef );
- idAngles AngleOffset() const;
- idMat3 ShakeAxis() const;
- void CalculateShake();
-
-
- void RenderPlayerView( idMenuHandler_HUD * hudManager );
- void EmitStereoEyeView( const int eye, idMenuHandler_HUD * hudManager );
- void Fade( idVec4 color, int time );
- void Flash( idVec4 color, int time );
-
- void EnableBFGVision( bool b ) { bfgVision = b; };
- private:
- void SingleView( const renderView_t *view, idMenuHandler_HUD * hudManager );
- void ScreenFade();
- screenBlob_t * GetScreenBlob();
- screenBlob_t screenBlobs[MAX_SCREEN_BLOBS];
- public:
- int dvFinishTime;
- int kickFinishTime;
- idAngles kickAngles;
- bool bfgVision;
- const idMaterial * tunnelMaterial;
- const idMaterial * armorMaterial;
- const idMaterial * berserkMaterial;
- const idMaterial * irGogglesMaterial;
- const idMaterial * bloodSprayMaterial;
- const idMaterial * bfgMaterial;
- float lastDamageTime;
- idVec4 fadeColor;
- idVec4 fadeToColor;
- idVec4 fadeFromColor;
- float fadeRate;
- int fadeTime;
- idAngles shakeAng;
- idPlayer * player;
- renderView_t view;
- FullscreenFXManager *fxManager;
- public:
- int AddWarp( idVec3 worldOrigin, float centerx, float centery, float initialRadius, float durationMsec );
- void FreeWarp( int id );
- };
- bool IsGameStereoRendered();
- #endif
|