summaryrefslogtreecommitdiff
path: root/hammer/mapoverlaytrans.h
blob: 96ddb3a67c56642f49d497c5391c67a13548763e (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
92
93
94
95
96
97
98
99
100
//========= Copyright Valve Corporation, All rights reserved. ============//
//
//
//=============================================================================

#ifndef OVERLAYTRANS_H
#define OVERLAYTRANS_H
#pragma once

#include "utlvector.h"
#include "mathlib/vector.h"
#include "mathlib/vector2d.h"
#include "MapHelper.h"

class IEditorTexture;
class CHelperInfo;
class CMapEntity;
class CMapFace;

struct ShoreEntityData_t
{
	IEditorTexture	*m_pTexture;
	Vector2D		m_vecLengthTexcoord;
	Vector2D		m_vecWidthTexcoord;
	float			m_flWidths[2];
};

//=============================================================================
//
// Overlay Transition Entity Helper
//
class CMapOverlayTransition : public CMapHelper
{
public:

	DECLARE_MAPCLASS(CMapOverlayTransition,CMapHelper)

	CMapOverlayTransition();
	~CMapOverlayTransition();

	// Factory for building from a list of string parameters.
	static CMapClass *Create( CHelperInfo *pInfo, CMapEntity *pParent );

	// Virtual/Interface Implementation.
	virtual void PostloadWorld( CMapWorld *pWorld );

	void CalcBounds( BOOL bFullUpdate = FALSE );

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

	virtual void OnParentKeyChanged( const char* szKey, const char* szValue );
	virtual void OnNotifyDependent( CMapClass *pObject, Notify_Dependent_t eNotifyType );

	virtual void OnAddToWorld(CMapWorld *pWorld);
	virtual void OnRemoveFromWorld(CMapWorld *pWorld, bool bNotifyChildren);

	void DoTransform( const VMatrix& matrix );
	
	void OnPaste( CMapClass *pCopy, CMapWorld *pSourceWorld, CMapWorld *pDestWorld, 
				  const CMapObjectList &OriginalList, CMapObjectList &NewList);
	void OnClone( CMapClass *pClone, CMapWorld *pWorld, 
				  const CMapObjectList &OriginalList, CMapObjectList &NewList );
	void OnUndoRedo( void );

	bool OnApply( void );

	void Render3D( CRender3D *pRender );

	inline virtual bool IsVisualElement( void ) { return true; }
	inline virtual bool ShouldRenderLast( void ) { return true; }
	inline const char* GetDescription() { return ( "Overlay Transition" ); }

	ChunkFileResult_t LoadVMF( CChunkFile *pFile );
	ChunkFileResult_t SaveVMF( CChunkFile *pFile, CSaveInfo *pSaveInfo );
	bool ShouldSerialize( void ) { return true; }

private:

	bool BuildFaceCaches( void );

	static ChunkFileResult_t OverlayDataCallback( CChunkFile *pFile, CMapDisp *pDisp );
	static ChunkFileResult_t OverlayDataKeyCallback( const char *szKey, const char *szValue, CMapDisp *pDisp );

private:

	bool					m_bIsWater;
	ShoreEntityData_t		m_ShoreData;

	CUtlVector<CMapFace*>	m_aFaceCache1;
	CUtlVector<CMapFace*>	m_aFaceCache2;

	int						m_nShorelineId;
	CUtlVector<CMapEntity*>	m_aOverlayChildren;

	bool					m_bDebugDraw;
};


#endif // OVERLAYTRANS_H