aboutsummaryrefslogtreecommitdiff
path: root/sp/src/game/shared/weapon_ifmbasecamera.h
blob: bd12c2f47727683c635255c7e3e9df65193c8fd7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: 
//
//===========================================================================//

#ifndef WEAPON_IFMBASECAMERA_H
#define WEAPON_IFMBASECAMERA_H
#ifdef _WIN32
#pragma once
#endif

#include "weapon_ifmbase.h"

#ifdef CLIENT_DLL
#include "materialsystem/MaterialSystemUtil.h"
#endif

#if defined( CLIENT_DLL )
	#define CWeaponIFMBaseCamera C_WeaponIFMBaseCamera
#endif

class CWeaponIFMBaseCamera : public CWeaponIFMBase
{
public:
	DECLARE_CLASS( CWeaponIFMBaseCamera, CWeaponIFMBase );
	DECLARE_NETWORKCLASS(); 
	DECLARE_PREDICTABLE();

#ifdef GAME_DLL
	DECLARE_DATADESC();
#endif

	// Shared code
public:
	CWeaponIFMBaseCamera();

#ifdef CLIENT_DLL
	// Client code
public:
	virtual void	ViewModelDrawn( CBaseViewModel *pBaseViewModel );
	virtual void	DrawCrosshair( );
	virtual int		DrawModel( int flags );
	virtual void	OnDataChanged( DataUpdateType_t updateType );

protected:
	// Gets the abs orientation of the camera
	virtual void ComputeAbsCameraTransform( Vector &vecAbsOrigin, QAngle &angAbsRotation );

	// Gets the bounds of the overlay to draw
	void GetOverlayBounds( int &x, int &y, int &w, int &h );

	// Gets the size of the overlay to draw
	void GetViewportSize( int &w, int &h );

	void TransmitRenderInfo();

	float m_flFOV;
	float m_flArmLength;
	Vector m_vecRelativePosition;
	QAngle m_angRelativeAngles;
	int m_nScreenWidth;
	int m_nScreenHeight;
	bool m_bFullScreen;
	CMaterialReference m_FrustumMaterial;
	CMaterialReference m_FrustumWireframeMaterial;
#endif

#ifdef GAME_DLL
	// Server code
public:
	void SetRenderInfo( float flAspectRatio, float flFOV, float flArmLength, const Vector &vecPosition, const QAngle &angles );
#endif

private:
	CNetworkVar( float, m_flRenderAspectRatio );
	CNetworkVar( float, m_flRenderFOV );
	CNetworkVar( float, m_flRenderArmLength );
	CNetworkVector( m_vecRenderPosition );
	CNetworkQAngle( m_angRenderAngles );

	CWeaponIFMBaseCamera( const CWeaponIFMBaseCamera & );
};


#endif // WEAPON_IFMBASECAMERA_H