aboutsummaryrefslogtreecommitdiff
path: root/mp/src/public/matsys_controls/vmtpanel.h
blob: ee2e6cc849690b6da5e327101744a04202f8226d (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
87
88
89
90
91
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: 
//
// $NoKeywords: $
//===========================================================================//

#ifndef VMTPANEL_H
#define VMTPANEL_H

#ifdef _WIN32
#pragma once
#endif

#include "matsys_controls/potterywheelpanel.h"


//-----------------------------------------------------------------------------
// Forward declarations
//-----------------------------------------------------------------------------
class IMaterial;
class CMeshBuilder;
class Vector;

namespace vgui
{
	class ScrollBar;
	class IScheme;
}


//-----------------------------------------------------------------------------
// Material Viewer Panel
//-----------------------------------------------------------------------------
class CVMTPanel : public CPotteryWheelPanel
{
	DECLARE_CLASS_SIMPLE( CVMTPanel, CPotteryWheelPanel );

public:
	// constructor, destructor
	CVMTPanel( vgui::Panel *pParent, const char *pName );
	virtual ~CVMTPanel();

	// Set the material to draw
	void SetMaterial( IMaterial *pMaterial );

	// Set rendering mode (stretch to full screen, or use actual size)
	void RenderUsingActualSize( bool bEnable );

	// performs the layout
	virtual void PerformLayout();

	virtual void ApplySchemeSettings( vgui::IScheme *pScheme );

private:
	// paint it stretched to the window size
	void DrawStretchedToPanel( CMeshBuilder &meshBuilder );

	// paint it actual size
	void DrawActualSize( CMeshBuilder &meshBuilder );

	// Draw it on a sphere
	void RenderSphere( const Vector &vCenter, float flRadius, int nTheta, int nPhi );

	// paint it!
	virtual void OnPaint3D();

private:
	// The material to draw
	IMaterial *m_pMaterial;

	// A texture to use for a lightmap
	CTextureReference m_pLightmapTexture;

	// The default env_cubemap
	CTextureReference m_DefaultEnvCubemap;

	// Are we using actual size or not?
	bool m_bUseActualSize;

	// Scroll bars
	vgui::ScrollBar *m_pHorizontalBar;
	vgui::ScrollBar *m_pVerticalBar;

	// The viewable size
	int	m_iViewableWidth;
	int m_iViewableHeight;
};

#endif // VMTPANEL_H