mercator 0.4.0
A terrain generation library for the Worldforge system.
FillShader.cpp
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#include "FillShader.h"
6
7#include "Segment.h"
8#include "Surface.h"
9
10namespace Mercator {
11
12FillShader::FillShader() = default;
13
15{
16}
17
18FillShader::~FillShader() = default;
19
21{
22 return true;
23}
24
26{
27 unsigned int channels = s.getChannels();
28 ColorT * data = s.getData();
29 unsigned int size = s.getSegment().getSize();
30
31 unsigned int buflen = size * size * channels;
32 for (unsigned int i = 0; i < buflen; ++i) {
33 data[i] = colorMax;
34 }
35}
36
37} // namespace Mercator
DataType * getData()
Accessor for a pointer to buffer containing data values.
Definition: Buffer.h:63
unsigned int getChannels() const
Accessor for the number of data values per height point.
Definition: Buffer.h:58
FillShader()
Constructor.
bool checkIntersect(const Segment &) const override
Check whether this Shader has any effect on the given Segment.
Definition: FillShader.cpp:20
void shade(Surface &) const override
Populate a Surface with data.
Definition: FillShader.cpp:25
Class storing heightfield and other data for a single fixed size square area of terrain defined by fo...
Definition: Segment.h:37
int getSize() const
Accessor for array size of this segment.
Definition: Segment.h:88
std::map< std::string, float > Parameters
STL map of parameter values for a shader constructor.
Definition: Shader.h:59
Data store for terrain surface data.
Definition: Surface.h:23
const Segment & getSegment() const
Accessor for the terrain height segment this surface is associated with.
Definition: Surface.h:37