如何从 3d 点数组在 Qt 中绘制和保存 3D 模型?
How to draw and save 3D model in Qt from an array of 3d points?
在我的程序中,我有一个带有 X 的点数组;是; Z坐标。我需要能够根据这些点的坐标绘制 3d 模型并将其保存在文件中。
我卡住了。任务似乎并没有那么困难,看起来我只需要一些常见的 3d 格式,这样我就可以放置这个坐标并将其保存为一些 3d 模型。然后使用 QtOpenGL 加载。但是我不知道从哪里开始。
Qt 有一个 tutorial on importing and displaying 3ds models. It's not exactly what you wanted, since it does not operate with array of 3d point coordinates, but how about editing the model in Maya/Blender/anything else that can export 3ds and loading it this way? Moreover (I haven't tried this, but at least according to the documentation it seems a viable approach), you can access the model through QGLAbstractScene::mainNode(), then obtain the geometry of the mesh through QGLSceneNode::geometry() and then edit the vertices of QGeometryData 实例。也可以从您的点数组构造一个新的几何实例并渲染它,但我不能为此提供一个片段,您应该查看文档。
在我的程序中,我有一个带有 X 的点数组;是; Z坐标。我需要能够根据这些点的坐标绘制 3d 模型并将其保存在文件中。
我卡住了。任务似乎并没有那么困难,看起来我只需要一些常见的 3d 格式,这样我就可以放置这个坐标并将其保存为一些 3d 模型。然后使用 QtOpenGL 加载。但是我不知道从哪里开始。
Qt 有一个 tutorial on importing and displaying 3ds models. It's not exactly what you wanted, since it does not operate with array of 3d point coordinates, but how about editing the model in Maya/Blender/anything else that can export 3ds and loading it this way? Moreover (I haven't tried this, but at least according to the documentation it seems a viable approach), you can access the model through QGLAbstractScene::mainNode(), then obtain the geometry of the mesh through QGLSceneNode::geometry() and then edit the vertices of QGeometryData 实例。也可以从您的点数组构造一个新的几何实例并渲染它,但我不能为此提供一个片段,您应该查看文档。