3Д принтеры и всё что с ними связано

ЗД принтеры АБС пластик

Making It Solid: Triangles

Triangles in MD2 files are made using vertex indexes. For each tri­angle, three two-byte integer values are stored, each representing a vertex in the vertex array. If the three values are 4, 6, and 14, those values can be used to index into the vertices of the current frame. All frames use the same triangle indexes when being drawn.

The triangle structure looks like this:

Making It Solid: Triangles

Making It Solid: Triangles

Figure 3.3 An MD2 model with only the vertices rendered. You can see a rough outline of the model beginning to take shape.

struct SMD2Tri {

unsigned short m_sVertIndices[3]; unsigned short m_sTexIndices[3];


Exactly m_iNumTriangles of these structures is stored at

m_uiOffsetTriangles bytes in the file.

In addition to the three vertex indexes, each triangle contains the same amount of indexes into the texture coordinate array, which you will get to in a second. Each vertex index has an accompanying index into the array of texture coordinates. This allows textures to be added easily.

Using this information, you can draw the whole model as triangles as shown in Figure 3.4. Finally, the model is starting to look decent; all it really needs are some textures.

Your email address will not be published. Required fields are marked *