简体   繁体   English

Qt,C ++,3D矩阵立方体

[英]Qt, C++, 3D Matrix Cube

I am not a very experienced Qt C++ Programmer, but unfortunately I have to create a 3D Cube containing 8x8x8 points. 我不是一个经验丰富的Qt C ++程序员,但不幸的是,我必须创建一个包含8x8x8点的3D多维数据集。

I already found the Qt tutorial to create a simple cube, but I am completely lost on how to make it hollow and draw the 512point matrix within the cube. 我已经找到了Qt教程来创建一个简单的多维数据集,但是我完全迷失了如何使其变得空心并在多维数据集中绘制512点矩阵。 Furthermore the goal is to change the color of specific points within this matrix. 此外,目标是更改此矩阵内特定点的颜色。 Anybody know how to proceed? 有人知道如何进行吗?

Thank you in advance! 先感谢您!

在此处输入图片说明

https://github.com/peteristhegreat/circles-in-a-cube https://github.com/peteristhegreat/circles-in-a-cube

Check out the awesome example I put together! 看看我整理的很棒的例子!

Basically I took the Grabber example and did some modifications to it. 基本上,我以Grabber示例为例,并对它进行了一些修改。

http://doc.qt.io/qt-5/examples-widgets-opengl.html http://doc.qt.io/qt-5/examples-widgets-opengl.html

http://doc.qt.digia.com/qt-quick3d-snapshot/qt3d-examples.html http://doc.qt.digia.com/qt-quick3d-snapshot/qt3d-examples.html

http://doc.qt.digia.com/qt-5.2/qtopengl-grabber-example.html http://doc.qt.digia.com/qt-5.2/qtopengl-grabber-example.html

It looks like you could modify this one to something similar. 看来您可以将其修改为类似内容。

http://doc.qt.io/qt-5/qtopengl-hellogl2-example.html http://doc.qt.io/qt-5/qtopengl-hellogl2-example.html

The core features of what is going on, is holding on to information about the individual spheres and modifying them when you need to. 正在进行的工作的核心功能是保留有关各个领域的信息,并在需要时进行修改。

To hold the pointers to sphere objects, I used two different lists. 为了保留指向球形对象的指针,我使用了两个不同的列表。

One is a straight forward QList , and the other is a 3D Vector. 一个是简单的QList ,另一个是3D矢量。 The 3D QVector allows you to access a sphere pointer with spheresInSpace[x][y][z] , where x , y , z are any integer between 0-7. 3D QVector允许您使用spheresInSpace[x][y][z]访问球体指针,其中xyz是0到7之间的任何整数。

To change the colors of the spheres, I change the reflectance values. 要更改球体的颜色,请更改反射率值。

Hope that helps. 希望能有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM