aboutsummaryrefslogtreecommitdiff
path: root/mp/src/game/client/replay/replay_screenshot.h
blob: 0fa8ed2dd85d7ed0076eb5eaa261a03f9743bb70 (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
//========= Copyright Valve Corporation, All rights reserved. ============//
//
//=======================================================================================//

#if !defined( REPLAY_SCREENSHOT_H )
#define REPLAY_SCREENSHOT_H
#ifdef _WIN32
#pragma once
#endif

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

#include "replay/screenshot.h"

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

class IViewRender;

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

//
// Takes screenshots as VTF's for the replay system - allocates enough
// memory up-front as opposed to every frame.  Should be destroyed and recreated
// any time the cvar "replay_screenshotresolution" changes OR the actual screen
// resolution.
//
class CReplayScreenshotTaker
{
public:
	CReplayScreenshotTaker( IViewRender *pViewRender, CViewSetup &view );
	~CReplayScreenshotTaker();

	void		TakeScreenshot( WriteReplayScreenshotParams_t &params );

	static void CreateRenderTarget( IMaterialSystem *pMaterialSystem );

private:
	IViewRender	*m_pViewRender;
	CViewSetup	&m_View;
	uint8		*m_pUnpaddedPixels;
	uint8		*m_pPaddedPixels;
	IVTFTexture *m_pVTFTexture;
	uint8		*m_pVTFPixels;

	int			m_aUnpaddedDims[2];		// Width & height of m_pUnpaddedPixels
	int			m_aPaddedDims[2];		// Width & height of m_pPaddedPixels

	CUtlBuffer	*m_pBuffer;


	static ITexture		*m_pScreenshotTarget;
};

#endif // REPLAY_SCREENSHOT_H