Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

91 lines
2.6 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // A class representing a camera
  4. //
  5. //=============================================================================
  6. #ifndef DMECAMERA_H
  7. #define DMECAMERA_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "movieobjects/dmedag.h"
  12. #include "movieobjects/timeutils.h"
  13. //-----------------------------------------------------------------------------
  14. // A class representing a camera
  15. //-----------------------------------------------------------------------------
  16. class CDmeCamera : public CDmeDag
  17. {
  18. DEFINE_ELEMENT( CDmeCamera, CDmeDag );
  19. public:
  20. // Sets up render state in the material system for rendering
  21. // This includes the view matrix and the projection matrix
  22. void SetupRenderState( int nDisplayWidth, int nDisplayHeight, bool bUseEngineCoordinateSystem = false );
  23. // accessors for generated matrices
  24. void GetViewMatrix( VMatrix &view, bool bUseEngineCoordinateSystem = false );
  25. void GetProjectionMatrix( VMatrix &proj, int width, int height );
  26. void GetViewProjectionInverse( VMatrix &viewprojinv, int width, int height );
  27. void ComputeScreenSpacePosition( const Vector &vecWorldPosition, int width, int height, Vector2D *pScreenPosition );
  28. // Returns the x FOV (the full angle)
  29. float GetFOVx() const;
  30. void SetFOVx( float fov );
  31. // Returns the focal distance in inches
  32. float GetFocalDistance() const;
  33. // Sets the focal distance in inches
  34. void SetFocalDistance( const float &fFocalDistance );
  35. // Returns the aperture size in inches
  36. float GetAperture() const;
  37. // Returns the shutter speed in seconds
  38. float GetShutterSpeed() const;
  39. // Returns the tone map scale
  40. float GetToneMapScale() const;
  41. // Returns the tone map scale
  42. float GetBloomScale() const;
  43. // Returns the view direction
  44. void GetViewDirection( Vector *pDirection );
  45. // Returns Depth of Field quality level
  46. int GetDepthOfFieldQuality() const;
  47. // Returns the Motion Blur quality level
  48. int GetMotionBlurQuality() const;
  49. private:
  50. // Loads the material system view matrix based on the transform
  51. void LoadViewMatrix( bool bUseEngineCoordinateSystem );
  52. // Loads the material system projection matrix based on the fov, etc.
  53. void LoadProjectionMatrix( int nDisplayWidth, int nDisplayHeight );
  54. // Sets the studiorender state
  55. void LoadStudioRenderCameraState();
  56. CDmaVar< float > m_fieldOfView;
  57. CDmaVar< float > m_zNear;
  58. CDmaVar< float > m_zFar;
  59. CDmaVar< float > m_fFocalDistance;
  60. CDmaVar< float > m_fAperture;
  61. CDmaVar< float > m_fShutterSpeed;
  62. CDmaVar< float > m_fToneMapScale;
  63. CDmaVar< float > m_fBloomScale;
  64. CDmaVar< int > m_nDoFQuality;
  65. CDmaVar< int > m_nMotionBlurQuality;
  66. };
  67. #endif // DMECAMERA_H