summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--application/main.cpp17
-rw-r--r--assetFactory/factoryMesh.cpp2
-rw-r--r--game/geoData.cpp2
-rw-r--r--game/geoData.h2
-rw-r--r--game/network/rail.cpp18
-rw-r--r--game/vehicles/linkHistory.cpp2
-rw-r--r--game/vehicles/railVehicle.cpp4
-rw-r--r--gfx/gl/sceneRenderer.cpp2
-rw-r--r--gfx/gl/shaders/landmass.fs6
-rw-r--r--gfx/gl/shaders/pointLight.fs2
-rw-r--r--gfx/gl/shaders/pointLight.vs2
-rw-r--r--gfx/gl/shaders/spotLight.fs2
-rw-r--r--gfx/gl/shaders/spotLight.vs2
-rw-r--r--gfx/gl/shaders/water.fs2
-rw-r--r--gfx/gl/shaders/water.vs4
-rw-r--r--gfx/gl/shadowMapper.cpp10
-rw-r--r--res/brush47.xml2
-rw-r--r--test/test-assetFactory.cpp14
-rw-r--r--test/test-geo.cpp10
-rw-r--r--test/test-render.cpp26
-rw-r--r--ui/gameMainWindow.cpp2
-rw-r--r--ui/manualCameraController.cpp4
-rw-r--r--ui/manualCameraController.h2
23 files changed, 70 insertions, 69 deletions
diff --git a/application/main.cpp b/application/main.cpp
index ffdaf63..01e6561 100644
--- a/application/main.cpp
+++ b/application/main.cpp
@@ -37,7 +37,7 @@ public:
int
run()
{
- geoData = std::make_shared<GeoData>(GeoData::Limits {{-120, -120}, {120, 120}}, 10.F);
+ geoData = std::make_shared<GeoData>(GeoData::Limits {{-120, -120}, {120, 120}}, 10000.F);
geoData->generateRandom();
Windows windows;
@@ -48,10 +48,10 @@ public:
{
auto rl = world.create<RailLinks>();
- const Position3D j {-1120, -1100, 3}, k {-1100, -1000, 15}, l {-1000, -800, 20}, m {-900, -600, 30},
- n {-600, -500, 32}, o {-500, -800, 30}, p {-600, -900, 25}, q {-1025, -1175, 10},
- r {-925, -1075, 10};
- const Position3D s {-1100, -500, 15}, t {-1100, -450, 15}, u {-1000, -400, 15};
+ const Position3D j {-1120000, -1100000, 3000}, k {-1100000, -1000000, 15000}, l {-1000000, -800000, 20000},
+ m {-900000, -600000, 30000}, n {-600000, -500000, 32000}, o {-500000, -800000, 30000},
+ p {-600000, -900000, 25000}, q {-1025000, -1175000, 10000}, r {-925000, -1075000, 10000};
+ const Position3D s {-1100000, -500000, 15000}, t {-1100000, -450000, 15000}, u {-1000000, -400000, 15000};
auto l3 = rl->addLinksBetween(j, k);
rl->addLinksBetween(k, l);
rl->addLinksBetween(l, m);
@@ -75,12 +75,13 @@ public:
train->create<RailVehicle>(b47);
}
train->orders.removeAll();
- train->orders.create<GoTo>(&train->orders, l3->ends[1], l3->length, rl->findNodeAt({-1100, -450, 15}));
+ train->orders.create<GoTo>(
+ &train->orders, l3->ends[1], l3->length, rl->findNodeAt({-1100000, -450000, 15000}));
train->currentActivity = train->orders.current()->createActivity();
auto foliage = std::dynamic_pointer_cast<Foliage>(assets.at("Tree-01-1"));
- for (float x = 900; x < 1100; x += 3) {
- for (float y = 900; y < 1100; y += 3) {
+ for (float x = 900000; x < 1100000; x += 3000) {
+ for (float y = 900000; y < 1100000; y += 3000) {
world.create<Plant>(foliage, Location {geoData->positionAt({-x, -y})});
}
}
diff --git a/assetFactory/factoryMesh.cpp b/assetFactory/factoryMesh.cpp
index 46bcf6f..3caf5e8 100644
--- a/assetFactory/factoryMesh.cpp
+++ b/assetFactory/factoryMesh.cpp
@@ -30,7 +30,7 @@ FactoryMesh::createMesh() const
const auto & point = mesh.point(vertex);
const auto & normal = useVertexNormals ? mesh.property(mesh.vertex_normals_pph(), vertex)
: mesh.property(mesh.face_normals_pph(), face);
- Vertex outVertex {point, textureUV, normal, colour, material};
+ Vertex outVertex {point * 1000.F, textureUV, normal, colour, material};
if (const auto existingItr = std::find(vertices.rbegin(), vertices.rend(), outVertex);
existingItr != vertices.rend()) {
faceIndices.push_back(static_cast<unsigned int>(std::distance(existingItr, vertices.rend()) - 1));
diff --git a/game/geoData.cpp b/game/geoData.cpp
index 76550cc..da067f7 100644
--- a/game/geoData.cpp
+++ b/game/geoData.cpp
@@ -31,7 +31,7 @@ GeoData::generateRandom()
std::uniform_int_distribution<> rxpos(limit.first.x + 2, limit.second.x - 2),
rypos(limit.first.y + 2, limit.second.y - 2);
std::uniform_int_distribution<> rsize(10, 30);
- std::uniform_real_distribution<float> rheight(1, 3);
+ std::uniform_real_distribution<float> rheight(1000, 3000);
for (int h = 0; h < 500;) {
const glm::ivec2 hpos {rxpos(gen), rypos(gen)};
const glm::ivec2 hsize {rsize(gen), rsize(gen)};
diff --git a/game/geoData.h b/game/geoData.h
index b3ec51d..3bceb9c 100644
--- a/game/geoData.h
+++ b/game/geoData.h
@@ -14,7 +14,7 @@ class Ray;
class GeoData {
public:
struct Node {
- float height {-1.5F};
+ float height {-1500.F};
};
using Quad = std::array<Position3D, 4>;
diff --git a/game/network/rail.cpp b/game/network/rail.cpp
index cc61db9..ff101d4 100644
--- a/game/network/rail.cpp
+++ b/game/network/rail.cpp
@@ -18,7 +18,7 @@
template class NetworkOf<RailLink>;
constexpr auto RAIL_CROSSSECTION_VERTICES {5U};
-constexpr Size3D RAIL_HEIGHT {0, 0, .25F};
+constexpr Size3D RAIL_HEIGHT {0, 0, 250.F};
RailLinks::RailLinks() : NetworkOf<RailLink> {"rails.jpg"} { }
@@ -104,11 +104,11 @@ constexpr const std::array<std::pair<Position3D, float>, RAIL_CROSSSECTION_VERTI
// ___________
// _/ \_
// left to right
- {{-1.9F, 0.F, 0.F}, 0.F},
- {{-.608F, 0.F, RAIL_HEIGHT.z}, 0.34F},
- {{0, 0.F, RAIL_HEIGHT.z * .7F}, 0.5F},
- {{.608F, 0.F, RAIL_HEIGHT.z}, 0.66F},
- {{1.9F, 0.F, 0.F}, 1.F},
+ {{-1900.F, 0.F, 0.F}, 0.F},
+ {{-608.F, 0.F, RAIL_HEIGHT.z}, .34F},
+ {{0, 0.F, RAIL_HEIGHT.z * .7F}, .5F},
+ {{608.F, 0.F, RAIL_HEIGHT.z}, .66F},
+ {{1900.F, 0.F, 0.F}, 1.F},
}};
constexpr auto sleepers {5.F}; // There are 5 repetitions of sleepers in the texture
@@ -128,7 +128,7 @@ RailLinkStraight::RailLinkStraight(Node::Ptr a, Node::Ptr b, const Position3D &
if (glGenVertexArrays) {
std::vector<Vertex> vertices;
vertices.reserve(2 * railCrossSection.size());
- const auto len = round_sleepers(length / 2.F);
+ const auto len = round_sleepers(length / 2000.F);
const auto e {flat_orientation(diff)};
for (auto ei : {1U, 0U}) {
const auto trans {glm::translate(ends[ei].node->pos) * e};
@@ -155,8 +155,8 @@ RailLinkCurve::RailLinkCurve(const Node::Ptr & a, const Node::Ptr & b, Position3
const auto & e0p {ends[0].node->pos};
const auto & e1p {ends[1].node->pos};
const auto slength = round_sleepers(length / 2.F);
- const auto segs = std::round(15.F * slength / std::pow(radius, 0.7F));
- const auto step {Position3D {arc_length(arc), e1p.z - e0p.z, slength} / segs};
+ const auto segs = std::round(slength / std::pow(radius, 0.7F));
+ const auto step {Position3D {arc_length(arc), e1p.z - e0p.z, slength / 1000.F} / segs};
const auto trans {glm::translate(centreBase)};
auto segCount = static_cast<std::size_t>(std::lround(segs)) + 1;
diff --git a/game/vehicles/linkHistory.cpp b/game/vehicles/linkHistory.cpp
index 2802109..e6bab36 100644
--- a/game/vehicles/linkHistory.cpp
+++ b/game/vehicles/linkHistory.cpp
@@ -8,7 +8,7 @@ LinkHistory::add(const Link::WPtr & l, unsigned char d)
links.insert(links.begin(), {l, d});
const auto lp = l.lock();
totalLen += lp->length;
- while (totalLen >= 1000.F && !links.empty()) {
+ while (totalLen >= 1000000.F && !links.empty()) {
totalLen -= links.back().first.lock()->length;
links.pop_back();
}
diff --git a/game/vehicles/railVehicle.cpp b/game/vehicles/railVehicle.cpp
index 6e6e18f..26536f5 100644
--- a/game/vehicles/railVehicle.cpp
+++ b/game/vehicles/railVehicle.cpp
@@ -46,9 +46,9 @@ RailVehicle::move(const Train * t, float & trailBy)
bool
RailVehicle::intersectRay(const Ray & ray, Position2D * baryPos, float * distance) const
{
- constexpr const auto X = 1.35F;
+ constexpr const auto X = 1350.F;
const auto Y = this->rvClass->length / 2.F;
- constexpr const auto Z = 3.9F;
+ constexpr const auto Z = 3900.F;
const auto moveBy = location.getTransform();
const std::array<Position3D, 8> cornerVertices {{
moveBy * glm::vec4 {-X, Y, 0, 1}, // LFB
diff --git a/gfx/gl/sceneRenderer.cpp b/gfx/gl/sceneRenderer.cpp
index 9b5510e..53178e5 100644
--- a/gfx/gl/sceneRenderer.cpp
+++ b/gfx/gl/sceneRenderer.cpp
@@ -15,7 +15,7 @@ static constexpr const std::array<const glm::i8vec4, 4> displayVAOdata {{
}};
SceneRenderer::SceneRenderer(ScreenAbsCoord s, GLuint o) :
- camera {{-1250.0F, -1250.0F, 35.0F}, quarter_pi, ratio(s), 0.1F, 10000.0F}, size {s}, output {o},
+ camera {{-1250000.0F, -1250000.0F, 35.0F}, quarter_pi, ratio(s), 100.F, 10000000.0F}, size {s}, output {o},
lighting {lighting_vs, lighting_fs}, shadowMapper {{2048, 2048}}
{
shader.setViewPort({0, 0, size.x, size.y});
diff --git a/gfx/gl/shaders/landmass.fs b/gfx/gl/shaders/landmass.fs
index 4dc92bb..9865d11 100644
--- a/gfx/gl/shaders/landmass.fs
+++ b/gfx/gl/shaders/landmass.fs
@@ -11,9 +11,9 @@ const vec3 rock = vec3(.2, .2, .1);
const vec3 sand = vec3(.76, .7, .5);
const vec3 snow = vec3(.97, .97, .99);
-const float beachline = .5;
-const float snowline_low = 28;
-const float snowline_high = 30;
+const float beachline = 500;
+const float snowline_low = 28000;
+const float snowline_high = 30000;
const float slope_min = .99;
const float slope_mid = .95;
diff --git a/gfx/gl/shaders/pointLight.fs b/gfx/gl/shaders/pointLight.fs
index bd32c05..1a68df8 100644
--- a/gfx/gl/shaders/pointLight.fs
+++ b/gfx/gl/shaders/pointLight.fs
@@ -26,5 +26,5 @@ main()
if (normalDot < 0) {
discard;
}
- FragColor = (colour * normalDot) / (1 + (kq * pow(lightDist, 2)));
+ FragColor = (colour * normalDot) / (1 + (kq * pow(lightDist / 1000.0, 2)));
}
diff --git a/gfx/gl/shaders/pointLight.vs b/gfx/gl/shaders/pointLight.vs
index b3fe7b9..7694a25 100644
--- a/gfx/gl/shaders/pointLight.vs
+++ b/gfx/gl/shaders/pointLight.vs
@@ -13,6 +13,6 @@ void
main()
{
centre = position;
- size = (8 * sqrt(max(max(colour.r, colour.g), colour.b))) / sqrt(kq);
+ size = (8000 * sqrt(max(max(colour.r, colour.g), colour.b))) / sqrt(kq);
gl_Position = vec4(centre - viewPoint, 0);
}
diff --git a/gfx/gl/shaders/spotLight.fs b/gfx/gl/shaders/spotLight.fs
index add86fd..78b8f72 100644
--- a/gfx/gl/shaders/spotLight.fs
+++ b/gfx/gl/shaders/spotLight.fs
@@ -30,5 +30,5 @@ main()
if (normalDot < 0) {
discard;
}
- FragColor = (colour * normalDot) / (1 + (kq * pow(lightDist, 2)));
+ FragColor = (colour * normalDot) / (1 + (kq * pow(lightDist / 1000.0, 2)));
}
diff --git a/gfx/gl/shaders/spotLight.vs b/gfx/gl/shaders/spotLight.vs
index e61b641..08197a4 100644
--- a/gfx/gl/shaders/spotLight.vs
+++ b/gfx/gl/shaders/spotLight.vs
@@ -18,7 +18,7 @@ main()
{
position = v_position;
direction = normalize(v_direction);
- size = (8 * sqrt(max(max(colour.r, colour.g), colour.b))) / sqrt(kq);
+ size = (8000 * sqrt(max(max(colour.r, colour.g), colour.b))) / sqrt(kq);
cosarc = cos(arc / 2);
gl_Position = vec4(position - viewPoint, 0);
}
diff --git a/gfx/gl/shaders/water.fs b/gfx/gl/shaders/water.fs
index 04aa94c..2ccc924 100644
--- a/gfx/gl/shaders/water.fs
+++ b/gfx/gl/shaders/water.fs
@@ -13,5 +13,5 @@ main()
gPosition = vec4(FragPos, 1);
gNormal = vec4(Normal, 1);
gAlbedoSpec = texture(texture0, TexCoords);
- gAlbedoSpec.a *= clamp(-FragPos.z * .7, .1, 1.0);
+ gAlbedoSpec.a *= clamp(-FragPos.z * .0007, .1, 1.0);
}
diff --git a/gfx/gl/shaders/water.vs b/gfx/gl/shaders/water.vs
index 014499f..03eabb2 100644
--- a/gfx/gl/shaders/water.vs
+++ b/gfx/gl/shaders/water.vs
@@ -10,8 +10,8 @@ uniform vec3 waves;
void
main()
{
- vec3 wpos = vec3(position.x + cos(waves.x), position.y + cos(waves.x * waves.y / 2),
- cos(waves.x + position.x + (position.y / 8)) * .3);
+ vec3 wpos = vec3(position.x + (cos(waves.x) * 1000.0), position.y + (cos(waves.x * waves.y / 2) * 1000.0),
+ cos(waves.x + (position.x / 1000.0) + (position.y * 125.0)) * 300.0);
FragPos = vec3(wpos.xy, position.z);
TexCoords = texCoord;
diff --git a/gfx/gl/shadowMapper.cpp b/gfx/gl/shadowMapper.cpp
index e4ee47a..190f20e 100644
--- a/gfx/gl/shadowMapper.cpp
+++ b/gfx/gl/shadowMapper.cpp
@@ -80,11 +80,11 @@ constexpr std::array<std::array<TextureRelRegion, ShadowMapper::SHADOW_BANDS>, S
}},
}};
constexpr std::array<float, ShadowMapper::SHADOW_BANDS + 1> shadowBands {
- 1.F,
- 250.F,
- 750.F,
- 2500.F,
- 10000.F,
+ 1000.F,
+ 250000.F,
+ 750000.F,
+ 2500000.F,
+ 10000000.F,
};
static_assert(viewports.size() == shadowMapRegions.size());
static_assert(shadowBands.size() == shadowMapRegions.size() + 1);
diff --git a/res/brush47.xml b/res/brush47.xml
index 31518c8..dc33282 100644
--- a/res/brush47.xml
+++ b/res/brush47.xml
@@ -61,7 +61,7 @@
<textureFragment id="roofSideWithVents" path="rail/roofSideWithVents.png"/>
<textureFragment id="roofTopWithVents" path="rail/roofTopWithVents.png"/>
<textureFragment id="cabWindowFront" path="rail/cabWindowFront.png"/>
- <asset p.typeid="RailVehicleClass" id="brush-47" name="Brush 47" length="19.38" wheelBase="15.70" maxSpeed="42.4688">
+ <asset p.typeid="RailVehicleClass" id="brush-47" name="Brush 47" length="19380" wheelBase="15700" maxSpeed="42468.8">
<bodyMesh id="body" size="2.69,19.38,3.9">
<use type="cuboid" position="0,0,1.2" scale="2.69,19.38,0.3" colour="goldenrod">
<face id="bottom" colour="#2c3539"/>
diff --git a/test/test-assetFactory.cpp b/test/test-assetFactory.cpp
index 9af08cb..c8183df 100644
--- a/test/test-assetFactory.cpp
+++ b/test/test-assetFactory.cpp
@@ -64,7 +64,7 @@ public:
}
void
- render(float dist = 10.f)
+ render(float dist)
{
sceneRenderer.camera.setView({-dist, dist * 1.2f, dist * 1.2f}, south + east + down);
sceneRenderer.render(*this);
@@ -104,7 +104,7 @@ BOOST_AUTO_TEST_CASE(brush47xml, *boost::unit_test::timeout(5))
auto railVehicle = std::make_shared<RailVehicle>(brush47rvc);
objects.objects.push_back(brush47rvc);
- render();
+ render(10000);
}
BOOST_AUTO_TEST_CASE(foliage, *boost::unit_test::timeout(5))
@@ -116,13 +116,13 @@ BOOST_AUTO_TEST_CASE(foliage, *boost::unit_test::timeout(5))
auto tree_01_1_f = std::dynamic_pointer_cast<Foliage>(tree_01_1);
BOOST_REQUIRE(tree_01_1_f);
- auto plant1 = std::make_shared<Plant>(tree_01_1_f, Location {{-2, 2, 0}, {0, 0, 0}});
- auto plant2 = std::make_shared<Plant>(tree_01_1_f, Location {{3, -4, 0}, {0, 1, 0}});
- auto plant3 = std::make_shared<Plant>(tree_01_1_f, Location {{-2, -4, 0}, {0, 2, 0}});
- auto plant4 = std::make_shared<Plant>(tree_01_1_f, Location {{3, 2, 0}, {0, 3, 0}});
+ auto plant1 = std::make_shared<Plant>(tree_01_1_f, Location {{-2000, 2000, 0}, {0, 0, 0}});
+ auto plant2 = std::make_shared<Plant>(tree_01_1_f, Location {{3000, -4000, 0}, {0, 1, 0}});
+ auto plant3 = std::make_shared<Plant>(tree_01_1_f, Location {{-2000, -4000, 0}, {0, 2, 0}});
+ auto plant4 = std::make_shared<Plant>(tree_01_1_f, Location {{3000, 2000, 0}, {0, 3, 0}});
objects.objects.push_back(tree_01_1_f);
- render(5);
+ render(6000);
}
BOOST_AUTO_TEST_SUITE_END();
diff --git a/test/test-geo.cpp b/test/test-geo.cpp
index 9874fb7..7404d32 100644
--- a/test/test-geo.cpp
+++ b/test/test-geo.cpp
@@ -30,7 +30,7 @@ BOOST_AUTO_TEST_CASE(initialize)
BOOST_CHECK_EQUAL(size, glm::uvec2(41, 46));
BOOST_CHECK_EQUAL(nodes.size(), 1886);
BOOST_CHECK(std::all_of(nodes.begin(), nodes.end(), [](const auto & n) {
- return n.height == -1.5F;
+ return n.height == -1500.F;
}));
}
@@ -63,12 +63,12 @@ BOOST_AUTO_TEST_CASE(gen_random)
}));
// Still an island
for (int x = limit.first.x; x <= limit.second.x; x += 1) {
- BOOST_CHECK_EQUAL(nodes[at(x, limit.first.y)].height, -1.5F);
- BOOST_CHECK_EQUAL(nodes[at(x, limit.second.y)].height, -1.5F);
+ BOOST_CHECK_EQUAL(nodes[at(x, limit.first.y)].height, -1500.F);
+ BOOST_CHECK_EQUAL(nodes[at(x, limit.second.y)].height, -1500.F);
}
for (int y = limit.first.y; y <= limit.second.y; y += 1) {
- BOOST_CHECK_EQUAL(nodes[at(limit.first.x, y)].height, -1.5F);
- BOOST_CHECK_EQUAL(nodes[at(limit.second.x, y)].height, -1.5F);
+ BOOST_CHECK_EQUAL(nodes[at(limit.first.x, y)].height, -1500.F);
+ BOOST_CHECK_EQUAL(nodes[at(limit.second.x, y)].height, -1500.F);
}
}
diff --git a/test/test-render.cpp b/test/test-render.cpp
index b16f241..766bb74 100644
--- a/test/test-render.cpp
+++ b/test/test-render.cpp
@@ -26,7 +26,7 @@ class TestScene : public SceneProvider {
std::shared_ptr<RailVehicle> train1, train2;
Terrain terrain {[]() {
- auto gd = std::make_shared<GeoData>(GeoData::Limits {{0, 0}, {100, 100}});
+ auto gd = std::make_shared<GeoData>(GeoData::Limits {{0, 0}, {100, 100}}, 10000);
gd->generateRandom();
return gd;
}()};
@@ -35,11 +35,11 @@ public:
TestScene()
{
train1 = std::make_shared<RailVehicle>(brush47rvc);
- train1->location.setPosition({52, 50, 2});
+ train1->location.setPosition({52000, 50000, 2000});
train1->bogies.front().setPosition(train1->bogies.front().position() + train1->location.position());
train1->bogies.back().setPosition(train1->bogies.back().position() + train1->location.position());
train2 = std::make_shared<RailVehicle>(brush47rvc);
- train2->location.setPosition({52, 30, 2});
+ train2->location.setPosition({52000, 30000, 2000});
train2->bogies.front().setPosition(train2->bogies.front().position() + train2->location.position());
train2->bogies.back().setPosition(train2->bogies.back().position() + train2->location.position());
}
@@ -88,7 +88,7 @@ BOOST_FIXTURE_TEST_SUITE(w, TestRenderOutput);
BOOST_AUTO_TEST_CASE(basic)
{
SceneRenderer ss {size, output};
- ss.camera.setView({-10, -10, 60}, glm::normalize(glm::vec3 {1, 1, -0.5F}));
+ ss.camera.setView({-10000, -10000, 60000}, glm::normalize(glm::vec3 {1, 1, -0.5F}));
const TestScene scene;
ss.render(scene);
Texture::save(outImage, "/tmp/basic.tga");
@@ -97,7 +97,7 @@ BOOST_AUTO_TEST_CASE(basic)
BOOST_AUTO_TEST_CASE(pointlight)
{
SceneRenderer ss {size, output};
- ss.camera.setView({-10, -10, 60}, glm::normalize(glm::vec3 {1, 1, -0.5F}));
+ ss.camera.setView({-10000, -10000, 60000}, glm::normalize(glm::vec3 {1, 1, -0.5F}));
class PointLightScene : public TestScene {
public:
@@ -111,9 +111,9 @@ BOOST_AUTO_TEST_CASE(pointlight)
void
lights(const SceneShader & shader) const override
{
- for (int x = 50; x < 100; x += 20) {
- for (int y = 50; y < 2000; y += 20) {
- shader.pointLight.add({x, y, 4}, {1.0, 1.0, 1.0}, 0.1F);
+ for (int x = 50000; x < 100000; x += 20000) {
+ for (int y = 50000; y < 2000000; y += 20000) {
+ shader.pointLight.add({x, y, 4000}, {1.0, 1.0, 1.0}, 0.1F);
}
}
}
@@ -127,7 +127,7 @@ BOOST_AUTO_TEST_CASE(pointlight)
BOOST_AUTO_TEST_CASE(spotlight)
{
SceneRenderer ss {size, output};
- ss.camera.setView({-10, -10, 60}, glm::normalize(glm::vec3 {1, 1, -0.5F}));
+ ss.camera.setView({-10000, -10000, 60000}, glm::normalize(glm::vec3 {1, 1, -0.5F}));
class PointLightScene : public TestScene {
public:
@@ -141,10 +141,10 @@ BOOST_AUTO_TEST_CASE(spotlight)
void
lights(const SceneShader & shader) const override
{
- shader.spotLight.add({50, 50, 15}, down, {1.0, 1.0, 1.0}, 0.01F, 1);
- shader.spotLight.add({51, 59.5, 1}, north, {1.0, 1.0, 1.0}, 0.001F, .5);
- shader.spotLight.add({53, 59.5, 1}, north, {1.0, 1.0, 1.0}, 0.001F, .5);
- shader.spotLight.add({60, 50, 3}, north + east, {1.0, 1.0, 1.0}, 0.0001F, .7F);
+ shader.spotLight.add({50000, 50000, 15000}, down, {1.0, 1.0, 1.0}, 0.01F, 1);
+ shader.spotLight.add({51000, 59500, 1000}, north, {1.0, 1.0, 1.0}, 0.001F, .5);
+ shader.spotLight.add({53000, 59500, 1000}, north, {1.0, 1.0, 1.0}, 0.001F, .5);
+ shader.spotLight.add({60000, 50000, 3000}, north + east, {1.0, 1.0, 1.0}, 0.0001F, .7F);
}
};
diff --git a/ui/gameMainWindow.cpp b/ui/gameMainWindow.cpp
index 15f1e07..7cf143a 100644
--- a/ui/gameMainWindow.cpp
+++ b/ui/gameMainWindow.cpp
@@ -31,7 +31,7 @@ public:
GameMainWindow::GameMainWindow(size_t w, size_t h) :
Window {w, h, "I Like Trains", SDL_WINDOW_OPENGL}, SceneRenderer {Window::size, 0}
{
- uiComponents.create<ManualCameraController>(Position2D {-1150, -1150});
+ uiComponents.create<ManualCameraController>(Position2D {-1150000, -1150000});
auto gms = uiComponents.create<GameMainSelector>(&camera, ScreenAbsCoord {w, h});
uiComponents.create<GameMainToolbar>(gms.get());
}
diff --git a/ui/manualCameraController.cpp b/ui/manualCameraController.cpp
index 05c1fc5..f6993a8 100644
--- a/ui/manualCameraController.cpp
+++ b/ui/manualCameraController.cpp
@@ -59,12 +59,12 @@ ManualCameraController::handleInput(const SDL_Event & e, const Position &)
pitch = std::clamp(pitch - 0.01F * static_cast<float>(e.motion.yrel), 0.1F, half_pi);
}
else {
- focus += rotate_flat(-direction) * Position2D {-e.motion.xrel, e.motion.yrel};
+ focus += rotate_flat(-direction) * (Position2D {-e.motion.xrel, e.motion.yrel} * dist / 2.0F);
}
}
return true;
case SDL_MOUSEWHEEL:
- dist = std::clamp(dist - static_cast<float>(e.wheel.y) * 4.F, 5.F, 200.F);
+ dist = std::clamp(dist - static_cast<float>(e.wheel.y) * 400.F, 5.F, 200000.F);
break;
}
return false;
diff --git a/ui/manualCameraController.h b/ui/manualCameraController.h
index 46655bc..1efaee1 100644
--- a/ui/manualCameraController.h
+++ b/ui/manualCameraController.h
@@ -22,5 +22,5 @@ private:
bool ctrl {false}, mrb {false};
Position2D focus;
float direction {quarter_pi};
- float dist {40}, pitch {quarter_pi};
+ float dist {4000}, pitch {quarter_pi};
};