diff options
author | ccolin | 2020-12-26 21:46:12 +0100 |
---|---|---|
committer | ccolin | 2020-12-26 21:46:12 +0100 |
commit | ef37119f4e94c83a6357ebc0b94a39e4e53b20d7 (patch) | |
tree | 87169f8b50d5a2013acad8cf4ac4661ecb7f57a7 /src/drone_controller.cc | |
parent | a6d3f3d779b031f8ca70510abe90fade909a8d0d (diff) |
add some sunlight
Diffstat (limited to 'src/drone_controller.cc')
-rw-r--r-- | src/drone_controller.cc | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/drone_controller.cc b/src/drone_controller.cc index 2c956dd..c41721e 100644 --- a/src/drone_controller.cc +++ b/src/drone_controller.cc @@ -62,11 +62,17 @@ Drone::Drone() { tinyobj::real_t vx = attrib.vertices[3*idx.vertex_index+0]; tinyobj::real_t vy = attrib.vertices[3*idx.vertex_index+1]; tinyobj::real_t vz = attrib.vertices[3*idx.vertex_index+2]; + tinyobj::real_t nx = attrib.normals[3*idx.normal_index+0]; + tinyobj::real_t ny = attrib.normals[3*idx.normal_index+1]; + tinyobj::real_t nz = attrib.normals[3*idx.normal_index+2]; tinyobj::real_t ts = attrib.texcoords[2*idx.texcoord_index+0]; tinyobj::real_t tt = attrib.texcoords[2*idx.texcoord_index+1]; verts.append(vx); verts.append(vy); verts.append(vz); + verts.append(nx); + verts.append(ny); + verts.append(nz); verts.append(ts); verts.append(tt); // qDebug() << "vert" << vx << vy << vz << "tex" << ts << tt; @@ -143,12 +149,12 @@ DroneController::DroneController(const QJsonObject &json) OpenGLWidget::instance->makeCurrent(); QOpenGLTexture *ground_tex = new QOpenGLTexture(QImage(":/mdl/ground.jpg").mirrored()); OpenGLMesh *ground = new OpenGLMesh({ - -100, 0, -100, 0, 0, - 100, 0, -100, 1, 0, - -100, 0, 100, 0, 1, - 100, 0, -100, 1, 0, - -100, 0, 100, 0, 1, - 100, 0, 100, 1, 1, + -100, 0, -100, 0, 1, 0, 0, 0, + 100, 0, -100, 0, 1, 0, 1, 0, + -100, 0, 100, 0, 1, 0, 0, 1, + 100, 0, -100, 0, 1, 0, 1, 0, + -100, 0, 100, 0, 1, 0, 0, 1, + 100, 0, 100, 0, 1, 0, 1, 1, }, ground_tex); OpenGLWidget::instance->meshes.append(*ground); OpenGLWidget::instance->doneCurrent(); |