This commit is contained in:
2018-03-27 14:04:31 +02:00
parent d746a253be
commit 0b0db2b706
8 changed files with 109 additions and 99 deletions

View File

@@ -295,7 +295,7 @@ void MapView3D::draw() {
V.rotate(rot.z, 0.0, 0.0, 1.0);
V.translate(center.x, center.y, center.z);
float far = 200; // TODO
float farPlane = 200; // TODO
// projection
QMatrix4x4 P;
@@ -306,14 +306,14 @@ void MapView3D::draw() {
float h = height() / 30;
viewport.size.x = w;
viewport.size.y = h;
P.perspective(45.0f, aspect, 0.01, far);
P.perspective(45.0f, aspect, 0.01, farPlane);
} else {
// default size: 50 * 50/aspect meters
float w = 50.0f;
float h = 50.0f * height() / width();
viewport.size.x = w;
viewport.size.y = h;
P.ortho(-w, +w, -h, +h, 0.1f, +far);
P.ortho(-w, +w, -h, +h, 0.1f, +farPlane);
}
rs.shader->bind();