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 
10 namespace Mercator {
11 
12 FillShader::FillShader() = default;
13 
15 {
16 }
17 
18 FillShader::~FillShader() = default;
19 
21 {
22  return true;
23 }
24 
25 void FillShader::shade(Surface & s) const
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
Mercator::FillShader::FillShader
FillShader()
Constructor.
Mercator::Surface::getSegment
const Segment & getSegment() const
Accessor for the terrain height segment this surface is associated with.
Definition: Surface.h:37
Mercator::Buffer::getChannels
unsigned int getChannels() const
Accessor for the number of data values per height point.
Definition: Buffer.h:58
Mercator::Segment
Class storing heightfield and other data for a single fixed size square area of terrain defined by fo...
Definition: Segment.h:37
Mercator::Surface
Data store for terrain surface data.
Definition: Surface.h:23
Mercator::FillShader::checkIntersect
bool checkIntersect(const Segment &) const override
Check whether this Shader has any effect on the given Segment.
Definition: FillShader.cpp:20
Mercator::Segment::getSize
int getSize() const
Accessor for array size of this segment.
Definition: Segment.h:88
Mercator::Buffer::getData
DataType * getData()
Accessor for a pointer to buffer containing data values.
Definition: Buffer.h:63
Mercator::FillShader::shade
void shade(Surface &) const override
Populate a Surface with data.
Definition: FillShader.cpp:25
Mercator::Shader::Parameters
std::map< std::string, float > Parameters
STL map of parameter values for a shader constructor.
Definition: Shader.h:59