add some sunlight

This commit is contained in:
2020-12-26 21:46:12 +01:00
parent a6d3f3d779
commit ef37119f4e
3 changed files with 36 additions and 13 deletions

View File

@ -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();