diff options
| author | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
|---|---|---|
| committer | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
| commit | 3bf9df6b2785fa6d951086978a3e66f49427166a (patch) | |
| tree | 2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /public/tier2/camerautils.h | |
| download | archived-source-engine-2018-hl2-src-master.tar.xz archived-source-engine-2018-hl2-src-master.zip | |
Diffstat (limited to 'public/tier2/camerautils.h')
| -rw-r--r-- | public/tier2/camerautils.h | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/public/tier2/camerautils.h b/public/tier2/camerautils.h new file mode 100644 index 0000000..dcaf423 --- /dev/null +++ b/public/tier2/camerautils.h @@ -0,0 +1,57 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: A set of utilities to deal with camera transforms +// +//===========================================================================// + +#ifndef CAMERAUTILS_H +#define CAMERAUTILS_H + +#ifdef _WIN32 +#pragma once +#endif + +#include "tier2/tier2.h" +#include "Color.h" + +//----------------------------------------------------------------------------- +// Forward declarations +//----------------------------------------------------------------------------- +class Vector; +class QAngle; +class IMaterial; +struct matrix3x4_t; +class VMatrix; + + +//----------------------------------------------------------------------------- +// Camera state +// TODO: Maybe this should be a base class of CViewSetup? +//----------------------------------------------------------------------------- +struct Camera_t +{ + Vector m_origin; + QAngle m_angles; + float m_flFOV; + float m_flZNear; + float m_flZFar; +}; + + +//----------------------------------------------------------------------------- +// accessors for generated matrices +//----------------------------------------------------------------------------- +void ComputeViewMatrix( VMatrix *pWorldToCamera, const Camera_t& camera ); +void ComputeViewMatrix( matrix3x4_t *pWorldToCamera, const Camera_t& camera ); +void ComputeProjectionMatrix( VMatrix *pCameraToProjection, const Camera_t& camera, int width, int height ); + + +//----------------------------------------------------------------------------- +// Computes the screen space position given a screen size +//----------------------------------------------------------------------------- +void ComputeScreenSpacePosition( Vector2D *pScreenPosition, const Vector &vecWorldPosition, + const Camera_t &camera, int width, int height ); + + +#endif // CAMERAUTILS_H + |