2 ===========================================================================
5 Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
7 This file is part of the Doom 3 GPL Source Code (?Doom 3 Source Code?).
9 Doom 3 Source Code is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
14 Doom 3 Source Code is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with Doom 3 Source Code. If not, see <http://www.gnu.org/licenses/>.
22 In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below.
24 If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
26 ===========================================================================
29 #ifndef __GAME_PLAYERVIEW_H__
30 #define __GAME_PLAYERVIEW_H__
33 ===============================================================================
37 ===============================================================================
40 // screenBlob_t are for the on-screen damage claw marks, etc
42 const idMaterial * material;
50 #define MAX_SCREEN_BLOBS 8
77 idList<WarpPolygon_t> polys;
90 class FullscreenFXManager;
115 bool SetTriggerState( bool active );
117 virtual void Save( idSaveGame *savefile );
118 virtual void Restore( idRestoreGame *savefile );
121 void SetFadeTime( int t ) { msec = t; };
122 int GetFadeTime() { return msec; };
125 float GetAlpha() { return alpha; };
138 FullscreenFXManager *fxman;
141 FullscreenFX() { fxman = NULL; };
142 virtual ~FullscreenFX() { };
144 virtual void Initialize() = 0;
145 virtual bool Active() = 0;
146 virtual void HighQuality() = 0;
147 virtual void LowQuality() { };
148 virtual void AccumPass( const renderView_t *view ) { };
149 virtual bool HasAccum() { return false; };
151 void SetName( idStr n ) { name = n; };
152 idStr GetName() { return name; };
154 void SetFXManager( FullscreenFXManager *fx ) { fxman = fx; };
156 bool SetTriggerState( bool state ) { return fader.SetTriggerState( state ); };
157 void SetFadeSpeed( int msec ) { fader.SetFadeTime( msec ); };
158 float GetFadeAlpha() { return fader.GetAlpha(); };
160 virtual void Save( idSaveGame *savefile );
161 virtual void Restore( idRestoreGame *savefile );
166 FullscreenFX_Helltime
169 class FullscreenFX_Helltime : public FullscreenFX {
170 const idMaterial* acInitMaterials[3];
171 const idMaterial* acCaptureMaterials[3];
172 const idMaterial* acDrawMaterials[3];
173 const idMaterial* crCaptureMaterials[3];
174 const idMaterial* crDrawMaterials[3];
175 bool clearAccumBuffer;
177 int DetermineLevel();
180 virtual void Initialize();
181 virtual bool Active();
182 virtual void HighQuality();
183 virtual void AccumPass( const renderView_t *view );
184 virtual bool HasAccum() { return true; };
186 virtual void Restore( idRestoreGame *savefile );
191 FullscreenFX_Multiplayer
194 class FullscreenFX_Multiplayer : public FullscreenFX {
195 const idMaterial* acInitMaterials;
196 const idMaterial* acCaptureMaterials;
197 const idMaterial* acDrawMaterials;
198 const idMaterial* crCaptureMaterials;
199 const idMaterial* crDrawMaterials;
200 bool clearAccumBuffer;
202 int DetermineLevel();
205 virtual void Initialize();
206 virtual bool Active();
207 virtual void HighQuality();
208 virtual void AccumPass( const renderView_t *view );
209 virtual bool HasAccum() { return true; };
211 virtual void Restore( idRestoreGame *savefile );
219 class FullscreenFX_Warp : public FullscreenFX {
220 const idMaterial* material;
224 void DrawWarp( WarpPolygon_t wp, float interp );
227 virtual void Initialize();
228 virtual bool Active();
229 virtual void HighQuality();
231 void EnableGrabber( bool active ) { grabberEnabled = active; startWarpTime = gameLocal.slow.time; };
233 virtual void Save( idSaveGame *savefile );
234 virtual void Restore( idRestoreGame *savefile );
239 FullscreenFX_EnviroSuit
242 class FullscreenFX_EnviroSuit : public FullscreenFX {
243 const idMaterial* material;
246 virtual void Initialize();
247 virtual bool Active();
248 virtual void HighQuality();
253 FullscreenFX_DoubleVision
256 class FullscreenFX_DoubleVision : public FullscreenFX {
257 const idMaterial* material;
260 virtual void Initialize();
261 virtual bool Active();
262 virtual void HighQuality();
267 FullscreenFX_InfluenceVision
270 class FullscreenFX_InfluenceVision : public FullscreenFX {
273 virtual void Initialize();
274 virtual bool Active();
275 virtual void HighQuality();
283 class FullscreenFX_Bloom : public FullscreenFX {
284 const idMaterial* drawMaterial;
285 const idMaterial* initMaterial;
286 const idMaterial* currentMaterial;
288 float currentIntensity;
289 float targetIntensity;
292 virtual void Initialize();
293 virtual bool Active();
294 virtual void HighQuality();
296 virtual void Save( idSaveGame *savefile );
297 virtual void Restore( idRestoreGame *savefile );
307 class FullscreenFXManager {
308 idList<FullscreenFX*> fx;
309 bool highQualityMode;
312 idPlayerView *playerView;
313 const idMaterial* blendBackMaterial;
315 void CreateFX( idStr name, idStr fxtype, int fade );
318 FullscreenFXManager();
319 virtual ~FullscreenFXManager();
321 void Initialize( idPlayerView *pv );
323 void Process( const renderView_t *view );
324 void CaptureCurrentRender();
325 void Blendback( float alpha );
327 idVec2 GetShiftScale() { return shiftScale; };
328 idPlayerView* GetPlayerView() { return playerView; };
329 idPlayer* GetPlayer() { return gameLocal.GetLocalPlayer(); };
331 int GetNum() { return fx.Num(); };
332 FullscreenFX* GetFX( int index ) { return fx[index]; };
333 FullscreenFX* FindFX( idStr name );
335 void Save( idSaveGame *savefile );
336 void Restore( idRestoreGame *savefile );
353 void Save( idSaveGame *savefile ) const;
354 void Restore( idRestoreGame *savefile );
356 void SetPlayerEntity( class idPlayer *playerEnt );
358 void ClearEffects( void );
360 void DamageImpulse( idVec3 localKickDir, const idDict *damageDef );
362 void WeaponFireFeedback( const idDict *weaponDef );
364 idAngles AngleOffset( void ) const; // returns the current kick angle
366 idMat3 ShakeAxis( void ) const; // returns the current shake angle
368 void CalculateShake( void );
370 // this may involve rendering to a texture and displaying
371 // that with a warp model or in double vision mode
372 void RenderPlayerView( idUserInterface *hud );
374 void Fade( idVec4 color, int time );
376 void Flash( idVec4 color, int time );
378 void AddBloodSpray( float duration );
380 // temp for view testing
381 void EnableBFGVision( bool b ) { bfgVision = b; };
384 void SingleView( idUserInterface *hud, const renderView_t *view );
387 screenBlob_t * GetScreenBlob();
389 screenBlob_t screenBlobs[MAX_SCREEN_BLOBS];
392 int dvFinishTime; // double vision will be stopped at this time
393 const idMaterial * dvMaterial; // material to take the double vision screen shot
395 int kickFinishTime; // view kick will be stopped at this time
400 const idMaterial * tunnelMaterial; // health tunnel vision
401 const idMaterial * armorMaterial; // armor damage view effect
402 const idMaterial * berserkMaterial; // berserk effect
403 const idMaterial * irGogglesMaterial; // ir effect
404 const idMaterial * bloodSprayMaterial; // blood spray
405 const idMaterial * bfgMaterial; // when targeted with BFG
406 const idMaterial * lagoMaterial; // lagometer drawing
407 float lastDamageTime; // accentuate the tunnel effect for a while
409 idVec4 fadeColor; // fade color
410 idVec4 fadeToColor; // color to fade to
411 idVec4 fadeFromColor; // color to fade from
412 float fadeRate; // fade rate
413 int fadeTime; // fade time
415 idAngles shakeAng; // from the sound sources
421 FullscreenFXManager *fxManager;
424 int AddWarp( idVec3 worldOrigin, float centerx, float centery, float initialRadius, float durationMsec );
425 void FreeWarp( int id );
429 #endif /* !__GAME_PLAYERVIEW_H__ */