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 
13 namespace Mercator {
14 
15 class Shader;
16 
17 typedef unsigned char ColorT;
18 
19 static const ColorT colorMax = UCHAR_MAX;
20 static const ColorT colorMin = 0;
21 
23 class Surface : public Buffer<ColorT> {
24  public:
26  const Shader & m_shader;
28  const Segment & m_segment;
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
Data store for terrain surface data.
Definition: Surface.h:23
void populate()
Populate the data buffer using the correct shader.
Definition: Surface.cpp:27
Class storing heightfield and other data for a single fixed size square area of terrain defined by fo...
Definition: Segment.h:37
const Segment & m_segment
The terrain height segment this buffer is associated with.
Definition: Surface.h:28
Base class for Shader objects which create surface data for use when rendering terrain.
Definition: Shader.h:25
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
Surface(const Segment &segment, const Shader &shader, bool colors=true, bool alpha=true)
Constructor.
Definition: Surface.cpp:18