什么是3D结构最简单的文件格式?

时间:2013-08-16 11:01:59

标签: c 3d data-visualization file-format

从我的计算中,我有很多原始数据字节。我想将它们视为图像,而不是3D相对标准文件。 (c.f.关于PPM的上一个问题:What is the simplest RGB image format?

我想在文件中添加一些标题和一堆struct point,并使用标准的3d文件查看器(如g3dviewer)打开此文件。

struct point {
    unsigned int x; // coordinates
    unsigned int y;
    unsigned int z;
    unsigned char r; // color
    unsigned char g;
    unsigned char b;
}

我已经查看了.OBJ文件格式,但它强制我翻译描述立方顶点的文本行中的每个点。

这种简单的3D文件格式是否存在?

1 个答案:

答案 0 :(得分:2)

PLY格式非常简单。

ply
format ascii 1.0
comment object: vertex cloud
element vertex 8
property uint x
property uint y
property uint z
property uchar red                   { start of vertex color }
property uchar green
property uchar blue
end_header
0 0 0 255 0 0                         { start of vertex list }
0 0 1 255 0 0
0 1 1 255 0 0
0 1 0 255 0 0
[...]

在第4行中,定义了顶点数。