mercator 0.4.0
A terrain generation library for the Worldforge system.
Surface.h
1// This file may be redistributed and modified only under the terms of
2// the GNU General Public License (See COPYING for details).
3// Copyright (C) 2003 Alistair Riddoch
4
5#ifndef MERCATOR_SURFACE_H
6#define MERCATOR_SURFACE_H
7
8#include "Buffer.h"
9#include "Segment.h"
10
11#include <climits>
12
13namespace Mercator {
14
15class Shader;
16
17typedef unsigned char ColorT;
18
19static const ColorT colorMax = UCHAR_MAX;
20static const ColorT colorMin = 0;
21
23class Surface : public Buffer<ColorT> {
24 public:
29
30 explicit Surface(const Segment & segment, const Shader & shader,
31 bool colors = true, bool alpha = true);
32 ~Surface() override = default;
33
34 void populate();
35
37 const Segment & getSegment() const {
38 return m_segment;
39 }
40 // Do we need an accessor presenting the array in colour form?
41};
42
43} // namespace Mercator
44
45#endif // MERCATOR_SURFACE_H
Template for managing buffers of data for a segment.
Definition: Buffer.h:14
Class storing heightfield and other data for a single fixed size square area of terrain defined by fo...
Definition: Segment.h:37
Base class for Shader objects which create surface data for use when rendering terrain.
Definition: Shader.h:25
Data store for terrain surface data.
Definition: Surface.h:23
Surface(const Segment &segment, const Shader &shader, bool colors=true, bool alpha=true)
Constructor.
Definition: Surface.cpp:18
void populate()
Populate the data buffer using the correct shader.
Definition: Surface.cpp:27
const Segment & getSegment() const
Accessor for the terrain height segment this surface is associated with.
Definition: Surface.h:37
const Shader & m_shader
The shader that populates this surface.
Definition: Surface.h:26
const Segment & m_segment
The terrain height segment this buffer is associated with.
Definition: Surface.h:28