Mercator
AreaShader.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_AREASHADER_H
6 #define MERCATOR_AREASHADER_H
7 
8 #include <Mercator/Shader.h>
9 
10 namespace Mercator
11 {
12 
13 class Area;
14 
16 class AreaShader : public Shader
17 {
18 public:
22  AreaShader(int layer);
23 
24  virtual void shade(Surface &s) const;
25 
26  virtual bool checkIntersect(const Segment &) const;
27 private:
29  void shadeArea(Surface& s, const Area* const ar) const;
30 
32  int m_layer;
33 };
34 
35 }
36 
37 #endif // of MERCATOR_AREASHADER_H
Mercator::AreaShader::shadeArea
void shadeArea(Surface &s, const Area *const ar) const
helper to shader a single area into the surface
Definition: AreaShader.cpp:239
Mercator::Buffer::getSegment
const Segment & getSegment() const
Accessor for the terrain height segment this buffer is associated with.
Definition: Buffer.h:55
Mercator::EdgeAtY::EdgeAtY
EdgeAtY(WFMath::CoordType y)
Definition: AreaShader.cpp:98
Mercator::Segment::getSize
const int getSize() const
Accessor for array size of this segment.
Definition: Segment.h:81
Mercator::Segment
Class storing heightfield and other data for a single fixed size square area of terrain defined by fo...
Definition: Segment.h:36
Mercator::AreaShader
Shader for handling areas.
Definition: AreaShader.h:16
Mercator::Edge
The edge of an area.
Definition: AreaShader.cpp:32
Mercator::Buffer::m_segment
const Segment & m_segment
The terrain height segment this buffer is associated with.
Definition: Buffer.h:17
Mercator::Edge::m_seg
Vector2 m_seg
The vector describing the edge from its start.
Definition: AreaShader.cpp:86
Mercator::Surface
Data store for terrain surface data.
Definition: Surface.h:22
Mercator::Segment::getAreas
const Areastore & getAreas() const
Accessor for multimap of Area objects.
Definition: Segment.h:195
Mercator::Edge::end
Point2 end() const
Determine the point describing the end of the edge.
Definition: AreaShader.cpp:60
Mercator::Area
Region of terrain surface which is modified.
Definition: Area.h:28
Mercator::Edge::start
Point2 start() const
Accessor for the point describing the start of the edge.
Definition: AreaShader.cpp:58
Mercator::Segment::getRect
WFMath::AxisBox< 2 > getRect() const
The 2d area covered by this segment.
Definition: Segment.cpp:752
Mercator::EdgeAtY
The edge of an area parallel to the x axis.
Definition: AreaShader.cpp:92
Mercator::Buffer::getData
DataType * getData()
Accessor for a pointer to buffer containing data values.
Definition: Buffer.h:70
Mercator::Segment::Areastore
std::multimap< int, const Area * > Areastore
STL multimap of pointers to Area objects affecting this segment.
Definition: Segment.h:42
Mercator::AreaShader::AreaShader
AreaShader(int layer)
Constructor.
Definition: AreaShader.cpp:205
Mercator::EdgeAtY::m_y
WFMath::CoordType m_y
The coordinate on the y axis of the edge.
Definition: AreaShader.cpp:107
Mercator::AreaShader::checkIntersect
virtual bool checkIntersect(const Segment &) const
Check whether this Shader has any effect on the given Segment.
Definition: AreaShader.cpp:212
Mercator::Edge::operator<
bool operator<(const Edge &other) const
Compare the y coordinate of the start with another edge.
Definition: AreaShader.cpp:78
Mercator::AreaShader::m_layer
int m_layer
The layer number.
Definition: AreaShader.h:32
Mercator::Shader
Base class for Shader objects which create surface data for use when rendering terrain.
Definition: Shader.h:29
Mercator::Edge::m_inverseGradient
WFMath::CoordType m_inverseGradient
The inverse of the gradient of the line.
Definition: AreaShader.cpp:88
Mercator::Edge::m_start
Point2 m_start
The point describing the start of the edge.
Definition: AreaShader.cpp:84
Mercator::Edge::Edge
Edge(const Point2 &a, const Point2 &b)
Constructor.
Definition: AreaShader.cpp:39
Mercator::Edge::xValueAtY
WFMath::CoordType xValueAtY(WFMath::CoordType y) const
Determine the x coordinate at a given y coordinate.
Definition: AreaShader.cpp:67
Mercator::EdgeAtY::operator()
bool operator()(const Edge &u, const Edge &v) const
Determine which edge crosses this edge at a lower x coordinate.
Definition: AreaShader.cpp:101
Mercator::AreaShader::shade
virtual void shade(Surface &s) const
Populate a Surface with data.
Definition: AreaShader.cpp:218
Mercator::Area::clipToSegment
WFMath::Polygon< 2 > clipToSegment(const Segment &s) const
Clip the shape of this area to a given segment.
Definition: Area.cpp:284
Mercator::Buffer::getSize
unsigned int getSize() const
Accessor for the size of segment, m_res + 1.
Definition: Buffer.h:60