Pyrogenesis  trunk
ICmpTerrain.h
Go to the documentation of this file.
1 /* Copyright (C) 2017 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 #ifndef INCLUDED_ICMPTERRAIN
19 #define INCLUDED_ICMPTERRAIN
20 
22 
24 
25 #include "maths/FixedVector3D.h"
26 
27 class CTerrain;
28 class CVector3D;
29 
30 class ICmpTerrain : public IComponent
31 {
32 public:
33  virtual bool IsLoaded() const = 0;
34 
35  virtual CFixedVector3D CalcNormal(entity_pos_t x, entity_pos_t z) const = 0;
36 
37  virtual CVector3D CalcExactNormal(float x, float z) const = 0;
38 
39  virtual entity_pos_t GetGroundLevel(entity_pos_t x, entity_pos_t z) const = 0;
40 
41  virtual float GetExactGroundLevel(float x, float z) const = 0;
42 
43  /**
44  * Returns number of tiles per side on the terrain.
45  * Return value is always non-zero.
46  */
47  virtual u16 GetTilesPerSide() const = 0;
48 
49  /**
50  * Returns number of vertices per side on the terrain.
51  * Return value is always non-zero.
52  */
53  virtual u16 GetVerticesPerSide() const = 0;
54 
55  virtual CTerrain* GetCTerrain() = 0;
56 
57  /**
58  * Call when the underlying CTerrain has been modified behind our backs.
59  * (TODO: eventually we should manage the CTerrain in this class so nobody
60  * can modify it behind our backs).
61  */
62  virtual void ReloadTerrain(bool ReloadWater = true) = 0;
63 
64  /**
65  * Indicate that terrain tiles within the given region (inclusive lower bound,
66  * exclusive upper bound) have been changed. CMessageTerrainChanged will be
67  * sent to any components that care about terrain changes.
68  */
69  virtual void MakeDirty(i32 i0, i32 j0, i32 i1, i32 j1) = 0;
70 
71  DECLARE_INTERFACE_TYPE(Terrain)
72 };
73 
74 #endif // INCLUDED_ICMPTERRAIN
virtual float GetExactGroundLevel(float x, float z) const =0
Definition: IComponent.h:33
A simple fixed-point number class.
Definition: Fixed.h:115
virtual CFixedVector3D CalcNormal(entity_pos_t x, entity_pos_t z) const =0
uint16_t u16
Definition: types.h:38
Definition: Vector3D.h:28
Definition: Terrain.h:51
virtual u16 GetVerticesPerSide() const =0
Returns number of vertices per side on the terrain.
virtual bool IsLoaded() const =0
Definition: FixedVector3D.h:24
#define DECLARE_INTERFACE_TYPE(iname)
Definition: Interface.h:23
virtual CVector3D CalcExactNormal(float x, float z) const =0
virtual CTerrain * GetCTerrain()=0
int32_t i32
Definition: types.h:34
virtual entity_pos_t GetGroundLevel(entity_pos_t x, entity_pos_t z) const =0
virtual void ReloadTerrain(bool ReloadWater=true)=0
Call when the underlying CTerrain has been modified behind our backs.
virtual void MakeDirty(i32 i0, i32 j0, i32 i1, i32 j1)=0
Indicate that terrain tiles within the given region (inclusive lower bound, exclusive upper bound) ha...
Entity coordinate types.
virtual u16 GetTilesPerSide() const =0
Returns number of tiles per side on the terrain.
Definition: ICmpTerrain.h:30