summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gfx/gl/shaders/network.fs2
-rw-r--r--gfx/gl/shaders/networkCommon.glsl6
-rw-r--r--test/test-render.cpp4
3 files changed, 8 insertions, 4 deletions
diff --git a/gfx/gl/shaders/network.fs b/gfx/gl/shaders/network.fs
index e7d15b3..4e347b4 100644
--- a/gfx/gl/shaders/network.fs
+++ b/gfx/gl/shaders/network.fs
@@ -11,7 +11,7 @@ uniform ivec3 viewPoint;
void
main()
{
- gPosition = ivec4(viewPoint + rposition, 0);
+ gPosition = ivec4(viewPoint + rposition, 1);
gNormal = vec4(0, 0, 1, 1);
gAlbedoSpec = texture(texture0, texCoord);
}
diff --git a/gfx/gl/shaders/networkCommon.glsl b/gfx/gl/shaders/networkCommon.glsl
index 7b55cad..0bc3c1c 100644
--- a/gfx/gl/shaders/networkCommon.glsl
+++ b/gfx/gl/shaders/networkCommon.glsl
@@ -21,9 +21,9 @@ ifelse(
TYPE, .gs,
// Begin: Geometry shader only function
void doVertex(const ivec3 end, const uint v, const float texY, const mat2 rot) {
- rposition = vec3(rot * profile[v].xy, profile[v].z);
- ivec3 vpos = end + ivec3(rposition);
- gl_Position = viewProjection * vec4(vpos - viewPoint, 1);
+ ivec3 vpos = end + ivec3(rot * profile[v].xy, profile[v].z);
+ rposition = vpos - viewPoint;
+ gl_Position = viewProjection * vec4(rposition, 1);
texCoord = vec2(texturePos[v], texY);
EmitVertex();
}
diff --git a/test/test-render.cpp b/test/test-render.cpp
index cc2bba2..6c20a23 100644
--- a/test/test-render.cpp
+++ b/test/test-render.cpp
@@ -25,6 +25,7 @@ class TestScene : public SceneProvider {
const RailVehicleClassPtr brush47rvc = std::dynamic_pointer_cast<RailVehicleClass>(
AssetFactory::loadXML(RESDIR "/brush47.xml")->assets.at("brush-47"));
std::shared_ptr<RailVehicle> train1, train2;
+ RailLinks rail;
Terrain terrain {[]() {
auto gd = std::make_shared<GeoData>(GeoData::createFlat({0, 0}, {1000000, 1000000}, 1));
@@ -42,6 +43,8 @@ public:
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());
+ rail.addLinksBetween({42000, 50000, 1000}, {65000, 50000, 1000});
+ rail.addLinksBetween({65000, 50000, 1000}, {75000, 45000, 2000});
}
void
@@ -49,6 +52,7 @@ public:
{
terrain.render(shader);
brush47rvc->render(shader);
+ rail.render(shader);
}
void