-
Notifications
You must be signed in to change notification settings - Fork 0
/
TerrainInterface.h
185 lines (155 loc) · 6.12 KB
/
TerrainInterface.h
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
/* Copyright (c) 2002-2012 Croteam Ltd.
This program is free software; you can redistribute it and/or modify
it under the terms of version 2 of the GNU General Public License as published by
the Free Software Foundation
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
#if !defined(AFX_TERRAININTERFACE_H__539D0786_D5B8_4079_A285_DA2C86EC7543__INCLUDED_)
#define AFX_TERRAININTERFACE_H__539D0786_D5B8_4079_A285_DA2C86EC7543__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// TerrainInterface.h : header file
//
#define TEM_HEIGHTMAP 0
#define TEM_LAYER 1
#define CT_EDIT_MODES 2
#define TBM_PAINT 0
#define TBM_SMOOTH 1
#define TBM_FILTER 2
#define TBM_MINIMUM 3
#define TBM_MAXIMUM 4
#define TBM_FLATTEN 5
#define TBM_POSTERIZE 6
#define TBM_RND_NOISE 7
#define TBM_CONTINOUS_NOISE 8
#define TBM_ERASE 9
#define CT_BRUSH_MODES 10
struct CTerrainEditBrush {
FLOAT teb_fHotSpot;
FLOAT teb_fFallOff;
};
extern CTFileName GetBrushTextureName(INDEX iBrush);
extern CTerrainEditBrush atebDefaultEditBrushValues[];
extern CTerrainEditBrush atebCustomEditBrushes[];
extern void InvokeTerrainTilePalette( PIX pixX, PIX pixY);
extern void InvokeTerrainBrushPalette( PIX pixX, PIX pixY);
extern void RenderBrushShape( INDEX iBrush, PIXaabbox2D rect, CDrawPort *pdp);
extern void GetEditingModeInfo(INDEX iMode, INDEX &iIcon, CTString &strText);
extern CBrushPaletteWnd *_pBrushPalette;
extern void GenerateTerrainBrushTexture( INDEX iBrush, FLOAT fHotSpot, FLOAT fFallOff);
extern void GenerateNonExistingTerrainEditBrushes(void);
extern void ApplyImportExport(INDEX iSelectedItem);
extern void DisplayHeightMapWindow(CPoint pt);
void GetBrushModeInfo(INDEX iMode, INDEX &iIcon, CTString &strText);
#define CT_BRUSHES 32
#define BRUSH_PALETTE_WIDTH (128-1)
#define BRUSH_PALETTE_HEIGHT (256-1)
#define TILE_PALETTE_WIDTH (256-1)
#define TILE_PALETTE_HEIGHT (256-1)
/////////////////////////////////////////////////////////////////////////////
// CTerrainInterface window
struct CTIButton {
FLOAT tib_fx;
FLOAT tib_fy;
FLOAT tib_fdx;
FLOAT tib_fdy;
INDEX tib_iIcon;
COLOR tib_colBorderColor;
COLOR tib_colFill;
FLOAT tib_fDataMin;
FLOAT tib_fDataMax;
FLOAT tib_fDataDelta;
BOOL tib_bWrapData;
BOOL tib_bMouseTrapForMove;
BOOL tib_bContinueTesting;
FLOAT *tib_pfData1;
FLOAT *tib_pfData2;
INDEX tib_iLayer;
CTString tib_strToolTip;
void (*tib_pOnRender)(CTIButton *ptib, CDrawPort *pdp);
void (*tib_pOnLeftClick)(CTIButton *ptib, CPoint pt, CDrawPort *pdp);
void (*tib_pOnLeftClickMove)(CTIButton *ptib, FLOAT fdx, FLOAT fdy, CDrawPort *pdp);
void (*tib_pOnRightClick)(CTIButton *ptib, CPoint pt, CDrawPort *pdp);
void (*tib_pOnRightClickMove)(CTIButton *ptib, FLOAT fdx, FLOAT fdy, CDrawPort *pdp);
void (*tib_pPreRender)(CTIButton *ptib, CDrawPort *pdp);
// misc functions
void (*tib_pOnDropFiles)(CTIButton *ptib, CPoint pt, CDrawPort *pdp, CTFileName fnFile);
CTString (*tib_pGetClickMoveData)(CTIButton *ptib, CPoint pt, CDrawPort *pdp, BOOL bLmb);
BOOL (*tib_pIsEnabled)(CTIButton *ptib);
// construction
CTIButton();
void SetData( FLOAT fDataMin, FLOAT fDataMax, FLOAT fDataDelta,
BOOL bWrap=FALSE, FLOAT *pfData1=NULL, FLOAT *pfData2=NULL);
void SetFunctions(
void (*pOnRender)(CTIButton *ptib, CDrawPort *pdp)=NULL,
void (*pOnLeftClick)(CTIButton *ptib, CPoint pt, CDrawPort *pdp)=NULL,
void (*pOnLeftClickMove)(CTIButton *ptib, FLOAT fdx, FLOAT fdy, CDrawPort *pdp)=NULL,
void (*pOnRightClick)(CTIButton *ptib, CPoint pt, CDrawPort *pdp)=NULL,
void (*pOnRighClickMove)(CTIButton *ptib, FLOAT fdx, FLOAT fdy, CDrawPort *pdp)=NULL,
void (*pPreRender)(CTIButton *ptib, CDrawPort *pdp)=NULL);
};
class CTerrainInterface : public CWnd
{
// Construction
public:
CTerrainInterface();
void InitializeInterface(CDrawPort *pdp);
CDrawPort *m_pDrawPort;
CViewPort *m_pViewPort;
COleDataSource m_DataSource;
INDEX m_iBrush;
INDEX m_iOpacity;
INDEX m_iEditMode;
CPoint m_ptMouse;
CPoint m_ptMouseDown;
CPoint m_ptMouseDownScreen;
CPoint m_ptMouseCenter;
CPoint m_ptMouseCenterScreen;
CUpdateableRT m_udTerrainPage;
CUpdateableRT m_udTerrainPageCanvas;
// Attributes
public:
// Operations
public:
void OnIdle(void);
int OnToolHitTest( CPoint point, TOOLINFO* pTI ) const;
void HideCursor(void);
void UnhideCursor(void);
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CTerrainInterface)
public:
virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL);
virtual BOOL PreTranslateMessage(MSG* pMsg);
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CTerrainInterface();
void RenderInterface(CDrawPort *pDP);
BOOL IsClicked(CTIButton &tib, CPoint pt) const;
// Generated message map functions
protected:
//{{AFX_MSG(CTerrainInterface)
afx_msg void OnPaint();
afx_msg void OnDestroy();
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
afx_msg void OnDropFiles(HDROP hDropInfo);
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_TERRAININTERFACE_H__539D0786_D5B8_4079_A285_DA2C86EC7543__INCLUDED_)