summaryrefslogtreecommitdiff
path: root/hammer/DispShore.h
blob: 4169176901a88a09535cc501d48d3129a7dc3b12 (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
//========= Copyright Valve Corporation, All rights reserved. ============//
//
//
//=============================================================================

#ifndef DISPSHORE_H
#define DISPSHORE_H
#pragma once

#include "MapHelper.h"
#include "MapFace.h"
#include "MapOverlay.h"
#include "MapOverlayTrans.h"

class CHelperInfo;
class CMapEntity;

struct ShoreFaceData_t
{
	CMapFace	*m_pFaces[4];			// The hammer faces the points reside on.
	Vector		m_vecPoints[4];			// The shore face points.
	Vector2D	m_vecTexCoords[4];		// The shore texture coordinates.
	bool		m_bAdjWinding;
};

struct ShoreSegment_t
{
	Vector				m_vecPoints[2];				// Shore segment points.
	Vector				m_vecNormals[2];			// Shore segment normals.
	Vector2D			m_vecTexCoords[4];			// Shore segment texture coordinates.

	EditDispHandle_t	m_hDisp;					// Displacement the shore segment was created from.
	float				m_flWaterZ;

	ShoreFaceData_t		m_WorldFace;
	ShoreFaceData_t		m_WaterFace;

	// ?
	Vector				m_vecCenter;
	unsigned int		m_iStartPoint;
	bool				m_bTouch;
	bool				m_bCreated;
};

struct Shoreline_t
{
	int							m_nShorelineId;
	CUtlVector<ShoreSegment_t>	m_aSegments;		// List of shore segments making up the shore line.
	CUtlVector<int>				m_aSortedSegments;	// List of shore segments sorted (for connectivity).
	CUtlVector<CMapOverlay>		m_aOverlays;
	float						m_flLength;			// Total length of the shore line.
	ShoreEntityData_t			m_ShoreData;

	Shoreline_t();
	~Shoreline_t();
	void AddSegment( Vector &vecPoint0, Vector &vecPoint1, Vector &vecNormal, float flWaterZ, CMapFace *pWaterFace, EditDispHandle_t hDisp );
};

class IDispShoreManager
{
public:

	virtual bool		Init( void ) = 0;
	virtual void		Shutdown( void ) = 0;

	// Shoreline management.
	virtual int			GetShorelineCount( void ) = 0;
	virtual Shoreline_t *GetShoreline( int nShorelineId ) = 0;
	virtual void		AddShoreline( int nShorelineId ) = 0;
	virtual void		RemoveShoreline( int nShorelineId ) = 0;
	virtual void		BuildShoreline( int nShorelineId, CUtlVector<CMapFace*> &aFaces, CUtlVector<CMapFace*> &aWaterFaces ) = 0;

	virtual void		Draw( CRender3D *pRender ) = 0;
	virtual void		DebugDraw( CRender3D *pRender ) = 0;
};

IDispShoreManager *GetShoreManager( void );

#endif // DISPSHORE_H