Pyrogenesis
13997
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
source
graphics
Patch.h
Go to the documentation of this file.
1
/* Copyright (C) 2009 Wildfire Games.
2
* This file is part of 0 A.D.
3
*
4
* 0 A.D. is free software: you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation, either version 2 of the License, or
7
* (at your option) any later version.
8
*
9
* 0 A.D. is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
13
*
14
* You should have received a copy of the GNU General Public License
15
* along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
16
*/
17
18
/*
19
* A patch of terrain holding NxN MiniPatch tiles
20
*/
21
22
#ifndef INCLUDED_PATCH
23
#define INCLUDED_PATCH
24
25
#include "
MiniPatch.h
"
26
#include "
RenderableObject.h
"
27
28
class
CTerrain
;
29
30
///////////////////////////////////////////////////////////////////////////////
31
// Terrain Constants:
32
//
33
// PATCH_SIZE: number of tiles in each patch
34
const
ssize_t
PATCH_SIZE
= 16;
35
36
// Flags for whether the patch should be drawn with a solid plane
37
// on each side
38
enum
CPatchSideFlags
39
{
40
CPATCH_SIDE_NEGX
= (1 << 0),
41
CPATCH_SIDE_POSX
= (1 << 1),
42
CPATCH_SIDE_NEGZ
= (1 << 2),
43
CPATCH_SIDE_POSZ
= (1 << 3),
44
};
45
46
///////////////////////////////////////////////////////////////////////////////
47
// CPatch: a single terrain patch, PATCH_SIZE tiles square
48
class
CPatch
:
public
CRenderableObject
49
{
50
public
:
51
// constructor
52
CPatch
();
53
// destructor
54
~CPatch
();
55
56
// initialize the patch
57
void
Initialize
(
CTerrain
* parent,
ssize_t
x,
ssize_t
z);
58
// calculate and store bounds of this patch
59
void
CalcBounds
();
60
61
// is already in the DrawList
62
bool
m_bWillBeDrawn
;
63
64
public
:
65
// minipatches (tiles) making up the patch
66
CMiniPatch
m_MiniPatches
[
PATCH_SIZE
][
PATCH_SIZE
];
67
// position of patch in parent terrain grid
68
int
m_X
,
m_Z
;
69
// parent terrain
70
CTerrain
*
m_Parent
;
71
72
// draw state...
73
void
setDrawState
(
bool
value) {
m_bWillBeDrawn
= value; };
74
bool
getDrawState
() {
return
m_bWillBeDrawn
; };
75
76
int
GetSideFlags
();
77
};
78
79
80
#endif
81
82
CPATCH_SIDE_POSX
Definition:
Patch.h:41
CPATCH_SIDE_NEGX
Definition:
Patch.h:40
CPATCH_SIDE_POSZ
Definition:
Patch.h:43
RenderableObject.h
CTerrain
Definition:
Terrain.h:51
CPatch::CPatch
CPatch()
Definition:
Patch.cpp:30
CPatchSideFlags
CPatchSideFlags
Definition:
Patch.h:38
CPatch::~CPatch
~CPatch()
Definition:
Patch.cpp:37
CPatch::m_X
int m_X
Definition:
Patch.h:68
CPATCH_SIDE_NEGZ
Definition:
Patch.h:42
CPatch
Definition:
Patch.h:48
ssize_t
intptr_t ssize_t
Definition:
wposix_types.h:82
CPatch::GetSideFlags
int GetSideFlags()
Definition:
Patch.cpp:78
CMiniPatch
Definition:
MiniPatch.h:31
MiniPatch.h
CPatch::m_Parent
CTerrain * m_Parent
Definition:
Patch.h:70
CPatch::m_Z
int m_Z
Definition:
Patch.h:68
CPatch::m_MiniPatches
CMiniPatch m_MiniPatches[PATCH_SIZE][PATCH_SIZE]
Definition:
Patch.h:66
CRenderableObject
Definition:
RenderableObject.h:54
CPatch::m_bWillBeDrawn
bool m_bWillBeDrawn
Definition:
Patch.h:62
CPatch::Initialize
void Initialize(CTerrain *parent, ssize_t x, ssize_t z)
Definition:
Patch.cpp:44
PATCH_SIZE
const ssize_t PATCH_SIZE
Definition:
Patch.h:34
CPatch::CalcBounds
void CalcBounds()
(Re)calculates and stores any bounds or bound-dependent data for this object.
Definition:
Patch.cpp:58
CPatch::getDrawState
bool getDrawState()
Definition:
Patch.h:74
CPatch::setDrawState
void setDrawState(bool value)
Definition:
Patch.h:73
Generated on Mon Oct 14 2013 00:58:06 for Pyrogenesis by
1.8.5