aboutsummaryrefslogtreecommitdiff
path: root/mp/src/public/headtrack/iheadtrack.h
blob: 4f5fcced0f9dd58ef036414d9f0d5b885c0b93ef (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
//===== Copyright (c), Valve Corporation, All rights reserved. ======//
//
// Purpose: Contains the IHeadTrack interface, which is implemented in headtrack.dll
//
// $NoKeywords: $
//
//===========================================================================//

#ifndef IHEADTRACK_H
#define IHEADTRACK_H

#ifdef _WIN32
#pragma once
#endif

#include "tier1/interface.h"
#include "tier1/refcount.h"
#include "appframework/IAppSystem.h"
#include "mathlib/vmatrix.h"
#include "view_shared.h"

//-----------------------------------------------------------------------------
// forward declarations
//-----------------------------------------------------------------------------

//-----------------------------------------------------------------------------
// important enumeration
//-----------------------------------------------------------------------------

// NOTE NOTE NOTE!!!!  If you up this, grep for "NEW_INTERFACE" to see if there is anything
// waiting to be enabled during an interface revision.
#define HEAD_TRACK_INTERFACE_VERSION "VHeadTrack001"

//-----------------------------------------------------------------------------
// 
//-----------------------------------------------------------------------------

abstract_class IHeadTrack : public IAppSystem
{
public:
	virtual ~IHeadTrack() {}

	// Placeholder for API revision
	virtual bool Connect( CreateInterfaceFn factory ) = 0;
	virtual void Disconnect() = 0;
	virtual void *QueryInterface( const char *pInterfaceName ) = 0;
	virtual InitReturnVal_t Init() = 0;
	virtual void Shutdown() = 0;

	//-----------------------------------------------------------------------------
	// Tracking section
	//-----------------------------------------------------------------------------
    // All methods return true on success, false on failure.

    // Also sets the zero pose
    virtual bool ResetTracking() = 0;

    // Set the current pose as the "zero"
    virtual bool SetCurrentCameraAsZero() = 0;

	// Raw interfaces - one one or other of these, not both (GetCameraPoseZeroFromCurrent calls GetCameraFromWorldPose );
	virtual bool GetCameraFromWorldPose ( VMatrix *pResultCameraFromWorldPose, VMatrix *pResultCameraFromWorldPoseUnpredicted = NULL, double *pflAcquireTime = NULL ) = 0;
	virtual bool GetCameraPoseZeroFromCurrent ( VMatrix *pResultMatrix ) = 0;

	// All-in-one interfaces (they call GetCameraPoseZeroFromCurrent)
	// Grabs the current tracking data and sets up state for the Override* calls.
	virtual bool ProcessCurrentTrackingState ( float PlayerGameFov ) = 0;

	// Performs the distortion post-processing.
	virtual bool DoDistortionProcessing ( const vrect_t *SrcRect ) = 0;

};



//-----------------------------------------------------------------------------

extern IHeadTrack *g_pHeadTrack;

inline bool UseHeadTracking()
{
	return g_pHeadTrack != NULL;
}
#endif // IHEADTRACK_H