File: Segmenttest.cpp

package info (click to toggle)
mercator 0.3.0-2
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 2,008 kB
  • sloc: sh: 10,433; cpp: 4,482; makefile: 115
file content (55 lines) | stat: -rw-r--r-- 1,128 bytes parent folder | download | duplicates (3)
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
// This file may be redistributed and modified only under the terms of
// the GNU General Public License (See COPYING for details).
// Copyright (C) 2009 Alistair Riddoch

#include <Mercator/Segment.h>

#include <wfmath/point.h>
#include <wfmath/axisbox.h>

int main()
{
    Mercator::Segment s(0,0,64);

    s.populate();
    s.populateNormals();
    s.populateSurfaces();
    s.invalidate();

    s.populate();
    s.populateNormals();
    s.populateSurfaces();

    float h;
    WFMath::Vector<3> normal;
    s.getHeightAndNormal(17.0, 23.0, h, normal);
    s.getHeightAndNormal(17.9, 23.1, h, normal);
    s.getHeightAndNormal(17.1, 23.9, h, normal);

    int lx, ly, hx, hy;
    s.clipToSegment(WFMath::AxisBox<2>(WFMath::Point<2>(50,50), WFMath::Point<2>(100,100)), lx, hx, ly, hy);

    return 0;
}

// stubs

#include <Mercator/Shader.h>
#include <Mercator/Surface.h>

namespace Mercator {

const float BasePoint::HEIGHT = 8.0;
const float BasePoint::ROUGHNESS = 1.25;
const float BasePoint::FALLOFF = 0.25;

void Surface::populate()
{
}

Surface * Shader::newSurface(const Segment & segment) const
{
    return 0;
}

}