mercator  0.4.0
A terrain generation library for the Worldforge system.
TileShader.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) 2005 Alistair Riddoch
4 
5 #ifndef MERCATOR_TILE_SHADER_H
6 #define MERCATOR_TILE_SHADER_H
7 
8 #include "Shader.h"
9 
10 #include <map>
11 
12 namespace Mercator {
13 
21 class TileShader : public Shader {
22  public:
24  typedef std::map<int, std::unique_ptr<Shader>> Shaderstore;
25  private:
27  Shaderstore m_subShaders;
28  public:
29  explicit TileShader();
30 
31  ~TileShader() override;
32 
34  void addShader(std::unique_ptr<Shader> t, int id) {
35  m_subShaders[id] = std::move(t);
36  }
37 
38  bool checkIntersect(const Segment &) const override;
39 
40  void shade(Surface &) const override;
41 };
42 
43 } // namespace Mercator
44 
45 #endif // MERCATOR_TILE_SHADER_H
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
Shader agregating surface data.
Definition: TileShader.h:21
std::map< int, std::unique_ptr< Shader > > Shaderstore
STL map to store sparse array of Shader pointers.
Definition: TileShader.h:24
void addShader(std::unique_ptr< Shader > t, int id)
Add a shader to those agregated by the tile shader.
Definition: TileShader.h:34
void shade(Surface &) const override
Populate a Surface with data.
Definition: TileShader.cpp:23
bool checkIntersect(const Segment &) const override
Check whether this Shader has any effect on the given Segment.
Definition: TileShader.cpp:18