This repository has been archived by the owner on Dec 3, 2023. It is now read-only.
/
IHeightMapSegment.h
66 lines (53 loc) · 2.02 KB
/
IHeightMapSegment.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/*
Copyright (C) 2010 Erik Ogenvik <erik@ogenvik.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef EMBEROGRETERRAINIHEIGHTMAPSEGMENT_H_
#define EMBEROGRETERRAINIHEIGHTMAPSEGMENT_H_
#include "Types.h"
namespace WFMath {
template<int>
class Vector;
}
namespace Ember {
namespace OgreView {
namespace Terrain {
/**
* @author Erik Ogenvik <erik@ogenvik.org>
* @brief Represents one segment (mapped to a Mercator::Segment) in the height map.
*/
struct IHeightMapSegment {
virtual ~IHeightMapSegment() = default;
/**
* @brief Gets the height at the specified location.
* This is a crude and fast lookup method which won't take into account slopes.
* @see getHeightAndNormal()
* @param x The x location, in world units.
* @param y The y location, in world units.
* @returns The height at the location.
*/
virtual float getHeight(int x, int y) const = 0;
/**
* @brief Gets the height and normal at the location.
* This calculates slopes and provides a precise height. It's therefore more time consuming than getHeight().
* @param x The x location, in world units.
* @param y The y location, in world units.
* @param height The height will be stored here.
* @param normal The normal will be stored here.
*/
virtual void getHeightAndNormal(float x, float y, float& height, WFMath::Vector<3>& normal) const = 0;
};
}
}
}
#endif /* EMBEROGRETERRAINIHEIGHTMAPSEGMENT_H_ */