summaryrefslogtreecommitdiff
path: root/hammer/mapfrustum.h
blob: e0555e120430163b88bef173e7cafae0d86934b0 (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 MAPFRUSTUM_H
#define MAPFRUSTUM_H
#ifdef _WIN32
#pragma once
#endif


#include "MapHelper.h"
#include "MapFace.h"
#include "fgdlib/WCKeyValues.h"


class CHelperInfo;
class CRender3D;


class CMapFrustum : public CMapHelper
{
public:

	DECLARE_MAPCLASS(CMapFrustum,CMapHelper);
	
	//
	// Factory for building from a list of string parameters.
	//
	static CMapClass *Create(CHelperInfo *pInfo, CMapEntity *pParent);
	
	//
	// Construction/destruction:
	//
	CMapFrustum(void);
	~CMapFrustum(void);

	void BuildFrustumFaces();
	void CalcBounds(BOOL bFullUpdate = FALSE);

	virtual CMapClass *Copy(bool bUpdateDependencies);
	virtual CMapClass *CopyFrom(CMapClass *pFrom, bool bUpdateDependencies);

	void Render3D(CRender3D *pRender);

	int SerializeRMF(std::fstream &File, BOOL bRMF);
	int SerializeMAP(std::fstream &File, BOOL bRMF);

	virtual void PostloadWorld(CMapWorld *pWorld);

	virtual bool IsVisualElement(void) { return(false); } // Only visible when parent entity is selected.
	virtual bool IsClutter(void) { return true; }
	virtual bool IsCulledByCordon(const Vector &vecMins, const Vector &vecMaxs) { return false; } // We don't hide unless our parent hides.

	const char* GetDescription() { return("Frustum helper"); }

	void OnParentKeyChanged( const char* key, const char* value );
	bool ShouldRenderLast(void) { return(true); }
	void GetAngles(QAngle& fAngles);


private:

	CMapFace* CreateMapFace( const Vector &v1, const Vector &v2, const Vector &v3, const Vector &v4, float flAlpha );


protected:

	CMapFaceList m_Faces;

	float m_flFOV;
	float m_flNearPlane;
	float m_flFarPlane;
	float m_flPitchScale;
	float m_fBrightness;

	QAngle m_Angles;	
	char m_szFOVKeyName[KEYVALUE_MAX_KEY_LENGTH];
	char m_szColorKeyName[KEYVALUE_MAX_KEY_LENGTH];
	char m_szNearPlaneKeyName[KEYVALUE_MAX_KEY_LENGTH];
	char m_szFarPlaneKeyName[KEYVALUE_MAX_KEY_LENGTH];
};

#endif // MAPFRUSTUM_H