5 #ifndef MERCATOR_SEGMENT_H 6 #define MERCATOR_SEGMENT_H 10 #include "BasePoint.h" 11 #include "HeightMap.h" 13 #include <wfmath/vector.h> 14 #include <wfmath/axisbox.h> 60 Surfacestore m_surfaces;
66 std::map<long, const TerrainMod*> m_terrainMods;
68 explicit Segment(
int x,
int z,
unsigned int resolution);
98 void invalidate(
bool points =
true);
107 m_controlPoints(x, z) = bp;
113 return m_controlPoints;
118 return m_controlPoints;
162 float get(
int x,
int z)
const {
163 return m_heightMap.
get(x, z);
166 void getHeight(
float x,
float y,
float &h)
const;
167 void getHeightAndNormal(
float x,
float z,
float &h,
168 WFMath::Vector<3> &normal)
const;
169 bool clipToSegment(
const WFMath::AxisBox<2> &bbox,
int &lx,
int &hx,
int &lz,
int &hz)
const;
173 void populateNormals();
174 void populateSurfaces();
175 void populateHeightMap(
HeightMap& heightMap);
183 WFMath::AxisBox<2> getRect()
const;
193 const std::map<long, const TerrainMod*>& getMods()
const 194 {
return m_terrainMods; }
196 int addArea(
const Area* a);
197 int updateArea(
const Area* a);
198 int removeArea(
const Area* a);
203 void invalidateSurfaces();
209 #endif // MERCATOR_SEGMENT_H Definition: HeightMap.h:13
int getZRef() const
Accessor for Global y reference of this segment.
Definition: Segment.h:87
Class storing heightfield and other data for a single fixed size square area of terrain defined by fo...
Definition: HeightMap.h:21
DataType * getData()
Accessor for a pointer to buffer containing data values.
Definition: Buffer.h:61
const Surfacestore & getSurfaces() const
Accessor for list of attached Surface objects.
Definition: Segment.h:122
const float * getNormals() const
Accessor for buffer containing surface normals.
Definition: Segment.h:152
bool isValid() const
Check whether this Segment contains valid point data.
Definition: Segment.h:94
float get(int x, int z) const
Get the height at a relative integer position in the Segment.
Definition: HeightMap.h:40
int getSize() const
Accessor for array size of this segment.
Definition: Segment.h:77
std::map< int, Surface * > Surfacestore
STL map of pointers to Surface objects.
Definition: Segment.h:39
Matrix< 2, 2, BasePoint > & getControlPoints()
Accessor for modifying 2D matrix of base points.
Definition: Segment.h:117
Class storing heightfield and other data for a single fixed size square area of terrain defined by fo...
Definition: Segment.h:36
float getMin() const
Accessor for the minimum height value in this Segment.
Definition: HeightMap.h:51
void setCornerPoint(unsigned int x, unsigned int z, const BasePoint &bp)
Set the BasePoint data for one of the four that define this Segment.
Definition: Segment.h:106
const Areastore & getAreas() const
Accessor for multimap of Area objects.
Definition: Segment.h:190
int getXRef() const
Accessor for Global x reference of this segment.
Definition: Segment.h:82
Point on the fundamental grid that is used as the basis for terrain.
Definition: BasePoint.h:19
A fixed sized array of objects.
Definition: Matrix.h:14
const Matrix< 2, 2, BasePoint > & getControlPoints() const
Accessor for 2D matrix of base points.
Definition: Segment.h:112
float getMax() const
Accessor for the maximum height value in this Segment.
Definition: Segment.h:178
bool isValid() const
Determine if this buffer has valid allocated storage.
Definition: Buffer.h:81
float getMin() const
Accessor for the minimum height value in this Segment.
Definition: Segment.h:180
std::multimap< int, const Area * > Areastore
STL multimap of pointers to Area objects affecting this segment.
Definition: Segment.h:42
float * getNormals()
Accessor for write access to buffer containing surface normals.
Definition: Segment.h:157
float * getPoints()
Accessor for write access to buffer containing height points.
Definition: Segment.h:137
const float * getPoints() const
Accessor for buffer containing height points.
Definition: Segment.h:132
int getResolution() const
Accessor for resolution of this segment.
Definition: Segment.h:72
const HeightMap & getHeightMap() const
Accessor for height map.
Definition: Segment.h:142
Surfacestore & getSurfaces()
Accessor for modifying list of attached Surface objects.
Definition: Segment.h:127
Region of terrain surface which is modified.
Definition: Area.h:28
HeightMap & getHeightMap()
Accessor for write access to height map.
Definition: Segment.h:147
float getMax() const
Accessor for the maximum height value in this Segment.
Definition: HeightMap.h:49
Base class for modifiers to the procedurally generated terrain.
Definition: TerrainMod.h:20