Camera.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. /*
  2. ===========================================================================
  3. Doom 3 GPL Source Code
  4. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
  5. This file is part of the Doom 3 GPL Source Code (?Doom 3 Source Code?).
  6. Doom 3 Source Code is free software: you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation, either version 3 of the License, or
  9. (at your option) any later version.
  10. Doom 3 Source Code is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. GNU General Public License for more details.
  14. You should have received a copy of the GNU General Public License
  15. along with Doom 3 Source Code. If not, see <http://www.gnu.org/licenses/>.
  16. 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.
  17. 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.
  18. ===========================================================================
  19. */
  20. #ifndef __GAME_CAMERA_H__
  21. #define __GAME_CAMERA_H__
  22. /*
  23. ===============================================================================
  24. Camera providing an alternative view of the level.
  25. ===============================================================================
  26. */
  27. class idCamera : public idEntity {
  28. public:
  29. ABSTRACT_PROTOTYPE( idCamera );
  30. void Spawn( void );
  31. virtual void GetViewParms( renderView_t *view ) = 0;
  32. virtual renderView_t * GetRenderView();
  33. virtual void Stop( void ){} ;
  34. };
  35. /*
  36. ===============================================================================
  37. idCameraView
  38. ===============================================================================
  39. */
  40. class idCameraView : public idCamera {
  41. public:
  42. CLASS_PROTOTYPE( idCameraView );
  43. idCameraView();
  44. // save games
  45. void Save( idSaveGame *savefile ) const; // archives object for save game file
  46. void Restore( idRestoreGame *savefile ); // unarchives object from save game file
  47. void Spawn( );
  48. virtual void GetViewParms( renderView_t *view );
  49. virtual void Stop( void );
  50. protected:
  51. void Event_Activate( idEntity *activator );
  52. void Event_SetAttachments();
  53. void SetAttachment( idEntity **e, const char *p );
  54. float fov;
  55. idEntity *attachedTo;
  56. idEntity *attachedView;
  57. };
  58. /*
  59. ===============================================================================
  60. A camera which follows a path defined by an animation.
  61. ===============================================================================
  62. */
  63. typedef struct {
  64. idCQuat q;
  65. idVec3 t;
  66. float fov;
  67. } cameraFrame_t;
  68. class idCameraAnim : public idCamera {
  69. public:
  70. CLASS_PROTOTYPE( idCameraAnim );
  71. idCameraAnim();
  72. ~idCameraAnim();
  73. // save games
  74. void Save( idSaveGame *savefile ) const; // archives object for save game file
  75. void Restore( idRestoreGame *savefile ); // unarchives object from save game file
  76. void Spawn( void );
  77. virtual void GetViewParms( renderView_t *view );
  78. private:
  79. int threadNum;
  80. idVec3 offset;
  81. int frameRate;
  82. int starttime;
  83. int cycle;
  84. idList<int> cameraCuts;
  85. idList<cameraFrame_t> camera;
  86. idEntityPtr<idEntity> activator;
  87. void Start( void );
  88. void Stop( void );
  89. void Think( void );
  90. void LoadAnim( void );
  91. void Event_Start( void );
  92. void Event_Stop( void );
  93. void Event_SetCallback( void );
  94. void Event_Activate( idEntity *activator );
  95. };
  96. #endif /* !__GAME_CAMERA_H__ */